| [2190] | 1 | /*! |
|---|
| 2 | \file world.h |
|---|
| 3 | \brief Holds and manages all game data |
|---|
| 4 | */ |
|---|
| [1853] | 5 | |
|---|
| [3224] | 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; |
|---|
| [3276] | 17 | class PNode; |
|---|
| [1883] | 18 | |
|---|
| [2190] | 19 | //! The game environment |
|---|
| [2636] | 20 | class World : public StoryEntity { |
|---|
| [1853] | 21 | |
|---|
| 22 | public: |
|---|
| [2636] | 23 | World (char* name); |
|---|
| 24 | World (int worldID); |
|---|
| [3221] | 25 | virtual ~World (); |
|---|
| [1853] | 26 | |
|---|
| [2636] | 27 | template<typename T> |
|---|
| [3225] | 28 | T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity |
|---|
| [2636] | 29 | template<typename T> |
|---|
| [3225] | 30 | T* spawn (Placement* plc, WorldEntity* owner); |
|---|
| [2636] | 31 | |
|---|
| [3225] | 32 | virtual ErrorMessage init (); |
|---|
| 33 | virtual ErrorMessage start (); |
|---|
| 34 | virtual ErrorMessage stop (); |
|---|
| 35 | virtual ErrorMessage pause (); |
|---|
| 36 | virtual ErrorMessage resume (); |
|---|
| [1917] | 37 | |
|---|
| [3225] | 38 | virtual void load (); |
|---|
| 39 | virtual void destroy (); |
|---|
| [2636] | 40 | |
|---|
| [3311] | 41 | //static void vertexCallback (GLfloat* vertex); |
|---|
| 42 | |
|---|
| [3225] | 43 | void timeSlice (Uint32 deltaT); |
|---|
| [2636] | 44 | void collide (); |
|---|
| 45 | void draw (); |
|---|
| 46 | void update (); // maps Locations to Placements |
|---|
| [3225] | 47 | void calcCameraPos (Location* loc, Placement* plc); |
|---|
| [2190] | 48 | |
|---|
| [2636] | 49 | void unload (); |
|---|
| [3225] | 50 | bool command (Command* cmd); |
|---|
| [2636] | 51 | |
|---|
| [3225] | 52 | void setTrackLen (Uint32 tracklen); |
|---|
| 53 | int getTrackLen (); |
|---|
| [3216] | 54 | //bool system_command (Command* cmd); |
|---|
| [3225] | 55 | Camera* getCamera (); |
|---|
| [2644] | 56 | |
|---|
| [3225] | 57 | void spawn (WorldEntity* entity); |
|---|
| [3306] | 58 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
|---|
| [2644] | 59 | |
|---|
| [2822] | 60 | tList<WorldEntity>* entities; |
|---|
| [2636] | 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 | |
|---|
| [1883] | 68 | private: |
|---|
| [2636] | 69 | Uint32 lastFrame; //!> last time of frame |
|---|
| 70 | bool bQuitOrxonox; //!> quit this application |
|---|
| 71 | bool bQuitCurrentGame; //!> quit only the current game and return to menu |
|---|
| 72 | bool bPause; |
|---|
| [1855] | 73 | |
|---|
| [2636] | 74 | char* worldName; |
|---|
| 75 | int debugWorldNr; |
|---|
| [2731] | 76 | GLuint objectList; |
|---|
| [2636] | 77 | |
|---|
| [2640] | 78 | WorldEntity* localPlayer; |
|---|
| [3276] | 79 | |
|---|
| 80 | PNode* nullParent; |
|---|
| 81 | |
|---|
| [3225] | 82 | void mainLoop (); |
|---|
| 83 | void synchronize (); |
|---|
| [3226] | 84 | void handleInput (); |
|---|
| [3225] | 85 | void timeSlice (); |
|---|
| 86 | void collision (); |
|---|
| 87 | void display (); |
|---|
| 88 | void debug (); |
|---|
| [2190] | 89 | }; |
|---|
| [1883] | 90 | |
|---|
| [3224] | 91 | #endif /* _WORLD_H */ |
|---|