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 "story_entity.h" |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | class Track; |
---|
15 | class WorldEntity; |
---|
16 | class Camera; |
---|
17 | class PNode; |
---|
18 | |
---|
19 | //! The game environment |
---|
20 | class World : public StoryEntity { |
---|
21 | |
---|
22 | public: |
---|
23 | World (char* name); |
---|
24 | World (int worldID); |
---|
25 | virtual ~World (); |
---|
26 | |
---|
27 | template<typename T> |
---|
28 | T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity |
---|
29 | template<typename T> |
---|
30 | T* spawn (Placement* plc, WorldEntity* owner); |
---|
31 | |
---|
32 | virtual ErrorMessage init (); |
---|
33 | virtual ErrorMessage start (); |
---|
34 | virtual ErrorMessage stop (); |
---|
35 | virtual ErrorMessage pause (); |
---|
36 | virtual ErrorMessage resume (); |
---|
37 | |
---|
38 | virtual void load (); |
---|
39 | virtual void destroy (); |
---|
40 | |
---|
41 | void timeSlice (Uint32 deltaT); |
---|
42 | void collide (); |
---|
43 | void draw (); |
---|
44 | void update (); // maps Locations to Placements |
---|
45 | void calcCameraPos (Location* loc, Placement* plc); |
---|
46 | |
---|
47 | void unload (); |
---|
48 | bool command (Command* cmd); |
---|
49 | |
---|
50 | void setTrackLen (Uint32 tracklen); |
---|
51 | int getTrackLen (); |
---|
52 | //bool system_command (Command* cmd); |
---|
53 | Camera* getCamera (); |
---|
54 | |
---|
55 | void spawn (WorldEntity* entity); |
---|
56 | void spawn (WorldEntity* entity, Location* loc); |
---|
57 | void spawn (WorldEntity* entity, Placement* plc); |
---|
58 | |
---|
59 | tList<WorldEntity>* entities; |
---|
60 | |
---|
61 | // base level data |
---|
62 | Track* track; |
---|
63 | Uint32 tracklen; // number of Tracks the World consist of |
---|
64 | Vector* pathnodes; |
---|
65 | Camera* localCamera; |
---|
66 | |
---|
67 | private: |
---|
68 | Uint32 lastFrame; //!> last time of frame |
---|
69 | bool bQuitOrxonox; //!> quit this application |
---|
70 | bool bQuitCurrentGame; //!> quit only the current game and return to menu |
---|
71 | bool bPause; |
---|
72 | |
---|
73 | char* worldName; |
---|
74 | int debugWorldNr; |
---|
75 | GLuint objectList; |
---|
76 | |
---|
77 | WorldEntity* localPlayer; |
---|
78 | |
---|
79 | PNode* nullParent; |
---|
80 | |
---|
81 | void mainLoop (); |
---|
82 | void synchronize (); |
---|
83 | void handleInput (); |
---|
84 | void timeSlice (); |
---|
85 | void collision (); |
---|
86 | void display (); |
---|
87 | void debug (); |
---|
88 | }; |
---|
89 | |
---|
90 | #endif /* _WORLD_H */ |
---|