Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4885 in orxonox.OLD for orxonox/trunk/src/world_entities/player.cc


Ignore:
Timestamp:
Jul 18, 2005, 3:36:18 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the weaponSystem back to the trunk, because it seems safe
merged with command:
svn merge -r 4847:HEAD branches/weaponSystem/ trunk/
conflict in file src/world-entities/weapons/weapon.h resolved in favor of the weaponSystem

File:
1 edited

Legend:

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

    r4836 r4885  
    2323
    2424#include "weapon_manager.h"
    25 #include "weapon.h"
    2625#include "test_gun.h"
    2726#include "world.h"
    2827
    2928#include "list.h"
    30 #include "stdincl.h"
    3129
    3230#include "event_handler.h"
    3331
    34 #include "projectile.h"
    3532#include "event.h"
    3633
     
    4138
    4239/**
    43  *  creates a new Player
     40 * creates a new Player
    4441 * @param isFree if the player is free
    4542*/
    4643Player::Player()
    4744{
    48   /*
    49     this is the debug player - actualy we would have to make a new
    50      class derivated from Player for each player. for now, we just use
    51      the player.cc for debug also
    52   */
    5345  this->init();
    5446
     
    7567  delete this->weaponMan;
    7668}
    77 
    7869
    7970/**
     
    119110
    120111/**
    121  *
     112 * loads the Settings of a Player from an XML-element.
    122113 * @param root the XML-element to load the Player's properties from
    123114 */
     
    132123
    133124/**
    134  *  adds a weapon to the weapon list of player
     125 * adds a weapon to the weapon list of player
    135126 * @param weapon to add
    136127*/
     
    219210void Player::tick (float time)
    220211{
    221   //printf("%p\n", this);
    222   //this->getRelCoor().debug();
    223 
    224   /* link tick to weapon */
    225   //this->activeWeapon->tick(time);
    226   //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
    227   this->weaponMan->tick(time);
    228212  // player controlled movement
    229213  this->move(time);
     214
     215  this->weaponMan->tick(time);
    230216  // weapon system manipulation
    231   this->weapon();
     217  this->weaponAction();
    232218}
    233219
     
    255241  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    256242    accel = accel + (orthDirection*acceleration);
    257   if( this->bAscend )
     243  if( this->bAscend ) { /* FIXME */ }
    258244  if( this->bDescend) {/* FIXME */} /* @todo up and down player movement */
    259245
     
    264250
    265251/**
    266  *  weapon manipulation by the player
    267 */
    268 void Player::weapon()
     252 * weapon manipulation by the player
     253*/
     254void Player::weaponAction()
    269255{
    270256  if( this->bFire)
     
    279265}
    280266
    281 
    282 /**
    283  *  The connection to the command node
    284  * @param cmd the Command unit from witch to map
    285 
    286    here the commands are mapped to the players movement/weaponary
    287 */
    288 void Player::command (Command* cmd)
    289 {
    290   PRINTF(3)("recieved command [%s]\n", cmd->cmd);
    291   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp;
    292   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp;
    293   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp;
    294   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp;
    295   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp;
    296   if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
    297 }
    298 
    299267/**
    300268 * @todo switch statement ??
     
    303271{
    304272  if( event.type == KeyMapper::PEV_UP)
    305     {
    306273      this->bUp = event.bPressed;
    307     }
    308274  else if( event.type == KeyMapper::PEV_DOWN)
    309     {
    310275      this->bDown = event.bPressed;
    311     }
    312276  else if( event.type == KeyMapper::PEV_RIGHT)
    313     {
    314277      this->bRight= event.bPressed;
    315     }
    316278  else if( event.type == KeyMapper::PEV_LEFT)
    317     {
    318279      this->bLeft = event.bPressed;
    319     }
    320280  else if( event.type == KeyMapper::PEV_FIRE1)
    321     {
    322        this->bFire = event.bPressed;
    323     }
     281      this->bFire = event.bPressed;
    324282  else if( event.type == KeyMapper::PEV_NEXT_WEAPON)
    325     {
    326283      if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    327     }
    328 
    329 }
     284
     285}
Note: See TracChangeset for help on using the changeset viewer.