| [2636] | 1 |  | 
|---|
 | 2 |  | 
|---|
 | 3 | /*  | 
|---|
 | 4 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
 | 5 |  | 
|---|
 | 6 |    Copyright (C) 2004 orx | 
|---|
 | 7 |  | 
|---|
 | 8 |    This program is free software; you can redistribute it and/or modify | 
|---|
 | 9 |    it under the terms of the GNU General Public License as published by | 
|---|
 | 10 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
 | 11 |    any later version. | 
|---|
 | 12 |  | 
|---|
 | 13 |    ### File Specific: | 
|---|
 | 14 |    main-programmer: Patrick Boenzli | 
|---|
 | 15 |    co-programmer:  | 
|---|
 | 16 | */ | 
|---|
 | 17 |  | 
|---|
 | 18 |  | 
|---|
 | 19 | #include "story_entity.h" | 
|---|
 | 20 |  | 
|---|
 | 21 |  | 
|---|
 | 22 | using namespace std; | 
|---|
 | 23 |  | 
|---|
 | 24 |  | 
|---|
 | 25 |  | 
|---|
 | 26 | StoryEntity::StoryEntity () {} | 
|---|
 | 27 | StoryEntity::~StoryEntity () {} | 
|---|
 | 28 |  | 
|---|
 | 29 |  | 
|---|
 | 30 | /**  | 
|---|
 | 31 |     \brief initialize the entity before use.  | 
|---|
| [3221] | 32 |     \returns an error code if not able to apply. | 
|---|
| [2636] | 33 |  | 
|---|
 | 34 |     After execution of this function, the Entity is ready to be played/executed,  | 
|---|
 | 35 |     this shifts the initialisation work before the execution - very important... | 
|---|
 | 36 | */ | 
|---|
| [3222] | 37 | ErrorMessage StoryEntity::init() | 
|---|
| [2636] | 38 | {} | 
|---|
 | 39 |  | 
|---|
 | 40 |  | 
|---|
| [3221] | 41 | /**  | 
|---|
 | 42 |     \brief sets the story ID | 
|---|
 | 43 |  | 
|---|
 | 44 |     sets the story id of the current entity, this enables it to be identified in a  | 
|---|
 | 45 |     global context. | 
|---|
 | 46 | */ | 
|---|
| [3220] | 47 | void StoryEntity::setStoryID(int storyID) | 
|---|
| [2636] | 48 | { | 
|---|
 | 49 |   this->storyID = storyID; | 
|---|
 | 50 | } | 
|---|
 | 51 |  | 
|---|
| [3221] | 52 |  | 
|---|
 | 53 | /**  | 
|---|
 | 54 |     \brief this reads the story id of the current entity | 
|---|
 | 55 |     \returns the story entity id | 
|---|
 | 56 | */ | 
|---|
| [2636] | 57 | int StoryEntity::getStoryID() | 
|---|
 | 58 | { | 
|---|
 | 59 |   return this->storyID; | 
|---|
 | 60 | } | 
|---|
 | 61 |  | 
|---|
 | 62 |  | 
|---|
| [3221] | 63 | /**  | 
|---|
 | 64 |     \brief sets the id of the next story entity | 
|---|
 | 65 |      | 
|---|
 | 66 |     StoryEntities can choose their following entity themselfs. the entity id defined here | 
|---|
 | 67 |     will be startet after this entity ends. this can be convenient if you want to have a | 
|---|
 | 68 |     non linear story with switches. | 
|---|
 | 69 | */ | 
|---|
| [3220] | 70 | void StoryEntity::setNextStoryID(int nextStoryID) | 
|---|
| [2636] | 71 | { | 
|---|
 | 72 |   this->nextStoryID = nextStoryID; | 
|---|
 | 73 | } | 
|---|
 | 74 |  | 
|---|
| [3221] | 75 | /**  | 
|---|
 | 76 |     \brief gets the story id of the current entity | 
|---|
 | 77 |     \returns story id | 
|---|
 | 78 | */ | 
|---|
| [3220] | 79 | int StoryEntity::getNextStoryID() | 
|---|
| [2636] | 80 | { | 
|---|
 | 81 |   return this->nextStoryID; | 
|---|
 | 82 | } | 
|---|
 | 83 |  | 
|---|
 | 84 |  | 
|---|
| [3221] | 85 | /**  | 
|---|
 | 86 |     \brief starts the entity with the choosen id. only for entities with lists. | 
|---|
 | 87 |     \param story id | 
|---|
 | 88 |     \returns error code if this action has caused a error | 
|---|
 | 89 |  | 
|---|
 | 90 |     this simply starts the story with the id storyID. the story with the choosen id has | 
|---|
 | 91 |     to be part of the current entity else, this doesn't make sense. this is used for | 
|---|
 | 92 |     campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own | 
|---|
 | 93 |     storyID. | 
|---|
 | 94 | */ | 
