- Timestamp:
- Apr 9, 2009, 3:18:11 AM (15 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.