- Timestamp:
- Apr 9, 2009, 3:18:11 AM (16 years ago)
- Location:
- code/branches/weapons/src/orxonox/objects/worldentities/pawns
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2896 r2912 39 39 #include "objects/worldentities/ParticleSpawner.h" 40 40 #include "objects/worldentities/ExplosionChunk.h" 41 #include "objects/weaponSystem/WeaponSystem.h" 42 #include "objects/weaponSystem/WeaponSlot.h" 43 #include "objects/weaponSystem/WeaponPack.h" 44 #include "objects/weaponSystem/WeaponSet.h" 41 45 42 46 namespace orxonox … … 66 70 { 67 71 this->weaponSystem_ = new WeaponSystem(this); 68 this->weaponSystem_->setPa rentPawn(this);72 this->weaponSystem_->setPawn(this); 69 73 } 70 74 else … … 100 104 XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7); 101 105 102 XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);103 XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);104 XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);106 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 107 XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode); 108 XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode); 105 109 } 106 110 … … 119 123 if (this->weaponSystem_) 120 124 { 121 if (this->fire_ & WeaponMode::fire) 122 this->weaponSystem_->fire(WeaponMode::fire); 123 if (this->fire_ & WeaponMode::altFire) 124 this->weaponSystem_->fire(WeaponMode::altFire); 125 if (this->fire_ & WeaponMode::altFire2) 126 this->weaponSystem_->fire(WeaponMode::altFire2); 125 for (unsigned int firemode = 0; firemode < WeaponSystem::getMaxFireModes(); firemode++) 126 if (this->fire_ & WeaponSystem::getFireModeMask(firemode)) 127 this->weaponSystem_->fire(firemode); 127 128 } 128 129 this->fire_ = this->firehack_; … … 252 253 } 253 254 254 void Pawn::fire( WeaponMode::Enum fireMode)255 { 256 this->firehack_ |= fireMode;255 void Pawn::fire(unsigned int firemode) 256 { 257 this->firehack_ |= WeaponSystem::getFireModeMask(firemode); 257 258 } 258 259 … … 275 276 * --> e.g. Pickup-Items 276 277 */ 277 void Pawn:: setWeaponSlot(WeaponSlot * wSlot)278 void Pawn::addWeaponSlot(WeaponSlot * wSlot) 278 279 { 279 280 this->attach(wSlot); … … 285 286 { 286 287 if (this->weaponSystem_) 287 return this->weaponSystem_->getWeaponSlot Pointer(index);288 return this->weaponSystem_->getWeaponSlot(index); 288 289 else 289 290 return 0; 290 291 } 291 292 292 void Pawn::setWeaponPack(WeaponPack * wPack) 293 { 294 if (this->weaponSystem_) 295 { 296 wPack->setParentWeaponSystem(this->weaponSystem_); 297 wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_); 298 this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); 299 wPack->attachNeededMunitionToAllWeapons(); 300 } 293 void Pawn::addWeaponPack(WeaponPack * wPack) 294 { 295 if (this->weaponSystem_) 296 this->weaponSystem_->attachWeaponPack(wPack, wPack->getFireMode()); 301 297 } 302 298 … … 304 300 { 305 301 if (this->weaponSystem_) 306 return this->weaponSystem_->getWeaponPack Pointer(firemode);302 return this->weaponSystem_->getWeaponPack(firemode); 307 303 else 308 304 return 0; 309 305 } 310 306 311 void Pawn:: setWeaponSet(WeaponSet * wSet)307 void Pawn::addWeaponSet(WeaponSet * wSet) 312 308 { 313 309 if (this->weaponSystem_) … … 318 314 { 319 315 if (this->weaponSystem_) 320 return this->weaponSystem_->getWeaponSet Pointer(index);316 return this->weaponSystem_->getWeaponSet(index); 321 317 else 322 318 return 0; -
code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h
r2826 r2912 34 34 #include "objects/worldentities/ControllableEntity.h" 35 35 #include "objects/RadarViewable.h" 36 #include "objects/weaponSystem/WeaponSystem.h"37 36 38 37 namespace orxonox … … 40 39 class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable 41 40 { 41 friend class WeaponSystem; 42 42 43 public: 43 44 Pawn(BaseObject* creator); … … 79 80 virtual void kill(); 80 81 81 virtual void fire( WeaponMode::Enum fireMode);82 virtual void fire(unsigned int firemode); 82 83 virtual void postSpawn(); 83 84 84 void setWeaponSlot(WeaponSlot * wSlot);85 void addWeaponSlot(WeaponSlot * wSlot); 85 86 WeaponSlot * getWeaponSlot(unsigned int index) const; 86 void setWeaponPack(WeaponPack * wPack);87 void addWeaponPack(WeaponPack * wPack); 87 88 WeaponPack * getWeaponPack(unsigned int firemode) const; 88 void setWeaponSet(WeaponSet * wSet);89 void addWeaponSet(WeaponSet * wSet); 89 90 WeaponSet * getWeaponSet(unsigned int index) const; 90 91 … … 134 135 float spawnparticleduration_; 135 136 unsigned int numexplosionchunks_; 137 138 private: 139 inline void setWeaponSystem(WeaponSystem* weaponsystem) 140 { this->weaponSystem_ = weaponsystem; } 136 141 }; 137 142 -
code/branches/weapons/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2896 r2912 196 196 } 197 197 198 void Spectator::fire( WeaponMode::Enum fireMode)198 void Spectator::fire(unsigned int firemode) 199 199 { 200 200 if (this->getPlayer()) -
code/branches/weapons/src/orxonox/objects/worldentities/pawns/Spectator.h
r2662 r2912 57 57 virtual void rotateRoll(const Vector2& value); 58 58 59 virtual void fire( WeaponMode::Enum fireMode);59 virtual void fire(unsigned int firemode); 60 60 virtual void greet(); 61 61
Note: See TracChangeset
for help on using the changeset viewer.