1 | /*! |
---|
2 | \file world.h |
---|
3 | * 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 Camera; |
---|
17 | class Player; |
---|
18 | class PNode; |
---|
19 | class GLMenuImageScreen; |
---|
20 | class Terrain; |
---|
21 | class GarbageCollector; |
---|
22 | class Text; |
---|
23 | class TiXmlElement; |
---|
24 | class PilotNode; |
---|
25 | |
---|
26 | class OggPlayer; |
---|
27 | |
---|
28 | //! The game world |
---|
29 | /** |
---|
30 | this class initializes everything that should be displayed inside of the current level. |
---|
31 | it is the main driving factor during gameplay. |
---|
32 | */ |
---|
33 | class World : public StoryEntity { |
---|
34 | |
---|
35 | public: |
---|
36 | World (const char* name); |
---|
37 | World (int worldID); |
---|
38 | World (const TiXmlElement* root = NULL); |
---|
39 | virtual ~World (); |
---|
40 | |
---|
41 | void loadParams(const TiXmlElement* root); |
---|
42 | |
---|
43 | double getGameTime(); |
---|
44 | |
---|
45 | /* classes from story-entity */ |
---|
46 | virtual ErrorMessage preLoad(); |
---|
47 | virtual ErrorMessage load (); |
---|
48 | virtual ErrorMessage init (); |
---|
49 | virtual ErrorMessage start (); |
---|
50 | virtual ErrorMessage stop (); |
---|
51 | virtual ErrorMessage pause (); |
---|
52 | virtual ErrorMessage resume (); |
---|
53 | virtual ErrorMessage destroy (); |
---|
54 | |
---|
55 | void loadDebugWorld(int worldID); |
---|
56 | |
---|
57 | virtual void displayLoadScreen(); |
---|
58 | virtual void releaseLoadScreen(); |
---|
59 | |
---|
60 | /* command node functions */ |
---|
61 | bool command (Command* cmd); |
---|
62 | |
---|
63 | tList<WorldEntity>* getEntities(); |
---|
64 | |
---|
65 | /* interface to world */ |
---|
66 | void spawn (WorldEntity* entity); |
---|
67 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
68 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir); |
---|
69 | |
---|
70 | const char* getPath(); |
---|
71 | void setPath( const char* name); |
---|
72 | |
---|
73 | inline Camera* getLocalCamera() {return this->localCamera;} |
---|
74 | |
---|
75 | private: |
---|
76 | void constuctorInit(const char* name, int worldID); |
---|
77 | |
---|
78 | Uint32 lastFrame; //!< last time of frame |
---|
79 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
80 | Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) |
---|
81 | float dtS; //!< The time needed for caluculations in seconds |
---|
82 | double gameTime; //!< this is where the game time is saved |
---|
83 | bool bQuitOrxonox; //!< quit this application |
---|
84 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
85 | bool bPause; //!< pause mode |
---|
86 | |
---|
87 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
88 | |
---|
89 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
90 | char* path; //!< The file from which this world is loaded |
---|
91 | |
---|
92 | |
---|
93 | OggPlayer* music; |
---|
94 | |
---|
95 | // IMPORTANT WORLD-ENTITIES |
---|
96 | Camera* localCamera; //!< The current Camera |
---|
97 | WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted |
---|
98 | Terrain* terrain; //!< The Terrain of the World. |
---|
99 | |
---|
100 | GLuint objectList; //!< temporary: @todo this will be ereased soon |
---|
101 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
102 | Player* localPlayer; //!< The Player, you fly through the level. |
---|
103 | PilotNode* pilotNode; //!< THe pilot node to fly with the mouse |
---|
104 | |
---|
105 | /* function for main-loop */ |
---|
106 | void mainLoop (); |
---|
107 | void synchronize (); |
---|
108 | void handleInput (); |
---|
109 | void tick (); |
---|
110 | void update (); |
---|
111 | void collide (); |
---|
112 | void draw (); |
---|
113 | void display (); |
---|
114 | void debug (); |
---|
115 | |
---|
116 | }; |
---|
117 | |
---|
118 | #endif /* _WORLD_H */ |
---|