|---|
| [3222] | 95 | ErrorMessage StoryEntity::start(int storyID) | 
|---|
| [2636] | 96 | {} | 
|---|
 | 97 |  | 
|---|
| [3221] | 98 |  | 
|---|
 | 99 | /**  | 
|---|
 | 100 |     \brief starts the current entity | 
|---|
 | 101 |     \returns error code if this action has caused a error     | 
|---|
 | 102 | */ | 
|---|
| [3222] | 103 | ErrorMessage StoryEntity::start() | 
|---|
| [2636] | 104 | {} | 
|---|
 | 105 |  | 
|---|
| [3221] | 106 |  | 
|---|
 | 107 | /**  | 
|---|
 | 108 |     \brief stops the current entity | 
|---|
 | 109 |     \returns error code if this action has caused a error | 
|---|
 | 110 |  | 
|---|
 | 111 |     ATTENTION: this function shouldn't call other functions, or if so, they must return | 
|---|
 | 112 |     after finishing. If you ignore or forget to do so, the current entity is not able to | 
|---|
 | 113 |     terminate and it will run in the background or the ressources can't be freed or even | 
|---|
 | 114 |     worse: are freed and the program will end in a segmentation fault! | 
|---|
 | 115 |     hehehe, all seen... :) | 
|---|
 | 116 | */ | 
|---|
| [3222] | 117 | ErrorMessage StoryEntity::stop() | 
|---|
| [2636] | 118 | {} | 
|---|
 | 119 |  | 
|---|
| [3221] | 120 |  | 
|---|
 | 121 | /**  | 
|---|
 | 122 |     \brief pause the current entity | 
|---|
 | 123 |     \returns error code if this action has caused a error | 
|---|
 | 124 |  | 
|---|
 | 125 |     this pauses the current entity or passes this call forth to the running entity. | 
|---|
 | 126 | */ | 
|---|
| [3222] | 127 | ErrorMessage StoryEntity::pause() | 
|---|
| [2636] | 128 | {} | 
|---|
 | 129 |  | 
|---|
| [3221] | 130 |  | 
|---|
 | 131 | /**  | 
|---|
 | 132 |     \brief resumes a pause | 
|---|
 | 133 |     \returns error code if this action has caused a error | 
|---|
 | 134 |  | 
|---|
 | 135 |     this resumess the current entity or passes this call forth to the running entity. | 
|---|
 | 136 | */ | 
|---|
| [3222] | 137 | ErrorMessage StoryEntity::resume() | 
|---|
| [2636] | 138 | {} | 
|---|
 | 139 |  | 
|---|
 | 140 |  | 
|---|
| [3221] | 141 | /**  | 
|---|
 | 142 |     \brief loads the current entity | 
|---|
 | 143 |  | 
|---|
 | 144 |     this is here to enable you loading maps into the entities. for all other actions you | 
|---|
 | 145 |     should take the init() function. | 
|---|
 | 146 | */ | 
|---|
| [2636] | 147 | void StoryEntity::load() | 
|---|
 | 148 | {} | 
|---|
 | 149 |  | 
|---|
| [3221] | 150 |  | 
|---|
 | 151 | /**  | 
|---|
 | 152 |     \brief destroys and cleans up the current entity.  | 
|---|
 | 153 |  | 
|---|
 | 154 |     this cleans up ressources before the deconstructor is called. for terminating  | 
|---|
 | 155 |     the entity please use the stop() function. | 
|---|
 | 156 | */ | 
|---|
| [3220] | 157 | void StoryEntity::destroy() | 
|---|
 | 158 | {} | 
|---|
| [2636] | 159 |  | 
|---|
| [3220] | 160 |  | 
|---|
| [3221] | 161 | /**  | 
|---|
 | 162 |     \brief this displays the load screen | 
|---|
 | 163 |  | 
|---|
 | 164 |     it will need some time to load maps or things like that. to inform the user about  | 
|---|
 | 165 |     progress and to just show him/her something for the eyes, put here this stuff | 
|---|
 | 166 | */ | 
|---|
| [3220] | 167 | void StoryEntity::displayLoadScreen() | 
|---|
| [2636] | 168 | {} | 
|---|
 | 169 |  | 
|---|
| [3221] | 170 |  | 
|---|
 | 171 | /**  | 
|---|
 | 172 |     \brief undisplay the load screen | 
|---|
 | 173 |  | 
|---|
 | 174 |     the load process has terminated, you now can release the load screen and start this | 
|---|
 | 175 |     entity. | 
|---|
 | 176 | */ | 
|---|
| [3220] | 177 | void StoryEntity::releaseLoadScreen() | 
|---|
| [2636] | 178 | {} | 
|---|