Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/scriptchanges.new/src/story_entities/game_world.h @ 10370

Last change on this file since 10370 was 10314, checked in by patrick, 18 years ago

merged branche mount_point to trunk. this will add mount point abilities, bsp transparency fix and some other smaller stuff to this trunk

File size: 3.8 KB
Line 
1/*!
2 * @file game_world.h
3 *  container for all game worlds (singleplayers, multiplayers..)
4 */
5
6#ifndef _GAME_WORLD_H
7#define _GAME_WORLD_H
8
9
10#include "story_entity.h"
11#include "game_world_data.h"
12#include "playable.h"
13#include "script_manager.h"
14
15namespace OrxShell { class Shell; };
16class WorldEntity;
17class GameRules;
18
19
20/** How many frames time values to keep
21 * The higher the value the smoother the result is...
22 * Don't make it 0 or less :)
23 */
24#define TICK_SMOOTH_VALUE 10
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 GameWorld : public StoryEntity
32{
33  ObjectListDeclaration(GameWorld);
34
35public:
36  GameWorld ();
37  virtual ~GameWorld ();
38
39  virtual void loadParams(const TiXmlElement* root);
40
41  /* functions from story-entity */
42  virtual ErrorMessage init();
43  virtual ErrorMessage loadData();
44  virtual ErrorMessage unloadData();
45
46  virtual bool start();
47  virtual bool stop();
48  virtual bool pause();
49  virtual bool resume();
50  virtual void run();
51
52  void setPlaymode(Playable::Playmode playmode);
53  void setPlaymode(const std::string& playmode);
54  /**  this returns the current game time @returns elapsed game time     */
55  inline double getGameTime() { return this->gameTime; }
56  /** sets the game speed @param speed speed of the Game */
57  inline void setSpeed(float speed) { this->speed = speed; };
58  /**  returns the track path of this world @returns the track path */
59
60
61  void setSoundtrack(const std::string& soundTrack);
62  void togglePNodeVisibility();
63  void toggleBVVisibility(int level);
64  inline void toggleMPVisibility() { this->showMPV = !this->showMPV; }
65
66  inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
67
68
69protected:
70  /* world - running functions */
71  virtual void synchronize();
72  virtual void handleInput();
73  virtual void tick(ObjectManager::EntityList worldEntity, float dt);
74  virtual void tick();
75  virtual void update();
76  virtual void checkGameRules();
77  virtual void collisionDetection();
78  virtual void collisionReaction();
79
80  void applyCameraSettings();
81  void drawEntityList(const ObjectManager::EntityList& drawList ) const;
82  virtual void renderPassReflection();
83  virtual void renderPassRefraction();
84  virtual void renderPassAll();
85
86
87  virtual void display();
88
89
90private:
91  void displayLoadScreen();
92  void releaseLoadScreen();
93
94
95protected:
96  GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
97  TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
98
99  bool                showPNodes;                   //!< if the PNodes should be visible.
100  bool                showBV;                       //!< if the Bounding Volumes should be visible.
101  int                 showBVLevel;                  //!< the depth level of the displayed bounding volumes
102  bool                showMPV;                      //!< true if the mounting points should be drawn for debug purposes
103
104  /* world timing */
105  double              lastFrame;                    //!< last time of frame (in MiliSeconds)
106  Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
107  float               dtS;                          //!< The time needed for caluculations in seconds
108  float               speed;                        //!< how fast the game flows
109  double              gameTime;                     //!< this is where the game time is saved
110  double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
111
112  GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
113
114private:
115  /* external modules interfaces */
116  ScriptManager       scriptManager;
117  OrxShell::Shell*    shell;
118};
119
120#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.