Changeset 10661 in orxonox.OLD for branches/vs-enhencements/src/world_entities/space_ships
- Timestamp:
- May 24, 2007, 3:22:51 PM (18 years ago)
- Location:
- branches/vs-enhencements/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc
r10660 r10661 69 69 70 70 #include "track/track.h" 71 72 73 // #include "lib/gui/gl_gui/glgui_bar.h"74 // #include "lib/gui/gl_gui/glgui_pushbutton.h"75 76 71 77 72 … … 159 154 //weapons: 160 155 161 Weapon* wpRight0 = new RFCannon (); 162 wpRight0->setName( "RFCannon"); 163 Weapon* wpLeft0 = new RFCannon (); 164 wpLeft0->setName( "RFCannon"); 165 166 Weapon* wpRight1 = new RFCannon (); 167 wpRight1->setName( "RFCannon"); 168 Weapon* wpLeft1 = new RFCannon (); 169 wpLeft1->setName( "RFCannon"); 170 /* 171 Weapon* wpRight2 = new MediumBlaster (); 172 wpRight2->setName( "MediumBlaster"); 173 Weapon* wpLeft2 = new MediumBlaster (); 174 wpLeft2->setName( "MediumBlaster");*/ 175 176 Weapon* wpRight2 = new NadionLaser (); 177 wpRight2->setName( "NadionLaser"); 178 Weapon* wpLeft2 = new NadionLaser (); 179 wpLeft2->setName( "NadionLaser"); 180 /* 181 Weapon* wpRight3 = new HeavyBlaster (1); 182 wpRight3->setName( "HeavyBlaster"); 183 Weapon* wpLeft3 = new HeavyBlaster (0); 184 wpLeft3->setName( "HeavyBlaster");*/ 185 186 Weapon* wpRight3 = new Disruptor (); 187 wpRight3->setName( "Disruptor"); 188 Weapon* wpLeft3 = new Disruptor (); 189 wpLeft3->setName( "Disruptor"); 190 191 /* 192 Weapon* wpRight3 = Weapon::createWeapon( "Disruptor" ); 193 wpRight3->setName( "Disruptor"); 194 Weapon* wpLeft3 = Weapon::createWeapon( "Disruptor" ); 195 wpLeft3->setName( "Disruptor");*/ 196 197 Weapon* cannon = new SwarmLauncher(); 198 cannon->setName( "SwarmLauncher"); 199 200 201 this->weaponMan.addWeapon( wpLeft0, 0, 0); 202 this->weaponMan.addWeapon( wpRight0, 0, 1); 203 204 this->weaponMan.addWeapon( wpLeft1, 0, 2); 205 this->weaponMan.addWeapon( wpRight1, 0, 3); 206 207 this->weaponMan.addWeapon( wpLeft2, 1, 4); 208 this->weaponMan.addWeapon( wpRight2, 1, 5); 209 210 this->weaponMan.addWeapon( wpLeft3, 2, 6); 211 this->weaponMan.addWeapon( wpRight3, 2, 7); 212 213 this->weaponMan.addWeapon( wpLeft0, 3, 0); 214 this->weaponMan.addWeapon( wpRight0, 3, 1); 215 216 this->weaponMan.addWeapon( wpLeft1, 3, 2); 217 this->weaponMan.addWeapon( wpRight1, 3, 3); 218 219 this->weaponMan.addWeapon( wpLeft2, 3, 4); 220 this->weaponMan.addWeapon( wpRight2, 3, 5); 221 222 this->weaponMan.addWeapon( wpLeft3, 3, 6); 223 this->weaponMan.addWeapon( wpRight3, 3, 7); 224 225 226 this->secWeaponMan.addWeapon( cannon, 0, 2); 227 228 this->weaponMan.changeWeaponConfig(3); 156 this->weaponMan.setParentEntity( this); 157 this->secWeaponMan.setParentEntity( this); 158 159 this->setWMSlotCount(1,8); 160 this->setWMSlotCount(2,6); 161 162 this->createWeaponSlot(1, 0, Vector(3.006, 1.028, .155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 163 this->createWeaponSlot(1, 1, Vector(3.006, 1.028, -.155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 164 this->createWeaponSlot(1, 2, Vector(4.03, .063, .876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 165 this->createWeaponSlot(1, 3, Vector(4.03, -.063, -.876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 166 this->createWeaponSlot(1, 4, Vector(1.431, -.612, 2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 167 this->createWeaponSlot(1, 5, Vector(1.431, -.612, -2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 168 this->createWeaponSlot(1, 6, Vector(1.431, -.612, 3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 169 this->createWeaponSlot(1, 7, Vector(1.431, -.612, -3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 170 171 172 this->addWeaponToSlot(1, 0, 0, "RFCannon"); 173 this->addWeaponToSlot(1, 0, 1, "RFCannon"); 174 this->addWeaponToSlot(1, 0, 2, "RFCannon"); 175 this->addWeaponToSlot(1, 0, 3, "RFCannon"); 176 this->addWeaponToSlot(1, 1, 0, "RFCannon"); 177 this->addWeaponToSlot(1, 1, 1, "RFCannon"); 178 this->addWeaponToSlot(1, 1, 2, "RFCannon"); 179 this->addWeaponToSlot(1, 1, 3, "RFCannon"); 180 181 this->addWeaponToSlot(1, 0, 4, "NadionLaser"); 182 this->addWeaponToSlot(1, 0, 5, "NadionLaser"); 183 this->addWeaponToSlot(1, 2, 4, "NadionLaser"); 184 this->addWeaponToSlot(1, 2, 5, "NadionLaser"); 185 186 this->addWeaponToSlot(1, 0, 6, "Disruptor"); 187 this->addWeaponToSlot(1, 0, 7, "Disruptor"); 188 this->addWeaponToSlot(1, 3, 6, "Disruptor"); 189 this->addWeaponToSlot(1, 3, 7, "Disruptor"); 190 191 192 this->createWeaponSlot(2, 0, Vector(1.5, 3, 0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 193 this->createWeaponSlot(2, 1, Vector(2.6, 0, 3.0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 194 this->createWeaponSlot(2, 2, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 195 this->createWeaponSlot(2, 3, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 196 this->createWeaponSlot(2, 4, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 197 this->createWeaponSlot(2, 5, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 198 199 this->addWeaponToSlot(2, 0, 2, "SwarmLauncher"); 200 201 202 this->weaponMan.changeWeaponConfig(0); 229 203 this->secWeaponMan.changeWeaponConfig(0); 230 204 … … 232 206 Playable::weaponConfigChanged(); 233 207 234 // reactorOutput = 10;235 208 setReactor(10); 236 // weaponEnergyRegen = 10; // 10 einheiten pro Sekunde237 209 setWeapon(10); 238 // engineSpeedBase = 15;239 210 setEngine(15); 240 // shieldRegen = 2; 241 /* 242 shieldEnergyShare = 0.3; 243 weaponEnergyShare = 0.3; 244 engineEnergyShare = 0.4;*/ 211 212 245 213 setEnergyShare(.3,.3,.4); 246 /*247 shieldCur = 100;248 shieldMax = 100;249 shieldTH = .2 * shieldMax; // shield power must be 20% before shield kicks in again*/250 214 setShield(100, 100, .2, 2); 251 /*252 this->setHealth( 100);253 this->setHealthMax( 100);*/254 215 setArmor(100, 100); 255 /*256 electronicCur = 50;257 electronicMax = 50;258 electronicRegen = 3;259 electronicTH = .7 * electronicMax; // 30% of eDamage can be handled by the ship*/260 216 setElectronic(50, 50, .7, 3.0); 261 217 … … 311 267 //registerEvent(SDLK_PAGEDOWN); 312 268 registerEvent(EV_MOUSE_MOTION); 313 314 this->weaponMan.setParentEntity( this);315 this->secWeaponMan.setParentEntity( this);316 317 this->weaponMan.setSlotCount(8);318 /*319 this->weaponMan.setSlotPosition(0, Vector(3.006, 1.028, .155));320 this->weaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);321 322 this->weaponMan.setSlotPosition(1, Vector(3.006, 1.028, -.155));323 this->weaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);324 325 this->weaponMan.setSlotPosition(2, Vector(4.03, .063, .876));326 this->weaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));327 328 this->weaponMan.setSlotPosition(3, Vector(4.03, -.063, -.876));329 this->weaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));330 331 this->weaponMan.setSlotPosition(4, Vector(1.431, -.612, 2.691));332 this->weaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));333 334 this->weaponMan.setSlotPosition(5, Vector(1.431, -.612, -2.691));335 this->weaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));336 337 this->weaponMan.setSlotPosition(6, Vector(1.431, -.612, 3.254));338 this->weaponMan.setSlotDirection(6, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));339 340 this->weaponMan.setSlotPosition(7, Vector(1.431, -.612, -3.254));341 this->weaponMan.setSlotDirection(7, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));*/342 343 this->createPriWMSlot(0, Vector(3.006, 1.028, .155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);344 this->createPriWMSlot(1, Vector(3.006, 1.028, -.155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);345 this->createPriWMSlot(2, Vector(4.03, .063, .876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);346 this->createPriWMSlot(3, Vector(4.03, -.063, -.876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);347 this->createPriWMSlot(4, Vector(1.431, -.612, 2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);348 this->createPriWMSlot(5, Vector(1.431, -.612, -2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);349 this->createPriWMSlot(6, Vector(1.431, -.612, 3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);350 this->createPriWMSlot(7, Vector(1.431, -.612, -3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);351 352 this->secWeaponMan.setSlotCount(6);353 /*354 this->secWeaponMan.setSlotPosition(0, Vector(1.5, 3, 0));355 this->secWeaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);356 357 this->secWeaponMan.setSlotPosition(1, Vector(2.6, 0, 3.0));358 this->secWeaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);359 360 this->secWeaponMan.setSlotPosition(2, Vector(1.5, 0, -.5));361 this->secWeaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));362 363 this->secWeaponMan.setSlotPosition(3, Vector(1.5, 0, .5));364 this->secWeaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));365 366 this->secWeaponMan.setSlotPosition(4, Vector(1.5, 0, .5));367 this->secWeaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));368 369 this->secWeaponMan.setSlotPosition(5, Vector(1.5, 0, -.5));370 this->secWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));*/371 372 this->createSecWMSlot(0, Vector(1.5, 3, 0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);373 this->createSecWMSlot(1, Vector(2.6, 0, 3.0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);374 this->createSecWMSlot(2, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);375 this->createSecWMSlot(3, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);376 this->createSecWMSlot(4, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);377 this->createSecWMSlot(5, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);378 269 379 270 … … 1230 1121 this->isTravelDistanceInit = false; 1231 1122 }; 1123 1124 void SpaceShip::addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName){ 1125 if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); } 1126 if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); } 1127 else return; 1128 } 1129 -
branches/vs-enhencements/src/world_entities/space_ships/space_ship.h
r10660 r10661 73 73 inline void setEnergyShare(float shield, float weapon, float engine) 74 74 { float tmp = shield + weapon + engine; if (unlikely (tmp > 1)) { tmp = 1/tmp; } 75 // dirty saf ty hack, prevents total share being bigger than 1!!75 // dirty safety hack, prevents total share being bigger than 1!! 76 76 this->shieldEnergyShare = shield * tmp; 77 77 this->weaponEnergyShare = weapon * tmp; … … 82 82 inline void updateHealth() { this->setHealth(this->armorCur); this->setHealthMax(this->armorMax); }; 83 83 84 inline void setPriWM(int slot) { this->weaponMan.setSlotCount(slot); }; 85 inline void setSecWM(int slot) { this->secWeaponMan.setSlotCount(slot); }; 86 inline void createPriWMSlot( int slot, Vector location, long capability) { 87 this->weaponMan.setSlotPosition(slot, location); 88 this->weaponMan.setSlotCapability(slot, capability); }; 89 inline void createSecWMSlot( int slot, Vector location, long capability) { 90 this->secWeaponMan.setSlotPosition(slot, location); 91 this->secWeaponMan.setSlotCapability(slot, capability); }; 84 inline void setWMSlotCount(int wm, int slot) { 85 if (wm == 1) { this->weaponMan.setSlotCount(slot); } 86 if (wm == 2) { this->secWeaponMan.setSlotCount(slot); } 87 else return; }; 88 inline void createWeaponSlot(int wm, int slot, Vector location, long capability) { 89 if (wm == 1) { 90 this->weaponMan.setSlotPosition(slot, location); 91 this->weaponMan.setSlotCapability(slot, capability); } 92 if (wm == 2) { 93 this->secWeaponMan.setSlotPosition(slot, location); 94 this->secWeaponMan.setSlotCapability(slot, capability); } 95 else return; }; 96 97 void addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName); 98 92 99 //Functions for GUI 93 100 inline float getShieldCur() { return this->shieldCur; }; //!< returns current shield value
Note: See TracChangeset
for help on using the changeset viewer.