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