Changeset 8855
- Timestamp:
- Aug 22, 2011, 3:05:26 PM (13 years ago)
- Location:
- code/trunk/src
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/MuzzleFlash.cc
r7801 r8855 23 23 * Hagen Seifert 24 24 * Co-authors: 25 * Ich 26 * Dini Mueter 25 * ... 27 26 * 28 27 */ 28 29 /** 30 @file MuzzleFlash.h 31 @brief Implementation of the MuzzleFlash class. 32 */ 29 33 30 34 #include "MuzzleFlash.h" … … 43 47 44 48 if( GameMode::isMaster() ) 45 this->delayTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&MuzzleFlash::destroy, this)));49 this->delayTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&MuzzleFlash::destroy, this))); 46 50 } 47 51 } -
code/trunk/src/modules/weapons/MuzzleFlash.h
r5929 r8855 27 27 */ 28 28 29 /** 30 @file MuzzleFlash.h 31 @brief Definition of the MuzzleFlash class. 32 */ 33 29 34 #ifndef _MuzzleFlash_H__ 30 35 #define _MuzzleFlash_H__ … … 37 42 namespace orxonox 38 43 { 44 45 /** 46 @brief 47 A muzzle flash that destroys itself after some time. 48 @author 49 Hagen Seifert 50 @ingroup Weapons 51 @todo 52 Remove because it's unused? 53 */ 39 54 class _WeaponsExport MuzzleFlash : public Billboard 40 55 { … … 44 59 45 60 private: 46 Timer delayTimer_; 61 Timer delayTimer_; //!< Timer to destroy the object. 47 62 }; 48 63 } -
code/trunk/src/modules/weapons/RocketController.cc
r7163 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler , Originalfile: Oli Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /** 30 @file BasicProjectile.h 31 @brief Implementation of the BasicProjectile class. 32 */ 33 29 34 #include "RocketController.h" 35 36 #include "util/Math.h" 37 #include "worldentities/pawns/Pawn.h" 30 38 #include "projectiles/SimpleRocket.h" 31 #include "util/Math.h" 32 #include "weapons/projectiles/SimpleRocket.h" 33 #include "util/Debug.h" 34 #include "weapons/weaponmodes/SimpleRocketFire.h" 35 #include "worldentities/pawns/Pawn.h" 39 #include "weaponmodes/SimpleRocketFire.h" 36 40 37 41 namespace orxonox … … 39 43 /** 40 44 @brief 41 Constructor.45 Constructor. 42 46 */ 43 47 RocketController::RocketController(BaseObject* creator) : Controller(creator) … … 46 50 COUT(5)<< "RocketController constructed\n"; 47 51 48 52 // Create a rocket for the controller. 49 53 this->rocket_ = new SimpleRocket(this); 50 54 this->rocket_->setController(this); … … 55 59 /** 56 60 @brief 57 The controlling happens here. This method defines what the controller has to do each tick.61 The controlling happens here. This method defines what the controller has to do each tick. 58 62 @param dt 59 The duration of the tick.63 The duration of the tick. 60 64 */ 61 65 void RocketController::tick(float dt) 62 66 { 63 64 67 if (this->target_ && this->rocket_->hasFuel()) { 65 this-> setTargetPosition();66 this->moveTo TargetPosition();68 this->updateTargetPosition(); 69 this->moveToPosition(this->targetPosition_); 67 70 } 68 69 70 71 } 71 72 72 73 73 RocketController::~RocketController() … … 76 76 } 77 77 78 void RocketController::setTargetPosition() 78 /** 79 @brief 80 Update the position of the target. 81 */ 82 void RocketController::updateTargetPosition() 79 83 { 80 this->targetPosition_ =this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD84 this->targetPosition_ = this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD 81 85 //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity()); 82 }83 void RocketController::moveToTargetPosition()84 {85 this->moveToPosition(this->targetPosition_);86 }87 88 89 90 void RocketController::setTarget(WorldEntity* target)91 {92 this->target_ = target;93 86 } 94 87 … … 110 103 } 111 104 112 113 114 115 105 } -
code/trunk/src/modules/weapons/RocketController.h
r7163 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler , Originalfile: Oli Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /** 30 @file RocketController.h 31 @brief Definition of the RocketController class. 32 */ 28 33 29 34 #ifndef _RocketController_H__ … … 32 37 #include "weapons/WeaponsPrereqs.h" 33 38 39 #include "tools/interfaces/Tickable.h" 34 40 #include "controllers/Controller.h" 35 #include "tools/interfaces/Tickable.h"36 #include "weapons/projectiles/SimpleRocket.h"37 #include "weapons/weaponmodes/SimpleRocketFire.h"38 41 39 42 namespace orxonox … … 41 44 /** 42 45 @brief 43 Controller for the Rocket (targetseeking)46 Controller for the SimpleRocket (target seeking) 44 47 @author 45 Gabriel Nadler, Originalfile: Oli Scheuss 48 Gabriel Nadler 49 @ingroup Weapons 46 50 */ 47 51 class _WeaponsExport RocketController : public Controller, public Tickable … … 52 56 53 57 virtual void tick(float dt); 58 /** 59 @brief Get the rocket that is controlled by this controller. 60 @return Returns a pointer to the rocket. 61 */ 54 62 SimpleRocket* getRocket() const 55 { return this->rocket_; }; 56 void setTarget(WorldEntity* target); 63 { return this->rocket_; }; 64 65 /** 66 @brief Set the target of the rocket. 67 @param target A pointer to the target. 68 */ 69 void setTarget(WorldEntity* target) 70 { this->target_ = target; } 71 57 72 protected: 73 void updateTargetPosition(); 58 74 void moveToPosition(const Vector3& target); 59 void setTargetPosition();60 void moveToTargetPosition();61 75 62 76 private: 63 SimpleRocket* rocket_; //!< The Rocket it controlls64 Vector3 targetPosition_; 65 WeakPtr<PlayerInfo> player_; 77 SimpleRocket* rocket_; //!< The Rocket it controls. 78 Vector3 targetPosition_; //!< The position of the target. 79 WeakPtr<PlayerInfo> player_; //!< The player the rocket belongs to. 66 80 67 WeakPtr<WorldEntity> target_; 68 69 81 WeakPtr<WorldEntity> target_; //!< The target. 70 82 }; 71 83 } -
code/trunk/src/modules/weapons/WeaponsPrereqs.h
r8351 r8855 81 81 class ParticleProjectile; 82 82 class Projectile; 83 class Rocket; 84 class SimpleRocket; 83 85 84 86 // weaponmodes … … 88 90 class LaserFire; 89 91 class LightningGun; 92 class RocketFire; 93 class SimpleRocketFire; 90 94 } 91 95 -
code/trunk/src/modules/weapons/munitions/FusionMunition.cc
r5781 r8855 27 27 */ 28 28 29 /** 30 @file FusionMunition.h 31 @brief Implementation of the FusionMunition class. 32 */ 33 29 34 #include "FusionMunition.h" 30 35 #include "core/CoreIncludes.h" -
code/trunk/src/modules/weapons/munitions/FusionMunition.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file FusionMunition.h 31 @brief Definition of the FusionMunition class. 32 */ 33 29 34 #ifndef _FusionMunition_H__ 30 35 #define _FusionMunition_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 FusionMunition. 46 @author 47 Martin Polak 48 @ingroup WeaponsMunitions 49 */ 37 50 class _WeaponsExport FusionMunition : public Munition 38 51 { -
code/trunk/src/modules/weapons/munitions/LaserMunition.cc
r5781 r8855 27 27 */ 28 28 29 /** 30 @file LaserMunition.h 31 @brief Implementation of the LaserMunition class. 32 */ 33 29 34 #include "LaserMunition.h" 30 35 #include "core/CoreIncludes.h" … … 48 53 this->bAllowMultiMunitionRemovementUnderflow_ = true; 49 54 50 this->replenishInterval l_ = 0.5f;55 this->replenishInterval_ = 0.5f; 51 56 this->replenishMunitionAmount_ = 1; 52 57 } -
code/trunk/src/modules/weapons/munitions/LaserMunition.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file LaserMunition.h 31 @brief Definition of the LaserMunition class. 32 */ 33 29 34 #ifndef _LaserMunition_H__ 30 35 #define _LaserMunition_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 LaserMunition. 46 @author 47 Martin Polak 48 @ingroup WeaponsMunitions 49 */ 37 50 class _WeaponsExport LaserMunition : public ReplenishingMunition 38 51 { -
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
r8729 r8855 27 27 */ 28 28 29 /** 30 @file ReplenishingMunition.h 31 @brief Implementation of the ReplenishingMunition class. 32 */ 33 29 34 #include "ReplenishingMunition.h" 30 35 … … 40 45 RegisterObject(ReplenishingMunition); 41 46 42 this->replenishInterval l_ = 1.0f;47 this->replenishInterval_ = 1.0f; 43 48 this->replenishMunitionAmount_ = 1; 44 49 … … 52 57 { 53 58 // Initialize the timer 54 this->replenishingTimer_.setTimer(this->replenishInterval l_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this)));59 this->replenishingTimer_.setTimer(this->replenishInterval_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this))); 55 60 } 56 61 -
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h
r5929 r8855 27 27 */ 28 28 29 /** 30 @file ReplenishingMunition.h 31 @brief Definition of the ReplenishingMunition class. 32 */ 33 29 34 #ifndef _ReplenishingMunition_H__ 30 35 #define _ReplenishingMunition_H__ … … 37 42 namespace orxonox 38 43 { 44 45 /** 46 @brief 47 Munition that is replenished by a certain amount each time interval. 48 @author 49 Fabian 'x3n' Landau 50 @ingroup WeaponsMunitions 51 */ 39 52 class _WeaponsExport ReplenishingMunition : public Munition 40 53 { … … 44 57 45 58 protected: 46 float replenishInterval l_;47 unsigned int replenishMunitionAmount_; 59 float replenishInterval_; //!< The interval in which the munition is replenished. 60 unsigned int replenishMunitionAmount_; //!< The amount by which it is replenished. 48 61 49 62 private: … … 51 64 void initializeTimer(); 52 65 53 Timer replenishingTimer_; 66 Timer replenishingTimer_; //!< Timer to do the replenishing. 54 67 }; 55 68 } -
code/trunk/src/modules/weapons/munitions/RocketMunition.cc
r7896 r8855 27 27 */ 28 28 29 /** 30 @file RocketMunition.h 31 @brief Implementation of the RocketMunition class. 32 */ 33 29 34 #include "RocketMunition.h" 30 35 #include "core/CoreIncludes.h" -
code/trunk/src/modules/weapons/munitions/RocketMunition.h
r7846 r8855 27 27 */ 28 28 29 /** 30 @file RocketMunition.h 31 @brief Definition of the RocketMunition class. 32 */ 33 29 34 #ifndef _RocketMunition_H__ 30 35 #define _RocketMunition_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 Munition for the Rocket. 46 @author 47 Fabian 'x3n' Landau 48 @ingroup WeaponsMunitions 49 */ 37 50 class _WeaponsExport RocketMunition : public Munition 38 51 { -
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
r8767 r8855 27 27 */ 28 28 29 /** 30 @file BasicProjectile.h 31 @brief Implementation of the BasicProjectile class. 32 */ 33 29 34 #include "BasicProjectile.h" 30 35 31 36 #include "core/CoreIncludes.h" 32 #include "core/ConfigValueIncludes.h"33 37 #include "core/GameMode.h" 34 38 #include "core/command/Executor.h" 35 #include "objects/collisionshapes/SphereCollisionShape.h" 36 #include "worldentities/pawns/Pawn.h" 39 37 40 #include "graphics/ParticleSpawner.h" 38 #include "core/OrxonoxClass.h"39 41 40 42 namespace orxonox … … 46 48 BasicProjectile::BasicProjectile() : OrxonoxClass() 47 49 { 48 RegisterRootObject(BasicProjectile);// - register the BasicProjectile class to the core50 RegisterRootObject(BasicProjectile);// Register the BasicProjectile class to the core 49 51 50 52 this->bDestroy_ = false; … … 61 63 } 62 64 63 /* The function called when a projectile hits another thing. 64 * calls the hit-function, starts the reload countdown, displays visual effects 65 * hit is defined in src/orxonox/worldentities/pawns/pawn.cc 66 */ 67 bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_) 65 /** 66 @brief 67 The function called when a projectile hits another thing. 68 Calls the hit-function, starts the reload countdown, displays visual hit effects defined in Pawn. 69 Needs to be called in the collidesAgainst() function by every Class directly inheriting from BasicProjectile. 70 @param otherObject 71 A pointer to the object the Projectile has collided against. 72 @param contactPoint 73 A btManifoldPoint indicating the point of contact/impact. 74 @return 75 Returns true if the collision resulted in a successful hit. 76 @see Pawn.h 77 */ 78 bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint) 68 79 { 69 if (!this _->getBDestroy()&& GameMode::isMaster())80 if (!this->bDestroy_ && GameMode::isMaster()) 70 81 { 71 if (otherObject == owner) //prevents you from shooting yourself82 if (otherObject == this->getShooter()) // Prevents you from shooting yourself 72 83 return false; 73 84 74 this _->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.75 85 this->bDestroy_ = true; // If something is hit, the object is destroyed and can't hit something else. 86 // The projectile is destroyed by its tick()-function (in the following tick). 76 87 77 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // if otherObject isn't a Pawn, then victim is NULL88 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL 78 89 79 WorldEntity* entity = orxonox_cast<WorldEntity*>(this _);80 assert(entity); // entity must not be null90 WorldEntity* entity = orxonox_cast<WorldEntity*>(this); 91 assert(entity); // The projectile must not be a WorldEntity. 81 92 82 83 // if visual effects after destruction cause problems, put this block below the effects code block 93 // If visual effects after destruction cause problems, put this block below the effects code block 84 94 if (victim) 85 95 { 86 victim->hit( owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());96 victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage()); 87 97 victim->startReloadCountdown(); 88 98 } 89 99 90 // visual effects for being hit, depending on whether the shield is hit or not91 if ( owner) //if the owner does not exist (anymore?), no effects are displayed.100 // Visual effects for being hit, depending on whether the shield is hit or not 101 if (this->getShooter()) // If the owner does not exist (anymore?), no effects are displayed. 92 102 { 93 // damping and explosion effect is only played if the victim is no pawn (see cast above)94 // or if the victim is a pawn, has no shield left, is still alive and any damage goes to the health95 if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0 && (this_->getDamage() > 0 || this_->getHealthDamage() > 0)))103 // Damping and explosion effect is only played if the victim is no Pawn (see cast above) 104 // or if the victim is a Pawn, has no shield left, is still alive and any damage goes to the health 105 if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0.0f && (this->getDamage() > 0.0f || this->getHealthDamage() > 0.0f))) 96 106 { 97 107 { 98 ParticleSpawner* effect = new ParticleSpawner( owner->getCreator());108 ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator()); 99 109 effect->setPosition(entity->getPosition()); 100 110 effect->setOrientation(entity->getOrientation()); … … 103 113 effect->setLifetime(2.0f); 104 114 } 105 // second effect with same condition115 // Second effect with same condition 106 116 { 107 ParticleSpawner* effect = new ParticleSpawner( owner->getCreator());117 ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator()); 108 118 effect->setPosition(entity->getPosition()); 109 119 effect->setOrientation(entity->getOrientation()); … … 115 125 116 126 // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead 117 if (victim && victim->hasShield() && (this _->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0)127 if (victim && victim->hasShield() && (this->getDamage() > 0.0f || this->getShieldDamage() > 0.0f) && victim->getHealth() > 0.0f) 118 128 { 119 ParticleSpawner* effect = new ParticleSpawner( owner->getCreator());129 ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator()); 120 130 effect->setDestroyAfterLife(true); 121 131 effect->setSource("Orxonox/Shield"); … … 124 134 } 125 135 } 126 136 return true; 127 137 } 128 138 return false; 129 139 } 140 141 /** 142 @brief 143 Check whether the projectile needs to be destroyed and destroys it if so. 144 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. 145 */ 146 void BasicProjectile::destroyCheck(void) 147 { 148 if(GameMode::isMaster() && this->bDestroy_) 149 this->destroy(); 150 } 151 152 /** 153 @brief 154 Destroys the object. 155 */ 156 void BasicProjectile::destroyObject(void) 157 { 158 if(GameMode::isMaster()) 159 this->destroy(); 160 } 130 161 } -
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
r8706 r8855 27 27 */ 28 28 29 /** 30 @file BasicProjectile.h 31 @brief Definition of the BasicProjectile class. 32 */ 33 29 34 #ifndef _BasicProjectile_H__ 30 35 #define _BasicProjectile_H__ … … 32 37 #include "weapons/WeaponsPrereqs.h" 33 38 34 #include "tools/Timer.h" 39 #include "worldentities/pawns/Pawn.h" 40 35 41 #include "core/OrxonoxClass.h" 36 42 37 43 namespace orxonox 38 44 { 45 46 /** 47 @brief 48 Baseclass of all projectiles. Defines the damage the projectile does. 49 50 @author 51 Simon Miescher 52 @ingroup WeaponsProjectiles 53 */ 39 54 class _WeaponsExport BasicProjectile : public virtual OrxonoxClass 40 55 { 41 56 public: 42 57 BasicProjectile(); 43 44 58 virtual ~BasicProjectile(); 45 59 46 static bool basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_); 47 48 void basicDestroyObject(); 49 60 /** 61 @brief Set the normal damage done by this projectile. 62 Normal damage can be (partially) absorbed by shields. 63 @param damage The amount of damage. Must be non-negative. 64 */ 50 65 inline void setDamage(float damage) 51 { this->damage_ = damage; } 66 { if(damage >= 0.0f) { this->damage_ = damage; return; } COUT(1) << "The input projectile damage must be non-negative. Ignoring..." << endl; } 67 /** 68 @brief Get the normal damage done by this projectile. 69 Normal damage can be (partially) absorbed by shields. 70 @return Returns the amount of damage. Is non-negative. 71 */ 52 72 inline float getDamage() const 53 73 { return this->damage_; } 54 74 75 /** 76 @brief Set the health-damage done by this projectile. 77 Health-damage cannot be absorbed by shields. 78 @param healthdamage The amount of damage. Must be non-negative. 79 */ 55 80 inline void setHealthDamage(float healthdamage) 56 { this->healthdamage_ = healthdamage; } 81 { if(healthdamage >= 0.0f) { this->healthdamage_ = healthdamage; return; } COUT(1) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; } 82 /** 83 @brief Get the health-damage done by this projectile. 84 Health-damage cannot be absorbed by shields. 85 @return healthdamage The amount of damage. Is non-negative. 86 */ 57 87 inline float getHealthDamage() const 58 88 { return this->healthdamage_; } 59 89 90 /** 91 @brief Set the shield-damage done by this projectile. 92 Shield-damage only reduces shield health. 93 @param shielddamage The amount of damage. Must be non-negative. 94 */ 60 95 inline void setShieldDamage(float shielddamage) 61 { this->shielddamage_ = shielddamage; } //ShieldDamage wird korrekt gesettet vom XML-File 96 { if(shielddamage >= 0.0f) { this->shielddamage_ = shielddamage; return; } COUT(1) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; } 97 /** 98 @brief Get the shield-damage done by this projectile. 99 Shield-damage only reduces shield health. 100 @param shielddamage The amount of damage. Is non-negative. 101 */ 62 102 inline float getShieldDamage() const 63 103 { return this->shielddamage_; } 64 104 105 /** 106 @brief Set the entity that fired the projectile. 107 @param shooter A pointer to the Pawn that fired the projectile. 108 */ 109 virtual void setShooter(Pawn* shooter) 110 { this->shooter_ = shooter; } 111 /** 112 @brief Get the entity that fired the projectile. 113 @return Returns a pointer to the Pawn that fired the projectile. 114 */ 115 inline Pawn* getShooter(void) 116 { return this->shooter_; } 65 117 66 inline void setBDestroy(bool bDestroy) 67 { this->bDestroy_ = bDestroy; } 68 inline float getBDestroy() const 69 { return this->bDestroy_; } 118 virtual void destroyObject(void); 70 119 120 protected: 121 bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint); 122 void destroyCheck(void); 71 123 72 124 private: 73 // WeakPtr<Pawn> owner_; //owner cannot be set in BasicProjectile, because it's already defined in MobileEntity and Movable Entity 125 WeakPtr<Pawn> shooter_; //!< The entity that fired the projectile. 74 126 75 float damage_; 76 float healthdamage_; 77 float shielddamage_; 127 float damage_; //!< The amount of normal damage. Normal damage can be (partially) absorbed by shields. 128 float healthdamage_; //!< The amount of health-damage. Health-damage cannot be absorbed by shields. 129 float shielddamage_; //!< The amount of shield-damage. Shield-damage only reduces shield health. 78 130 79 bool bDestroy_; 131 bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed. 80 132 }; 81 133 } -
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
r6502 r8855 27 27 */ 28 28 29 /** 30 @file BillboardProjectile.h 31 @brief Implementation of the BillboardProjectile class. 32 */ 33 29 34 #include "BillboardProjectile.h" 30 35 … … 44 49 { 45 50 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity 51 52 // Create the billboard. 46 53 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5f, 0.5f, 0.7f, 0.8f), 1); 47 54 this->attachOgreObject(this->billboard_.getBillboardSet()); … … 57 64 } 58 65 66 /** 67 @brief 68 Set the colour of the BillboardProjectile. 69 @param colour 70 The colour to be set. 71 */ 59 72 void BillboardProjectile::setColour(const ColourValue& colour) 60 73 { … … 62 75 } 63 76 77 /** 78 @brief 79 Set the material of the BillboardProjectile. 80 @param material 81 The material name. 82 */ 64 83 void BillboardProjectile::setMaterial(const std::string& material) 65 84 { … … 67 86 } 68 87 88 /** 89 @brief 90 Is called when the visibility of the BillboardProjectile has changed. 91 */ 69 92 void BillboardProjectile::changedVisibility() 70 93 { 71 94 SUPER(BillboardProjectile, changedVisibility); 72 95 96 // Also change the visibility of the billboard. 73 97 this->billboard_.setVisible(this->isVisible()); 74 98 } -
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file BillboardProjectile.h 31 @brief Definition of the BillboardProjectile class. 32 */ 33 29 34 #ifndef _BillboardProjectile_H__ 30 35 #define _BillboardProjectile_H__ … … 38 43 namespace orxonox 39 44 { 45 46 /** 47 @brief 48 A BillboardProjectile is a projectile that is represented by a Billboard. 49 50 @author 51 Fabian 'x3n' Landau 52 @ingroup WeaponsProjectiles 53 */ 40 54 class _WeaponsExport BillboardProjectile : public Projectile 41 55 { … … 49 63 50 64 private: 51 BillboardSet billboard_; 65 BillboardSet billboard_; //!< The billboard that represents the projectile. 52 66 }; 53 67 } -
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
r8706 r8855 1 1 ADD_SOURCE_FILES(WEAPONS_SRC_FILES 2 BasicProjectile.cc 2 3 BillboardProjectile.cc 3 4 ParticleProjectile.cc … … 6 7 Rocket.cc 7 8 SimpleRocket.cc 8 BasicProjectile.cc9 9 ) -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r8729 r8855 27 27 */ 28 28 29 /** 30 @file LightningGunProjectile.h 31 @brief Implementation of the LightningGunProjectile class. 32 */ 33 29 34 #include "LightningGunProjectile.h" 30 35 31 #include "util/Convert.h"32 36 #include "core/CoreIncludes.h" 33 37 #include "core/command/Executor.h" 38 #include "util/Convert.h" 34 39 35 40 namespace orxonox … … 53 58 } 54 59 60 /** 61 @brief 62 Set the material. 63 @param material 64 The name of the material. Material names with 1 to 8 appended must exist. 65 */ 55 66 void LightningGunProjectile::setMaterial(const std::string& material) 56 67 { … … 60 71 } 61 72 73 /** 74 @brief 75 Change the texture. 76 */ 62 77 void LightningGunProjectile::changeTexture() 63 78 { -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
r5929 r8855 27 27 */ 28 28 29 /** 30 @file LightningGunProjectile.h 31 @brief Definition of the LightningGunProjectile class. 32 */ 33 29 34 #ifndef _LightningGunProjectile_H__ 30 35 #define _LightningGunProjectile_H__ … … 38 43 namespace orxonox 39 44 { 45 46 /** 47 @brief 48 The LightningGunProjectile is a projectile that is represented by a looped series of billboards. 49 50 @author 51 Joel Smely 52 @ingroup WeaponsProjectiles 53 */ 40 54 class _WeaponsExport LightningGunProjectile : public BillboardProjectile 41 55 { … … 46 60 virtual void setMaterial(const std::string& material); 47 61 48 protected: 62 private: 63 void registerVariables(); 49 64 void changeTexture(); 50 unsigned int textureIndex_; 51 unsigned int maxTextureIndex_; 52 Timer textureTimer_; 53 std::string materialBase_; 54 private: 55 void registerVariables(); 65 66 unsigned int textureIndex_; //!< The current index of the texture. (i.e. the index of the currently displayed texture) 67 unsigned int maxTextureIndex_; //!< The maximal index. 68 Timer textureTimer_; //!< A timer that loops and changes textures each time it expires. 69 std::string materialBase_; //!< The base name of the material. 56 70 }; 57 71 } -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
r5929 r8855 27 27 */ 28 28 29 /** 30 @file ParticleProjectile.h 31 @brief Implementation of the ParticleProjectile class. 32 */ 33 29 34 #include "ParticleProjectile.h" 30 35 31 36 #include <OgreParticleEmitter.h> 37 #include "core/CoreIncludes.h" 32 38 #include "tools/ParticleInterface.h" 33 #include "core/CoreIncludes.h"34 39 #include "Scene.h" 35 40 … … 44 49 if (GameMode::showsGraphics()) 45 50 { 51 // Create the particles. 46 52 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::Normal); 47 53 this->attachOgreObject(this->particles_->getParticleSystem()); … … 63 69 } 64 70 71 /** 72 @brief 73 Is called when the visibility of the ParticleProjectile has changed. 74 */ 65 75 void ParticleProjectile::changedVisibility() 66 76 { 67 77 SUPER(ParticleProjectile, changedVisibility); 68 78 79 // Change the visibility of the particles. 69 80 if (this->particles_) 70 81 this->particles_->setEnabled(this->isVisible()); -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file ParticleProjectile.h 31 @brief Definition of the ParticleProjectile class. 32 */ 33 29 34 #ifndef _ParticleProjectile_H__ 30 35 #define _ParticleProjectile_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 A projectile that is represented by particles. 46 @author 47 Fabian 'x3n' Landau 48 @ingroup WeaponsProjectiles 49 */ 37 50 class _WeaponsExport ParticleProjectile : public BillboardProjectile 38 51 { … … 43 56 44 57 private: 45 ParticleInterface* particles_; 58 ParticleInterface* particles_; //!< The particles. 46 59 }; 47 60 } -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file Projectile.h 31 @brief Implementation of the Projectile class. 32 */ 33 29 34 #include "Projectile.h" 30 35 36 #include "core/ConfigValueIncludes.h" 31 37 #include "core/CoreIncludes.h" 32 #include "core/ConfigValueIncludes.h"33 38 #include "core/GameMode.h" 34 39 #include "core/command/Executor.h" 40 35 41 #include "objects/collisionshapes/SphereCollisionShape.h" 36 42 #include "worldentities/pawns/Pawn.h" 37 #include "graphics/ParticleSpawner.h"38 43 39 44 namespace orxonox … … 46 51 47 52 this->setConfigValues(); 48 this->owner_ = 0;49 53 50 54 // Get notification about collisions 51 55 if (GameMode::isMaster()) 52 56 { 53 this->setMass(1.0 );57 this->setMass(1.0f); 54 58 this->enableCollisionCallback(); 55 59 this->setCollisionResponse(false); … … 57 61 58 62 SphereCollisionShape* shape = new SphereCollisionShape(this); 59 shape->setRadius(20 );63 shape->setRadius(20.0f); 60 64 this->attachCollisionShape(shape); 61 65 62 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(& Projectile::destroyObject, this)));66 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); 63 67 } 64 68 } … … 70 74 void Projectile::setConfigValues() 71 75 { 72 SetConfigValue(lifetime_, 4.0 ).description("The time in seconds a projectile stays alive");76 SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive"); 73 77 } 74 78 … … 81 85 return; 82 86 83 if (this->getBDestroy()) 84 this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick() 87 this->destroyCheck(); 85 88 } 86 89 87 void Projectile::destroyObject()90 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 88 91 { 89 if (GameMode::isMaster()) 90 this->destroy(); 92 return this->processCollision(otherObject, contactPoint); 91 93 } 92 94 93 /* Calls the collidesAgainst function of BasicProjectile94 */95 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)96 {97 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);98 }99 100 void Projectile::setOwner(Pawn* owner)101 {102 this->owner_ = owner;103 }104 95 } -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r8706 r8855 27 27 */ 28 28 29 /** 30 @file Projectile.h 31 @brief Definition of the Projectile class. 32 */ 33 29 34 #ifndef _Projectile_H__ 30 35 #define _Projectile_H__ … … 39 44 namespace orxonox 40 45 { 46 47 /** 48 @brief 49 Represents all 'standard' projectiles. 50 51 @author 52 Fabian 'x3n' Landau 53 @author 54 Simon Miescher 55 @ingroup WeaponsProjectiles 56 */ 41 57 class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile 42 58 { … … 46 62 47 63 void setConfigValues(); 48 void destroyObject();49 64 50 65 virtual void tick(float dt); 51 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 52 67 53 void setOwner(Pawn* owner);54 inline Pawn* getOwner() const55 { return this->owner_; }56 57 58 68 private: 59 WeakPtr<Pawn> owner_; 60 float lifetime_; 61 Timer destroyTimer_; 69 float lifetime_; //!< The time the projectile exists. 70 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 62 71 }; 63 72 } -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r8738 r8855 27 27 */ 28 28 29 /** 30 @file Rocket.h 31 @brief Implementation of the Rocket class. 32 */ 33 29 34 #include "Rocket.h" 30 35 … … 33 38 #include "core/CoreIncludes.h" 34 39 #include "core/XMLPort.h" 40 41 #include "Scene.h" 42 #include "controllers/Controller.h" 43 #include "graphics/Model.h" 44 #include "graphics/ParticleSpawner.h" 45 #include "infos/PlayerInfo.h" 46 #include "objects/collisionshapes/ConeCollisionShape.h" 47 #include "sound/WorldSound.h" 35 48 #include "worldentities/CameraPosition.h" 36 49 #include "worldentities/pawns/Pawn.h" 37 #include "graphics/ParticleSpawner.h"38 #include "graphics/Model.h"39 #include "objects/collisionshapes/ConeCollisionShape.h"40 #include "infos/PlayerInfo.h"41 #include "controllers/Controller.h"42 #include "sound/WorldSound.h"43 #include "Scene.h"44 50 45 51 namespace orxonox 46 52 { 47 53 CreateFactory(Rocket); 48 // create the factory for the Rocket49 54 50 55 /** … … 57 62 , RadarViewable(creator, static_cast<WorldEntity*>(this)) 58 63 { 59 RegisterObject(Rocket);// - register the Rocket class to the core64 RegisterObject(Rocket);// Register the Rocket class to the core 60 65 61 66 this->localAngularVelocity_ = 0; 62 this->lifetime_ = 100 ;67 this->lifetime_ = 100.0f; 63 68 64 69 if (GameMode::isMaster()) … … 67 72 this->setVelocity(0,0,-100); 68 73 74 // Create rocket model 69 75 Model* model = new Model(this); 70 76 model->setMeshSource("rocket.mesh"); 71 77 model->scale(0.7f); 72 78 this->attach(model); 79 80 // Add effects. 73 81 ParticleEmitter* fire = new ParticleEmitter(this); 74 82 this->attach(fire); … … 80 88 this->setCollisionType(Kinematic); 81 89 90 // Add collision shape 82 91 ConeCollisionShape* collisionShape = new ConeCollisionShape(this); 83 92 collisionShape->setRadius(3); … … 85 94 this->attachCollisionShape(collisionShape); 86 95 87 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this))); 88 96 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); 97 98 // Add sound 89 99 this->defSndWpnEngine_ = new WorldSound(this); 90 100 this->defSndWpnEngine_->setLooping(true); … … 105 115 } 106 116 117 // Add camera 107 118 CameraPosition* camPosition = new CameraPosition(this); 108 119 camPosition->setPosition(0,4,15); … … 141 152 /** 142 153 @brief 143 Method for creating a Rocket through XML. 144 */ 145 void Rocket::XMLPort(Element& xmlelement, XMLPort::Mode mode) 146 { 147 // this calls the XMLPort function of the parent class 148 SUPER(Rocket, XMLPort, xmlelement, mode); 149 } 150 151 void Rocket::setOwner(Pawn* owner) 152 { 153 this->owner_ = owner; 154 this->player_ = this->getOwner()->getPlayer(); 155 this->getOwner()->getPlayer()->startTemporaryControl(this); 154 Sets the entity that fired the Rocket. 155 @param shooter 156 A pointer to the Pawn that fired the Rocket. 157 */ 158 void Rocket::setShooter(Pawn* shooter) 159 { 160 this->BasicProjectile::setShooter(shooter); 161 162 this->player_ = this->getShooter()->getPlayer(); 163 this->getShooter()->getPlayer()->startTemporaryControl(this); 156 164 157 165 if( GameMode::isMaster() ) … … 179 187 } 180 188 181 if( GameMode::isMaster() ) 182 { 183 if( this->getBDestroy() ) 184 this->destroy(); 185 186 } 187 } 188 189 /* Calls the collidesAgainst function of BasicProjectile 190 */ 189 this->destroyCheck(); 190 } 191 191 192 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 192 193 { 193 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 194 } 195 196 void Rocket::destroyObject() 197 { 198 if (GameMode::isMaster()) 199 { 200 if(this->defSndWpnEngine_->isPlaying()) 201 { 202 this->defSndWpnEngine_->stop(); 203 } 204 this->destroy(); 205 } 206 } 207 194 return this->processCollision(otherObject, contactPoint); 195 } 196 197 /** 198 @brief 199 Destroys the Rocket and stops the sound, 200 */ 201 void Rocket::destroyObject(void) 202 { 203 if (GameMode::isMaster() && this->defSndWpnEngine_->isPlaying()) 204 this->defSndWpnEngine_->stop(); 205 206 this->BasicProjectile::destroyObject(); 207 } 208 209 /** 210 @brief 211 Destroys the Rocket upon pressing "fire". 212 */ 208 213 void Rocket::fired(unsigned int firemode) 209 214 { 210 this->destroy(); 211 } 212 215 this->destroyObject(); 216 } 217 218 /** 219 @brief 220 The effects that are displayed, when the Rocket is destroyed. 221 */ 213 222 void Rocket::destructionEffect() 214 223 { 215 224 ParticleSpawner *effect1, *effect2; 216 if( this->getOwner())217 { 218 effect1 = new ParticleSpawner(this->get Owner()->getCreator());219 effect2 = new ParticleSpawner(this->get Owner()->getCreator());225 if(this->getShooter()) 226 { 227 effect1 = new ParticleSpawner(this->getShooter()->getCreator()); 228 effect2 = new ParticleSpawner(this->getShooter()->getCreator()); 220 229 } 221 230 else -
code/trunk/src/modules/weapons/projectiles/Rocket.h
r8738 r8855 27 27 */ 28 28 29 /** 30 @file Rocket.h 31 @brief Definition of the Rocket class. 32 */ 33 29 34 #ifndef _Rocket_H__ 30 35 #define _Rocket_H__ … … 33 38 34 39 #include "tools/Timer.h" 40 41 #include "interfaces/RadarViewable.h" 35 42 #include "worldentities/ControllableEntity.h" 36 #include "interfaces/RadarViewable.h"37 43 38 44 #include "BasicProjectile.h" … … 44 50 /** 45 51 @brief 46 Rocket , that is made to move upon a specified pattern.47 This class was constructed for the PPS tutorial. 52 Rocket that can be steered by the player. 53 48 54 @author 49 55 Oli Scheuss 56 @ingroup WeaponsProjectiles 50 57 */ 51 58 class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable … … 55 62 virtual ~Rocket(); 56 63 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.58 64 virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick. 59 65 60 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 61 v oid destroyObject();67 virtual void destroyObject(void); 62 68 void destructionEffect(); 63 69 64 virtual void moveFrontBack(const Vector2& value) {}65 virtual void moveRightLeft(const Vector2& value) {}66 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) {} 71 virtual void moveRightLeft(const Vector2& value) {} 72 virtual void moveUpDown(const Vector2& value) {} 67 73 68 74 virtual void rotateYaw(const Vector2& value); … … 75 81 */ 76 82 inline void moveFrontBack(float value) 77 { this->moveFrontBack(Vector2(value, 0)); }83 { this->moveFrontBack(Vector2(value, 0)); } 78 84 /** 79 85 @brief Moves the Rocket in the Right/Left-direction by the specifed amount. … … 81 87 */ 82 88 inline void moveRightLeft(float value) 83 { this->moveRightLeft(Vector2(value, 0)); }89 { this->moveRightLeft(Vector2(value, 0)); } 84 90 /** 85 91 @brief Moves the Rocket in the Up/Down-direction by the specifed amount. … … 87 93 */ 88 94 inline void moveUpDown(float value) 89 { this->moveUpDown(Vector2(value, 0)); }95 { this->moveUpDown(Vector2(value, 0)); } 90 96 91 97 /** … … 94 100 */ 95 101 inline void rotateYaw(float value) 96 { this->rotateYaw(Vector2(value, 0)); }102 { this->rotateYaw(Vector2(value, 0)); } 97 103 /** 98 104 @brief Rotates the Rocket around the x-axis by the specifed amount. … … 100 106 */ 101 107 inline void rotatePitch(float value) 102 { this->rotatePitch(Vector2(value, 0)); }108 { this->rotatePitch(Vector2(value, 0)); } 103 109 /** 104 110 @brief Rotates the Rocket around the z-axis by the specifed amount. … … 106 112 */ 107 113 inline void rotateRoll(float value) 108 { this->rotateRoll(Vector2(value, 0)); }114 { this->rotateRoll(Vector2(value, 0)); } 109 115 110 void setOwner(Pawn* owner); 111 inline Pawn* getOwner() const 112 { return this->owner_; } 116 virtual void setShooter(Pawn* shooter); 113 117 114 118 virtual void fired(unsigned int firemode); 115 119 116 120 private: 117 WeakPtr<Pawn> owner_; 118 Vector3 localAngularVelocity_; 121 Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input. 119 122 120 WeakPtr<PlayerInfo> player_; 121 Timer destroyTimer_; 122 float lifetime_; 123 WeakPtr<PlayerInfo> player_; //!< The player that controls the Rocket. 124 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 125 float lifetime_; //!< The time the projectile exists. 123 126 124 WorldSound* defSndWpnEngine_; 125 WorldSound* defSndWpnLaunch_; 127 WorldSound* defSndWpnEngine_; //!< Engine sound. 128 WorldSound* defSndWpnLaunch_; //!< Launch sound. 126 129 }; 127 130 -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
r8738 r8855 21 21 * 22 22 * Author: 23 * Oliver Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * simonmie … … 27 27 */ 28 28 29 /** 30 @file SimpleRocket.h 31 @brief Implementation of the SimpleRocket class. 32 */ 33 34 29 35 #include "SimpleRocket.h" 30 36 … … 33 39 #include "core/CoreIncludes.h" 34 40 #include "core/XMLPort.h" 41 #include "util/Debug.h" 42 43 #include "controllers/Controller.h" 44 #include "graphics/Model.h" 45 #include "graphics/ParticleSpawner.h" 46 #include "infos/PlayerInfo.h" 47 #include "objects/collisionshapes/ConeCollisionShape.h" 35 48 #include "worldentities/pawns/Pawn.h" 36 #include "graphics/ParticleSpawner.h" 37 #include "graphics/Model.h" 38 #include "objects/collisionshapes/ConeCollisionShape.h" 39 #include "infos/PlayerInfo.h" 40 #include "controllers/Controller.h" 49 #include "sound/WorldSound.h" 50 41 51 #include "weapons/RocketController.h" 42 #include "sound/WorldSound.h"43 #include "util/Debug.h"44 52 45 53 namespace orxonox … … 53 61 , RadarViewable(creator, static_cast<WorldEntity*>(this)) 54 62 { 55 RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core63 RegisterObject(SimpleRocket);// Register the SimpleRocket class to the core 56 64 57 65 this->localAngularVelocity_ = 0; 58 this->lifetime_ = 10; 59 60 this->setMass(15); 61 // COUT(4) << "simplerocket constructed\n"; 66 this->lifetime_ = 10.f; 67 68 this->setMass(15.0); 62 69 63 70 if (GameMode::isMaster()) 64 71 { 65 72 this->setCollisionType(WorldEntity::Kinematic); 66 this->fuel_=true; 67 73 this->fuel_ = true; 74 75 // Create rocket model. 68 76 Model* model = new Model(this); 69 77 model->setMeshSource("rocket.mesh"); … … 71 79 this->attach(model); 72 80 81 // Add effects. 73 82 this->fire_ = new ParticleEmitter(this); 74 83 this->attach(this->fire_); … … 80 89 this->setCollisionType(Kinematic); 81 90 91 // Add collision shape. 82 92 // TODO: fix the orientation and size of this collision shape to match the rocket 83 93 ConeCollisionShape* collisionShape = new ConeCollisionShape(this); … … 86 96 collisionShape->setHeight(5); 87 97 this->attachCollisionShape(collisionShape); 88 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this))); 98 99 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this))); 89 100 } 90 101 … … 97 108 98 109 /** 99 * @brief updates state of rocket, disables fire if no fuel 100 * @param dt tick-length 110 @brief 111 Updates state of rocket, disables fire if no fuel 112 @param dt 113 tick-length 101 114 */ 102 115 void SimpleRocket::tick(float dt) 103 116 { 104 105 117 SUPER(SimpleRocket, tick, dt); 106 if ( GameMode::isMaster() ) 118 119 if (GameMode::isMaster()) 107 120 { 108 109 110 121 this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_); 111 122 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 112 123 this->localAngularVelocity_ = 0; 113 124 114 115 125 if (this->fuel_) 116 126 { 117 if (this->destroyTimer_.getRemainingTime() < (static_cast<float>(this->FUEL_PERCENTAGE)/100)*this->lifetime_ )118 this->fuel_ =false;127 if (this->destroyTimer_.getRemainingTime() < this->FUEL_PERCENTAGE*this->lifetime_ ) 128 this->fuel_ = false; 119 129 } else 120 130 this->disableFire(); 121 122 if( this->getBDestroy() )123 this->destroy();124 131 } 125 132 126 } 127 128 /** 129 * @brief Sets the Acceleration to 0 and detaches the fire 130 * @return void 133 this->destroyCheck(); 134 } 135 136 /** 137 @brief 138 Sets the Acceleration to 0 and detaches the fire. 131 139 */ 132 140 void SimpleRocket::disableFire() … … 136 144 } 137 145 138 /** s146 /** 139 147 @brief 140 148 Destructor. Destroys controller, if present and kills sounds, if playing. … … 153 161 /** 154 162 @brief 155 Method for creating a SimpleRocket through XML. 156 */ 157 void SimpleRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode) 158 { 159 // this calls the XMLPort function of the parent class 160 SUPER(SimpleRocket, XMLPort, xmlelement, mode); 161 } 162 163 void SimpleRocket::setOwner(Pawn* owner) 164 { 165 this->owner_ = owner; 166 this->player_ = this->getOwner()->getPlayer(); 167 } 168 169 170 /* Calls the collidesAgainst function of BasicProjectile 171 */ 163 Set the entity that fired the SimpleRocket. 164 @param shooter 165 A pointer to the Pawn that fired the SimpleRocket. 166 */ 167 void SimpleRocket::setShooter(Pawn* shooter) 168 { 169 BasicProjectile::setShooter(shooter); 170 171 this->player_ = this->getShooter()->getPlayer(); 172 } 173 172 174 bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 173 175 { 174 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 175 } 176 177 void SimpleRocket::destroyObject() 178 { 179 if (GameMode::isMaster()) 180 { 181 this->destroy(); 182 } 176 return this->processCollision(otherObject, contactPoint); 183 177 } 184 178 -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
r8738 r8855 21 21 * 22 22 * Author: 23 * Oliver Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * simonmie 26 26 * 27 27 */ 28 29 /** 30 @file SimpleRocket.h 31 @brief Definition of the SimpleRocket class. 32 */ 28 33 29 34 #ifndef _SimpleRocket_H__ … … 33 38 34 39 #include "tools/Timer.h" 35 #include "worldentities/ControllableEntity.h" 40 36 41 #include "graphics/ParticleSpawner.h" 37 42 #include "interfaces/RadarViewable.h" 43 #include "worldentities/ControllableEntity.h" 38 44 39 45 #include "BasicProjectile.h" … … 45 51 /** 46 52 @brief 47 SimpleRocket, follows direction from a Rocketcontroller, has fuel for 80% of its lifetime, afterwards it's fire disappears. 53 SimpleRocket is a target seeking, intelligent rocket. It follows its target until it either hits something or runs out of fuel. 54 The steering is done by the RocketController. 48 55 @author 49 Gabriel Nadler (Original file: Oli Scheuss) 56 Gabriel Nadler 57 @ingroup WeaponsProjectiles 50 58 */ 51 59 class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable … … 55 63 virtual ~SimpleRocket(); 56 64 virtual void tick(float dt); 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.58 65 59 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 60 void destroyObject();61 67 62 68 void disableFire(); //!< Method to disable the fire and stop all acceleration … … 76 82 */ 77 83 inline void moveFrontBack(float value) 78 { this->moveFrontBack(Vector2(value, 0)); }84 { this->moveFrontBack(Vector2(value, 0)); } 79 85 /** 80 86 @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount. … … 82 88 */ 83 89 inline void moveRightLeft(float value) 84 { this->moveRightLeft(Vector2(value, 0)); }90 { this->moveRightLeft(Vector2(value, 0)); } 85 91 /** 86 92 @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount. … … 88 94 */ 89 95 inline void moveUpDown(float value) 90 { this->moveUpDown(Vector2(value, 0)); }96 { this->moveUpDown(Vector2(value, 0)); } 91 97 92 98 /** … … 95 101 */ 96 102 inline void rotateYaw(float value) 97 { this->rotateYaw(Vector2(value, 0)); }103 { this->rotateYaw(Vector2(value, 0)); } 98 104 /** 99 105 @brief Rotates the SimpleRocket around the x-axis by the specifed amount. … … 101 107 */ 102 108 inline void rotatePitch(float value) 103 { 104 this->rotatePitch(Vector2(value, 0)); } 109 { this->rotatePitch(Vector2(value, 0)); } 105 110 /** 106 111 @brief Rotates the SimpleRocket around the z-axis by the specifed amount. … … 108 113 */ 109 114 inline void rotateRoll(float value) 110 { 111 this->rotateRoll(Vector2(value, 0)); } 115 { this->rotateRoll(Vector2(value, 0)); } 112 116 113 void setOwner(Pawn* owner); 114 inline Pawn* getOwner() const 115 { return this->owner_; } 117 virtual void setShooter(Pawn* shooter); 116 118 117 119 inline bool hasFuel() const 118 { return this->fuel_; }120 { return this->fuel_; } 119 121 120 122 121 123 private: 122 WeakPtr<Pawn> owner_; 123 Vector3 localAngularVelocity_; 124 static const float FUEL_PERCENTAGE = 0.8f; //!< Percentage of lifetime the rocket has fuel 125 126 Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input. 124 127 bool fuel_; //!< Bool is true while the rocket "has fuel" 125 128 126 127 WeakPtr<PlayerInfo> player_; 128 Timer destroyTimer_; 129 float lifetime_; 130 static const int FUEL_PERCENTAGE=80; //!<Percentage of Lifetime the rocket has fuel 129 WeakPtr<PlayerInfo> player_; //!< The player the SimpleRocket belongs to. 130 Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out. 131 float lifetime_; //!< The time the projectile exists. 131 132 132 133 ParticleEmitter* fire_; //!< Fire-Emittor 133 134 135 136 134 }; 137 135 -
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file EnergyDrink.h 31 @brief Implementation of the EnergyDrink class. 32 */ 33 29 34 #include "EnergyDrink.h" 30 35 … … 32 37 #include "core/XMLPort.h" 33 38 #include "core/command/Executor.h" 39 34 40 #include "graphics/Model.h" 35 36 #include "weapons/projectiles/Projectile.h"37 #include "weapons/MuzzleFlash.h"38 41 #include "weaponsystem/Weapon.h" 39 42 #include "weaponsystem/WeaponPack.h" 40 43 #include "weaponsystem/WeaponSystem.h" 41 44 #include "worldentities/pawns/Pawn.h" 45 46 #include "weapons/projectiles/Projectile.h" 47 #include "weapons/MuzzleFlash.h" 42 48 43 49 namespace orxonox … … 49 55 RegisterObject(EnergyDrink); 50 56 51 this->reloadTime_ = 0.25 ;52 this->damage_ = 0 ; //default 1553 this->speed_ = 2500 ;54 this->delay_ = 0 ;57 this->reloadTime_ = 0.25f; 58 this->damage_ = 0.0f; 59 this->speed_ = 2500.0f; 60 this->delay_ = 0.0f; 55 61 this->setMunitionName("FusionMunition"); 56 62 … … 65 71 XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode); 66 72 XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode); 67 68 73 } 69 74 70 void EnergyDrink::setMaterial(const std::string& material) 75 /** 76 @brief 77 Sets the delay with which is fired. 78 @param delay 79 The delay in seconds. 80 */ 81 void EnergyDrink::setDelay(float delay) 71 82 { 72 this->material_ = material; 73 } 74 75 void EnergyDrink::setDelay(float d) 76 { 77 this->delay_ = d; 83 this->delay_ = delay; 78 84 this->delayTimer_.setInterval(this->delay_); 79 85 } 80 86 81 float EnergyDrink::getDelay() const 82 { 83 return this->delay_; 84 } 85 87 /** 88 @brief 89 Fires the weapon. 90 */ 86 91 void EnergyDrink::fire() 87 92 { … … 89 94 } 90 95 91 void EnergyDrink::muendungsfeuer() 92 { 93 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 94 this->getWeapon()->attach(muzzleFlash); 95 muzzleFlash->setPosition(this->getMuzzleOffset()); 96 muzzleFlash->setMaterial(this->material_); 97 } 98 99 /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer() 100 */ 96 /** 97 @brief 98 Executes the shot, be creating the projectile and sending it on its way. 99 */ 101 100 void EnergyDrink::shot() 102 101 { 102 // Create the projectile 103 103 Projectile* projectile = new Projectile(this); 104 104 Model* model = new Model(projectile); … … 112 112 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 113 113 114 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());114 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 115 115 projectile->setDamage(this->getDamage()); 116 116 projectile->setShieldDamage(this->getShieldDamage()); 117 117 projectile->setHealthDamage(this->getHealthDamage()); 118 118 119 EnergyDrink::muendungsfeuer(); 119 // Display a muzzle flash. 120 this->muzzleflash(); 121 } 122 123 /** 124 @brief 125 Displays a muzzle flash. 126 */ 127 void EnergyDrink::muzzleflash() 128 { 129 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 130 this->getWeapon()->attach(muzzleFlash); 131 muzzleFlash->setPosition(this->getMuzzleOffset()); 132 muzzleFlash->setMaterial(this->material_); 120 133 } 121 134 } -
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
r5929 r8855 27 27 */ 28 28 29 /** 30 @file EnergyDrink.h 31 @brief Definition of the EnergyDrink class. 32 */ 33 29 34 #ifndef _EnergyDrink_H__ 30 35 #define _EnergyDrink_H__ … … 38 43 namespace orxonox 39 44 { 45 46 /** 47 @brief 48 Shoots a can. 49 @author 50 Hagen Seifert 51 @ingroup WeaponsWeaponModes 52 */ 40 53 class _WeaponsExport EnergyDrink : public WeaponMode 41 54 { … … 48 61 49 62 private: 50 void setMaterial(const std::string& material); 51 inline const std::string& getMaterial() 63 /** 64 @brief Set the material of the EnergyDrink. 65 @param material The name of the material. 66 */ 67 void setMaterial(const std::string& material) 68 { this->material_ = material; } 69 /** 70 @brief Get the material of the EnergyDrink. 71 @return Returns the material name. 72 */ 73 inline const std::string& getMaterial() const 52 74 { return this->material_; } 53 void setDelay(float d); 54 float getDelay() const; 75 76 void setDelay(float delay); 77 /** 78 @brief Get the firing delay. 79 @return Returns the delay in seconds. 80 */ 81 float getDelay() const 82 { return this->delay_; } 83 55 84 void shot(); 56 void mu endungsfeuer();85 void muzzleflash(); 57 86 58 std::string material_; 59 float speed_; 60 float delay_; 61 Timer delayTimer_; 87 std::string material_; //!< The material. 88 float speed_; //!< The speed of the EnergyDrink. 89 float delay_; //!< The firing delay. 90 Timer delayTimer_; //!< The timer to delay the firing. 62 91 }; 63 92 } -
code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file FusionFire.h 31 @brief Implementation of the FusionFire class. 32 */ 33 29 34 #include "FusionFire.h" 30 35 36 #include "core/CoreIncludes.h" 31 37 #include "util/Math.h" 32 #include "core/CoreIncludes.h"33 #include "weapons/projectiles/BillboardProjectile.h"34 38 35 39 #include "weaponsystem/Weapon.h" … … 37 41 #include "weaponsystem/WeaponSystem.h" 38 42 #include "worldentities/pawns/Pawn.h" 43 44 #include "weapons/projectiles/BillboardProjectile.h" 39 45 40 46 namespace orxonox … … 46 52 RegisterObject(FusionFire); 47 53 48 this->reloadTime_ = 1.0 ;54 this->reloadTime_ = 1.0f; 49 55 this->bParallelReload_ = false; 50 this->damage_ = 0 ; //default 4051 this->speed_ = 1250 ;56 this->damage_ = 0.0f; 57 this->speed_ = 1250.0f; 52 58 53 59 this->setMunitionName("FusionMunition"); 54 60 } 55 61 56 /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties 57 */ 62 /** 63 @brief 64 Fires the weapon, by creating a projectile. 65 */ 58 66 void FusionFire::fire() 59 67 { … … 65 73 projectile->scale(5); 66 74 67 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());75 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 68 76 projectile->setDamage(this->getDamage()); 69 77 projectile->setShieldDamage(this->getShieldDamage()); -
code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file FusionFire.h 31 @brief Definition of the FusionFire class. 32 */ 33 29 34 #ifndef _FusionFire_H__ 30 35 #define _FusionFire_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 FusionFire. 46 @author 47 Martin Polak 48 @ingroup WeaponsWeaponModes 49 */ 37 50 class _WeaponsExport FusionFire : public WeaponMode 38 51 { … … 44 57 45 58 private: 46 float speed_; 59 float speed_; //!< The speed of the fusion fire weapon. 47 60 }; 48 61 } -
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file HsW01.h 31 @brief Implementation of the HsW01 class. 32 */ 33 29 34 #include "HsW01.h" 30 35 … … 32 37 #include "core/XMLPort.h" 33 38 #include "core/command/Executor.h" 39 34 40 #include "graphics/Model.h" 35 36 #include "weapons/projectiles/Projectile.h"37 #include "weapons/MuzzleFlash.h"38 41 #include "weaponsystem/Weapon.h" 39 42 #include "weaponsystem/WeaponPack.h" … … 41 44 #include "worldentities/WorldEntity.h" 42 45 #include "worldentities/pawns/Pawn.h" 46 47 #include "weapons/projectiles/Projectile.h" 48 #include "weapons/MuzzleFlash.h" 43 49 44 50 namespace orxonox … … 50 56 RegisterObject(HsW01); 51 57 52 this->reloadTime_ = 0.25 ;53 this->damage_ = 0 ; //default 1554 this->speed_ = 2500 ;55 this->delay_ = 0 ;58 this->reloadTime_ = 0.25f; 59 this->damage_ = 0.0f; //default 15 60 this->speed_ = 2500.0f; 61 this->delay_ = 0.0f; 56 62 this->setMunitionName("LaserMunition"); 57 63 … … 72 78 XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode); 73 79 XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode); 74 75 80 } 76 81 77 void HsW01::setMaterial(const std::string& material) 82 /** 83 @brief 84 Set the firing delay. 85 @param delay 86 The firing delay in seconds. 87 */ 88 void HsW01::setDelay(float delay) 78 89 { 79 this->material_ = material; 80 } 81 82 std::string& HsW01::getMaterial() 83 { 84 return this->material_; 85 } 86 87 void HsW01::setDelay(float d) 88 { 89 this->delay_ = d; 90 this->delay_ = delay; 90 91 this->delayTimer_.setInterval(this->delay_); 91 }92 93 float HsW01::getDelay() const94 {95 return this->delay_;96 92 } 97 93 … … 101 97 } 102 98 103 void HsW01::muendungsfeuer() 104 { 105 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 106 this->getWeapon()->attach(muzzleFlash); 107 muzzleFlash->setPosition(this->getMuzzleOffset()); 108 muzzleFlash->setMaterial(this->material_); 109 } 110 111 /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer() 112 */ 99 /** 100 @brief 101 Fires the weapon. Creates a projectile and fires it. 102 */ 113 103 void HsW01::shot() 114 104 { 115 105 assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() ); 106 107 // Create the projectile. 116 108 Projectile* projectile = new Projectile(this); 117 109 Model* model = new Model(projectile); … … 126 118 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 127 119 128 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());120 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 129 121 projectile->setDamage(this->getDamage()); 130 122 projectile->setShieldDamage(this->getShieldDamage()); 131 123 projectile->setHealthDamage(this->getHealthDamage()); 132 124 133 HsW01::muendungsfeuer(); 125 // Display the muzzle flash. 126 this->HsW01::muzzleflash(); 127 } 128 129 /** 130 @brief 131 Displays the muzzle flash. 132 */ 133 void HsW01::muzzleflash() 134 { 135 MuzzleFlash *muzzleFlash = new MuzzleFlash(this); 136 this->getWeapon()->attach(muzzleFlash); 137 muzzleFlash->setPosition(this->getMuzzleOffset()); 138 muzzleFlash->setMaterial(this->material_); 134 139 } 135 140 } -
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
r6417 r8855 27 27 */ 28 28 29 /** 30 @file HsW01.h 31 @brief Definition of the HsW01 class. 32 */ 33 29 34 #ifndef _HsW01_H__ 30 35 #define _HsW01_H__ … … 37 42 namespace orxonox 38 43 { 44 45 /** 46 @brief 47 Shoots laser beams. 48 @author 49 Hagen Seifert 50 @ingroup WeaponsWeaponModes 51 */ 39 52 class _WeaponsExport HsW01 : public WeaponMode 40 53 { … … 47 60 48 61 private: 49 void setMaterial(const std::string& material); 50 std::string& getMaterial(); 51 void setDelay(float d); 52 float getDelay() const; 62 /** 63 @brief Set the material. 64 @param material The material name. 65 */ 66 void setMaterial(const std::string& material) 67 { this->material_ = material; } 68 /** 69 @brief Get the material. 70 @return Returns the material name. 71 */ 72 const std::string& getMaterial() const 73 { return this->material_; } 74 75 void setDelay(float delay); 76 /** 77 @brief Get the firing delay. 78 @return Returns the firing delay in seconds. 79 */ 80 float getDelay() const 81 { return this->delay_; } 82 53 83 void shot(); 54 void mu endungsfeuer();84 void muzzleflash(); 55 85 56 std::string material_; 57 float speed_; 58 float delay_; 59 Timer delayTimer_; 86 std::string material_; //!< The material. 87 float speed_; //!< The speed of the fired projectile. 88 float delay_; //!< The firing delay. 89 Timer delayTimer_; //!< A timer to delay the firing. 60 90 }; 61 91 } -
code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file LaserFire.h 31 @brief Implementation of the LaserFire class. 32 */ 33 29 34 #include "LaserFire.h" 30 35 31 36 #include "core/CoreIncludes.h" 32 #include "weapons/projectiles/ParticleProjectile.h" 37 33 38 #include "weaponsystem/Weapon.h" 34 39 #include "weaponsystem/WeaponPack.h" 35 40 #include "weaponsystem/WeaponSystem.h" 36 41 #include "worldentities/pawns/Pawn.h" 42 43 #include "weapons/projectiles/ParticleProjectile.h" 37 44 38 45 namespace orxonox … … 44 51 RegisterObject(LaserFire); 45 52 46 this->reloadTime_ = 0.25 ;47 this->damage_ = 0 ; //default 1548 this->speed_ = 1250 ;53 this->reloadTime_ = 0.25f; 54 this->damage_ = 0.0f; 55 this->speed_ = 1250.0f; 49 56 50 57 this->setMunitionName("LaserMunition"); 51 58 } 52 59 53 /* Creates the projectile object, sets its properties to the LaserFire properties 54 */ 60 /** 61 @brief 62 Fires the weapon. Creates a projectile and fires it. 63 */ 55 64 void LaserFire::fire() 56 65 { … … 61 70 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 62 71 63 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());72 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 64 73 projectile->setDamage(this->getDamage()); 65 74 projectile->setShieldDamage(this->getShieldDamage()); -
code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
r5781 r8855 27 27 */ 28 28 29 /** 30 @file LaserFire.h 31 @brief Definition of the LaserFire class. 32 */ 33 29 34 #ifndef _LaserFire_H__ 30 35 #define _LaserFire_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 Shoots a particle laser. 46 @author 47 Martin Polak 48 @ingroup WeaponsWeaponModes 49 */ 37 50 class _WeaponsExport LaserFire : public WeaponMode 38 51 { … … 44 57 45 58 private: 46 float speed_; 59 float speed_; //!< The speed of the fired projectile. 47 60 }; 48 61 } -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file LightningGun.h 31 @brief Implementation of the LightningGun class. 32 */ 33 29 34 #include "LightningGun.h" 30 35 31 36 #include "core/CoreIncludes.h" 32 #include "weapons/projectiles/LightningGunProjectile.h"33 37 #include "weaponsystem/Weapon.h" 34 38 #include "weaponsystem/WeaponPack.h" 35 39 #include "weaponsystem/WeaponSystem.h" 36 40 #include "worldentities/pawns/Pawn.h" 41 42 #include "weapons/projectiles/LightningGunProjectile.h" 37 43 38 44 namespace orxonox … … 44 50 RegisterObject(LightningGun); 45 51 46 this->reloadTime_ = 1 ;47 this->damage_ = 0 ; //default 10048 this->speed_ = 150;52 this->reloadTime_ = 1.0f; 53 this->damage_ = 0.0f; 54 this->speed_ = 250.0f; 49 55 50 56 this->setMunitionName("LaserMunition"); … … 56 62 } 57 63 58 /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties 59 */ 64 /** 65 @brief 66 Fires the weapon. Creates a projectile and fires it. 67 */ 60 68 void LightningGun::fire() 61 69 { … … 67 75 projectile->setPosition(this->getMuzzlePosition()); 68 76 projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_); 69 projectile->setAcceleration(this->getMuzzleDirection() * 1000);70 77 71 projectile->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());78 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 72 79 projectile->setDamage(this->getDamage()); 73 80 projectile->setShieldDamage(this->getShieldDamage()); -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
r6417 r8855 27 27 */ 28 28 29 /** 30 @file LightningGun.h 31 @brief Definition of the LightningGun class. 32 */ 33 29 34 #ifndef _LightningGun_H__ 30 35 #define _LightningGun_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 A slow ball of lightning. 46 @author 47 Joel Smely 48 @ingroup WeaponsWeaponModes 49 */ 37 50 class _WeaponsExport LightningGun : public WeaponMode 38 51 { … … 44 57 45 58 private: 46 float speed_; 59 float speed_; //!< The speed of the fired projectile. 47 60 }; 48 61 } -
code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
r8706 r8855 27 27 */ 28 28 29 /** 30 @file RocketFire.h 31 @brief Implementation of the RocketFire class. 32 */ 33 29 34 #include "RocketFire.h" 30 35 36 #include "core/CoreIncludes.h" 31 37 #include "util/Math.h" 32 #include "core/CoreIncludes.h"33 #include "weapons/projectiles/Rocket.h"34 38 35 39 #include "weaponsystem/Weapon.h" … … 37 41 #include "weaponsystem/WeaponSystem.h" 38 42 #include "worldentities/pawns/Pawn.h" 43 44 #include "weapons/projectiles/Rocket.h" 39 45 40 46 namespace orxonox … … 48 54 this->reloadTime_ = 0.20f; 49 55 this->bParallelReload_ = false; 50 this->damage_ = 0 ;51 this->speed_ = 500 ;56 this->damage_ = 0.0f; 57 this->speed_ = 500.0f; 52 58 53 59 this->setMunitionName("RocketMunition"); … … 59 65 } 60 66 61 /* Creates the Rocket object, sets its properties to the RocketFire properties 62 */ 67 /** 68 @brief 69 Fires the weapon. Creates the Rocket and fires it. 70 */ 63 71 void RocketFire::fire() 64 72 { … … 71 79 rocket->scale(2); 72 80 73 rocket->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());81 rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 74 82 rocket->setDamage(this->getDamage()); 75 83 rocket->setShieldDamage(this->getShieldDamage()); -
code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
r6417 r8855 27 27 */ 28 28 29 /** 30 @file RocketFire.h 31 @brief Definition of the RocketFire class. 32 */ 33 29 34 #ifndef _RocketFire_H__ 30 35 #define _RocketFire_H__ … … 35 40 namespace orxonox 36 41 { 42 43 /** 44 @brief 45 Fires the (steerable) Rocket. 46 @author 47 Oliver Scheuss 48 @ingroup WeaponsWeaponModes 49 */ 37 50 class _WeaponsExport RocketFire : public WeaponMode 38 51 { … … 44 57 45 58 private: 46 float speed_; 59 float speed_; //!< The speed of the Rocket. 47 60 }; 48 61 } -
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r8706 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler 24 * Co-authors: 23 25 * Oliver Scheuss 24 * Co-authors:25 26 * simonmie 26 27 * 27 28 */ 28 29 30 /** 31 @file BasicProjectile.h 32 @brief Implementation of the BasicProjectile class. 33 */ 34 29 35 #include "SimpleRocketFire.h" 30 36 37 #include "core/CoreIncludes.h" 31 38 #include "util/Math.h" 32 #include "core/CoreIncludes.h"33 #include "weapons/RocketController.h"34 39 35 40 #include "weaponsystem/Weapon.h" … … 38 43 #include "worldentities/pawns/Pawn.h" 39 44 #include "sound/WorldSound.h" 45 46 #include "weapons/RocketController.h" 47 #include "weapons/projectiles/SimpleRocket.h" 40 48 41 49 namespace orxonox … … 48 56 RegisterObject(SimpleRocketFire); 49 57 50 this->reloadTime_ = 1 ;58 this->reloadTime_ = 1.0f; 51 59 this->bParallelReload_ = false; 52 this->damage_ = 0 ;53 this->speed_ = 500 ;60 this->damage_ = 0.0f; 61 this->speed_ = 500.0f; 54 62 55 63 this->setMunitionName("RocketMunition"); … … 62 70 } 63 71 64 /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target 65 */ 72 /** 73 @brief 74 Fires the weapon. Creates the SimpleRocket and a RocketController to steer it and fires it. 75 */ 66 76 void SimpleRocketFire::fire() 67 77 { 68 RocketController* con = new RocketController(this);69 SimpleRocket* rocket = con ->getRocket();78 RocketController* controller = new RocketController(this); 79 SimpleRocket* rocket = controller->getRocket(); 70 80 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 71 81 rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation()); 72 82 rocket->setPosition(this->getMuzzlePosition()); 73 83 rocket->setVelocity(this->getMuzzleDirection()*this->speed_); 74 rocket->set Owner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());84 rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 75 85 76 86 rocket->setDamage(this->damage_); … … 78 88 rocket->setHealthDamage(this->getHealthDamage()); 79 89 80 WorldEntity* pawn n=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();81 if (pawn n) con->setTarget(pawnn);90 WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget(); 91 if (pawn) controller->setTarget(pawn); 82 92 } 83 93 } -
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
r7163 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler 24 * Co-authors: 23 25 * Oliver Scheuss 24 * Co-authors:25 * ...26 26 * 27 27 */ 28 29 /** 30 @file SimpleRocketFire.h 31 @brief Definition of the SimpleRocketFire class. 32 */ 28 33 29 34 #ifndef _SimpleRocketFire_H__ … … 39 44 FireMode for target-seeking Rocket 40 45 @author 41 Gabriel Nadler (Original file: Oli Scheuss) 46 Gabriel Nadler 47 @ingroup WeaponsWeaponModes 42 48 */ 43 49 class _WeaponsExport SimpleRocketFire : public WeaponMode … … 50 56 51 57 private: 52 float speed_; 58 float speed_; //!< The speed of the SimpleRocket. 53 59 54 60 }; -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r8706 r8855 47 47 #include "weaponsystem/WeaponSet.h" 48 48 49 50 49 namespace orxonox 51 50 { … … 256 255 257 256 */ 258 259 257 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage) 260 258 { -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r8706 r8855 75 75 76 76 inline float getShieldHealth() 77 { return this->shieldHealth_; }77 { return this->shieldHealth_; } 78 78 79 79 inline void addShieldHealth(float amount) 80 { this->setShieldHealth(this->shieldHealth_ + amount); }80 { this->setShieldHealth(this->shieldHealth_ + amount); } 81 81 82 82 inline bool hasShield() 83 { return (this->getShieldHealth() > 0); }83 { return (this->getShieldHealth() > 0); } 84 84 85 85 virtual void setMaxShieldHealth(float maxshieldhealth); … … 98 98 99 99 inline void setShieldAbsorption(float shieldAbsorption) 100 { this->shieldAbsorption_ = shieldAbsorption; }100 { this->shieldAbsorption_ = shieldAbsorption; } 101 101 inline float getShieldAbsorption() 102 { return this->shieldAbsorption_; }102 { return this->shieldAbsorption_; } 103 103 104 104 // TODO: Rename to shieldRechargeRate … … 112 112 113 113 inline void resetReloadCountdown() 114 { this->reloadWaitCountdown_ = 0; }114 { this->reloadWaitCountdown_ = 0; } 115 115 116 116 inline void startReloadCountdown() 117 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc117 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc 118 118 119 119 virtual void decreaseReloadCountdownTime(float dt);
Note: See TracChangeset
for help on using the changeset viewer.