| [2190] | 1 | /*! |
|---|
| 2 | \file world.h |
|---|
| 3 | \brief Holds and manages all game data |
|---|
| 4 | */ |
|---|
| [1853] | 5 | |
|---|
| [3238] | 6 | #ifndef _WORLD_H |
|---|
| 7 | #define _WORLD_H |
|---|
| [1853] | 8 | |
|---|
| [2190] | 9 | #include "stdincl.h" |
|---|
| [2636] | 10 | #include "story_entity.h" |
|---|
| [2190] | 11 | |
|---|
| [2636] | 12 | |
|---|
| 13 | |
|---|
| [2190] | 14 | class Track; |
|---|
| [2077] | 15 | class WorldEntity; |
|---|
| [2636] | 16 | class Camera; |
|---|
| [1883] | 17 | |
|---|
| [2190] | 18 | //! The game environment |
|---|
| [2636] | 19 | class World : public StoryEntity { |
|---|
| [1853] | 20 | |
|---|
| 21 | public: |
|---|
| [2636] | 22 | World (char* name); |
|---|
| 23 | World (int worldID); |
|---|
| [3238] | 24 | virtual ~World (); |
|---|
| [1853] | 25 | |
|---|
| [2636] | 26 | template<typename T> |
|---|
| [3238] | 27 | T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity |
|---|
| [2636] | 28 | template<typename T> |
|---|
| [3238] | 29 | T* spawn (Placement* plc, WorldEntity* owner); |
|---|
| [2636] | 30 | |
|---|
| [3238] | 31 | virtual ErrorMessage init (); |
|---|
| 32 | virtual ErrorMessage start (); |
|---|
| 33 | virtual ErrorMessage stop (); |
|---|
| 34 | virtual ErrorMessage pause (); |
|---|
| 35 | virtual ErrorMessage resume (); |
|---|
| [1917] | 36 | |
|---|
| [3238] | 37 | virtual void load (); |
|---|
| 38 | virtual void destroy (); |
|---|
| [2636] | 39 | |
|---|
| [3238] | 40 | void timeSlice (Uint32 deltaT); |
|---|
| [2636] | 41 | void collide (); |
|---|
| 42 | void draw (); |
|---|
| 43 | void update (); // maps Locations to Placements |
|---|
| [3238] | 44 | void calcCameraPos (Location* loc, Placement* plc); |
|---|
| [2190] | 45 | |
|---|
| [2636] | 46 | void unload (); |
|---|
| [3238] | 47 | bool command (Command* cmd); |
|---|
| [2636] | 48 | |
|---|
| [3238] | 49 | void setTrackLen (Uint32 tracklen); |
|---|
| 50 | int getTrackLen (); |
|---|
| 51 | //bool system_command (Command* cmd); |
|---|
| 52 | Camera* getCamera (); |
|---|
| [2644] | 53 | |
|---|
| [3238] | 54 | void spawn (WorldEntity* entity); |
|---|
| 55 | void spawn (WorldEntity* entity, Location* loc); |
|---|
| 56 | void spawn (WorldEntity* entity, Placement* plc); |
|---|
| [2644] | 57 | |
|---|
| [2822] | 58 | tList<WorldEntity>* entities; |
|---|
| [2636] | 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 | |
|---|
| [1883] | 66 | private: |
|---|
| [2636] | 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; |
|---|
| [1855] | 71 | |
|---|
| [2636] | 72 | char* worldName; |
|---|
| 73 | int debugWorldNr; |
|---|
| [2731] | 74 | GLuint objectList; |
|---|
| [2636] | 75 | |
|---|
| [2640] | 76 | WorldEntity* localPlayer; |
|---|
| 77 | |
|---|
| [3238] | 78 | void mainLoop (); |
|---|
| 79 | void synchronize (); |
|---|
| 80 | void handleInput (); |
|---|
| 81 | void timeSlice (); |
|---|
| 82 | void collision (); |
|---|
| 83 | void display (); |
|---|
| 84 | void debug (); |
|---|
| [2190] | 85 | }; |
|---|
| [1883] | 86 | |
|---|
| [3238] | 87 | #endif /* _WORLD_H */ |
|---|