Changeset 10362 in orxonox.OLD for branches/playability.new/src/world_entities/weapons/weapon_manager.cc
- Timestamp:
- Jan 25, 2007, 3:05:01 AM (17 years ago)
- Location:
- branches/playability.new
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability.new
- Property svn:ignore
-
old new 10 10 autom4te.cache 11 11 aclocal.m4 12 tags 13 test.bmp 14 config.sub 15 config.guess 16 OrxonoxPlayability.kdevses 17 OrxonoxPlayability.kdevelop.pcs
-
- Property svn:ignore
-
branches/playability.new/src/world_entities/weapons/weapon_manager.cc
r9869 r10362 103 103 104 104 this->currentConfigID = 0; 105 this->slotCount = 2;105 this->slotCount = WM_MAX_SLOTS; 106 106 //this->weaponChange; 107 107 … … 114 114 this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR); 115 115 this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR); 116 117 this->hideCrosshair(); 118 119 this->bFire = false; 120 } 121 122 void WeaponManager::showCrosshair() 123 { 124 this->crosshair->setVisibility( true); 125 } 126 127 void WeaponManager::hideCrosshair() 128 { 129 this->crosshair->setVisibility( false); 130 } 131 132 void WeaponManager::setRotationSpeed(float speed) 133 { 134 this->crosshair->setRotationSpeed(speed); 116 135 } 117 136 … … 300 319 if (this->parentEntity->isA(Playable::staticClassID())) 301 320 dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged(); 321 302 322 weapon->setDefaultTarget(this->crosshair); 303 323 } … … 317 337 318 338 /** 319 * @brief does the same as the funtion inc lreaseAmmunition, added four your convenience339 * @brief does the same as the funtion increaseAmmunition, added four your convenience 320 340 * @param weapon, the Weapon to read the ammo-info about. 321 341 * @param ammo how much ammo to add. 322 342 */ 323 float WeaponManager::inc lreaseAmmunition(const Weapon* weapon, float ammo)343 float WeaponManager::increaseAmmunition(const Weapon* weapon, float ammo) 324 344 { 325 345 assert (weapon != NULL); … … 400 420 this->currentConfigID = weaponConfig; 401 421 PRINTF(4)("Changing weapon configuration: to %i\n", this->currentConfigID); 422 402 423 for (int i = 0; i < WM_MAX_SLOTS; i++) 403 424 this->currentSlotConfig[i].nextWeapon = this->configs[currentConfigID][i]; … … 410 431 void WeaponManager::fire() 411 432 { 433 // printf("firing WM: "); 412 434 Weapon* firingWeapon; 413 435 for(int i = 0; i < this->slotCount; i++) 414 436 { 437 // printf("%i ", i); 438 firingWeapon = this->currentSlotConfig[i].currentWeapon; 439 if( firingWeapon != NULL && firingWeapon->getCurrentState() == WS_SHOOTING) continue; 440 if( firingWeapon != NULL) firingWeapon->requestAction(WA_SHOOT); 441 } 442 // printf("\n"); 443 /* 444 this->crosshair->setRotationSpeed(500); 445 this->crossHairSizeAnim->replay(); 446 */ 447 } 448 449 /** 450 * triggers fire of all weapons in the current weaponconfig 451 */ 452 void WeaponManager::releaseFire() 453 { 454 Weapon* firingWeapon; 455 for(int i = 0; i < this->slotCount; i++) 456 { 415 457 firingWeapon = this->currentSlotConfig[i].currentWeapon; 416 if( firingWeapon != NULL) firingWeapon->requestAction(WA_SHOOT); 417 } 458 if( firingWeapon != NULL) firingWeapon->requestAction(WA_NONE); 459 } 460 461 /* 418 462 this->crosshair->setRotationSpeed(500); 419 463 this->crossHairSizeAnim->replay(); 420 } 421 464 */ 465 } 422 466 423 467 /** … … 429 473 Weapon* tickWeapon; 430 474 475 431 476 for(int i = 0; i < this->slotCount; i++) 432 477 { 433 /* 434 NICE LITTLE DEBUG FUNCTION435 if (this->currentSlotConfig[i].currentWeapon != NULL || this->currentSlotConfig[i].nextWeapon != NULL)478 479 //NICE LITTLE DEBUG FUNCTION 480 /* if (this->currentSlotConfig[i].currentWeapon != NULL || this->currentSlotConfig[i].nextWeapon != NULL) 436 481 printf("%p %p\n", this->currentSlotConfig[i].currentWeapon, this->currentSlotConfig[i].nextWeapon);*/ 437 482 … … 455 500 } 456 501 } 457 458 502 // switching to next Weapon 459 503 tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon; 504 460 505 if (tickWeapon != NULL) 461 506 { 462 //if (this->parent != NULL)463 507 //if (this->parent != NULL) 508 tickWeapon->toList(this->parentEntity->getOMListNumber()); 464 509 tickWeapon->requestAction(WA_ACTIVATE); 465 510 this->currentSlotConfig[i].position.activateNode();
Note: See TracChangeset
for help on using the changeset viewer.