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