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