[4558] | 1 | /*! |
---|
[2190] | 2 | \file world.h |
---|
[4836] | 3 | * Holds and manages all game data |
---|
[4558] | 4 | */ |
---|
[1853] | 5 | |
---|
[3224] | 6 | #ifndef _WORLD_H |
---|
| 7 | #define _WORLD_H |
---|
[1853] | 8 | |
---|
[2190] | 9 | #include "stdincl.h" |
---|
[3608] | 10 | #include "comincl.h" |
---|
[2636] | 11 | #include "story_entity.h" |
---|
[3521] | 12 | #include "p_node.h" |
---|
[2190] | 13 | |
---|
[3620] | 14 | class World; |
---|
| 15 | class WorldEntity; |
---|
[3634] | 16 | class Camera; |
---|
[4396] | 17 | class Player; |
---|
[3634] | 18 | class PNode; |
---|
| 19 | class GLMenuImageScreen; |
---|
| 20 | class Terrain; |
---|
[3646] | 21 | class GarbageCollector; |
---|
[3790] | 22 | class Text; |
---|
[4261] | 23 | class TiXmlElement; |
---|
[4326] | 24 | class PilotNode; |
---|
[3790] | 25 | |
---|
[4961] | 26 | class OggPlayer; |
---|
[3620] | 27 | |
---|
[3449] | 28 | //! The game world |
---|
| 29 | /** |
---|
| 30 | this class initializes everything that should be displayed inside of the current level. |
---|
| 31 | it is the main driving factor during gameplay. |
---|
| 32 | */ |
---|
[2636] | 33 | class World : public StoryEntity { |
---|
[1853] | 34 | |
---|
| 35 | public: |
---|
[4978] | 36 | World (const char* name); |
---|
[2636] | 37 | World (int worldID); |
---|
[4261] | 38 | World (const TiXmlElement* root = NULL); |
---|
[3221] | 39 | virtual ~World (); |
---|
[3459] | 40 | |
---|
[4261] | 41 | void loadParams(const TiXmlElement* root); |
---|
| 42 | |
---|
[3646] | 43 | double getGameTime(); |
---|
[3459] | 44 | |
---|
| 45 | /* classes from story-entity */ |
---|
[3629] | 46 | virtual ErrorMessage preLoad(); |
---|
[3459] | 47 | virtual ErrorMessage load (); |
---|
[3225] | 48 | virtual ErrorMessage init (); |
---|
| 49 | virtual ErrorMessage start (); |
---|
| 50 | virtual ErrorMessage stop (); |
---|
| 51 | virtual ErrorMessage pause (); |
---|
| 52 | virtual ErrorMessage resume (); |
---|
[3459] | 53 | virtual ErrorMessage destroy (); |
---|
[1917] | 54 | |
---|
[4010] | 55 | void loadDebugWorld(int worldID); |
---|
| 56 | |
---|
[3459] | 57 | virtual void displayLoadScreen(); |
---|
| 58 | virtual void releaseLoadScreen(); |
---|
[4558] | 59 | |
---|
[3461] | 60 | /* command node functions */ |
---|
[3225] | 61 | bool command (Command* cmd); |
---|
[3459] | 62 | |
---|
[3620] | 63 | tList<WorldEntity>* getEntities(); |
---|
| 64 | |
---|
[3461] | 65 | /* interface to world */ |
---|
[3225] | 66 | void spawn (WorldEntity* entity); |
---|
[3365] | 67 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
[4765] | 68 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir); |
---|
[2644] | 69 | |
---|
[4010] | 70 | const char* getPath(); |
---|
| 71 | void setPath( const char* name); |
---|
[3461] | 72 | |
---|
[4746] | 73 | inline Camera* getLocalCamera() {return this->localCamera;} |
---|
[4338] | 74 | |
---|
[3461] | 75 | private: |
---|
[4978] | 76 | void constuctorInit(const char* name, int worldID); |
---|
[3526] | 77 | |
---|
[3727] | 78 | Uint32 lastFrame; //!< last time of frame |
---|
[4558] | 79 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
[4822] | 80 | Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) |
---|
[4145] | 81 | float dtS; //!< The time needed for caluculations in seconds |
---|
[3727] | 82 | double gameTime; //!< this is where the game time is saved |
---|
| 83 | bool bQuitOrxonox; //!< quit this application |
---|
| 84 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
| 85 | bool bPause; //!< pause mode |
---|
[1855] | 86 | |
---|
[3727] | 87 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
[3365] | 88 | |
---|
[3727] | 89 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
[4010] | 90 | char* path; //!< The file from which this world is loaded |
---|
[3462] | 91 | |
---|
[4822] | 92 | |
---|
[4961] | 93 | OggPlayer* music; |
---|
[4977] | 94 | |
---|
[4822] | 95 | // IMPORTANT WORLD-ENTITIES |
---|
[3727] | 96 | Camera* localCamera; //!< The current Camera |
---|
[4836] | 97 | WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted |
---|
[3727] | 98 | Terrain* terrain; //!< The Terrain of the World. |
---|
[2636] | 99 | |
---|
[4836] | 100 | GLuint objectList; //!< temporary: @todo this will be ereased soon |
---|
[3727] | 101 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
[4396] | 102 | Player* localPlayer; //!< The Player, you fly through the level. |
---|
[4326] | 103 | PilotNode* pilotNode; //!< THe pilot node to fly with the mouse |
---|
[3646] | 104 | |
---|
[3462] | 105 | /* function for main-loop */ |
---|
[3225] | 106 | void mainLoop (); |
---|
| 107 | void synchronize (); |
---|
[3226] | 108 | void handleInput (); |
---|
[3551] | 109 | void tick (); |
---|
| 110 | void update (); |
---|
[3459] | 111 | void collide (); |
---|
[3461] | 112 | void draw (); |
---|
[3225] | 113 | void display (); |
---|
| 114 | void debug (); |
---|
[3365] | 115 | |
---|
[2190] | 116 | }; |
---|
[1883] | 117 | |
---|
[3224] | 118 | #endif /* _WORLD_H */ |
---|