Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/story_entity.h @ 8932

Last change on this file since 8932 was 8717, checked in by bensch, 18 years ago

merged the gui back

File size: 4.1 KB
Line 
1/*!
2 * @file story_entity.h
3 *  holds the base class of everything that is playable - that is part of the story
4 */
5
6
7#ifndef _STORY_ENTITY_H
8#define _STORY_ENTITY_H
9
10#include "base_object.h"
11#include "story_def.h"
12#include "error.h"
13
14
15typedef enum StoryEntityState
16{
17  SE_STATE_RUN     = 0,
18  SE_STATE_STOP,
19  SE_STATE_PAUSE,
20
21  SE_STATE_NUM
22};
23
24
25//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
26class StoryEntity : virtual public BaseObject
27{
28
29public:
30  StoryEntity ();
31  virtual ~StoryEntity ();
32
33  virtual void loadParams(const TiXmlElement* root);
34
35  /* initialisation and loading */
36  /** initializes a Story Entity to the needed values */
37  virtual ErrorMessage init() { return ErrorMessage(); };
38  /** called to load the data into the StoryEntity*/
39  virtual ErrorMessage loadData() { return ErrorMessage(); };
40  /** function that unloads the data from the StoryEntity */
41  virtual ErrorMessage unloadData() { return ErrorMessage(); };
42
43  /* running, stopping and pausing */
44  /** starts the Entity. Starts the main cycle */
45  virtual bool start() = 0;
46  /**  Stops the entity. */
47  virtual bool stop() = 0;
48  /** pauses the Entity, you can resume the game by calling the resume() function */
49  virtual bool pause() = 0;
50  /** resumes a paused StoryEntity */
51  virtual bool resume() = 0;
52  /** function that is been called when the StoryEntity is started via start() */
53  virtual void run() = 0;
54
55  /* properties interface */
56  /** returns the state of this StoryEntity */
57  StoryEntityState getState();
58
59  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
60  inline void setStoryID(int storyID) { this->storyID = storyID; }
61  /** sets the story id of the current entity, this enables it to be identified in a  global context. @returns  the story id  */
62  inline int getStoryID() { return this->storyID; }
63
64  void setLoadFile(const std::string& fileName);
65  /** @returns the Filename this StoryEntity was loaded with */
66  const std::string& getLoadFile() const { return this->loadFile; }
67
68  void setNextStoryID(int nextStoryID);
69  /**  gets the story id of the current entity @returns story id */
70  inline int getNextStoryID() const { return this->nextStoryID; }
71  inline void setDescription(const std::string& description);
72  /** @returns the description of this StoryEntity */
73  inline const std::string& getDescription() { return this->description; }
74
75  void grabWorldInfo();
76  /** toggle the menu visibility: SimpleMenu specific */
77  inline void addToGameMenu(bool toggle) { this->bMenuEntry = toggle; }
78  /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
79  inline bool isContainedInMenu() { return this->bMenuEntry; }
80  /** sets the menu item image of this StoryEntity @param name name */
81  inline void setMenuItemImage(const std::string& image);
82  /** @returns the menu item image of this StoryEntity */
83  inline const std::string& getMenuItemImage() { return this->menuItemImage; }
84  inline void setMenuScreenshoot(const std::string& image);
85  /** @returns the menu screenshoot of this StoryEntity */
86  inline const std::string& getMenuScreenshoot() { return this->menuScreenshoot; }
87
88protected:
89  bool          bInit;             //!< if the entity is initialized, this has to be true.
90  bool          bRunning;          //!< is true if the entity is running
91  bool          bPaused;           //!< is true if the entity is paused
92
93
94private:
95  int           storyID;          //!< this is the number of this entity, identifying it in a list/tree...
96  int           nextStoryID;      //!< if this entity has finished, this entity shall be called
97  std::string   loadFile;         //!< The file from which this world is loaded
98
99  std::string   description;      //!< the description of the StoryEntity
100  std::string   menuItemImage;    //!< the item image of the StoryEntity
101  std::string   menuScreenshoot;  //!< the screenshoot of the StoryEntity
102  bool          bMenuEntry;       //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
103};
104
105#endif /* _STORY_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.