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