Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Cleaning up game immersion. Roughly documenting weapons module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.