[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 | |
---|
[3319] | 68 | |
---|
[3327] | 69 | UPointCurve* testCurve; |
---|
[1883] | 70 | private: |
---|
[2636] | 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; |
---|
[1855] | 75 | |
---|
[2636] | 76 | char* worldName; |
---|
| 77 | int debugWorldNr; |
---|
[2731] | 78 | GLuint objectList; |
---|
[2636] | 79 | |
---|
[2640] | 80 | WorldEntity* localPlayer; |
---|
[3276] | 81 | |
---|
| 82 | PNode* nullParent; |
---|
| 83 | |
---|
[3225] | 84 | void mainLoop (); |
---|
| 85 | void synchronize (); |
---|
[3226] | 86 | void handleInput (); |
---|
[3225] | 87 | void timeSlice (); |
---|
| 88 | void collision (); |
---|
| 89 | void display (); |
---|
| 90 | void debug (); |
---|
[2190] | 91 | }; |
---|
[1883] | 92 | |
---|
[3224] | 93 | #endif /* _WORLD_H */ |
---|