[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 | |
---|
[5389] | 76 | inline Camera* getLocalCamera() { return this->localCamera; }; |
---|
[4338] | 77 | |
---|
[5389] | 78 | void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; }; |
---|
[5429] | 79 | void toggleBVVisibility() { this->showBV = !this->showBV; }; |
---|
[5389] | 80 | |
---|
[3461] | 81 | private: |
---|
[4978] | 82 | void constuctorInit(const char* name, int worldID); |
---|
[3462] | 83 | /* function for main-loop */ |
---|
[3225] | 84 | void mainLoop (); |
---|
| 85 | void synchronize (); |
---|
[3226] | 86 | void handleInput (); |
---|
[3551] | 87 | void tick (); |
---|
| 88 | void update (); |
---|
[3459] | 89 | void collide (); |
---|
[3461] | 90 | void draw (); |
---|
[3225] | 91 | void display (); |
---|
| 92 | void debug (); |
---|
[3365] | 93 | |
---|
[5389] | 94 | private: |
---|
| 95 | bool showPNodes; //!< if the PNodes should be visible. |
---|
[5429] | 96 | bool showBV; //!< if the Bounding Volumes should be visible. |
---|
[5389] | 97 | Uint32 lastFrame; //!< last time of frame |
---|
| 98 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
| 99 | Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) |
---|
| 100 | float dtS; //!< The time needed for caluculations in seconds |
---|
| 101 | float speed; //!< how fast the game flows |
---|
| 102 | double gameTime; //!< this is where the game time is saved |
---|
| 103 | bool bQuitOrxonox; //!< quit this application |
---|
| 104 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
| 105 | bool bPause; //!< pause mode |
---|
| 106 | |
---|
| 107 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
| 108 | |
---|
| 109 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
| 110 | char* path; //!< The file from which this world is loaded |
---|
| 111 | |
---|
| 112 | Shell* shell; |
---|
| 113 | OggPlayer* music; |
---|
| 114 | |
---|
| 115 | // IMPORTANT WORLD-ENTITIES |
---|
| 116 | Camera* localCamera; //!< The current Camera |
---|
| 117 | WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted |
---|
| 118 | Terrain* terrain; //!< The Terrain of the World. |
---|
| 119 | |
---|
| 120 | GLuint objectList; //!< temporary: @todo this will be ereased soon |
---|
| 121 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
| 122 | Player* localPlayer; //!< The Player, you fly through the level. |
---|
| 123 | PilotNode* pilotNode; //!< THe pilot node to fly with the mouse |
---|
| 124 | |
---|
| 125 | |
---|
[2190] | 126 | }; |
---|
[1883] | 127 | |
---|
[3224] | 128 | #endif /* _WORLD_H */ |
---|