[Orxonox-commit 4184] r8855 - in code/trunk/src: modules/weapons modules/weapons/munitions modules/weapons/projectiles modules/weapons/weaponmodes orxonox/worldentities/pawns
dafrick at orxonox.net
dafrick at orxonox.net
Mon Aug 22 15:05:27 CEST 2011
Author: dafrick
Date: 2011-08-22 15:05:26 +0200 (Mon, 22 Aug 2011)
New Revision: 8855
Modified:
code/trunk/src/modules/weapons/MuzzleFlash.cc
code/trunk/src/modules/weapons/MuzzleFlash.h
code/trunk/src/modules/weapons/RocketController.cc
code/trunk/src/modules/weapons/RocketController.h
code/trunk/src/modules/weapons/WeaponsPrereqs.h
code/trunk/src/modules/weapons/munitions/FusionMunition.cc
code/trunk/src/modules/weapons/munitions/FusionMunition.h
code/trunk/src/modules/weapons/munitions/LaserMunition.cc
code/trunk/src/modules/weapons/munitions/LaserMunition.h
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h
code/trunk/src/modules/weapons/munitions/RocketMunition.cc
code/trunk/src/modules/weapons/munitions/RocketMunition.h
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
code/trunk/src/modules/weapons/projectiles/Projectile.cc
code/trunk/src/modules/weapons/projectiles/Projectile.h
code/trunk/src/modules/weapons/projectiles/Rocket.cc
code/trunk/src/modules/weapons/projectiles/Rocket.h
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
Log:
Cleaning up game immersion. Roughly documenting weapons module.
Modified: code/trunk/src/modules/weapons/MuzzleFlash.cc
===================================================================
--- code/trunk/src/modules/weapons/MuzzleFlash.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/MuzzleFlash.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -22,11 +22,15 @@
* Author:
* Hagen Seifert
* Co-authors:
- * Ich
- * Dini Mueter
+ * ...
*
*/
+/**
+ @file MuzzleFlash.h
+ @brief Implementation of the MuzzleFlash class.
+*/
+
#include "MuzzleFlash.h"
#include "core/CoreIncludes.h"
@@ -42,6 +46,6 @@
this->setScale(0.1f);
if( GameMode::isMaster() )
- this->delayTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&MuzzleFlash::destroy, this)));
+ this->delayTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&MuzzleFlash::destroy, this)));
}
}
Modified: code/trunk/src/modules/weapons/MuzzleFlash.h
===================================================================
--- code/trunk/src/modules/weapons/MuzzleFlash.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/MuzzleFlash.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file MuzzleFlash.h
+ @brief Definition of the MuzzleFlash class.
+*/
+
#ifndef _MuzzleFlash_H__
#define _MuzzleFlash_H__
@@ -36,6 +41,16 @@
namespace orxonox
{
+
+ /**
+ @brief
+ A muzzle flash that destroys itself after some time.
+ @author
+ Hagen Seifert
+ @ingroup Weapons
+ @todo
+ Remove because it's unused?
+ */
class _WeaponsExport MuzzleFlash : public Billboard
{
public:
@@ -43,7 +58,7 @@
virtual ~MuzzleFlash() {}
private:
- Timer delayTimer_;
+ Timer delayTimer_; //!< Timer to destroy the object.
};
}
Modified: code/trunk/src/modules/weapons/RocketController.cc
===================================================================
--- code/trunk/src/modules/weapons/RocketController.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/RocketController.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,32 +20,36 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
-* Gabriel Nadler, Originalfile: Oli Scheuss
+* Gabriel Nadler
* Co-authors:
* ...
*
*/
+/**
+ @file BasicProjectile.h
+ @brief Implementation of the BasicProjectile class.
+*/
+
#include "RocketController.h"
-#include "projectiles/SimpleRocket.h"
+
#include "util/Math.h"
-#include "weapons/projectiles/SimpleRocket.h"
-#include "util/Debug.h"
-#include "weapons/weaponmodes/SimpleRocketFire.h"
#include "worldentities/pawns/Pawn.h"
+#include "projectiles/SimpleRocket.h"
+#include "weaponmodes/SimpleRocketFire.h"
namespace orxonox
{
/**
@brief
- Constructor.
+ Constructor.
*/
RocketController::RocketController(BaseObject* creator) : Controller(creator)
{
RegisterObject(RocketController);
COUT(5)<< "RocketController constructed\n";
-
+ // Create a rocket for the controller.
this->rocket_ = new SimpleRocket(this);
this->rocket_->setController(this);
this->setControllableEntity(dynamic_cast<ControllableEntity*> (this->rocket_));
@@ -54,44 +58,33 @@
/**
@brief
- The controlling happens here. This method defines what the controller has to do each tick.
+ The controlling happens here. This method defines what the controller has to do each tick.
@param dt
- The duration of the tick.
+ The duration of the tick.
*/
void RocketController::tick(float dt)
{
-
if (this->target_ && this->rocket_->hasFuel()) {
- this->setTargetPosition();
- this->moveToTargetPosition();
+ this->updateTargetPosition();
+ this->moveToPosition(this->targetPosition_);
}
-
-
}
-
RocketController::~RocketController()
{
COUT(5)<< "RocketController destroyed\n";
}
- void RocketController::setTargetPosition()
+ /**
+ @brief
+ Update the position of the target.
+ */
+ void RocketController::updateTargetPosition()
{
- this->targetPosition_=this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
+ this->targetPosition_ = this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
//this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
}
- void RocketController::moveToTargetPosition()
- {
- this->moveToPosition(this->targetPosition_);
- }
-
-
- void RocketController::setTarget(WorldEntity* target)
- {
- this->target_ = target;
- }
-
void RocketController::moveToPosition(const Vector3& target)
{
if (!this->getControllableEntity())
@@ -109,7 +102,4 @@
this->rocket_->rotatePitch(sgn(coord.y)*coord.y*coord.y);
}
-
-
-
}
Modified: code/trunk/src/modules/weapons/RocketController.h
===================================================================
--- code/trunk/src/modules/weapons/RocketController.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/RocketController.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,29 +20,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Gabriel Nadler, Originalfile: Oli Scheuss
+ * Gabriel Nadler
* Co-authors:
* ...
*
*/
+/**
+ @file RocketController.h
+ @brief Definition of the RocketController class.
+*/
+
#ifndef _RocketController_H__
#define _RocketController_H__
#include "weapons/WeaponsPrereqs.h"
+#include "tools/interfaces/Tickable.h"
#include "controllers/Controller.h"
-#include "tools/interfaces/Tickable.h"
-#include "weapons/projectiles/SimpleRocket.h"
-#include "weapons/weaponmodes/SimpleRocketFire.h"
namespace orxonox
{
/**
@brief
- Controller for the Rocket (targetseeking)
+ Controller for the SimpleRocket (target seeking)
@author
- Gabriel Nadler, Originalfile: Oli Scheuss
+ Gabriel Nadler
+ @ingroup Weapons
*/
class _WeaponsExport RocketController : public Controller, public Tickable
{
@@ -51,22 +55,30 @@
virtual ~RocketController();
virtual void tick(float dt);
+ /**
+ @brief Get the rocket that is controlled by this controller.
+ @return Returns a pointer to the rocket.
+ */
SimpleRocket* getRocket() const
- { return this->rocket_; };
- void setTarget(WorldEntity* target);
+ { return this->rocket_; };
+
+ /**
+ @brief Set the target of the rocket.
+ @param target A pointer to the target.
+ */
+ void setTarget(WorldEntity* target)
+ { this->target_ = target; }
+
protected:
+ void updateTargetPosition();
void moveToPosition(const Vector3& target);
- void setTargetPosition();
- void moveToTargetPosition();
private:
- SimpleRocket* rocket_; //!<The Rocket it controlls
- Vector3 targetPosition_;
- WeakPtr<PlayerInfo> player_;
+ SimpleRocket* rocket_; //!< The Rocket it controls.
+ Vector3 targetPosition_; //!< The position of the target.
+ WeakPtr<PlayerInfo> player_; //!< The player the rocket belongs to.
- WeakPtr<WorldEntity> target_;
-
-
+ WeakPtr<WorldEntity> target_; //!< The target.
};
}
Modified: code/trunk/src/modules/weapons/WeaponsPrereqs.h
===================================================================
--- code/trunk/src/modules/weapons/WeaponsPrereqs.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/WeaponsPrereqs.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -80,6 +80,8 @@
class LightningGunProjectile;
class ParticleProjectile;
class Projectile;
+ class Rocket;
+ class SimpleRocket;
// weaponmodes
class EnergyDrink;
@@ -87,6 +89,8 @@
class HsW01;
class LaserFire;
class LightningGun;
+ class RocketFire;
+ class SimpleRocketFire;
}
#endif /* _WeaponsPrereqs_H__ */
Modified: code/trunk/src/modules/weapons/munitions/FusionMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/FusionMunition.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/FusionMunition.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file FusionMunition.h
+ @brief Implementation of the FusionMunition class.
+*/
+
#include "FusionMunition.h"
#include "core/CoreIncludes.h"
Modified: code/trunk/src/modules/weapons/munitions/FusionMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/FusionMunition.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/FusionMunition.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file FusionMunition.h
+ @brief Definition of the FusionMunition class.
+*/
+
#ifndef _FusionMunition_H__
#define _FusionMunition_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ FusionMunition.
+ @author
+ Martin Polak
+ @ingroup WeaponsMunitions
+ */
class _WeaponsExport FusionMunition : public Munition
{
public:
Modified: code/trunk/src/modules/weapons/munitions/LaserMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/LaserMunition.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/LaserMunition.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file LaserMunition.h
+ @brief Implementation of the LaserMunition class.
+*/
+
#include "LaserMunition.h"
#include "core/CoreIncludes.h"
@@ -47,7 +52,7 @@
this->bAllowMunitionRefilling_ = true;
this->bAllowMultiMunitionRemovementUnderflow_ = true;
- this->replenishIntervall_ = 0.5f;
+ this->replenishInterval_ = 0.5f;
this->replenishMunitionAmount_ = 1;
}
}
Modified: code/trunk/src/modules/weapons/munitions/LaserMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/LaserMunition.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/LaserMunition.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file LaserMunition.h
+ @brief Definition of the LaserMunition class.
+*/
+
#ifndef _LaserMunition_H__
#define _LaserMunition_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ LaserMunition.
+ @author
+ Martin Polak
+ @ingroup WeaponsMunitions
+ */
class _WeaponsExport LaserMunition : public ReplenishingMunition
{
public:
Modified: code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file ReplenishingMunition.h
+ @brief Implementation of the ReplenishingMunition class.
+*/
+
#include "ReplenishingMunition.h"
#include "core/CoreIncludes.h"
@@ -39,7 +44,7 @@
{
RegisterObject(ReplenishingMunition);
- this->replenishIntervall_ = 1.0f;
+ this->replenishInterval_ = 1.0f;
this->replenishMunitionAmount_ = 1;
// Use the timer to initialize itself after the first tick (because the real values for
@@ -51,7 +56,7 @@
void ReplenishingMunition::initializeTimer()
{
// Initialize the timer
- this->replenishingTimer_.setTimer(this->replenishIntervall_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this)));
+ this->replenishingTimer_.setTimer(this->replenishInterval_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this)));
}
void ReplenishingMunition::replenish()
Modified: code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file ReplenishingMunition.h
+ @brief Definition of the ReplenishingMunition class.
+*/
+
#ifndef _ReplenishingMunition_H__
#define _ReplenishingMunition_H__
@@ -36,6 +41,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Munition that is replenished by a certain amount each time interval.
+ @author
+ Fabian 'x3n' Landau
+ @ingroup WeaponsMunitions
+ */
class _WeaponsExport ReplenishingMunition : public Munition
{
public:
@@ -43,14 +56,14 @@
virtual ~ReplenishingMunition() {}
protected:
- float replenishIntervall_;
- unsigned int replenishMunitionAmount_;
+ float replenishInterval_; //!< The interval in which the munition is replenished.
+ unsigned int replenishMunitionAmount_; //!< The amount by which it is replenished.
private:
void replenish();
void initializeTimer();
- Timer replenishingTimer_;
+ Timer replenishingTimer_; //!< Timer to do the replenishing.
};
}
Modified: code/trunk/src/modules/weapons/munitions/RocketMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/RocketMunition.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/RocketMunition.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file RocketMunition.h
+ @brief Implementation of the RocketMunition class.
+*/
+
#include "RocketMunition.h"
#include "core/CoreIncludes.h"
Modified: code/trunk/src/modules/weapons/munitions/RocketMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/RocketMunition.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/munitions/RocketMunition.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file RocketMunition.h
+ @brief Definition of the RocketMunition class.
+*/
+
#ifndef _RocketMunition_H__
#define _RocketMunition_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Munition for the Rocket.
+ @author
+ Fabian 'x3n' Landau
+ @ingroup WeaponsMunitions
+ */
class _WeaponsExport RocketMunition : public Munition
{
public:
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,16 +26,18 @@
*
*/
+/**
+ @file BasicProjectile.h
+ @brief Implementation of the BasicProjectile class.
+*/
+
#include "BasicProjectile.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/command/Executor.h"
-#include "objects/collisionshapes/SphereCollisionShape.h"
-#include "worldentities/pawns/Pawn.h"
+
#include "graphics/ParticleSpawner.h"
-#include "core/OrxonoxClass.h"
namespace orxonox
{
@@ -45,7 +47,7 @@
*/
BasicProjectile::BasicProjectile() : OrxonoxClass()
{
- RegisterRootObject(BasicProjectile);// - register the BasicProjectile class to the core
+ RegisterRootObject(BasicProjectile);// Register the BasicProjectile class to the core
this->bDestroy_ = false;
@@ -60,51 +62,59 @@
{
}
- /* The function called when a projectile hits another thing.
- * calls the hit-function, starts the reload countdown, displays visual effects
- * hit is defined in src/orxonox/worldentities/pawns/pawn.cc
- */
- bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_)
+ /**
+ @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.
+ 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.
+ @param contactPoint
+ A btManifoldPoint indicating the point of contact/impact.
+ @return
+ Returns true if the collision resulted in a successful hit.
+ @see Pawn.h
+ */
+ bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- if (!this_->getBDestroy() && GameMode::isMaster())
+ if (!this->bDestroy_ && GameMode::isMaster())
{
- if (otherObject == owner) //prevents you from shooting yourself
+ if (otherObject == this->getShooter()) // Prevents you from shooting yourself
return false;
- this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.
- // The projectile is destroyed by its tick()-function (in the following tick).
+ this->bDestroy_ = true; // If something is hit, the object is destroyed and can't hit something else.
+ // The projectile is destroyed by its tick()-function (in the following tick).
- Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL
- WorldEntity* entity = orxonox_cast<WorldEntity*>(this_);
- assert(entity); //entity must not be null
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(this);
+ assert(entity); // The projectile must not be a WorldEntity.
-
- // if visual effects after destruction cause problems, put this block below the effects code block
+ // If visual effects after destruction cause problems, put this block below the effects code block
if (victim)
{
- victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
+ victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
victim->startReloadCountdown();
}
- // visual effects for being hit, depending on whether the shield is hit or not
- if (owner) //if the owner does not exist (anymore?), no effects are displayed.
+ // Visual effects for being hit, depending on whether the shield is hit or not
+ if (this->getShooter()) // If the owner does not exist (anymore?), no effects are displayed.
{
- // damping and explosion effect is only played if the victim is no pawn (see cast above)
- // or if the victim is a pawn, has no shield left, is still alive and any damage goes to the health
- if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0 && (this_->getDamage() > 0 || this_->getHealthDamage() > 0)))
+ // Damping and explosion effect is only played if the victim is no Pawn (see cast above)
+ // or if the victim is a Pawn, has no shield left, is still alive and any damage goes to the health
+ if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0.0f && (this->getDamage() > 0.0f || this->getHealthDamage() > 0.0f)))
{
{
- ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
effect->setSource("Orxonox/explosion3");
effect->setLifetime(2.0f);
}
- // second effect with same condition
+ // Second effect with same condition
{
- ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -114,17 +124,38 @@
}
// victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
- if (victim && victim->hasShield() && (this_->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0)
+ if (victim && victim->hasShield() && (this->getDamage() > 0.0f || this->getShieldDamage() > 0.0f) && victim->getHealth() > 0.0f)
{
- ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
effect->setDestroyAfterLife(true);
effect->setSource("Orxonox/Shield");
effect->setLifetime(0.5f);
victim->attach(effect);
}
}
-
+ return true;
}
return false;
}
+
+ /**
+ @brief
+ Check whether the projectile needs to be destroyed and destroys it if so.
+ Needs to be called in the tick() by every Class directly inheriting from BasicProjectile, to make sure the projectile is destroyed after it has hit something.
+ */
+ void BasicProjectile::destroyCheck(void)
+ {
+ if(GameMode::isMaster() && this->bDestroy_)
+ this->destroy();
+ }
+
+ /**
+ @brief
+ Destroys the object.
+ */
+ void BasicProjectile::destroyObject(void)
+ {
+ if(GameMode::isMaster())
+ this->destroy();
+ }
}
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,57 +26,109 @@
*
*/
+/**
+ @file BasicProjectile.h
+ @brief Definition of the BasicProjectile class.
+*/
+
#ifndef _BasicProjectile_H__
#define _BasicProjectile_H__
#include "weapons/WeaponsPrereqs.h"
-#include "tools/Timer.h"
+#include "worldentities/pawns/Pawn.h"
+
#include "core/OrxonoxClass.h"
namespace orxonox
{
+
+ /**
+ @brief
+ Baseclass of all projectiles. Defines the damage the projectile does.
+
+ @author
+ Simon Miescher
+ @ingroup WeaponsProjectiles
+ */
class _WeaponsExport BasicProjectile : public virtual OrxonoxClass
{
public:
BasicProjectile();
-
virtual ~BasicProjectile();
- static bool basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_);
-
- void basicDestroyObject();
-
+ /**
+ @brief Set the normal damage done by this projectile.
+ Normal damage can be (partially) absorbed by shields.
+ @param damage The amount of damage. Must be non-negative.
+ */
inline void setDamage(float damage)
- { this->damage_ = damage; }
+ { if(damage >= 0.0f) { this->damage_ = damage; return; } COUT(1) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
+ /**
+ @brief Get the normal damage done by this projectile.
+ Normal damage can be (partially) absorbed by shields.
+ @return Returns the amount of damage. Is non-negative.
+ */
inline float getDamage() const
{ return this->damage_; }
+ /**
+ @brief Set the health-damage done by this projectile.
+ Health-damage cannot be absorbed by shields.
+ @param healthdamage The amount of damage. Must be non-negative.
+ */
inline void setHealthDamage(float healthdamage)
- { this->healthdamage_ = healthdamage; }
+ { if(healthdamage >= 0.0f) { this->healthdamage_ = healthdamage; return; } COUT(1) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
+ /**
+ @brief Get the health-damage done by this projectile.
+ Health-damage cannot be absorbed by shields.
+ @return healthdamage The amount of damage. Is non-negative.
+ */
inline float getHealthDamage() const
{ return this->healthdamage_; }
+ /**
+ @brief Set the shield-damage done by this projectile.
+ Shield-damage only reduces shield health.
+ @param shielddamage The amount of damage. Must be non-negative.
+ */
inline void setShieldDamage(float shielddamage)
- { this->shielddamage_ = shielddamage; } //ShieldDamage wird korrekt gesettet vom XML-File
+ { if(shielddamage >= 0.0f) { this->shielddamage_ = shielddamage; return; } COUT(1) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
+ /**
+ @brief Get the shield-damage done by this projectile.
+ Shield-damage only reduces shield health.
+ @param shielddamage The amount of damage. Is non-negative.
+ */
inline float getShieldDamage() const
{ return this->shielddamage_; }
+ /**
+ @brief Set the entity that fired the projectile.
+ @param shooter A pointer to the Pawn that fired the projectile.
+ */
+ virtual void setShooter(Pawn* shooter)
+ { this->shooter_ = shooter; }
+ /**
+ @brief Get the entity that fired the projectile.
+ @return Returns a pointer to the Pawn that fired the projectile.
+ */
+ inline Pawn* getShooter(void)
+ { return this->shooter_; }
- inline void setBDestroy(bool bDestroy)
- { this->bDestroy_ = bDestroy; }
- inline float getBDestroy() const
- { return this->bDestroy_; }
+ virtual void destroyObject(void);
+ protected:
+ bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ void destroyCheck(void);
private:
-// WeakPtr<Pawn> owner_; //owner cannot be set in BasicProjectile, because it's already defined in MobileEntity and Movable Entity
+ WeakPtr<Pawn> shooter_; //!< The entity that fired the projectile.
- float damage_;
- float healthdamage_;
- float shielddamage_;
+ float damage_; //!< The amount of normal damage. Normal damage can be (partially) absorbed by shields.
+ float healthdamage_; //!< The amount of health-damage. Health-damage cannot be absorbed by shields.
+ float shielddamage_; //!< The amount of shield-damage. Shield-damage only reduces shield health.
- bool bDestroy_;
+ bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file BillboardProjectile.h
+ @brief Implementation of the BillboardProjectile class.
+*/
+
#include "BillboardProjectile.h"
#include "core/CoreIncludes.h"
@@ -43,6 +48,8 @@
if (GameMode::showsGraphics())
{
assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
+
+ // Create the billboard.
this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5f, 0.5f, 0.7f, 0.8f), 1);
this->attachOgreObject(this->billboard_.getBillboardSet());
}
@@ -56,20 +63,37 @@
this->detachOgreObject(this->billboard_.getBillboardSet());
}
+ /**
+ @brief
+ Set the colour of the BillboardProjectile.
+ @param colour
+ The colour to be set.
+ */
void BillboardProjectile::setColour(const ColourValue& colour)
{
this->billboard_.setColour(colour);
}
+ /**
+ @brief
+ Set the material of the BillboardProjectile.
+ @param material
+ The material name.
+ */
void BillboardProjectile::setMaterial(const std::string& material)
{
this->billboard_.setMaterial(material);
}
+ /**
+ @brief
+ Is called when the visibility of the BillboardProjectile has changed.
+ */
void BillboardProjectile::changedVisibility()
{
SUPER(BillboardProjectile, changedVisibility);
+ // Also change the visibility of the billboard.
this->billboard_.setVisible(this->isVisible());
}
}
Modified: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file BillboardProjectile.h
+ @brief Definition of the BillboardProjectile class.
+*/
+
#ifndef _BillboardProjectile_H__
#define _BillboardProjectile_H__
@@ -37,6 +42,15 @@
namespace orxonox
{
+
+ /**
+ @brief
+ A BillboardProjectile is a projectile that is represented by a Billboard.
+
+ @author
+ Fabian 'x3n' Landau
+ @ingroup WeaponsProjectiles
+ */
class _WeaponsExport BillboardProjectile : public Projectile
{
public:
@@ -48,7 +62,7 @@
virtual void changedVisibility();
private:
- BillboardSet billboard_;
+ BillboardSet billboard_; //!< The billboard that represents the projectile.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/weapons/projectiles/CMakeLists.txt 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/CMakeLists.txt 2011-08-22 13:05:26 UTC (rev 8855)
@@ -1,9 +1,9 @@
ADD_SOURCE_FILES(WEAPONS_SRC_FILES
+ BasicProjectile.cc
BillboardProjectile.cc
ParticleProjectile.cc
Projectile.cc
LightningGunProjectile.cc
Rocket.cc
SimpleRocket.cc
- BasicProjectile.cc
)
Modified: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,11 +26,16 @@
*
*/
+/**
+ @file LightningGunProjectile.h
+ @brief Implementation of the LightningGunProjectile class.
+*/
+
#include "LightningGunProjectile.h"
-#include "util/Convert.h"
#include "core/CoreIncludes.h"
#include "core/command/Executor.h"
+#include "util/Convert.h"
namespace orxonox
{
@@ -52,6 +57,12 @@
registerVariable(this->materialBase_);
}
+ /**
+ @brief
+ Set the material.
+ @param material
+ The name of the material. Material names with 1 to 8 appended must exist.
+ */
void LightningGunProjectile::setMaterial(const std::string& material)
{
this->materialBase_ = material;
@@ -59,6 +70,10 @@
BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_));
}
+ /**
+ @brief
+ Change the texture.
+ */
void LightningGunProjectile::changeTexture()
{
this->textureIndex_++;
Modified: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file LightningGunProjectile.h
+ @brief Definition of the LightningGunProjectile class.
+*/
+
#ifndef _LightningGunProjectile_H__
#define _LightningGunProjectile_H__
@@ -37,6 +42,15 @@
namespace orxonox
{
+
+ /**
+ @brief
+ The LightningGunProjectile is a projectile that is represented by a looped series of billboards.
+
+ @author
+ Joel Smely
+ @ingroup WeaponsProjectiles
+ */
class _WeaponsExport LightningGunProjectile : public BillboardProjectile
{
public:
@@ -45,14 +59,14 @@
virtual void setMaterial(const std::string& material);
- protected:
+ private:
+ void registerVariables();
void changeTexture();
- unsigned int textureIndex_;
- unsigned int maxTextureIndex_;
- Timer textureTimer_;
- std::string materialBase_;
- private:
- void registerVariables();
+
+ unsigned int textureIndex_; //!< The current index of the texture. (i.e. the index of the currently displayed texture)
+ unsigned int maxTextureIndex_; //!< The maximal index.
+ Timer textureTimer_; //!< A timer that loops and changes textures each time it expires.
+ std::string materialBase_; //!< The base name of the material.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,11 +26,16 @@
*
*/
+/**
+ @file ParticleProjectile.h
+ @brief Implementation of the ParticleProjectile class.
+*/
+
#include "ParticleProjectile.h"
#include <OgreParticleEmitter.h>
+#include "core/CoreIncludes.h"
#include "tools/ParticleInterface.h"
-#include "core/CoreIncludes.h"
#include "Scene.h"
namespace orxonox
@@ -43,6 +48,7 @@
if (GameMode::showsGraphics())
{
+ // Create the particles.
this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::Normal);
this->attachOgreObject(this->particles_->getParticleSystem());
this->particles_->setKeepParticlesInLocalSpace(0);
@@ -62,10 +68,15 @@
}
}
+ /**
+ @brief
+ Is called when the visibility of the ParticleProjectile has changed.
+ */
void ParticleProjectile::changedVisibility()
{
SUPER(ParticleProjectile, changedVisibility);
+ // Change the visibility of the particles.
if (this->particles_)
this->particles_->setEnabled(this->isVisible());
}
Modified: code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file ParticleProjectile.h
+ @brief Definition of the ParticleProjectile class.
+*/
+
#ifndef _ParticleProjectile_H__
#define _ParticleProjectile_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ A projectile that is represented by particles.
+ @author
+ Fabian 'x3n' Landau
+ @ingroup WeaponsProjectiles
+ */
class _WeaponsExport ParticleProjectile : public BillboardProjectile
{
public:
@@ -42,7 +55,7 @@
virtual void changedVisibility();
private:
- ParticleInterface* particles_;
+ ParticleInterface* particles_; //!< The particles.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,15 +26,20 @@
*
*/
+/**
+ @file Projectile.h
+ @brief Implementation of the Projectile class.
+*/
+
#include "Projectile.h"
-#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/command/Executor.h"
+
#include "objects/collisionshapes/SphereCollisionShape.h"
#include "worldentities/pawns/Pawn.h"
-#include "graphics/ParticleSpawner.h"
namespace orxonox
{
@@ -45,21 +50,20 @@
RegisterObject(Projectile);
this->setConfigValues();
- this->owner_ = 0;
// Get notification about collisions
if (GameMode::isMaster())
{
- this->setMass(1.0);
+ this->setMass(1.0f);
this->enableCollisionCallback();
this->setCollisionResponse(false);
this->setCollisionType(Kinematic);
SphereCollisionShape* shape = new SphereCollisionShape(this);
- shape->setRadius(20);
+ shape->setRadius(20.0f);
this->attachCollisionShape(shape);
- this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Projectile::destroyObject, this)));
+ this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
}
}
@@ -69,7 +73,7 @@
void Projectile::setConfigValues()
{
- SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
+ SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive");
}
@@ -80,25 +84,12 @@
if (!this->isActive())
return;
- if (this->getBDestroy())
- this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
+ this->destroyCheck();
}
- void Projectile::destroyObject()
- {
- if (GameMode::isMaster())
- this->destroy();
- }
-
- /* Calls the collidesAgainst function of BasicProjectile
- */
bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
+ return this->processCollision(otherObject, contactPoint);
}
- void Projectile::setOwner(Pawn* owner)
- {
- this->owner_ = owner;
- }
}
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file Projectile.h
+ @brief Definition of the Projectile class.
+*/
+
#ifndef _Projectile_H__
#define _Projectile_H__
@@ -38,6 +43,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Represents all 'standard' projectiles.
+
+ @author
+ Fabian 'x3n' Landau
+ @author
+ Simon Miescher
+ @ingroup WeaponsProjectiles
+ */
class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
{
public:
@@ -45,20 +61,13 @@
virtual ~Projectile();
void setConfigValues();
- void destroyObject();
virtual void tick(float dt);
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- void setOwner(Pawn* owner);
- inline Pawn* getOwner() const
- { return this->owner_; }
-
-
private:
- WeakPtr<Pawn> owner_;
- float lifetime_;
- Timer destroyTimer_;
+ float lifetime_; //!< The time the projectile exists.
+ Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,26 +26,31 @@
*
*/
+/**
+ @file Rocket.h
+ @brief Implementation of the Rocket class.
+*/
+
#include "Rocket.h"
#include <BulletDynamics/Dynamics/btRigidBody.h>
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
-#include "worldentities/CameraPosition.h"
-#include "worldentities/pawns/Pawn.h"
+
+#include "Scene.h"
+#include "controllers/Controller.h"
+#include "graphics/Model.h"
#include "graphics/ParticleSpawner.h"
-#include "graphics/Model.h"
+#include "infos/PlayerInfo.h"
#include "objects/collisionshapes/ConeCollisionShape.h"
-#include "infos/PlayerInfo.h"
-#include "controllers/Controller.h"
#include "sound/WorldSound.h"
-#include "Scene.h"
+#include "worldentities/CameraPosition.h"
+#include "worldentities/pawns/Pawn.h"
namespace orxonox
{
CreateFactory(Rocket);
- // create the factory for the Rocket
/**
@brief
@@ -56,20 +61,23 @@
, BasicProjectile()
, RadarViewable(creator, static_cast<WorldEntity*>(this))
{
- RegisterObject(Rocket);// - register the Rocket class to the core
+ RegisterObject(Rocket);// Register the Rocket class to the core
this->localAngularVelocity_ = 0;
- this->lifetime_ = 100;
+ this->lifetime_ = 100.0f;
if (GameMode::isMaster())
{
this->setCollisionType(WorldEntity::Kinematic);
this->setVelocity(0,0,-100);
+ // Create rocket model
Model* model = new Model(this);
model->setMeshSource("rocket.mesh");
model->scale(0.7f);
this->attach(model);
+
+ // Add effects.
ParticleEmitter* fire = new ParticleEmitter(this);
this->attach(fire);
fire->setOrientation(this->getOrientation());
@@ -79,13 +87,15 @@
this->setCollisionResponse(false);
this->setCollisionType(Kinematic);
+ // Add collision shape
ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
collisionShape->setRadius(3);
collisionShape->setHeight(500);
this->attachCollisionShape(collisionShape);
- this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
+ this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
+ // Add sound
this->defSndWpnEngine_ = new WorldSound(this);
this->defSndWpnEngine_->setLooping(true);
this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
@@ -104,6 +114,7 @@
this->defSndWpnLaunch_ = 0;
}
+ // Add camera
CameraPosition* camPosition = new CameraPosition(this);
camPosition->setPosition(0,4,15);
camPosition->setAllowMouseLook(true);
@@ -140,20 +151,17 @@
/**
@brief
- Method for creating a Rocket through XML.
+ Sets the entity that fired the Rocket.
+ @param shooter
+ A pointer to the Pawn that fired the Rocket.
*/
- void Rocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ void Rocket::setShooter(Pawn* shooter)
{
- // this calls the XMLPort function of the parent class
- SUPER(Rocket, XMLPort, xmlelement, mode);
- }
+ this->BasicProjectile::setShooter(shooter);
+
+ this->player_ = this->getShooter()->getPlayer();
+ this->getShooter()->getPlayer()->startTemporaryControl(this);
- void Rocket::setOwner(Pawn* owner)
- {
- this->owner_ = owner;
- this->player_ = this->getOwner()->getPlayer();
- this->getOwner()->getPlayer()->startTemporaryControl(this);
-
if( GameMode::isMaster() )
{
this->defSndWpnEngine_->play();
@@ -178,45 +186,46 @@
this->localAngularVelocity_ = 0;
}
- if( GameMode::isMaster() )
- {
- if( this->getBDestroy() )
- this->destroy();
-
- }
+ this->destroyCheck();
}
- /* Calls the collidesAgainst function of BasicProjectile
- */
bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
+ return this->processCollision(otherObject, contactPoint);
}
- void Rocket::destroyObject()
+ /**
+ @brief
+ Destroys the Rocket and stops the sound,
+ */
+ void Rocket::destroyObject(void)
{
- if (GameMode::isMaster())
- {
- if(this->defSndWpnEngine_->isPlaying())
- {
- this->defSndWpnEngine_->stop();
- }
- this->destroy();
- }
+ if (GameMode::isMaster() && this->defSndWpnEngine_->isPlaying())
+ this->defSndWpnEngine_->stop();
+
+ this->BasicProjectile::destroyObject();
}
+ /**
+ @brief
+ Destroys the Rocket upon pressing "fire".
+ */
void Rocket::fired(unsigned int firemode)
{
- this->destroy();
+ this->destroyObject();
}
+ /**
+ @brief
+ The effects that are displayed, when the Rocket is destroyed.
+ */
void Rocket::destructionEffect()
{
ParticleSpawner *effect1, *effect2;
- if( this->getOwner() )
+ if(this->getShooter())
{
- effect1 = new ParticleSpawner(this->getOwner()->getCreator());
- effect2 = new ParticleSpawner(this->getOwner()->getCreator());
+ effect1 = new ParticleSpawner(this->getShooter()->getCreator());
+ effect2 = new ParticleSpawner(this->getShooter()->getCreator());
}
else
{
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,14 +26,20 @@
*
*/
+/**
+ @file Rocket.h
+ @brief Definition of the Rocket class.
+*/
+
#ifndef _Rocket_H__
#define _Rocket_H__
#include "weapons/WeaponsPrereqs.h"
#include "tools/Timer.h"
+
+#include "interfaces/RadarViewable.h"
#include "worldentities/ControllableEntity.h"
-#include "interfaces/RadarViewable.h"
#include "BasicProjectile.h"
@@ -43,10 +49,11 @@
/**
@brief
- Rocket, that is made to move upon a specified pattern.
- This class was constructed for the PPS tutorial.
+ Rocket that can be steered by the player.
+
@author
Oli Scheuss
+ @ingroup WeaponsProjectiles
*/
class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable
{
@@ -54,16 +61,15 @@
Rocket(BaseObject* creator);
virtual ~Rocket();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- void destroyObject();
+ virtual void destroyObject(void);
void destructionEffect();
- virtual void moveFrontBack(const Vector2& value){}
- virtual void moveRightLeft(const Vector2& value){}
- virtual void moveUpDown(const Vector2& value){}
+ virtual void moveFrontBack(const Vector2& value) {}
+ virtual void moveRightLeft(const Vector2& value) {}
+ virtual void moveUpDown(const Vector2& value) {}
virtual void rotateYaw(const Vector2& value);
virtual void rotatePitch(const Vector2& value);
@@ -74,55 +80,52 @@
@param value The amount by which the Rocket is to be moved.
*/
inline void moveFrontBack(float value)
- { this->moveFrontBack(Vector2(value, 0)); }
+ { this->moveFrontBack(Vector2(value, 0)); }
/**
@brief Moves the Rocket in the Right/Left-direction by the specifed amount.
@param value The amount by which the Rocket is to be moved.
*/
inline void moveRightLeft(float value)
- { this->moveRightLeft(Vector2(value, 0)); }
+ { this->moveRightLeft(Vector2(value, 0)); }
/**
@brief Moves the Rocket in the Up/Down-direction by the specifed amount.
@param value The amount by which the Rocket is to be moved.
*/
inline void moveUpDown(float value)
- { this->moveUpDown(Vector2(value, 0)); }
+ { this->moveUpDown(Vector2(value, 0)); }
/**
@brief Rotates the Rocket around the y-axis by the specifed amount.
@param value The amount by which the Rocket is to be rotated.
*/
inline void rotateYaw(float value)
- { this->rotateYaw(Vector2(value, 0)); }
+ { this->rotateYaw(Vector2(value, 0)); }
/**
@brief Rotates the Rocket around the x-axis by the specifed amount.
@param value The amount by which the Rocket is to be rotated.
*/
inline void rotatePitch(float value)
- { this->rotatePitch(Vector2(value, 0)); }
+ { this->rotatePitch(Vector2(value, 0)); }
/**
@brief Rotates the Rocket around the z-axis by the specifed amount.
@param value The amount by which the Rocket is to be rotated.
*/
inline void rotateRoll(float value)
- { this->rotateRoll(Vector2(value, 0)); }
+ { this->rotateRoll(Vector2(value, 0)); }
- void setOwner(Pawn* owner);
- inline Pawn* getOwner() const
- { return this->owner_; }
+ virtual void setShooter(Pawn* shooter);
virtual void fired(unsigned int firemode);
private:
- WeakPtr<Pawn> owner_;
- Vector3 localAngularVelocity_;
+ Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
- WeakPtr<PlayerInfo> player_;
- Timer destroyTimer_;
- float lifetime_;
+ WeakPtr<PlayerInfo> player_; //!< The player that controls the Rocket.
+ Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
+ float lifetime_; //!< The time the projectile exists.
- WorldSound* defSndWpnEngine_;
- WorldSound* defSndWpnLaunch_;
+ WorldSound* defSndWpnEngine_; //!< Engine sound.
+ WorldSound* defSndWpnLaunch_; //!< Launch sound.
};
}
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,28 +20,36 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Oliver Scheuss
+ * Gabriel Nadler
* Co-authors:
* simonmie
*
*/
+/**
+ @file SimpleRocket.h
+ @brief Implementation of the SimpleRocket class.
+*/
+
+
#include "SimpleRocket.h"
#include <BulletDynamics/Dynamics/btRigidBody.h>
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
-#include "worldentities/pawns/Pawn.h"
-#include "graphics/ParticleSpawner.h"
+#include "util/Debug.h"
+
+#include "controllers/Controller.h"
#include "graphics/Model.h"
-#include "objects/collisionshapes/ConeCollisionShape.h"
+#include "graphics/ParticleSpawner.h"
#include "infos/PlayerInfo.h"
-#include "controllers/Controller.h"
-#include "weapons/RocketController.h"
+#include "objects/collisionshapes/ConeCollisionShape.h"
+#include "worldentities/pawns/Pawn.h"
#include "sound/WorldSound.h"
-#include "util/Debug.h"
+#include "weapons/RocketController.h"
+
namespace orxonox
{
@@ -52,24 +60,25 @@
, BasicProjectile()
, RadarViewable(creator, static_cast<WorldEntity*>(this))
{
- RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
+ RegisterObject(SimpleRocket);// Register the SimpleRocket class to the core
this->localAngularVelocity_ = 0;
- this->lifetime_ = 10;
+ this->lifetime_ = 10.f;
- this->setMass(15);
-// COUT(4) << "simplerocket constructed\n";
+ this->setMass(15.0);
if (GameMode::isMaster())
{
this->setCollisionType(WorldEntity::Kinematic);
- this->fuel_=true;
+ this->fuel_ = true;
+ // Create rocket model.
Model* model = new Model(this);
model->setMeshSource("rocket.mesh");
model->scale(0.7f);
this->attach(model);
+ // Add effects.
this->fire_ = new ParticleEmitter(this);
this->attach(this->fire_);
@@ -79,13 +88,15 @@
this->setCollisionResponse(false);
this->setCollisionType(Kinematic);
+ // Add collision shape.
// TODO: fix the orientation and size of this collision shape to match the rocket
ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
collisionShape->setOrientation(this->getOrientation());
collisionShape->setRadius(1.5f);
collisionShape->setHeight(5);
this->attachCollisionShape(collisionShape);
- this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
+
+ this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
}
this->setRadarObjectColour(ColourValue(1.0, 1.0, 0.0)); // yellow
@@ -96,38 +107,35 @@
/**
- * @brief updates state of rocket, disables fire if no fuel
- * @param dt tick-length
+ @brief
+ Updates state of rocket, disables fire if no fuel
+ @param dt
+ tick-length
*/
void SimpleRocket::tick(float dt)
{
-
SUPER(SimpleRocket, tick, dt);
- if ( GameMode::isMaster() )
+
+ if (GameMode::isMaster())
{
-
-
this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
this->localAngularVelocity_ = 0;
-
if (this->fuel_)
{
- if (this->destroyTimer_.getRemainingTime()< (static_cast<float>(this->FUEL_PERCENTAGE)/100) *this->lifetime_ )
- this->fuel_=false;
+ if (this->destroyTimer_.getRemainingTime() < this->FUEL_PERCENTAGE*this->lifetime_ )
+ this->fuel_ = false;
} else
this->disableFire();
-
- if( this->getBDestroy() )
- this->destroy();
}
+ this->destroyCheck();
}
/**
- * @brief Sets the Acceleration to 0 and detaches the fire
- * @return void
+ @brief
+ Sets the Acceleration to 0 and detaches the fire.
*/
void SimpleRocket::disableFire()
{
@@ -135,7 +143,7 @@
this->fire_->detachFromParent();
}
- /**s
+ /**
@brief
Destructor. Destroys controller, if present and kills sounds, if playing.
*/
@@ -152,36 +160,22 @@
/**
@brief
- Method for creating a SimpleRocket through XML.
+ Set the entity that fired the SimpleRocket.
+ @param shooter
+ A pointer to the Pawn that fired the SimpleRocket.
*/
- void SimpleRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ void SimpleRocket::setShooter(Pawn* shooter)
{
- // this calls the XMLPort function of the parent class
- SUPER(SimpleRocket, XMLPort, xmlelement, mode);
+ BasicProjectile::setShooter(shooter);
+
+ this->player_ = this->getShooter()->getPlayer();
}
- void SimpleRocket::setOwner(Pawn* owner)
- {
- this->owner_ = owner;
- this->player_ = this->getOwner()->getPlayer();
- }
-
-
- /* Calls the collidesAgainst function of BasicProjectile
- */
bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
+ return this->processCollision(otherObject, contactPoint);
}
- void SimpleRocket::destroyObject()
- {
- if (GameMode::isMaster())
- {
- this->destroy();
- }
- }
-
/**
@brief
Rotates the SimpleRocket around the y-axis by the amount specified by the first component of the input 2-dim vector.
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,21 +20,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Oliver Scheuss
+ * Gabriel Nadler
* Co-authors:
* simonmie
*
*/
+/**
+ @file SimpleRocket.h
+ @brief Definition of the SimpleRocket class.
+*/
+
#ifndef _SimpleRocket_H__
#define _SimpleRocket_H__
#include "weapons/WeaponsPrereqs.h"
#include "tools/Timer.h"
-#include "worldentities/ControllableEntity.h"
+
#include "graphics/ParticleSpawner.h"
#include "interfaces/RadarViewable.h"
+#include "worldentities/ControllableEntity.h"
#include "BasicProjectile.h"
@@ -44,9 +50,11 @@
/**
@brief
- SimpleRocket, follows direction from a Rocketcontroller, has fuel for 80% of its lifetime, afterwards it's fire disappears.
+ SimpleRocket is a target seeking, intelligent rocket. It follows its target until it either hits something or runs out of fuel.
+ The steering is done by the RocketController.
@author
- Gabriel Nadler (Original file: Oli Scheuss)
+ Gabriel Nadler
+ @ingroup WeaponsProjectiles
*/
class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable
{
@@ -54,10 +62,8 @@
SimpleRocket(BaseObject* creator);
virtual ~SimpleRocket();
virtual void tick(float dt);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- void destroyObject();
void disableFire(); //!< Method to disable the fire and stop all acceleration
@@ -75,64 +81,56 @@
@param value The amount by which the SimpleRocket is to be moved.
*/
inline void moveFrontBack(float value)
- { this->moveFrontBack(Vector2(value, 0)); }
+ { this->moveFrontBack(Vector2(value, 0)); }
/**
@brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount.
@param value The amount by which the SimpleRocket is to be moved.
*/
inline void moveRightLeft(float value)
- { this->moveRightLeft(Vector2(value, 0)); }
+ { this->moveRightLeft(Vector2(value, 0)); }
/**
@brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount.
@param value The amount by which the SimpleRocket is to be moved.
*/
inline void moveUpDown(float value)
- { this->moveUpDown(Vector2(value, 0)); }
+ { this->moveUpDown(Vector2(value, 0)); }
/**
@brief Rotates the SimpleRocket around the y-axis by the specifed amount.
@param value The amount by which the SimpleRocket is to be rotated.
*/
inline void rotateYaw(float value)
- { this->rotateYaw(Vector2(value, 0)); }
+ { this->rotateYaw(Vector2(value, 0)); }
/**
@brief Rotates the SimpleRocket around the x-axis by the specifed amount.
@param value The amount by which the SimpleRocket is to be rotated.
*/
inline void rotatePitch(float value)
- {
- this->rotatePitch(Vector2(value, 0)); }
+ { this->rotatePitch(Vector2(value, 0)); }
/**
@brief Rotates the SimpleRocket around the z-axis by the specifed amount.
@param value The amount by which the SimpleRocket is to be rotated.
*/
inline void rotateRoll(float value)
- {
- this->rotateRoll(Vector2(value, 0)); }
+ { this->rotateRoll(Vector2(value, 0)); }
- void setOwner(Pawn* owner);
- inline Pawn* getOwner() const
- { return this->owner_; }
+ virtual void setShooter(Pawn* shooter);
inline bool hasFuel() const
- { return this->fuel_; }
+ { return this->fuel_; }
private:
- WeakPtr<Pawn> owner_;
- Vector3 localAngularVelocity_;
+ static const float FUEL_PERCENTAGE = 0.8f; //!< Percentage of lifetime the rocket has fuel
+
+ Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
bool fuel_; //!< Bool is true while the rocket "has fuel"
+ WeakPtr<PlayerInfo> player_; //!< The player the SimpleRocket belongs to.
+ Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
+ float lifetime_; //!< The time the projectile exists.
- WeakPtr<PlayerInfo> player_;
- Timer destroyTimer_;
- float lifetime_;
- static const int FUEL_PERCENTAGE=80; //!<Percentage of Lifetime the rocket has fuel
-
ParticleEmitter* fire_; //!< Fire-Emittor
-
-
-
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,20 +26,26 @@
*
*/
+/**
+ @file EnergyDrink.h
+ @brief Implementation of the EnergyDrink class.
+*/
+
#include "EnergyDrink.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "core/command/Executor.h"
+
#include "graphics/Model.h"
-
-#include "weapons/projectiles/Projectile.h"
-#include "weapons/MuzzleFlash.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/Projectile.h"
+#include "weapons/MuzzleFlash.h"
+
namespace orxonox
{
CreateFactory(EnergyDrink);
@@ -48,10 +54,10 @@
{
RegisterObject(EnergyDrink);
- this->reloadTime_ = 0.25;
- this->damage_ = 0; //default 15
- this->speed_ = 2500;
- this->delay_ = 0;
+ this->reloadTime_ = 0.25f;
+ this->damage_ = 0.0f;
+ this->speed_ = 2500.0f;
+ this->delay_ = 0.0f;
this->setMunitionName("FusionMunition");
this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&EnergyDrink::shot, this)));
@@ -64,42 +70,36 @@
XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
-
}
- void EnergyDrink::setMaterial(const std::string& material)
+ /**
+ @brief
+ Sets the delay with which is fired.
+ @param delay
+ The delay in seconds.
+ */
+ void EnergyDrink::setDelay(float delay)
{
- this->material_ = material;
- }
-
- void EnergyDrink::setDelay(float d)
- {
- this->delay_ = d;
+ this->delay_ = delay;
this->delayTimer_.setInterval(this->delay_);
}
- float EnergyDrink::getDelay() const
- {
- return this->delay_;
- }
-
+ /**
+ @brief
+ Fires the weapon.
+ */
void EnergyDrink::fire()
{
this->delayTimer_.startTimer();
}
- void EnergyDrink::muendungsfeuer()
- {
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
- this->getWeapon()->attach(muzzleFlash);
- muzzleFlash->setPosition(this->getMuzzleOffset());
- muzzleFlash->setMaterial(this->material_);
- }
-
- /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer()
- */
+ /**
+ @brief
+ Executes the shot, be creating the projectile and sending it on its way.
+ */
void EnergyDrink::shot()
{
+ // Create the projectile
Projectile* projectile = new Projectile(this);
Model* model = new Model(projectile);
model->setMeshSource("can.mesh");
@@ -111,11 +111,24 @@
projectile->setPosition(this->getMuzzlePosition());
projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
projectile->setShieldDamage(this->getShieldDamage());
projectile->setHealthDamage(this->getHealthDamage());
- EnergyDrink::muendungsfeuer();
+ // Display a muzzle flash.
+ this->muzzleflash();
}
+
+ /**
+ @brief
+ Displays a muzzle flash.
+ */
+ void EnergyDrink::muzzleflash()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
}
Modified: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file EnergyDrink.h
+ @brief Definition of the EnergyDrink class.
+*/
+
#ifndef _EnergyDrink_H__
#define _EnergyDrink_H__
@@ -37,6 +42,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Shoots a can.
+ @author
+ Hagen Seifert
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport EnergyDrink : public WeaponMode
{
public:
@@ -47,18 +60,34 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
private:
- void setMaterial(const std::string& material);
- inline const std::string& getMaterial()
+ /**
+ @brief Set the material of the EnergyDrink.
+ @param material The name of the material.
+ */
+ void setMaterial(const std::string& material)
+ { this->material_ = material; }
+ /**
+ @brief Get the material of the EnergyDrink.
+ @return Returns the material name.
+ */
+ inline const std::string& getMaterial() const
{ return this->material_; }
- void setDelay(float d);
- float getDelay() const;
+
+ void setDelay(float delay);
+ /**
+ @brief Get the firing delay.
+ @return Returns the delay in seconds.
+ */
+ float getDelay() const
+ { return this->delay_; }
+
void shot();
- void muendungsfeuer();
+ void muzzleflash();
- std::string material_;
- float speed_;
- float delay_;
- Timer delayTimer_;
+ std::string material_; //!< The material.
+ float speed_; //!< The speed of the EnergyDrink.
+ float delay_; //!< The firing delay.
+ Timer delayTimer_; //!< The timer to delay the firing.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,17 +26,23 @@
*
*/
+/**
+ @file FusionFire.h
+ @brief Implementation of the FusionFire class.
+*/
+
#include "FusionFire.h"
+#include "core/CoreIncludes.h"
#include "util/Math.h"
-#include "core/CoreIncludes.h"
-#include "weapons/projectiles/BillboardProjectile.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/BillboardProjectile.h"
+
namespace orxonox
{
CreateFactory(FusionFire);
@@ -45,16 +51,18 @@
{
RegisterObject(FusionFire);
- this->reloadTime_ = 1.0;
+ this->reloadTime_ = 1.0f;
this->bParallelReload_ = false;
- this->damage_ = 0; //default 40
- this->speed_ = 1250;
+ this->damage_ = 0.0f;
+ this->speed_ = 1250.0f;
this->setMunitionName("FusionMunition");
}
- /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties
- */
+ /**
+ @brief
+ Fires the weapon, by creating a projectile.
+ */
void FusionFire::fire()
{
BillboardProjectile* projectile = new BillboardProjectile(this);
@@ -64,7 +72,7 @@
projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
projectile->scale(5);
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
projectile->setShieldDamage(this->getShieldDamage());
projectile->setHealthDamage(this->getHealthDamage());
Modified: code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file FusionFire.h
+ @brief Definition of the FusionFire class.
+*/
+
#ifndef _FusionFire_H__
#define _FusionFire_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ FusionFire.
+ @author
+ Martin Polak
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport FusionFire : public WeaponMode
{
public:
@@ -43,7 +56,7 @@
virtual void fire();
private:
- float speed_;
+ float speed_; //!< The speed of the fusion fire weapon.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,21 +26,27 @@
*
*/
+/**
+ @file HsW01.h
+ @brief Implementation of the HsW01 class.
+*/
+
#include "HsW01.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "core/command/Executor.h"
+
#include "graphics/Model.h"
-
-#include "weapons/projectiles/Projectile.h"
-#include "weapons/MuzzleFlash.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/WorldEntity.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/Projectile.h"
+#include "weapons/MuzzleFlash.h"
+
namespace orxonox
{
CreateFactory(HsW01);
@@ -49,10 +55,10 @@
{
RegisterObject(HsW01);
- this->reloadTime_ = 0.25;
- this->damage_ = 0; //default 15
- this->speed_ = 2500;
- this->delay_ = 0;
+ this->reloadTime_ = 0.25f;
+ this->damage_ = 0.0f; //default 15
+ this->speed_ = 2500.0f;
+ this->delay_ = 0.0f;
this->setMunitionName("LaserMunition");
this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&HsW01::shot, this)));
@@ -71,48 +77,34 @@
XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
-
}
- void HsW01::setMaterial(const std::string& material)
+ /**
+ @brief
+ Set the firing delay.
+ @param delay
+ The firing delay in seconds.
+ */
+ void HsW01::setDelay(float delay)
{
- this->material_ = material;
- }
-
- std::string& HsW01::getMaterial()
- {
- return this->material_;
- }
-
- void HsW01::setDelay(float d)
- {
- this->delay_ = d;
+ this->delay_ = delay;
this->delayTimer_.setInterval(this->delay_);
}
- float HsW01::getDelay() const
- {
- return this->delay_;
- }
-
void HsW01::fire()
{
this->delayTimer_.startTimer();
}
- void HsW01::muendungsfeuer()
- {
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
- this->getWeapon()->attach(muzzleFlash);
- muzzleFlash->setPosition(this->getMuzzleOffset());
- muzzleFlash->setMaterial(this->material_);
- }
-
- /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer()
- */
+ /**
+ @brief
+ Fires the weapon. Creates a projectile and fires it.
+ */
void HsW01::shot()
{
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
+
+ // Create the projectile.
Projectile* projectile = new Projectile(this);
Model* model = new Model(projectile);
model->setMeshSource("laserbeam.mesh");
@@ -125,11 +117,24 @@
projectile->setPosition(this->getMuzzlePosition());
projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
projectile->setShieldDamage(this->getShieldDamage());
projectile->setHealthDamage(this->getHealthDamage());
- HsW01::muendungsfeuer();
+ // Display the muzzle flash.
+ this->HsW01::muzzleflash();
}
+
+ /**
+ @brief
+ Displays the muzzle flash.
+ */
+ void HsW01::muzzleflash()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
}
Modified: code/trunk/src/modules/weapons/weaponmodes/HsW01.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/HsW01.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/HsW01.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file HsW01.h
+ @brief Definition of the HsW01 class.
+*/
+
#ifndef _HsW01_H__
#define _HsW01_H__
@@ -36,6 +41,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Shoots laser beams.
+ @author
+ Hagen Seifert
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport HsW01 : public WeaponMode
{
public:
@@ -46,17 +59,34 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
private:
- void setMaterial(const std::string& material);
- std::string& getMaterial();
- void setDelay(float d);
- float getDelay() const;
+ /**
+ @brief Set the material.
+ @param material The material name.
+ */
+ void setMaterial(const std::string& material)
+ { this->material_ = material; }
+ /**
+ @brief Get the material.
+ @return Returns the material name.
+ */
+ const std::string& getMaterial() const
+ { return this->material_; }
+
+ void setDelay(float delay);
+ /**
+ @brief Get the firing delay.
+ @return Returns the firing delay in seconds.
+ */
+ float getDelay() const
+ { return this->delay_; }
+
void shot();
- void muendungsfeuer();
+ void muzzleflash();
- std::string material_;
- float speed_;
- float delay_;
- Timer delayTimer_;
+ std::string material_; //!< The material.
+ float speed_; //!< The speed of the fired projectile.
+ float delay_; //!< The firing delay.
+ Timer delayTimer_; //!< A timer to delay the firing.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,15 +26,22 @@
*
*/
+/**
+ @file LaserFire.h
+ @brief Implementation of the LaserFire class.
+*/
+
#include "LaserFire.h"
#include "core/CoreIncludes.h"
-#include "weapons/projectiles/ParticleProjectile.h"
+
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/ParticleProjectile.h"
+
namespace orxonox
{
CreateFactory(LaserFire);
@@ -43,15 +50,17 @@
{
RegisterObject(LaserFire);
- this->reloadTime_ = 0.25;
- this->damage_ = 0; //default 15
- this->speed_ = 1250;
+ this->reloadTime_ = 0.25f;
+ this->damage_ = 0.0f;
+ this->speed_ = 1250.0f;
this->setMunitionName("LaserMunition");
}
- /* Creates the projectile object, sets its properties to the LaserFire properties
- */
+ /**
+ @brief
+ Fires the weapon. Creates a projectile and fires it.
+ */
void LaserFire::fire()
{
ParticleProjectile* projectile = new ParticleProjectile(this);
@@ -60,7 +69,7 @@
projectile->setPosition(this->getMuzzlePosition());
projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
projectile->setShieldDamage(this->getShieldDamage());
projectile->setHealthDamage(this->getHealthDamage());
Modified: code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file LaserFire.h
+ @brief Definition of the LaserFire class.
+*/
+
#ifndef _LaserFire_H__
#define _LaserFire_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Shoots a particle laser.
+ @author
+ Martin Polak
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport LaserFire : public WeaponMode
{
public:
@@ -43,7 +56,7 @@
virtual void fire();
private:
- float speed_;
+ float speed_; //!< The speed of the fired projectile.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,15 +26,21 @@
*
*/
+/**
+ @file LightningGun.h
+ @brief Implementation of the LightningGun class.
+*/
+
#include "LightningGun.h"
#include "core/CoreIncludes.h"
-#include "weapons/projectiles/LightningGunProjectile.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/LightningGunProjectile.h"
+
namespace orxonox
{
CreateFactory(LightningGun);
@@ -43,9 +49,9 @@
{
RegisterObject(LightningGun);
- this->reloadTime_ = 1;
- this->damage_ = 0; //default 100
- this->speed_ = 150;
+ this->reloadTime_ = 1.0f;
+ this->damage_ = 0.0f;
+ this->speed_ = 250.0f;
this->setMunitionName("LaserMunition");
this->setDefaultSound("sounds/Weapon_LightningGun.ogg");
@@ -55,8 +61,10 @@
{
}
- /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties
- */
+ /**
+ @brief
+ Fires the weapon. Creates a projectile and fires it.
+ */
void LightningGun::fire()
{
LightningGunProjectile* projectile = new LightningGunProjectile(this);
@@ -66,9 +74,8 @@
projectile->setOrientation(this->getMuzzleOrientation());
projectile->setPosition(this->getMuzzlePosition());
projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
- projectile->setAcceleration(this->getMuzzleDirection() * 1000);
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
projectile->setShieldDamage(this->getShieldDamage());
projectile->setHealthDamage(this->getHealthDamage());
Modified: code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file LightningGun.h
+ @brief Definition of the LightningGun class.
+*/
+
#ifndef _LightningGun_H__
#define _LightningGun_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ A slow ball of lightning.
+ @author
+ Joel Smely
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport LightningGun : public WeaponMode
{
public:
@@ -43,7 +56,7 @@
virtual void fire();
private:
- float speed_;
+ float speed_; //!< The speed of the fired projectile.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,17 +26,23 @@
*
*/
+/**
+ @file RocketFire.h
+ @brief Implementation of the RocketFire class.
+*/
+
#include "RocketFire.h"
+#include "core/CoreIncludes.h"
#include "util/Math.h"
-#include "core/CoreIncludes.h"
-#include "weapons/projectiles/Rocket.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSystem.h"
#include "worldentities/pawns/Pawn.h"
+#include "weapons/projectiles/Rocket.h"
+
namespace orxonox
{
CreateFactory(RocketFire);
@@ -47,8 +53,8 @@
this->reloadTime_ = 0.20f;
this->bParallelReload_ = false;
- this->damage_ = 0;
- this->speed_ = 500;
+ this->damage_ = 0.0f;
+ this->speed_ = 500.0f;
this->setMunitionName("RocketMunition");
// The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
@@ -58,8 +64,10 @@
{
}
- /* Creates the Rocket object, sets its properties to the RocketFire properties
- */
+ /**
+ @brief
+ Fires the weapon. Creates the Rocket and fires it.
+ */
void RocketFire::fire()
{
Rocket* rocket = new Rocket(this);
@@ -70,7 +78,7 @@
rocket->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
rocket->scale(2);
- rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
rocket->setDamage(this->getDamage());
rocket->setShieldDamage(this->getShieldDamage());
rocket->setHealthDamage(this->getHealthDamage());
Modified: code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFire.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFire.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file RocketFire.h
+ @brief Definition of the RocketFire class.
+*/
+
#ifndef _RocketFire_H__
#define _RocketFire_H__
@@ -34,6 +39,14 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Fires the (steerable) Rocket.
+ @author
+ Oliver Scheuss
+ @ingroup WeaponsWeaponModes
+ */
class _WeaponsExport RocketFire : public WeaponMode
{
public:
@@ -43,7 +56,7 @@
virtual void fire();
private:
- float speed_;
+ float speed_; //!< The speed of the Rocket.
};
}
Modified: code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,17 +20,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
+ * Gabriel Nadler
+ * Co-authors:
* Oliver Scheuss
- * Co-authors:
* simonmie
*
*/
+/**
+ @file BasicProjectile.h
+ @brief Implementation of the BasicProjectile class.
+*/
+
#include "SimpleRocketFire.h"
+#include "core/CoreIncludes.h"
#include "util/Math.h"
-#include "core/CoreIncludes.h"
-#include "weapons/RocketController.h"
#include "weaponsystem/Weapon.h"
#include "weaponsystem/WeaponPack.h"
@@ -38,6 +43,9 @@
#include "worldentities/pawns/Pawn.h"
#include "sound/WorldSound.h"
+#include "weapons/RocketController.h"
+#include "weapons/projectiles/SimpleRocket.h"
+
namespace orxonox
{
@@ -47,10 +55,10 @@
{
RegisterObject(SimpleRocketFire);
- this->reloadTime_ = 1;
+ this->reloadTime_ = 1.0f;
this->bParallelReload_ = false;
- this->damage_ = 0;
- this->speed_ = 500;
+ this->damage_ = 0.0f;
+ this->speed_ = 500.0f;
this->setMunitionName("RocketMunition");
this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4f);
@@ -61,23 +69,25 @@
{
}
- /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target
- */
+ /**
+ @brief
+ Fires the weapon. Creates the SimpleRocket and a RocketController to steer it and fires it.
+ */
void SimpleRocketFire::fire()
{
- RocketController* con = new RocketController(this);
- SimpleRocket* rocket = con->getRocket();
+ RocketController* controller = new RocketController(this);
+ SimpleRocket* rocket = controller->getRocket();
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation());
rocket->setPosition(this->getMuzzlePosition());
rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
- rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
rocket->setDamage(this->damage_);
rocket->setShieldDamage(this->getShieldDamage());
rocket->setHealthDamage(this->getHealthDamage());
- WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
- if (pawnn) con->setTarget(pawnn);
+ WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
+ if (pawn) controller->setTarget(pawn);
}
}
Modified: code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -20,12 +20,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
+ * Gabriel Nadler
+ * Co-authors:
* Oliver Scheuss
- * Co-authors:
- * ...
*
*/
+/**
+ @file SimpleRocketFire.h
+ @brief Definition of the SimpleRocketFire class.
+*/
+
#ifndef _SimpleRocketFire_H__
#define _SimpleRocketFire_H__
@@ -38,7 +43,8 @@
@brief
FireMode for target-seeking Rocket
@author
- Gabriel Nadler (Original file: Oli Scheuss)
+ Gabriel Nadler
+ @ingroup WeaponsWeaponModes
*/
class _WeaponsExport SimpleRocketFire : public WeaponMode
{
@@ -49,7 +55,7 @@
virtual void fire();
private:
- float speed_;
+ float speed_; //!< The speed of the SimpleRocket.
};
}
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2011-08-22 13:05:26 UTC (rev 8855)
@@ -46,7 +46,6 @@
#include "weaponsystem/WeaponPack.h"
#include "weaponsystem/WeaponSet.h"
-
namespace orxonox
{
CreateFactory(Pawn);
@@ -255,7 +254,6 @@
Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
*/
-
void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2011-08-21 21:56:59 UTC (rev 8854)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2011-08-22 13:05:26 UTC (rev 8855)
@@ -74,13 +74,13 @@
virtual void setShieldHealth(float shieldHealth);
inline float getShieldHealth()
- { return this->shieldHealth_; }
+ { return this->shieldHealth_; }
inline void addShieldHealth(float amount)
- { this->setShieldHealth(this->shieldHealth_ + amount); }
+ { this->setShieldHealth(this->shieldHealth_ + amount); }
inline bool hasShield()
- { return (this->getShieldHealth() > 0); }
+ { return (this->getShieldHealth() > 0); }
virtual void setMaxShieldHealth(float maxshieldhealth);
inline float getMaxShieldHealth() const
@@ -97,9 +97,9 @@
{ this->setShieldHealth(this->maxShieldHealth_); }
inline void setShieldAbsorption(float shieldAbsorption)
- { this->shieldAbsorption_ = shieldAbsorption; }
+ { this->shieldAbsorption_ = shieldAbsorption; }
inline float getShieldAbsorption()
- { return this->shieldAbsorption_; }
+ { return this->shieldAbsorption_; }
// TODO: Rename to shieldRechargeRate
virtual void setReloadRate(float reloadrate);
@@ -111,10 +111,10 @@
{ return this->reloadWaitTime_; }
inline void resetReloadCountdown()
- { this->reloadWaitCountdown_ = 0; }
+ { this->reloadWaitCountdown_ = 0; }
inline void startReloadCountdown()
- { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
+ { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
virtual void decreaseReloadCountdownTime(float dt);
More information about the Orxonox-commit
mailing list