| [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; }; | 
|---|
 | 79 |  | 
|---|
| [3461] | 80 |  private: | 
|---|
| [4978] | 81 |   void constuctorInit(const char* name, int worldID); | 
|---|
| [3462] | 82 |   /* function for main-loop */ | 
|---|
| [3225] | 83 |   void mainLoop (); | 
|---|
 | 84 |   void synchronize (); | 
|---|
| [3226] | 85 |   void handleInput (); | 
|---|
| [3551] | 86 |   void tick (); | 
|---|
 | 87 |   void update (); | 
|---|
| [3459] | 88 |   void collide (); | 
|---|
| [3461] | 89 |   void draw (); | 
|---|
| [3225] | 90 |   void display (); | 
|---|
 | 91 |   void debug (); | 
|---|
| [3365] | 92 |  | 
|---|
| [5389] | 93 |   private: | 
|---|
 | 94 |     bool   showPNodes;                  //!< if the PNodes should be visible. | 
|---|
 | 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. | 
|---|
 | 121 |     PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse | 
|---|
 | 122 |  | 
|---|
 | 123 |  | 
|---|
| [2190] | 124 | }; | 
|---|
| [1883] | 125 |  | 
|---|
| [3224] | 126 | #endif /* _WORLD_H */ | 
|---|