[Orxonox-commit 6088] r10746 - in code/branches/fabienHS15: data/levels data/levels/templates data/overlays src/modules/overlays/hud src/modules/pickup/items src/orxonox/worldentities/pawns
fvultier at orxonox.net
fvultier at orxonox.net
Sun Nov 1 22:25:58 CET 2015
Author: fvultier
Date: 2015-11-01 22:25:57 +0100 (Sun, 01 Nov 2015)
New Revision: 10746
Added:
code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h
Modified:
code/branches/fabienHS15/data/levels/pickups.oxw
code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt
code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
code/branches/fabienHS15/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
Modified: code/branches/fabienHS15/data/levels/pickups.oxw
===================================================================
--- code/branches/fabienHS15/data/levels/pickups.oxw 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/data/levels/pickups.oxw 2015-11-01 21:25:57 UTC (rev 10746)
@@ -86,23 +86,7 @@
<PickupSpawner pickup=hugeinvisiblepickup position="25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
<!-- Meta pickups -->
-
- <Template name=usemetapickup baseclass=MetaPickup>
- <MetaPickup representation="use" metaType="use" />
- </Template>
- <Template name=dropmetapickup baseclass=MetaPickup>
- <MetaPickup representation="drop" metaType="drop" />
- </Template>
-
- <Template name=destroymetapickup baseclass=MetaPickup>
- <MetaPickup representation="destroy" metaType="destroy" />
- </Template>
-
- <Template name=destroycarriermetapickup baseclass=MetaPickup>
- <MetaPickup representation="destroycarrier" metaType="destroyCarrier" />
- </Template>
-
<PickupSpawner pickup=usemetapickup position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
<PickupSpawner pickup=dropmetapickup position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
<PickupSpawner pickup=destroymetapickup position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
@@ -114,7 +98,7 @@
<!-- Drone pickup -->
- <PickupSpawner pickup=dronepickup position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+ <PickupSpawner pickup=dronepickup position="-25,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
<!-- Other pickups -->
Modified: code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt 2015-11-01 21:25:57 UTC (rev 10746)
@@ -380,6 +380,10 @@
</PickupRepresentation>
</Template>
+<Template name=usemetapickup baseclass=MetaPickup>
+ <MetaPickup representation="use" metaType="use" />
+</Template>
+
<Template name=droppickupRepresentation>
<PickupRepresentation>
<spawner-representation>
@@ -396,6 +400,10 @@
</PickupRepresentation>
</Template>
+<Template name=dropmetapickup baseclass=MetaPickup>
+ <MetaPickup representation="drop" metaType="drop" />
+</Template>
+
<Template name=destroypickupRepresentation>
<PickupRepresentation>
<spawner-representation>
@@ -412,6 +420,10 @@
</PickupRepresentation>
</Template>
+<Template name=destroymetapickup baseclass=MetaPickup>
+ <MetaPickup representation="destroy" metaType="destroy" />
+</Template>
+
<Template name=destroycarrierpickupRepresentation>
<PickupRepresentation>
<spawner-representation>
@@ -428,6 +440,10 @@
</PickupRepresentation>
</Template>
+<Template name=destroycarriermetapickup baseclass=MetaPickup>
+ <MetaPickup representation="destroycarrier" metaType="destroyCarrier" />
+</Template>
+
<!-- DamageBoost pickups -->
<Template name=smalldamageboostpickupRepresentation>
Modified: code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-01 21:25:57 UTC (rev 10746)
@@ -34,7 +34,7 @@
name = "HealthBar1"
background = "Orxonox/HealthBarBackground"
size = "0.40, 0.08"
- position = "0.0 , 0.9 "
+ position = "0.0 , 0.85 "
pickpoint = "0, 1"
bartexture = "healthbar_bar.png"
textfont = "VeraMono"
@@ -51,6 +51,20 @@
<BarColour position = 1.0 colour = "0.2,0.7,0.2" />
</HUDHealthBar>
+ <HUDShieldBar
+ name = "ShieldBar1"
+ background = "Orxonox/BarBackground"
+ size = "0.40, 0.04"
+ position = "0.0 , 0.9 "
+ pickpoint = "0, 1"
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconShield"
+ >
+ <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+ <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+ <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+ </HUDShieldBar>
+
<HUDSpeedBar
name = "SpeedBar1"
background = "Orxonox/BarBackground"
Modified: code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt 2015-11-01 21:25:57 UTC (rev 10746)
@@ -4,6 +4,7 @@
HUDRadar.cc
HUDSpeedBar.cc
HUDBoostBar.cc
+ HUDShieldBar.cc
HUDHealthBar.cc
HUDTimer.cc
HUDEnemyHealthBar.cc
Added: code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc (rev 0)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc 2015-11-01 21:25:57 UTC (rev 10746)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#include "HUDShieldBar.h"
+
+#include "core/CoreIncludes.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ RegisterClass(HUDShieldBar);
+
+ HUDShieldBar::HUDShieldBar(Context* context)
+ : HUDBar(context)
+ {
+ RegisterObject(HUDShieldBar);
+
+ this->owner_ = NULL;
+ }
+
+ HUDShieldBar::~HUDShieldBar()
+ {
+ }
+
+ void HUDShieldBar::tick(float dt)
+ {
+ SUPER(HUDShieldBar, tick, dt);
+
+ if (this->owner_)
+ {
+ float maxShieldHealth = this->owner_->getShieldHealth();
+ float shieldHealth = this->owner_->getShieldHealth();
+
+ if (maxShieldHealth > 0.0f)
+ {
+ this->setValue(shieldHealth/maxShieldHealth);
+ }
+ else
+ {
+ this->setValue(0.0f);
+ }
+ }
+ }
+
+ void HUDShieldBar::changedOwner()
+ {
+ SUPER(HUDShieldBar, changedOwner);
+
+ this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
+ }
+}
+
Added: code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h (rev 0)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h 2015-11-01 21:25:57 UTC (rev 10746)
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+#ifndef _HUDShieldBar_H__
+#define _HUDShieldBar_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "HUDBar.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ The HUDShieldBar displays the the status of the shield of its owner (a @ref Pawn).
+ The length of the bar is given by the ratio of the shield health and the maximal shield health of the @ref Pawn.
+ */
+
+ class _OverlaysExport HUDShieldBar : public HUDBar, public Tickable
+ {
+ public:
+ HUDShieldBar(Context* context);
+ virtual ~HUDShieldBar();
+
+ virtual void tick(float dt);
+ virtual void changedOwner();
+
+ private:
+ Pawn* owner_;
+ };
+}
+#endif /* _HUDShieldBar_H__ */
Modified: code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h
===================================================================
--- code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h 2015-11-01 21:25:57 UTC (rev 10746)
@@ -47,7 +47,10 @@
namespace orxonox
{
-
+ /**
+ @brief
+ The MunitionPickup gives munition to the user (a @ref Pawn).
+ */
class _PickupExport MunitionPickup : public Pickup
{
public:
Modified: code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc 2015-11-01 21:25:57 UTC (rev 10746)
@@ -60,7 +60,6 @@
RegisterObject(Pawn);
this->bAlive_ = true;
- this->bShieldRecharging_ = false;
this->health_ = 0;
this->maxHealth_ = 0;
@@ -70,7 +69,6 @@
this->initialShieldHealth_ = 0;
this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max
this->shieldAbsorption_ = 0.5;
-
this->shieldRechargeRate_ = 0;
this->shieldRechargeWaitTime_ = 1.0f;
this->shieldRechargeWaitCountdown_ = 0;
@@ -152,22 +150,20 @@
void Pawn::registerVariables()
{
- registerVariable(this->bAlive_, VariableDirection::ToClient);
- registerVariable(this->health_, VariableDirection::ToClient);
- registerVariable(this->maxHealth_, VariableDirection::ToClient);
- registerVariable(this->shieldHealth_, VariableDirection::ToClient);
- registerVariable(this->maxShieldHealth_, VariableDirection::ToClient);
- registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
- registerVariable(this->bShieldRecharging_, VariableDirection::ToServer);
- registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server
+ registerVariable(this->bAlive_, VariableDirection::ToClient);
+ registerVariable(this->health_, VariableDirection::ToClient);
+ registerVariable(this->maxHealth_, VariableDirection::ToClient);
+ registerVariable(this->shieldHealth_, VariableDirection::ToClient);
+ registerVariable(this->maxShieldHealth_, VariableDirection::ToClient);
+ registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
+ registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server
}
void Pawn::tick(float dt)
{
SUPER(Pawn, tick, dt);
- this->bShieldRecharging_ = false;
-
+ // Recharge the shield
// TODO: use the existing timer functions instead
if(this->shieldRechargeWaitCountdown_ > 0)
{
@@ -251,6 +247,10 @@
if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
{
+ // Health-damage cannot be absorbed by shields.
+ // Shield-damage only reduces shield health.
+ // Normal damage can be (partially) absorbed by shields.
+
if (shielddamage >= this->getShieldHealth())
{
this->setShieldHealth(0);
@@ -479,11 +479,6 @@
this->weaponSystem_->fire(firemode);
}
- void Pawn::reload()
- {
- this->bShieldRecharging_ = true;
- }
-
void Pawn::postSpawn()
{
this->setHealth(this->initialHealth_);
Modified: code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h 2015-11-01 21:25:57 UTC (rev 10746)
@@ -41,7 +41,7 @@
{
/**
@brief
- Everything in Orxonoy that has a health attribute is a Pawn. After a Pawn is spawned its health is set to
+ Everything in Orxonox that has a health attribute is a Pawn. After a Pawn is spawned its health is set to
its initial health. In every call of the Pawns tick function the game checks whether the pawns health is at
or below zero. If it is, the pawn gets killed.
@@ -140,7 +140,6 @@
virtual void kill();
virtual void fired(unsigned int firemode);
- virtual void reload();
virtual void postSpawn();
void addWeaponSlot(WeaponSlot * wSlot);
@@ -233,7 +232,6 @@
WeakPtr<Pawn> lastHitOriginator_;
WeaponSystem* weaponSystem_;
- bool bShieldRecharging_;
std::string spawnparticlesource_;
float spawnparticleduration_;
Modified: code/branches/fabienHS15/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/fabienHS15/src/orxonox/worldentities/pawns/SpaceShip.h 2015-11-01 21:06:23 UTC (rev 10745)
+++ code/branches/fabienHS15/src/orxonox/worldentities/pawns/SpaceShip.h 2015-11-01 21:25:57 UTC (rev 10746)
@@ -52,7 +52,7 @@
- The <b>rotationThrust</b>, specifies the force with which the SpaceShip rotates.
- The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the SpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the SpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
- The <b>boost shaking</b>, when the SpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
- - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
+ - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again two parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
As mentioned @ref orxonox::Engine Engines can be mounted on the SpaceShip. Here is a (primitive) example of a SpaceShip defined in XML:
@code
@@ -266,7 +266,7 @@
bool bBoost_; //!< Whether the SpaceShip is currently boosting.
bool bBoostCooldown_; //!< Whether the SpaceShip is currently in boost cooldown, during which boosting is impossible.
float initialBoostPower_; //!< The initial (and maximal) boost power.
- float boostPower_; //!< The current boost power.
+ float boostPower_; //!< The current boost power. If the boost power is reduced to zero the boost cooldown will start.
float boostPowerRate_; //!< The rate at which the boost power is recharged.
float boostRate_; //!< The rate at which boost power is used up.
float boostCooldownDuration_; //!< The duration for which boost cooldown is in effect.
@@ -293,7 +293,7 @@
std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.
- Timer timer_; //!< Timer for the cooldown duration.
+ Timer timer_; //!< Timer for the cooldown of the boost.
float shakeDt_; //!< Temporary variable for the shaking of the camera.
Vector3 cameraOriginalPosition_; //!< The original position of the camera before shaking it.
Quaternion cameraOriginalOrientation_; //!< The original orientation of the camera before shaking it.
More information about the Orxonox-commit
mailing list