1 | /*! |
---|
2 | \file world.h |
---|
3 | \brief Holds and manages all game data |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _WORLD_H |
---|
7 | #define _WORLD_H |
---|
8 | |
---|
9 | #include "stdincl.h" |
---|
10 | #include "comincl.h" |
---|
11 | #include "story_entity.h" |
---|
12 | #include "p_node.h" |
---|
13 | #include "xmlparser/tinyxml.h" |
---|
14 | |
---|
15 | class World; |
---|
16 | class WorldEntity; |
---|
17 | class TrackManager; |
---|
18 | class Camera; |
---|
19 | class PNode; |
---|
20 | class GLMenuImageScreen; |
---|
21 | class LightManager; |
---|
22 | class Terrain; |
---|
23 | class GarbageCollector; |
---|
24 | class Text; |
---|
25 | |
---|
26 | //! The game world Interface |
---|
27 | /** |
---|
28 | this is a singleton interface, that enables world_entities to access the |
---|
29 | world. for those objects, there is no easier way than over this interface! |
---|
30 | */ |
---|
31 | class WorldInterface : BaseObject { |
---|
32 | |
---|
33 | public: |
---|
34 | ~WorldInterface(); |
---|
35 | static WorldInterface* getInstance(); |
---|
36 | void init(World* world); |
---|
37 | tList<WorldEntity>* getEntityList(); |
---|
38 | |
---|
39 | private: |
---|
40 | WorldInterface(); |
---|
41 | static WorldInterface* singletonRef; //!< singleton reference to this object |
---|
42 | bool worldIsInitialized; //!< true if the world has been initialized |
---|
43 | World* worldReference; //!< this is a reference to the running world |
---|
44 | |
---|
45 | }; |
---|
46 | |
---|
47 | //! The game world |
---|
48 | /** |
---|
49 | this class initializes everything that should be displayed inside of the current level. |
---|
50 | it is the main driving factor during gameplay. |
---|
51 | */ |
---|
52 | class World : public StoryEntity { |
---|
53 | |
---|
54 | public: |
---|
55 | World (char* name); |
---|
56 | World (int worldID); |
---|
57 | World (TiXmlElement* root); |
---|
58 | virtual ~World (); |
---|
59 | |
---|
60 | double getGameTime(); |
---|
61 | |
---|
62 | /* classes from story-entity */ |
---|
63 | virtual ErrorMessage preLoad(); |
---|
64 | virtual ErrorMessage load (); |
---|
65 | virtual ErrorMessage init (); |
---|
66 | virtual ErrorMessage start (); |
---|
67 | virtual ErrorMessage stop (); |
---|
68 | virtual ErrorMessage pause (); |
---|
69 | virtual ErrorMessage resume (); |
---|
70 | virtual ErrorMessage destroy (); |
---|
71 | |
---|
72 | void loadDebugWorld(int worldID); |
---|
73 | |
---|
74 | virtual void displayLoadScreen(); |
---|
75 | virtual void releaseLoadScreen(); |
---|
76 | |
---|
77 | /* command node functions */ |
---|
78 | bool command (Command* cmd); |
---|
79 | |
---|
80 | tList<WorldEntity>* getEntities(); |
---|
81 | |
---|
82 | /* interface to world */ |
---|
83 | void spawn (WorldEntity* entity); |
---|
84 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
85 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, |
---|
86 | int parentingMode); |
---|
87 | |
---|
88 | const char* getPath(); |
---|
89 | void setPath( const char* name); |
---|
90 | |
---|
91 | private: |
---|
92 | void constuctorInit(char* name, int worldID); |
---|
93 | |
---|
94 | Uint32 lastFrame; //!< last time of frame |
---|
95 | Uint32 dt; //!< time needed to calculate this frame |
---|
96 | float dtS; //!< The time needed for caluculations in seconds |
---|
97 | double gameTime; //!< this is where the game time is saved |
---|
98 | bool bQuitOrxonox; //!< quit this application |
---|
99 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
100 | bool bPause; //!< pause mode |
---|
101 | |
---|
102 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
103 | |
---|
104 | char* worldName; //!< The name of this World |
---|
105 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
106 | char* path; //!< The file from which this world is loaded |
---|
107 | |
---|
108 | PNode* nullParent; //!< The zero-point, that everything has as its parent. |
---|
109 | TrackManager* trackManager; //!< The reference of the TrackManager that handles the course through the Level. |
---|
110 | Camera* localCamera; //!< The current Camera |
---|
111 | WorldEntity* sky; //!< The Environmental Heaven of orxonox \todo insert this to environment insted |
---|
112 | LightManager* lightMan; //!< The Lights of the Level |
---|
113 | Terrain* terrain; //!< The Terrain of the World. |
---|
114 | |
---|
115 | GLuint objectList; //!< temporary: \todo this will be ereased soon |
---|
116 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
117 | WorldEntity* localPlayer; //!< The Player, you fly through the level. |
---|
118 | |
---|
119 | GarbageCollector* garbageCollector; //!< reference to the garbage collector |
---|
120 | |
---|
121 | /* function for main-loop */ |
---|
122 | void mainLoop (); |
---|
123 | void synchronize (); |
---|
124 | void handleInput (); |
---|
125 | void tick (); |
---|
126 | void update (); |
---|
127 | void collide (); |
---|
128 | void draw (); |
---|
129 | void display (); |
---|
130 | void debug (); |
---|
131 | |
---|
132 | }; |
---|
133 | |
---|
134 | #endif /* _WORLD_H */ |
---|