Changeset 6107
- Timestamp:
- Nov 20, 2009, 5:20:11 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 20 edited
- 11 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/particles2 (added) merged: 6050,6059,6065-6068,6076,6078-6082,6086-6087,6098-6099,6101
- Property svn:mergeinfo changed
-
code/branches/presentation2/data/levels/empty_level.oxw
r5781 r6107 17 17 skybox = "Orxonox/Starbox" 18 18 > 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 19 34 <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=spaceship pirate/>35 <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff /> 21 36 </Scene> 22 37 </Level> -
code/branches/presentation2/data/levels/includes/weaponsettings3.oxi
r5781 r6107 2 2 <WeaponSlot position="-15.0,-1.5,0" /> 3 3 <WeaponSlot position=" 15.0,-1.5,0" /> 4 <WeaponSlot position=" 0.0, 0.0,0" />4 <WeaponSlot position=" 0, 0,0" /> 5 5 </weaponslots> 6 6 <weaponsets> 7 7 <WeaponSet firemode=0 /> 8 8 <WeaponSet firemode=1 /> 9 <WeaponSet firemode=2 /> 9 10 </weaponsets> 10 11 <weapons> … … 13 14 <DefaultWeaponmodeLink firemode=0 weaponmode=0 /> 14 15 <DefaultWeaponmodeLink firemode=1 weaponmode=1 /> 16 <DefaultWeaponmodeLink firemode=2 weaponmode=2 /> 15 17 </links> 16 18 <Weapon> … … 36 38 <LightningGun mode=1 muzzleoffset="0,0,0" /> 37 39 </Weapon> 40 <Weapon> 41 <RocketFire mode=2 muzzleoffset="0,0,0" /> 42 </Weapon> 38 43 </WeaponPack> 39 44 <WeaponPack> … … 41 46 <DefaultWeaponmodeLink firemode=1 weaponmode=0 /> 42 47 </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--> 46 51 </WeaponPack> 47 52 </weapons> -
code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt
r5781 r6107 4 4 Projectile.cc 5 5 LightningGunProjectile.cc 6 Rocket.cc 6 7 ) -
code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt
r5781 r6107 5 5 HsW01.cc 6 6 LightningGun.cc 7 RocketFire.cc 7 8 ) -
code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h
r5929 r6107 176 176 class TeamSpawnPoint; 177 177 class WorldEntity; 178 class Rocket; 178 179 // worldentities, pawns 179 180 class Destroyer; -
code/branches/presentation2/src/orxonox/Scene.cc
r6064 r6107 334 334 { 335 335 // 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()); 340 338 341 339 // false means that bullet will assume we didn't modify the contact -
code/branches/presentation2/src/orxonox/controllers/Controller.h
r5781 r6107 37 37 class _OrxonoxExport Controller : public BaseObject 38 38 { 39 // set friend classes to access setControllableEntity 40 friend class PlayerInfo; 41 friend class ControllableEntity; 42 39 43 public: 40 44 Controller(BaseObject* creator); … … 46 50 { return this->player_; } 47 51 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) 48 58 inline void setControllableEntity(ControllableEntity* entity) 49 59 { … … 54 64 } 55 65 } 56 inline ControllableEntity* getControllableEntity() const57 { return this->controllableEntity_; }58 virtual void changedControllableEntity() {}59 66 60 protected:61 67 PlayerInfo* player_; 62 68 ControllableEntity* controllableEntity_; -
code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc
r5929 r6107 50 50 this->controller_ = 0; 51 51 this->controllableEntity_ = 0; 52 this->controllableEntityID_ = CLIENTID_UNKNOWN; 52 this->controllableEntityID_ = OBJECTID_UNKNOWN; 53 this->oldControllableEntity_ = 0; 53 54 54 55 this->gtinfo_ = 0; … … 80 81 registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 81 82 registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 82 registerVariable(this->bReadyToSpawn_, VariableDirection::ToServer);83 83 registerVariable(this->gtinfoID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID)); 84 84 } … … 148 148 return; 149 149 150 if (this->oldControllableEntity_) 151 this->stopTemporaryControl(); 150 152 if (this->controllableEntity_) 151 153 this->stopControl(); … … 163 165 this->changedControllableEntity(); 164 166 } 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 } 165 186 166 187 void PlayerInfo::stopControl() 167 188 { 189 if ( this->oldControllableEntity_ ) 190 this->stopTemporaryControl(); 191 168 192 ControllableEntity* entity = this->controllableEntity_; 169 193 … … 177 201 this->controller_->setControllableEntity(0); 178 202 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 184 229 void PlayerInfo::networkcallback_changedcontrollableentityID() 185 230 { … … 196 241 } 197 242 243 198 244 void PlayerInfo::networkcallback_changedgtinfoID() 199 245 { -
code/branches/presentation2/src/orxonox/infos/PlayerInfo.h
r5929 r6107 69 69 void startControl(ControllableEntity* entity); 70 70 void stopControl(); 71 void startTemporaryControl(ControllableEntity* entity); 72 void stopTemporaryControl(); 71 73 72 74 inline ControllableEntity* getControllableEntity() const … … 96 98 Controller* controller_; 97 99 ControllableEntity* controllableEntity_; 100 ControllableEntity* oldControllableEntity_; 98 101 unsigned int controllableEntityID_; 99 102 -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc
r5929 r6107 49 49 WeaponPack::~WeaponPack() 50 50 { 51 if (this->isInitialized() && this->weaponSystem_)51 if (this->isInitialized()) 52 52 { 53 this->weaponSystem_->removeWeaponPack(this); 53 if( this->weaponSystem_ ) 54 this->weaponSystem_->removeWeaponPack(this); 54 55 55 56 while (!this->weapons_.empty()) … … 71 72 void WeaponPack::fire(unsigned int weaponmode) 72 73 { 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) 74 75 (*it)->fire(weaponmode); 75 76 } … … 77 78 void WeaponPack::reload() 78 79 { 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) 80 81 (*it)->reload(); 81 82 } … … 86 87 return; 87 88 88 this->weapons_. insert(weapon);89 this->weapons_.push_back(weapon); 89 90 weapon->setWeaponPack(this); 90 91 } … … 95 96 return; 96 97 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); 98 101 weapon->setWeaponPack(0); 99 102 } … … 103 106 unsigned int i = 0; 104 107 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) 106 109 { 107 110 if (i == index) … … 142 145 void WeaponPack::notifyWeapons() 143 146 { 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) 145 148 (*it)->setWeaponPack(this); 146 149 } -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h
r5781 r6107 69 69 void notifyWeapons(); 70 70 71 std:: set<Weapon *> weapons_;71 std::vector<Weapon *> weapons_; 72 72 std::set<DefaultWeaponmodeLink *> links_; 73 73 WeaponSystem * weaponSystem_; -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc
r5929 r6107 202 202 } 203 203 204 this->weaponPacks_. insert(wPack);204 this->weaponPacks_.push_back(wPack); 205 205 wPack->setWeaponSystem(this); 206 206 … … 221 221 222 222 // 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); 224 226 } 225 227 … … 227 229 { 228 230 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) 230 232 { 231 233 ++i; … … 258 260 259 261 // 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 ); 261 263 if (it1 == this->weaponPacks_.end()) 262 264 return; -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h
r5781 r6107 92 92 std::map<unsigned int, WeaponSet *> weaponSets_; 93 93 std::vector<WeaponSlot *> weaponSlots_; 94 std:: set<WeaponPack *> weaponPacks_;94 std::vector<WeaponPack *> weaponPacks_; 95 95 std::map<Identifier *, Munition *> munitions_; 96 96 Pawn * pawn_; -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
r5929 r6107 36 36 #include "core/GameMode.h" 37 37 #include "core/XMLPort.h" 38 #include "network/NetworkFunction.h" 38 39 39 40 #include "Scene.h" … … 47 48 { 48 49 CreateFactory(ControllableEntity); 50 51 registerMemberNetworkFunction( ControllableEntity, fire ); 49 52 50 53 ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator) … … 217 220 this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL); 218 221 } 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 } 219 234 220 235 void ControllableEntity::setPlayer(PlayerInfo* player) -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h
r5929 r6107 84 84 { this->rotateRoll(Vector2(value, 0)); } 85 85 86 virtual void fire(unsigned int firemode) {} 86 void fire(unsigned int firemode); 87 virtual void fired(unsigned int firemode) {} 87 88 virtual void reload() {} 88 89 -
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
r5929 r6107 52 52 CreateFactory(Pawn); 53 53 54 registerMemberNetworkFunction( Pawn, doFire );55 56 54 Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator) 57 55 { … … 110 108 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 111 109 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); 113 111 } 114 112 … … 263 261 } 264 262 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); 283 267 } 284 268 … … 341 325 } 342 326 327 void Pawn::addWeaponPackXML(WeaponPack * wPack) 328 { 329 if (this->weaponSystem_) 330 if (!this->weaponSystem_->addWeaponPack(wPack)) 331 wPack->destroy(); 332 } 333 343 334 WeaponPack * Pawn::getWeaponPack(unsigned int index) const 344 335 { -
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h
r5781 r6107 79 79 virtual void kill(); 80 80 81 virtual void fire (unsigned int firemode);81 virtual void fired(unsigned int firemode); 82 82 virtual void reload(); 83 virtual void doFire(uint8_t firemode);84 83 virtual void postSpawn(); 85 84 … … 89 88 WeaponSet * getWeaponSet(unsigned int index) const; 90 89 void addWeaponPack(WeaponPack * wPack); 90 void addWeaponPackXML(WeaponPack * wPack); 91 91 WeaponPack * getWeaponPack(unsigned int index) const; 92 92 -
code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc
r5929 r6107 189 189 } 190 190 191 void Spectator::fire (unsigned int firemode)191 void Spectator::fired(unsigned int firemode) 192 192 { 193 193 if (this->getPlayer()) -
code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.h
r5781 r6107 55 55 virtual void rotateRoll(const Vector2& value); 56 56 57 virtual void fire (unsigned int firemode);57 virtual void fired(unsigned int firemode); 58 58 virtual void greet(); 59 59
Note: See TracChangeset
for help on using the changeset viewer.