Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3225 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Dec 20, 2004, 12:23:58 AM (20 years ago)
Author:
patrick
Message:

/orxonox/trunk: unstable - added many comments and now redefinit all function/variable names with underline

Location:
orxonox/trunk/src
Files:
9 edited

Legend:

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

    r3215 r3225  
    6161   as smooth camera movement or swaying).
    6262*/
    63 void Camera::time_slice (Uint32 deltaT)
     63void Camera::timeSlice (Uint32 deltaT)
    6464{
    6565  if( this->t <= deltaTime)
  • orxonox/trunk/src/camera.h

    r3224 r3225  
    6060  ~Camera ();
    6161 
    62   void time_slice (Uint32 deltaT);
     62  void timeSlice (Uint32 deltaT);
    6363  void apply ();
    6464  void bind (WorldEntity* entity);
  • orxonox/trunk/src/campaign.cc

    r3222 r3225  
    104104      if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) )
    105105        {
    106           printf("Campaign::start() - quiting campaing story loop\n");
     106          printf("Campaign::start() - quitting campaing story loop\n");
    107107          if(se != NULL)
    108108            delete se;
     
    148148}
    149149
     150/*
     151  \brief this changes to the next level
     152*/
    150153void Campaign::nextLevel()
    151154{
     
    157160}
    158161
     162/*
     163  \brief change to the previous level - not implemented
     164
     165  this propably useless
     166*/
    159167void Campaign::previousLevel()
    160168{}
    161169
    162170
     171/*
     172  \brief lookup a entity with a given id
     173  \param story id to be lookuped
     174  \returns the entity found or NULL if search ended without match
     175*/
    163176StoryEntity* Campaign::getStoryEntity(int storyID)
    164177{
  • orxonox/trunk/src/command_node.cc

    r3221 r3225  
    108108   \param filename: The path and name of the file to load the bindings from
    109109*/
    110 void CommandNode::load_bindings (char* filename)
     110void CommandNode::loadBindings (char* filename)
    111111{
    112112  FILE* stream;
     
    125125  // create parser
    126126  IniParser parser (filename);
    127   if( parser.get_section ("Bindings") == -1)
     127  if( parser.getSection ("Bindings") == -1)
    128128    {
    129129      printf("Could not find key bindings in %s\n", filename);
     
    145145        {
    146146        case 0:
    147           printf("Key binding %d(%s) set to %s\n", index[1], SDLK_to_keyname( index[1]), valuebuf);
     147          printf("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), valuebuf);
    148148          strcpy (aliases->keys[index[1]], valuebuf);
    149149          break;
    150150        case 1:
    151           printf("Button binding %d(%s) set to %s\n", index[1], SDLB_to_buttonname( index[1]), valuebuf);
     151          printf("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), valuebuf);
    152152          strcpy (aliases->buttons[index[1]], valuebuf);
    153153          break;
     
    166166void CommandNode::bind (WorldEntity* entity)
    167167{
    168   bound->add(entity);
     168  bound->add (entity);
    169169}
    170170
     
    175175void CommandNode::unbind (WorldEntity* entity)
    176176{
    177   bound->remove(entity);
    178 }
    179 
    180 int* CommandNode::name_to_index (char* name)
     177  bound->remove (entity);
     178}
     179
     180int* CommandNode::nameToIndex (char* name)
    181181{
    182182  coord[0] = -1;
    183183  coord[1] = -1;
    184184  int c;
    185   if( (c = keyname_to_SDLK (name)) != -1)
     185  if( (c = keynameToSDLK (name)) != -1)
    186186    {
    187187      coord[1] = c;
    188188      coord[0] = 0;
    189189    }
    190   if( (c = buttonname_to_SDLB (name)) != -1)
     190  if( (c = buttonnameToSDLB (name)) != -1)
    191191    {
    192192      coord[1] = c;
     
    203203  if( this->bEnabled)
    204204    {
    205       if( bLocalInput) process_local ();
    206       else process_network ();
     205      if( bLocalInput) processLocal ();
     206      else processNetwork ();
    207207    }
    208208}
     
    220220          strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]);
    221221          cmd.bUp = false;
    222           if( strlen (cmd.cmd) > 0) relay (&cmd);
     222          if( strlen (cmd.cmd) > 0) relay(&cmd);
    223223          break;
    224224        case SDL_KEYUP:
    225225          strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]);
    226226          cmd.bUp = true;
    227           if( strlen (cmd.cmd) > 0) relay (&cmd);
     227          if( strlen (cmd.cmd) > 0) relay(&cmd);
    228228          break;
    229229        case SDL_MOUSEMOTION:
     
    237237          strcpy( cmd.cmd, aliases->buttons[event.button.button]);
    238238          cmd.bUp = true;
    239           if( strlen (cmd.cmd) > 0) relay (&cmd);
     239          if( strlen (cmd.cmd) > 0) relay(&cmd);
    240240          break;
    241241        case SDL_MOUSEBUTTONDOWN:
    242242          strcpy( cmd.cmd, aliases->buttons[event.button.button]);
    243243          cmd.bUp = false;
    244           if( strlen (cmd.cmd) > 0) relay (&cmd);
     244          if( strlen (cmd.cmd) > 0) relay(&cmd);
    245245          break;
    246246        case SDL_JOYAXISMOTION:
     
    252252        default:
    253253          Orxonox *orx = Orxonox::getInstance();
    254           orx->event_handler (&event);
     254          orx->eventHandler(&event);
    255255          break;
    256256        }
     
    259259
    260260
    261 void CommandNode::process_network ()
     261void CommandNode::processNetwork ()
    262262{
    263263
     
    269269
    270270  Orxonox *orx = Orxonox::getInstance();
    271   if( orx->system_command (cmd)) return;
     271  if( orx->systemCommand (cmd)) return;
    272272
    273273  GameLoader* gl = GameLoader::getInstance();
    274274  if( gl->worldCommand(cmd)) return;
    275275
    276   if( bLocalInput) send_over_network (cmd);
     276  if( bLocalInput) sendOverNetwork (cmd);
    277277 
    278278  if( this->world->command(cmd)) return;
     
    291291   \param ID: the new ID to use
    292292*/
    293 void CommandNode::set_netID (int ID)
     293void CommandNode::setNetID (int ID)
    294294{
    295295  netID = ID;
    296296}
    297297
    298 void CommandNode::send_over_network (Command* cmd)
    299 {
    300 }
     298void CommandNode::sendOverNetwork (Command* cmd)
     299{
     300}
  • orxonox/trunk/src/command_node.h

    r3224 r3225  
    4949
    5050  void relay (Command* cmd);
    51   int* name_to_index (char* name);
    52   void process_local ();
    53   void process_network ();
    54   void send_over_network (Command* cmd);
     51  int* nameToIndex (char* name);
     52  void processLocal ();
     53  void processNetwork ();
     54  void sendOverNetwork (Command* cmd);
    5555 
    5656 public:
     
    5959  ~CommandNode ();
    6060
    61   void reset();
    62   void enable(bool bEnabled);
     61  void reset ();
     62  void enable (bool bEnabled);
    6363  void load_bindings (char* filename);
    6464  void bind (WorldEntity* entity);
    6565  void unbind (WorldEntity* entity);
    66   void addToWorld(World* world);
     66  void addToWorld (World* world);
    6767  void process ();
    6868 
    69   void set_netID (int ID);
     69  void setNetID (int ID);
    7070};
    7171
  • orxonox/trunk/src/game_loader.cc

    r3222 r3225  
    4242
    4343
     44/**
     45   \brief this class is a singleton class
     46   \returns an instance of itself
     47
     48   if you are unsure about singleton classes, check the theory out on the internet :)
     49*/
    4450GameLoader* GameLoader::getInstance()
    4551{
     
    5763
    5864
     65/**
     66   \brief reads a campaign definition file into a campaign class
     67   \param filename to be loaded
     68   \returns the loaded campaign
     69
     70   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     71*/
    5972ErrorMessage GameLoader::loadCampaign(char* name)
    6073{
     
    6477}
    6578
     79
     80/**
     81   \brief loads a debug campaign for test purposes only.
     82   \param the identifier of the campaign.
     83   \returns error message if not able to do so.
     84*/
    6685ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID)
    6786{
     
    117136}
    118137
    119 ErrorMessage GameLoader::free()
     138/**
     139   \brief release the mem
     140 */
     141ErrorMessage GameLoader::destroy()
    120142{}
    121143
    122144
     145/**
     146   \brief reads a campaign definition file into a campaign class
     147   \param filename to be loaded
     148   \returns the loaded campaign
     149
     150   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
     151*/
    123152Campaign* GameLoader::fileToCampaign(char *name)
    124153{
     
    133162   \brief handle keyboard commands
    134163   \param cmd: the command to handle
    135    \return true if the command was handled by the system
     164   \returns true if the command was handled by the system
    136165*/
    137166bool GameLoader::worldCommand (Command* cmd)
     
    172201}
    173202
     203
     204/*
     205  \brief this changes to the next level
     206*/
    174207void GameLoader::nextLevel()
    175208{
     
    178211}
    179212
     213
     214/*
     215  \brief change to the previous level - not implemented
     216
     217  this propably useless
     218*/
    180219void GameLoader::previousLevel()
    181220{
  • orxonox/trunk/src/game_loader.h

    r3224 r3225  
    2626  ErrorMessage pause();
    2727  ErrorMessage resume();
    28   ErrorMessage free();
     28  ErrorMessage destroy();
    2929
    3030  void nextLevel();
  • orxonox/trunk/src/world.cc

    r3222 r3225  
    7272
    7373
    74 /**
    75     \brief initialize the world before use.
    76 */
    7774ErrorMessage World::init()
    7875{
     
    118115      switch(this->debugWorldNr)
    119116        {
     117          /*
     118            this loads the hard-coded debug world. this only for simplicity and will be
     119            removed by a reald world-loader, which interprets a world-file.
     120            if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and
     121            make whatever you want...
     122           */
    120123        case DEBUG_WORLD_0:
    121124          {
     
    497500      else
    498501        {
    499           /* TO DO: implement check whether this particular free entity
     502          /* \todo: implement check whether this particular free entity
    500503             is out of the game area
    501              TO DO: call function to notify the entity that it left
     504             \todo: call function to notify the entity that it left
    502505             the game area
    503506          */
     
    513516    \param deltaT: the time passed since the last frame in milliseconds
    514517*/
    515 void World::time_slice (Uint32 deltaT)
     518void World::timeSlice (Uint32 deltaT)
    516519{
    517520  //List<WorldEntity> *l;
     
    544547   Camera Placement
    545548*/
    546 void World::calc_camera_pos (Location* loc, Placement* plc)
     549void World::calcCameraPos (Location* loc, Placement* plc)
    547550{
    548551  track[loc->part].map_camera (loc, plc);
     
    560563}
    561564
     565
     566
     567/**
     568   \brief function to put your own debug stuff into it. it can display informations about
     569   the current class/procedure
     570*/
    562571void World::debug()
    563572{
     
    576585
    577586
     587/*
     588  \brief main loop of the world: executing all world relevant function
     589
     590  in this loop we synchronize (if networked), handle input events, give the heart-beat to
     591  all other member-entities of the world (tick to player, enemies etc.), checking for
     592  collisions drawing everything to the screen.
     593*/
    578594void World::mainLoop()
    579595{
     
    582598  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */
    583599    {
    584       //debug routine
    585       //debug();
    586600      // Network
    587601      synchronize();
     
    594608        }
    595609      // Process time
    596       time_slice();
     610      timeSlice();
    597611      // Process collision
    598612      collision();
     
    616630/**
    617631   \brief run all input processing
    618 */
    619 void World::handle_input ()
     632
     633   the command node is the central input event dispatcher. the node uses the even-queue from
     634   sdl and has its own event-passing-queue.
     635*/
     636void World::handleInput ()
    620637{
    621638  // localinput
    622   CommandNode* cn = Orxonox::getInstance()->get_localinput();
     639  CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    623640  cn->process();
    624641  // remoteinput
     
    627644/**
    628645   \brief advance the timeline
    629 */
    630 void World::time_slice ()
     646
     647   this calculates the time used to process one frame (with all input handling, drawing, etc)
     648   the time is mesured in ms and passed to all world-entities and other classes that need
     649   a heart-beat.
     650*/
     651void World::timeSlice ()
    631652{
    632653  Uint32 currentFrame = SDL_GetTicks();
     
    642663      else
    643664        {
     665          /* the frame-rate is limited to 100 frames per second, all other things are for
     666             nothing.
     667          */
    644668          printf("fps = 1000 - frame rate is adjusted\n");
    645669          SDL_Delay(10);
    646670          dt = 10;
    647671        }
    648      
    649       this->time_slice (dt);
     672      this->timeSlice (dt);
    650673      this->update ();
    651       this->localCamera->time_slice (dt);
     674      this->localCamera->timeSlice(dt);
    652675    }
    653676  this->lastFrame = currentFrame;
     
    665688
    666689/**
    667         \brief render the current frame
     690   \brief render the current frame
     691   
     692   clear all buffers and draw the world
    668693*/
    669694void World::display ()
     
    680705}
    681706
     707/**
     708   \brief give back active camera
     709   
     710   this passes back the actualy active camera
     711   \todo ability to define more than one camera or camera-places
     712*/
    682713Camera* World::getCamera()
    683714{
     
    686717
    687718
     719/**
     720   \brief add and spawn a new entity to this world
     721   \param entity to be added
     722*/
    688723void World::spawn(WorldEntity* entity)
    689724{
     
    707742
    708743
     744/**
     745   \brief add and spawn a new entity to this world
     746   \param entity to be added
     747   \param location where to add
     748*/
    709749void World::spawn(WorldEntity* entity, Location* loc)
    710750{
     
    730770
    731771
     772/**
     773   \brief add and spawn a new entity to this world
     774   \param entity to be added
     775   \param place where to be added
     776*/
    732777void World::spawn(WorldEntity* entity, Placement* plc)
    733778{
     
    747792
    748793
     794/*
     795  \brief commands that the world must catch
     796  \returns false if not used by the world
     797*/
    749798bool World::command(Command* cmd)
    750799{
  • orxonox/trunk/src/world.h

    r3224 r3225  
    2525
    2626  template<typename T>
    27     T* spawn(Location* loc, WorldEntity* owner);        // template to be able to spawn any derivation of WorldEntity
     27    T* spawn (Location* loc, WorldEntity* owner);       // template to be able to spawn any derivation of WorldEntity
    2828  template<typename T>
    29     T* spawn(Placement* plc, WorldEntity* owner);
     29    T* spawn (Placement* plc, WorldEntity* owner);
    3030 
    31   virtual ErrorMessage init();
    32   virtual ErrorMessage start();
    33   virtual ErrorMessage stop();
    34   virtual ErrorMessage pause();
    35   virtual ErrorMessage resume();
     31  virtual ErrorMessage init ();
     32  virtual ErrorMessage start ();
     33  virtual ErrorMessage stop ();
     34  virtual ErrorMessage pause ();
     35  virtual ErrorMessage resume ();
    3636
    37   virtual void load();
    38   virtual void destroy();
     37  virtual void load ();
     38  virtual void destroy ();
    3939
    40   void time_slice (Uint32 deltaT);
     40  void timeSlice (Uint32 deltaT);
    4141  void collide ();
    4242  void draw ();
    4343  void update ();       // maps Locations to Placements
    44   void calc_camera_pos (Location* loc, Placement* plc);
     44  void calcCameraPos (Location* loc, Placement* plc);
    4545       
    4646  void unload ();
    47   bool command(Command* cmd);
     47  bool command (Command* cmd);
    4848 
    49   void setTrackLen(Uint32 tracklen);
    50   int getTrackLen();
     49  void setTrackLen (Uint32 tracklen);
     50  int getTrackLen ();
    5151  //bool system_command (Command* cmd);
    52   Camera* getCamera();
     52  Camera* getCamera ();
    5353
    54   void spawn(WorldEntity* entity);
    55   void spawn(WorldEntity* entity, Location* loc);
    56   void spawn(WorldEntity* entity, Placement* plc);
     54  void spawn (WorldEntity* entity);
     55  void spawn (WorldEntity* entity, Location* loc);
     56  void spawn (WorldEntity* entity, Placement* plc);
    5757
    5858  tList<WorldEntity>* entities;
     
    7676  WorldEntity* localPlayer;
    7777 
    78   void mainLoop();
    79   void synchronize();
    80   void handle_input();
    81   void time_slice();
    82   void collision();
    83   void display();
    84   void debug();
     78  void mainLoop ();
     79  void synchronize ();
     80  void handle_input ();
     81  void timeSlice ();
     82  void collision ();
     83  void display ();
     84  void debug ();
    8585};
    8686
Note: See TracChangeset for help on using the changeset viewer.