- Timestamp:
- Dec 20, 2004, 12:23:58 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/camera.cc
r3215 r3225 61 61 as smooth camera movement or swaying). 62 62 */ 63 void Camera::time _slice (Uint32 deltaT)63 void Camera::timeSlice (Uint32 deltaT) 64 64 { 65 65 if( this->t <= deltaTime) -
orxonox/trunk/src/camera.h
r3224 r3225 60 60 ~Camera (); 61 61 62 void time _slice (Uint32 deltaT);62 void timeSlice (Uint32 deltaT); 63 63 void apply (); 64 64 void bind (WorldEntity* entity); -
orxonox/trunk/src/campaign.cc
r3222 r3225 104 104 if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 105 105 { 106 printf("Campaign::start() - quit ing campaing story loop\n");106 printf("Campaign::start() - quitting campaing story loop\n"); 107 107 if(se != NULL) 108 108 delete se; … … 148 148 } 149 149 150 /* 151 \brief this changes to the next level 152 */ 150 153 void Campaign::nextLevel() 151 154 { … … 157 160 } 158 161 162 /* 163 \brief change to the previous level - not implemented 164 165 this propably useless 166 */ 159 167 void Campaign::previousLevel() 160 168 {} 161 169 162 170 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 */ 163 176 StoryEntity* Campaign::getStoryEntity(int storyID) 164 177 { -
orxonox/trunk/src/command_node.cc
r3221 r3225 108 108 \param filename: The path and name of the file to load the bindings from 109 109 */ 110 void CommandNode::load _bindings (char* filename)110 void CommandNode::loadBindings (char* filename) 111 111 { 112 112 FILE* stream; … … 125 125 // create parser 126 126 IniParser parser (filename); 127 if( parser.get _section ("Bindings") == -1)127 if( parser.getSection ("Bindings") == -1) 128 128 { 129 129 printf("Could not find key bindings in %s\n", filename); … … 145 145 { 146 146 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); 148 148 strcpy (aliases->keys[index[1]], valuebuf); 149 149 break; 150 150 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); 152 152 strcpy (aliases->buttons[index[1]], valuebuf); 153 153 break; … … 166 166 void CommandNode::bind (WorldEntity* entity) 167 167 { 168 bound->add (entity);168 bound->add (entity); 169 169 } 170 170 … … 175 175 void CommandNode::unbind (WorldEntity* entity) 176 176 { 177 bound->remove (entity);178 } 179 180 int* CommandNode::name _to_index (char* name)177 bound->remove (entity); 178 } 179 180 int* CommandNode::nameToIndex (char* name) 181 181 { 182 182 coord[0] = -1; 183 183 coord[1] = -1; 184 184 int c; 185 if( (c = keyname _to_SDLK (name)) != -1)185 if( (c = keynameToSDLK (name)) != -1) 186 186 { 187 187 coord[1] = c; 188 188 coord[0] = 0; 189 189 } 190 if( (c = buttonname _to_SDLB (name)) != -1)190 if( (c = buttonnameToSDLB (name)) != -1) 191 191 { 192 192 coord[1] = c; … … 203 203 if( this->bEnabled) 204 204 { 205 if( bLocalInput) process _local ();206 else process _network ();205 if( bLocalInput) processLocal (); 206 else processNetwork (); 207 207 } 208 208 } … … 220 220 strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]); 221 221 cmd.bUp = false; 222 if( strlen (cmd.cmd) > 0) relay 222 if( strlen (cmd.cmd) > 0) relay(&cmd); 223 223 break; 224 224 case SDL_KEYUP: 225 225 strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]); 226 226 cmd.bUp = true; 227 if( strlen (cmd.cmd) > 0) relay 227 if( strlen (cmd.cmd) > 0) relay(&cmd); 228 228 break; 229 229 case SDL_MOUSEMOTION: … … 237 237 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 238 238 cmd.bUp = true; 239 if( strlen (cmd.cmd) > 0) relay 239 if( strlen (cmd.cmd) > 0) relay(&cmd); 240 240 break; 241 241 case SDL_MOUSEBUTTONDOWN: 242 242 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 243 243 cmd.bUp = false; 244 if( strlen (cmd.cmd) > 0) relay 244 if( strlen (cmd.cmd) > 0) relay(&cmd); 245 245 break; 246 246 case SDL_JOYAXISMOTION: … … 252 252 default: 253 253 Orxonox *orx = Orxonox::getInstance(); 254 orx->event _handler(&event);254 orx->eventHandler(&event); 255 255 break; 256 256 } … … 259 259 260 260 261 void CommandNode::process _network ()261 void CommandNode::processNetwork () 262 262 { 263 263 … … 269 269 270 270 Orxonox *orx = Orxonox::getInstance(); 271 if( orx->system _command (cmd)) return;271 if( orx->systemCommand (cmd)) return; 272 272 273 273 GameLoader* gl = GameLoader::getInstance(); 274 274 if( gl->worldCommand(cmd)) return; 275 275 276 if( bLocalInput) send _over_network (cmd);276 if( bLocalInput) sendOverNetwork (cmd); 277 277 278 278 if( this->world->command(cmd)) return; … … 291 291 \param ID: the new ID to use 292 292 */ 293 void CommandNode::set _netID (int ID)293 void CommandNode::setNetID (int ID) 294 294 { 295 295 netID = ID; 296 296 } 297 297 298 void CommandNode::send _over_network (Command* cmd)299 { 300 } 298 void CommandNode::sendOverNetwork (Command* cmd) 299 { 300 } -
orxonox/trunk/src/command_node.h
r3224 r3225 49 49 50 50 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); 55 55 56 56 public: … … 59 59 ~CommandNode (); 60 60 61 void reset ();62 void enable (bool bEnabled);61 void reset (); 62 void enable (bool bEnabled); 63 63 void load_bindings (char* filename); 64 64 void bind (WorldEntity* entity); 65 65 void unbind (WorldEntity* entity); 66 void addToWorld (World* world);66 void addToWorld (World* world); 67 67 void process (); 68 68 69 void set _netID (int ID);69 void setNetID (int ID); 70 70 }; 71 71 -
orxonox/trunk/src/game_loader.cc
r3222 r3225 42 42 43 43 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 */ 44 50 GameLoader* GameLoader::getInstance() 45 51 { … … 57 63 58 64 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 */ 59 72 ErrorMessage GameLoader::loadCampaign(char* name) 60 73 { … … 64 77 } 65 78 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 */ 66 85 ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID) 67 86 { … … 117 136 } 118 137 119 ErrorMessage GameLoader::free() 138 /** 139 \brief release the mem 140 */ 141 ErrorMessage GameLoader::destroy() 120 142 {} 121 143 122 144 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 */ 123 152 Campaign* GameLoader::fileToCampaign(char *name) 124 153 { … … 133 162 \brief handle keyboard commands 134 163 \param cmd: the command to handle 135 \return true if the command was handled by the system164 \returns true if the command was handled by the system 136 165 */ 137 166 bool GameLoader::worldCommand (Command* cmd) … … 172 201 } 173 202 203 204 /* 205 \brief this changes to the next level 206 */ 174 207 void GameLoader::nextLevel() 175 208 { … … 178 211 } 179 212 213 214 /* 215 \brief change to the previous level - not implemented 216 217 this propably useless 218 */ 180 219 void GameLoader::previousLevel() 181 220 { -
orxonox/trunk/src/game_loader.h
r3224 r3225 26 26 ErrorMessage pause(); 27 27 ErrorMessage resume(); 28 ErrorMessage free();28 ErrorMessage destroy(); 29 29 30 30 void nextLevel(); -
orxonox/trunk/src/world.cc
r3222 r3225 72 72 73 73 74 /**75 \brief initialize the world before use.76 */77 74 ErrorMessage World::init() 78 75 { … … 118 115 switch(this->debugWorldNr) 119 116 { 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 */ 120 123 case DEBUG_WORLD_0: 121 124 { … … 497 500 else 498 501 { 499 /* TO DO: implement check whether this particular free entity502 /* \todo: implement check whether this particular free entity 500 503 is out of the game area 501 TO DO: call function to notify the entity that it left504 \todo: call function to notify the entity that it left 502 505 the game area 503 506 */ … … 513 516 \param deltaT: the time passed since the last frame in milliseconds 514 517 */ 515 void World::time _slice (Uint32 deltaT)518 void World::timeSlice (Uint32 deltaT) 516 519 { 517 520 //List<WorldEntity> *l; … … 544 547 Camera Placement 545 548 */ 546 void World::calc _camera_pos (Location* loc, Placement* plc)549 void World::calcCameraPos (Location* loc, Placement* plc) 547 550 { 548 551 track[loc->part].map_camera (loc, plc); … … 560 563 } 561 564 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 */ 562 571 void World::debug() 563 572 { … … 576 585 577 586 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 */ 578 594 void World::mainLoop() 579 595 { … … 582 598 while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */ 583 599 { 584 //debug routine585 //debug();586 600 // Network 587 601 synchronize(); … … 594 608 } 595 609 // Process time 596 time _slice();610 timeSlice(); 597 611 // Process collision 598 612 collision(); … … 616 630 /** 617 631 \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 */ 636 void World::handleInput () 620 637 { 621 638 // localinput 622 CommandNode* cn = Orxonox::getInstance()->get _localinput();639 CommandNode* cn = Orxonox::getInstance()->getLocalInput(); 623 640 cn->process(); 624 641 // remoteinput … … 627 644 /** 628 645 \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 */ 651 void World::timeSlice () 631 652 { 632 653 Uint32 currentFrame = SDL_GetTicks(); … … 642 663 else 643 664 { 665 /* the frame-rate is limited to 100 frames per second, all other things are for 666 nothing. 667 */ 644 668 printf("fps = 1000 - frame rate is adjusted\n"); 645 669 SDL_Delay(10); 646 670 dt = 10; 647 671 } 648 649 this->time_slice (dt); 672 this->timeSlice (dt); 650 673 this->update (); 651 this->localCamera->time _slice(dt);674 this->localCamera->timeSlice(dt); 652 675 } 653 676 this->lastFrame = currentFrame; … … 665 688 666 689 /** 667 \brief render the current frame 690 \brief render the current frame 691 692 clear all buffers and draw the world 668 693 */ 669 694 void World::display () … … 680 705 } 681 706 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 */ 682 713 Camera* World::getCamera() 683 714 { … … 686 717 687 718 719 /** 720 \brief add and spawn a new entity to this world 721 \param entity to be added 722 */ 688 723 void World::spawn(WorldEntity* entity) 689 724 { … … 707 742 708 743 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 */ 709 749 void World::spawn(WorldEntity* entity, Location* loc) 710 750 { … … 730 770 731 771 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 */ 732 777 void World::spawn(WorldEntity* entity, Placement* plc) 733 778 { … … 747 792 748 793 794 /* 795 \brief commands that the world must catch 796 \returns false if not used by the world 797 */ 749 798 bool World::command(Command* cmd) 750 799 { -
orxonox/trunk/src/world.h
r3224 r3225 25 25 26 26 template<typename T> 27 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity27 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity 28 28 template<typename T> 29 T* spawn (Placement* plc, WorldEntity* owner);29 T* spawn (Placement* plc, WorldEntity* owner); 30 30 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 (); 36 36 37 virtual void load ();38 virtual void destroy ();37 virtual void load (); 38 virtual void destroy (); 39 39 40 void time _slice (Uint32 deltaT);40 void timeSlice (Uint32 deltaT); 41 41 void collide (); 42 42 void draw (); 43 43 void update (); // maps Locations to Placements 44 void calc _camera_pos (Location* loc, Placement* plc);44 void calcCameraPos (Location* loc, Placement* plc); 45 45 46 46 void unload (); 47 bool command (Command* cmd);47 bool command (Command* cmd); 48 48 49 void setTrackLen (Uint32 tracklen);50 int getTrackLen ();49 void setTrackLen (Uint32 tracklen); 50 int getTrackLen (); 51 51 //bool system_command (Command* cmd); 52 Camera* getCamera ();52 Camera* getCamera (); 53 53 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); 57 57 58 58 tList<WorldEntity>* entities; … … 76 76 WorldEntity* localPlayer; 77 77 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 (); 85 85 }; 86 86
Note: See TracChangeset
for help on using the changeset viewer.