Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/story_entities/world.h @ 6068

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

orxonox/branches/avi_play: merged the Trunk back into the branche avi_play again

merged with command svn merge ../trunk/ avi_play/ -r5845:HEAD
no conflicts

File size: 3.9 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
14class World;
15class WorldEntity;
16class Camera;
17class Player;
18class GLMenuImageScreen;
19class Terrain;
20class GarbageCollector;
21class Text;
22class TiXmlElement;
23
24class Shell;
25class OggPlayer;
26
27//! The game world
28/**
29   this class initializes everything that should be displayed inside of the current level.
30   it is the main driving factor during gameplay.
31*/
32class World : public StoryEntity {
33
34 public:
35  World (const char* name);
36  World (int worldID);
37  World (const TiXmlElement* root = NULL);
38  virtual ~World ();
39
40  void loadParams(const TiXmlElement* root);
41
42  double getGameTime();
43
44  /* classes from story-entity */
45  virtual ErrorMessage preLoad();
46  virtual ErrorMessage load ();
47  virtual ErrorMessage init ();
48  virtual ErrorMessage start ();
49  virtual ErrorMessage stop ();
50  virtual ErrorMessage pause ();
51  virtual ErrorMessage resume ();
52  virtual ErrorMessage destroy ();
53
54  void loadDebugWorld(int worldID);
55
56  virtual void displayLoadScreen();
57  virtual void releaseLoadScreen();
58
59  /* command node functions */
60  bool command (Command* cmd);
61
62  tList<WorldEntity>* getEntities();
63
64  /* interface to world */
65  void spawn (WorldEntity* entity);
66  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
67  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
68
69  /** @param speed sets the speed of the Game */
70  inline void setSpeed(float speed) { this->speed = speed; };
71  const char* getPath();
72  void setPath( const char* name);
73
74  inline Camera* getLocalCamera() { return this->localCamera; };
75
76  void togglePNodeVisibility() { this->showPNodes = !this->showPNodes; };
77  void toggleBVVisibility() { this->showBV = !this->showBV; };
78
79 private:
80  void constuctorInit(const char* name, int worldID);
81  /* function for main-loop */
82  void mainLoop ();
83  void synchronize ();
84  void handleInput ();
85  void tick ();
86  void update ();
87  void collide ();
88  void draw ();
89  void display ();
90  void debug ();
91
92  private:
93    bool   showPNodes;                  //!< if the PNodes should be visible.
94    bool   showBV;                      //!< if the Bounding Volumes should be visible.
95    Uint32 lastFrame;                   //!< last time of frame
96    Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
97    Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
98    float dtS;                          //!< The time needed for caluculations in seconds
99    float speed;                        //!< how fast the game flows
100    double gameTime;                    //!< this is where the game time is saved
101    bool bQuitOrxonox;                  //!< quit this application
102    bool bQuitCurrentGame;              //!< quit only the current game and return to menu
103    bool bPause;                        //!< pause mode
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    tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
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.