Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8855


Ignore:
Timestamp:
Aug 22, 2011, 3:05:26 PM (13 years ago)
Author:
dafrick
Message:

Cleaning up game immersion. Roughly documenting weapons module.

Location:
code/trunk/src
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/weapons/MuzzleFlash.cc

    r7801 r8855  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      Ich
    26  *      Dini Mueter
     25 *      ...
    2726 *
    2827 */
     28
     29/**
     30    @file MuzzleFlash.h
     31    @brief Implementation of the MuzzleFlash class.
     32*/
    2933
    3034#include "MuzzleFlash.h"
     
    4347
    4448        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)));
    4650    }
    4751}
  • code/trunk/src/modules/weapons/MuzzleFlash.h

    r5929 r8855  
    2727 */
    2828
     29/**
     30    @file MuzzleFlash.h
     31    @brief Definition of the MuzzleFlash class.
     32*/
     33
    2934#ifndef _MuzzleFlash_H__
    3035#define _MuzzleFlash_H__
     
    3742namespace orxonox
    3843{
     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    */
    3954    class _WeaponsExport MuzzleFlash : public Billboard
    4055    {
     
    4459
    4560        private:
    46             Timer delayTimer_;
     61            Timer delayTimer_; //!< Timer to destroy the object.
    4762    };
    4863}
  • code/trunk/src/modules/weapons/RocketController.cc

    r7163 r8855  
    2121*
    2222*   Author:
    23 *     Gabriel Nadler, Originalfile: Oli Scheuss
     23*     Gabriel Nadler
    2424*   Co-authors:
    2525*      ...
     
    2727*/
    2828
     29/**
     30    @file BasicProjectile.h
     31    @brief Implementation of the BasicProjectile class.
     32*/
     33
    2934#include "RocketController.h"
     35
     36#include "util/Math.h"
     37#include "worldentities/pawns/Pawn.h"
    3038#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"
    3640
    3741namespace orxonox
     
    3943    /**
    4044    @brief
    41     Constructor.
     45        Constructor.
    4246    */
    4347    RocketController::RocketController(BaseObject* creator) : Controller(creator)
     
    4650        COUT(5)<< "RocketController constructed\n";
    4751
    48 
     52        // Create a rocket for the controller.
    4953        this->rocket_ = new SimpleRocket(this);
    5054        this->rocket_->setController(this);
     
    5559    /**
    5660    @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.
    5862    @param dt
    59     The duration of the tick.
     63        The duration of the tick.
    6064    */
    6165    void RocketController::tick(float dt)
    6266    {
    63 
    6467        if (this->target_ && this->rocket_->hasFuel()) {
    65             this->setTargetPosition();
    66             this->moveToTargetPosition();
     68            this->updateTargetPosition();
     69            this->moveToPosition(this->targetPosition_);
    6770        }
    68 
    69 
    7071    }
    71 
    7272
    7373    RocketController::~RocketController()
     
    7676    }
    7777
    78     void RocketController::setTargetPosition()
     78    /**
     79    @brief
     80        Update the position of the target.
     81    */
     82    void RocketController::updateTargetPosition()
    7983    {
    80         this->targetPosition_=this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
     84        this->targetPosition_ = this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
    8185        //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;
    9386    }
    9487
     
    110103    }
    111104
    112 
    113 
    114 
    115105}
  • code/trunk/src/modules/weapons/RocketController.h

    r7163 r8855  
    2121 *
    2222 *   Author:
    23  *      Gabriel Nadler, Originalfile: Oli Scheuss
     23 *      Gabriel Nadler
    2424 *   Co-authors:
    2525 *      ...
    2626 *
    2727 */
     28
     29/**
     30    @file RocketController.h
     31    @brief Definition of the RocketController class.
     32*/
    2833
    2934#ifndef _RocketController_H__
     
    3237#include "weapons/WeaponsPrereqs.h"
    3338
     39#include "tools/interfaces/Tickable.h"
    3440#include "controllers/Controller.h"
    35 #include "tools/interfaces/Tickable.h"
    36 #include "weapons/projectiles/SimpleRocket.h"
    37 #include "weapons/weaponmodes/SimpleRocketFire.h"
    3841
    3942namespace orxonox
     
    4144    /**
    4245    @brief
    43         Controller for the Rocket (targetseeking)
     46        Controller for the SimpleRocket (target seeking)
    4447    @author
    45         Gabriel Nadler, Originalfile: Oli Scheuss
     48        Gabriel Nadler
     49    @ingroup Weapons
    4650    */
    4751    class _WeaponsExport RocketController : public Controller, public Tickable
     
    5256
    5357            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            */
    5462            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
    5772        protected:
     73            void updateTargetPosition();
    5874            void moveToPosition(const Vector3& target);
    59             void setTargetPosition();
    60             void moveToTargetPosition();
    6175
    6276        private:
    63             SimpleRocket* rocket_; //!<The Rocket it controlls
    64             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.
    6680
    67             WeakPtr<WorldEntity> target_;
    68 
    69 
     81            WeakPtr<WorldEntity> target_; //!< The target.
    7082    };
    7183}
  • code/trunk/src/modules/weapons/WeaponsPrereqs.h

    r8351 r8855  
    8181    class ParticleProjectile;
    8282    class Projectile;
     83    class Rocket;
     84    class SimpleRocket;
    8385
    8486    // weaponmodes
     
    8890    class LaserFire;
    8991    class LightningGun;
     92    class RocketFire;
     93    class SimpleRocketFire;
    9094}
    9195
  • code/trunk/src/modules/weapons/munitions/FusionMunition.cc

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file FusionMunition.h
     31    @brief Implementation of the FusionMunition class.
     32*/
     33
    2934#include "FusionMunition.h"
    3035#include "core/CoreIncludes.h"
  • code/trunk/src/modules/weapons/munitions/FusionMunition.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file FusionMunition.h
     31    @brief Definition of the FusionMunition class.
     32*/
     33
    2934#ifndef _FusionMunition_H__
    3035#define _FusionMunition_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        FusionMunition.
     46    @author
     47        Martin Polak
     48    @ingroup WeaponsMunitions
     49    */
    3750    class _WeaponsExport FusionMunition : public Munition
    3851    {
  • code/trunk/src/modules/weapons/munitions/LaserMunition.cc

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file LaserMunition.h
     31    @brief Implementation of the LaserMunition class.
     32*/
     33
    2934#include "LaserMunition.h"
    3035#include "core/CoreIncludes.h"
     
    4853        this->bAllowMultiMunitionRemovementUnderflow_ = true;
    4954
    50         this->replenishIntervall_ = 0.5f;
     55        this->replenishInterval_ = 0.5f;
    5156        this->replenishMunitionAmount_ = 1;
    5257    }
  • code/trunk/src/modules/weapons/munitions/LaserMunition.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file LaserMunition.h
     31    @brief Definition of the LaserMunition class.
     32*/
     33
    2934#ifndef _LaserMunition_H__
    3035#define _LaserMunition_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        LaserMunition.
     46    @author
     47        Martin Polak
     48    @ingroup WeaponsMunitions
     49    */
    3750    class _WeaponsExport LaserMunition : public ReplenishingMunition
    3851    {
  • code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc

    r8729 r8855  
    2727 */
    2828
     29/**
     30    @file ReplenishingMunition.h
     31    @brief Implementation of the ReplenishingMunition class.
     32*/
     33
    2934#include "ReplenishingMunition.h"
    3035
     
    4045        RegisterObject(ReplenishingMunition);
    4146
    42         this->replenishIntervall_ = 1.0f;
     47        this->replenishInterval_ = 1.0f;
    4348        this->replenishMunitionAmount_ = 1;
    4449
     
    5257    {
    5358        // Initialize the timer
    54         this->replenishingTimer_.setTimer(this->replenishIntervall_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this)));
     59        this->replenishingTimer_.setTimer(this->replenishInterval_, true, createExecutor(createFunctor(&ReplenishingMunition::replenish, this)));
    5560    }
    5661
  • code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h

    r5929 r8855  
    2727 */
    2828
     29/**
     30    @file ReplenishingMunition.h
     31    @brief Definition of the ReplenishingMunition class.
     32*/
     33
    2934#ifndef _ReplenishingMunition_H__
    3035#define _ReplenishingMunition_H__
     
    3742namespace orxonox
    3843{
     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    */
    3952    class _WeaponsExport ReplenishingMunition : public Munition
    4053    {
     
    4457
    4558        protected:
    46             float replenishIntervall_;
    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.
    4861
    4962        private:
     
    5164            void initializeTimer();
    5265
    53             Timer replenishingTimer_;
     66            Timer replenishingTimer_; //!< Timer to do the replenishing.
    5467    };
    5568}
  • code/trunk/src/modules/weapons/munitions/RocketMunition.cc

    r7896 r8855  
    2727 */
    2828
     29/**
     30    @file RocketMunition.h
     31    @brief Implementation of the RocketMunition class.
     32*/
     33
    2934#include "RocketMunition.h"
    3035#include "core/CoreIncludes.h"
  • code/trunk/src/modules/weapons/munitions/RocketMunition.h

    r7846 r8855  
    2727 */
    2828
     29/**
     30    @file RocketMunition.h
     31    @brief Definition of the RocketMunition class.
     32*/
     33
    2934#ifndef _RocketMunition_H__
    3035#define _RocketMunition_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        Munition for the Rocket.
     46    @author
     47        Fabian 'x3n' Landau
     48    @ingroup WeaponsMunitions
     49    */
    3750    class _WeaponsExport RocketMunition : public Munition
    3851    {
  • code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc

    r8767 r8855  
    2727 */
    2828
     29/**
     30    @file BasicProjectile.h
     31    @brief Implementation of the BasicProjectile class.
     32*/
     33
    2934#include "BasicProjectile.h"
    3035
    3136#include "core/CoreIncludes.h"
    32 #include "core/ConfigValueIncludes.h"
    3337#include "core/GameMode.h"
    3438#include "core/command/Executor.h"
    35 #include "objects/collisionshapes/SphereCollisionShape.h"
    36 #include "worldentities/pawns/Pawn.h"
     39
    3740#include "graphics/ParticleSpawner.h"
    38 #include "core/OrxonoxClass.h"
    3941
    4042namespace orxonox
     
    4648    BasicProjectile::BasicProjectile() : OrxonoxClass()
    4749    {
    48         RegisterRootObject(BasicProjectile);// - register the BasicProjectile class to the core
     50        RegisterRootObject(BasicProjectile);// Register the BasicProjectile class to the core
    4951
    5052        this->bDestroy_ = false;
     
    6163    }
    6264
    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)
    6879    {
    69         if (!this_->getBDestroy() && GameMode::isMaster())
     80        if (!this->bDestroy_ && GameMode::isMaster())
    7081        {
    71             if (otherObject == owner) //prevents you from shooting yourself
     82            if (otherObject == this->getShooter()) // Prevents you from shooting yourself
    7283                return false;
    7384
    74             this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.
    75                                       // The projectile is destroyed by its tick()-function (in the following tick).
     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).
    7687
    77             Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
     88            Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL
    7889
    79             WorldEntity* entity = orxonox_cast<WorldEntity*>(this_);
    80             assert(entity); //entity must not be null
     90            WorldEntity* entity = orxonox_cast<WorldEntity*>(this);
     91            assert(entity); // The projectile must not be a WorldEntity.
    8192
    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
    8494            if (victim)
    8595            {
    86                 victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
     96                victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
    8797                victim->startReloadCountdown();
    8898            }
    8999
    90             // visual effects for being hit, depending on whether the shield is hit or not
    91             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.
    92102            {
    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 health
    95                 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)))
    96106                {
    97107                    {
    98                         ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
     108                        ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
    99109                        effect->setPosition(entity->getPosition());
    100110                        effect->setOrientation(entity->getOrientation());
     
    103113                        effect->setLifetime(2.0f);
    104114                    }
    105                         // second effect with same condition
     115                    // Second effect with same condition
    106116                    {
    107                         ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
     117                        ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
    108118                        effect->setPosition(entity->getPosition());
    109119                        effect->setOrientation(entity->getOrientation());
     
    115125
    116126                // 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)
    118128                {
    119                     ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
     129                    ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
    120130                    effect->setDestroyAfterLife(true);
    121131                    effect->setSource("Orxonox/Shield");
     
    124134                }
    125135            }
    126 
     136            return true;
    127137        }
    128138        return false;
    129139    }
     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    }
    130161}
  • code/trunk/src/modules/weapons/projectiles/BasicProjectile.h

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file BasicProjectile.h
     31    @brief Definition of the BasicProjectile class.
     32*/
     33
    2934#ifndef _BasicProjectile_H__
    3035#define _BasicProjectile_H__
     
    3237#include "weapons/WeaponsPrereqs.h"
    3338
    34 #include "tools/Timer.h"
     39#include "worldentities/pawns/Pawn.h"
     40
    3541#include "core/OrxonoxClass.h"
    3642
    3743namespace orxonox
    3844{
     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    */
    3954    class _WeaponsExport BasicProjectile : public virtual OrxonoxClass
    4055    {
    4156        public:
    4257            BasicProjectile();
    43 
    4458            virtual ~BasicProjectile();
    4559
    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            */
    5065            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            */
    5272            inline float getDamage() const
    5373                { return this->damage_; }
    5474
     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            */
    5580            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            */
    5787            inline float getHealthDamage() const
    5888                { return this->healthdamage_; }
    5989
     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            */
    6095            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            */
    62102            inline float getShieldDamage() const
    63103                { return this->shielddamage_; }
    64104
     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_; }
    65117
    66             inline void setBDestroy(bool bDestroy)
    67                 { this->bDestroy_ = bDestroy;  }
    68             inline float getBDestroy() const
    69                 { return this->bDestroy_; }
     118            virtual void destroyObject(void);
    70119
     120        protected:
     121            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     122            void destroyCheck(void);
    71123
    72124        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.
    74126
    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.
    78130
    79             bool bDestroy_;
     131            bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed.
    80132    };
    81133}
  • code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc

    r6502 r8855  
    2727 */
    2828
     29/**
     30    @file BillboardProjectile.h
     31    @brief Implementation of the BillboardProjectile class.
     32*/
     33
    2934#include "BillboardProjectile.h"
    3035
     
    4449        {
    4550            assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
     51
     52            // Create the billboard.
    4653            this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5f, 0.5f, 0.7f, 0.8f), 1);
    4754            this->attachOgreObject(this->billboard_.getBillboardSet());
     
    5764    }
    5865
     66    /**
     67    @brief
     68        Set the colour of the BillboardProjectile.
     69    @param colour
     70        The colour to be set.
     71    */
    5972    void BillboardProjectile::setColour(const ColourValue& colour)
    6073    {
     
    6275    }
    6376
     77    /**
     78    @brief
     79        Set the material of the BillboardProjectile.
     80    @param material
     81        The material name.
     82    */
    6483    void BillboardProjectile::setMaterial(const std::string& material)
    6584    {
     
    6786    }
    6887
     88    /**
     89    @brief
     90        Is called when the visibility of the BillboardProjectile has changed.
     91    */
    6992    void BillboardProjectile::changedVisibility()
    7093    {
    7194        SUPER(BillboardProjectile, changedVisibility);
    7295
     96        // Also change the visibility of the billboard.
    7397        this->billboard_.setVisible(this->isVisible());
    7498    }
  • code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file BillboardProjectile.h
     31    @brief Definition of the BillboardProjectile class.
     32*/
     33
    2934#ifndef _BillboardProjectile_H__
    3035#define _BillboardProjectile_H__
     
    3843namespace orxonox
    3944{
     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    */
    4054    class _WeaponsExport BillboardProjectile : public Projectile
    4155    {
     
    4963
    5064        private:
    51             BillboardSet billboard_;
     65            BillboardSet billboard_; //!< The billboard that represents the projectile.
    5266    };
    5367}
  • code/trunk/src/modules/weapons/projectiles/CMakeLists.txt

    r8706 r8855  
    11ADD_SOURCE_FILES(WEAPONS_SRC_FILES
     2  BasicProjectile.cc
    23  BillboardProjectile.cc
    34  ParticleProjectile.cc
     
    67  Rocket.cc
    78  SimpleRocket.cc
    8   BasicProjectile.cc
    99)
  • code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc

    r8729 r8855  
    2727 */
    2828
     29/**
     30    @file LightningGunProjectile.h
     31    @brief Implementation of the LightningGunProjectile class.
     32*/
     33
    2934#include "LightningGunProjectile.h"
    3035
    31 #include "util/Convert.h"
    3236#include "core/CoreIncludes.h"
    3337#include "core/command/Executor.h"
     38#include "util/Convert.h"
    3439
    3540namespace orxonox
     
    5358    }
    5459
     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    */
    5566    void LightningGunProjectile::setMaterial(const std::string& material)
    5667    {
     
    6071    }
    6172
     73    /**
     74    @brief
     75        Change the texture.
     76    */
    6277    void LightningGunProjectile::changeTexture()
    6378    {
  • code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h

    r5929 r8855  
    2727 */
    2828
     29/**
     30    @file LightningGunProjectile.h
     31    @brief Definition of the LightningGunProjectile class.
     32*/
     33
    2934#ifndef _LightningGunProjectile_H__
    3035#define _LightningGunProjectile_H__
     
    3843namespace orxonox
    3944{
     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    */
    4054    class _WeaponsExport LightningGunProjectile : public BillboardProjectile
    4155    {
     
    4660            virtual void setMaterial(const std::string& material);
    4761
    48         protected:
     62        private:
     63            void registerVariables();
    4964            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.
    5670    };
    5771}
  • code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc

    r5929 r8855  
    2727 */
    2828
     29/**
     30    @file ParticleProjectile.h
     31    @brief Implementation of the ParticleProjectile class.
     32*/
     33
    2934#include "ParticleProjectile.h"
    3035
    3136#include <OgreParticleEmitter.h>
     37#include "core/CoreIncludes.h"
    3238#include "tools/ParticleInterface.h"
    33 #include "core/CoreIncludes.h"
    3439#include "Scene.h"
    3540
     
    4449        if (GameMode::showsGraphics())
    4550        {
     51            // Create the particles.
    4652            this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::Normal);
    4753            this->attachOgreObject(this->particles_->getParticleSystem());
     
    6369    }
    6470
     71    /**
     72    @brief
     73        Is called when the visibility of the ParticleProjectile has changed.
     74    */
    6575    void ParticleProjectile::changedVisibility()
    6676    {
    6777        SUPER(ParticleProjectile, changedVisibility);
    6878
     79        // Change the visibility of the particles.
    6980        if (this->particles_)
    7081            this->particles_->setEnabled(this->isVisible());
  • code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file ParticleProjectile.h
     31    @brief Definition of the ParticleProjectile class.
     32*/
     33
    2934#ifndef _ParticleProjectile_H__
    3035#define _ParticleProjectile_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        A projectile that is represented by particles.
     46    @author
     47        Fabian 'x3n' Landau
     48    @ingroup WeaponsProjectiles
     49    */
    3750    class _WeaponsExport ParticleProjectile : public BillboardProjectile
    3851    {
     
    4356
    4457        private:
    45             ParticleInterface* particles_;
     58            ParticleInterface* particles_; //!< The particles.
    4659    };
    4760}
  • code/trunk/src/modules/weapons/projectiles/Projectile.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file Projectile.h
     31    @brief Implementation of the Projectile class.
     32*/
     33
    2934#include "Projectile.h"
    3035
     36#include "core/ConfigValueIncludes.h"
    3137#include "core/CoreIncludes.h"
    32 #include "core/ConfigValueIncludes.h"
    3338#include "core/GameMode.h"
    3439#include "core/command/Executor.h"
     40
    3541#include "objects/collisionshapes/SphereCollisionShape.h"
    3642#include "worldentities/pawns/Pawn.h"
    37 #include "graphics/ParticleSpawner.h"
    3843
    3944namespace orxonox
     
    4651
    4752        this->setConfigValues();
    48         this->owner_ = 0;
    4953
    5054        // Get notification about collisions
    5155        if (GameMode::isMaster())
    5256        {
    53             this->setMass(1.0);
     57            this->setMass(1.0f);
    5458            this->enableCollisionCallback();
    5559            this->setCollisionResponse(false);
     
    5761
    5862            SphereCollisionShape* shape = new SphereCollisionShape(this);
    59             shape->setRadius(20);
     63            shape->setRadius(20.0f);
    6064            this->attachCollisionShape(shape);
    6165
    62             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Projectile::destroyObject, this)));
     66            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
    6367        }
    6468    }
     
    7074    void Projectile::setConfigValues()
    7175    {
    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");
    7377    }
    7478
     
    8185            return;
    8286
    83         if (this->getBDestroy())
    84             this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
     87        this->destroyCheck();
    8588    }
    8689
    87     void Projectile::destroyObject()
     90    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    8891    {
    89         if (GameMode::isMaster())
    90             this->destroy();
     92        return this->processCollision(otherObject, contactPoint);
    9193    }
    9294
    93     /* Calls the collidesAgainst function of BasicProjectile
    94      */
    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     }
    10495}
  • code/trunk/src/modules/weapons/projectiles/Projectile.h

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file Projectile.h
     31    @brief Definition of the Projectile class.
     32*/
     33
    2934#ifndef _Projectile_H__
    3035#define _Projectile_H__
     
    3944namespace orxonox
    4045{
     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    */
    4157    class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
    4258    {
     
    4662
    4763            void setConfigValues();
    48             void destroyObject();
    4964
    5065            virtual void tick(float dt);
    5166            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5267
    53             void setOwner(Pawn* owner);
    54             inline Pawn* getOwner() const
    55                 { return this->owner_; }
    56 
    57 
    5868        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.
    6271    };
    6372}
  • code/trunk/src/modules/weapons/projectiles/Rocket.cc

    r8738 r8855  
    2727 */
    2828
     29/**
     30    @file Rocket.h
     31    @brief Implementation of the Rocket class.
     32*/
     33
    2934#include "Rocket.h"
    3035
     
    3338#include "core/CoreIncludes.h"
    3439#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"
    3548#include "worldentities/CameraPosition.h"
    3649#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"
    4450
    4551namespace orxonox
    4652{
    4753    CreateFactory(Rocket);
    48     // create the factory for the Rocket
    4954
    5055    /**
     
    5762        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    5863    {
    59         RegisterObject(Rocket);// - register the Rocket class to the core
     64        RegisterObject(Rocket);// Register the Rocket class to the core
    6065
    6166        this->localAngularVelocity_ = 0;
    62         this->lifetime_ = 100;
     67        this->lifetime_ = 100.0f;
    6368
    6469        if (GameMode::isMaster())
     
    6772            this->setVelocity(0,0,-100);
    6873
     74            // Create rocket model
    6975            Model* model = new Model(this);
    7076            model->setMeshSource("rocket.mesh");
    7177            model->scale(0.7f);
    7278            this->attach(model);
     79
     80            // Add effects.
    7381            ParticleEmitter* fire = new ParticleEmitter(this);
    7482            this->attach(fire);
     
    8088            this->setCollisionType(Kinematic);
    8189
     90            // Add collision shape
    8291            ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
    8392            collisionShape->setRadius(3);
     
    8594            this->attachCollisionShape(collisionShape);
    8695
    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
    8999            this->defSndWpnEngine_ = new WorldSound(this);
    90100            this->defSndWpnEngine_->setLooping(true);
     
    105115        }
    106116
     117        // Add camera
    107118        CameraPosition* camPosition = new CameraPosition(this);
    108119        camPosition->setPosition(0,4,15);
     
    141152    /**
    142153    @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);
    156164
    157165        if( GameMode::isMaster() )
     
    179187        }
    180188
    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
    191192    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    192193    {
    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    */
    208213    void Rocket::fired(unsigned int firemode)
    209214    {
    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    */
    213222    void Rocket::destructionEffect()
    214223    {
    215224        ParticleSpawner *effect1, *effect2;
    216         if( this->getOwner() )
    217         {
    218             effect1 = new ParticleSpawner(this->getOwner()->getCreator());
    219             effect2 = new ParticleSpawner(this->getOwner()->getCreator());
     225        if(this->getShooter())
     226        {
     227            effect1 = new ParticleSpawner(this->getShooter()->getCreator());
     228            effect2 = new ParticleSpawner(this->getShooter()->getCreator());
    220229        }
    221230        else
  • code/trunk/src/modules/weapons/projectiles/Rocket.h

    r8738 r8855  
    2727 */
    2828
     29/**
     30    @file Rocket.h
     31    @brief Definition of the Rocket class.
     32*/
     33
    2934#ifndef _Rocket_H__
    3035#define _Rocket_H__
     
    3338
    3439#include "tools/Timer.h"
     40
     41#include "interfaces/RadarViewable.h"
    3542#include "worldentities/ControllableEntity.h"
    36 #include "interfaces/RadarViewable.h"
    3743
    3844#include "BasicProjectile.h"
     
    4450    /**
    4551    @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
    4854    @author
    4955        Oli Scheuss
     56    @ingroup WeaponsProjectiles
    5057    */
    5158    class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable
     
    5562            virtual ~Rocket();
    5663
    57             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
    5864            virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
    5965
    6066            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    61             void destroyObject();
     67            virtual void destroyObject(void);
    6268            void destructionEffect();
    6369
    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) {}
    6773
    6874            virtual void rotateYaw(const Vector2& value);
     
    7581            */
    7682            inline void moveFrontBack(float value)
    77             { this->moveFrontBack(Vector2(value, 0)); }
     83                { this->moveFrontBack(Vector2(value, 0)); }
    7884            /**
    7985            @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
     
    8187            */
    8288            inline void moveRightLeft(float value)
    83             { this->moveRightLeft(Vector2(value, 0)); }
     89                { this->moveRightLeft(Vector2(value, 0)); }
    8490            /**
    8591            @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
     
    8793            */
    8894            inline void moveUpDown(float value)
    89             { this->moveUpDown(Vector2(value, 0)); }
     95                { this->moveUpDown(Vector2(value, 0)); }
    9096
    9197            /**
     
    94100            */
    95101            inline void rotateYaw(float value)
    96             { this->rotateYaw(Vector2(value, 0)); }
     102                { this->rotateYaw(Vector2(value, 0)); }
    97103            /**
    98104            @brief Rotates the Rocket around the x-axis by the specifed amount.
     
    100106            */
    101107            inline void rotatePitch(float value)
    102             { this->rotatePitch(Vector2(value, 0)); }
     108                { this->rotatePitch(Vector2(value, 0)); }
    103109            /**
    104110            @brief Rotates the Rocket around the z-axis by the specifed amount.
     
    106112            */
    107113            inline void rotateRoll(float value)
    108             { this->rotateRoll(Vector2(value, 0)); }
     114                { this->rotateRoll(Vector2(value, 0)); }
    109115
    110             void setOwner(Pawn* owner);
    111             inline Pawn* getOwner() const
    112                 { return this->owner_; }
     116            virtual void setShooter(Pawn* shooter);
    113117
    114118            virtual void fired(unsigned int firemode);
    115119
    116120        private:
    117             WeakPtr<Pawn> owner_;
    118             Vector3 localAngularVelocity_;
     121            Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
    119122
    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.
    123126
    124             WorldSound* defSndWpnEngine_;
    125             WorldSound* defSndWpnLaunch_;
     127            WorldSound* defSndWpnEngine_; //!< Engine sound.
     128            WorldSound* defSndWpnLaunch_; //!< Launch sound.
    126129    };
    127130
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc

    r8738 r8855  
    2121 *
    2222 *   Author:
    23  *      Oliver Scheuss
     23 *      Gabriel Nadler
    2424 *   Co-authors:
    2525 *      simonmie
     
    2727 */
    2828
     29/**
     30    @file SimpleRocket.h
     31    @brief Implementation of the SimpleRocket class.
     32*/
     33
     34
    2935#include "SimpleRocket.h"
    3036
     
    3339#include "core/CoreIncludes.h"
    3440#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"
    3548#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
    4151#include "weapons/RocketController.h"
    42 #include "sound/WorldSound.h"
    43 #include "util/Debug.h"
    4452
    4553namespace orxonox
     
    5361        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    5462    {
    55         RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
     63        RegisterObject(SimpleRocket);// Register the SimpleRocket class to the core
    5664
    5765        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);
    6269
    6370        if (GameMode::isMaster())
    6471        {
    6572            this->setCollisionType(WorldEntity::Kinematic);
    66             this->fuel_=true;
    67 
     73            this->fuel_ = true;
     74
     75            // Create rocket model.
    6876            Model* model = new Model(this);
    6977            model->setMeshSource("rocket.mesh");
     
    7179            this->attach(model);
    7280
     81            // Add effects.
    7382            this->fire_ = new ParticleEmitter(this);
    7483            this->attach(this->fire_);
     
    8089            this->setCollisionType(Kinematic);
    8190
     91            // Add collision shape.
    8292            // TODO: fix the orientation and size of this collision shape to match the rocket
    8393            ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
     
    8696            collisionShape->setHeight(5);
    8797            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)));
    89100        }
    90101
     
    97108
    98109    /**
    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
    101114    */
    102115    void SimpleRocket::tick(float dt)
    103116    {
    104 
    105117        SUPER(SimpleRocket, tick, dt);
    106         if ( GameMode::isMaster() )
     118       
     119        if (GameMode::isMaster())
    107120        {
    108 
    109 
    110121            this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
    111122            this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
    112123            this->localAngularVelocity_ = 0;
    113124
    114 
    115125            if (this->fuel_)
    116126            {
    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;
    119129            } else
    120130                this->disableFire();
    121 
    122             if( this->getBDestroy() )
    123                 this->destroy();
    124131        }
    125132
    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.
    131139    */
    132140    void SimpleRocket::disableFire()
     
    136144    }
    137145
    138     /**s
     146    /**
    139147    @brief
    140148        Destructor. Destroys controller, if present and kills sounds, if playing.
     
    153161    /**
    154162    @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
    172174    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    173175    {
    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);
    183177    }
    184178
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.h

    r8738 r8855  
    2121 *
    2222 *   Author:
    23  *      Oliver Scheuss
     23 *      Gabriel Nadler
    2424 *   Co-authors:
    2525 *      simonmie
    2626 *
    2727 */
     28
     29/**
     30    @file SimpleRocket.h
     31    @brief Definition of the SimpleRocket class.
     32*/
    2833
    2934#ifndef _SimpleRocket_H__
     
    3338
    3439#include "tools/Timer.h"
    35 #include "worldentities/ControllableEntity.h"
     40
    3641#include "graphics/ParticleSpawner.h"
    3742#include "interfaces/RadarViewable.h"
     43#include "worldentities/ControllableEntity.h"
    3844
    3945#include "BasicProjectile.h"
     
    4551    /**
    4652    @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.
    4855    @author
    49        Gabriel Nadler (Original file: Oli Scheuss)
     56       Gabriel Nadler
     57    @ingroup WeaponsProjectiles
    5058    */
    5159    class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable
     
    5563            virtual ~SimpleRocket();
    5664            virtual void tick(float dt);
    57             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.
    5865
    5966            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    60             void destroyObject();
    6167
    6268            void disableFire(); //!< Method to disable the fire and stop all acceleration
     
    7682            */
    7783            inline void moveFrontBack(float value)
    78             { this->moveFrontBack(Vector2(value, 0)); }
     84                { this->moveFrontBack(Vector2(value, 0)); }
    7985            /**
    8086            @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount.
     
    8288            */
    8389            inline void moveRightLeft(float value)
    84             { this->moveRightLeft(Vector2(value, 0)); }
     90                { this->moveRightLeft(Vector2(value, 0)); }
    8591            /**
    8692            @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount.
     
    8894            */
    8995            inline void moveUpDown(float value)
    90             { this->moveUpDown(Vector2(value, 0)); }
     96                { this->moveUpDown(Vector2(value, 0)); }
    9197
    9298            /**
     
    95101            */
    96102            inline void rotateYaw(float value)
    97             { this->rotateYaw(Vector2(value, 0)); }
     103                { this->rotateYaw(Vector2(value, 0)); }
    98104            /**
    99105            @brief Rotates the SimpleRocket around the x-axis by the specifed amount.
     
    101107            */
    102108            inline void rotatePitch(float value)
    103             {
    104                 this->rotatePitch(Vector2(value, 0)); }
     109                { this->rotatePitch(Vector2(value, 0)); }
    105110            /**
    106111            @brief Rotates the SimpleRocket around the z-axis by the specifed amount.
     
    108113            */
    109114            inline void rotateRoll(float value)
    110             {
    111                 this->rotateRoll(Vector2(value, 0)); }
     115                { this->rotateRoll(Vector2(value, 0)); }
    112116
    113             void setOwner(Pawn* owner);
    114             inline Pawn* getOwner() const
    115                 { return this->owner_; }
     117            virtual void setShooter(Pawn* shooter);
    116118
    117119            inline bool hasFuel() const
    118             { return this->fuel_; }
     120                { return this->fuel_; }
    119121
    120122
    121123        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.
    124127            bool fuel_; //!< Bool is true while the rocket "has fuel"
    125128
    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.
    131132
    132133            ParticleEmitter* fire_; //!< Fire-Emittor
    133 
    134 
    135 
    136134    };
    137135
  • code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file EnergyDrink.h
     31    @brief Implementation of the EnergyDrink class.
     32*/
     33
    2934#include "EnergyDrink.h"
    3035
     
    3237#include "core/XMLPort.h"
    3338#include "core/command/Executor.h"
     39
    3440#include "graphics/Model.h"
    35 
    36 #include "weapons/projectiles/Projectile.h"
    37 #include "weapons/MuzzleFlash.h"
    3841#include "weaponsystem/Weapon.h"
    3942#include "weaponsystem/WeaponPack.h"
    4043#include "weaponsystem/WeaponSystem.h"
    4144#include "worldentities/pawns/Pawn.h"
     45
     46#include "weapons/projectiles/Projectile.h"
     47#include "weapons/MuzzleFlash.h"
    4248
    4349namespace orxonox
     
    4955        RegisterObject(EnergyDrink);
    5056
    51         this->reloadTime_ = 0.25;
    52         this->damage_ = 0; //default 15
    53         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;
    5561        this->setMunitionName("FusionMunition");
    5662
     
    6571        XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
    6672        XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
    67 
    6873    }
    6974
    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)
    7182    {
    72         this->material_ = material;
    73     }
    74 
    75     void EnergyDrink::setDelay(float d)
    76     {
    77         this->delay_ = d;
     83        this->delay_ = delay;
    7884        this->delayTimer_.setInterval(this->delay_);
    7985    }
    8086
    81     float EnergyDrink::getDelay() const
    82     {
    83         return this->delay_;
    84     }
    85 
     87    /**
     88    @brief
     89        Fires the weapon.
     90    */
    8691    void EnergyDrink::fire()
    8792    {
     
    8994    }
    9095
    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    */
    101100    void EnergyDrink::shot()
    102101    {
     102        // Create the projectile
    103103        Projectile* projectile = new Projectile(this);
    104104        Model* model = new Model(projectile);
     
    112112        projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    113113
    114         projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     114        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    115115        projectile->setDamage(this->getDamage());
    116116        projectile->setShieldDamage(this->getShieldDamage());
    117117        projectile->setHealthDamage(this->getHealthDamage());
    118118
    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_);
    120133    }
    121134}
  • code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h

    r5929 r8855  
    2727 */
    2828
     29/**
     30    @file EnergyDrink.h
     31    @brief Definition of the EnergyDrink class.
     32*/
     33
    2934#ifndef _EnergyDrink_H__
    3035#define _EnergyDrink_H__
     
    3843namespace orxonox
    3944{
     45
     46    /**
     47    @brief
     48        Shoots a can.
     49    @author
     50        Hagen Seifert
     51    @ingroup WeaponsWeaponModes
     52    */
    4053    class _WeaponsExport EnergyDrink : public WeaponMode
    4154    {
     
    4861
    4962        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
    5274                { 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
    5584            void shot();
    56             void muendungsfeuer();
     85            void muzzleflash();
    5786
    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.
    6291    };
    6392}
  • code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file FusionFire.h
     31    @brief Implementation of the FusionFire class.
     32*/
     33
    2934#include "FusionFire.h"
    3035
     36#include "core/CoreIncludes.h"
    3137#include "util/Math.h"
    32 #include "core/CoreIncludes.h"
    33 #include "weapons/projectiles/BillboardProjectile.h"
    3438
    3539#include "weaponsystem/Weapon.h"
     
    3741#include "weaponsystem/WeaponSystem.h"
    3842#include "worldentities/pawns/Pawn.h"
     43
     44#include "weapons/projectiles/BillboardProjectile.h"
    3945
    4046namespace orxonox
     
    4652        RegisterObject(FusionFire);
    4753
    48         this->reloadTime_ = 1.0;
     54        this->reloadTime_ = 1.0f;
    4955        this->bParallelReload_ = false;
    50         this->damage_ = 0; //default 40
    51         this->speed_ = 1250;
     56        this->damage_ = 0.0f;
     57        this->speed_ = 1250.0f;
    5258
    5359        this->setMunitionName("FusionMunition");
    5460    }
    5561
    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    */
    5866    void FusionFire::fire()
    5967    {
     
    6573        projectile->scale(5);
    6674
    67         projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     75        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    6876        projectile->setDamage(this->getDamage());
    6977        projectile->setShieldDamage(this->getShieldDamage());
  • code/trunk/src/modules/weapons/weaponmodes/FusionFire.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file FusionFire.h
     31    @brief Definition of the FusionFire class.
     32*/
     33
    2934#ifndef _FusionFire_H__
    3035#define _FusionFire_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        FusionFire.
     46    @author
     47        Martin Polak
     48    @ingroup WeaponsWeaponModes
     49    */
    3750    class _WeaponsExport FusionFire : public WeaponMode
    3851    {
     
    4457
    4558        private:
    46             float speed_;
     59            float speed_; //!< The speed of the fusion fire weapon.
    4760    };
    4861}
  • code/trunk/src/modules/weapons/weaponmodes/HsW01.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file HsW01.h
     31    @brief Implementation of the HsW01 class.
     32*/
     33
    2934#include "HsW01.h"
    3035
     
    3237#include "core/XMLPort.h"
    3338#include "core/command/Executor.h"
     39
    3440#include "graphics/Model.h"
    35 
    36 #include "weapons/projectiles/Projectile.h"
    37 #include "weapons/MuzzleFlash.h"
    3841#include "weaponsystem/Weapon.h"
    3942#include "weaponsystem/WeaponPack.h"
     
    4144#include "worldentities/WorldEntity.h"
    4245#include "worldentities/pawns/Pawn.h"
     46
     47#include "weapons/projectiles/Projectile.h"
     48#include "weapons/MuzzleFlash.h"
    4349
    4450namespace orxonox
     
    5056        RegisterObject(HsW01);
    5157
    52         this->reloadTime_ = 0.25;
    53         this->damage_ = 0; //default 15
    54         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;
    5662        this->setMunitionName("LaserMunition");
    5763
     
    7278        XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
    7379        XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
    74 
    7580    }
    7681
    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)
    7889    {
    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;
    9091        this->delayTimer_.setInterval(this->delay_);
    91     }
    92 
    93     float HsW01::getDelay() const
    94     {
    95         return this->delay_;
    9692    }
    9793
     
    10197    }
    10298
    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    */
    113103    void HsW01::shot()
    114104    {
    115105        assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
     106
     107        // Create the projectile.
    116108        Projectile* projectile = new Projectile(this);
    117109        Model* model = new Model(projectile);
     
    126118        projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    127119
    128         projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     120        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    129121        projectile->setDamage(this->getDamage());
    130122        projectile->setShieldDamage(this->getShieldDamage());
    131123        projectile->setHealthDamage(this->getHealthDamage());
    132124
    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_);
    134139    }
    135140}
  • code/trunk/src/modules/weapons/weaponmodes/HsW01.h

    r6417 r8855  
    2727 */
    2828
     29/**
     30    @file HsW01.h
     31    @brief Definition of the HsW01 class.
     32*/
     33
    2934#ifndef _HsW01_H__
    3035#define _HsW01_H__
     
    3742namespace orxonox
    3843{
     44
     45    /**
     46    @brief
     47        Shoots laser beams.
     48    @author
     49        Hagen Seifert
     50    @ingroup WeaponsWeaponModes
     51    */
    3952    class _WeaponsExport HsW01 : public WeaponMode
    4053    {
     
    4760
    4861        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
    5383            void shot();
    54             void muendungsfeuer();
     84            void muzzleflash();
    5585
    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.
    6090    };
    6191}
  • code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file LaserFire.h
     31    @brief Implementation of the LaserFire class.
     32*/
     33
    2934#include "LaserFire.h"
    3035
    3136#include "core/CoreIncludes.h"
    32 #include "weapons/projectiles/ParticleProjectile.h"
     37
    3338#include "weaponsystem/Weapon.h"
    3439#include "weaponsystem/WeaponPack.h"
    3540#include "weaponsystem/WeaponSystem.h"
    3641#include "worldentities/pawns/Pawn.h"
     42
     43#include "weapons/projectiles/ParticleProjectile.h"
    3744
    3845namespace orxonox
     
    4451        RegisterObject(LaserFire);
    4552
    46         this->reloadTime_ = 0.25;
    47         this->damage_ = 0; //default 15
    48         this->speed_ = 1250;
     53        this->reloadTime_ = 0.25f;
     54        this->damage_ = 0.0f;
     55        this->speed_ = 1250.0f;
    4956
    5057        this->setMunitionName("LaserMunition");
    5158    }
    5259
    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    */
    5564    void LaserFire::fire()
    5665    {
     
    6170        projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    6271
    63         projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     72        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    6473        projectile->setDamage(this->getDamage());
    6574        projectile->setShieldDamage(this->getShieldDamage());
  • code/trunk/src/modules/weapons/weaponmodes/LaserFire.h

    r5781 r8855  
    2727 */
    2828
     29/**
     30    @file LaserFire.h
     31    @brief Definition of the LaserFire class.
     32*/
     33
    2934#ifndef _LaserFire_H__
    3035#define _LaserFire_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        Shoots a particle laser.
     46    @author
     47        Martin Polak
     48    @ingroup WeaponsWeaponModes
     49    */
    3750    class _WeaponsExport LaserFire : public WeaponMode
    3851    {
     
    4457
    4558        private:
    46             float speed_;
     59            float speed_; //!< The speed of the fired projectile.
    4760    };
    4861}
  • code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file LightningGun.h
     31    @brief Implementation of the LightningGun class.
     32*/
     33
    2934#include "LightningGun.h"
    3035
    3136#include "core/CoreIncludes.h"
    32 #include "weapons/projectiles/LightningGunProjectile.h"
    3337#include "weaponsystem/Weapon.h"
    3438#include "weaponsystem/WeaponPack.h"
    3539#include "weaponsystem/WeaponSystem.h"
    3640#include "worldentities/pawns/Pawn.h"
     41
     42#include "weapons/projectiles/LightningGunProjectile.h"
    3743
    3844namespace orxonox
     
    4450        RegisterObject(LightningGun);
    4551
    46         this->reloadTime_ = 1;
    47         this->damage_ = 0; //default 100
    48         this->speed_ = 150;
     52        this->reloadTime_ = 1.0f;
     53        this->damage_ = 0.0f;
     54        this->speed_ = 250.0f;
    4955
    5056        this->setMunitionName("LaserMunition");
     
    5662    }
    5763
    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    */
    6068    void LightningGun::fire()
    6169    {
     
    6775        projectile->setPosition(this->getMuzzlePosition());
    6876        projectile->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    69         projectile->setAcceleration(this->getMuzzleDirection() * 1000);
    7077
    71         projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     78        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7279        projectile->setDamage(this->getDamage());
    7380        projectile->setShieldDamage(this->getShieldDamage());
  • code/trunk/src/modules/weapons/weaponmodes/LightningGun.h

    r6417 r8855  
    2727 */
    2828
     29/**
     30    @file LightningGun.h
     31    @brief Definition of the LightningGun class.
     32*/
     33
    2934#ifndef _LightningGun_H__
    3035#define _LightningGun_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        A slow ball of lightning.
     46    @author
     47        Joel Smely
     48    @ingroup WeaponsWeaponModes
     49    */
    3750    class _WeaponsExport LightningGun : public WeaponMode
    3851    {
     
    4457
    4558       private:
    46             float speed_;
     59            float speed_; //!< The speed of the fired projectile.
    4760    };
    4861}
  • code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file RocketFire.h
     31    @brief Implementation of the RocketFire class.
     32*/
     33
    2934#include "RocketFire.h"
    3035
     36#include "core/CoreIncludes.h"
    3137#include "util/Math.h"
    32 #include "core/CoreIncludes.h"
    33 #include "weapons/projectiles/Rocket.h"
    3438
    3539#include "weaponsystem/Weapon.h"
     
    3741#include "weaponsystem/WeaponSystem.h"
    3842#include "worldentities/pawns/Pawn.h"
     43
     44#include "weapons/projectiles/Rocket.h"
    3945
    4046namespace orxonox
     
    4854        this->reloadTime_ = 0.20f;
    4955        this->bParallelReload_ = false;
    50         this->damage_ = 0;
    51         this->speed_ = 500;
     56        this->damage_ = 0.0f;
     57        this->speed_ = 500.0f;
    5258
    5359        this->setMunitionName("RocketMunition");
     
    5965    }
    6066
    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    */
    6371    void RocketFire::fire()
    6472    {
     
    7179        rocket->scale(2);
    7280
    73         rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     81        rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7482        rocket->setDamage(this->getDamage());
    7583        rocket->setShieldDamage(this->getShieldDamage());
  • code/trunk/src/modules/weapons/weaponmodes/RocketFire.h

    r6417 r8855  
    2727 */
    2828
     29/**
     30    @file RocketFire.h
     31    @brief Definition of the RocketFire class.
     32*/
     33
    2934#ifndef _RocketFire_H__
    3035#define _RocketFire_H__
     
    3540namespace orxonox
    3641{
     42
     43    /**
     44    @brief
     45        Fires the (steerable) Rocket.
     46    @author
     47        Oliver Scheuss
     48    @ingroup WeaponsWeaponModes
     49    */
    3750    class _WeaponsExport RocketFire : public WeaponMode
    3851    {
     
    4457
    4558        private:
    46             float speed_;
     59            float speed_; //!< The speed of the Rocket.
    4760    };
    4861}
  • code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r8706 r8855  
    2121 *
    2222 *   Author:
     23 *      Gabriel Nadler
     24 *   Co-authors:
    2325 *      Oliver Scheuss
    24  *   Co-authors:
    2526 *      simonmie
    2627 *
    2728 */
    2829
     30/**
     31    @file BasicProjectile.h
     32    @brief Implementation of the BasicProjectile class.
     33*/
     34
    2935#include "SimpleRocketFire.h"
    3036
     37#include "core/CoreIncludes.h"
    3138#include "util/Math.h"
    32 #include "core/CoreIncludes.h"
    33 #include "weapons/RocketController.h"
    3439
    3540#include "weaponsystem/Weapon.h"
     
    3843#include "worldentities/pawns/Pawn.h"
    3944#include "sound/WorldSound.h"
     45
     46#include "weapons/RocketController.h"
     47#include "weapons/projectiles/SimpleRocket.h"
    4048
    4149namespace orxonox
     
    4856        RegisterObject(SimpleRocketFire);
    4957
    50         this->reloadTime_ = 1;
     58        this->reloadTime_ = 1.0f;
    5159        this->bParallelReload_ = false;
    52         this->damage_ = 0;
    53         this->speed_ = 500;
     60        this->damage_ = 0.0f;
     61        this->speed_ = 500.0f;
    5462
    5563        this->setMunitionName("RocketMunition");
     
    6270    }
    6371
    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    */
    6676    void SimpleRocketFire::fire()
    6777    {
    68         RocketController* con = new RocketController(this);
    69         SimpleRocket* rocket = con->getRocket();
     78        RocketController* controller = new RocketController(this);
     79        SimpleRocket* rocket = controller->getRocket();
    7080        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    7181        rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation());
    7282        rocket->setPosition(this->getMuzzlePosition());
    7383        rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    74         rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     84        rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7585
    7686        rocket->setDamage(this->damage_);
     
    7888        rocket->setHealthDamage(this->getHealthDamage());
    7989
    80         WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
    81         if (pawnn) con->setTarget(pawnn);
     90        WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
     91        if (pawn) controller->setTarget(pawn);
    8292    }
    8393}
  • code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h

    r7163 r8855  
    2121 *
    2222 *   Author:
     23 *      Gabriel Nadler
     24 *   Co-authors:
    2325 *      Oliver Scheuss
    24  *   Co-authors:
    25  *      ...
    2626 *
    2727 */
     28
     29/**
     30    @file SimpleRocketFire.h
     31    @brief Definition of the SimpleRocketFire class.
     32*/
    2833
    2934#ifndef _SimpleRocketFire_H__
     
    3944        FireMode for target-seeking Rocket
    4045    @author
    41         Gabriel Nadler (Original file: Oli Scheuss)
     46        Gabriel Nadler
     47    @ingroup WeaponsWeaponModes
    4248    */
    4349    class _WeaponsExport SimpleRocketFire : public WeaponMode
     
    5056
    5157        private:
    52             float speed_;
     58            float speed_; //!< The speed of the SimpleRocket.
    5359
    5460    };
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r8706 r8855  
    4747#include "weaponsystem/WeaponSet.h"
    4848
    49 
    5049namespace orxonox
    5150{
     
    256255
    257256*/
    258 
    259257    void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
    260258    {
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r8706 r8855  
    7575
    7676            inline float getShieldHealth()
    77             { return this->shieldHealth_; }
     77                { return this->shieldHealth_; }
    7878
    7979            inline void addShieldHealth(float amount)
    80             { this->setShieldHealth(this->shieldHealth_ + amount); }
     80                { this->setShieldHealth(this->shieldHealth_ + amount); }
    8181
    8282            inline bool hasShield()
    83             { return (this->getShieldHealth() > 0); }
     83                { return (this->getShieldHealth() > 0); }
    8484
    8585            virtual void setMaxShieldHealth(float maxshieldhealth);
     
    9898
    9999            inline void setShieldAbsorption(float shieldAbsorption)
    100             { this->shieldAbsorption_ = shieldAbsorption; }
     100                { this->shieldAbsorption_ = shieldAbsorption; }
    101101            inline float getShieldAbsorption()
    102             { return this->shieldAbsorption_; }
     102                { return this->shieldAbsorption_; }
    103103
    104104            // TODO: Rename to shieldRechargeRate
     
    112112
    113113            inline void resetReloadCountdown()
    114             { this->reloadWaitCountdown_ = 0; }
     114                { this->reloadWaitCountdown_ = 0; }
    115115
    116116            inline void startReloadCountdown()
    117             { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
     117                { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
    118118
    119119            virtual void decreaseReloadCountdownTime(float dt);
Note: See TracChangeset for help on using the changeset viewer.