Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

trunk: remastered Playables a bit

File:
1 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    {
Note: See TracChangeset for help on using the changeset viewer.