- Timestamp:
- Apr 14, 2016, 4:02:00 PM (9 years ago)
- Location:
- code/branches/sagerjFS16
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sagerjFS16/data/levels/includes/weaponSettingsEscort.oxi
r11052 r11166 1 1 <weaponslots> 2 2 <WeaponSlot position="-9.2,2,-13" /> 3 <WeaponSlot position=" 9.2,2,-13" /> 3 4 4 </weaponslots> 5 5 <weaponsets> 6 6 <WeaponSet firemode=0 /> 7 <WeaponSet firemode=1 /> 7 8 8 </weaponsets> 9 9 <weaponpacks> … … 11 11 <links> 12 12 <DefaultWeaponmodeLink firemode=0 weaponmode=0 /> 13 <DefaultWeaponmodeLink firemode=1 weaponmode=1 /> 13 14 14 </links> 15 15 <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" />16 <Discharger mode=0 munitionpershot=1 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="LaserBeam2.mesh" /> 17 17 </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> 18 21 19 </WeaponPack> 22 <WeaponPack> 23 <links> 24 <DefaultWeaponmodeLink firemode=1 weaponmode=0 /> 25 </links> 26 </WeaponPack> 20 27 21 </weaponpacks> 28 22 <munition> -
code/branches/sagerjFS16/src/modules/weapons/WeaponsPrereqs.h
r11052 r11166 107 107 class SimpleRocketFire; 108 108 class GravityBombFire; 109 class Discharger; 109 110 } 110 111 -
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/CMakeLists.txt
r11108 r11166 13 13 GravityBombFire.cc 14 14 MineGun.cc 15 Discharger.cc 15 16 ) -
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc
r11153 r11166 51 51 RegisterObject(Discharger); 52 52 53 this->reloadTime_ = 0.1f; 54 this->damage_ = 9000.1f*loaded_; 55 this->speed_ = 9000.1f*loaded_; 56 57 this->setMunitionName("dEnergy"); 58 this->setFireSound("sounds/Weapon_Discharger.ogg"); 59 this->setReloadSound("sounds/Reload_Discharger.ogg", 0.8); 53 this->setMunitionName("LaserMunition"); 60 54 61 55 hudImageString_ = "Orxonox/WSHUD_WM_LaserFire"; 62 56 } 63 57 64 /**65 @brief66 Fires the weapon. Creates a projectile and fires it.67 */68 58 void Discharger::fire() 69 59 { 70 /*BillboardProjectile* projectile = new BillboardProjectile(this->getContext()); 71 72 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 73 projectile->setOrientation(this->getMuzzleOrientation()); 74 projectile->setPosition(this->getMuzzlePosition()); 75 projectile->setVelocity(this->getMuzzleDirection() * this->speed_); 76 77 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 78 projectile->setDamage(this->getDamage()); 79 projectile->setShieldDamage(this->getShieldDamage()); 80 projectile->setHealthDamage(this->getHealthDamage());*/ 81 extern unsigned int beginLoad_ = time; 60 orxout() << "fire dis " << endl; 82 61 } 83 void Discharger::release() 62 63 bool Discharger::fire(float* reloadTime) 84 64 { 85 extern unsigned int endLoad_ = time; 86 extern unsigned int loaded_ = endLoad_ - beginLoad_; 87 65 orxout() << "fire Discharger " << endl; 66 return false; 67 } 68 bool Discharger::release(float* reloadTime) 69 { 70 orxout() << "release Discharger " << endl; 71 return false; 88 72 } 89 73 } -
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h
r11153 r11166 55 55 56 56 virtual void fire() override; 57 virtual void release() override; 57 virtual bool fire(float* reloadTime) override; 58 virtual bool release(float* reloadTime) override; 58 59 59 60 private: 60 float speed_; //!< The speed of the fired projectile.61 float loaded_; // The time how long the weapon charged62 float beginLoad_;63 float endLoad_;64 61 }; 65 62 } -
code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc
r11164 r11166 159 159 void HumanController::fire(unsigned int firemode) 160 160 { 161 orxout() << "fire hc " << firemode << endl; 161 162 if (HumanController::localController_s) 162 163 HumanController::localController_s->doFire(firemode); … … 165 166 void HumanController::doFire(unsigned int firemode) 166 167 { 168 orxout() << "do fire hc " << firemode << endl; 167 169 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 168 170 { … … 178 180 void HumanController::release(unsigned int firemode) 179 181 { 180 orxout() << " HumanController" << firemode << endl;182 orxout() << "release hc " << firemode << endl; 181 183 if (HumanController::localController_s) 182 184 HumanController::localController_s->doRelease(firemode); … … 185 187 void HumanController::doRelease(unsigned int firemode) 186 188 { 189 orxout() << "do release hc " << firemode << endl; 187 190 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 188 191 { -
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc
r11164 r11166 54 54 SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress); 55 55 SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress); 56 //SetConsoleCommand("NewHumanController", "release", &NewHumanController::release ).keybindMode(KeybindMode::OnRelease).addShortcut();57 56 58 57 RegisterUnloadableClass(NewHumanController); … … 286 285 if (firemode == 1 && this->controlMode_ == 1) 287 286 { 287 orxout() << "do fire nhc if " << firemode << endl; 288 288 //unlocked steering, steer on right mouse click 289 289 HumanController::yaw(Vector2(this->currentYaw_, 0)); … … 291 291 } 292 292 else 293 { 294 orxout() << "do fire nhc else " << firemode << endl; 293 295 HumanController::doFire(firemode); //call for formationflight 294 } 295 296 /*void NewHumanController::release(unsigned int firemode) 297 { 298 if (NewHumanController::localController_s) 299 NewHumanController::localController_s->doRelease(firemode); 300 orxout() << "Trigger " << firemode << endl; 301 } 302 303 /void NewHumanController::doRelease(unsigned int firemode) 304 { 305 // this->firemode_ = -1; (outdated code from unfire) 306 // hideArrows(); 296 } 297 } 298 299 void NewHumanController::doRelease(unsigned int firemode) 300 { 301 orxout() << "do release nhc" << firemode << endl; 307 302 if (!this->controllableEntity_) 308 303 return; … … 311 306 312 307 HumanController::doRelease(firemode); //call for formationflight 313 } */308 } 314 309 315 310 void NewHumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) -
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h
r11164 r11166 55 55 56 56 virtual void doFire(unsigned int firemode) override; 57 /*virtual void release(unsigned int firemode); 58 virtual void doRelease(unsigned int firemode);*/ 57 virtual void doRelease(unsigned int firemode) override; 59 58 60 59 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override; -
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc
r11164 r11166 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 orxout() << "fire weapon " << mode << endl; 116 117 if (this->bReloading_ && this->reloadingWeaponmode_ != mode) 117 118 return; … … 135 136 136 137 void Weapon::release(unsigned int mode) 137 {orxout() << "release weapon " << mode << endl;} 138 { 139 orxout() << "release weapon " << mode << endl; 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)) 150 { 151 this->bReloading_ = true; 152 this->reloadingWeaponmode_ = mode; 153 154 this->reloadTimer_.setInterval(reloading_time); 155 this->reloadTimer_.startTimer(); 156 } 157 } 158 } 138 159 139 160 /** -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11164 r11166 121 121 { 122 122 (*reloadTime) = this->reloadTime_; 123 123 orxout() << "fire wm " << reloadTime << endl; 124 124 // Fireing is only possible if this weapon mode is not reloading and there is enough munition 125 125 if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this)) … … 169 169 } 170 170 171 void WeaponMode::release(float* reloadTime) 172 {orxout() << "release wmode " << reloadTime << endl;} 171 bool WeaponMode::release(float* reloadTime) 172 { 173 orxout() << "release wm " << reloadTime << endl; 174 return false; 175 } 173 176 174 177 bool WeaponMode::reload() -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
r11164 r11166 58 58 59 59 virtual bool fire(float* reloadTime); 60 virtual voidrelease(float* reloadTime);60 virtual bool release(float* reloadTime); 61 61 bool reload(); 62 62 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc
r11164 r11166 76 76 void WeaponPack::fire(unsigned int weaponmode) 77 77 { 78 orxout() << "fire wp " << weaponmode << endl; 78 79 for (Weapon* weapon : this->weapons_) 79 80 weapon->fire(weaponmode); … … 82 83 void WeaponPack::release(unsigned int weaponmode) 83 84 { 85 orxout() << "release wp " << weaponmode << endl; 84 86 for (Weapon* weapon : this->weapons_) 85 87 weapon->release(weaponmode); 86 orxout() << "release wpack " << weaponmode << endl;87 88 } 88 89 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc
r11164 r11166 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 orxout() << "fire wset " << endl; 65 66 for (const auto& mapEntry : this->weaponpacks_) 66 67 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) … … 70 71 void WeaponSet::release() 71 72 { 72 73 73 // Fire all WeaponPacks with their defined weaponmode 74 orxout() << "release wset " << endl; 74 75 for (const auto& mapEntry : this->weaponpacks_) 75 76 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 76 77 mapEntry.first->release(mapEntry.second); 77 orxout() << "release wset " << endl;78 79 78 } 80 79 -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc
r11164 r11166 289 289 void WeaponSystem::fire(unsigned int firemode) 290 290 { 291 orxout() << "fire wsys " << firemode << endl; 291 292 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 292 293 if (it != this->weaponSets_.end() && it->second) … … 296 297 void WeaponSystem::release(unsigned int firemode) 297 298 { 299 orxout() << "release wsys " << firemode << endl; 298 300 std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode); 299 301 if (it != this->weaponSets_.end() && it->second) 300 302 it->second->release(); 301 orxout() << "release wsys " << firemode << endl;302 303 } 303 304 -
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc
r11164 r11166 303 303 if(GameMode::isMaster()) 304 304 { 305 orxout() << "f CE IF" << firemode << endl;305 orxout() << "fire ce if " << firemode << endl; 306 306 this->fired(firemode); 307 307 } 308 308 else 309 309 { 310 orxout() << "f CE EL" << firemode << endl;310 orxout() << "fire ce else " << firemode << endl; 311 311 callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode); 312 312 } … … 317 317 if(GameMode::isMaster()) 318 318 { 319 orxout() << "r CE IF" << firemode << endl;319 orxout() << "release ce if " << firemode << endl; 320 320 this->released(firemode); 321 321 } 322 322 else 323 323 { 324 orxout() << "r CE EL" << firemode << endl;324 orxout() << "release ce else " << firemode << endl; 325 325 callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode); 326 326 } -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc
r11099 r11166 430 430 void Pawn::fired(unsigned int firemode) 431 431 { 432 orxout() << "fired pawn " << firemode << endl; 432 433 if (this->weaponSystem_) 433 434 this->weaponSystem_->fire(firemode); 435 } 436 437 void Pawn::released(unsigned int firemode) 438 { 439 orxout() << "released pawn " << firemode << endl; 440 if (this->weaponSystem_) 441 this->weaponSystem_->release(firemode); 434 442 } 435 443 -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h
r11071 r11166 158 158 159 159 virtual void fired(unsigned int firemode) override; 160 virtual void released(unsigned int firemode) override; 160 161 virtual void postSpawn(); 161 162
Note: See TracChangeset
for help on using the changeset viewer.