Changeset 11208 for code/branches/presentationFS16
- Timestamp:
- May 26, 2016, 4:53:34 PM (9 years ago)
- Location:
- code/branches/presentationFS16
- Files:
-
- 47 edited
- 9 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationFS16
- Property svn:mergeinfo changed
/code/branches/sagerjFS16 (added) merged: 11138,11142,11153,11164,11166,11170,11174-11175,11185,11189,11205
- Property svn:mergeinfo changed
-
code/branches/presentationFS16/data/defaultConfig/keybindings.ini
r10622 r11208 122 122 KeyStop= 123 123 KeySystemRequest="printScreen" 124 KeyT= "onpress fire 3"124 KeyT= onpress push 3 | onrelease release 3 125 125 KeyTab="NewHumanController changeMode" 126 126 KeyU="" … … 132 132 KeyVolumeDown= 133 133 KeyVolumeUp= 134 KeyW="scale 1 moveFrontBack "134 KeyW="scale 1 moveFrontBack " 135 135 KeyWake= 136 136 KeyWebBack= … … 142 142 KeyWebStop= 143 143 KeyX="selectClosest" 144 KeyY= "onpress fire 4"144 KeyY= onpress push 4 | onrelease release 4 145 145 KeyYen= 146 146 KeyZ="selectNext" … … 152 152 Button6= 153 153 Button7= 154 Left= "fire 0"155 Middle= "fire 2"156 Right= fire 1 | unfire154 Left= push 0 | release 0 155 Middle= push 2 | release 2 156 Right= push 1 | release 1 157 157 Wheel1Down="NewHumanController decelerate" 158 158 Wheel1Up="NewHumanController accelerate" -
code/branches/presentationFS16/data/gui/scripts/KeyBindMenu.lua
r8232 r11208 7 7 8 8 commandList = {} 9 table.insert(commandList, "fire 0" )10 table.insert(commandList, "fire 1 | unfire")11 table.insert(commandList, "onpress fire 2" )12 table.insert(commandList, "onpress fire 3" )9 table.insert(commandList, "fire 0" | "release 0") 10 table.insert(commandList, "fire 1" | "release 1") 11 table.insert(commandList, "onpress fire 2" | "onrelease release 2") 12 table.insert(commandList, "onpress fire 3" | "onrelease release 3") 13 13 table.insert(commandList, "scale 1 moveFrontBack") 14 14 table.insert(commandList, "scale -1 moveFrontBack") -
code/branches/presentationFS16/data/levels/emptyLevel.oxw
r11199 r11208 13 13 14 14 <?lua 15 include("templates/spaceshipEscort .oxt")15 include("templates/spaceshipEscortDischarger.oxt") 16 16 include("templates/spaceshipHover.oxt") 17 17 ?> … … 29 29 30 30 <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"/> 31 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />31 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescortdischarger /> 32 32 33 33 <SpaceShip position="0,0,0" lookat="0,0,0" > -
code/branches/presentationFS16/data/levels/includes/weaponSettingsEscort.oxi
r11052 r11208 1 1 <weaponslots> 2 <WeaponSlot position="-9.2,2,-13" /> 3 <WeaponSlot position=" 9.2,2,-13" /> 2 <WeaponSlot 3 position="-9.2,2,-13" 4 /> 4 5 </weaponslots> 6 5 7 <weaponsets> 6 <WeaponSet firemode=0 /> 7 <WeaponSet firemode=1 /> 8 <WeaponSet 9 firemode=0 10 /> 8 11 </weaponsets> 12 9 13 <weaponpacks> 10 14 <WeaponPack> 11 15 <links> 12 <DefaultWeaponmodeLink firemode=0 weaponmode=0 /> 13 <DefaultWeaponmodeLink firemode=1 weaponmode=1 /> 16 <DefaultWeaponmodeLink 17 firemode=0 18 weaponmode=0 19 /> 14 20 </links> 15 21 <Weapon> 16 <HsW01 mode=0 munitionpershot=1 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="LaserBeam2.mesh" /> 22 <Discharger 23 mode=0 24 munitionpershot=1 25 delay=0 26 damage=0.8 27 material="Flares/point_lensflare" 28 muzzleoffset=" 1.6, 1.3, -2.0" 29 projectileMesh="LaserBeam2.mesh" 30 /> 17 31 </Weapon> 18 <Weapon> 19 <HsW01 mode=0 munitionpershot=1 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" /> 20 </Weapon> 32 21 33 </WeaponPack> 22 <WeaponPack> 23 <links> 24 <DefaultWeaponmodeLink firemode=1 weaponmode=0 /> 25 </links> 26 </WeaponPack> 34 27 35 </weaponpacks> 28 36 <munition> 29 <LaserMunition initialmagazines=8 maxmagazines=8 munitionpermagazine=10 replenishamount=1 replenishinterval=7.5/> 37 <LaserMunition 38 initialmagazines=2 39 maxmagazines=2 40 munitionpermagazine=10 41 replenishamount=1 42 replenishinterval=2 43 /> 30 44 </munition> -
code/branches/presentationFS16/data/levels/missionOne.oxw
r11052 r11208 12 12 include("templates/lodInformation.oxt") 13 13 include("templates/spaceshipAssff.oxt") 14 include("templates/spaceshipEscort.oxt") 14 15 include("templates/spaceshipPirate.oxt") 15 16 include("templates/spaceshipSpacecruiser.oxt") … … 57 58 <events> 58 59 <trigger> 59 <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceship assff>60 <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort> 60 61 <EventTrigger invert=true> 61 62 <events> -
code/branches/presentationFS16/data/overlays/HUDTemplates3.oxo
r11052 r11208 184 184 weaponModeHUDSize = "0.09, 0.03" 185 185 /> 186 187 <HUDChargeBar 188 name = "ChargeBar" 189 background = "Orxonox/BarBackground" 190 size = "0.40, 0.04" 191 position = "0.0 , 0.5 " 192 pickpoint = "0, 1" 193 correctaspect = true 194 iconmaterial = "Orxonox/BarIconCharge" 195 > 196 <BarColour position = 0.0 colour = "0.7,0.5,0.2" /> 197 <BarColour position = 0.5 colour = "0.2,0.7,0.2" /> 198 <BarColour position = 1.0 colour = "0.7,0.2,0.2" /> 199 </HUDChargeBar> 186 200 187 201 <HUDTimer -
code/branches/presentationFS16/src/modules/invader/InvaderEnemyShooter.cc
r11083 r11208 71 71 void InvaderEnemyShooter::shoot() 72 72 { 73 ControllableEntity:: fire(0);73 ControllableEntity::push(0); 74 74 } 75 75 -
code/branches/presentationFS16/src/modules/invader/InvaderShip.cc
r11071 r11208 91 91 // shoot! 92 92 if (isFireing) 93 ControllableEntity:: fire(0);93 ControllableEntity::push(0); 94 94 95 95 // Camera -
code/branches/presentationFS16/src/modules/jump/JumpFigure.cc
r11071 r11208 398 398 } 399 399 400 void JumpFigure:: fire(unsigned int firemode)401 { 402 403 } 404 405 void JumpFigure:: fired(unsigned int firemode)400 void JumpFigure::push(unsigned int firemode) 401 { 402 403 } 404 405 void JumpFigure::pushed(unsigned int firemode) 406 406 { 407 407 firePressed_ = true; -
code/branches/presentationFS16/src/modules/jump/JumpFigure.h
r11105 r11208 47 47 virtual void rotatePitch(const Vector2& value) override; 48 48 virtual void rotateRoll(const Vector2& value) override; 49 void fire(unsigned int firemode);50 virtual void fired(unsigned int firemode) override;49 void push(unsigned int firemode); 50 virtual void pushed(unsigned int firemode) override; 51 51 virtual void JumpFromPlatform(JumpPlatform* platform); 52 52 virtual void JumpFromSpring(JumpSpring* spring); -
code/branches/presentationFS16/src/modules/objects/controllers/TurretController.cc
r11071 r11208 198 198 { 199 199 200 this->getControllableEntity()-> fire(0);200 this->getControllableEntity()->push(0); 201 201 } 202 202 } -
code/branches/presentationFS16/src/modules/overlays/hud/CMakeLists.txt
r11052 r11208 14 14 HUDWeapon.cc 15 15 HUDWeaponSystem.cc 16 HUDChargeBar.cc 16 17 ChatOverlay.cc 17 18 AnnounceMessage.cc -
code/branches/presentationFS16/src/modules/towerdefense/TowerDefenseSelecter.cc
r11071 r11208 146 146 } 147 147 148 void TowerDefenseSelecter:: fire(unsigned int firemode)148 void TowerDefenseSelecter::push(unsigned int firemode) 149 149 { 150 150 } 151 151 152 void TowerDefenseSelecter:: fired(unsigned int firemode)152 void TowerDefenseSelecter::pushed(unsigned int firemode) 153 153 { 154 154 -
code/branches/presentationFS16/src/modules/towerdefense/TowerDefenseSelecter.h
r11071 r11208 47 47 virtual void rotatePitch(const Vector2& value) override; 48 48 virtual void rotateRoll(const Vector2& value) override; 49 void fire(unsigned int firemode);50 virtual void fired(unsigned int firemode) override;49 void push(unsigned int firemode); 50 virtual void pushed(unsigned int firemode) override; 51 51 virtual void boost(bool bBoost) override; 52 52 virtual void setSelectedPosition(TDCoordinate* newPos); -
code/branches/presentationFS16/src/modules/weapons/WeaponsPrereqs.h
r11052 r11208 107 107 class SimpleRocketFire; 108 108 class GravityBombFire; 109 class Discharger; 109 110 } 110 111 -
code/branches/presentationFS16/src/modules/weapons/projectiles/Rocket.cc
r11071 r11208 218 218 Destroys the Rocket upon pressing "fire". 219 219 */ 220 void Rocket:: fired(unsigned int firemode)220 void Rocket::pushed(unsigned int firemode) 221 221 { 222 222 this->destroyObject(); -
code/branches/presentationFS16/src/modules/weapons/projectiles/Rocket.h
r11071 r11208 116 116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) override;118 virtual void pushed(unsigned int firemode) override; 119 119 120 120 /** -
code/branches/presentationFS16/src/modules/weapons/projectiles/RocketOld.cc
r11071 r11208 218 218 Destroys the RocketOld upon pressing "fire". 219 219 */ 220 void RocketOld:: fired(unsigned int firemode)220 void RocketOld::pushed(unsigned int firemode) 221 221 { 222 222 this->destroyObject(); -
code/branches/presentationFS16/src/modules/weapons/projectiles/RocketOld.h
r11071 r11208 116 116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) override;118 virtual void pushed(unsigned int firemode) override; 119 119 120 120 private: -
code/branches/presentationFS16/src/modules/weapons/weaponmodes/CMakeLists.txt
r11108 r11208 13 13 GravityBombFire.cc 14 14 MineGun.cc 15 Discharger.cc 15 16 ) -
code/branches/presentationFS16/src/orxonox/controllers/AIController.cc
r11071 r11208 197 197 if (this->bHasTargetPosition_) 198 198 this->moveToTargetPosition(); 199 this->do Fire();199 this->doPush(); 200 200 } 201 201 … … 227 227 this->moveToTargetPosition(); 228 228 229 this->do Fire();229 this->doPush(); 230 230 } 231 231 } … … 241 241 if((timeout_< 0)||(!target_))//Check if the timeout is over or target died. 242 242 { 243 controllable-> fire(0);//kill the rocket243 controllable->push(0);//kill the rocket 244 244 this->setPreviousMode();//get out of rocket mode 245 245 } -
code/branches/presentationFS16/src/orxonox/controllers/ArtificialController.cc
r11099 r11208 132 132 @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all. 133 133 */ 134 void ArtificialController::do Fire()134 void ArtificialController::doPush() 135 135 { 136 136 if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ... … … 144 144 if (this->isCloseAtTarget(130) && (firemode = getFiremode("LightningGun")) > -1 ) 145 145 {//LENSFLARE: short range weapon 146 this->getControllableEntity()-> fire(firemode); //ai uses lens flare if they're close enough to the target146 this->getControllableEntity()->push(firemode); //ai uses lens flare if they're close enough to the target 147 147 } 148 148 else if( this->isCloseAtTarget(400) && (random < this->botlevel_) && (firemode = getFiremode("RocketFire")) > -1 ) 149 149 {//ROCKET: mid range weapon 150 150 this->mode_ = ROCKET; //Vector-implementation: mode_.push_back(ROCKET); 151 this->getControllableEntity()-> fire(firemode); //launch rocket151 this->getControllableEntity()->push(firemode); //launch rocket 152 152 if(this->getControllableEntity() && this->target_) //after fire(3) is called, getControllableEntity() refers to the rocket! 153 153 { … … 161 161 } 162 162 else if ((firemode = getFiremode("HsW01")) > -1 ) //LASER: default weapon 163 this->getControllableEntity()-> fire(firemode);163 this->getControllableEntity()->push(firemode); 164 164 } 165 165 } -
code/branches/presentationFS16/src/orxonox/controllers/ArtificialController.h
r11071 r11208 48 48 virtual void changedControllableEntity() override; 49 49 50 virtual void do Fire();50 virtual void doPush(); 51 51 void setBotLevel(float level=1.0f); 52 52 inline float getBotLevel() const -
code/branches/presentationFS16/src/orxonox/controllers/DroneController.cc
r11071 r11208 130 130 this->aimAtTarget(); 131 131 if(!this->friendlyFire()) 132 this->getDrone()-> fire(0);132 this->getDrone()->push(0); 133 133 } 134 134 } -
code/branches/presentationFS16/src/orxonox/controllers/FightingController.cc
r11083 r11208 318 318 } 319 319 320 this->getControllableEntity()-> fire(firemode);320 this->getControllableEntity()->push(firemode); 321 321 322 322 } -
code/branches/presentationFS16/src/orxonox/controllers/HumanController.cc
r11071 r11208 40 40 namespace orxonox 41 41 { 42 extern const std::string __CC_ fire_name = "fire";42 extern const std::string __CC_push_name = "push"; 43 43 extern const std::string __CC_suicide_name = "suicide"; 44 extern const std::string __CC_release_name = "release"; 44 45 45 46 SetConsoleCommand("HumanController", "moveFrontBack", &HumanController::moveFrontBack ).addShortcut().setAsInputCommand(); … … 51 52 SetConsoleCommand("HumanController", "toggleFormationFlight", &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress); 52 53 SetConsoleCommand("HumanController", "FFChangeMode", &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress); 53 SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold); 54 SetConsoleCommand("HumanController", __CC_push_name, &HumanController::push ).addShortcut().keybindMode(KeybindMode::OnHold); 55 SetConsoleCommand("HumanController", __CC_release_name, &HumanController::release ).addShortcut().keybindMode(KeybindMode::OnRelease); 54 56 SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut(); 55 57 SetConsoleCommand("HumanController", "boost", &HumanController::boost ).addShortcut().setAsInputCommand().keybindMode(KeybindMode::OnPressAndRelease); … … 155 157 } 156 158 157 void HumanController:: fire(unsigned int firemode)158 { 159 if (HumanController::localController_s) 160 HumanController::localController_s->do Fire(firemode);161 } 162 163 void HumanController::do Fire(unsigned int firemode)164 { 165 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 166 { 167 HumanController::localController_s->controllableEntity_-> fire(firemode);159 void HumanController::push(unsigned int firemode) 160 { 161 if (HumanController::localController_s) 162 HumanController::localController_s->doPush(firemode); 163 } 164 165 void HumanController::doPush(unsigned int firemode) 166 { 167 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 168 { 169 HumanController::localController_s->controllableEntity_->push(firemode); 168 170 //if human fires, set slaves free. See FormationController::forceFreeSlaves() 171 if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL) 172 { 173 HumanController::localController_s->forceFreeSlaves(); 174 } 175 } 176 } 177 178 void HumanController::release(unsigned int firemode) 179 { 180 if (HumanController::localController_s) 181 HumanController::localController_s->doRelease(firemode); 182 } 183 184 void HumanController::doRelease(unsigned int firemode) 185 { 186 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 187 { 188 HumanController::localController_s->controllableEntity_->release(firemode); 189 //if human releases, set slaves free. See FormationController::forceFreeSlaves() 169 190 if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL) 170 191 { -
code/branches/presentationFS16/src/orxonox/controllers/HumanController.h
r11071 r11208 61 61 virtual void pitch(const Vector2& value); 62 62 63 static void fire(unsigned int firemode); 64 virtual void doFire(unsigned int firemode); 63 static void push(unsigned int firemode); 64 virtual void doPush(unsigned int firemode); 65 static void release(unsigned int firemode); 66 virtual void doRelease(unsigned int firemode); 65 67 static void reload(); 66 68 -
code/branches/presentationFS16/src/orxonox/controllers/NewHumanController.cc
r11071 r11208 54 54 SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress); 55 55 SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress); 56 SetConsoleCommand("NewHumanController", "unfire", &NewHumanController::unfire ).keybindMode(KeybindMode::OnRelease).addShortcut();57 56 58 57 RegisterUnloadableClass(NewHumanController); … … 277 276 } 278 277 279 void NewHumanController::do Fire(unsigned int firemode)278 void NewHumanController::doPush(unsigned int firemode) 280 279 { 281 280 if (!this->controllableEntity_) … … 291 290 } 292 291 else 293 HumanController::doFire(firemode); //call for formationflight 292 { 293 HumanController::doPush(firemode); //call for formationflight 294 } 295 } 296 297 void NewHumanController::doRelease(unsigned int firemode) 298 { 299 if (!this->controllableEntity_) 300 return; 301 302 this->firemode_ = firemode; 303 304 HumanController::doRelease(firemode); //call for formationflight 294 305 } 295 306 … … 342 353 } 343 354 } 344 }345 346 void NewHumanController::unfire()347 {348 if (NewHumanController::localController_s)349 NewHumanController::localController_s->doUnfire();350 }351 352 void NewHumanController::doUnfire()353 {354 this->firemode_ = -1;355 hideArrows();356 355 } 357 356 -
code/branches/presentationFS16/src/orxonox/controllers/NewHumanController.h
r11071 r11208 54 54 static void decelerate(); 55 55 56 virtual void doFire(unsigned int firemode) override; 56 virtual void doPush(unsigned int firemode) override; 57 virtual void doRelease(unsigned int firemode) override; 57 58 58 59 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override; 59 60 static void unfire();61 virtual void doUnfire();62 60 63 61 void centerCursor(); -
code/branches/presentationFS16/src/orxonox/controllers/WaypointPatrolController.cc
r11071 r11208 69 69 70 70 if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f)) 71 this->getControllableEntity()-> fire(0);71 this->getControllableEntity()->push(0); 72 72 } 73 73 else -
code/branches/presentationFS16/src/orxonox/weaponsystem/Weapon.cc
r11071 r11208 99 99 Fire this Weapon with the the WeaponMode defined by @param mode 100 100 */ 101 void Weapon:: fire(unsigned int mode)101 void Weapon::push(unsigned int mode) 102 102 { 103 103 // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for … … 114 114 // Note: The reloading of each WeaponMode is internally handled by each A, B and C. 115 115 // The reloading of the weapon is only performed to avoid firing with different modes at the same time. 116 117 116 118 if (this->bReloading_ && this->reloadingWeaponmode_ != mode) 117 119 return; … … 123 125 { 124 126 float reloading_time = 0; 125 if (it->second->fire(&reloading_time)) 127 if (it->second->push(&reloading_time)) 128 { 129 this->bReloading_ = true; 130 this->reloadingWeaponmode_ = mode; 131 132 this->reloadTimer_.setInterval(reloading_time); 133 this->reloadTimer_.startTimer(); 134 } 135 } 136 } 137 138 void Weapon::release(unsigned int mode) 139 { 140 if (this->bReloading_ && this->reloadingWeaponmode_ != mode) 141 return; 142 143 std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode); 144 std::multimap<unsigned int, WeaponMode*>::iterator end = this->weaponmodes_.upper_bound(mode); 145 146 for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it) 147 { 148 float reloading_time = 0; 149 if (it->second->release(&reloading_time)) 126 150 { 127 151 this->bReloading_ = true; -
code/branches/presentationFS16/src/orxonox/weaponsystem/Weapon.h
r11071 r11208 52 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 void fire(unsigned int mode); 54 void push(unsigned int mode); 55 void release(unsigned int mode); 55 56 void reload(); 56 57 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11108 r11208 24 24 * Fabian 'x3n' Landau 25 25 * Co-authors: 26 * ...26 * Johannes Sager 27 27 * 28 28 */ … … 63 63 this->bAutoReload_ = true; 64 64 this->bParallelReload_ = true; 65 this->chargeable_ = false; // most weapons are not chargeable 66 this->charges_ = 0; // always start with no charges 67 this->maxCharges_ = 100; // default maximum charges one can have are 100 65 68 66 69 this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this))); … … 121 124 { 122 125 (*reloadTime) = this->reloadTime_; 123 124 126 // Fireing is only possible if this weapon mode is not reloading and there is enough munition 125 127 if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this)) … … 169 171 } 170 172 173 bool WeaponMode::push(float* reloadTime) 174 { 175 176 if( this->chargeable_) // chargeable weapons are supposed to charge on push 177 { 178 this->munition_ = this->weapon_->getWeaponPack()->getWeaponSystem()->getMunition(&this->munitiontype_); // updates the pointer to the munition(which we use in the next step) 179 if(this->charges_ < this->maxCharges_ && this->bReloading_ == false && this->munition_->canTakeMunition(1, this)) // charges up unless: 180 { // - we are fully charged 181 this->charges_ += 1; // - we are reloading 182 } // - we have no munition 183 return false; 184 } 185 else // normal (not chargeable) weapons are supposed to fire on push 186 { 187 return fire(reloadTime); 188 } 189 } 190 191 bool WeaponMode::release(float* reloadTime) 192 { 193 if( this->chargeable_) // chargeable weapons are supposed to fire on release 194 { 195 return fire(reloadTime); 196 } 197 else // normal (not chargeable) weapons should do nothing on release 198 { 199 return false; 200 } 201 } 202 171 203 bool WeaponMode::reload() 172 204 { -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponMode.h
r11108 r11208 24 24 * Fabian 'x3n' Landau 25 25 * Co-authors: 26 * ...26 * Johannes Sager 27 27 * 28 28 */ … … 45 45 /** 46 46 @brief 47 A WeaponMode defines how a Weapon is used. It specifies what kind of @ref orxonox::Projectile is created when you fire it, how much time it takes to reload, what sound you hear while shooting, how much damage the projectile deals to a target, ... 47 A WeaponMode defines how a Weapon is used. It specifies what kind of 48 @ref orxonox::Projectile is created when you fire it, how much time it takes to reload, 49 what sound you hear while shooting, how much damage the projectile deals to a target, ... 48 50 */ 49 51 class _OrxonoxExport WeaponMode : public BaseObject … … 55 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 56 58 59 virtual bool push(float* reloadTime); 60 virtual bool release(float* reloadTime); 57 61 virtual bool fire(float* reloadTime); 58 62 bool reload(); … … 106 110 107 111 // Fire 112 inline unsigned int getMaxCharges() // get the maximum of charges one can have 113 { return this->maxCharges_;} 114 inline unsigned int getCharges() // get the current amount of charges 115 { return this->charges_;} 116 inline bool isChargeable() // returns if the weaponmode is chargeable 117 { return this->chargeable_;} 108 118 inline void setDamage(float damage) 109 119 { this->damage_ = damage;} … … 166 176 unsigned int initialMagazines_; 167 177 unsigned int munitionPerShot_; 178 unsigned int charges_; // current amount of charges only matters for chargeable weapons(chargeable == true) 179 unsigned int maxCharges_; // maximum amount of charges (is initialized with 100 in weaponmode.cc) only matters for chargeable weapons(chargeable == true) 168 180 169 181 float reloadTime_; 170 bool bAutoReload_; // If true, the weapon reloads the magazine automatically. 171 bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading. 182 bool bAutoReload_; // If true, the weapon reloads the magazine automatically. 183 bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading. 184 bool chargeable_; // If true, the weapon charges up on push and fires on release 172 185 173 186 float damage_; … … 189 202 190 203 Timer reloadTimer_; 191 bool bReloading_; // If true, this weapon mode is marked as reloading.204 bool bReloading_; // If true, this weapon mode is marked as reloading. 192 205 193 206 Vector3 muzzlePosition_; 194 207 Quaternion muzzleOrientation_; 195 208 196 std::string fireSoundPath_; // The path of the sound played when fireing197 float fireSoundVolume_; // The volume of the sound played when fireing198 std::vector<WorldSound*> fireSounds_; // List of sounds used by the weapon mode. Because multiple sounds may overlap, we need mor than one WorldSound instance.199 std::string reloadSoundPath_; // The path of the sound played when reloading200 float reloadSoundVolume_; // The volume of the sound played when reloading209 std::string fireSoundPath_; // The path of the sound played when fireing 210 float fireSoundVolume_; // The volume of the sound played when fireing 211 std::vector<WorldSound*> fireSounds_; // List of sounds used by the weapon mode. Because multiple sounds may overlap, we need mor than one WorldSound instance. 212 std::string reloadSoundPath_; // The path of the sound played when reloading 213 float reloadSoundVolume_; // The volume of the sound played when reloading 201 214 WorldSound* reloadSound_; 202 215 }; -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponPack.cc
r11071 r11208 74 74 Fire all weapons in this WeaponSet with the defined weaponmode. 75 75 */ 76 void WeaponPack:: fire(unsigned int weaponmode)76 void WeaponPack::push(unsigned int weaponmode) 77 77 { 78 78 for (Weapon* weapon : this->weapons_) 79 weapon->fire(weaponmode); 79 weapon->push(weaponmode); 80 } 81 82 void WeaponPack::release(unsigned int weaponmode) 83 { 84 for (Weapon* weapon : this->weapons_) 85 weapon->release(weaponmode); 80 86 } 81 87 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponPack.h
r11071 r11208 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 void fire(unsigned int weaponmode); 48 void push(unsigned int weaponmode); 49 void release(unsigned int weaponmode); 49 50 void reload(); 50 51 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSet.cc
r11071 r11208 60 60 } 61 61 62 void WeaponSet:: fire()62 void WeaponSet::push() 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 65 for (const auto& mapEntry : this->weaponpacks_) 66 66 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 67 mapEntry.first->fire(mapEntry.second); 67 mapEntry.first->push(mapEntry.second); 68 } 69 70 void WeaponSet::release() 71 { 72 // Fire all WeaponPacks with their defined weaponmode 73 for (const auto& mapEntry : this->weaponpacks_) 74 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 75 mapEntry.first->release(mapEntry.second); 68 76 } 69 77 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSet.h
r11071 r11208 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 void fire(); 48 void push(); 49 void release(); 49 50 void reload(); 50 51 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSystem.cc
r11099 r11208 287 287 Fires the @ref orxonox::WeaponSet with the specified firemode. 288 288 */ 289 void WeaponSystem:: fire(unsigned int firemode)289 void WeaponSystem::push(unsigned int firemode) 290 290 { 291 291 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 292 292 if (it != this->weaponSets_.end() && it->second) 293 it->second->fire(); 293 it->second->push(); 294 } 295 296 void WeaponSystem::release(unsigned int firemode) 297 { 298 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 299 if (it != this->weaponSets_.end() && it->second) 300 it->second->release(); 294 301 } 295 302 -
code/branches/presentationFS16/src/orxonox/weaponsystem/WeaponSystem.h
r11176 r11208 76 76 void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode); 77 77 78 void fire(unsigned int firemode); 78 void push(unsigned int firemode); 79 void release(unsigned int firemode); 79 80 void reload(); 80 81 -
code/branches/presentationFS16/src/orxonox/worldentities/ControllableEntity.cc
r11071 r11208 49 49 RegisterClass(ControllableEntity); 50 50 51 registerMemberNetworkFunction( ControllableEntity, fire);51 registerMemberNetworkFunction( ControllableEntity, push ); 52 52 registerMemberNetworkFunction( ControllableEntity, setTargetInternal ); 53 53 … … 299 299 } 300 300 301 void ControllableEntity:: fire(unsigned int firemode)301 void ControllableEntity::push(unsigned int firemode) 302 302 { 303 303 if(GameMode::isMaster()) 304 304 { 305 this-> fired(firemode);305 this->pushed(firemode); 306 306 } 307 307 else 308 308 { 309 callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode); 309 callMemberNetworkFunction(&ControllableEntity::push, this->getObjectID(), 0, firemode); 310 } 311 } 312 313 void ControllableEntity::release(unsigned int firemode) 314 { 315 if(GameMode::isMaster()) 316 { 317 this->released(firemode); 318 } 319 else 320 { 321 callMemberNetworkFunction(&ControllableEntity::release, this->getObjectID(), 0, firemode); 310 322 } 311 323 } -
code/branches/presentationFS16/src/orxonox/worldentities/ControllableEntity.h
r11071 r11208 96 96 { this->rotateRoll(Vector2(value, 0)); } 97 97 98 void fire(unsigned int firemode); 99 virtual void fired(unsigned int firemode) {} 98 void push(unsigned int firemode); 99 void release(unsigned int firemode); 100 virtual void pushed(unsigned int firemode) {} 101 virtual void released(unsigned int firemode) {} 100 102 virtual void reload() {} 101 103 -
code/branches/presentationFS16/src/orxonox/worldentities/pawns/Pawn.cc
r11176 r11208 432 432 */ 433 433 434 void Pawn::fired(unsigned int firemode) 435 { 436 if (this->weaponSystem_) 437 this->weaponSystem_->fire(firemode); 434 void Pawn::pushed(unsigned int firemode) 435 { 436 if (this->weaponSystem_) 437 this->weaponSystem_->push(firemode); 438 } 439 440 void Pawn::released(unsigned int firemode) 441 { 442 if (this->weaponSystem_) 443 this->weaponSystem_->release(firemode); 438 444 } 439 445 -
code/branches/presentationFS16/src/orxonox/worldentities/pawns/Pawn.h
r11176 r11208 157 157 virtual void kill(); 158 158 159 virtual void fired(unsigned int firemode) override; 159 virtual void pushed(unsigned int firemode) override; 160 virtual void released(unsigned int firemode) override; 160 161 virtual void postSpawn(); 161 162 -
code/branches/presentationFS16/src/orxonox/worldentities/pawns/Spectator.cc
r11071 r11208 42 42 namespace orxonox 43 43 { 44 extern const std::string __CC_ fire_name;44 extern const std::string __CC_push_name; 45 45 extern const std::string __CC_suicide_name; 46 46 … … 162 162 163 163 // change keybind mode of fire command to OnPress to avoid firing after respawn 164 ModifyConsoleCommand(__CC_ fire_name).keybindMode(KeybindMode::OnPress);164 ModifyConsoleCommand(__CC_push_name).keybindMode(KeybindMode::OnPress); 165 165 166 166 // disable suicide … … 177 177 // change fire command to a helper function and change keybind mode to OnPress 178 178 // as soon as the player releases and presses the button again, the helper function will be called which changes the keybind mode back to OnHold 179 ModifyConsoleCommand(__CC_ fire_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);179 ModifyConsoleCommand(__CC_push_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress); 180 180 181 181 // enable suicide … … 188 188 void Spectator::resetFireCommand(unsigned int firemode) 189 189 { 190 ModifyConsoleCommand(__CC_ fire_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode191 192 CommandExecutor::execute(__CC_ fire_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function190 ModifyConsoleCommand(__CC_push_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode 191 192 CommandExecutor::execute(__CC_push_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function 193 193 } 194 194 … … 229 229 } 230 230 231 void Spectator:: fired(unsigned int firemode)231 void Spectator::pushed(unsigned int firemode) 232 232 { 233 233 if (this->getPlayer()) -
code/branches/presentationFS16/src/orxonox/worldentities/pawns/Spectator.h
r9667 r11208 54 54 virtual void rotateRoll(const Vector2& value); 55 55 56 virtual void fired(unsigned int firemode);56 virtual void pushed(unsigned int firemode); 57 57 virtual void greet(); 58 58 virtual void mouseLook() {}
Note: See TracChangeset
for help on using the changeset viewer.