Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3877 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 18, 2005, 5:34:39 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: the player now works entirely with the WeaponManager. much more elegant! but its not yet finished.

Location:
orxonox/trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r3875 r3877  
    6060  this->weaponMan->addWeapon(wpLeft);
    6161
    62   this->weapons->add(wpRight);
    63   this->activeWeapon = wpRight;
    64   this->activeWeaponL = wpLeft;
     62  //this->weapons->add(wpRight);
     63  //this->activeWeapon = wpRight;
     64  //this->activeWeaponL = wpLeft;
    6565}
    6666
     
    157157  glPopMatrix();
    158158
    159   this->activeWeapon->draw();
    160   this->activeWeaponL->draw();
     159  //this->activeWeapon->draw();
     160  //this->activeWeaponL->draw();
     161  this->weaponMan->draw();
    161162}
    162163
     
    169170{
    170171  /* link tick to weapon */
    171   this->activeWeapon->tick(time);
    172   this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
     172  //this->activeWeapon->tick(time);
     173  //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
     174  this->weaponMan->tick(time);
    173175  // player controlled movement
    174176  this->move(time);
     
    186188  Vector accel(0.0, 0.0, 0.0);
    187189  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    188  
    189190  /* calculate the direction in which the craft is heading  */
    190191  Vector direction (1.0, 0.0, 0.0);
     
    216217  if( this->bFire)
    217218    {
    218       //if(this->activeWeapon != NULL)
    219       //this->activeWeapon->fire();
    220       //FIX THIS FIX FIIIIIIIIIIIX
    221       //this->activeWeaponL->fire();
    222219      this->weaponMan->fire();
    223220    }
    224   if( this->bWeaponChange && this->weapons->getSize() > 1)
     221  if( this->bWeaponChange)
    225222    {
    226       PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n");
    227       this->activeWeapon->deactivate();
     223      //this->activeWeapon->deactivate();
    228224      //this->weapons->enumerate();  FIX: strang weapon change...
    229       this->activeWeapon = this->weapons->nextElement(this->activeWeapon);
    230       this->activeWeapon->activate();
     225      //this->activeWeapon = this->weapons->nextElement(this->activeWeapon);
     226      //this->activeWeapon->activate();
     227      this->weaponMan->nextWeaponConf();
    231228    }
    232229}
  • orxonox/trunk/src/world_entities/weapon.cc

    r3875 r3877  
    7777void WeaponManager::nextWeaponConf()
    7878{
     79  PRINTF(3)("Changing weapon configuration: from %i ", this->currConfID);
    7980  int i;
    8081  for(i = this->currConfID; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i);
    8182  if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0;
    8283  else this->currConfID = i; 
     84  PRINTF(3)("to %i\n", this->currConfID);
    8385}
    8486
     
    105107}
    106108
     109
     110void WeaponManager::tick(float sec)
     111{
     112  Weapon* w;
     113  for(int i = 0; i < W_MAX_SLOTS; ++i)
     114    {
     115      w = this->configs[this->currConfID].slots[i];
     116      if( w != NULL) w->tick(sec);
     117    }
     118}
     119
     120
     121void WeaponManager::draw()
     122{
     123  Weapon* w;
     124  for(int i = 0; i < W_MAX_SLOTS; ++i)
     125    {
     126      w = this->configs[this->currConfID].slots[i];
     127      if( w != NULL) w->draw();
     128    }
     129}
    107130
    108131/**
  • orxonox/trunk/src/world_entities/weapon.h

    r3875 r3877  
    8383
    8484  void fire();
     85  void tick(float sec);
     86  void draw();
    8587
    8688 private:
Note: See TracChangeset for help on using the changeset viewer.