- Timestamp:
- Dec 17, 2005, 6:52:57 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/campaign.cc
r6139 r6152 117 117 { 118 118 PRINTF(0)("Starting new StoryEntity Nr:%i\n", se->getStoryID()); 119 se->displayLoadScreen();120 119 se->preLoad(); 121 120 se->load(); 122 se->init(); 123 se->releaseLoadScreen(); 121 se->postLoad(); 122 123 se->preStart(); 124 124 se->start(); 125 125 se->destroy(); -
trunk/src/story_entities/story_entity.cc
r4836 r6152 73 73 return this->nextStoryID; 74 74 } 75 76 77 /**78 * stuff that will have to be initialized before load79 80 this gives all storyentities the possibility to init stuff before the81 load function, where all the stuff is been made ready for start82 */83 ErrorMessage StoryEntity::preLoad()84 {}85 86 /**87 * loads the current entity88 89 this is here to enable you loading maps into the entities. for all other actions you90 should take the init() function.91 load() is exec before init()92 */93 ErrorMessage StoryEntity::load()94 {}95 96 97 /**98 * initialize the entity before use.99 * @returns an error code if not able to apply.100 101 After execution of this function, the Entity is ready to be played/executed,102 this shifts the initialisation work before the execution - very important...103 init() is exec shortly before start()104 */105 ErrorMessage StoryEntity::init()106 {}107 108 109 /**110 * starts the entity with the choosen id. only for entities with lists.111 * @param story id112 * @returns error code if this action has caused a error113 114 this simply starts the story with the id storyID. the story with the choosen id has115 to be part of the current entity else, this doesn't make sense. this is used for116 campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own117 storyID.118 */119 ErrorMessage StoryEntity::start(int storyID)120 {}121 122 123 /**124 * starts the current entity125 * @returns error code if this action has caused a error126 */127 ErrorMessage StoryEntity::start()128 {}129 130 131 /**132 * pause the current entity133 * @returns error code if this action has caused a error134 135 this pauses the current entity or passes this call forth to the running entity.136 */137 ErrorMessage StoryEntity::pause()138 {}139 140 141 /**142 * resumes a pause143 * @returns error code if this action has caused a error144 145 this resumess the current entity or passes this call forth to the running entity.146 */147 ErrorMessage StoryEntity::resume()148 {}149 150 151 /**152 * stops the current entity153 * @returns error code if this action has caused a error154 155 ATTENTION: this function shouldn't call other functions, or if so, they must return156 after finishing. If you ignore or forget to do so, the current entity is not able to157 terminate and it will run in the background or the ressources can't be freed or even158 worse: are freed and the program will end in a segmentation fault!159 hehehe, all seen... :)160 */161 ErrorMessage StoryEntity::stop()162 {}163 164 165 /**166 * destroys and cleans up the current entity.167 168 this cleans up ressources before the deconstructor is called. for terminating169 the entity please use the stop() function.170 */171 ErrorMessage StoryEntity::destroy()172 {}173 174 175 /**176 * this displays the load screen177 178 it will need some time to load maps or things like that. to inform the user about179 progress and to just show him/her something for the eyes, put here this stuff180 */181 void StoryEntity::displayLoadScreen()182 {}183 184 185 /**186 * undisplay the load screen187 188 the load process has terminated, you now can release the load screen and start this189 entity.190 */191 void StoryEntity::releaseLoadScreen()192 {} -
trunk/src/story_entities/story_entity.h
r5039 r6152 19 19 virtual ~StoryEntity (); 20 20 21 bool isInit; //! if the entity is initialized, this has to be true22 bool isPaused; //! is true if the entity is paused23 21 24 virtual ErrorMessage preLoad(); 25 virtual ErrorMessage load(); 26 virtual ErrorMessage init(); 27 virtual ErrorMessage start(int storyID); 28 virtual ErrorMessage start(); 29 virtual ErrorMessage pause(); 30 virtual ErrorMessage resume(); 31 virtual ErrorMessage stop(); 32 virtual ErrorMessage destroy(); 22 // INIT AND LOAD // 23 virtual ErrorMessage preLoad() {}; 24 virtual ErrorMessage load() {}; 25 virtual ErrorMessage postLoad() {}; 26 virtual ErrorMessage check() {}; 33 27 34 35 virtual void displayLoadScreen(); 36 virtual void releaseLoadScreen(); 28 // RUNNING // 29 virtual ErrorMessage preStart() {}; 30 virtual ErrorMessage start() = 0; 31 virtual ErrorMessage pause() = 0; 32 virtual ErrorMessage rewind() {}; 33 virtual ErrorMessage suspend() {}; 34 virtual ErrorMessage resume() = 0; 35 virtual ErrorMessage stop() = 0; 36 virtual ErrorMessage destroy() {}; 37 37 38 38 void setStoryID(int storyID); … … 42 42 int getNextStoryID(); 43 43 44 protected: 45 bool isInit; //!< if the entity is initialized, this has to be true. 46 bool readyToRun; //!< If the entity is ready to run -> post-check. 47 bool isPaused; //!< is true if the entity is paused 48 bool isSuspended; //!< if the Entity is suspended. 44 49 45 50 private: 46 int storyID; //!this is the number of this entity, identifying it in a list/tree...47 int nextStoryID; //!if this entity has finished, this entity shall be called51 int storyID; //!< this is the number of this entity, identifying it in a list/tree... 52 int nextStoryID; //!< if this entity has finished, this entity shall be called 48 53 }; 49 54 -
trunk/src/story_entities/world.cc
r6151 r6152 201 201 202 202 GraphicsEngine::getInstance()->displayFPS(true); 203 this->displayLoadScreen(); 203 204 } 204 205 … … 384 385 } 385 386 387 ErrorMessage World::postLoad() 388 { 389 this->releaseLoadScreen(); 390 } 391 386 392 387 393 /** … … 391 397 * started 392 398 */ 393 ErrorMessage World:: init()399 ErrorMessage World::preStart() 394 400 { 395 401 this->bPause = false; -
trunk/src/story_entities/world.h
r6151 r6152 39 39 virtual ErrorMessage preLoad(); 40 40 virtual ErrorMessage load (); 41 virtual ErrorMessage init (); 41 virtual ErrorMessage postLoad(); 42 43 virtual ErrorMessage preStart(); 42 44 virtual ErrorMessage start (); 43 45 virtual ErrorMessage stop (); … … 46 48 virtual ErrorMessage destroy (); 47 49 48 v irtual void displayLoadScreen();49 v irtual void releaseLoadScreen();50 void displayLoadScreen(); 51 void releaseLoadScreen(); 50 52 51 53 /* interface to world */ -
trunk/src/util/loading/game_loader.cc
r6151 r6152 19 19 20 20 #include "game_loader.h" 21 #include "load_param.h" 21 22 22 23 #include "shell_command.h" 23 24 #include "campaign.h" 24 #include "world.h" 25 #include "orxonox.h" 26 #include "camera.h" 27 #include "vector.h" 25 28 26 #include "resource_manager.h" 29 #include "factory.h" 30 #include "event.h" 27 31 28 #include "event_handler.h" 32 #include <string.h>33 29 34 30 -
trunk/src/util/loading/game_loader.h
r6139 r6152 27 27 //! The GameLoader 28 28 /** 29 The game loader loads all game date. this is performed in the following way:30 31 32 33 34 35 36 37 29 * The game loader loads all game date. this is performed in the following way: 30 * 1. Read the structure of campaings and worlds 31 * 2. Create the instances of the tree: here _ALL_ StoryEntities are created 32 * also if they are not yet used. the worlds should load their data in 33 * the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE! 34 * Elsewhere, all the data will be allocated at the beginning... mess... 35 * 3. StoryEntities are load() and init() before they start 36 * 4. once the gamloader starts the game there will be a campaing starting a 37 * world. this is done by callaing those StoryEntity::start() 38 38 */ 39 39 class GameLoader : public EventListener 40 40 { 41 42 43 41 public: 44 42 ~GameLoader ();
Note: See TracChangeset
for help on using the changeset viewer.