[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 | |
---|
| 15 | class World; |
---|
| 16 | class WorldEntity; |
---|
[3634] | 17 | class TrackManager; |
---|
| 18 | class Camera; |
---|
| 19 | class PNode; |
---|
| 20 | class GLMenuImageScreen; |
---|
| 21 | class Skysphere; |
---|
[3803] | 22 | class SkyBox; |
---|
[3634] | 23 | class LightManager; |
---|
| 24 | class Terrain; |
---|
[3646] | 25 | class GarbageCollector; |
---|
[3790] | 26 | class Text; |
---|
| 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); |
---|
| 39 | tList<WorldEntity>* getEntityList(); |
---|
| 40 | |
---|
| 41 | private: |
---|
| 42 | WorldInterface(); |
---|
| 43 | static WorldInterface* singletonRef; //!< singleton reference to this object |
---|
| 44 | bool worldIsInitialized; //!< true if the world has been initialized |
---|
| 45 | World* worldReference; //!< this is a reference to the running world |
---|
| 46 | |
---|
| 47 | }; |
---|
| 48 | |
---|
[3449] | 49 | //! The game world |
---|
| 50 | /** |
---|
| 51 | this class initializes everything that should be displayed inside of the current level. |
---|
| 52 | it is the main driving factor during gameplay. |
---|
| 53 | */ |
---|
[2636] | 54 | class World : public StoryEntity { |
---|
[1853] | 55 | |
---|
| 56 | public: |
---|
[2636] | 57 | World (char* name); |
---|
| 58 | World (int worldID); |
---|
[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 | |
---|
[3459] | 73 | virtual void displayLoadScreen(); |
---|
| 74 | virtual void releaseLoadScreen(); |
---|
[3461] | 75 | |
---|
| 76 | /* command node functions */ |
---|
[3225] | 77 | bool command (Command* cmd); |
---|
[3459] | 78 | |
---|
[3620] | 79 | tList<WorldEntity>* getEntities(); |
---|
| 80 | |
---|
[3461] | 81 | /* interface to world */ |
---|
[3225] | 82 | void spawn (WorldEntity* entity); |
---|
[3365] | 83 | void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); |
---|
[3521] | 84 | void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, |
---|
[3565] | 85 | int parentingMode); |
---|
[2644] | 86 | |
---|
[3461] | 87 | |
---|
| 88 | private: |
---|
[3526] | 89 | void init(char* name, int worldID); |
---|
| 90 | |
---|
[3727] | 91 | Uint32 lastFrame; //!< last time of frame |
---|
| 92 | Uint32 dt; //!< time needed to calculate this frame |
---|
| 93 | double gameTime; //!< this is where the game time is saved |
---|
| 94 | bool bQuitOrxonox; //!< quit this application |
---|
| 95 | bool bQuitCurrentGame; //!< quit only the current game and return to menu |
---|
| 96 | bool bPause; //!< pause mode |
---|
[1855] | 97 | |
---|
[3727] | 98 | GLMenuImageScreen* glmis; //!< The Level-Loader Display |
---|
[3365] | 99 | |
---|
[3727] | 100 | char* worldName; //!< The name of this World |
---|
| 101 | int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong |
---|
[3462] | 102 | |
---|
[3727] | 103 | PNode* nullParent; //!< The zero-point, that everything has as its parent. |
---|
| 104 | TrackManager* trackManager; //!< The reference of the TrackManager that handles the course through the Level. |
---|
| 105 | Camera* localCamera; //!< The current Camera |
---|
| 106 | Skysphere* skySphere; //!< The Environmental Heaven of orxonox \todo insert this to environment insted |
---|
[3803] | 107 | SkyBox* skyBox; |
---|
[3727] | 108 | LightManager* lightMan; //!< The Lights of the Level |
---|
| 109 | Terrain* terrain; //!< The Terrain of the World. |
---|
[2636] | 110 | |
---|
[3727] | 111 | GLuint objectList; //!< temporary: \todo this will be ereased soon |
---|
| 112 | tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. |
---|
| 113 | WorldEntity* localPlayer; //!< The Player, you fly through the level. |
---|
[3646] | 114 | |
---|
| 115 | GarbageCollector* garbageCollector; //!< reference to the garbage collector |
---|
[3727] | 116 | |
---|
[3462] | 117 | /* function for main-loop */ |
---|
[3225] | 118 | void mainLoop (); |
---|
| 119 | void synchronize (); |
---|
[3226] | 120 | void handleInput (); |
---|
[3551] | 121 | void tick (); |
---|
| 122 | void update (); |
---|
[3459] | 123 | void collide (); |
---|
[3461] | 124 | void draw (); |
---|
[3225] | 125 | void display (); |
---|
| 126 | void debug (); |
---|
[3365] | 127 | |
---|
[2190] | 128 | }; |
---|
[1883] | 129 | |
---|
[3224] | 130 | #endif /* _WORLD_H */ |
---|