Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Reverse merge to revert last, failed, merge. Apparently you can't partially commit a merge.

Location:
code/branches/presentation
Files:
6 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/data/defaultConfig/keybindings.ini

    r8578 r8579  
    2121KeyDown="scale -1 moveFrontBack"
    2222KeyE="scale -1 rotateRoll"
    23 KeyEnd="boost"
     23KeyEnd=boost
    2424KeyEquals=
    2525KeyEscape="keyESC"
     
    119119KeySlash=
    120120KeySleep=
    121 KeySpace="boost"
     121KeySpace=boost
    122122KeyStop=
    123123KeySystemRequest="printScreen"
  • code/branches/presentation/data/levels/includes/weaponSettingsAssff.oxi

    r8578 r8579  
    2626          <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
    2727          <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
    28           <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
     28          <LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
    2929        </Weapon>
    3030        <Weapon>
     
    3636          <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
    3737          <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
    38           <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
     38          <LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
    3939        </Weapon>
    4040        <Weapon>
    41           <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
    42           <RocketFire mode=3 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
     41          <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=50 />
     42          <RocketFire mode=3 muzzleoffset="0,0,0" damage=100 />
    4343        </Weapon>
    4444      </WeaponPack>
  • code/branches/presentation/data/levels/templates/spaceshipAssff.oxt

    r8578 r8579  
    1212   initialhealth     = 100
    1313
    14    shieldhealth        = 30
    15    initialshieldhealth = 30
    16    maxshieldhealth     = 50
    17    shieldabsorption    = 0.8
    18    reloadrate          = 1
    19    reloadwaittime      = 1
    20 
    21    primaryThrust     = 100
    22    auxilaryThrust    = 30
    23    rotationThrust    = 25
    24 
    25    boostPower            = 15
    26    boostPowerRate        = 1
    27    boostRate             = 5
    28    boostCooldownDuration = 10
    29 
    30    shakeFrequency = 15
    31    shakeAmplitude = 7
     14   primaryThrust     = 100;
     15   auxilaryThrust    = 30;
     16   rotationThrust    = 25;
    3217
    3318   collisionType     = "dynamic"
  • code/branches/presentation/src/modules/weapons/projectiles/CMakeLists.txt

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

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    4141    CreateFactory(Projectile);
    4242
    43     Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
     43    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
    4444    {
    4545        RegisterObject(Projectile);
    4646
    4747        this->setConfigValues();
     48        this->bDestroy_ = false;
    4849        this->owner_ = 0;
     50        this->damage_ = 15;
    4951
    5052        // Get notification about collisions
     53
    5154        if (GameMode::isMaster())
    5255        {
     
    8184            return;
    8285
    83         if (this->getBDestroy())
     86        if (this->bDestroy_)
    8487            this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
    8588    }
     
    9194    }
    9295
    93     /* Calls the collidesAgainst function of BasicProjectile
    94      */
    9596    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    9697    {
    97         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     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;
    98130    }
    99131
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.h

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3535#include "worldentities/MovableEntity.h"
    3636
    37 #include "BasicProjectile.h"
    38 
    3937namespace orxonox
    4038{
    41     class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
     39    class _WeaponsExport Projectile : public MovableEntity
    4240    {
    4341        public:
     
    5149            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5250
     51            inline void setDamage(float damage)
     52                { this->damage_ = damage; }
     53            inline float getDamage() const
     54                { return this->damage_; }
     55
    5356            void setOwner(Pawn* owner);
    5457            inline Pawn* getOwner() const
    5558                { return this->owner_; }
    5659
    57 
    5860        private:
    5961            WeakPtr<Pawn> owner_;
    6062            float lifetime_;
     63            float damage_;
     64            bool bDestroy_;
    6165            Timer destroyTimer_;
    6266    };
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.cc

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    5252        Constructor. Registers the object and initializes some default values.
    5353    */
    54     Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     54    Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
    5555    {
    5656        RegisterObject(Rocket);// - register the Rocket class to the core
    5757
    5858        this->localAngularVelocity_ = 0;
     59        this->bDestroy_ = false;
    5960        this->lifetime_ = 100;
    6061
     
    145146    {
    146147        this->owner_ = owner;
    147         this->player_ = this->getOwner()->getPlayer();
    148         this->getOwner()->getPlayer()->startTemporaryControl(this);
     148        this->player_ = this->owner_->getPlayer();
     149        this->owner_->getPlayer()->startTemporaryControl(this);
    149150
    150151        if( GameMode::isMaster() )
     
    174175        if( GameMode::isMaster() )
    175176        {
    176             if( this->getBDestroy() )
     177            if( this->bDestroy_ )
    177178                this->destroy();
    178179
     
    180181    }
    181182
    182     /* Calls the collidesAgainst function of BasicProjectile
    183      */
    184183    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    185184    {
    186         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     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;
    187219    }
    188220
     
    201233    void Rocket::fired(unsigned int firemode)
    202234    {
    203         this->destroy();
     235//         if (this->owner_)
     236//         {
     237            this->destroy();
     238//         }
    204239    }
    205240
     
    207242    {
    208243        ParticleSpawner *effect1, *effect2;
    209         if( this->getOwner() )
    210         {
    211             effect1 = new ParticleSpawner(this->getOwner()->getCreator());
    212             effect2 = new ParticleSpawner(this->getOwner()->getCreator());
     244        if( this->owner_ )
     245        {
     246            effect1 = new ParticleSpawner(this->owner_->getCreator());
     247            effect2 = new ParticleSpawner(this->owner_->getCreator());
    213248        }
    214249        else
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.h

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3434#include "tools/Timer.h"
    3535#include "worldentities/ControllableEntity.h"
    36 
    37 #include "BasicProjectile.h"
    3836
    3937namespace orxonox
     
    4846        Oli Scheuss
    4947    */
    50     class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile
     48    class _WeaponsExport Rocket : public ControllableEntity
    5149    {
    5250        public:
     
    111109                { return this->owner_; }
    112110
     111            inline void setDamage(float damage)
     112                { this->damage_ = damage; }
     113            inline float getDamage() const
     114                { return this->damage_; }
    113115            virtual void fired(unsigned int firemode);
    114116
     
    116118            WeakPtr<Pawn> owner_;
    117119            Vector3 localAngularVelocity_;
     120            float damage_;
     121            bool bDestroy_;
    118122
    119123            WeakPtr<PlayerInfo> player_;
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.cc

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    4848    CreateFactory(SimpleRocket);
    4949
    50     SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     50    SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator)
    5151    {
    5252        RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
    5353
    5454        this->localAngularVelocity_ = 0;
     55        this->bDestroy_ = false;
    5556        this->lifetime_ = 120;
    5657
    5758        this->setMass(15);
    58 //        COUT(4) << "simplerocket constructed\n";
     59        COUT(4) << "simplerocket constructed\n";
    5960
    6061        if (GameMode::isMaster())
     
    114115                this->disableFire();
    115116
    116             if( this->getBDestroy() )
     117            if( this->bDestroy_ )
    117118                this->destroy();
    118119        }
     
    158159    {
    159160        this->owner_ = owner;
    160         this->player_ = this->getOwner()->getPlayer();
    161     }
    162 
    163 
    164     /* Calls the collidesAgainst function of BasicProjectile
    165      */
     161        this->player_ = this->owner_->getPlayer();
     162    }
     163
     164
     165
     166
    166167    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    167168    {
    168         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     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;
    169206    }
    170207
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.h

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3636#include "graphics/ParticleSpawner.h"
    3737
    38 #include "BasicProjectile.h"
    39 
    4038namespace orxonox
    4139{
     
    4846       Gabriel Nadler (Original file: Oli Scheuss)
    4947    */
    50     class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile
     48    class _WeaponsExport SimpleRocket : public ControllableEntity
    5149    {
    5250        public:
     
    113111            inline Pawn* getOwner() const
    114112                { return this->owner_; }
    115 
    116113            inline bool hasFuel() const
    117114            { return this->fuel_; }
     115
     116            inline void setDamage(float damage)
     117                { this->damage_ = damage; }
     118            inline float getDamage() const
     119                { return this->damage_; }
    118120
    119121
     
    121123            WeakPtr<Pawn> owner_;
    122124            Vector3 localAngularVelocity_;
     125            float damage_;
     126            bool bDestroy_;
    123127            bool fuel_; //!< Bool is true while the rocket "has fuel"
    124128
  • code/branches/presentation/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r8578 r8579  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    5050
    5151        this->reloadTime_ = 0.25;
    52         this->damage_ = 0; //default 15
     52        this->damage_ = 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      */
    10199    void EnergyDrink::shot()
    102100    {
     
    114112        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    115113        projectile->setDamage(this->getDamage());
    116         projectile->setShieldDamage(this->getShieldDamage());
    117         projectile->setHealthDamage(this->getHealthDamage());
    118114
    119115        EnergyDrink::muendungsfeuer();
  • code/branches/presentation/src/modules/weapons/weaponmodes/FusionFire.cc

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

    r8578 r8579  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    5151
    5252        this->reloadTime_ = 0.25;
    53         this->damage_ = 0; //default 15
     53        this->damage_ = 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      */
    113111    void HsW01::shot()
    114112    {
     
    128126        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    129127        projectile->setDamage(this->getDamage());
    130         projectile->setShieldDamage(this->getShieldDamage());
    131         projectile->setHealthDamage(this->getHealthDamage());
    132128
    133129        HsW01::muendungsfeuer();
  • code/branches/presentation/src/modules/weapons/weaponmodes/LaserFire.cc

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

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

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

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    5050        this->reloadTime_ = 1;
    5151        this->bParallelReload_ = false;
    52         this->damage_ = 0;
     52        this->damage_ = 100;
    5353        this->speed_ = 500;
    5454
     
    6262    }
    6363
    64     /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target
    65      */
    6664    void SimpleRocketFire::fire()
    6765    {
     
    7371        rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    7472        rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    75 
    7673        rocket->setDamage(this->damage_);
    77         rocket->setShieldDamage(this->getShieldDamage());
    78         rocket->setHealthDamage(this->getHealthDamage());
    79 
    8074        WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
    8175        if (pawnn) con->setTarget(pawnn);
  • code/branches/presentation/src/orxonox/controllers/Controller.h

    r8578 r8579  
    5252            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
    5353
    54 /* Override needed for different visual effects (e.g. in "NewHumanController.cc") depending on
    55    the DIFFERENT AMOUNT OF DAMAGE done to the shield and to the health of "victim" (see Projectile.cc, Pawn.cc)
    56 
    57 //            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) {};
    58 */
    59 
    6054            void setGodMode( bool mode ){ this->bGodMode_ = mode; }
    6155            bool getGodMode(){ return this->bGodMode_; }
  • code/branches/presentation/src/orxonox/controllers/HumanController.cc

    r8578 r8579  
    4242    extern const std::string __CC_fire_name = "fire";
    4343    extern const std::string __CC_suicide_name = "suicide";
    44     const std::string __CC_boost_name = "boost";
    4544
    4645    SetConsoleCommand("HumanController", "moveFrontBack",          &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
     
    5251    SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
    5352    SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
    54     SetConsoleCommand("HumanController", __CC_boost_name,          &HumanController::keepBoost     ).addShortcut().keybindMode(KeybindMode::OnHold);
     53    SetConsoleCommand("HumanController", "boost",                  &HumanController::boost         ).addShortcut().keybindMode(KeybindMode::OnHold);
    5554    SetConsoleCommand("HumanController", "greet",                  &HumanController::greet         ).addShortcut();
    5655    SetConsoleCommand("HumanController", "switchCamera",           &HumanController::switchCamera  ).addShortcut();
     
    6766
    6867    HumanController* HumanController::localController_s = 0;
    69     /*static*/ const float HumanController::BOOSTING_TIME = 0.1f;
    7068
    7169    HumanController::HumanController(BaseObject* creator) : Controller(creator)
     
    7371        RegisterObject(HumanController);
    7472
    75         this->controlPaused_ = false;
    76         this->boosting_ = false;
     73        controlPaused_ = false;
    7774
    7875        HumanController::localController_s = this;
    79         this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
    80         this->boostingTimeout_.stopTimer();
    8176    }
    8277
     
    168163    }
    169164
    170     /**
    171     @brief
    172         Static method,keeps boosting.
    173     */
    174     /*static*/ void HumanController::keepBoost()
    175     {
    176         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    177             HumanController::localController_s->keepBoosting();
    178     }
    179    
    180     /**
    181     @brief
    182         Starts, or keeps the boosting mode.
    183         Resets the boosting timeout and ells the ControllableEntity to boost (or not boost anymore).
    184     */
    185     void HumanController::keepBoosting(void)
    186     {
    187         if(this->boostingTimeout_.isActive())
    188         {
    189             this->boostingTimeout_.stopTimer();
    190             this->boostingTimeout_.startTimer();
    191         }
    192         else
    193         {
    194             this->boosting_ = true;
    195             this->boostingTimeout_.startTimer();
    196            
    197             this->controllableEntity_->boost(this->boosting_);
    198             COUT(4) << "Start boosting" << endl;
    199         }
    200     }
    201 
    202     /**
    203     @brief
    204         Terminates the boosting mode.
    205     */
    206     void HumanController::terminateBoosting(void)
    207     {
    208         this->boosting_ = false;
    209         this->boostingTimeout_.stopTimer();
    210 
    211         this->controllableEntity_->boost(this->boosting_);
    212         COUT(4) << "Stop boosting" << endl;
     165    void HumanController::boost()
     166    {
     167        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     168            HumanController::localController_s->controllableEntity_->boost();
    213169    }
    214170
  • code/branches/presentation/src/orxonox/controllers/HumanController.h

    r8578 r8579  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "tools/Timer.h"
    3534#include "tools/interfaces/Tickable.h"
    3635#include "Controller.h"
     
    6564            static void reload();
    6665
    67             static void keepBoost(); // Static method, keeps boosting.
    68             /**
    69             @brief Check whether the HumanController is in boosting mode.
    70             @return Returns true if it is, false if not.
    71             */
    72             inline bool isBoosting(void)
    73                 { return this->boosting_; }
    74             void keepBoosting(void);
    75             void terminateBoosting(void);
    76            
     66            static void boost();
    7767            static void greet();
    7868            static void switchCamera();
     
    10292            static HumanController* localController_s;
    10393            bool controlPaused_;
    104        
    105         private:
    106             bool boosting_; // Whether the HumanController is in boosting mode or not.
    107             Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
    108             static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting.
    109 
    11094    }; // tolua_export
    11195} // tolua_export
  • code/branches/presentation/src/orxonox/graphics/Camera.cc

    r8578 r8579  
    4848    CreateFactory(Camera);
    4949
    50     Camera::Camera(BaseObject* creator) : MovableEntity(creator)
     50    Camera::Camera(BaseObject* creator) : StaticEntity(creator)
    5151    {
    5252        RegisterObject(Camera);
  • code/branches/presentation/src/orxonox/graphics/Camera.h

    r8578 r8579  
    3636#include "tools/interfaces/Tickable.h"
    3737#include "tools/interfaces/TimeFactorListener.h"
    38 #include "worldentities/MovableEntity.h"
     38#include "worldentities/StaticEntity.h"
    3939
    4040namespace orxonox
    4141{
    42 
    43     class _OrxonoxExport Camera : public MovableEntity, public TimeFactorListener, public WindowEventListener
     42    class _OrxonoxExport Camera : public StaticEntity, public Tickable, public TimeFactorListener, public WindowEventListener
    4443    {
    4544        friend class CameraManager;
  • code/branches/presentation/src/orxonox/items/Engine.cc

    r8578 r8579  
    204204        this->ship_->setAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())));
    205205
     206        if (!this->ship_->getPermanentBoost())
     207            this->ship_->setBoost(false);
    206208        this->ship_->setSteeringDirection(Vector3::ZERO);
    207209
  • code/branches/presentation/src/orxonox/weaponsystem/WeaponMode.cc

    r8578 r8579  
    6666
    6767        this->damage_ = 0;
    68         this->healthdamage_ = 0;
    69         this->shielddamage_ = 0;
    7068
    7169        this->muzzleOffset_ = Vector3::ZERO;
     
    108106
    109107        XMLPortParam(WeaponMode, "damage",           setDamage,           getDamage,           xmlelement, mode);
    110         XMLPortParam(WeaponMode, "healthdamage",     setHealthDamage,     getHealthDamage,     xmlelement, mode);
    111         XMLPortParam(WeaponMode, "shielddamage",     setShieldDamage,     getShieldDamage,     xmlelement, mode);
    112108        XMLPortParam(WeaponMode, "muzzleoffset",     setMuzzleOffset,     getMuzzleOffset,     xmlelement, mode);
    113109    }
  • code/branches/presentation/src/orxonox/weaponsystem/WeaponMode.h

    r8578 r8579  
    104104            // Fire
    105105            inline void setDamage(float damage)
    106                 { this->damage_ = damage;}
     106                { this->damage_ = damage; }
    107107            inline float getDamage() const
    108108                { return this->damage_; }
    109             inline void setHealthDamage(float healthdamage)
    110                 { this->healthdamage_ = healthdamage; }
    111             inline float getHealthDamage() const
    112                 { return this->healthdamage_; }
    113 
    114             inline void setShieldDamage(float shielddamage)
    115                 { this->shielddamage_ = shielddamage;}
    116             inline float getShieldDamage() const
    117                 { return this->shielddamage_; }
    118109
    119110            inline void setMuzzleOffset(const Vector3& offset)
     
    155146
    156147            float damage_;
    157             float healthdamage_;
    158             float shielddamage_;
    159148            Vector3 muzzleOffset_;
    160149
  • code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc

    r8578 r8579  
    8484        this->client_angular_velocity_ = Vector3::ZERO;
    8585
     86
    8687        this->setConfigValues();
    8788        this->setPriority( Priority::VeryHigh );
  • code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h

    r8578 r8579  
    9393            virtual void reload() {}
    9494
    95             /**
    96             @brief Tells the ControllableEntity to either start or stop boosting.
    97                    This doesn't mean, that the ControllableEntity will do so, there might be additional restrictions on boosting, but if it can, then it will.
    98             @param bBoost If true the ControllableEntity is told to start boosting, if false it is told to stop.
    99             */
    100             virtual void boost(bool bBoost) {}
    101            
     95            virtual void boost() {}
    10296            virtual void greet() {}
    10397            virtual void switchCamera();
  • code/branches/presentation/src/orxonox/worldentities/pawns/Pawn.cc

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    6464        this->maxHealth_ = 0;
    6565        this->initialHealth_ = 0;
    66 
    6766        this->shieldHealth_ = 0;
    68         this->initialShieldHealth_ = 0;
    69         this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max
    7067        this->shieldAbsorption_ = 0.5;
    71 
    72         this->reloadRate_ = 0;
    73         this->reloadWaitTime_ = 1.0f;
    74         this->reloadWaitCountdown_ = 0;
    7568
    7669        this->lastHitOriginator_ = 0;
     
    116109
    117110        XMLPortParam(Pawn, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);
    118         XMLPortParam(Pawn, "initialshieldhealth", setInitialShieldHealth, getInitialShieldHealth, xmlelement, mode).defaultValues(0);
    119         XMLPortParam(Pawn, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
    120111        XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
    121112
     
    127118        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    128119        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    129 
    130         XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    131         XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    132120    }
    133121
     
    136124        registerVariable(this->bAlive_,           VariableDirection::ToClient);
    137125        registerVariable(this->health_,           VariableDirection::ToClient);
    138         registerVariable(this->maxHealth_,        VariableDirection::ToClient);
     126        registerVariable(this->initialHealth_,    VariableDirection::ToClient);
    139127        registerVariable(this->shieldHealth_,     VariableDirection::ToClient);
    140         registerVariable(this->maxShieldHealth_,  VariableDirection::ToClient);
    141128        registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
    142129        registerVariable(this->bReload_,          VariableDirection::ToServer);
     
    150137        this->bReload_ = false;
    151138
    152         // TODO: use the existing timer functions instead
    153         if(this->reloadWaitCountdown_ > 0)
    154         {
    155             this->decreaseReloadCountdownTime(dt);
    156         }
    157         else
    158         {
    159             this->addShieldHealth(this->getReloadRate() * dt);
    160             this->resetReloadCountdown();
    161         }
    162 
    163139        if (GameMode::isMaster())
    164         {
    165140            if (this->health_ <= 0 && bAlive_)
    166141            {
    167                 this->fireEvent(); // Event to notify anyone who wants to know about the death.
     142                this->fireEvent(); // Event to notify anyone who want's to know about the death.
    168143                this->death();
    169144            }
    170         }
    171145    }
    172146
     
    194168    }
    195169
    196 
    197170    void Pawn::setHealth(float health)
    198171    {
    199         this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit
    200     }
    201 
    202     void Pawn::setShieldHealth(float shieldHealth)
    203     {
    204         this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
    205     }
    206 
    207     void Pawn::setMaxShieldHealth(float maxshieldhealth)
    208     {
    209         this->maxShieldHealth_ = maxshieldhealth;
    210     }
    211 
    212     void Pawn::setReloadRate(float reloadrate)
    213     {
    214         this->reloadRate_ = reloadrate;
    215     }
    216 
    217     void Pawn::setReloadWaitTime(float reloadwaittime)
    218     {
    219         this->reloadWaitTime_ = reloadwaittime;
    220     }
    221 
    222     void Pawn::decreaseReloadCountdownTime(float dt)
    223     {
    224         this->reloadWaitCountdown_ -= dt;
    225     }
    226 
    227     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     172        this->health_ = std::min(health, this->maxHealth_);
     173    }
     174
     175    void Pawn::damage(float damage, Pawn* originator)
    228176    {
    229177        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    230178        {
    231             if (shielddamage >= this->getShieldHealth())
     179            //share the dealt damage to the shield and the Pawn.
     180            float shielddamage = damage*this->shieldAbsorption_;
     181            float healthdamage = damage*(1-this->shieldAbsorption_);
     182
     183            // In case the shield can not take all the shield damage.
     184            if (shielddamage > this->getShieldHealth())
    232185            {
     186                healthdamage += shielddamage-this->getShieldHealth();
    233187                this->setShieldHealth(0);
    234                 this->setHealth(this->health_ - (healthdamage + damage));
    235188            }
    236             else
     189
     190            this->setHealth(this->health_ - healthdamage);
     191
     192            if (this->getShieldHealth() > 0)
    237193            {
    238194                this->setShieldHealth(this->shieldHealth_ - shielddamage);
    239 
    240                 // remove remaining shieldAbsorpton-Part of damage from shield
    241                 shielddamage = damage * this->shieldAbsorption_;
    242                 shielddamage = std::min(this->getShieldHealth(),shielddamage);
    243                 this->setShieldHealth(this->shieldHealth_ - shielddamage);
    244 
    245                 // set remaining damage to health
    246                 this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
    247195            }
    248196
    249197            this->lastHitOriginator_ = originator;
    250         }
    251     }
    252 
    253 // TODO: Still valid?
    254 /* HIT-Funktionen
    255     Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
    256 
    257 */
    258 
    259     void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
     198
     199            // play damage effect
     200        }
     201    }
     202
     203    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    260204    {
    261205        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    262206        {
    263             this->damage(damage, healthdamage, shielddamage, originator);
     207            this->damage(damage, originator);
    264208            this->setVelocity(this->getVelocity() + force);
    265         }
    266     }
    267 
    268 
    269     void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
     209
     210            // play hit effect
     211        }
     212    }
     213
     214    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    270215    {
    271216        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    272217        {
    273             this->damage(damage, healthdamage, shielddamage, originator);
     218            this->damage(damage, originator);
    274219
    275220            if ( this->getController() )
    276                 this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
    277         }
    278     }
    279 
     221                this->getController()->hit(originator, contactpoint, damage);
     222
     223            // play hit effect
     224        }
     225    }
    280226
    281227    void Pawn::kill()
  • code/branches/presentation/src/orxonox/worldentities/pawns/Pawn.h

    r8578 r8579  
    7272                { return this->initialHealth_; }
    7373
    74             virtual void setShieldHealth(float shieldHealth);
    75 
     74            inline void setShieldHealth(float shieldHealth)
     75            { this->shieldHealth_ = shieldHealth; }
    7676            inline float getShieldHealth()
    7777            { return this->shieldHealth_; }
    78 
    79             inline void addShieldHealth(float amount)
    80             { this->setShieldHealth(this->shieldHealth_ + amount); }
    81 
    82             inline bool hasShield()
    83             { return (this->getShieldHealth() > 0); }
    84 
    85             virtual void setMaxShieldHealth(float maxshieldhealth);
    86             inline float getMaxShieldHealth() const
    87                 { return this->maxShieldHealth_; }
    88 
    89             inline void setInitialShieldHealth(float initialshieldhealth)
    90                 { this->initialShieldHealth_ = initialshieldhealth; this->setShieldHealth(initialshieldhealth); }
    91             inline float getInitialShieldHealth() const
    92                 { return this->initialShieldHealth_; }
    93 
    94             inline void restoreInitialShieldHealth()
    95                 { this->setShieldHealth(this->initialShieldHealth_); }
    96             inline void restoreMaxShieldHealth()
    97                 { this->setShieldHealth(this->maxShieldHealth_); }
    9878
    9979            inline void setShieldAbsorption(float shieldAbsorption)
     
    10282            { return this->shieldAbsorption_; }
    10383
    104             // TODO: Rename to shieldRechargeRate
    105             virtual void setReloadRate(float reloadrate);
    106             inline float getReloadRate() const
    107                 { return this->reloadRate_; }
    108 
    109             virtual void setReloadWaitTime(float reloadwaittime);
    110             inline float getReloadWaitTime() const
    111                 { return this->reloadWaitTime_; }
    112 
    113             inline void resetReloadCountdown()
    114             { this->reloadWaitCountdown_ = 0; }
    115 
    116             inline void startReloadCountdown()
    117             { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
    118 
    119             virtual void decreaseReloadCountdownTime(float dt);
    120 
    12184            inline ControllableEntity* getLastHitOriginator() const
    12285                { return this->lastHitOriginator_; }
    12386
    124             //virtual void hit(Pawn* originator, const Vector3& force, float damage);
    125             //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    126             virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    127             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    128 
     87            virtual void hit(Pawn* originator, const Vector3& force, float damage);
     88            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    12989            virtual void kill();
    13090
     
    182142            virtual void spawneffect();
    183143
    184             //virtual void damage(float damage, Pawn* originator = 0);
    185             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
     144            virtual void damage(float damage, Pawn* originator = 0);
    186145
    187146            bool bAlive_;
     
    195154            float maxHealth_;
    196155            float initialHealth_;
    197            
    198156            float shieldHealth_;
    199             float maxShieldHealth_;
    200             float initialShieldHealth_;
    201157            float shieldAbsorption_; // Has to be between 0 and 1
    202             float reloadRate_;
    203             float reloadWaitTime_;
    204             float reloadWaitCountdown_;
    205158
    206159            WeakPtr<Pawn> lastHitOriginator_;
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8578 r8579  
    3636#include "core/XMLPort.h"
    3737#include "items/Engine.h"
    38 #include "graphics/Camera.h"
    39 #include "CameraManager.h"
    40 #include "util/Math.h"
    4138
    4239namespace orxonox
     
    5653        this->localAngularAcceleration_.setValue(0, 0, 0);
    5754        this->bBoost_ = false;
     55        this->bPermanentBoost_ = false;
    5856        this->steering_ = Vector3::ZERO;
    5957        this->engine_ = 0;
     
    7876        this->setConfigValues();
    7977        this->registerVariables();
    80        
    81         Camera* camera = CameraManager::getInstance().getActiveCamera();
    82         this->cameraOriginalPosition_ = camera->getPosition();
    83         this->cameraOriginalOrientation_ = camera->getOrientation();
    84 
    85         this->shakeFrequency_ = 15;
    86         this->shakeAmplitude_ = 5;
    87         this->shakeDt_ = 0;
    8878    }
    8979
     
    10696        XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
    10797        XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
    108         XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
    109         XMLPortParamVariable(SpaceShip, "shakeAmplitude", shakeAmplitude_, xmlelement, mode);
    11098    }
    11199
     
    115103        registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
    116104        registerVariable(this->rotationThrust_, VariableDirection::ToClient);
    117         // TODO: Synchronization of boost needed?
    118         registerVariable(this->boostPower_, VariableDirection::ToClient);
    119         registerVariable(this->boostPowerRate_, VariableDirection::ToClient);
    120         registerVariable(this->boostRate_, VariableDirection::ToClient);
    121         registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
    122         registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
    123         registerVariable(this->shakeAmplitude_, VariableDirection::ToClient);
    124105    }
    125106
     
    147128        if (this->hasLocalController())
    148129        {
    149 
    150130/*
    151131            this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
     
    170150                this->boostPower_ += this->boostPowerRate_*dt;
    171151            }
    172 
    173152            if(this->bBoost_)
    174153            {
     
    176155                if(this->boostPower_ <= 0.0f)
    177156                {
    178                     this->boost(false);
     157                    this->bBoost_ = false;
    179158                    this->bBoostCooldown_ = true;
    180159                    this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this)));
    181 
    182160                }
    183 
    184                 shakeCamera(dt);
    185             }
    186         }
     161            }
     162        }
     163    }
     164
     165    void SpaceShip::boostCooledDown(void)
     166    {
     167        this->bBoostCooldown_ = false;
    187168    }
    188169
     
    226207    }
    227208
     209    // TODO: something seems to call this function every tick, could probably handled a little more efficiently!
     210    void SpaceShip::setBoost(bool bBoost)
     211    {
     212        if(bBoost == this->bBoost_)
     213            return;
     214
     215        if(bBoost)
     216            this->boost();
     217        else
     218        {
     219            this->bBoost_ = false;
     220        }
     221    }
     222
    228223    void SpaceShip::fire()
    229224    {
    230225    }
    231226
    232     /**
    233     @brief
    234         Starts or stops boosting.
    235     @param bBoost
    236         Whether to start or stop boosting.
    237     */
    238     void SpaceShip::boost(bool bBoost)
    239     {
    240         if(bBoost && !this->bBoostCooldown_)
    241         {
    242             //COUT(0) << "Boost startet!\n";
     227    void SpaceShip::boost()
     228    {
     229        if(!this->bBoostCooldown_)
    243230            this->bBoost_ = true;
    244         }
    245         if(!bBoost)
    246         {
    247             //COUT(0) << "Boost stoppt\n";
    248             this->resetCamera();
    249             this->bBoost_ = false;
    250         }
    251     }
    252    
    253     void SpaceShip::boostCooledDown(void)
    254     {
    255         this->bBoostCooldown_ = false;
    256     }
    257    
    258     void SpaceShip::shakeCamera(float dt)
    259     {
    260         //make sure the ship is only shaking if it's moving
    261         if (this->getVelocity().squaredLength() > 80)
    262         {
    263             this->shakeDt_ += dt;
    264    
    265             int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
    266    
    267             if (this->shakeDt_ >= 1 /(frequency))
    268             {
    269                 this->shakeDt_ -= 1/(frequency);
    270             }
    271    
    272             Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
    273    
    274             //COUT(0) << "Angle: " << angle << std::endl;
    275             Camera* c = this->getCamera();
    276 
    277             //Shaking Camera effect
    278             if (c != 0)
    279             {
    280                 c->setOrientation(Vector3::UNIT_X, angle);
    281             }
    282         }
    283     }
    284    
    285     void SpaceShip::resetCamera()
    286     {
    287    
    288         //COUT(0) << "Resetting camera\n";
    289         Camera *c = this->getCamera();
    290    
    291         if (c == 0)
    292         {
    293             COUT(2) << "Failed to reset camera!";
    294             return;
    295         }
    296    
    297         shakeDt_ = 0;
    298         //
    299         c->setPosition(this->cameraOriginalPosition_);
    300         c->setOrientation(this->cameraOriginalOrientation_);
    301231    }
    302232
     
    343273        return list;
    344274    }
    345    
    346 
    347275}
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.h

    r8578 r8579  
    5959
    6060            virtual void fire();
    61             virtual void boost(bool bBoost); // Starts or stops boosting.
     61            virtual void boost();
    6262
    6363            void setEngine(Engine* engine);
     
    7070                { return this->steering_; }
    7171
     72            void setBoost(bool bBoost);
    7273            inline bool getBoost() const
    7374                { return this->bBoost_; }
     
    7879                { return this->enginetemplate_; }
    7980
     81            inline void setPermanentBoost(bool bPermanent)
     82                { this->bPermanentBoost_ = bPermanent; }
     83            inline bool getPermanentBoost() const
     84                { return this->bPermanentBoost_; }
     85
    8086        protected:
    8187            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const;
     
    8490            bool bBoost_;
    8591            bool bBoostCooldown_;
     92            bool bPermanentBoost_;
    8693            float boostPower_;
    8794            float initialBoostPower_;
     
    96103            btVector3 localAngularAcceleration_;
    97104
    98             float shakeFrequency_;
    99             float shakeAmplitude_;
    100 
    101105        private:
    102106            void registerVariables();
     
    106110           
    107111            void boostCooledDown(void);
    108        
    109             void resetCamera();
    110             void shakeCamera(float dt);
    111112
    112113            std::string enginetemplate_;
    113114            Engine* engine_;
    114115            Timer timer_;
    115             Vector3 cameraOriginalPosition_;
    116             Quaternion cameraOriginalOrientation_;
    117        
    118             float shakeDt_;
    119116    };
    120117}
Note: See TracChangeset for help on using the changeset viewer.