Changeset 3053 for code/trunk/src/orxonox/objects/worldentities
- Timestamp:
- May 25, 2009, 4:19:14 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/weapons (added) merged: 2898,2901,2912,2914-2915,2918-2924,2969,2979,2981,2983,2987,3012
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/Billboard.cc
r2896 r3053 47 47 this->material_ = ""; 48 48 this->colour_ = ColourValue::White; 49 // this->rotation_ = 0; 49 50 50 51 this->registerVariables(); … … 66 67 XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode); 67 68 XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White); 69 // XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0); 68 70 } 69 71 … … 72 74 registerVariable(this->material_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial)); 73 75 registerVariable(this->colour_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour)); 76 // registerVariable(this->rotation_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation)); 74 77 } 75 78 … … 87 90 this->attachOgreObject(this->billboard_.getBillboardSet()); 88 91 this->billboard_.setVisible(this->isVisible()); 92 // this->changedRotation(); 89 93 } 90 94 } … … 110 114 this->billboard_.setColour(this->colour_); 111 115 } 116 117 /* 118 void Billboard::changedRotation() 119 { 120 if (this->billboard_.getBillboardSet()) 121 this->billboard_.getBillboardSet()->setRotation(this->rotation_); 122 } 123 */ 112 124 113 125 void Billboard::changedVisibility() -
code/trunk/src/orxonox/objects/worldentities/Billboard.h
r2826 r3053 61 61 inline const ColourValue& getColour() const 62 62 { return this->colour_; } 63 63 /* 64 inline void setRotation(const Radian& rotation) 65 { this->rotation_ = rotation; this->changedRotation(); } 66 inline const Radian& getRotation() const 67 { return this->rotation_; } 68 */ 64 69 virtual void setTeamColour(const ColourValue& colour) 65 70 { this->setColour(colour); } … … 73 78 private: 74 79 void changedMaterial(); 80 // void changedRotation(); 75 81 76 82 BillboardSet billboard_; 77 83 std::string material_; 78 84 ColourValue colour_; 85 // Radian rotation_; 79 86 }; 80 87 } -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
r3049 r3053 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 33 #include "MobileEntity.h" 35 #include "objects/weaponSystem/WeaponSystem.h"36 34 37 35 namespace orxonox … … 82 80 { this->rotateRoll(Vector2(value, 0)); } 83 81 84 virtual void fire( WeaponMode::Enum fireMode) {}85 virtual void altFire(WeaponMode::Enum fireMode) {}82 virtual void fire(unsigned int firemode) {} 83 virtual void reload() {} 86 84 87 85 virtual void boost() {} -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3038 r3053 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 … … 52 56 this->fire_ = 0x0; 53 57 this->firehack_ = 0x0; 58 this->bReload_ = false; 54 59 55 60 this->health_ = 0; … … 66 71 { 67 72 this->weaponSystem_ = new WeaponSystem(this); 68 this->weaponSystem_->setPa rentPawn(this);73 this->weaponSystem_->setPawn(this); 69 74 } 70 75 else … … 100 105 XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7); 101 106 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);107 XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode); 108 XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode); 109 XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode); 105 110 } 106 111 … … 111 116 registerVariable(this->initialHealth_, variableDirection::toclient); 112 117 registerVariable(this->fire_, variableDirection::toserver); 118 registerVariable(this->bReload_, variableDirection::toserver); 113 119 } 114 120 … … 117 123 SUPER(Pawn, tick, dt); 118 124 119 if (this->weaponSystem_) 120 { 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); 127 } 125 if (this->weaponSystem_ && GameMode::isMaster()) 126 { 127 for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++) 128 if (this->fire_ & WeaponSystem::getFiremodeMask(firemode)) 129 this->weaponSystem_->fire(firemode); 130 131 if (this->bReload_) 132 this->weaponSystem_->reload(); 133 } 134 128 135 this->fire_ = this->firehack_; 129 136 this->firehack_ = 0x0; 137 this->bReload_ = false; 130 138 131 139 if (this->health_ <= 0) … … 251 259 } 252 260 253 void Pawn::fire(WeaponMode::Enum fireMode) 254 { 255 this->firehack_ |= fireMode; 261 void Pawn::fire(unsigned int firemode) 262 { 263 this->firehack_ |= WeaponSystem::getFiremodeMask(firemode); 264 } 265 266 void Pawn::reload() 267 { 268 this->bReload_ = true; 256 269 } 257 270 … … 274 287 * --> e.g. Pickup-Items 275 288 */ 276 void Pawn:: setWeaponSlot(WeaponSlot * wSlot)289 void Pawn::addWeaponSlot(WeaponSlot * wSlot) 277 290 { 278 291 this->attach(wSlot); 279 292 if (this->weaponSystem_) 280 this->weaponSystem_->a ttachWeaponSlot(wSlot);293 this->weaponSystem_->addWeaponSlot(wSlot); 281 294 } 282 295 … … 284 297 { 285 298 if (this->weaponSystem_) 286 return this->weaponSystem_->getWeaponSlot Pointer(index);299 return this->weaponSystem_->getWeaponSlot(index); 287 300 else 288 301 return 0; 289 302 } 290 303 291 void Pawn::setWeaponPack(WeaponPack * wPack) 292 { 293 if (this->weaponSystem_) 294 { 295 wPack->setParentWeaponSystem(this->weaponSystem_); 296 wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_); 297 this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() ); 298 wPack->attachNeededMunitionToAllWeapons(); 299 } 300 } 301 302 WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const 303 { 304 if (this->weaponSystem_) 305 return this->weaponSystem_->getWeaponPackPointer(firemode); 304 void Pawn::addWeaponSet(WeaponSet * wSet) 305 { 306 if (this->weaponSystem_) 307 this->weaponSystem_->addWeaponSet(wSet); 308 } 309 310 WeaponSet * Pawn::getWeaponSet(unsigned int index) const 311 { 312 if (this->weaponSystem_) 313 return this->weaponSystem_->getWeaponSet(index); 306 314 else 307 315 return 0; 308 316 } 309 317 310 void Pawn:: setWeaponSet(WeaponSet * wSet)311 { 312 if (this->weaponSystem_) 313 this->weaponSystem_->a ttachWeaponSet(wSet);314 } 315 316 Weapon Set * Pawn::getWeaponSet(unsigned int index) const317 { 318 if (this->weaponSystem_) 319 return this->weaponSystem_->getWeapon SetPointer(index);318 void Pawn::addWeaponPack(WeaponPack * wPack) 319 { 320 if (this->weaponSystem_) 321 this->weaponSystem_->addWeaponPack(wPack); 322 } 323 324 WeaponPack * Pawn::getWeaponPack(unsigned int index) const 325 { 326 if (this->weaponSystem_) 327 return this->weaponSystem_->getWeaponPack(index); 320 328 else 321 329 return 0; -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r3038 r3053 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); … … 76 77 virtual void kill(); 77 78 78 virtual void fire(WeaponMode::Enum fireMode); 79 virtual void fire(unsigned int firemode); 80 virtual void reload(); 79 81 virtual void postSpawn(); 80 82 81 void setWeaponSlot(WeaponSlot * wSlot);83 void addWeaponSlot(WeaponSlot * wSlot); 82 84 WeaponSlot * getWeaponSlot(unsigned int index) const; 83 void setWeaponPack(WeaponPack * wPack); 84 WeaponPack * getWeaponPack(unsigned int firemode) const; 85 void setWeaponSet(WeaponSet * wSet); 85 void addWeaponSet(WeaponSet * wSet); 86 86 WeaponSet * getWeaponSet(unsigned int index) const; 87 void addWeaponPack(WeaponPack * wPack); 88 WeaponPack * getWeaponPack(unsigned int index) const; 87 89 88 90 inline const WorldEntity* getWorldEntity() const … … 130 132 unsigned int fire_; 131 133 unsigned int firehack_; 134 bool bReload_; 132 135 133 136 std::string spawnparticlesource_; 134 137 float spawnparticleduration_; 135 138 unsigned int numexplosionchunks_; 139 140 private: 141 inline void setWeaponSystem(WeaponSystem* weaponsystem) 142 { this->weaponSystem_ = weaponsystem; } 136 143 }; 137 144 -
code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
r3039 r3053 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/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h
r3038 r3053 54 54 virtual void rotateRoll(const Vector2& value); 55 55 56 virtual void fire( WeaponMode::Enum fireMode);56 virtual void fire(unsigned int firemode); 57 57 virtual void greet(); 58 58
Note: See TracChangeset
for help on using the changeset viewer.