Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3226 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Dec 20, 2004, 12:27:51 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: world fixed (still unstable)

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

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

    r3220 r3226  
    4747Orxonox::~Orxonox ()
    4848{
    49   Orxonox::singleton_ref = NULL;
     49  Orxonox::singletonRef = NULL;
    5050  if( world != NULL) delete world;
    5151  if( localinput != NULL) delete world;
     
    5656
    5757/* this is a singleton class to prevent duplicates */
    58 Orxonox* Orxonox::singleton_ref = 0;
     58Orxonox* Orxonox::singletonRef = 0;
    5959
    6060Orxonox* Orxonox::getInstance (void)
    6161{
    62   if (singleton_ref == NULL)
    63     singleton_ref = new Orxonox();
    64   return singleton_ref;
     62  if (singletonRef == NULL)
     63    singletonRef = new Orxonox();
     64  return singletonRef;
    6565}
    6666
     
    7272   it's path and name into configfilename
    7373*/
    74 void Orxonox::get_config_file (int argc, char** argv)
     74void Orxonox::getConfigFile (int argc, char** argv)
    7575{
    7676  strcpy (configfilename, "orxonox.conf");
     
    8585  // config file
    8686 
    87   get_config_file (argc, argv);
     87  getConfigFile (argc, argv);
    8888  SDL_Init (SDL_INIT_TIMER);
    8989  // initialize everything
    90   if( init_video () == -1) return -1;
    91   if( init_sound () == -1) return -1;
     90  if( initVideo() == -1) return -1;
     91  if( initSound() == -1) return -1;
    9292  printf("> Initializing input\n");
    93   if( init_input () == -1) return -1;
     93  if( initInput() == -1) return -1;
    9494  printf("> Initializing networking\n");
    95   if( init_networking () == -1) return -1;
     95  if( initNetworking () == -1) return -1;
    9696  printf("> Initializing resources\n");
    97   if( init_resources () == -1) return -1;
     97  if( initResources () == -1) return -1;
    9898  //printf("> Initializing world\n");
    9999  //if( init_world () == -1) return -1; PB: world will be initialized when started
     
    105105   \brief initializes SDL and OpenGL
    106106*/
    107 int Orxonox::init_video ()
     107int Orxonox::initVideo()
    108108{
    109109  printf("> Initializing video\n");
    110   if (SDL_Init (SDL_INIT_VIDEO) == -1)
     110  if (SDL_Init(SDL_INIT_VIDEO) == -1)
    111111    {
    112112      printf ("could not initialize SDL Video\n");
     
    115115  // Set video mode
    116116  // TO DO: parse arguments for settings
    117   SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 5);
    118   SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5);
    119   SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5);
    120   SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
     117  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
     118  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
     119  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
     120  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    121121 
    122122  int bpp = 16;
     
    125125  Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
    126126 
    127   if( (screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
     127  if((screen = SDL_SetVideoMode (width, height, bpp, flags)) == NULL)
    128128  {
    129     printf ("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
     129    printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, flags, SDL_GetError());
    130130    SDL_Quit();
    131131    return -1;
     
    133133 
    134134  // Set window labeling
    135   SDL_WM_SetCaption( "Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
     135  SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    136136 
    137137  // TO DO: Create a cool icon and use it here
     
    169169   \brief initializes the sound engine
    170170*/
    171 int Orxonox::init_sound ()
     171int Orxonox::initSound()
    172172{
    173173  printf("> Initializing sound\n");
    174   // SDL_Init (SDL_INIT_AUDIO);
     174  // SDL_Init(SDL_INIT_AUDIO);
    175175  printf("Not yet implemented\n");
    176176  return 0;
     
    181181   \brief initializes input functions
    182182*/
    183 int Orxonox::init_input ()
     183int Orxonox::initInput()
    184184{
    185185  // create localinput
     
    193193   \brief initializes network system
    194194*/
    195 int Orxonox::init_networking ()
     195int Orxonox::initNetworking()
    196196{
    197197  printf("Not yet implemented\n");
     
    203203   \brief initializes and loads resource files
    204204*/
    205 int Orxonox::init_resources ()
     205int Orxonox::initResources()
    206206{
    207207  printf("Not yet implemented\n");
     
    213213   \brief initializes the world
    214214*/
    215 int Orxonox::init_world ()
     215int Orxonox::initWorld()
    216216{
    217217  //world = new World();
     
    256256   \param event: an event not handled by the CommandNode
    257257*/
    258 void Orxonox::event_handler (SDL_Event* event)
     258void Orxonox::eventHandler(SDL_Event* event)
    259259{
    260260  // Handle special events such as reshape, quit, focus changes
     
    267267   \return true if the command was handled by the system or false if it may be passed to the WorldEntities
    268268*/
    269 bool Orxonox::system_command (Command* cmd)
     269bool Orxonox::systemCommand(Command* cmd)
    270270{
    271271  /*
     
    285285   \return a pointer to localcamera
    286286*/
    287 Camera* Orxonox::get_camera ()
     287Camera* Orxonox::getCamera()
    288288{
    289289  return localcamera;
     
    295295   \return a pointer to localinput
    296296*/
    297 CommandNode* Orxonox::get_localinput ()
     297CommandNode* Orxonox::getLocalInput()
    298298{
    299299  return localinput;
     
    305305   \return a pointer to world
    306306*/
    307 World* Orxonox::get_world ()
     307World* Orxonox::getWorld()
    308308{
    309309  return world;
     
    313313
    314314
    315 int main (int argc, char** argv)
     315int main(int argc, char** argv)
    316316
    317317  printf(">>> Starting Orxonox <<<\n");
    318318  Orxonox *orx = Orxonox::getInstance();
    319319 
    320   if( (*orx).init(argc, argv) == -1)
     320  if((*orx).init(argc, argv) == -1)
    321321    {
    322322      printf("! Orxonox initialization failed\n");
  • orxonox/trunk/src/orxonox.h

    r3224 r3226  
    2222
    2323 private:
    24   static Orxonox* singleton_ref;
     24  static Orxonox* singletonRef;
    2525  Orxonox ();
    2626  ~Orxonox ();
     
    3838  Uint32 lastframe;
    3939 
    40   void get_config_file (int argc, char** argv);
     40  void getConfigFile (int argc, char** argv);
    4141 
    4242  // main loop functions
     
    4848 
    4949        // subsystem initialization
    50   int init_video ();
    51   int init_sound ();
    52   int init_input ();
    53   int init_networking ();
    54   int init_resources ();
    55   int init_world ();
     50  int initVideo ();
     51  int initSound ();
     52  int initInput ();
     53  int initNetworking ();
     54  int initResources ();
     55  int initWorld ();
    5656 
    5757 public:
     
    6060  void quitGame();
    6161
    62   void event_handler (SDL_Event* event);
    63   bool system_command (Command* cmd);
     62  void eventHandler (SDL_Event* event);
     63  bool systemCommand (Command* cmd);
    6464
    6565  int init (int argc, char** argv);
    6666 
    67   CommandNode* get_localinput();
    68   Camera* get_camera();
    69   World* get_world();
     67  CommandNode* getLocalInput();
     68  Camera* getCamera();
     69  World* getWorld();
    7070 
    7171  //void mainLoop();
  • orxonox/trunk/src/player.cc

    r3210 r3226  
    2626{
    2727
    28   this->obj = new Object ("reaplow.obj");
     28  this->obj = new Object("reaplow.obj");
    2929  /*
    3030  objectList = glGenLists(1);
     
    5454}
    5555
    56 Player::~Player ()
     56Player::~Player()
    5757{
    5858  delete this->obj;
    5959}
    6060
    61 void Player::post_spawn ()
     61void Player::postSpawn()
    6262{
    6363  travel_speed = 15.0;
     
    6666  bFire = false;
    6767  acceleration = 10.0;
    68   set_collision (new CollisionCluster (1.0, Vector(0,0,0)));
     68  setSollision(new CollisionCluster(1.0, Vector(0,0,0)));
    6969}
    7070
    71 void Player::tick (float time)
     71void Player::tick(float time)
    7272{
    7373  // movement
     
    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);
     105  glTranslatef(get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);
    106106  get_placement()->w.matrix (matrix);
    107   glMultMatrixf ((float*)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 
     
    117117}
    118118
    119 void Player::get_lookat (Location* locbuf)
     119void Player::getLookat(Location* locbuf)
    120120{
    121121  *locbuf = *get_location();
     
    123123}
    124124
    125 void Player::left_world ()
     125void Player::leftWorld()
    126126{
    127127}
    128128
    129 void Player::move (float time)
     129void Player::move(float time)
    130130{
    131131  Vector accel(0.0, 0.0, 0.0);
     
    158158  l->pos = l->pos + accel*time;
    159159}
    160 
    161 
    162 
    163 
    164 
    165 
    166 
    167 
    168 
    169 
    170 
    171 
    172 
    173 
    174 
    175 
    176 
    177 
  • orxonox/trunk/src/player.h

    r3224 r3226  
    1616 
    1717 public:
    18   Player (bool isFree = false);
    19   ~Player ();
     18  Player(bool isFree = false);
     19  ~Player();
    2020 
    21   virtual void post_spawn ();
    22   virtual void tick (float time);
    23   virtual void hit (WorldEntity* weapon, Vector loc);
    24   virtual void destroy ();
    25   virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
    26   virtual void command (Command* cmd);
     21  virtual void post_spawn();
     22  virtual void tick(float time);
     23  virtual void hit(WorldEntity* weapon, Vector loc);
     24  virtual void destroy();
     25  virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
     26  virtual void command(Command* cmd);
    2727 
    28   virtual void draw ();
    29   virtual void get_lookat (Location* locbuf);
     28  virtual void draw();
     29  virtual void getLookat(Location* locbuf);
    3030 
    31   virtual void left_world ();
     31  virtual void leftWorld();
    3232 
    3333 private:
     
    4040  Object* obj;
    4141 
    42   void move (float time);
     42  void move(float time);
    4343 
    4444};
  • orxonox/trunk/src/world.cc

    r3225 r3226  
    5252{
    5353  printf("World::~World() - deleting current world\n");
    54   CommandNode* cn = Orxonox::getInstance()->get_localinput();
     54  CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    5555  cn->unbind(this->localPlayer);
    5656  cn->reset();
     
    7575{
    7676  this->bPause = false;
    77   CommandNode* cn = Orxonox::getInstance()->get_localinput();
     77  CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    7878  cn->addToWorld(this);
    7979  cn->enable(true);
     
    148148            // bind input
    149149            Orxonox *orx = Orxonox::getInstance();
    150             orx->get_localinput()->bind (myPlayer);
     150            orx->getLocalInput()->bind (myPlayer);
    151151           
    152152            // bind camera
     
    188188            // bind input
    189189            Orxonox *orx = Orxonox::getInstance();
    190             orx->get_localinput()->bind (myPlayer);
     190            orx->getLocalInput()->bind (myPlayer);
    191191           
    192192            // bind camera
     
    601601      synchronize();
    602602      // Process input
    603       handle_input();
     603      handleInput();
    604604      if( this->bQuitCurrentGame || this->bQuitOrxonox)
    605605        {
  • orxonox/trunk/src/world.h

    r3225 r3226  
    7878  void mainLoop ();
    7979  void synchronize ();
    80   void handle_input ();
     80  void handleInput ();
    8181  void timeSlice ();
    8282  void collision ();
Note: See TracChangeset for help on using the changeset viewer.