Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3586 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Mar 17, 2005, 2:15:33 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: fixed movement bug (was in the lists), modified the player

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/command_node.cc

    r3236 r3586  
    214214  while( SDL_PollEvent (&event))
    215215    {
     216      printf("CommandNode::processLocal() =========================got Event\n");
    216217      memset (cmd.cmd, 0, CMD_LENGHT);
    217218      switch( event.type)
     
    267268void CommandNode::relay (Command* cmd)
    268269{
    269 
    270270  Orxonox *orx = Orxonox::getInstance();
    271271  if( orx->systemCommand (cmd)) return;
     
    281281  while( entity != NULL)
    282282    {
    283       entity->command (cmd);
     283      entity->command (cmd); /*no absorbtion of command! strange*/
    284284      entity = bound->nextElement();
    285285    }
  • orxonox/trunk/src/lib/util/list.h

    r3585 r3586  
    120120void tList<T>::add(T* entity)
    121121{
     122  if( entity == NULL) return;
    122123  listElement* el = new listElement;
    123124  el->prev = this->last;
     
    136137void tList<T>::remove(T* entity)
    137138{
     139  if( entity == NULL) return;
    138140  this->currentEl = this->first;
    139141  listElement* te;
     
    200202T* tList<T>::enumerate()
    201203{
    202   if(this->last == this->first) return NULL;
     204  //if( this->last == this->first == NULL) return NULL;
     205  if(this->size == 0) return NULL;
    203206  this->currentEl = this->first;
    204207  return this->currentEl->curr;
     
    209212T* tList<T>::nextElement()
    210213{
    211   if(this->last == this->first) return NULL;
     214  // if( this->last == this->first == NULL) return NULL;
     215  if(this->size == 0) return NULL;
    212216  this->currentEl = this->currentEl->next;
    213217  if(this->currentEl == NULL) return NULL;
     
    222226T* tList<T>::nextElement(T* toEntity)
    223227{
    224   if( this->last == this->first) return NULL;
     228  //if( this->last == this->first == NULL) return NULL;
     229  if(this->size == 0) return NULL;
    225230  if( toEntity == NULL) return this->first->curr;
    226231  if( toEntity == this->last->curr ) return this->first->curr;
  • orxonox/trunk/src/orxonox.conf

    r3584 r3586  
    55RIGHT=right
    66SPACE=fire
    7 m=weapon_mode
     7m=mode
    88ESCAPE=quit
    99p=pause
     
    1111BUTTON_LEFT=fire
    1212BUTTON_RIGHT=altfire
    13 b=benscho
    1413x=up_world
    1514z=down_world
  • orxonox/trunk/src/story_entities/world.cc

    r3573 r3586  
    181181
    182182            //create helper for player
    183             HelperParent* hp = new HelperParent ();
     183            //HelperParent* hp = new HelperParent ();
    184184            /* the player has to be added to this helper */
    185185
    186186            // create a player
    187             WorldEntity* myPlayer = new Player ();
    188             myPlayer->setName ("player");
    189             this->spawn (myPlayer);
    190             this->localPlayer = myPlayer;
     187            this->localPlayer = new Player ();
     188            this->localPlayer->setName ("player");
     189            this->spawn (this->localPlayer);
    191190            /*monitor progress*/
    192191            this->glmis->step();           
     
    194193            // bind input
    195194            Orxonox *orx = Orxonox::getInstance ();
    196             orx->getLocalInput()->bind (myPlayer);
     195            orx->getLocalInput()->bind (this->localPlayer);
    197196           
    198197            // bind camera
    199198            this->localCamera = new Camera(this);
    200199            this->localCamera->setName ("camera");
    201             this->localCamera->bind (myPlayer);
     200            this->localCamera->bind (this->localPlayer);
    202201            /*monitor progress*/
    203202            this->glmis->step();           
     
    217216            this->spawn(env);
    218217
    219             /*
    220             Vector* es = new Vector (50, 2, 0);
    221             Quaternion* qs = new Quaternion ();
    222             WorldEntity* pr = new Primitive(PSPHERE);
    223             pr->setName("primitive");
    224             this->spawn(pr, this->localPlayer, es, qs, ROTATION);
    225             */
    226 
     218           
     219            //Vector* es = new Vector (10, 5, 0);
     220            //Quaternion* qs = new Quaternion ();
     221            //WorldEntity* pr = new Primitive(PSPHERE);
     222            //pr->setName("primitive");
     223            //this->spawn(pr, this->localPlayer, es, qs, PNODE_ROTATE_AND_MOVE);
     224           
    227225
    228226            /*monitor progress*/
     
    231229            //      trackManager->setBindSlave(env);
    232230            PNode* tn = trackManager->getTrackNode();
    233             tn->addChild(myPlayer);
     231            tn->addChild(this->localPlayer);
    234232
    235233            //localCamera->setParent(TrackNode::getInstance());
    236234            tn->addChild (this->localCamera);
    237             myPlayer->setMode(PNODE_ROTATE_AND_MOVE);
     235            this->localPlayer->setMode(PNODE_ROTATE_AND_MOVE);
    238236            //Vector* cameraOffset = new Vector (0, 5, -10);
    239237            Vector* cameraOffset = new Vector (-10, 5, 0);
    240238            this->localCamera->setRelCoor (cameraOffset);
    241             trackManager->condition(2, NEAREST, myPlayer);
     239            trackManager->condition(2, NEAREST, this->localPlayer);
    242240
    243241            break;
     
    267265            skySphere = new Skysphere("../data/pictures/sky-replace.jpg");
    268266            this->localPlayer->addChild(this->skySphere);
     267
     268            Vector* es = new Vector (20, 0, 0);
     269            Quaternion* qs = new Quaternion ();
     270            WorldEntity* pr = new Primitive(PSPHERE);
     271            pr->setName("primitive");
     272            this->spawn(pr, this->localPlayer, es, qs, PNODE_ROTATE_AND_MOVE);
    269273
    270274            break;
     
    721725      entity->setRelCoor (relCoor);
    722726      entity->setRelDir (relDir);
     727      entity->setMode(parentingMode);
    723728     
    724729      this->entities->add (entity);
  • orxonox/trunk/src/world_entities/player.cc

    r3585 r3586  
    167167  //orthDirection = orthDirection.cross (direction);
    168168
    169   if( bUp) { accel = accel+(direction*acceleration); }
    170   if( bDown) { accel = accel-(direction*acceleration); }
    171   if( bLeft ) { accel = accel - (orthDirection*acceleration); }
    172   if( bRight ) { accel = accel + (orthDirection*acceleration); }
    173   if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    174   if( bDescend) {/* FIXME */} /* \todo up and down player movement */
     169  if( this->bUp) { accel = accel+(direction*acceleration); }
     170  if( this->bDown) { accel = accel-(direction*acceleration); }
     171  if( this->bLeft ) { accel = accel - (orthDirection*acceleration); }
     172  if( this->bRight ) { accel = accel + (orthDirection*acceleration); }
     173  if( this->bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
     174  if( this->bDescend) {/* FIXME */} /* \todo up and down player movement */
    175175
    176176  Vector move = accel * time;
     
    211211  else if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    212212  else if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
    213   else if( !strcmp( cmd->cmd, "weapon_mode")) this->bWeaponChange = !cmd->bUp;
    214 }
     213  else if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;
     214}
  • orxonox/trunk/src/world_entities/primitive.cc

    r3578 r3586  
    2626
    2727
     28
     29/**
     30   \brief standard constructor
     31*/
    2832Primitive::Primitive (PRIMITIVE_FORM form) : WorldEntity()
    2933{
    30   this->model = new OBJModel("../data/models/fighter.obj");
     34  //this->model = new OBJModel("../data/models/fighter.obj");
    3135  //this->model = new OBJModel("");
     36  this->object = gluNewQuadric();
     37
     38  gluQuadricTexture(this->object, GL_TRUE);
     39
     40  this->material = new Material("Sky");
     41  this->material->setDiffuseMap("../data/pictures/sky-replace.jpg");
     42  this->material->setIllum(3);
     43  this->material->setAmbient(1.0, 1.0, 1.0);
    3244}
    3345
    3446
    35 
     47/**
     48   \brief standard deconstructor
     49*/
    3650Primitive::~Primitive ()
    3751{
    38 
     52  delete this->material;
     53  free(this->object);
    3954}
    4055
     56/**
     57   \brief called, when the object gets hit
     58   \param other object, that hits it
     59   \param location of impact
     60*/
     61void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
     62
     63
     64/**
     65   \brief object collides
     66*/
     67void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
     68
     69
     70/**
     71   \brief tick singal put everything here, that is timedependent
     72   \param time in sec
     73*/
    4174void Primitive::tick (float time)
    4275{
    43   Vector v(0.0, 0.0, 1.0);
    44   Quaternion q(10.0, v);
     76  //Vector v(0.0, 0.0, 1.0);
     77  //Quaternion q(10.0, v);
    4578  //this->relDirection = this->relDirection * q;
    4679}
    4780
    48 void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
    49 
    50 
    51 void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
    52 
     81/**
     82   \brief drawing function of the object
     83*/
    5384void Primitive::draw ()
    5485{
    5586  glMatrixMode(GL_MODELVIEW);
    5687  glPushMatrix();
     88
    5789  float matrix[4][4];
    58  
    5990  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    6091  //rotate
    61   this->getAbsDir().matrix (matrix);
    62   glMultMatrixf((float*)matrix);
    63  
    64   this->model->draw();
     92  //this->getAbsDir().matrix (matrix);
     93  //glMultMatrixf((float*)matrix);
     94  gluSphere(this->object, 2, 20, 20);
     95
    6596  glPopMatrix();
    6697}
  • orxonox/trunk/src/world_entities/primitive.h

    r3578 r3586  
    1919  virtual void draw ();
    2020
     21 private:
     22  GLUquadricObj *object; //!< the object to be rendered
     23  Material *material;    //!< A Material for the SkySphere.
     24
    2125};
    2226
  • orxonox/trunk/src/world_entities/skysphere.cc

    r3566 r3586  
    3838Skysphere::Skysphere()
    3939
    40   initialize("../data/pictures/sky-replace.jpg");
     40  this->initialize("../data/pictures/sky-replace.jpg");
    4141}
    4242
     
    4848Skysphere::Skysphere(char* fileName)
    4949{
    50   initialize(fileName);
     50  this->initialize(fileName);
    5151}
    5252
     
    108108 
    109109  skyMaterial->select();
    110   gluSphere(sphereObj, sphereRadius, 20, 20);
     110  gluSphere(this->sphereObj, this->sphereRadius, 20, 20);
    111111  glPopMatrix();
    112112}
Note: See TracChangeset for help on using the changeset viewer.