[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 | |
---|
[3335] | 13 | class TrackManager; |
---|
[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); |
---|
[3336] | 51 | virtual void displayLoadScreen(); |
---|
| 52 | virtual void releaseLoadScreen(); |
---|
[2636] | 53 | |
---|
[3225] | 54 | void setTrackLen (Uint32 tracklen); |
---|
| 55 | int getTrackLen (); |
---|
[3216] | 56 | //bool system_command (Command* cmd); |
---|
[3225] | 57 | Camera* getCamera (); |
---|
[2644] | 58 | |
---|
[3225] | 59 | void spawn (WorldEntity* entity); |
---|
[3306] | 60 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
[2644] | 61 | |
---|
[2822] | 62 | tList<WorldEntity>* entities; |
---|
[2636] | 63 | |
---|
| 64 | // base level data |
---|
[3335] | 65 | TrackManager* trackManager; |
---|
[2636] | 66 | Track* track; |
---|
| 67 | Uint32 tracklen; // number of Tracks the World consist of |
---|
| 68 | Vector* pathnodes; |
---|
| 69 | Camera* localCamera; |
---|
| 70 | |
---|
[3319] | 71 | |
---|
[3327] | 72 | UPointCurve* testCurve; |
---|
[1883] | 73 | private: |
---|
[2636] | 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; |
---|
[1855] | 78 | |
---|
[2636] | 79 | char* worldName; |
---|
| 80 | int debugWorldNr; |
---|
[2731] | 81 | GLuint objectList; |
---|
[3336] | 82 | SDL_Surface *loadImage; |
---|
[2636] | 83 | |
---|
[2640] | 84 | WorldEntity* localPlayer; |
---|
[3276] | 85 | |
---|
| 86 | PNode* nullParent; |
---|
| 87 | |
---|
[3225] | 88 | void mainLoop (); |
---|
| 89 | void synchronize (); |
---|
[3226] | 90 | void handleInput (); |
---|
[3225] | 91 | void timeSlice (); |
---|
| 92 | void collision (); |
---|
| 93 | void display (); |
---|
| 94 | void debug (); |
---|
[3338] | 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*/ |
---|
[2190] | 97 | }; |
---|
[1883] | 98 | |
---|
[3224] | 99 | #endif /* _WORLD_H */ |
---|