Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 25, 2007, 3:05:01 AM (17 years ago)
Author:
patrick
Message:

merged playability. but got strange bug

Location:
branches/playability.new
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability.new

    • Property svn:ignore
      •  

        old new  
        1010autom4te.cache
        1111aclocal.m4
         12tags
         13test.bmp
         14config.sub
         15config.guess
         16OrxonoxPlayability.kdevses
         17OrxonoxPlayability.kdevelop.pcs
  • branches/playability.new/src/world_entities/weapons/weapon_manager.cc

    r9869 r10362  
    103103
    104104  this->currentConfigID = 0;
    105   this->slotCount = 2;
     105  this->slotCount = WM_MAX_SLOTS;
    106106  //this->weaponChange;
    107107
     
    114114  this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR);
    115115  this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR);
     116
     117  this->hideCrosshair();
     118
     119  this->bFire = false;
     120}
     121
     122void WeaponManager::showCrosshair()
     123{
     124  this->crosshair->setVisibility( true);
     125}
     126
     127void WeaponManager::hideCrosshair()
     128{
     129  this->crosshair->setVisibility( false);
     130}
     131
     132void WeaponManager::setRotationSpeed(float speed)
     133{
     134  this->crosshair->setRotationSpeed(speed);
    116135}
    117136
     
    300319    if (this->parentEntity->isA(Playable::staticClassID()))
    301320      dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
     321   
    302322    weapon->setDefaultTarget(this->crosshair);
    303323  }
     
    317337
    318338/**
    319  * @brief does the same as the funtion inclreaseAmmunition, added four your convenience
     339 * @brief does the same as the funtion increaseAmmunition, added four your convenience
    320340 * @param weapon, the Weapon to read the ammo-info about.
    321341 * @param ammo how much ammo to add.
    322342 */
    323 float WeaponManager::inclreaseAmmunition(const Weapon* weapon, float ammo)
     343float WeaponManager::increaseAmmunition(const Weapon* weapon, float ammo)
    324344{
    325345  assert (weapon != NULL);
     
    400420  this->currentConfigID = weaponConfig;
    401421  PRINTF(4)("Changing weapon configuration: to %i\n", this->currentConfigID);
     422
    402423  for (int i = 0; i < WM_MAX_SLOTS; i++)
    403424    this->currentSlotConfig[i].nextWeapon = this->configs[currentConfigID][i];
     
    410431void WeaponManager::fire()
    411432{
     433//   printf("firing WM: ");
    412434  Weapon* firingWeapon;
    413435  for(int i = 0; i < this->slotCount; i++)
    414436  {
     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 */
     452void WeaponManager::releaseFire()
     453{
     454  Weapon* firingWeapon;
     455  for(int i = 0; i < this->slotCount; i++)
     456  {
    415457    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  /*
    418462  this->crosshair->setRotationSpeed(500);
    419463  this->crossHairSizeAnim->replay();
    420 }
    421 
     464  */
     465}
    422466
    423467/**
     
    429473  Weapon* tickWeapon;
    430474
     475
    431476  for(int i = 0; i < this->slotCount; i++)
    432477  {
    433 /*
    434     NICE LITTLE DEBUG FUNCTION
    435        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)
    436481      printf("%p %p\n", this->currentSlotConfig[i].currentWeapon, this->currentSlotConfig[i].nextWeapon);*/
    437482
     
    455500        }
    456501      }
    457 
    458502      // switching to next Weapon
    459503      tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon;
     504     
    460505      if (tickWeapon != NULL)
    461506      {
    462            //        if (this->parent != NULL)
    463           tickWeapon->toList(this->parentEntity->getOMListNumber());
     507        //if (this->parent != NULL)
     508        tickWeapon->toList(this->parentEntity->getOMListNumber());
    464509        tickWeapon->requestAction(WA_ACTIVATE);
    465510        this->currentSlotConfig[i].position.activateNode();
Note: See TracChangeset for help on using the changeset viewer.