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