[2190] | 1 | /*! |
---|
| 2 | \file world.h |
---|
| 3 | \brief Holds and manages all game data |
---|
| 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 TrackManager; |
---|
| 17 | class Camera; |
---|
| 18 | class PNode; |
---|
| 19 | class GLMenuImageScreen; |
---|
| 20 | class LightManager; |
---|
[4178] | 21 | class ParticleEngine; |
---|
[3634] | 22 | class Terrain; |
---|
[3646] | 23 | class GarbageCollector; |
---|
[3790] | 24 | class Text; |
---|
[4283] | 25 | class TiXmlElement; |
---|
[4332] | 26 | class PilotNode; |
---|
[3790] | 27 | |
---|
[3620] | 28 | //! The game world Interface |
---|
| 29 | /** |
---|
| 30 | this is a singleton interface, that enables world_entities to access the |
---|
| 31 | world. for those objects, there is no easier way than over this interface! |
---|
| 32 | */ |
---|
| 33 | class WorldInterface : BaseObject { |
---|
| 34 | |
---|
| 35 | public: |
---|
| 36 | ~WorldInterface(); |
---|
| 37 | static WorldInterface* getInstance(); |
---|
| 38 | void init(World* world); |
---|
[4190] | 39 | inline World* getCurrentWorld(void) {return this->worldReference;} |
---|
[3620] | 40 | tList<WorldEntity>* getEntityList(); |
---|
| 41 | |
---|
| 42 | private: |
---|
| 43 | WorldInterface(); |
---|
| 44 | static WorldInterface* singletonRef; //!< singleton reference to this object |
---|
| 45 | bool worldIsInitialized; //!< true if the world has been initialized |
---|
| 46 | World* worldReference; //!< this is a reference to the running world |
---|
| 47 | |
---|
| 48 | }; |
---|
| 49 | |
---|
[3449] | 50 | //! The game world |
---|
| 51 | /** |
---|
| 52 | this class initializes everything that should be displayed inside of the current level. |
---|
| 53 | it is the main driving factor during gameplay. |
---|
| 54 | */ |
---|
[2636] | 55 | class World : public StoryEntity { |
---|
[1853] | 56 | |
---|
| 57 | public: |
---|
[2636] | 58 | World (char* name); |
---|
| 59 | World (int worldID); |
---|
[4283] | 60 | World (const TiXmlElement* root = NULL); |
---|
[3221] | 61 | virtual ~World (); |
---|
[3459] | 62 | |
---|
[4283] | 63 | void loadParams(const TiXmlElement* root); |
---|
| 64 | |
---|
[3646] | 65 | double getGameTime(); |
---|
[3459] | 66 | |
---|
| 67 | /* classes from story-entity */ |
---|
[3629] | 68 | virtual ErrorMessage preLoad(); |
---|
[3459] | 69 | virtual ErrorMessage load (); |
---|
[3225] | 70 | virtual ErrorMessage init (); |
---|
| 71 | virtual ErrorMessage start (); |
---|
| 72 | virtual ErrorMessage stop (); |
---|
| 73 | virtual ErrorMessage pause (); |
---|
| 74 | virtual ErrorMessage resume (); |
---|
[3459] | 75 | virtual ErrorMessage destroy (); |
---|
[1917] | 76 | |
---|
[4178] | 77 | void loadDebugWorld(int worldID); |
---|
| 78 | |
---|
[3459] | 79 | virtual void displayLoadScreen(); |
---|
| 80 | virtual void releaseLoadScreen(); |
---|
[3461] | 81 | |
---|
| 82 | /* command node functions */ |
---|
[3225] | 83 | bool command (Command* cmd); |
---|
[3459] | 84 | |
---|
[3620] | 85 | tList<WorldEntity>* getEntities(); |
---|
| 86 | |
---|
[3461] | 87 | /* interface to world */ |
---|
[3225] | 88 | void spawn (WorldEntity* entity); |
---|
[3365] | 89 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
[3521] | 90 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, |
---|
[3565] | 91 | int parentingMode); |
---|
[2644] | 92 | |
---|
[4178] | 93 | const char* getPath(); |
---|
| 94 | void setPath( const char* name); |
---|
[3461] | 95 | |
---|
[4190] | 96 | inline Camera* getLocalCamera(void) {return this->localCamera;} |
---|
| 97 | |
---|
[3461] | 98 | private: |
---|
[4178] | 99 | void constuctorInit(char* name, int worldID); |
---|
[3526] | 100 | |
---|
[3727] | 101 | Uint32 lastFrame; //!< last time of frame |
---|
| 102 | Uint32 dt; //!< time needed to calculate this frame |
---|
[4178] | 103 | float dtS; //!< The time needed for caluculations in seconds |
---|
[3727] | 104 | double gameTime; //!< this is where the game time is saved |
---|
| 105 | bool bQuitOrxonox; //!< quit this application |
---|
| 106 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
| 107 | bool bPause; //!< pause mode |
---|
[1855] | 108 | |
---|
[3727] | 109 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
[3365] | 110 | |
---|
[3727] | 111 | char* worldName; //!< The name of this World |
---|
| 112 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
[4178] | 113 | char* path; //!< The file from which this world is loaded |
---|
[3462] | 114 | |
---|
[3727] | 115 | PNode* nullParent; //!< The zero-point, that everything has as its parent. |
---|
| 116 | TrackManager* trackManager; //!< The reference of the TrackManager that handles the course through the Level. |
---|
[4178] | 117 | ParticleEngine* particleEngine; //!< The ParticleEngine of the World. |
---|
[3727] | 118 | Camera* localCamera; //!< The current Camera |
---|
[4178] | 119 | WorldEntity* sky; //!< The Environmental Heaven of orxonox \todo insert this to environment insted |
---|
[3727] | 120 | LightManager* lightMan; //!< The Lights of the Level |
---|
| 121 | Terrain* terrain; //!< The Terrain of the World. |
---|
[2636] | 122 | |
---|
[3727] | 123 | GLuint objectList; //!< temporary: \todo this will be ereased soon |
---|
| 124 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
| 125 | WorldEntity* localPlayer; //!< The Player, you fly through the level. |
---|
[4332] | 126 | PilotNode* pilotNode; //!< THe pilot node to fly with the mouse |
---|
[3646] | 127 | |
---|
| 128 | GarbageCollector* garbageCollector; //!< reference to the garbage collector |
---|
[3727] | 129 | |
---|
[3462] | 130 | /* function for main-loop */ |
---|
[3225] | 131 | void mainLoop (); |
---|
| 132 | void synchronize (); |
---|
[3226] | 133 | void handleInput (); |
---|
[3551] | 134 | void tick (); |
---|
| 135 | void update (); |
---|
[3459] | 136 | void collide (); |
---|
[3461] | 137 | void draw (); |
---|
[3225] | 138 | void display (); |
---|
| 139 | void debug (); |
---|
[3365] | 140 | |
---|
[2190] | 141 | }; |
---|
[1883] | 142 | |
---|
[3224] | 143 | #endif /* _WORLD_H */ |
---|