| [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 GLMenuImageScreen; | 
|---|
 | 19 | class Terrain; | 
|---|
| [3646] | 20 | class GarbageCollector; | 
|---|
| [3790] | 21 | class Text; | 
|---|
| [4261] | 22 | class TiXmlElement; | 
|---|
| [3790] | 23 |  | 
|---|
| [5206] | 24 | class Shell; | 
|---|
| [4961] | 25 | class OggPlayer; | 
|---|
| [3620] | 26 |  | 
|---|
| [3449] | 27 | //! The game world | 
|---|
 | 28 | /** | 
|---|
 | 29 |    this class initializes everything that should be displayed inside of the current level. | 
|---|
 | 30 |    it is the main driving factor during gameplay. | 
|---|
 | 31 | */ | 
|---|
| [2636] | 32 | class World : public StoryEntity { | 
|---|
| [1853] | 33 |  | 
|---|
 | 34 |  public: | 
|---|
| [4978] | 35 |   World (const char* name); | 
|---|
| [2636] | 36 |   World (int worldID); | 
|---|
| [4261] | 37 |   World (const TiXmlElement* root = NULL); | 
|---|
| [3221] | 38 |   virtual ~World (); | 
|---|
| [3459] | 39 |  | 
|---|
| [4261] | 40 |   void loadParams(const TiXmlElement* root); | 
|---|
 | 41 |  | 
|---|
| [3646] | 42 |   double getGameTime(); | 
|---|
| [3459] | 43 |  | 
|---|
 | 44 |   /* classes from story-entity */ | 
|---|
| [3629] | 45 |   virtual ErrorMessage preLoad(); | 
|---|
| [3459] | 46 |   virtual ErrorMessage load (); | 
|---|
| [3225] | 47 |   virtual ErrorMessage init (); | 
|---|
 | 48 |   virtual ErrorMessage start (); | 
|---|
 | 49 |   virtual ErrorMessage stop (); | 
|---|
 | 50 |   virtual ErrorMessage pause (); | 
|---|
 | 51 |   virtual ErrorMessage resume (); | 
|---|
| [3459] | 52 |   virtual ErrorMessage destroy (); | 
|---|
| [1917] | 53 |  | 
|---|
| [4010] | 54 |   void loadDebugWorld(int worldID); | 
|---|
 | 55 |  | 
|---|
| [3459] | 56 |   virtual void displayLoadScreen(); | 
|---|
 | 57 |   virtual void releaseLoadScreen(); | 
|---|
| [4558] | 58 |  | 
|---|
| [3461] | 59 |   /* command node functions */ | 
|---|
| [3225] | 60 |   bool command (Command* cmd); | 
|---|
| [3459] | 61 |  | 
|---|
| [3620] | 62 |   tList<WorldEntity>* getEntities(); | 
|---|
 | 63 |  | 
|---|
| [3461] | 64 |   /* interface to world */ | 
|---|
| [3225] | 65 |   void spawn (WorldEntity* entity); | 
|---|
| [3365] | 66 |   void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); | 
|---|
| [4765] | 67 |   void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir); | 
|---|
| [2644] | 68 |  | 
|---|
| [5205] | 69 |   /** @param speed sets the speed of the Game */ | 
|---|
 | 70 |   inline void setSpeed(float speed) { this->speed = speed; }; | 
|---|
| [4010] | 71 |   const char* getPath(); | 
|---|
 | 72 |   void setPath( const char* name); | 
|---|
| [3461] | 73 |  | 
|---|
| [5389] | 74 |   inline Camera* getLocalCamera() { return this->localCamera; }; | 
|---|
| [4338] | 75 |  | 
|---|
| [5389] | 76 |   void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; }; | 
|---|
| [5429] | 77 |   void toggleBVVisibility() { this->showBV = !this->showBV; }; | 
|---|
| [5389] | 78 |  | 
|---|
| [3461] | 79 |  private: | 
|---|
| [4978] | 80 |   void constuctorInit(const char* name, int worldID); | 
|---|
| [3462] | 81 |   /* function for main-loop */ | 
|---|
| [3225] | 82 |   void mainLoop (); | 
|---|
 | 83 |   void synchronize (); | 
|---|
| [3226] | 84 |   void handleInput (); | 
|---|
| [3551] | 85 |   void tick (); | 
|---|
 | 86 |   void update (); | 
|---|
| [3459] | 87 |   void collide (); | 
|---|
| [3461] | 88 |   void draw (); | 
|---|
| [3225] | 89 |   void display (); | 
|---|
 | 90 |   void debug (); | 
|---|
| [3365] | 91 |  | 
|---|
| [5389] | 92 |   private: | 
|---|
 | 93 |     bool   showPNodes;                  //!< if the PNodes should be visible. | 
|---|
| [5429] | 94 |     bool   showBV;                      //!< if the Bounding Volumes should be visible. | 
|---|
| [5389] | 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 |     bool bQuitOrxonox;                  //!< quit this application | 
|---|
 | 102 |     bool bQuitCurrentGame;              //!< quit only the current game and return to menu | 
|---|
 | 103 |     bool bPause;                        //!< pause mode | 
|---|
 | 104 |  | 
|---|
 | 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 | 
|---|
 | 119 |     tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. | 
|---|
 | 120 |     Player* localPlayer;                //!< The Player, you fly through the level. | 
|---|
| [2190] | 121 | }; | 
|---|
| [1883] | 122 |  | 
|---|
| [3224] | 123 | #endif /* _WORLD_H */ | 
|---|