Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r5929 r6417  
    3838#include "PawnManager.h"
    3939#include "infos/PlayerInfo.h"
     40#include "controllers/Controller.h"
    4041#include "gametypes/Gametype.h"
    4142#include "graphics/ParticleSpawner.h"
     
    5253    CreateFactory(Pawn);
    5354
    54     registerMemberNetworkFunction( Pawn, doFire );
    55 
    5655    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
    5756    {
     
    6968
    7069        this->spawnparticleduration_ = 3.0f;
     70
     71        this->aimPosition_ = Vector3::ZERO;
    7172
    7273        this->getPickups().setOwner(this);
     
    110111        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
    111112        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    112         XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
     113        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    113114    }
    114115
     
    119120        registerVariable(this->initialHealth_, VariableDirection::ToClient);
    120121        registerVariable(this->bReload_,       VariableDirection::ToServer);
     122        registerVariable(this->aimPosition_,   Bidirectionality::ServerMaster, 0, true);
    121123    }
    122124
     
    166168    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    167169    {
    168         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
     170        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    169171        {
    170172            this->damage(damage, originator);
     
    175177    }
    176178
     179    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
     180    {
     181        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
     182        {
     183            this->damage(damage, originator);
     184
     185            if ( this->getController() )
     186                this->getController()->hit(originator, contactpoint, damage);
     187
     188            // play hit effect
     189        }
     190    }
     191
    177192    void Pawn::kill()
    178193    {
     
    184199    {
    185200        // play spawn effect
    186         if (this->spawnparticlesource_ != "")
     201        if (!this->spawnparticlesource_.empty())
    187202        {
    188203            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
     
    263278    }
    264279
    265     void Pawn::fire(unsigned int firemode)
    266     {
    267         this->doFire(firemode);
    268     }
    269 
    270     void Pawn::doFire(uint8_t firemode)
    271     {
    272         if(GameMode::isMaster())
    273         {
    274             if (this->weaponSystem_)
    275                 this->weaponSystem_->fire(firemode);
    276         }
    277         else
    278         {
    279             callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, firemode);
    280             if (this->weaponSystem_)
    281                 this->weaponSystem_->fire(firemode);
    282         }
     280    void Pawn::fired(unsigned int firemode)
     281    {
     282        if (this->weaponSystem_)
     283            this->weaponSystem_->fire(firemode);
    283284    }
    284285
     
    341342    }
    342343
     344    void Pawn::addWeaponPackXML(WeaponPack * wPack)
     345    {
     346        if (this->weaponSystem_)
     347            if (!this->weaponSystem_->addWeaponPack(wPack))
     348                wPack->destroy();
     349    }
     350
    343351    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
    344352    {
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r5781 r6417  
    7575                { return this->lastHitOriginator_; }
    7676
    77             virtual void damage(float damage, Pawn* originator = 0);
    7877            virtual void hit(Pawn* originator, const Vector3& force, float damage);
     78            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    7979            virtual void kill();
    8080
    81             virtual void fire(unsigned int firemode);
     81            virtual void fired(unsigned int firemode);
    8282            virtual void reload();
    83             virtual void doFire(uint8_t firemode);
    8483            virtual void postSpawn();
    8584
     
    8988            WeaponSet * getWeaponSet(unsigned int index) const;
    9089            void addWeaponPack(WeaponPack * wPack);
     90            void addWeaponPackXML(WeaponPack * wPack);
    9191            WeaponPack * getWeaponPack(unsigned int index) const;
    9292
     
    117117            virtual void startLocalHumanControl();
    118118
     119            void setAimPosition( Vector3 position )
     120                { this->aimPosition_ = position; }
     121            Vector3 getAimPosition()
     122                { return this->aimPosition_; }
     123
    119124        protected:
    120125            virtual void setPlayer(PlayerInfo* player);
     
    125130            virtual void deatheffect();
    126131            virtual void spawneffect();
     132
     133            virtual void damage(float damage, Pawn* originator = 0);
    127134
    128135            bool bAlive_;
     
    146153            inline void setWeaponSystem(WeaponSystem* weaponsystem)
    147154                { this->weaponSystem_ = weaponsystem; }
     155
     156            Vector3 aimPosition_;
    148157    };
    149158}
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r5929 r6417  
    187187    void SpaceShip::loadEngineTemplate()
    188188    {
    189         if (this->enginetemplate_ != "")
     189        if (!this->enginetemplate_.empty())
    190190        {
    191191            Template* temp = Template::getTemplate(this->enginetemplate_);
  • code/trunk/src/orxonox/worldentities/pawns/Spectator.cc

    r5929 r6417  
    189189    }
    190190
    191     void Spectator::fire(unsigned int firemode)
     191    void Spectator::fired(unsigned int firemode)
    192192    {
    193193        if (this->getPlayer())
  • code/trunk/src/orxonox/worldentities/pawns/Spectator.h

    r5781 r6417  
    5555            virtual void rotateRoll(const Vector2& value);
    5656
    57             virtual void fire(unsigned int firemode);
     57            virtual void fired(unsigned int firemode);
    5858            virtual void greet();
    5959
Note: See TracChangeset for help on using the changeset viewer.