Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6107


Ignore:
Timestamp:
Nov 20, 2009, 5:20:11 PM (15 years ago)
Author:
rgrieder
Message:

Merged particles2 branch to presentation2.

Location:
code/branches/presentation2
Files:
20 edited
11 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2

  • code/branches/presentation2/data/levels/empty_level.oxw

    r5781 r6107  
    1717    skybox       = "Orxonox/Starbox"
    1818  >
     19
     20<!--Rocket position="-10, 3.5,800" velocity="0,0,-100">
     21      <attached>
     22        <Model pitch=180 position="0,0,0" scale=1.5 mesh="rocket_test.mesh" >
     23          <attached>
     24           <ParticleEmitter pitch=0 roll=0 position="0,5,0" source="Orxonox/laser" lifetime=2.0 loop=1 startdelay=3.0/>
     25           <ParticleEmitter pitch=-90 roll=0 position="0,-5,0" source="Orxonox/particlecanon" lifetime=2.0 loop=1 startdelay=3.0/>
     26           <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/rocketfire" lifetime=2.0 loop=1 startdelay=3.0 />
     27           <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/smoke" lifetime=2.0 loop=1 startdelay=3.0 />
     28          </attached>
     29          </Model>
     30        </attached>
     31    </Rocket-->
     32   
     33   
    1934    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
    20     <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshippirate />
     35    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
    2136  </Scene>
    2237</Level>
  • code/branches/presentation2/data/levels/includes/weaponsettings3.oxi

    r5781 r6107  
    22      <WeaponSlot position="-15.0,-1.5,0" />
    33      <WeaponSlot position=" 15.0,-1.5,0" />
    4       <WeaponSlot position="  0.0, 0.0,0" />
     4      <WeaponSlot position="    0,   0,0" />
    55    </weaponslots>
    66    <weaponsets>
    77      <WeaponSet firemode=0 />
    88      <WeaponSet firemode=1 />
     9      <WeaponSet firemode=2 />
    910    </weaponsets>
    1011    <weapons>
     
    1314          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
    1415          <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
     16          <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
    1517        </links>
    1618        <Weapon>
     
    3638          <LightningGun mode=1 muzzleoffset="0,0,0" />
    3739        </Weapon>
     40        <Weapon>
     41          <RocketFire mode=2 muzzleoffset="0,0,0" />
     42        </Weapon>
    3843      </WeaponPack>
    3944      <WeaponPack>
     
    4146          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
    4247        </links>
    43         <Weapon>
    44           <!-- EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" / -->
    45         </Weapon>
     48        <!--Weapon>
     49          <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
     50        </Weapon-->
    4651      </WeaponPack>
    4752    </weapons>
  • code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt

    r5781 r6107  
    44  Projectile.cc
    55  LightningGunProjectile.cc
     6  Rocket.cc
    67)
  • code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt

    r5781 r6107  
    55  HsW01.cc
    66  LightningGun.cc
     7  RocketFire.cc
    78)
  • code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h

    r5929 r6107  
    176176    class TeamSpawnPoint;
    177177    class WorldEntity;
     178    class Rocket;
    178179    // worldentities, pawns
    179180    class Destroyer;
  • code/branches/presentation2/src/orxonox/Scene.cc

    r6064 r6107  
    334334    {
    335335        // get the WorldEntity pointers
    336         WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
    337         assert(orxonox_cast<WorldEntity*>(object0));
    338         WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    339         assert(orxonox_cast<WorldEntity*>(object1));
     336        SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
     337        SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    340338
    341339        // false means that bullet will assume we didn't modify the contact
  • code/branches/presentation2/src/orxonox/controllers/Controller.h

    r5781 r6107  
    3737    class _OrxonoxExport Controller : public BaseObject
    3838    {
     39        // set friend classes to access setControllableEntity
     40        friend class PlayerInfo;
     41        friend class ControllableEntity;
     42       
    3943        public:
    4044            Controller(BaseObject* creator);
     
    4650                { return this->player_; }
    4751
     52            inline ControllableEntity* getControllableEntity() const
     53                { return this->controllableEntity_; }
     54            virtual void changedControllableEntity() {}
     55
     56        protected:
     57            // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
    4858            inline void setControllableEntity(ControllableEntity* entity)
    4959            {
     
    5464                }
    5565            }
    56             inline ControllableEntity* getControllableEntity() const
    57                 { return this->controllableEntity_; }
    58             virtual void changedControllableEntity() {}
    5966
    60         protected:
    6167            PlayerInfo* player_;
    6268            ControllableEntity* controllableEntity_;
  • code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc

    r5929 r6107  
    5050        this->controller_ = 0;
    5151        this->controllableEntity_ = 0;
    52         this->controllableEntityID_ = CLIENTID_UNKNOWN;
     52        this->controllableEntityID_ = OBJECTID_UNKNOWN;
     53        this->oldControllableEntity_ = 0;
    5354
    5455        this->gtinfo_ = 0;
     
    8081        registerVariable(this->name_,                 VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
    8182        registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
    82         registerVariable(this->bReadyToSpawn_,        VariableDirection::ToServer);
    8383        registerVariable(this->gtinfoID_,             VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID));
    8484    }
     
    148148            return;
    149149
     150        if (this->oldControllableEntity_)
     151            this->stopTemporaryControl();
    150152        if (this->controllableEntity_)
    151153            this->stopControl();
     
    163165        this->changedControllableEntity();
    164166    }
     167   
     168    void PlayerInfo::startTemporaryControl(ControllableEntity* entity)
     169    {
     170        if (!entity)
     171            return;
     172       
     173//         assert( this->temporaryControllableEntity_==0 );
     174
     175        this->oldControllableEntity_ = this->controllableEntity_;
     176        this->controllableEntity_ = entity;
     177        this->controllableEntityID_ = entity->getObjectID();
     178
     179        entity->setPlayer(this);
     180
     181        if (this->controller_)
     182            this->controller_->setControllableEntity(entity);
     183
     184        this->changedControllableEntity();
     185    }
    165186
    166187    void PlayerInfo::stopControl()
    167188    {
     189        if ( this->oldControllableEntity_ )
     190            this->stopTemporaryControl();
     191       
    168192        ControllableEntity* entity = this->controllableEntity_;
    169193
     
    177201            this->controller_->setControllableEntity(0);
    178202
    179         entity->removePlayer();
    180 
    181         this->changedControllableEntity();
    182     }
    183 
     203        if ( GameMode::isMaster() )
     204            entity->removePlayer();
     205
     206        this->changedControllableEntity();
     207    }
     208   
     209    void PlayerInfo::stopTemporaryControl()
     210    {
     211        ControllableEntity* entity = this->controllableEntity_;
     212
     213        if (!entity || !this->oldControllableEntity_)
     214            return;
     215
     216        this->controllableEntity_ = this->oldControllableEntity_;
     217        this->controllableEntityID_ = this->controllableEntity_->getObjectID();
     218        this->oldControllableEntity_ = 0;
     219
     220        if ( this->controllableEntity_ && this->controller_)
     221            this->controller_->setControllableEntity(this->controllableEntity_);
     222
     223        if ( GameMode::isMaster() )
     224            entity->removePlayer();
     225       
     226        this->changedControllableEntity();
     227    }
     228   
    184229    void PlayerInfo::networkcallback_changedcontrollableentityID()
    185230    {
     
    196241    }
    197242
     243
    198244    void PlayerInfo::networkcallback_changedgtinfoID()
    199245    {
  • code/branches/presentation2/src/orxonox/infos/PlayerInfo.h

    r5929 r6107  
    6969            void startControl(ControllableEntity* entity);
    7070            void stopControl();
     71            void startTemporaryControl(ControllableEntity* entity);
     72            void stopTemporaryControl();
    7173
    7274            inline ControllableEntity* getControllableEntity() const
     
    9698            Controller* controller_;
    9799            ControllableEntity* controllableEntity_;
     100            ControllableEntity* oldControllableEntity_;
    98101            unsigned int controllableEntityID_;
    99102
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc

    r5929 r6107  
    4949    WeaponPack::~WeaponPack()
    5050    {
    51         if (this->isInitialized() && this->weaponSystem_)
     51        if (this->isInitialized())
    5252        {
    53             this->weaponSystem_->removeWeaponPack(this);
     53            if( this->weaponSystem_ )
     54                this->weaponSystem_->removeWeaponPack(this);
    5455
    5556            while (!this->weapons_.empty())
     
    7172    void WeaponPack::fire(unsigned int weaponmode)
    7273    {
    73         for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     74        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    7475            (*it)->fire(weaponmode);
    7576    }
     
    7778    void WeaponPack::reload()
    7879    {
    79         for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     80        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    8081            (*it)->reload();
    8182    }
     
    8687            return;
    8788
    88         this->weapons_.insert(weapon);
     89        this->weapons_.push_back(weapon);
    8990        weapon->setWeaponPack(this);
    9091    }
     
    9596            return;
    9697
    97         this->weapons_.erase(weapon);
     98        std::vector<Weapon*>::iterator it = std::find(this->weapons_.begin(), this->weapons_.end(), weapon);
     99        assert(it != this->weapons_.end());
     100        this->weapons_.erase(it);
    98101        weapon->setWeaponPack(0);
    99102    }
     
    103106        unsigned int i = 0;
    104107
    105         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     108        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    106109        {
    107110            if (i == index)
     
    142145    void WeaponPack::notifyWeapons()
    143146    {
    144         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     147        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    145148            (*it)->setWeaponPack(this);
    146149    }
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h

    r5781 r6107  
    6969            void notifyWeapons();
    7070
    71             std::set<Weapon *> weapons_;
     71            std::vector<Weapon *> weapons_;
    7272            std::set<DefaultWeaponmodeLink *> links_;
    7373            WeaponSystem * weaponSystem_;
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc

    r5929 r6107  
    202202        }
    203203
    204         this->weaponPacks_.insert(wPack);
     204        this->weaponPacks_.push_back(wPack);
    205205        wPack->setWeaponSystem(this);
    206206
     
    221221
    222222        // Remove the WeaponPack from the WeaponSystem
    223         this->weaponPacks_.erase(wPack);
     223        std::vector<WeaponPack*>::iterator it = std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(), wPack);
     224        assert(it !=this->weaponPacks_.end());
     225        this->weaponPacks_.erase(it);
    224226    }
    225227
     
    227229    {
    228230        unsigned int i = 0;
    229         for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     231        for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
    230232        {
    231233            ++i;
     
    258260
    259261        // Check if the WeaponPack belongs to this WeaponSystem
    260         std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
     262        std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack );
    261263        if (it1 == this->weaponPacks_.end())
    262264            return;
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h

    r5781 r6107  
    9292            std::map<unsigned int, WeaponSet *> weaponSets_;
    9393            std::vector<WeaponSlot *> weaponSlots_;
    94             std::set<WeaponPack *> weaponPacks_;
     94            std::vector<WeaponPack *> weaponPacks_;
    9595            std::map<Identifier *, Munition *> munitions_;
    9696            Pawn * pawn_;
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc

    r5929 r6107  
    3636#include "core/GameMode.h"
    3737#include "core/XMLPort.h"
     38#include "network/NetworkFunction.h"
    3839
    3940#include "Scene.h"
     
    4748{
    4849    CreateFactory(ControllableEntity);
     50
     51    registerMemberNetworkFunction( ControllableEntity, fire );
    4952
    5053    ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
     
    217220            this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
    218221    }
     222   
     223    void ControllableEntity::fire(unsigned int firemode)
     224    {
     225        if(GameMode::isMaster())
     226        {
     227            this->fired(firemode);
     228        }
     229        else
     230        {
     231            callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
     232        }
     233    }
    219234
    220235    void ControllableEntity::setPlayer(PlayerInfo* player)
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h

    r5929 r6107  
    8484                { this->rotateRoll(Vector2(value, 0)); }
    8585
    86             virtual void fire(unsigned int firemode) {}
     86            void fire(unsigned int firemode);
     87            virtual void fired(unsigned int firemode) {}
    8788            virtual void reload() {}
    8889
  • code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc

    r5929 r6107  
    5252    CreateFactory(Pawn);
    5353
    54     registerMemberNetworkFunction( Pawn, doFire );
    55 
    5654    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
    5755    {
     
    110108        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
    111109        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    112         XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
     110        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    113111    }
    114112
     
    263261    }
    264262
    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         }
     263    void Pawn::fired(unsigned int firemode)
     264    {
     265        if (this->weaponSystem_)
     266            this->weaponSystem_->fire(firemode);
    283267    }
    284268
     
    341325    }
    342326
     327    void Pawn::addWeaponPackXML(WeaponPack * wPack)
     328    {
     329        if (this->weaponSystem_)
     330            if (!this->weaponSystem_->addWeaponPack(wPack))
     331                wPack->destroy();
     332    }
     333
    343334    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
    344335    {
  • code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h

    r5781 r6107  
    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
  • code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc

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

    r5781 r6107  
    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.