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