Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6804 in orxonox.OLD for trunk/src/world_entities/space_ships


Ignore:
Timestamp:
Jan 28, 2006, 11:29:03 AM (18 years ago)
Author:
bensch
Message:

trunk: remastered Playables a bit

Location:
trunk/src/world_entities/space_ships
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/helicopter.cc

    r6724 r6804  
    124124
    125125  //cycle = 0.0;
    126  
     126
    127127  // cameraissue
    128128  this->cameraNode.setParent(this);
    129129  this->cameraNode.setParentMode(PNODE_ALL);
    130  
    131  
     130
     131
    132132  // rotors
    133133  this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    134134  this->tailRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    135  
     135
    136136  this->topRotor.setParent(this);
    137137  this->tailRotor.setParent(this);
    138  
     138
    139139  this->topRotor.setRelCoor(Vector(-0.877,0.627,0));
    140140  this->tailRotor.setRelCoor(Vector(-4.43,0.297,0.068));
    141141  this->tailRotor.setAbsDir(Quaternion(M_PI_2,Vector(1,0,0)));
    142  
     142
    143143  this->loadModel("models/ships/rotor.obj",1.0,3);
    144144  this->loadModel("models/ships/rotor.obj",0.2,4);
     
    274274void Helicopter::tick (float time)
    275275{
     276  Playable::tick(time);
     277
    276278  if( xMouse != 0 || yMouse != 0)
    277279   {
     
    281283    else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;
    282284  }
    283  
     285
    284286  // rotorrotation
    285287  this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    286288  this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    287  
     289
    288290  // spaceship controlled movement
    289291  this->calculateVelocity(time);
     
    293295  // this is the air friction (necessary for a smooth control)
    294296  if(velocity.len() != 0) velocity -= velocity*0.1;
    295  
     297
    296298  //travelSpeed = velocity.len();
    297299
     
    301303  this->shiftCoor(getAbsDirY()*rotorspeed);
    302304  */
    303  
     305
    304306  /*
    305307  //hoover effect
     
    316318  this->shiftCoor (move);
    317319  //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
    318 
    319   this->getWeaponManager()->tick(time);
    320   // weapon system manipulation
    321   this->weaponAction();
    322320}
    323321
     
    338336     //this->shiftCoor(this->getAbsDirX());
    339337     //accel -= this->getAbsDirY();
    340      
     338
    341339     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
    342340     if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
     
    351349     //this->shiftCoor((this->getAbsDirX())*-1);
    352350     //accel -= this->getAbsDirY();
    353      
     351
    354352     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
    355353     rotValZ += time;
     
    365363    //accel -= this->getAbsDirY();
    366364    //velocityDir.normalize();
    367    
     365
    368366    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
    369367    rotValX -= time;
     
    379377    //accel += this->getAbsDirY();
    380378    //velocityDir.normalize();
    381    
     379
    382380    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
    383381    rotValX += time;
     
    446444{
    447445  WorldEntity::draw();
    448  
     446
    449447  glMatrixMode(GL_MODELVIEW);
    450448    glPushMatrix();
     
    474472}
    475473
    476 
    477 /**
    478  * weapon manipulation by the player
    479 */
    480 void Helicopter::weaponAction()
    481 {
    482   if( this->bFire)
    483     {
    484       this->getWeaponManager()->fire();
    485     }
    486 }
    487 
    488474/**
    489475 * @todo switch statement ??
     
    491477void Helicopter::process(const Event &event)
    492478{
    493 
     479  Playable::process(event);
    494480
    495481  if( event.type == KeyMapper::PEV_LEFT)
     
    497483  else if( event.type == KeyMapper::PEV_RIGHT)
    498484      this->bRight = event.bPressed;
    499   else if( event.type == KeyMapper::PEV_FIRE1)
    500       this->bFire = event.bPressed;
    501   else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    502     this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    503   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    504     this->getWeaponManager()->previousWeaponConfig();
    505485  else if( event.type == SDLK_e)
    506486    this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
     
    517497
    518498    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)));
    519    
     499
    520500    Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1));
    521501
    522    
     502
    523503    if ((this->cameraNode.getAbsDirY()).y < 0.5)
    524504    {
  • trunk/src/world_entities/space_ships/helicopter.h

    r6724 r6804  
    2121    virtual ~Helicopter();
    2222
    23     void init();
    2423    virtual void loadParams(const TiXmlElement* root);
    2524
     
    4039
    4140  private:
     41    void init();
    4242    void calculateVelocity(float time);
    43     void weaponAction();
    4443
    4544    // !! temporary !!
     
    6362    int                   controlVelocityY;
    6463    //float                 cycle;              //!< hovercycle
    65    
     64
    6665    PNode                 topRotor;
    6766    PNode                 tailRotor;
    68    
     67
    6968    PNode                 cameraNode;
    7069
  • trunk/src/world_entities/space_ships/hover.cc

    r6803 r6804  
    252252 * @param time The timespan passed since last update
    253253*/
    254 void Hover::tick (float time)
    255 {
     254void Hover::tick (float dt)
     255{
     256  Playable::tick(dt);
     257
    256258  if( xMouse != 0 || yMouse != 0)
    257259   {
     
    263265
    264266  // spaceship controlled movement
    265   this->calculateVelocity(time);
    266 
    267   Vector move = (velocity)*time;
     267  this->calculateVelocity(dt);
     268
     269  Vector move = (velocity)*dt;
    268270
    269271  // this is the air friction (necessary for a smooth control)
     
    271273  this->shiftCoor (move);
    272274
    273   this->getWeaponManager()->tick(time);
    274   // weapon system manipulation
    275   this->weaponAction();
    276275}
    277276
     
    400399{
    401400  Vector tmpRot;
    402 
    403401  WorldEntity::draw();
    404402
     
    463461void Hover::process(const Event &event)
    464462{
    465 
     463  Playable::process(event);
    466464
    467465  if( event.type == KeyMapper::PEV_LEFT)
     
    469467  else if( event.type == KeyMapper::PEV_RIGHT)
    470468      this->bRight = event.bPressed;
    471   else if( event.type == KeyMapper::PEV_FIRE1)
    472       this->bFire = event.bPressed;
    473   else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    474     this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    475   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    476     this->getWeaponManager()->previousWeaponConfig();
    477469  else if( event.type == SDLK_e)
    478470    this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6803 r6804  
    306306void SpaceShip::tick (float time)
    307307{
    308   this->getWeaponManager()->tick(time);
    309   // weapon system manipulation
    310   this->weaponAction();
     308  Playable::tick(time);
    311309
    312310  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == this->getHostID() )
     
    464462
    465463/**
    466  * weapon manipulation by the player
    467 */
    468 void SpaceShip::weaponAction()
    469 {
    470   if( this->bFire)
    471     {
    472       this->getWeaponManager()->fire();
    473     }
    474 }
    475 
    476 /**
    477464 * @todo switch statement ??
    478465 */
    479466void SpaceShip::process(const Event &event)
    480467{
     468  Playable::process(event);
     469
    481470  if( event.type == KeyMapper::PEV_LEFT)
    482471      this->bRollL = event.bPressed;
    483472  else if( event.type == KeyMapper::PEV_RIGHT)
    484473      this->bRollR = event.bPressed;
    485   else if( event.type == KeyMapper::PEV_FIRE1)
    486       this->bFire = event.bPressed;
    487   else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    488   {
    489     this->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    490   }
    491   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    492     this->previousWeaponConfig();
    493474  else if( event.type == KeyMapper::PEV_UP)
    494475    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
  • trunk/src/world_entities/space_ships/space_ship.h

    r6756 r6804  
    2727    virtual ~SpaceShip();
    2828
    29     void init();
    3029    virtual void loadParams(const TiXmlElement* root);
    3130
     
    4746
    4847  private:
     48    void init();
    4949
    5050    void calculateVelocity(float time);
    51     void weaponAction();
    5251
    5352    // !! temporary !!
Note: See TracChangeset for help on using the changeset viewer.