Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3238 in orxonox.OLD for orxonox/branches/nico/src/player.cc


Ignore:
Timestamp:
Dec 20, 2004, 2:42:54 AM (21 years ago)
Author:
bensch
Message:

orxonox/branches: updated branches: buerli, nico, sound. And moved bezierTrack to old.bezierTrack. Conflicts resolved in a usefull order.
Conflics mostly resolved in favor of trunk
merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico/src/player.cc

    r2969 r3238  
    2626{
    2727
    28   obj = new Object ("reaplow.obj");
     28  this->obj = new Object("reaplow.obj");
    2929  /*
    3030  objectList = glGenLists(1);
     
    5454}
    5555
    56 Player::~Player ()
    57 
     56Player::~Player()
    5857{
     58  delete this->obj;
    5959}
    6060
    61 void Player::post_spawn ()
     61void Player::postSpawn()
    6262{
    63   travel_speed = 15.0;
     63  travelSpeed = 15.0;
    6464  velocity = Vector();
    6565  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    6666  bFire = false;
    6767  acceleration = 10.0;
    68   set_collision (new CollisionCluster (1.0, Vector(0,0,0)));
     68  setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
    6969}
    7070
    71 void Player::tick (float time)
     71void Player::tick(float time)
    7272{
    73         // movement
    74         move (time);
     73  // movement
     74  move (time);
    7575}
    7676
    77 void Player::hit (WorldEntity* weapon, Vector loc)
     77void Player::hit(WorldEntity* weapon, Vector loc)
    7878{
    7979}
    8080
    81 void Player::destroy ()
     81void Player::destroy()
    8282{
    8383}
    8484
    85 void Player::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)
     85void Player::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)
    8686{
    8787}
    8888
    89 void Player::command (Command* cmd)
     89void Player::command(Command* cmd)
    9090{
    9191  //printf("Player|recieved command [%s]\n", cmd->cmd);
     
    9797}
    9898
    99 void Player::draw ()
     99void Player::draw()
    100100{
    101101  glMatrixMode(GL_MODELVIEW);
     
    103103  float matrix[4][4];
    104104 
    105   glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
    106   get_placement()->w.matrix (matrix);
    107   glMultMatrixf ((float*)matrix);
     105  glTranslatef(getPlacement()->r.x, getPlacement()->r.y, getPlacement()->r.z);
     106  getPlacement()->w.matrix (matrix);
     107  glMultMatrixf((float*)matrix);
    108108 
    109   glMatrixMode (GL_MODELVIEW);
    110   glRotatef (-90, 0,1,0);
     109  glMatrixMode(GL_MODELVIEW);
     110  glRotatef(-90, 0,1,0);
    111111  obj->draw();
    112   //  glCallList (objectList);
     112  // glCallList(objectList);
    113113
    114114 
    115115 
    116   //printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);
    117116}
    118117
    119 void Player::get_lookat (Location* locbuf)
     118void Player::getLookat(Location* locbuf)
    120119{
    121         *locbuf = *get_location();
    122         //locbuf->dist += 5.0;
     120  *locbuf = *getLocation();
     121  //locbuf->dist += 5.0;
    123122}
    124123
    125 void Player::left_world ()
     124void Player::leftWorld()
    126125{
    127126}
    128127
    129 void Player::move (float time)
     128void Player::move(float time)
    130129{
    131130  Vector accel(0.0, 0.0, 0.0);
    132   /* FIXME: calculating the direction and orthDirection every time_slice is redundant! save it somewhere */
    133   Placement *pos = get_placement();
     131  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
     132  Placement *pos = getPlacement();
    134133  /* calculate the direction in which the craft is heading  */
    135134  Vector direction(0.0, 0.0, 1.0);
     
    143142  if( bRight ) { accel = accel - (orthDirection*acceleration); }
    144143  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    145   if( bDescend) {/* FIXME */}
     144  if( bDescend) {/* FIXME */} /* \todo up and down player movement */
    146145
    147   Location* l = get_location();
     146  Location* l = getLocation();
    148147 
    149148  // r(t) = r(0) + v(0)*t + 1/2*a*t^2
     
    153152
    154153  /* this the base-speed of the player: determines how fast and how the player follows the track*/
    155   l->dist = l->dist + travel_speed * time;
     154  l->dist = l->dist + travelSpeed * time;
    156155
    157156  /* this updates the player position on the track - user interaction */
    158157  l->pos = l->pos + accel*time;
    159158}
    160 
    161 
    162 
    163 
    164 
    165 
    166 
    167 
    168 
    169 
    170 
    171 
    172 
    173 
    174 
    175 
    176 
    177 
Note: See TracChangeset for help on using the changeset viewer.