Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5483 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 4, 2005, 1:51:35 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better banking of the player, and memory leak fix

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/loading/resource_manager.cc

    r5482 r5483  
    156156    return true;
    157157  }
     158  delete[] realDir;
    158159  return false;
    159160}
  • trunk/src/world_entities/player.cc

    r5482 r5483  
    286286  if( this->bDown && this->getRelCoor().x > -5)
    287287    accel = accel -(direction*acceleration);
    288   if( this->bLeft)
    289   {
    290     if( TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
     288  if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
    291289      accel = accel - (orthDirection*acceleration);
    292     else
    293       this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    294   }
    295   if( this->bRight)
    296   {
    297    if (TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    298     accel = accel + (orthDirection*acceleration);
    299    else
    300      this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    301   }
     290  if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
     291     accel = accel + (orthDirection*acceleration);
    302292  if( this->bAscend ) { /* FIXME */ }
    303293  if( this->bDescend) {/* FIXME */} /* @todo up and down player movement */
    304294
    305295  Vector move = accel * time;
     296
     297  if (accel.z < 0)
     298    this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5);
     299  else if (accel.z > 0)
     300    this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5);
     301  else
     302    this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    306303  this->shiftCoor (move);
    307304}
     
    329326      this->bDown = event.bPressed;
    330327  else if( event.type == KeyMapper::PEV_RIGHT)
    331   {
    332328      this->bRight= event.bPressed;
    333       if (event.bPressed)
    334         this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5);
    335       else
    336         this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    337   }
    338329  else if( event.type == KeyMapper::PEV_LEFT)
    339   {
    340330      this->bLeft = event.bPressed;
    341       if (event.bPressed)
    342         this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5);
    343       else
    344         this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
    345   }
    346331  else if( event.type == KeyMapper::PEV_FIRE1)
    347332      this->bFire = event.bPressed;
Note: See TracChangeset for help on using the changeset viewer.