[Orxonox-commit 6062] r10721 - in code/branches/fabienHS15: data/levels/includes data/levels/templates data/overlays src/modules/overlays/hud src/modules/pickup/items src/orxonox/overlays src/orxonox/weaponsystem
fvultier at orxonox.net
fvultier at orxonox.net
Thu Oct 29 23:27:33 CET 2015
Author: fvultier
Date: 2015-10-29 23:27:32 +0100 (Thu, 29 Oct 2015)
New Revision: 10721
Added:
code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.cc
code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.h
Modified:
code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi
code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h
code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc
code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h
code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc
Log:
Modified: code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi
===================================================================
--- code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi 2015-10-29 22:27:32 UTC (rev 10721)
@@ -14,13 +14,13 @@
<DefaultWeaponmodeLink firemode=1 weaponmode=1 />
</links>
<Weapon>
- <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset="11,0,-3" freezefactor=0.5 freezetime=2.0 />
+ <IceGun mode=0 munitionpershot=1 delay=0.125 damage=9.3 muzzleoffset="11,0,-3" freezefactor=0.5 freezetime=2.0 />
</Weapon>
<Weapon>
- <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" -11,0,-3" freezefactor=0.5 freezetime=2.0 />
+ <IceGun mode=0 munitionpershot=1 delay=0.125 damage=9.3 muzzleoffset=" -11,0,-3" freezefactor=0.5 freezetime=2.0 />
</Weapon>
<Weapon>
- <GravityBombFire mode=1 munitionpershot=0 delay=0.125 damage=3 muzzleoffset="0,0,-7"/>
+ <GravityBombFire mode=1 munitionpershot=1 delay=0.125 damage=3 muzzleoffset="0,0,-7"/>
</Weapon>
</WeaponPack>
</weapons>
Modified: code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt 2015-10-29 22:27:32 UTC (rev 10721)
@@ -292,9 +292,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="0.60,0.97,0.23" material="Sphere2" scale=0.1>
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="0.40,0.81,0.10" material="Arrow" scale=0.65 />
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="ArrowUp" scale=0.65 />
</attached>
</Billboard>
</attached>
@@ -308,9 +308,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="0.95,0.10,0.05" material="Sphere2" scale=0.1>
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="0.95,0.20,0.10" material="Arrow" scale=0.65 />
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="ArrowDown" scale=0.65 />
</attached>
</Billboard>
</attached>
@@ -324,9 +324,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="0.60,0.97,0.23" material="Sphere2" scale=0.1>
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="0.40,0.81,0.10" material="Splash" scale=0.65 />
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Splash" scale=0.65 />
</attached>
</Billboard>
</attached>
@@ -340,9 +340,9 @@
<spawner-representation>
<StaticEntity>
<attached>
- <Billboard position="0,0,0" colour="0.60,0.97,0.23" material="Sphere2" scale=0.1>
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1>
<attached>
- <Billboard position="0,0,0" colour="0.40,0.81,0.10" material="Asterisk" scale=0.65 />
+ <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Asterisk" scale=0.65 />
</attached>
</Billboard>
</attached>
Modified: code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-10-29 22:27:32 UTC (rev 10721)
@@ -129,11 +129,11 @@
<HUDWeaponSystem
name = "WeaponSystem"
- correctaspect = false
- size = "0.6, 0.1"
+ correctaspect = true
position = "0.0, 0.0"
pickpoint = "0, 0"
visible = "true"
+ weaponModeHUDSize = "0.12, 0.04"
/>
<HUDTimer
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -20,11 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Yuning Chai
- * Felix Schulthess
+ * Fabien Vultier
* Co-authors:
- * Reto Grieder
- * Wolfgang Roenninger
+ * ...
*
*/
@@ -47,6 +45,12 @@
{
RegisterObject(HUDWeapon);
+ weaponModeHUDActualSize_ = Vector2(0.0f,0.0f);
+
+ weaponModes_ = NULL;
+ weaponIndex_ = 0;
+ hudWeaponModes_.clear();
+
overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeapon" + getUniqueNumberString()));
overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon");
overlayElement_->setPosition(0.0f,0.0f);
@@ -74,6 +78,11 @@
void HUDWeapon::tick(float dt)
{
SUPER(HUDWeapon, tick, dt);
+
+ if (!weapon_)
+ {
+ // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is NULL)
+ }
}
void HUDWeapon::positionChanged()
@@ -81,8 +90,15 @@
OrxonoxOverlay::positionChanged();
positionHUDChilds();
- }
+ }
+ void HUDWeapon::sizeChanged()
+ {
+ OrxonoxOverlay::sizeChanged();
+
+ positionHUDChilds();
+ }
+
void HUDWeapon::changedOwner()
{
SUPER(HUDWeapon, changedOwner);
@@ -130,19 +146,34 @@
weaponModes_ = weapon_->getAllWeaponmodes();
+ updateSize();
createHUDChilds();
- positionHUDChilds();
+ positionHUDChilds();
}
void HUDWeapon::createHUDChilds()
{
+ if (weaponModes_ == NULL)
+ {
+ return;
+ }
+
+ int positionIndex = 0;
+
for (std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)
{
HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext());
hudWeaponMode->setOwner(owner_);
+ hudWeaponMode->setOverlayGroup(this->getOverlayGroup());
hudWeaponMode->setWeaponMode(it->second);
+ hudWeaponMode->setWeaponIndex(this->weaponIndex_);
+ hudWeaponMode->setAspectCorrection(false);
+ hudWeaponMode->setPickPoint(Vector2(0.0f,0.0f));
+
hudWeaponModes_.push_back(hudWeaponMode);
- }
+
+ ++ positionIndex;
+ }
}
void HUDWeapon::positionHUDChilds()
@@ -151,16 +182,13 @@
for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
{
- (*it)->setOverlayGroup(this->getOverlayGroup());
- (*it)->setAspectCorrection(this->getAspectCorrection());
- (*it)->setPosition(this->getPosition() + Vector2(0.0f,0.025f*positionIndex));
- (*it)->setSize(Vector2(0.15f,0.025f));
- (*it)->setPickPoint(Vector2(0.0f,0.0f));
+ (*it)->setWeaponModeIndex(positionIndex);
+ (*it)->setWeaponIndex(this->weaponIndex_);
+ (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
+ (*it)->positionHUDChilds();
- ++ positionIndex;
+ ++ positionIndex;
}
-
- overlayElement_->setDimensions(1.0f,0.25f*hudWeaponModes_.size());
}
void HUDWeapon::destroyHUDChilds()
@@ -172,4 +200,21 @@
hudWeaponModes_.clear();
}
+
+ void HUDWeapon::updateSize()
+ {
+ if (weaponModes_ != NULL)
+ {
+ this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weaponModes_->size()));
+ updatePosition();
+ }
+ }
+
+ void HUDWeapon::updatePosition()
+ {
+ if (weaponModes_ != NULL)
+ {
+ this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f));
+ }
+ }
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h 2015-10-29 22:27:32 UTC (rev 10721)
@@ -64,15 +64,31 @@
virtual void changedOverlayGroup();
virtual void changedVisibility();
virtual void changedName();
- virtual void positionChanged();
+ virtual void positionChanged();
+ virtual void sizeChanged();
virtual void setWeapon(Weapon* weapon);
+ inline void setWeaponModeHUDActualSize(Vector2 vector)
+ { weaponModeHUDActualSize_ = vector;
+ this->updateSize();
+ }
+ inline Vector2 getWeaponModeHUDActualSize() const
+ { return weaponModeHUDActualSize_; }
+ inline void setWeaponIndex(int index)
+ { weaponIndex_ = index;
+ this->updatePosition();
+ }
+
+ virtual void positionHUDChilds();
+
private:
virtual void createHUDChilds();
- virtual void positionHUDChilds();
- virtual void destroyHUDChilds();
+
+ virtual void destroyHUDChilds();
virtual void updateWeaponModeList();
+ virtual void updateSize();
+ virtual void updatePosition();
WeakPtr<Pawn> owner_;
WeakPtr<Weapon> weapon_;
@@ -80,7 +96,10 @@
std::multimap<unsigned int, WeaponMode*>* weaponModes_;
std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_;
- Ogre::PanelOverlayElement* overlayElement_;
+ Ogre::PanelOverlayElement* overlayElement_;
+
+ Vector2 weaponModeHUDActualSize_;
+ int weaponIndex_;
};
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -48,6 +48,9 @@
{
RegisterObject(HUDWeaponMode);
+ weaponIndex_ = 0;
+ weaponModeIndex_ = 0;
+
overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
overlayElementIcon_->setPosition(0.0f,0.0f);
overlayElementIcon_->setDimensions(1.0f,1.0f);
@@ -79,22 +82,20 @@
this->textOverlayLeft_->setCaption("???");
textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f));
textOverlayLeft_->setVisible(true);
- textOverlayLeft_->setAlignment(OverlayText::Left);
+ textOverlayLeft_->setAlignment(OverlayText::Center);
textOverlayLeft_->setTextSize(0.02f);
textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0));
- textOverlayLeft_->setPosition(getPosition());
- textOverlayLeft_->setAspectCorrection(this->getAspectCorrection());
+ textOverlayLeft_->setAspectCorrection(false);
this->textOverlayRight_ = new OverlayText(this->getContext());
assert(this->textOverlayLeft_.get());
this->textOverlayRight_->setCaption("???");
textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f));
textOverlayRight_->setVisible(true);
- textOverlayRight_->setAlignment(OverlayText::Left);
+ textOverlayRight_->setAlignment(OverlayText::Center);
textOverlayRight_->setTextSize(0.02f);
textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0));
- textOverlayRight_->setPosition(getPosition());
- textOverlayRight_->setAspectCorrection(this->getAspectCorrection());
+ textOverlayRight_->setAspectCorrection(false);
materialNameState_ = "Orxonox/WSHUD_Reloading";
@@ -105,10 +106,15 @@
{
if (this->isInitialized())
{
- //this->textOverlay_->destroy();
+ //this->textOverlay_->destroy();
}
}
+ void HUDWeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(HUDWeaponMode, XMLPort, xmlelement, mode);
+ }
+
void HUDWeaponMode::tick(float dt)
{
SUPER(HUDWeaponMode, tick, dt);
@@ -182,15 +188,20 @@
OrxonoxOverlay::positionChanged();
positionHUDChilds();
- }
+ }
+ void HUDWeaponMode::sizeChanged()
+ {
+ OrxonoxOverlay::sizeChanged();
+
+ positionHUDChilds();
+ }
+
void HUDWeaponMode::changedOwner()
{
SUPER(HUDWeaponMode, changedOwner);
this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
-
- //updateWeaponsList();
}
void HUDWeaponMode::changedOverlayGroup()
@@ -205,7 +216,8 @@
{
SUPER(HUDWeaponMode, changedVisibility);
- //this->textOverlay_->setVisible(this->isVisible());
+ this->textOverlayLeft_->setVisible(this->isVisible());
+ this->textOverlayRight_->setVisible(this->isVisible());
}
void HUDWeaponMode::changedName()
@@ -247,12 +259,33 @@
{
overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate");
}
- }
+ }
}
void HUDWeaponMode::positionHUDChilds()
{
- textOverlayLeft_->setPosition(getPosition() + Vector2(0.06f,0.0f));
- textOverlayRight_->setPosition(getPosition() + Vector2(0.105f,0.0f));
- }
-}
+ Vector2 size = Vector2(getSize().x*45.0f/150.0f, getSize().y);
+ Vector2 offset1 = Vector2(getSize().x*82.5f/150.0f, 0.0f);
+ Vector2 offset2 = Vector2(getSize().x*127.5f/150.0f, 0.0f);
+
+ textOverlayLeft_->setPosition(getPosition() + offset1);
+ textOverlayRight_->setPosition(getPosition() + offset2);
+
+ textOverlayLeft_->setSize(size);
+ textOverlayRight_->setSize(size);
+
+ textOverlayLeft_->setTextSize(getSize().y);
+ textOverlayRight_->setTextSize(getSize().y);
+ }
+
+ void HUDWeaponMode::updateSize()
+ {
+ this->setSize(weaponModeHUDActualSize_);
+ updatePosition();
+ }
+
+ void HUDWeaponMode::updatePosition()
+ {
+ this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,weaponModeHUDActualSize_.y*weaponModeIndex_));
+ }
+}
\ No newline at end of file
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h 2015-10-29 22:27:32 UTC (rev 10721)
@@ -1,3 +1,4 @@
+
/*
* ORXONOX - the hottest 3D action shooter ever to exist
* > www.orxonox.net <
@@ -57,17 +58,37 @@
virtual ~HUDWeaponMode();
virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void changedOwner();
virtual void changedOverlayGroup();
virtual void changedVisibility();
virtual void changedName();
virtual void positionChanged();
+ virtual void sizeChanged();
virtual void setWeaponMode(WeaponMode* weaponMode);
- private:
+ inline void setWeaponModeHUDActualSize(Vector2 vector)
+ { weaponModeHUDActualSize_ = vector;
+ this->updateSize();
+ }
+ inline Vector2 getWeaponModeHUDActualSize() const
+ { return weaponModeHUDActualSize_; }
+ inline void setWeaponIndex(int index)
+ { weaponIndex_ = index;
+ this->updatePosition();
+ }
+ inline void setWeaponModeIndex(int index)
+ { weaponModeIndex_ = index;
+ this->updatePosition();
+ }
+
virtual void positionHUDChilds();
+ private:
+ virtual void updateSize();
+ virtual void updatePosition();
+
WeakPtr<Pawn> owner_;
WeakPtr<WeaponMode> weaponMode_;
@@ -80,6 +101,10 @@
StrongPtr<OverlayText> textOverlayLeft_;
StrongPtr<OverlayText> textOverlayRight_;
+
+ Vector2 weaponModeHUDActualSize_;
+ int weaponIndex_;
+ int weaponModeIndex_;
};
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -50,6 +50,9 @@
{
RegisterObject(HUDWeaponSystem);
+ weaponModeHUDSize_ = Vector2(0.0f,0.0f);
+ weaponModeHUDActualSize_ = Vector2(0.0f,0.0f);
+
weapons_.clear();
hudWeapons_.clear();
}
@@ -66,8 +69,7 @@
{
SUPER(HUDWeaponSystem, XMLPort, xmlelement, mode);
- /*XMLPortParam(HUDWeaponSystem, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode);
- XMLPortParam(HUDWeaponSystem, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);*/
+ XMLPortParam(HUDWeaponSystem, "weaponModeHUDSize", setWeaponModeHUDSize, getWeaponModeHUDSize, xmlelement, mode);
}
void HUDWeaponSystem::tick(float dt)
@@ -85,8 +87,17 @@
OrxonoxOverlay::positionChanged();
positionHUDChilds();
- }
+ }
+ void HUDWeaponSystem::sizeChanged()
+ {
+ OrxonoxOverlay::sizeChanged();
+
+ weaponModeHUDActualSize_ = this->getActualSize();
+
+ positionHUDChilds();
+ }
+
void HUDWeaponSystem::changedOwner()
{
SUPER(HUDWeaponSystem, changedOwner);
@@ -141,34 +152,42 @@
}
createHUDChilds();
- positionHUDChilds();
+ positionHUDChilds();
}
void HUDWeaponSystem::createHUDChilds()
{
+ int positionIndex = 0;
+
for (std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)
{
- HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());
+ HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());
hudWeapon->setOwner(owner_);
+ hudWeapon->setOverlayGroup(this->getOverlayGroup());
hudWeapon->setWeapon(*it);
+ hudWeapon->setAspectCorrection(false);
+ hudWeapon->setPickPoint(Vector2(0.0f,0.0f));
+
hudWeapons_.push_back(hudWeapon);
- }
+
+ ++ positionIndex;
+ }
}
void HUDWeaponSystem::positionHUDChilds()
{
int positionIndex = 0;
+ //this->setSize(weaponModeHUDSize_);
+ // this->weaponModeHUDActualSize_ = this->getActualSize();
for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
{
- (*it)->setOverlayGroup(this->getOverlayGroup());
- (*it)->setAspectCorrection(this->getAspectCorrection());
- (*it)->setPosition(this->getPosition() + Vector2(0.15f*positionIndex,0.0f));
- (*it)->setSize(Vector2(0.15f,0.10f));
- (*it)->setPickPoint(Vector2(0.0f,0.0f));
+ (*it)->setWeaponIndex(positionIndex);
+ (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
+ (*it)->positionHUDChilds();
++ positionIndex;
- }
+ }
}
void HUDWeaponSystem::destroyHUDChilds()
@@ -179,5 +198,5 @@
}
hudWeapons_.clear();
- }
+ }
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h 2015-10-29 22:27:32 UTC (rev 10721)
@@ -62,8 +62,15 @@
virtual void changedOverlayGroup();
virtual void changedVisibility();
virtual void changedName();
- virtual void positionChanged();
-
+ virtual void positionChanged();
+ virtual void sizeChanged();
+ protected:
+ inline void setWeaponModeHUDSize(Vector2 vector)
+ { weaponModeHUDSize_ = vector;
+ this->setSize(weaponModeHUDSize_);
+ }
+ inline Vector2 getWeaponModeHUDSize() const
+ { return weaponModeHUDSize_; }
private:
virtual void updateWeaponList();
virtual void createHUDChilds();
@@ -74,6 +81,9 @@
std::vector<WeakPtr<Weapon> > weapons_;
std::vector<WeakPtr<HUDWeapon> > hudWeapons_;
+
+ Vector2 weaponModeHUDSize_;
+ Vector2 weaponModeHUDActualSize_;
};
}
Added: code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.cc
===================================================================
--- code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.cc (rev 0)
+++ code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -0,0 +1,117 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MunitionContainer.cc
+ @brief Implementation of the MunitionContainer class. This class is only used by the MunitionPickup class to defines how much munition of what type the pickup contains.
+*/
+
+#include "MunitionContainer.h"
+
+#include <sstream>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(MunitionContainer);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes the member variables.
+ */
+ MunitionContainer::MunitionContainer(Context* context) : BaseObject(context)
+ {
+ RegisterObject(MunitionContainer);
+
+ this->munitionName_ = "";
+ this->munitionAmount_ = 1;
+ this->magazinesAmount_ = 1;
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ MunitionContainer::~MunitionContainer()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a MunitionContainer object through XML.
+ */
+ void MunitionContainer::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+ {
+ SUPER(MunitionContainer, XMLPort, xmlelement, mode);
+
+ XMLPortParam(MunitionContainer, "munitiontype", setMunitionName, getMunitionName, xmlelement, mode).defaultValues("LaserMunition");
+ XMLPortParam(MunitionContainer, "munitionamount", setMunitionAmount, getMunitionAmount, xmlelement, mode).defaultValues(1);
+ XMLPortParam(MunitionContainer, "magazinesamount", setMagazinesAmount, getMagazinesAmount, xmlelement, mode).defaultValues(0);
+ }
+
+ void MunitionContainer::setMunitionName(const std::string& munitionName)
+ {
+ Identifier* identifier = ClassByString(munitionName);
+ if (identifier)
+ {
+ this->munitionName_ = munitionName;
+ this->munitionType_ = identifier;
+ }
+ else
+ {
+ this->munitionName_ = "";
+ orxout(internal_warning) << "Invalid munition class defined in MunitionContainer." << endl;
+ }
+ }
+
+ void MunitionContainer::setMunitionAmount(int munitionAmount)
+ {
+ if (munitionAmount > 0)
+ {
+ munitionAmount_ = munitionAmount;
+ }
+ else
+ {
+ munitionAmount_ = 0;
+ }
+ }
+
+ void MunitionContainer::setMagazinesAmount(int magazinesAmount)
+ {
+ if (magazinesAmount > 0)
+ {
+ magazinesAmount_ = magazinesAmount;
+ }
+ else
+ {
+ magazinesAmount_ = 0;
+ }
+ }
+}
+
Added: code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.h
===================================================================
--- code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.h (rev 0)
+++ code/branches/fabienHS15/src/modules/pickup/items/MunitionContainer.h 2015-10-29 22:27:32 UTC (rev 10721)
@@ -0,0 +1,80 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MunitionContainer.h
+ @brief Declaration of the MunitionContainer class.
+ @ingroup PickupItems
+*/
+
+#ifndef _MunitionContainer_H__
+#define _MunitionContainer_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include <string>
+
+#include "pickup/Pickup.h"
+#include "core/class/SubclassIdentifier.h"
+#include "weaponsystem/Munition.h"
+
+namespace orxonox
+{
+ class _PickupExport MunitionContainer : public BaseObject
+ {
+ public:
+
+ MunitionContainer(Context* context);
+ virtual ~MunitionContainer();
+
+ virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode);
+
+ inline const std::string& getMunitionName() const
+ { return this->munitionName_; }
+ inline int getMunitionAmount() const
+ { return this->munitionAmount_; }
+ inline int getMagazinesAmount() const
+ { return this->magazinesAmount_; }
+ inline SubclassIdentifier<Munition> getMunitionType() const
+ { return munitionType_; }
+
+ protected:
+ void setMunitionName(const std::string& munitionName);
+ void setMunitionAmount(int munitionAmount);
+ void setMagazinesAmount(int magazinesAmount_);
+
+ private:
+ SubclassIdentifier<Munition> munitionType_; //!< Indentifier of the munition type.
+ std::string munitionName_; //!< String containing the class name of the munition type (e.g. "LaserMunition")
+ int munitionAmount_; //!< The amount of singe bullets added
+ int magazinesAmount_; //!< The amount of full magazines added
+
+ };
+}
+
+#endif // _MunitionContainer_H__
Modified: code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc
===================================================================
--- code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -133,7 +133,7 @@
else
{
this->Pickupable::destroy();
- }
+ }
}
/**
Modified: code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h 2015-10-29 22:27:32 UTC (rev 10721)
@@ -64,7 +64,7 @@
- Standard Ogre::PanelOverlayElement for a background image (class doesn't have to be derived
only for displaying a picture).
- Reacts to changes of the window aspect
- - Last but not least: On demand you can tell the overlay to automatically resale to correct for
+ - Last but not least: On demand you can tell the overlay to automatically rescale to correct for
aspect distortion. E.g. if you play 1024x768 you wouldn't want a round object to be oval.
Remark: This can (due to the Ogre::Overlay transformation order) only work for angle that are
multiples of 90 degrees. But it's only a small drawback.
Modified: code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc 2015-10-29 22:26:28 UTC (rev 10720)
+++ code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc 2015-10-29 22:27:32 UTC (rev 10721)
@@ -301,10 +301,10 @@
this->magazines_++;
}
- // If we reached the limit, reduze both magazines and munition to the maximum
+ // If we reached the limit, reduce both magazines and munition to the maximum
if (this->magazines_ >= this->maxMagazines_)
{
- this->magazines_ = this->maxMagazines_ - 1;
+ this->magazines_ = this->maxMagazines_;
magazine->munition_ = this->maxMunitionPerMagazine_;
}
More information about the Orxonox-commit
mailing list