Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5751 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 24, 2005, 1:14:06 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: really cool hack, to let the fighter fly up and down :)

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/campaign.cc

    r5671 r5751  
    9191    return;
    9292
    93   const TiXmlElement* element = root->FirstChildElement();
    94   // load Worlds/Subcampaigns/Whatever
    95   StoryEntity* lastCreated = NULL;
    96   while( element != NULL)
     93  LOAD_PARAM_START_CYCLE(root, element);
    9794  {
    9895    PRINTF(5)("Campaign: Constructor: adding a world\n");
    9996    StoryEntity* created = (StoryEntity*) GameLoader::getInstance()->fabricate(element);
    100       /*
    101     if( lastCreated != NULL)
    102     created->setNextStoryID( lastCreated->getStoryID());
    103     else
    104     created->setNextStoryID( WORLD_ID_GAMEEND);
    105       */
    10697    if( created != NULL)
    10798    {
    10899      this->addEntity( created);
    109       lastCreated = created;
    110     }
    111     element = element->NextSiblingElement();
     100    }
    112101  }
     102  LOAD_PARAM_END_CYCLE(element);
    113103}
    114104
  • trunk/src/story_entities/world.cc

    r5750 r5751  
    371371  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
    372372  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
     373  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEUP);
     374  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEDOWN);
    373375
    374376  // bind camera
  • trunk/src/world_entities/camera.cc

    r5384 r5751  
    167167      this->setParentSoft("TrackNode");
    168168      this->target->setParentSoft("TrackNode");
    169       this->setRelCoorSoft(Vector(0, 10, 0));
    170       this->target->setRelCoorSoft(0,0,0);
     169      this->setRelCoorSoft(Vector(30, 50, 0));
     170      this->target->setRelCoorSoft(35,0,0);
    171171    }
    172172}
  • trunk/src/world_entities/player.cc

    r5750 r5751  
    273273{
    274274  Vector accel(0.0, 0.0, 0.0);
     275  Vector rot(0.0, 0.0, 0.0);
     276  float rotVal = 0.0;
    275277  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    276278  /* calculate the direction in which the craft is heading  */
     
    281283
    282284  if( this->bUp && this->getRelCoor().x < 20)
    283     accel = accel+(direction*acceleration);
     285    accel += direction;
    284286  if( this->bDown && this->getRelCoor().x > -5)
    285     accel = accel -(direction*acceleration);
     287    accel -= direction;
     288
    286289  if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
    287       accel = accel - (orthDirection*acceleration);
     290  {
     291    accel -=(orthDirection);
     292    rot +=Vector(1,0,0);
     293    rotVal -= .4;
     294  }
    288295  if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    289      accel = accel + (orthDirection*acceleration);
     296  {
     297    accel += orthDirection;
     298    rot += Vector(1,0,0);
     299    rotVal += .4;
     300  }
     301  if (this->bAscend )
     302  {
     303    accel += Vector(0,1,0);
     304    rot += Vector(0,0,1);
     305    rotVal += .4;
     306  }
     307  if (this->bDescend )
     308  {
     309    accel -= Vector(0,1,0);
     310    rot += Vector(0,0,1);
     311    rotVal -= .4;
     312  }
     313
    290314  if( this->bAscend ) { /* FIXME */ }
    291315  if( this->bDescend) {/* FIXME */} /* @todo up and down player movement */
    292316
    293   Vector move = accel * time;
    294 
    295   if (accel.z < 0)
    296     this->setRelDirSoft(Quaternion(-.4, Vector(1,0,0)), 5);
     317  Vector move = accel * time *acceleration;
     318
     319/*  if (accel.z < 0)
     320    this->setRelDirSoft(Quaternion(-.4, accel), 5);
    297321  else if (accel.z > 0)
    298     this->setRelDirSoft(Quaternion(.4, Vector(1,0,0)), 5);
    299   else
    300     this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 5);
     322    this->setRelDirSoft(Quaternion(.4, accel), 5);
     323  else*/
     324  rot.normalize();
     325  this->setRelDirSoft(Quaternion(rotVal, rot), 5);
    301326  this->shiftCoor (move);
    302327}
     
    333358  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    334359    this->weaponMan->previousWeaponConfig();
     360
     361  else if( event.type == SDLK_PAGEUP)
     362    this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
     363  else if( event.type == SDLK_PAGEDOWN)
     364    this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
    335365}
    336366
Note: See TracChangeset for help on using the changeset viewer.