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 | //static void vertexCallback (GLfloat* vertex); |
---|
42 | |
---|
43 | void timeSlice (Uint32 deltaT); |
---|
44 | void collide (); |
---|
45 | void draw (); |
---|
46 | void update (); // maps Locations to Placements |
---|
47 | void calcCameraPos (Location* loc, Placement* plc); |
---|
48 | |
---|
49 | void unload (); |
---|
50 | bool command (Command* cmd); |
---|
51 | |
---|
52 | void setTrackLen (Uint32 tracklen); |
---|
53 | int getTrackLen (); |
---|
54 | //bool system_command (Command* cmd); |
---|
55 | Camera* getCamera (); |
---|
56 | |
---|
57 | void spawn (WorldEntity* entity); |
---|
58 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
59 | |
---|
60 | tList<WorldEntity>* entities; |
---|
61 | |
---|
62 | // base level data |
---|
63 | Track* track; |
---|
64 | Uint32 tracklen; // number of Tracks the World consist of |
---|
65 | Vector* pathnodes; |
---|
66 | Camera* localCamera; |
---|
67 | |
---|
68 | |
---|
69 | BezierCurve* testCurve; |
---|
70 | private: |
---|
71 | Uint32 lastFrame; //!> last time of frame |
---|
72 | bool bQuitOrxonox; //!> quit this application |
---|
73 | bool bQuitCurrentGame; //!> quit only the current game and return to menu |
---|
74 | bool bPause; |
---|
75 | |
---|
76 | char* worldName; |
---|
77 | int debugWorldNr; |
---|
78 | GLuint objectList; |
---|
79 | |
---|
80 | WorldEntity* localPlayer; |
---|
81 | |
---|
82 | PNode* nullParent; |
---|
83 | |
---|
84 | void mainLoop (); |
---|
85 | void synchronize (); |
---|
86 | void handleInput (); |
---|
87 | void timeSlice (); |
---|
88 | void collision (); |
---|
89 | void display (); |
---|
90 | void debug (); |
---|
91 | }; |
---|
92 | |
---|
93 | #endif /* _WORLD_H */ |
---|