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 | class TrackManager; |
---|
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 | virtual void displayLoadScreen(); |
---|
52 | virtual void releaseLoadScreen(); |
---|
53 | |
---|
54 | void setTrackLen (Uint32 tracklen); |
---|
55 | int getTrackLen (); |
---|
56 | //bool system_command (Command* cmd); |
---|
57 | Camera* getCamera (); |
---|
58 | |
---|
59 | void spawn (WorldEntity* entity); |
---|
60 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
61 | |
---|
62 | tList<WorldEntity>* entities; |
---|
63 | |
---|
64 | // base level data |
---|
65 | TrackManager* trackManager; |
---|
66 | Track* track; |
---|
67 | Uint32 tracklen; // number of Tracks the World consist of |
---|
68 | Vector* pathnodes; |
---|
69 | Camera* localCamera; |
---|
70 | |
---|
71 | |
---|
72 | UPointCurve* testCurve; |
---|
73 | private: |
---|
74 | Uint32 lastFrame; //!> last time of frame |
---|
75 | bool bQuitOrxonox; //!> quit this application |
---|
76 | bool bQuitCurrentGame; //!> quit only the current game and return to menu |
---|
77 | bool bPause; |
---|
78 | |
---|
79 | char* worldName; |
---|
80 | int debugWorldNr; |
---|
81 | GLuint objectList; |
---|
82 | SDL_Surface *loadImage; |
---|
83 | |
---|
84 | WorldEntity* localPlayer; |
---|
85 | |
---|
86 | PNode* nullParent; |
---|
87 | |
---|
88 | void mainLoop (); |
---|
89 | void synchronize (); |
---|
90 | void handleInput (); |
---|
91 | void timeSlice (); |
---|
92 | void collision (); |
---|
93 | void display (); |
---|
94 | void debug (); |
---|
95 | |
---|
96 | void swap (unsigned char &a, unsigned char &b); /* \todo: this function doesn't belong here, this should be part of a image class*/ |
---|
97 | }; |
---|
98 | |
---|
99 | #endif /* _WORLD_H */ |
---|