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