Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2011, 9:41:29 PM (13 years ago)
Author:
dafrick
Message:

Merging game immersion branch into presentation branch.

Location:
code/branches/presentation
Files:
15 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/modules/weapons/projectiles/CMakeLists.txt

    r8579 r8580  
    66  Rocket.cc
    77  SimpleRocket.cc
     8  BasicProjectile.cc
    89)
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.cc

    r8579 r8580  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4141    CreateFactory(Projectile);
    4242
    43     Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
     43    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
    4444    {
    4545        RegisterObject(Projectile);
    4646
    4747        this->setConfigValues();
    48         this->bDestroy_ = false;
    4948        this->owner_ = 0;
    50         this->damage_ = 15;
    5149
    5250        // Get notification about collisions
    53 
    5451        if (GameMode::isMaster())
    5552        {
     
    8481            return;
    8582
    86         if (this->bDestroy_)
     83        if (this->getBDestroy())
    8784            this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
    8885    }
     
    9491    }
    9592
     93    /* Calls the collidesAgainst function of BasicProjectile
     94     */
    9695    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    9796    {
    98         if (!this->bDestroy_ && GameMode::isMaster())
    99         {
    100             if (otherObject == this->owner_)
    101                 return false;
    102 
    103             this->bDestroy_ = true;
    104 
    105             if (this->owner_)
    106             {
    107                 {
    108                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    109                     effect->setPosition(this->getPosition());
    110                     effect->setOrientation(this->getOrientation());
    111                     effect->setDestroyAfterLife(true);
    112                     effect->setSource("Orxonox/explosion3");
    113                     effect->setLifetime(2.0f);
    114                 }
    115                 {
    116                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    117                     effect->setPosition(this->getPosition());
    118                     effect->setOrientation(this->getOrientation());
    119                     effect->setDestroyAfterLife(true);
    120                     effect->setSource("Orxonox/smoke4");
    121                     effect->setLifetime(3.0f);
    122                 }
    123             }
    124 
    125             Pawn* victim = orxonox_cast<Pawn*>(otherObject);
    126             if (victim)
    127                 victim->hit(this->owner_, contactPoint, this->damage_);
    128         }
    129         return false;
     97        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    13098    }
    13199
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.h

    r8579 r8580  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    3535#include "worldentities/MovableEntity.h"
    3636
     37#include "BasicProjectile.h"
     38
    3739namespace orxonox
    3840{
    39     class _WeaponsExport Projectile : public MovableEntity
     41    class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
    4042    {
    4143        public:
     
    4951            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5052
    51             inline void setDamage(float damage)
    52                 { this->damage_ = damage; }
    53             inline float getDamage() const
    54                 { return this->damage_; }
    55 
    5653            void setOwner(Pawn* owner);
    5754            inline Pawn* getOwner() const
    5855                { return this->owner_; }
    5956
     57
    6058        private:
    6159            WeakPtr<Pawn> owner_;
    6260            float lifetime_;
    63             float damage_;
    64             bool bDestroy_;
    6561            Timer destroyTimer_;
    6662    };
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.cc

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5252        Constructor. Registers the object and initializes some default values.
    5353    */
    54     Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
     54    Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
    5555    {
    5656        RegisterObject(Rocket);// - register the Rocket class to the core
    5757
    5858        this->localAngularVelocity_ = 0;
    59         this->bDestroy_ = false;
    6059        this->lifetime_ = 100;
    6160
     
    146145    {
    147146        this->owner_ = owner;
    148         this->player_ = this->owner_->getPlayer();
    149         this->owner_->getPlayer()->startTemporaryControl(this);
     147        this->player_ = this->getOwner()->getPlayer();
     148        this->getOwner()->getPlayer()->startTemporaryControl(this);
    150149
    151150        if( GameMode::isMaster() )
     
    175174        if( GameMode::isMaster() )
    176175        {
    177             if( this->bDestroy_ )
     176            if( this->getBDestroy() )
    178177                this->destroy();
    179178
     
    181180    }
    182181
     182    /* Calls the collidesAgainst function of BasicProjectile
     183     */
    183184    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    184185    {
    185         if (!this->bDestroy_ && GameMode::isMaster())
    186         {
    187             if (otherObject == this->owner_)
    188                 return false;
    189 
    190             this->bDestroy_ = true;
    191 
    192             if (this->owner_)
    193             {
    194                 {
    195                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    196                     effect->setPosition(this->getPosition());
    197                     effect->setOrientation(this->getOrientation());
    198                     effect->setDestroyAfterLife(true);
    199                     effect->setSource("Orxonox/explosion4");
    200                     effect->setLifetime(2.0f);
    201                 }
    202 
    203                 {
    204                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    205                     effect->setPosition(this->getPosition());
    206                     effect->setOrientation(this->getOrientation());
    207                     effect->setDestroyAfterLife(true);
    208                     effect->setSource("Orxonox/smoke4");
    209                     effect->setLifetime(3.0f);
    210                 }
    211             }
    212 
    213             Pawn* victim = orxonox_cast<Pawn*>(otherObject);
    214             if (victim)
    215                 victim->hit(this->owner_, contactPoint, this->damage_);
    216 //             this->destroy();
    217         }
    218         return false;
     186        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    219187    }
    220188
     
    233201    void Rocket::fired(unsigned int firemode)
    234202    {
    235 //         if (this->owner_)
    236 //         {
    237             this->destroy();
    238 //         }
     203        this->destroy();
    239204    }
    240205
     
    242207    {
    243208        ParticleSpawner *effect1, *effect2;
    244         if( this->owner_ )
    245         {
    246             effect1 = new ParticleSpawner(this->owner_->getCreator());
    247             effect2 = new ParticleSpawner(this->owner_->getCreator());
     209        if( this->getOwner() )
     210        {
     211            effect1 = new ParticleSpawner(this->getOwner()->getCreator());
     212            effect2 = new ParticleSpawner(this->getOwner()->getCreator());
    248213        }
    249214        else
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.h

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    3434#include "tools/Timer.h"
    3535#include "worldentities/ControllableEntity.h"
     36
     37#include "BasicProjectile.h"
    3638
    3739namespace orxonox
     
    4648        Oli Scheuss
    4749    */
    48     class _WeaponsExport Rocket : public ControllableEntity
     50    class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile
    4951    {
    5052        public:
     
    109111                { return this->owner_; }
    110112
    111             inline void setDamage(float damage)
    112                 { this->damage_ = damage; }
    113             inline float getDamage() const
    114                 { return this->damage_; }
    115113            virtual void fired(unsigned int firemode);
    116114
     
    118116            WeakPtr<Pawn> owner_;
    119117            Vector3 localAngularVelocity_;
    120             float damage_;
    121             bool bDestroy_;
    122118
    123119            WeakPtr<PlayerInfo> player_;
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.cc

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4848    CreateFactory(SimpleRocket);
    4949
    50     SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator)
     50    SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
    5151    {
    5252        RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
    5353
    5454        this->localAngularVelocity_ = 0;
    55         this->bDestroy_ = false;
    5655        this->lifetime_ = 120;
    5756
    5857        this->setMass(15);
    59         COUT(4) << "simplerocket constructed\n";
     58//        COUT(4) << "simplerocket constructed\n";
    6059
    6160        if (GameMode::isMaster())
     
    115114                this->disableFire();
    116115
    117             if( this->bDestroy_ )
     116            if( this->getBDestroy() )
    118117                this->destroy();
    119118        }
     
    159158    {
    160159        this->owner_ = owner;
    161         this->player_ = this->owner_->getPlayer();
    162     }
    163 
    164 
    165 
    166 
     160        this->player_ = this->getOwner()->getPlayer();
     161    }
     162
     163
     164    /* Calls the collidesAgainst function of BasicProjectile
     165     */
    167166    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    168167    {
    169         if (!this->bDestroy_ && GameMode::isMaster())
    170         {
    171             if (otherObject == this->owner_)
    172                 return false;
    173 
    174             this->bDestroy_ = true;
    175 
    176             if (this->owner_)
    177             {
    178                 {
    179                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    180                     effect->setPosition(this->getPosition());
    181                     effect->setOrientation(this->getOrientation());
    182                     effect->setDestroyAfterLife(true);
    183                     effect->setSource("Orxonox/explosion4");
    184                     effect->setLifetime(2.0f);
    185                 }
    186 
    187                 {
    188                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    189                     effect->setPosition(this->getPosition());
    190                     effect->setOrientation(this->getOrientation());
    191                     effect->setDestroyAfterLife(true);
    192                     effect->setSource("Orxonox/smoke4");
    193                     effect->setLifetime(3.0f);
    194                 }
    195             }
    196 
    197             float dmg = this->damage_;
    198 //             if (this->owner_)
    199 //                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
    200 
    201             Pawn* victim = orxonox_cast<Pawn*>(otherObject);
    202             if (victim)
    203                 victim->hit(this->owner_, contactPoint, dmg);
    204         }
    205         return false;
     168        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    206169    }
    207170
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.h

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    3636#include "graphics/ParticleSpawner.h"
    3737
     38#include "BasicProjectile.h"
     39
    3840namespace orxonox
    3941{
     
    4648       Gabriel Nadler (Original file: Oli Scheuss)
    4749    */
    48     class _WeaponsExport SimpleRocket : public ControllableEntity
     50    class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile
    4951    {
    5052        public:
     
    111113            inline Pawn* getOwner() const
    112114                { return this->owner_; }
     115
    113116            inline bool hasFuel() const
    114117            { return this->fuel_; }
    115 
    116             inline void setDamage(float damage)
    117                 { this->damage_ = damage; }
    118             inline float getDamage() const
    119                 { return this->damage_; }
    120118
    121119
     
    123121            WeakPtr<Pawn> owner_;
    124122            Vector3 localAngularVelocity_;
    125             float damage_;
    126             bool bDestroy_;
    127123            bool fuel_; //!< Bool is true while the rocket "has fuel"
    128124
  • code/branches/presentation/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r8579 r8580  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5050
    5151        this->reloadTime_ = 0.25;
    52         this->damage_ = 15;
     52        this->damage_ = 0; //default 15
    5353        this->speed_ = 2500;
    5454        this->delay_ = 0;
     
    9797    }
    9898
     99    /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer()
     100     */
    99101    void EnergyDrink::shot()
    100102    {
     
    112114        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    113115        projectile->setDamage(this->getDamage());
     116        projectile->setShieldDamage(this->getShieldDamage());
     117        projectile->setHealthDamage(this->getHealthDamage());
    114118
    115119        EnergyDrink::muendungsfeuer();
  • code/branches/presentation/src/modules/weapons/weaponmodes/FusionFire.cc

    r8579 r8580  
    2323 *      Martin Polak
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4848        this->reloadTime_ = 1.0;
    4949        this->bParallelReload_ = false;
    50         this->damage_ = 40;
     50        this->damage_ = 0; //default 40
    5151        this->speed_ = 1250;
    5252
     
    5454    }
    5555
     56    /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties
     57     */
    5658    void FusionFire::fire()
    5759    {
     
    6567        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    6668        projectile->setDamage(this->getDamage());
     69        projectile->setShieldDamage(this->getShieldDamage());
     70        projectile->setHealthDamage(this->getHealthDamage());
     71
    6772        projectile->setColour(ColourValue(1.0f, 0.7f, 0.3f, 1.0f));
    6873    }
  • code/branches/presentation/src/modules/weapons/weaponmodes/HsW01.cc

    r8579 r8580  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5151
    5252        this->reloadTime_ = 0.25;
    53         this->damage_ = 15;
     53        this->damage_ = 0; //default 15
    5454        this->speed_ = 2500;
    5555        this->delay_ = 0;
     
    109109    }
    110110
     111    /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer()
     112     */
    111113    void HsW01::shot()
    112114    {
     
    126128        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    127129        projectile->setDamage(this->getDamage());
     130        projectile->setShieldDamage(this->getShieldDamage());
     131        projectile->setHealthDamage(this->getHealthDamage());
    128132
    129133        HsW01::muendungsfeuer();
  • code/branches/presentation/src/modules/weapons/weaponmodes/LaserFire.cc

    r8579 r8580  
    2323 *      Martin Polak
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4545
    4646        this->reloadTime_ = 0.25;
    47         this->damage_ = 15;
     47        this->damage_ = 0; //default 15
    4848        this->speed_ = 1250;
    4949
     
    5151    }
    5252
     53    /* Creates the projectile object, sets its properties to the LaserFire properties
     54     */
    5355    void LaserFire::fire()
    5456    {
     
    6163        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    6264        projectile->setDamage(this->getDamage());
     65        projectile->setShieldDamage(this->getShieldDamage());
     66        projectile->setHealthDamage(this->getHealthDamage());
    6367    }
    6468}
  • code/branches/presentation/src/modules/weapons/weaponmodes/LightningGun.cc

    r8579 r8580  
    2323 *      Joel Smely
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4545
    4646        this->reloadTime_ = 1;
    47         this->damage_ = 100;
     47        this->damage_ = 0; //default 100
    4848        this->speed_ = 150;
    4949
     
    5656    }
    5757
     58    /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties
     59     */
    5860    void LightningGun::fire()
    5961    {
     
    6971        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7072        projectile->setDamage(this->getDamage());
     73        projectile->setShieldDamage(this->getShieldDamage());
     74        projectile->setHealthDamage(this->getHealthDamage());
    7175    }
    7276}
  • code/branches/presentation/src/modules/weapons/weaponmodes/RocketFire.cc

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4848        this->reloadTime_ = 0.20f;
    4949        this->bParallelReload_ = false;
    50         this->damage_ = 100;
     50        this->damage_ = 0;
    5151        this->speed_ = 500;
    5252
     
    5959    }
    6060
     61    /* Creates the Rocket object, sets its properties to the RocketFire properties
     62     */
    6163    void RocketFire::fire()
    6264    {
     
    7173        rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7274        rocket->setDamage(this->getDamage());
     75        rocket->setShieldDamage(this->getShieldDamage());
     76        rocket->setHealthDamage(this->getHealthDamage());
    7377    }
    7478}
  • code/branches/presentation/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r8579 r8580  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5050        this->reloadTime_ = 1;
    5151        this->bParallelReload_ = false;
    52         this->damage_ = 100;
     52        this->damage_ = 0;
    5353        this->speed_ = 500;
    5454
     
    6262    }
    6363
     64    /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target
     65     */
    6466    void SimpleRocketFire::fire()
    6567    {
     
    7173        rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    7274        rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     75
    7376        rocket->setDamage(this->damage_);
     77        rocket->setShieldDamage(this->getShieldDamage());
     78        rocket->setHealthDamage(this->getHealthDamage());
     79
    7480        WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
    7581        if (pawnn) con->setTarget(pawnn);
Note: See TracChangeset for help on using the changeset viewer.