[Orxonox-commit 6081] r10739 - in code/branches/fabienHS15: data/gui/layouts data/gui/scripts data/overlays src/modules/overlays/hud src/modules/towerdefense src/modules/weapons/projectiles src/orxonox/worldentities/pawns
fvultier at orxonox.net
fvultier at orxonox.net
Sun Nov 1 13:05:55 CET 2015
Author: fvultier
Date: 2015-11-01 13:05:54 +0100 (Sun, 01 Nov 2015)
New Revision: 10739
Modified:
code/branches/fabienHS15/data/gui/layouts/InGameMenu.layout
code/branches/fabienHS15/data/gui/scripts/InGameMenu.lua
code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.h
code/branches/fabienHS15/src/modules/overlays/hud/HUDBoostBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.h
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/towerdefense/TowerDefenseTower.cc
code/branches/fabienHS15/src/modules/weapons/projectiles/BasicProjectile.cc
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
Log:
HUD improved. Corrected text rescaling. Renamed reload to shieldRecharge in Pawn.cc, ... to avoid confusion with the weapon system.
Modified: code/branches/fabienHS15/data/gui/layouts/InGameMenu.layout
===================================================================
--- code/branches/fabienHS15/data/gui/layouts/InGameMenu.layout 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/data/gui/layouts/InGameMenu.layout 2015-11-01 12:05:54 UTC (rev 10739)
@@ -8,28 +8,35 @@
<Window Type="MenuWidgets/Button" Name="orxonox/InGameMenu_ReturnButton" >
<Property Name="Text" Value="Return to Game" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2875,0},{0.6,0},{0.3375,0}}" />
<Property Name="Alpha" Value="0.9" />
<Event Name="Clicked" Function="InGameMenu.button_return_clicked"/>
</Window>
+ <Window Type="MenuWidgets/Button" Name="orxonox/InGameMenu_ReloadLevelButton" >
+ <Property Name="Text" Value="Reload level" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" />
+ <Property Name="Alpha" Value="0.9" />
+ <Event Name="Clicked" Function="InGameMenu.button_reloadLevel_clicked"/>
+ </Window>
<Window Type="MenuWidgets/Button" Name="orxonox/InGameMenu_MainMenuButton" >
<Property Name="Text" Value="Main Menu" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4625,0},{0.6,0},{0.5125,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4375,0},{0.6,0},{0.4875,0}}" />
<Property Name="Alpha" Value="0.9" />
<Event Name="Clicked" Function="InGameMenu.button_mainmenu_clicked"/>
</Window>
<Window Type="MenuWidgets/Button" Name="orxonox/InGameMenu_SettingsButton" >
<Property Name="Text" Value="Settings" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5625,0},{0.6,0},{0.6125,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5125,0},{0.6,0},{0.5625,0}}" />
<Property Name="Alpha" Value="0.9" />
<Event Name="Clicked" Function="InGameMenu.button_settings_clicked"/>
</Window>
<Window Type="MenuWidgets/Button" Name="orxonox/InGameMenu_QuitButton" >
<Property Name="Text" Value="Quit" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5875,0},{0.6,0},{0.6375,0}}" />
<Property Name="Alpha" Value="0.9" />
<Event Name="Clicked" Function="InGameMenu.button_quit_clicked"/>
</Window>
Modified: code/branches/fabienHS15/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/branches/fabienHS15/data/gui/scripts/InGameMenu.lua 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/data/gui/scripts/InGameMenu.lua 2015-11-01 12:05:54 UTC (rev 10739)
@@ -6,23 +6,28 @@
function P.onLoad()
P.multiplayerMode = "startClient"
- --button are arranged in a 4x1 matrix, the left lower item is nil
+ --button are arranged in a 5x1 matrix, the left lower item is nil
P:setButton(1, 1, {
["button"] = winMgr:getWindow("orxonox/InGameMenu_ReturnButton"),
["callback"] = P.button_return_clicked
})
P:setButton(2, 1, {
+ ["button"] = winMgr:getWindow("orxonox/InGameMenu_ReloadLevelButton"),
+ ["callback"] = P.button_reloadLevel_clicked
+ })
+
+ P:setButton(3, 1, {
["button"] = winMgr:getWindow("orxonox/InGameMenu_MainMenuButton"),
["callback"] = P.button_mainmenu_clicked
})
- P:setButton(3, 1, {
+ P:setButton(4, 1, {
["button"] = winMgr:getWindow("orxonox/InGameMenu_SettingsButton"),
["callback"] = P.button_settings_clicked
})
- P:setButton(4, 1, {
+ P:setButton(5, 1, {
["button"] = winMgr:getWindow("orxonox/InGameMenu_QuitButton"),
["callback"] = P.button_quit_clicked
})
@@ -53,6 +58,11 @@
showMenuSheet("SettingsMenu", true)
end
+function P.button_reloadLevel_clicked(e)
+ hideMenuSheet("InGameMenu")
+ orxonox.execute("reloadLevel")
+end
+
function P.button_return_clicked(e)
hideMenuSheet("InGameMenu")
end
Modified: code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-01 12:05:54 UTC (rev 10739)
@@ -33,18 +33,18 @@
<HUDHealthBar
name = "HealthBar1"
background = "Orxonox/HealthBarBackground"
- size = "0.35, 0.0875"
+ size = "0.40, 0.08"
position = "0.0 , 0.9 "
pickpoint = "0, 1"
bartexture = "healthbar_bar.png"
textfont = "VeraMono"
textusebarcolour = true
- textsize = 0.039
- textoffset = "0.315, 0.05"
+ textscale = 0.4
+ textoffset = "0.325, -0.825"
textpickpoint = "0, 0"
textalign = "right"
- correctaspect = false
- textcorrectaspect = false
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconHealth"
>
<BarColour position = 0.0 colour = "0.7,0.2,0.2" />
<BarColour position = 0.5 colour = "0.7,0.7,0.2" />
@@ -54,10 +54,11 @@
<HUDSpeedBar
name = "SpeedBar1"
background = "Orxonox/BarBackground"
- size = "0.35, 0.05"
+ size = "0.40, 0.04"
position = "0.0 , 0.95 "
pickpoint = "0, 1"
- correctaspect = false
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconSpeed"
>
<BarColour position = 0.0 colour = "0.7,0.5,0.2" />
<BarColour position = 0.5 colour = "0.2,0.7,0.2" />
@@ -66,11 +67,12 @@
<HUDBoostBar
name = "BoostBar1"
- backgroundtex = "bar1.png"
- size = "0.35, 0.05"
+ background = "Orxonox/BarBackground"
+ size = "0.40, 0.04"
position = "0.0 , 1.0 "
pickpoint = "0, 1"
- correctaspect = false
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconBoost"
>
<BarColour position = 0.0 colour = "0.7,0.2,0.2" />
<BarColour position = 0.5 colour = "0.7,0.7,0.2" />
@@ -80,18 +82,18 @@
<HUDEnemyHealthBar
name = "EnemyHealthBar"
background = "Orxonox/HealthBarBackground"
- size = "0.35, 0.0875"
- position = "1 ,0.1"
- pickpoint = "1, 1"
+ size = "0.4, 0.08"
+ position = "1 ,0"
+ pickpoint = "1, 0"
bartexture = "healthbar_bar.png"
textfont = "VeraMono"
textusebarcolour = true
- textsize = 0.039
- textoffset = "0.315, 0.05"
+ textscale = 0.4
+ textoffset = "-0.675, 0.175"
textpickpoint = "0, 0"
textalign = "right"
- correctaspect = false
- textcorrectaspect = false
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconHealth"
>
<BarColour position = 0.0 colour = "0.7,0.2,0.2" />
<BarColour position = 0.5 colour = "0.7,0.7,0.2" />
@@ -130,7 +132,7 @@
<HUDWeaponSystem
name = "WeaponSystem"
correctaspect = true
- position = "0.0, 0.0"
+ position = "0.01, 0.01"
pickpoint = "0, 0"
visible = "true"
weaponModeHUDSize = "0.09, 0.03"
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -46,11 +46,10 @@
{
RegisterClass(BarColour);
- BarColour::BarColour(Context* context)
- : BaseObject(context)
+ BarColour::BarColour(Context* context) : BaseObject(context)
{
RegisterObject(BarColour);
-
+
this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
this->setPosition(0.0);
}
@@ -68,8 +67,7 @@
RegisterClass(HUDBar);
- HUDBar::HUDBar(Context* context)
- : OrxonoxOverlay(context), right2Left_(false), autoColour_(false)
+ HUDBar::HUDBar(Context* context) : OrxonoxOverlay(context), right2Left_(false), autoColour_(false)
{
RegisterObject(HUDBar);
@@ -87,6 +85,10 @@
.createOverlayElement("Panel", "HUDBar_bar_" + getUniqueNumberString()));
this->bar_->setMaterialName(materialname);
+ this->bar_->setPosition(0.0f,0.0f);
+ this->bar_->setDimensions(1.0f,1.0f);
+
+ this->bUseIcon_ = false;
this->value_ = 1.0f; // initialize with 1.0f to trigger a change when calling setValue(0.0f) on the line below
this->setAutoColour(true);
this->setValue(0.0f); // <--
@@ -94,6 +96,11 @@
this->currentColour_ = ColourValue::White;
this->background_->addChild(bar_);
+
+ this->icon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDBar_icon_" + getUniqueNumberString()));
+ this->icon_->setPosition(0.06f,0.0f);
+ this->icon_->setDimensions(0.1f,1.0f);
+ this->background_->addChild(this->icon_);
}
HUDBar::~HUDBar()
@@ -114,6 +121,7 @@
XMLPortParam(HUDBar, "righttoleft", setRightToLeft, getRightToLeft, xmlelement, mode);
XMLPortParam(HUDBar, "autocolour", setAutoColour, getAutoColour, xmlelement, mode);
XMLPortParam(HUDBar, "bartexture", setBarTexture, getBarTexture, xmlelement, mode);
+ XMLPortParam(HUDBar, "iconmaterial", setIconMaterial, getIconMaterial, xmlelement, mode);
XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlelement, mode);
}
@@ -160,19 +168,39 @@
}
}
+ float height = this->bar_->getHeight();
+ float top = this->bar_->getTop();
+
// set value
if (this->right2Left_)
{
// backward case
- this->bar_->setPosition(0.06f + 0.88f * (1 - this->value_), 0.0f);
- this->bar_->setDimensions(0.88f * this->value_, 1.0f);
+ if (this->bUseIcon_)
+ {
+ this->bar_->setPosition(0.16f + 0.78f * (1 - this->value_), top);
+ this->bar_->setDimensions(0.78f * this->value_, height);
+ }
+ else
+ {
+ this->bar_->setPosition(0.06f + 0.88f * (1 - this->value_), top);
+ this->bar_->setDimensions(0.88f * this->value_, height);
+ }
}
else
{
// default case
- this->bar_->setPosition(0.06f, 0.0f);
- this->bar_->setDimensions(0.88f * this->value_, 1.0f);
+ if (this->bUseIcon_)
+ {
+ this->bar_->setPosition(0.16f, top);
+ this->bar_->setDimensions(0.78f * this->value_, height);
+ }
+ else
+ {
+ this->bar_->setPosition(0.06f, top);
+ this->bar_->setDimensions(0.88f * this->value_, height);
+ }
}
+
if (this->value_ != 0)
this->bar_->setTiling(this->value_, 1.0);
}
@@ -207,4 +235,16 @@
{
return this->textureUnitState_->getTextureName();
}
+
+ void HUDBar::setIconMaterial(const std::string& iconMaterial)
+ {
+ this->bUseIcon_ = true;
+ this->icon_->setMaterialName(iconMaterial);
+ valueChanged();
+ }
+
+ const std::string& HUDBar::getIconMaterial() const
+ {
+ return this->icon_->getMaterialName();
+ }
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.h 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDBar.h 2015-11-01 12:05:54 UTC (rev 10739)
@@ -36,6 +36,7 @@
#include <map>
#include <vector>
+#include <OgrePanelOverlayElement.h>
#include "util/Math.h"
#include "util/OgreForwardRefs.h"
@@ -50,7 +51,7 @@
BarColour(Context* context);
virtual ~BarColour() { }
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
void setColour(const ColourValue& colour) { this->colour_ = colour; }
const ColourValue& getColour() const { return this->colour_; }
@@ -114,12 +115,19 @@
void setBarTexture(const std::string& texture);
const std::string& getBarTexture() const;
+ void setIconMaterial(const std::string& iconMaterial);
+ const std::string& getIconMaterial() const;
+
inline const ColourValue& getCurrentBarColour() const
{ return this->currentColour_; }
+ inline void setIconPosition(Vector2 position)
+ { this->icon_->setPosition(position.x, position.y); }
+ inline void setIconDimensions(Vector2 dimensions)
+ { this->icon_->setDimensions(dimensions.x, dimensions.y); }
+
protected:
virtual void valueChanged();
-
private:
void addColour(BarColour* colour);
BarColour* getColour(unsigned int index);
@@ -128,9 +136,11 @@
bool autoColour_; //!< whether bar changes colour automatically
float value_; //!< progress of bar
ColourValue currentColour_;
+ bool bUseIcon_;
Ogre::PanelOverlayElement* bar_;
Ogre::TextureUnitState* textureUnitState_;
+ Ogre::PanelOverlayElement* icon_;
std::map<float, ColourValue> colours_;
std::vector<BarColour*> barColours_;
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDBoostBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDBoostBar.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDBoostBar.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -58,7 +58,7 @@
{
if (this->owner_->isBoostCoolingDown())
{
- this->setBackgroundColour(ColourValue(0.7f, 0.2f, 0.2f));
+ //this->setBackgroundColour(ColourValue(0.7f, 0.2f, 0.2f));
if (this->flashDt_ <= 0.0f)
{
this->flashDt_ = this->flashInterval_;
@@ -71,7 +71,7 @@
{
this->flashDt_ = 0.0f;
this->show();
- this->setBackgroundColour(ColourValue(0.2f, 0.7f, 0.2f));
+ //this->setBackgroundColour(ColourValue(0.2f, 0.7f, 0.2f));
}
float value = this->owner_->getBoostPower() / this->owner_->getInitialBoostPower();
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -44,12 +44,20 @@
this->owner_ = 0;
this->bUseBarColour_ = false;
+ this->textOffset_ = Vector2(0.0f, 0.0f);
+ this->textScale_ = 1.0f;
+ this->setIconPosition(Vector2(0.05f,0.5f));
+ this->setIconDimensions(Vector2(0.1f,0.5f));
+
this->textoverlay_ = new OverlayText(this->getContext());
assert(this->textoverlay_.get());
this->textoverlay_->setCaption("");
+ this->textoverlay_->setAspectCorrection(false);
+
+ positionText();
}
HUDHealthBar::~HUDHealthBar()
@@ -57,7 +65,7 @@
if (this->isInitialized())
{
this->textoverlay_->destroy();
- this->textoverlay_ = 0;
+ this->textoverlay_ = NULL;
}
}
@@ -69,12 +77,11 @@
XMLPortParam(HUDHealthBar, "textfont", setTextFont, getTextFont, xmlelement, mode).defaultValues("Monofur");
XMLPortParam(HUDHealthBar, "textusebarcolour", setTextUseBarColour, getTextUseBarColour, xmlelement, mode).defaultValues(false);
XMLPortParam(HUDHealthBar, "textcolour", setTextColour, getTextColour, xmlelement, mode).defaultValues(ColourValue(1.0, 1.0, 1.0, 1.0));
- XMLPortParam(HUDHealthBar, "textsize", setTextSize, getTextSize, xmlelement, mode).defaultValues(1.0f);
XMLPortParam(HUDHealthBar, "textalign", setTextAlignmentString, getTextAlignmentString, xmlelement, mode).defaultValues("left");
XMLPortParam(HUDHealthBar, "textoffset", setTextOffset, getTextOffset, xmlelement, mode).defaultValues(Vector2::ZERO);
+ XMLPortParam(HUDHealthBar, "textscale", setTextScale, getTextScale, xmlelement, mode).defaultValues(1.0f);
XMLPortParam(HUDHealthBar, "textpickpoint", setTextPickPoint, getTextPickPoint, xmlelement, mode).defaultValues(Vector2::ZERO);
XMLPortParam(HUDHealthBar, "textrotation", setTextRotation, getTextRotation, xmlelement, mode).defaultValues(0.0f);
- XMLPortParam(HUDHealthBar, "textcorrectaspect", setTextAspectCorrection, getTextAspectCorrection, xmlelement, mode).defaultValues(true);
XMLPortParam(HUDHealthBar, "textspacewidth", setTextSpaceWidth, getTextSpaceWidth, xmlelement, mode).defaultValues(true);
}
@@ -138,4 +145,22 @@
if (!bUseBarColour)
this->textoverlay_->setColour(this->textColour_);
}
+
+ void HUDHealthBar::positionText()
+ {
+ this->textoverlay_->setPosition(this->getPosition() + this->textOffset_*this->getActualSize());
+ this->textoverlay_->setTextSize(this->getActualSize().y*this->textScale_);
+ }
+
+ void HUDHealthBar::positionChanged()
+ {
+ HUDBar::positionChanged();
+ positionText();
+ }
+
+ void HUDHealthBar::sizeChanged()
+ {
+ HUDBar::sizeChanged();
+ positionText();
+ }
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.h 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDHealthBar.h 2015-11-01 12:05:54 UTC (rev 10739)
@@ -74,31 +74,30 @@
std::string getTextAlignmentString() const
{ return this->textoverlay_->getAlignmentString(); }
- inline void setTextSize(float size)
- { this->textoverlay_->setTextSize(size); }
- inline float getTextSize() const
- { return this->textoverlay_->getTextSize(); }
-
inline void setTextVisible(bool bVisible)
{ this->textoverlay_->setVisible(bVisible); }
inline bool getTextVisible() const
{ return this->textoverlay_->isVisible(); }
+ inline void setTextScale(float scale)
+ { this->textScale_ = scale;
+ positionText();
+ }
+ inline float getTextScale() const
+ { return this->textScale_; }
+
inline void setTextPickPoint(const Vector2& pickpoint)
{ this->textoverlay_->setPickPoint(pickpoint); }
inline Vector2 getTextPickPoint() const
{ return this->textoverlay_->getPickPoint(); }
inline void setTextOffset(const Vector2& position)
- { this->textoverlay_->setPosition(this->getPosition() + (position - this->getPickPoint()) * this->getSize()); }
+ { this->textOffset_ = position;
+ this->positionText();
+ }
inline Vector2 getTextOffset() const
- { return (this->textoverlay_->getPosition() - this->getPosition()) / this->getSize() + this->getPickPoint(); }
+ { return this->textOffset_; }
- inline void setTextAspectCorrection(bool correct)
- { this->textoverlay_->setAspectCorrection(correct); }
- inline bool getTextAspectCorrection() const
- { return this->textoverlay_->getAspectCorrection(); }
-
inline void setTextRotation(const Degree& angle)
{ this->textoverlay_->setRotation(angle); }
inline const Degree& getTextRotation() const
@@ -111,12 +110,17 @@
inline void setHealthBarOwner(Pawn* owner)
{ this->owner_ = owner; }
-
+ protected:
+ virtual void positionChanged();
+ virtual void sizeChanged();
private:
+ virtual void positionText();
WeakPtr<Pawn> owner_;
StrongPtr<OverlayText> textoverlay_;
bool bUseBarColour_;
ColourValue textColour_;
+ Vector2 textOffset_;
+ float textScale_;
};
}
#endif /* _HUDHealthBar_H__ */
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -59,7 +59,6 @@
if (this->isInitialized())
{
destroyHUDChilds();
- //this->overlayElement_->destroy();
}
}
@@ -178,6 +177,7 @@
for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
{
+ (*it)->setPositionOffset(this->positionOffset_);
(*it)->setWeaponModeIndex(positionIndex);
(*it)->setWeaponIndex(this->weaponIndex_);
(*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
@@ -209,7 +209,7 @@
{
if (weaponModes_ != NULL)
{
- this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f));
+ this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f) + this->positionOffset_);
}
}
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h 2015-11-01 12:05:54 UTC (rev 10739)
@@ -71,9 +71,15 @@
}
inline Vector2 getWeaponModeHUDActualSize() const
{ return weaponModeHUDActualSize_; }
+ inline void setPositionOffset(Vector2 positionOffset)
+ {
+ this->positionOffset_ = positionOffset;
+ this->updatePosition();
+ }
inline void setWeaponIndex(int index)
- { weaponIndex_ = index;
- this->updatePosition();
+ {
+ weaponIndex_ = index;
+ this->updatePosition();
}
private:
@@ -93,6 +99,7 @@
Ogre::PanelOverlayElement* overlayElement_;
Vector2 weaponModeHUDActualSize_;
+ Vector2 positionOffset_;
int weaponIndex_;
};
}
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -101,7 +101,8 @@
{
if (this->isInitialized())
{
- //this->textOverlay_->destroy();
+ this->textOverlayLeft_->destroy();
+ this->textOverlayRight_->destroy();
}
}
@@ -279,6 +280,6 @@
void HUDWeaponMode::updatePosition()
{
- this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,weaponModeHUDActualSize_.y*weaponModeIndex_));
+ this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,weaponModeHUDActualSize_.y*weaponModeIndex_) + this->positionOffset_);
}
}
\ 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-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h 2015-11-01 12:05:54 UTC (rev 10739)
@@ -81,6 +81,11 @@
{ weaponModeIndex_ = index;
this->updatePosition();
}
+ inline void setPositionOffset(Vector2 positionOffset)
+ {
+ this->positionOffset_ = positionOffset;
+ this->updatePosition();
+ }
private:
virtual void updateSize();
@@ -101,6 +106,7 @@
StrongPtr<OverlayText> textOverlayRight_;
Vector2 weaponModeHUDActualSize_;
+ Vector2 positionOffset_;
int weaponIndex_;
int weaponModeIndex_;
};
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -155,9 +155,11 @@
void HUDWeaponSystem::positionHUDChilds()
{
int positionIndex = 0;
+ Vector2 offset = this->getPosition();
for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
{
+ (*it)->setPositionOffset(offset);
(*it)->setWeaponIndex(positionIndex);
(*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
Modified: code/branches/fabienHS15/src/modules/towerdefense/TowerDefenseTower.cc
===================================================================
--- code/branches/fabienHS15/src/modules/towerdefense/TowerDefenseTower.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/towerdefense/TowerDefenseTower.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -60,14 +60,8 @@
if(upgrade < 5)
{
upgrade++;
- float reloadrate = getReloadRate();
- float reloadwaittime = getReloadWaitTime();
this->setDamageMultiplier((upgrade+1)*2);
//this->setRotationThrust(2*this->getRotationThrust());
- reloadrate = 0.5f*reloadrate;
- reloadwaittime = 0.5f*reloadwaittime;
- setReloadRate(reloadrate);
- setReloadWaitTime(reloadwaittime);
//this->addTemplate("towerturret1");
}
else
Modified: code/branches/fabienHS15/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/branches/fabienHS15/src/modules/weapons/projectiles/BasicProjectile.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/modules/weapons/projectiles/BasicProjectile.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -67,7 +67,7 @@
/**
@brief
The function called when a projectile hits another thing.
- Calls the hit-function, starts the reload countdown, displays visual hit effects defined in Pawn.
+ Calls the hit-function, starts the shield recharge countdown, displays visual hit effects defined in Pawn.
Needs to be called in the collidesAgainst() function by every Class directly inheriting from BasicProjectile.
@param otherObject
A pointer to the object the Projectile has collided against.
@@ -96,7 +96,7 @@
if (victim)
{
victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
- victim->startReloadCountdown();
+ victim->startShieldRechargeCountdown();
}
// Visual effects for being hit, depending on whether the shield is hit or not
Modified: code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-01 12:05:54 UTC (rev 10739)
@@ -60,7 +60,7 @@
RegisterObject(Pawn);
this->bAlive_ = true;
- this->bReload_ = false;
+ this->bShieldRecharging_ = false;
this->health_ = 0;
this->maxHealth_ = 0;
@@ -71,9 +71,9 @@
this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max
this->shieldAbsorption_ = 0.5;
- this->reloadRate_ = 0;
- this->reloadWaitTime_ = 1.0f;
- this->reloadWaitCountdown_ = 0;
+ this->shieldRechargeRate_ = 0;
+ this->shieldRechargeWaitTime_ = 1.0f;
+ this->shieldRechargeWaitCountdown_ = 0;
this->lastHitOriginator_ = 0;
@@ -142,8 +142,8 @@
XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
- XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
- XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(Pawn, "reloadrate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0);
+ XMLPortParam(Pawn, "reloadwaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f);
XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode);
@@ -158,7 +158,7 @@
registerVariable(this->shieldHealth_, VariableDirection::ToClient);
registerVariable(this->maxShieldHealth_, VariableDirection::ToClient);
registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
- registerVariable(this->bReload_, VariableDirection::ToServer);
+ registerVariable(this->bShieldRecharging_, VariableDirection::ToServer);
registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server
}
@@ -166,17 +166,17 @@
{
SUPER(Pawn, tick, dt);
- this->bReload_ = false;
+ this->bShieldRecharging_ = false;
// TODO: use the existing timer functions instead
- if(this->reloadWaitCountdown_ > 0)
+ if(this->shieldRechargeWaitCountdown_ > 0)
{
- this->decreaseReloadCountdownTime(dt);
+ this->decreaseShieldRechargeCountdownTime(dt);
}
else
{
- this->addShieldHealth(this->getReloadRate() * dt);
- this->resetReloadCountdown();
+ this->addShieldHealth(this->getShieldRechargeRate() * dt);
+ this->resetShieldRechargeCountdown();
}
if (GameMode::isMaster())
@@ -228,19 +228,19 @@
this->maxShieldHealth_ = maxshieldhealth;
}
- void Pawn::setReloadRate(float reloadrate)
+ void Pawn::setShieldRechargeRate(float shieldRechargeRate)
{
- this->reloadRate_ = reloadrate;
+ this->shieldRechargeRate_ = shieldRechargeRate;
}
- void Pawn::setReloadWaitTime(float reloadwaittime)
+ void Pawn::setShieldRechargeWaitTime(float shieldRechargeWaitTime)
{
- this->reloadWaitTime_ = reloadwaittime;
+ this->shieldRechargeWaitTime_ = shieldRechargeWaitTime;
}
- void Pawn::decreaseReloadCountdownTime(float dt)
+ void Pawn::decreaseShieldRechargeCountdownTime(float dt)
{
- this->reloadWaitCountdown_ -= dt;
+ this->shieldRechargeWaitCountdown_ -= dt;
}
void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
@@ -481,7 +481,7 @@
void Pawn::reload()
{
- this->bReload_ = true;
+ this->bShieldRecharging_ = true;
}
void Pawn::postSpawn()
@@ -631,4 +631,4 @@
assert(0);
return BLANKSTRING;
}
-}
+}
\ No newline at end of file
Modified: code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-01 12:02:39 UTC (rev 10738)
+++ code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-01 12:05:54 UTC (rev 10739)
@@ -115,28 +115,25 @@
inline float getShieldAbsorption()
{ return this->shieldAbsorption_; }
- // TODO: Rename to shieldRechargeRate
- virtual void setReloadRate(float reloadrate);
- inline float getReloadRate() const
- { return this->reloadRate_; }
+ virtual void setShieldRechargeRate(float shieldRechargeRate);
+ inline float getShieldRechargeRate() const
+ { return this->shieldRechargeRate_; }
- virtual void setReloadWaitTime(float reloadwaittime);
- inline float getReloadWaitTime() const
- { return this->reloadWaitTime_; }
+ virtual void setShieldRechargeWaitTime(float shieldRechargeWaitTime);
+ inline float getShieldRechargeWaitTime() const
+ { return this->shieldRechargeWaitTime_; }
- inline void resetReloadCountdown()
- { this->reloadWaitCountdown_ = 0; }
+ inline void resetShieldRechargeCountdown()
+ { this->shieldRechargeWaitCountdown_ = 0; }
- inline void startReloadCountdown()
- { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
+ inline void startShieldRechargeCountdown()
+ { this->shieldRechargeWaitCountdown_ = this->getShieldRechargeWaitTime(); } // TODO: Implement in Projectile.cc
- virtual void decreaseReloadCountdownTime(float dt);
+ virtual void decreaseShieldRechargeCountdownTime(float dt);
inline ControllableEntity* getLastHitOriginator() const
{ return this->lastHitOriginator_; }
- //virtual void hit(Pawn* originator, const Vector3& force, float damage);
- //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
@@ -209,7 +206,6 @@
virtual void deatheffect();
virtual void spawneffect();
- //virtual void damage(float damage, Pawn* originator = 0);
virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
bool bAlive_;
@@ -228,16 +224,16 @@
float maxShieldHealth_;
float initialShieldHealth_;
float shieldAbsorption_; ///< Has to be between 0 and 1
- float reloadRate_;
- float reloadWaitTime_;
- float reloadWaitCountdown_;
+ float shieldRechargeRate_;
+ float shieldRechargeWaitTime_;
+ float shieldRechargeWaitCountdown_;
float damageMultiplier_; ///< Used by the Damage Boost Pickup.
WeakPtr<Pawn> lastHitOriginator_;
WeaponSystem* weaponSystem_;
- bool bReload_;
+ bool bShieldRecharging_;
std::string spawnparticlesource_;
float spawnparticleduration_;
More information about the Orxonox-commit
mailing list