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