Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/story_entities/world.h @ 4338

Last change on this file since 4338 was 4338, checked in by bensch, 19 years ago

orxonox/trunk: merged branches/physics back to the trunk
merged with command
svn merge -r 3866:HEAD . ../../trunk/
many conflict that i tried to resolv
@patrick: i hope i did not interfere with your stuff :/

File size: 4.5 KB
Line 
1/*!
2    \file world.h
3    \brief Holds and manages all game data
4*/ 
5
6#ifndef _WORLD_H
7#define _WORLD_H
8
9#include "stdincl.h"
10#include "comincl.h"
11#include "story_entity.h"
12#include "p_node.h"
13
14class World;
15class WorldEntity;
16class TrackManager;
17class Camera;
18class PNode;
19class GLMenuImageScreen;
20class LightManager;
21class ParticleEngine;
22class Terrain;
23class GarbageCollector;
24class Text;
25class TiXmlElement;
26class PilotNode;
27
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*/
33class WorldInterface : BaseObject {
34
35 public:
36  ~WorldInterface();
37  static WorldInterface* getInstance();
38  void init(World* world);
39  inline World* getCurrentWorld(void) {return this->worldReference;}
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
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*/
55class World : public StoryEntity {
56
57 public:
58  World (char* name);
59  World (int worldID);
60  World (const TiXmlElement* root = NULL);
61  virtual ~World ();
62
63  void loadParams(const TiXmlElement* root);
64
65  double getGameTime();
66
67  /* classes from story-entity */
68  virtual ErrorMessage preLoad();
69  virtual ErrorMessage load ();
70  virtual ErrorMessage init ();
71  virtual ErrorMessage start ();
72  virtual ErrorMessage stop ();
73  virtual ErrorMessage pause ();
74  virtual ErrorMessage resume ();
75  virtual ErrorMessage destroy ();
76
77  void loadDebugWorld(int worldID);
78
79  virtual void displayLoadScreen();
80  virtual void releaseLoadScreen();
81 
82  /* command node functions */
83  bool command (Command* cmd);
84
85  tList<WorldEntity>* getEntities();
86
87  /* interface to world */
88  void spawn (WorldEntity* entity);
89  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
90  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 
91             int parentingMode);
92
93  const char* getPath();
94  void setPath( const char* name);
95
96  inline Camera* getLocalCamera(void) {return this->localCamera;}
97
98 private:
99  void constuctorInit(char* name, int worldID);
100
101  Uint32 lastFrame;                   //!< last time of frame
102  Uint32 dt;                          //!< time needed to calculate this frame
103  float dtS;                          //!< The time needed for caluculations in seconds
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
108
109  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
110
111  char* worldName;                    //!< The name of this World
112  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
113  char* path;                         //!< The file from which this world is loaded
114
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.
117  ParticleEngine* particleEngine;     //!< The ParticleEngine of the World.
118  Camera* localCamera;                //!< The current Camera
119  WorldEntity* sky;                   //!< The Environmental Heaven of orxonox \todo insert this to environment insted
120  LightManager* lightMan;             //!< The Lights of the Level
121  Terrain* terrain;                   //!< The Terrain of the World.
122
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.
126  PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
127
128  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
129
130  /* function for main-loop */
131  void mainLoop ();
132  void synchronize ();
133  void handleInput ();
134  void tick ();
135  void update ();
136  void collide ();
137  void draw ();
138  void display ();
139  void debug ();
140
141};
142
143#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.