[2636] | 1 | |
---|
| 2 | |
---|
[4592] | 3 | /* |
---|
[2636] | 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 |
---|
[4592] | 15 | co-programmer: |
---|
[2636] | 16 | */ |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #include "story_entity.h" |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | using namespace std; |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
[4592] | 26 | StoryEntity::StoryEntity () |
---|
| 27 | { |
---|
[4597] | 28 | this->setClassID(CL_STORY_ENTITY, "StoryEntity"); |
---|
[4592] | 29 | } |
---|
[2636] | 30 | StoryEntity::~StoryEntity () {} |
---|
| 31 | |
---|
| 32 | |
---|
[4592] | 33 | /** |
---|
[4836] | 34 | * sets the story ID |
---|
[3221] | 35 | |
---|
[4592] | 36 | sets the story id of the current entity, this enables it to be identified in a |
---|
[3221] | 37 | global context. |
---|
| 38 | */ |
---|
[3220] | 39 | void StoryEntity::setStoryID(int storyID) |
---|
[2636] | 40 | { |
---|
| 41 | this->storyID = storyID; |
---|
| 42 | } |
---|
| 43 | |
---|
[3221] | 44 | |
---|
[4592] | 45 | /** |
---|
[4836] | 46 | * this reads the story id of the current entity |
---|
| 47 | * @returns the story entity id |
---|
[3221] | 48 | */ |
---|
[2636] | 49 | int StoryEntity::getStoryID() |
---|
| 50 | { |
---|
| 51 | return this->storyID; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
[4592] | 55 | /** |
---|
[4836] | 56 | * sets the id of the next story entity |
---|
[4592] | 57 | |
---|
[3221] | 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 | */ |
---|
[3220] | 62 | void StoryEntity::setNextStoryID(int nextStoryID) |
---|
[2636] | 63 | { |
---|
| 64 | this->nextStoryID = nextStoryID; |
---|
| 65 | } |
---|
| 66 | |
---|
[4592] | 67 | /** |
---|
[4836] | 68 | * gets the story id of the current entity |
---|
| 69 | * @returns story id |
---|
[3221] | 70 | */ |
---|
[3220] | 71 | int StoryEntity::getNextStoryID() |
---|
[2636] | 72 | { |
---|
| 73 | return this->nextStoryID; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | |
---|
[3629] | 77 | /** |
---|
[4836] | 78 | * stuff that will have to be initialized before load |
---|
[3459] | 79 | |
---|
[3629] | 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 |
---|
[3459] | 82 | */ |
---|
[3629] | 83 | ErrorMessage StoryEntity::preLoad() |
---|
[3459] | 84 | {} |
---|
| 85 | |
---|
[4592] | 86 | /** |
---|
[4836] | 87 | * loads the current entity |
---|
[3459] | 88 | |
---|
| 89 | this is here to enable you loading maps into the entities. for all other actions you |
---|
| 90 | should take the init() function. |
---|
[3629] | 91 | load() is exec before init() |
---|
[3459] | 92 | */ |
---|
| 93 | ErrorMessage StoryEntity::load() |
---|
| 94 | {} |
---|
| 95 | |
---|
[3629] | 96 | |
---|
[4592] | 97 | /** |
---|
[4836] | 98 | * initialize the entity before use. |
---|
| 99 | * @returns an error code if not able to apply. |
---|
[3629] | 100 | |
---|
[4592] | 101 | After execution of this function, the Entity is ready to be played/executed, |
---|
[3629] | 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 | |
---|
[4592] | 109 | /** |
---|
[4836] | 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 |
---|
[3221] | 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 | */ |
---|
[3222] | 119 | ErrorMessage StoryEntity::start(int storyID) |
---|
[2636] | 120 | {} |
---|
| 121 | |
---|
[3221] | 122 | |
---|
[4592] | 123 | /** |
---|
[4836] | 124 | * starts the current entity |
---|
| 125 | * @returns error code if this action has caused a error |
---|
[3221] | 126 | */ |
---|
[3222] | 127 | ErrorMessage StoryEntity::start() |
---|
[2636] | 128 | {} |
---|
| 129 | |
---|
[3221] | 130 | |
---|
[4592] | 131 | /** |
---|
[4836] | 132 | * pause the current entity |
---|
| 133 | * @returns error code if this action has caused a error |
---|
[3221] | 134 | |
---|
| 135 | this pauses the current entity or passes this call forth to the running entity. |
---|
| 136 | */ |
---|
[3222] | 137 | ErrorMessage StoryEntity::pause() |
---|
[2636] | 138 | {} |
---|
| 139 | |
---|
[3221] | 140 | |
---|
[4592] | 141 | /** |
---|
[4836] | 142 | * resumes a pause |
---|
| 143 | * @returns error code if this action has caused a error |
---|
[3221] | 144 | |
---|
| 145 | this resumess the current entity or passes this call forth to the running entity. |
---|
| 146 | */ |
---|
[3222] | 147 | ErrorMessage StoryEntity::resume() |
---|
[2636] | 148 | {} |
---|
| 149 | |
---|
| 150 | |
---|
[4592] | 151 | /** |
---|
[4836] | 152 | * stops the current entity |
---|
| 153 | * @returns error code if this action has caused a error |
---|
[3221] | 154 | |
---|
[3459] | 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... :) |
---|
[3221] | 160 | */ |
---|
[3459] | 161 | ErrorMessage StoryEntity::stop() |
---|
[2636] | 162 | {} |
---|
| 163 | |
---|
[3221] | 164 | |
---|
[4592] | 165 | /** |
---|
[4836] | 166 | * destroys and cleans up the current entity. |
---|
[3221] | 167 | |
---|
[4592] | 168 | this cleans up ressources before the deconstructor is called. for terminating |
---|
[3221] | 169 | the entity please use the stop() function. |
---|
| 170 | */ |
---|
[3459] | 171 | ErrorMessage StoryEntity::destroy() |
---|
[3220] | 172 | {} |
---|
[2636] | 173 | |
---|
[3220] | 174 | |
---|
[4592] | 175 | /** |
---|
[4836] | 176 | * this displays the load screen |
---|
[3221] | 177 | |
---|
[4592] | 178 | it will need some time to load maps or things like that. to inform the user about |
---|
[3221] | 179 | progress and to just show him/her something for the eyes, put here this stuff |
---|
| 180 | */ |
---|
[3220] | 181 | void StoryEntity::displayLoadScreen() |
---|
[2636] | 182 | {} |
---|
| 183 | |
---|
[3221] | 184 | |
---|
[4592] | 185 | /** |
---|
[4836] | 186 | * undisplay the load screen |
---|
[3221] | 187 | |
---|
| 188 | the load process has terminated, you now can release the load screen and start this |
---|
| 189 | entity. |
---|
| 190 | */ |
---|
[3220] | 191 | void StoryEntity::releaseLoadScreen() |
---|
[2636] | 192 | {} |
---|