Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/story_entities/world.h @ 6303

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

orxonox/trunk: merge the ObjectManager to the trunk
merged with command:
svn merge -r6082:HEAD objectmanager/ ../trunk/

conflicts resolution was easy this time :)
but specially merged the world to network_world

File size: 3.8 KB
Line 
1/*!
2 * @file world.h
3  *  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#include "object_manager.h"
14
15
16class WorldEntity;
17class Camera;
18class Player;
19class GLMenuImageScreen;
20class Terrain;
21class TiXmlElement;
22
23class Shell;
24class OggPlayer;
25
26//! The game world
27/**
28   this class initializes everything that should be displayed inside of the current level.
29   it is the main driving factor during gameplay.
30*/
31class World : public StoryEntity {
32
33 public:
34  World (const char* name);
35  World (int worldID);
36  World (const TiXmlElement* root = NULL);
37  virtual ~World ();
38
39  void loadParams(const TiXmlElement* root);
40
41  double getGameTime();
42
43  /* classes from story-entity */
44  virtual ErrorMessage preLoad();
45  virtual ErrorMessage load ();
46  virtual ErrorMessage init ();
47  virtual ErrorMessage start ();
48  virtual ErrorMessage stop ();
49  virtual ErrorMessage pause ();
50  virtual ErrorMessage resume ();
51  virtual ErrorMessage destroy ();
52
53  void loadDebugWorld(int worldID);
54
55  virtual void displayLoadScreen();
56  virtual void releaseLoadScreen();
57
58  /* command node functions */
59  bool command (Command* cmd);
60
61  /* interface to world */
62  void spawn (WorldEntity* entity);
63  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
64  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
65
66  /** @param speed sets the speed of the Game */
67  inline void setSpeed(float speed) { this->speed = speed; };
68  const char* getPath();
69  void setPath( const char* name);
70
71  inline Camera* getLocalCamera() { return this->localCamera; };
72
73  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
74  void toggleBVVisibility() { this->showBV = !this->showBV; };
75
76 private:
77  void constuctorInit(const char* name, int worldID);
78  /* function for main-loop */
79  void mainLoop ();
80  void synchronize ();
81  void handleInput ();
82  void tick (std::list<WorldEntity*> worldEntity, float dt);
83  void tick ();
84  void update ();
85  void collide ();
86  void draw ();
87  void display ();
88  void debug ();
89
90  private:
91    bool   showPNodes;                  //!< if the PNodes should be visible.
92    bool   showBV;                      //!< if the Bounding Volumes should be visible.
93    Uint32 lastFrame;                   //!< last time of frame
94    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
95    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
96    float dtS;                          //!< The time needed for caluculations in seconds
97    float speed;                        //!< how fast the game flows
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
102
103    ObjectManager      objectManager;   //!< The ObjectManager of this World.
104
105    GLMenuImageScreen* glmis;           //!< The Level-Loader Display
106
107    int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
108    char* path;                         //!< The file from which this world is loaded
109
110    Shell*     shell;
111    OggPlayer* music;
112
113  // IMPORTANT WORLD-ENTITIES
114    Camera* localCamera;                //!< The current Camera
115    WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
116    Terrain* terrain;                   //!< The Terrain of the World.
117
118    GLuint objectList;                  //!< temporary: @todo this will be ereased soon
119
120    Player* localPlayer;                //!< The Player, you fly through the level.
121};
122
123#endif /* _WORLD_H */
Note: See TracBrowser for help on using the repository browser.