[6352] | 1 | /*! |
---|
| 2 | * @file game_world.h |
---|
| 3 | * container for all game worlds (singleplayers, multiplayers..) |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _GAME_WORLD_H |
---|
| 7 | #define _GAME_WORLD_H |
---|
| 8 | |
---|
| 9 | #include "sdlincl.h" |
---|
| 10 | #include "story_entity.h" |
---|
| 11 | #include "object_manager.h" |
---|
| 12 | |
---|
| 13 | class WorldEntity; |
---|
| 14 | class Camera; |
---|
| 15 | class Player; |
---|
| 16 | class GLMenuImageScreen; |
---|
| 17 | class Terrain; |
---|
| 18 | class TiXmlElement; |
---|
| 19 | |
---|
| 20 | class Shell; |
---|
| 21 | class OggPlayer; |
---|
| 22 | |
---|
| 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 | */ |
---|
| 28 | class GameWorld : public StoryEntity |
---|
| 29 | { |
---|
| 30 | |
---|
| 31 | public: |
---|
| 32 | GameWorld (const TiXmlElement* root = NULL); |
---|
| 33 | virtual ~GameWorld (); |
---|
| 34 | |
---|
| 35 | void loadParams(const TiXmlElement* root); |
---|
| 36 | |
---|
| 37 | double getGameTime(); |
---|
| 38 | |
---|
| 39 | /* classes from story-entity */ |
---|
[6365] | 40 | virtual ErrorMessage preLoad(); |
---|
| 41 | virtual ErrorMessage load (); |
---|
| 42 | virtual ErrorMessage postLoad(); |
---|
[6352] | 43 | |
---|
| 44 | virtual ErrorMessage preStart(); |
---|
| 45 | virtual ErrorMessage start (); |
---|
| 46 | virtual ErrorMessage stop (); |
---|
| 47 | virtual ErrorMessage pause (); |
---|
| 48 | virtual ErrorMessage resume (); |
---|
| 49 | virtual ErrorMessage destroy (); |
---|
| 50 | |
---|
| 51 | virtual void displayLoadScreen(); |
---|
| 52 | virtual void releaseLoadScreen(); |
---|
| 53 | |
---|
| 54 | /* interface to the game world */ |
---|
| 55 | virtual void spawn (WorldEntity* entity); |
---|
| 56 | |
---|
| 57 | /** @param speed sets the speed of the Game */ |
---|
| 58 | inline void setSpeed(float speed) { this->speed = speed; }; |
---|
| 59 | const char* getPath(); |
---|
| 60 | void setPath( const char* name); |
---|
| 61 | |
---|
| 62 | void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; }; |
---|
| 63 | void toggleBVVisibility() { this->showBV = !this->showBV; }; |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | protected: |
---|
| 67 | virtual void constuctorInit(const char* name, int worldID); |
---|
| 68 | |
---|
| 69 | /* world - running functions */ |
---|
| 70 | virtual void mainLoop (); |
---|
| 71 | |
---|
| 72 | virtual void synchronize (); |
---|
| 73 | virtual void handleInput (); |
---|
| 74 | virtual void tick (std::list<WorldEntity*> worldEntity, float dt); |
---|
| 75 | virtual void tick (); |
---|
| 76 | virtual void update (); |
---|
| 77 | virtual void collide (); |
---|
| 78 | virtual void draw (); |
---|
| 79 | virtual void display (); |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | protected: |
---|
| 83 | char* path; //!< The file from which this world is loaded |
---|
| 84 | |
---|
| 85 | /* state flags */ |
---|
[6360] | 86 | bool bQuitWorld; //!< quit only the current game and return to menu |
---|
[6352] | 87 | bool bPause; //!< pause mode |
---|
| 88 | |
---|
| 89 | bool showPNodes; //!< if the PNodes should be visible. |
---|
| 90 | bool showBV; //!< if the Bounding Volumes should be visible. |
---|
| 91 | |
---|
[6358] | 92 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
| 93 | |
---|
[6352] | 94 | /* world timing */ |
---|
| 95 | Uint32 lastFrame; //!< last time of frame |
---|
| 96 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
| 97 | Uint32 dt; //!< time needed to calculate this frame (in milliSeconds) |
---|
| 98 | float dtS; //!< The time needed for caluculations in seconds |
---|
| 99 | float speed; //!< how fast the game flows |
---|
| 100 | double gameTime; //!< this is where the game time is saved |
---|
| 101 | |
---|
| 102 | /* external modules interfaces */ |
---|
| 103 | ObjectManager objectManager; //!< The ObjectManager of this GameWorld. |
---|
| 104 | |
---|
[6358] | 105 | /* external modules interfaces */ |
---|
| 106 | Shell* shell; |
---|
| 107 | OggPlayer* music; |
---|
[6352] | 108 | |
---|
| 109 | /* important entities */ |
---|
| 110 | Camera* localCamera; //!< The current Camera |
---|
| 111 | Player* localPlayer; //!< The Player, you fly through the level. |
---|
| 112 | WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted |
---|
| 113 | Terrain* terrain; //!< The Terrain of the GameWorld. |
---|
| 114 | |
---|
| 115 | }; |
---|
| 116 | |
---|
| 117 | #endif /* _GAME_WORLD_H */ |
---|