Changeset 3053 for code/trunk
- Timestamp:
- May 25, 2009, 4:19:14 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 14 edited
- 50 copied
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/OrxonoxPrereqs.h
r3049 r3053 74 74 } 75 75 76 //put here all existing munitionTypes77 namespace MunitionType78 {79 enum Enum80 { laserGunMunition };81 }82 83 //put here all weapon fire modes.84 //they have to be added to Pawn and HumanController, too.85 namespace WeaponMode86 {87 enum Enum88 {89 fire = 0x1,90 altFire = 0x2,91 altFire2 = 0x492 };93 }94 95 96 76 class GraphicsManager; 97 77 class OgreWindowEventListener; … … 182 162 class WeaponPack; 183 163 class Weapon; 164 class WeaponMode; 165 class DefaultWeaponmodeLink; 166 class MuzzleFlash; 167 168 class LaserFire; 169 class FusionFire; 170 class HsW01; 171 class LightningGun; 172 class EnergyDrink; 173 174 class ReplenishingMunition; 184 175 class Munition; 185 class LaserGun; 186 class LaserGunMunition; 176 class LaserMunition; 187 177 class FusionMunition; 178 179 class Projectile; 180 class BillboardProjectile; 181 class ParticleProjectile; 182 class LightningGunProjectile; 188 183 189 184 class EventListener; -
code/trunk/src/orxonox/objects/CMakeLists.txt
r2826 r3053 22 22 ADD_SUBDIRECTORY(pickup) 23 23 ADD_SUBDIRECTORY(quest) 24 ADD_SUBDIRECTORY(weapon System)24 ADD_SUBDIRECTORY(weaponsystem) 25 25 ADD_SUBDIRECTORY(worldentities) 26 26 -
code/trunk/src/orxonox/objects/controllers/AIController.cc
r3049 r3053 111 111 112 112 if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0)) 113 this->getControllableEntity()->fire( WeaponMode::fire);113 this->getControllableEntity()->fire(0); 114 114 115 115 SUPER(AIController, tick, dt); -
code/trunk/src/orxonox/objects/controllers/HumanController.cc
r3038 r3053 46 46 SetConsoleCommand(HumanController, rotateRoll, true).setAsInputCommand(); 47 47 SetConsoleCommand(HumanController, fire, true).keybindMode(KeybindMode::OnHold); 48 SetConsoleCommand(HumanController, altFire, true).keybindMode(KeybindMode::OnHold);48 SetConsoleCommand(HumanController, reload, true); 49 49 SetConsoleCommand(HumanController, boost, true).keybindMode(KeybindMode::OnHold); 50 50 SetConsoleCommand(HumanController, greet, true); … … 109 109 } 110 110 111 void HumanController::fire( )111 void HumanController::fire(unsigned int firemode) 112 112 { 113 113 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 114 HumanController::localController_s->controllableEntity_->fire( WeaponMode::fire);114 HumanController::localController_s->controllableEntity_->fire(firemode); 115 115 } 116 116 117 void HumanController:: altFire()117 void HumanController::reload() 118 118 { 119 119 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 120 HumanController::localController_s->controllableEntity_-> fire(WeaponMode::altFire);120 HumanController::localController_s->controllableEntity_->reload(); 121 121 } 122 122 -
code/trunk/src/orxonox/objects/controllers/HumanController.h
r2662 r3053 51 51 static void rotateRoll(const Vector2& value); 52 52 53 static void fire( );54 static void altFire();53 static void fire(unsigned int firemode); 54 static void reload(); 55 55 56 56 static void boost(); -
code/trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc
r3049 r3053 68 68 69 69 if (this->getControllableEntity() && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0)) 70 this->getControllableEntity()->fire( WeaponMode::fire);70 this->getControllableEntity()->fire(0); 71 71 } 72 72 else -
code/trunk/src/orxonox/objects/weaponsystem/Munition.cc
r3052 r3053 404 404 return (this->magazines_ >= amount); 405 405 } 406 407 return false; 406 408 } 407 409 -
code/trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
- Property svn:eol-style set to native
r3052 r3053 52 52 this->speed_ = 2500; 53 53 this->delay_ = 0; 54 this->setMunitionName(" EnergyDrink");54 this->setMunitionName("FusionMunition"); 55 55 56 56 this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot))); … … 104 104 { 105 105 Projectile* projectile = new Projectile(this); 106 107 108 109 110 106 Model* model = new Model(projectile); 107 model->setMeshSource("can.mesh"); 108 model->setCastShadows(false); 109 projectile->attach(model); 110 model->setScale(5); 111 111 112 112 projectile->setOrientation(this->getMuzzleOrientation()); -
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
- Property svn:eol-style set to native
r3052 r3053 52 52 this->speed_ = 2500; 53 53 this->delay_ = 0; 54 this->setMunitionName(" HsW01");54 this->setMunitionName("LaserMunition"); 55 55 56 56 this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot))); … … 104 104 { 105 105 Projectile* projectile = new Projectile(this); 106 107 108 109 110 106 Model* model = new Model(projectile); 107 model->setMeshSource("laserbeam.mesh"); 108 model->setCastShadows(false); 109 projectile->attach(model); 110 model->setScale(5); 111 111 112 112 projectile->setOrientation(this->getMuzzleOrientation()); -
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h
- Property svn:mergeinfo deleted
-
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
- Property svn:eol-style set to native
r3052 r3053 53 53 this->damage_ = 100; 54 54 this->speed_ = 150; 55 55 56 56 this->setMunitionName("LaserMunition"); 57 57 } 58 58 59 59 LightningGun::~LightningGun() 60 60 { … … 65 65 LightningGunProjectile* projectile = new LightningGunProjectile(this); 66 66 projectile->setMaterial("Flares/LightningBall_"); 67 67 68 68 projectile->setOrientation(this->getMuzzleOrientation()); 69 69 projectile->setPosition(this->getMuzzlePosition()); -
code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
- Property svn:eol-style set to native
-
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.