| 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 | { | 
|---|
| 28 |   this->setClassID(CL_STORY_ENTITY, "StoryEntity"); | 
|---|
| 29 | } | 
|---|
| 30 | StoryEntity::~StoryEntity () {} | 
|---|
| 31 |  | 
|---|
| 32 |  | 
|---|
| 33 | /** | 
|---|
| 34 |   *  sets the story ID | 
|---|
| 35 |  | 
|---|
| 36 |     sets the story id of the current entity, this enables it to be identified in a | 
|---|
| 37 |     global context. | 
|---|
| 38 | */ | 
|---|
| 39 | void StoryEntity::setStoryID(int storyID) | 
|---|
| 40 | { | 
|---|
| 41 |   this->storyID = storyID; | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | /** | 
|---|
| 46 |   *  this reads the story id of the current entity | 
|---|
| 47 |   * @returns the story entity id | 
|---|
| 48 | */ | 
|---|
| 49 | int StoryEntity::getStoryID() | 
|---|
| 50 | { | 
|---|
| 51 |   return this->storyID; | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 |  | 
|---|
| 55 | /** | 
|---|
| 56 |   *  sets the id of the next story entity | 
|---|
| 57 |  | 
|---|
| 58 |     StoryEntities can choose their following entity themselfs. the entity id defined here | 
|---|
| 59 |     will be startet after this entity ends. this can be convenient if you want to have a | 
|---|
| 60 |     non linear story with switches. | 
|---|
| 61 | */ | 
|---|
| 62 | void StoryEntity::setNextStoryID(int nextStoryID) | 
|---|
| 63 | { | 
|---|
| 64 |   this->nextStoryID = nextStoryID; | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | /** | 
|---|
| 68 |   *  gets the story id of the current entity | 
|---|
| 69 |   * @returns story id | 
|---|
| 70 | */ | 
|---|
| 71 | int StoryEntity::getNextStoryID() | 
|---|
| 72 | { | 
|---|
| 73 |   return this->nextStoryID; | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | /** | 
|---|
| 78 |  *  stuff that will have to be initialized before load | 
|---|
| 79 |  | 
|---|
| 80 |    this gives all storyentities the possibility to init stuff before the | 
|---|
| 81 |    load function, where all the stuff is been made ready for start | 
|---|
| 82 | */ | 
|---|
| 83 | ErrorMessage StoryEntity::preLoad() | 
|---|
| 84 | {} | 
|---|
| 85 |  | 
|---|
| 86 | /** | 
|---|
| 87 |   *  loads the current entity | 
|---|
| 88 |  | 
|---|
| 89 |     this is here to enable you loading maps into the entities. for all other actions you | 
|---|
| 90 |     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 id | 
|---|
| 112 |   * @returns error code if this action has caused a error | 
|---|
| 113 |  | 
|---|
| 114 |     this simply starts the story with the id storyID. the story with the choosen id has | 
|---|
| 115 |     to be part of the current entity else, this doesn't make sense. this is used for | 
|---|
| 116 |     campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own | 
|---|
| 117 |     storyID. | 
|---|
| 118 | */ | 
|---|
| 119 | ErrorMessage StoryEntity::start(int storyID) | 
|---|
| 120 | {} | 
|---|
| 121 |  | 
|---|
| 122 |  | 
|---|
| 123 | /** | 
|---|
| 124 |   *  starts the current entity | 
|---|
| 125 |   * @returns error code if this action has caused a error | 
|---|
| 126 | */ | 
|---|
| 127 | ErrorMessage StoryEntity::start() | 
|---|
| 128 | {} | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 | /** | 
|---|
| 132 |   *  pause the current entity | 
|---|
| 133 |   * @returns error code if this action has caused a error | 
|---|
| 134 |  | 
|---|
| 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 pause | 
|---|
| 143 |   * @returns error code if this action has caused a error | 
|---|
| 144 |  | 
|---|
| 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 entity | 
|---|
| 153 |   * @returns error code if this action has caused a error | 
|---|
| 154 |  | 
|---|
| 155 |     ATTENTION: this function shouldn't call other functions, or if so, they must return | 
|---|
| 156 |     after finishing. If you ignore or forget to do so, the current entity is not able to | 
|---|
| 157 |     terminate and it will run in the background or the ressources can't be freed or even | 
|---|
| 158 |     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 terminating | 
|---|
| 169 |     the entity please use the stop() function. | 
|---|
| 170 | */ | 
|---|
| 171 | ErrorMessage StoryEntity::destroy() | 
|---|
| 172 | {} | 
|---|
| 173 |  | 
|---|
| 174 |  | 
|---|
| 175 | /** | 
|---|
| 176 |   *  this displays the load screen | 
|---|
| 177 |  | 
|---|
| 178 |     it will need some time to load maps or things like that. to inform the user about | 
|---|
| 179 |     progress and to just show him/her something for the eyes, put here this stuff | 
|---|
| 180 | */ | 
|---|
| 181 | void StoryEntity::displayLoadScreen() | 
|---|
| 182 | {} | 
|---|
| 183 |  | 
|---|
| 184 |  | 
|---|
| 185 | /** | 
|---|
| 186 |   *  undisplay the load screen | 
|---|
| 187 |  | 
|---|
| 188 |     the load process has terminated, you now can release the load screen and start this | 
|---|
| 189 |     entity. | 
|---|
| 190 | */ | 
|---|
| 191 | void StoryEntity::releaseLoadScreen() | 
|---|
| 192 | {} | 
|---|