Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/story_entities/game_world.cc @ 9723

Last change on this file since 9723 was 9723, checked in by bensch, 18 years ago

orxonox/trunk: safer smart-pointer

File size: 18.3 KB
RevLine 
[6352]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer: Christian Meyer
14   co-programmer: Benjamin Grauer
15*/
16
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
18
[6358]19#include "game_world.h"
[6402]20#include "game_world_data.h"
[6352]21
[7287]22#include "util/loading/resource_manager.h"
[6352]23#include "state.h"
24
[7193]25#include "util/loading/game_loader.h"
[7919]26#include "util/timer.h"
[6404]27
[6352]28#include "player.h"
29#include "camera.h"
30#include "environment.h"
31#include "terrain.h"
[7287]32#include "test_entity.h"
33#include "terrain.h"
[6404]34#include "playable.h"
[7785]35#include "environments/mapped_water.h"
[6404]36
[6352]37#include "light.h"
[6404]38
[7193]39#include "util/loading/factory.h"
[7368]40#include "util/loading/load_param.h"
[9709]41#include "loading/fast_factory.h"
[6404]42#include "shell_command.h"
[6352]43
44#include "graphics_engine.h"
[7810]45#include "effects/atmospheric_engine.h"
[6404]46#include "event_handler.h"
47#include "sound_engine.h"
48#include "cd_engine.h"
49#include "network_manager.h"
[6352]50#include "physics_engine.h"
[7287]51#include "fields.h"
[6352]52
53#include "glmenu_imagescreen.h"
[6404]54#include "shell.h"
[6352]55
56#include "ogg_player.h"
[6404]57#include "shader.h"
[6352]58
[7369]59#include "animation_player.h"
60
[7035]61#include "game_rules.h"
[6352]62
[9110]63#include "script_class.h"
[9715]64ObjectListDefinition(GameWorld);
[9709]65CREATE_SCRIPTABLE_CLASS(GameWorld, GameWorld::classID(),
[9110]66                        addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))
[9235]67                        ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack))
[9110]68                       );
[6352]69
[7412]70SHELL_COMMAND(speed, GameWorld, setSpeed) ->describe("set the Speed of the Level");
71SHELL_COMMAND(playmode, GameWorld, setPlaymode)
[7723]72->describe("Set the Playmode of the current Level")
73->completionPlugin(0, OrxShell::CompletorStringArray(Playable::playmodeNames, Playable::PlaymodeCount));
[7412]74
[7739]75SHELL_COMMAND(togglePNodeVisibility, GameWorld, togglePNodeVisibility);
76SHELL_COMMAND(showBVLevel, GameWorld, toggleBVVisibility);
[6352]77
78
[6989]79GameWorld::GameWorld()
[6402]80    : StoryEntity()
[6352]81{
[9709]82  this->registerObject(this, GameWorld::_objectList);
[6368]83  this->setName("Preloaded World - no name yet");
84
85  this->gameTime = 0.0f;
[6370]86  this->setSpeed(1.0f);
[6368]87  this->shell = NULL;
88
89  this->showPNodes = false;
90  this->showBV = false;
[7739]91  this->showBVLevel = 3;
[6368]92
[6845]93  this->dataXML = NULL;
[7391]94  this->gameRules = NULL;
[6352]95}
96
97/**
[6358]98 *  remove the GameWorld from memory
[6352]99 *
100 *  delete everything explicitly, that isn't contained in the parenting tree!
101 *  things contained in the tree are deleted automaticaly
102 */
[6358]103GameWorld::~GameWorld ()
[6352]104{
[6408]105  PRINTF(4)("Deleted GameWorld\n");
[7283]106
[6352]107}
108
109
110
111/**
[6358]112 * loads the parameters of a GameWorld from an XML-element
[6352]113 * @param root the XML-element to load from
114 */
[6358]115void GameWorld::loadParams(const TiXmlElement* root)
[6352]116{
[6512]117  StoryEntity::loadParams(root);
[6352]118
[6376]119  PRINTF(4)("Loaded GameWorld specific stuff\n");
[6352]120}
121
[6368]122
[6352]123/**
124 * this is executed just before load
125 *
126 * since the load function sometimes needs data, that has been initialized
127 * before the load and after the proceeding storyentity has finished
128*/
[6370]129ErrorMessage GameWorld::init()
[6352]130{
131  /* init the world interface */
[7374]132  this->shell = new OrxShell::Shell();
[6352]133
[6498]134  State::setCurrentStoryEntity(dynamic_cast<StoryEntity*>(this));
[6407]135  this->dataTank->init();
[7369]136
137  /* initialize some engines and graphical elements */
138  AnimationPlayer::getInstance();
139  PhysicsEngine::getInstance();
[8190]140  CREngine::getInstance();
[8408]141
142  State::setScriptManager(&this->scriptManager);
143
[8717]144  return ErrorMessage();
[6352]145}
146
147/**
[6358]148 *  loads the GameWorld by initializing all resources, and set their default values.
[6352]149 */
[6372]150ErrorMessage GameWorld::loadData()
[6352]151{
[8408]152  this->displayLoadScreen();  State::setScriptManager(&this->scriptManager);
[6370]153
[8408]154
[6407]155  PRINTF(0)("Loading the GameWorld\n");
156
[7677]157  PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str());
[9235]158  //  TiXmlElement* element;
159  //  GameLoader* loader = GameLoader::getInstance();
[6352]160
[7221]161  if( getLoadFile().empty())
[6402]162  {
[6634]163    PRINTF(1)("GameWorld has no path specified for loading\n");
[8717]164    return (ErrorMessage(213,"Path not specified","GameWorld::load()"));
[6402]165  }
[6352]166
[7287]167  TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile());
[6402]168  // load the xml world file for further loading
[7287]169  if( !XMLDoc->LoadFile())
[6352]170  {
[7287]171    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile().c_str(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
172    delete XMLDoc;
[8717]173    return ErrorMessage(213,"XML File parsing error","GameWorld::load()");
[6352]174  }
175  // check basic validity
[7287]176  TiXmlElement* root = XMLDoc->RootElement();
[6352]177  assert( root != NULL);
178  if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
179  {
[6402]180    // report an error
181    PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
[7287]182    delete XMLDoc;
[8717]183    return ErrorMessage(213,"Path not a WorldDataFile","GameWorld::load()");
[6352]184  }
[6402]185  /* the whole loading process for the GameWorld */
[6407]186  this->dataTank->loadData(root);
[6845]187  this->dataXML = (TiXmlElement*)root->Clone();
[6352]188
[8408]189  //remove this after finished testing !!!!
[8711]190  //Object* obj= new Object();
191  //obj->setName("Obj");
192  //Account* a = new Account();
193  //a->setName("a");
194  //Account *b = new Account(30);
195  //b->setName("b");
[8717]196
[8740]197
[8271]198  LoadParamXML(root, "ScriptManager", &this->scriptManager, ScriptManager, loadParams);
199
[7287]200  delete XMLDoc;
[6386]201  this->releaseLoadScreen();
[8717]202
203  return ErrorMessage();
[6352]204}
205
206
207/**
[6387]208 *  unload the data of this GameWorld
209 */
210ErrorMessage GameWorld::unloadData()
211{
[8271]212
[7287]213  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
[8271]214  this->scriptManager.flush();
215
[7370]216  delete this->shell;
[6387]217
[6981]218  this->dataTank->unloadData();
219
[7369]220  this->shell = NULL;
221  delete AnimationPlayer::getInstance();
222  delete PhysicsEngine::getInstance();
[8190]223  delete CREngine::getInstance();
[7369]224
[6988]225  State::setCurrentStoryEntity(NULL);
[6845]226  if (this->dataXML)
227    delete this->dataXML;
[8717]228
229  return ErrorMessage();
[6387]230}
231
232
[9235]233void GameWorld::setSoundtrack(const std::string& soundTrack)
234{
235  if (this->dataTank != NULL)
236  {
237    this->dataTank->setSoundTrack(soundTrack);
238    this->dataTank->music->play();
239  }
240}
241
242
[6387]243/**
[6358]244 *  starts the GameWorld
[6352]245 */
[6387]246bool GameWorld::start()
[6352]247{
[7283]248  this->bPaused = false;
249  this->bRunning = true;
[8408]250  State::setScriptManager(&this->scriptManager); //make sure we have the right script manager
[6387]251  this->run();
[8717]252
253  return true;
[6352]254}
255
[6402]256
[6352]257/**
258 *  stops the world.
[6402]259 */
[6387]260bool GameWorld::stop()
[6352]261{
[6358]262  PRINTF(3)("GameWorld::stop() - got stop signal\n");
[8408]263  State::setScriptManager(NULL);
[8717]264  return (this->bRunning = false);
[6352]265}
266
[6402]267
[6352]268/**
[6402]269 *  pauses the game
270 */
[6387]271bool GameWorld::pause()
[6352]272{
[8717]273  return (this->bPaused = true);
[6352]274}
275
[6402]276
[6352]277/**
278 *  ends the pause Phase
[6409]279 */
[6387]280bool GameWorld::resume()
[6352]281{
[8717]282  return(this->bPaused = false);
[6352]283}
284
285
286/**
[6402]287 *  main loop of the world: executing all world relevant function
288 *
289 * in this loop we synchronize (if networked), handle input events, give the heart-beat to
290 * all other member-entities of the world (tick to player, enemies etc.), checking for
291 * collisions drawing everything to the screen.
292 */
293void GameWorld::run()
[6352]294{
[6402]295  PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
[6352]296
[7131]297  // initialize Timing
298  this->cycle = 0;
299  for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++)
[7919]300    this->frameTimes[i] = 0.01f;
[7131]301  this->dtS = 0.0f;
[7919]302  this->lastFrame = Timer::getNow();
[7131]303
[7304]304  if (this->dataTank->music != NULL)
305    this->dataTank->music->play();
306
[7283]307  while( this->bRunning) /* @todo implement pause */
[6402]308  {
309    /* process intput */
310    this->handleInput ();
[7322]311    if( !this->bRunning)
312      break;
[6386]313
[6402]314    /* network synchronisation */
315    this->synchronize ();
316    /* process time */
317    this->tick ();
[8490]318
[8740]319
[8724]320    /* update the state */
[8740]321    //this->update (); /// LESS REDUNDANCY.
[9235]322    //      PNode::getNullParent()->updateNode(this->dtS);
[9061]323    PNode::getNullParent()->updateNode(this->dtS);
[8724]324
[8190]325    /* collision detection */
326    this->collisionDetection ();
327    /* collision reaction */
328    this->collisionReaction ();
[8490]329
[8724]330    /* check the game rules */
331    this->checkGameRules();
[8740]332
[6402]333    /* update the state */
334    this->update ();
335    /* draw everything */
336    this->display ();
[7306]337
[6402]338  }
339
[7330]340  PRINTF(0)("GameWorld::mainLoop() - Exiting the main loop\n");
[6352]341}
342
343
[7338]344void GameWorld::setPlaymode(Playable::Playmode playmode)
345{
346  if (this->dataTank->localPlayer &&
347      this->dataTank->localPlayer->getPlayable() &&
[7339]348      this->dataTank->localPlayer->getPlayable()->setPlaymode(playmode))
[7338]349  {
[9110]350    PRINTF(4)("Set Playmode to %d:%s\n", playmode, Playable::playmodeToString(playmode).c_str());
[7338]351  }
[7339]352  else
353  {
[9110]354    PRINTF(2)("Unable to set Playmode %d:'%s'\n", playmode, Playable::playmodeToString(playmode).c_str());
[7339]355  }
[7338]356}
357
[7339]358void GameWorld::setPlaymode(const std::string& playmode)
359{
360  this->setPlaymode(Playable::stringToPlaymode(playmode));
361}
[7338]362
[6352]363/**
364 *  synchronize local data with remote data
365*/
[6358]366void GameWorld::synchronize ()
[6402]367{}
[6352]368
369
370/**
371 *  run all input processing
372
373   the command node is the central input event dispatcher. the node uses the even-queue from
374   sdl and has its own event-passing-queue.
375*/
[6358]376void GameWorld::handleInput ()
[6352]377{
378  EventHandler::getInstance()->process();
379}
380
[6402]381
382/**
[7370]383 * @brief ticks a WorldEntity list
[6402]384 * @param entityList list of the WorldEntities
385 * @param dt time passed since last frame
386 */
[7370]387void GameWorld::tick(ObjectManager::EntityList entityList, float dt)
[6352]388{
[7370]389  ObjectManager::EntityList::iterator entity, next;
[6710]390  next = entityList.begin();
391  while (next != entityList.end())
392  {
393    entity = next++;
[6352]394    (*entity)->tick(dt);
[6710]395  }
[6352]396}
397
[7131]398
[6352]399/**
400 *  advance the timeline
[6402]401 *
402 * this calculates the time used to process one frame (with all input handling, drawing, etc)
403 * the time is mesured in ms and passed to all world-entities and other classes that need
404 * a heart-beat.
405 */
[6358]406void GameWorld::tick ()
[6352]407{
[7283]408  if( !this->bPaused)
[6402]409  {
[7131]410    // CALCULATE FRAMERATE
411    Uint32 frameTimesIndex;
412    Uint32 i;
[7919]413    double currentFrame = Timer::getNow();
[6402]414
[9494]415    if (currentFrame - this->lastFrame < .01)
416    {
[9723]417      SDL_Delay((int)1000.0 * (0.01 - (currentFrame - lastFrame)));
[9494]418      currentFrame = Timer::getNow();
419    }
420
421
[7131]422    frameTimesIndex = this->cycle % TICK_SMOOTH_VALUE;
[7919]423    this->frameTimes[frameTimesIndex] = currentFrame - this->lastFrame;
424    this->lastFrame = currentFrame;
[7132]425    ++this->cycle;
[7919]426    this->dtS = 0.0;
[7132]427    for (i = 0; i < TICK_SMOOTH_VALUE; i++)
[7131]428      this->dtS += this->frameTimes[i];
[7919]429    this->dtS = this->dtS / TICK_SMOOTH_VALUE * speed;
[6352]430
[7131]431    // TICK everything
[7370]432    for (i = 0; i < this->dataTank->tickLists.size(); ++i)
[9709]433      this->tick(this->dataTank->objectManager->getEntityList(this->dataTank->tickLists[i]), this->dtS);
[6352]434
[6402]435    /* update tick the rest */
[6407]436    this->dataTank->localCamera->tick(this->dtS);
[6402]437    AnimationPlayer::getInstance()->tick(this->dtS);
438    PhysicsEngine::getInstance()->tick(this->dtS);
[6352]439
[6402]440    GraphicsEngine::getInstance()->tick(this->dtS);
[7810]441    AtmosphericEngine::getInstance()->tick(this->dtS);
[7035]442
443    if( likely(this->dataTank->gameRule != NULL))
444      this->dataTank->gameRule->tick(this->dtS);
[8717]445
[6402]446  }
[6352]447}
448
449
450/**
451 *  this function gives the world a consistant state
[6402]452 *
453 * after ticking (updating the world state) this will give a constistant
454 * state to the whole system.
455 */
[6358]456void GameWorld::update()
[6352]457{
458  PNode::getNullParent()->updateNode (this->dtS);
[7460]459  OrxSound::SoundEngine::getInstance()->update();
[8740]460
461  this->applyCameraSettings();
[7871]462  GraphicsEngine::getInstance()->update(this->dtS);
[6352]463}
464
465
[6402]466/**
467 * kicks the CDEngine to detect the collisions between the object groups in the world
468 */
[8190]469void GameWorld::collisionDetection()
[6352]470{
[8490]471  // object-object collision detection
[9709]472  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00),
473      this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ));
474  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
475      this->dataTank->objectManager->getEntityList(OM_GROUP_00_PROJ));
476  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
477      this->dataTank->objectManager->getEntityList(OM_GROUP_00));
[6433]478
[9709]479  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
480      this->dataTank->objectManager->getEntityList(OM_GROUP_02));
481  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_02),
482      this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ));
[9235]483
484
[9709]485  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00),
486      this->dataTank->objectManager->getEntityList(OM_COMMON));
487  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01),
488      this->dataTank->objectManager->getEntityList(OM_COMMON));
[7083]489
[8490]490  // ground collision detection: BSP Model
[9709]491  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_00));
492  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_01));
[6352]493}
494
[7391]495
[8190]496void GameWorld::collisionReaction()
497{
498  CREngine::getInstance()->handleCollisions();
499}
500
501
[6352]502/**
[7391]503 *  check the game rules: winning conditions, etc.
504 *
505 */
506void GameWorld::checkGameRules()
507{
508  if( this->gameRules)
509    this->gameRules->tick(this->dtS);
510}
511
512
513/**
[6352]514 *  render the current frame
[6402]515 *
516 * clear all buffers and draw the world
517 */
[6358]518void GameWorld::display ()
[6352]519{
[9406]520
[9494]521  // if this server is a dedicated server the game workd does not need to be drawn
[9406]522  if( !GraphicsEngine::getInstance()->isDedicated())
523  {
[9494]524    // render the reflection texture
525    this->renderPassReflection();
526    // redner the refraction texture
527    this->renderPassRefraction();
[9406]528  }
[7785]529  // render all
530  this->renderPassAll();
531
[6352]532  // flip buffers
533  GraphicsEngine::swapBuffers();
534}
535
536
537/**
[7370]538 * @brief draws all entities in the list drawList
539 * @param drawList the List of entities to draw.
[6352]540 */
[7370]541void GameWorld::drawEntityList(const ObjectManager::EntityList& drawList) const
542{
543  ObjectManager::EntityList::const_iterator entity;
544  for (entity = drawList.begin(); entity != drawList.end(); entity++)
545    if ((*entity)->isVisible())
546      (*entity)->draw();
547}
548
[7785]549
[8740]550void GameWorld::applyCameraSettings()
551{
552  this->dataTank->localCamera->apply ();
553  this->dataTank->localCamera->project ();
554  GraphicsEngine::storeMatrices();
555}
[7785]556
[8740]557
558
[7370]559/**
[7785]560 * reflection rendering for water surfaces
[7370]561 */
[7785]562void GameWorld::renderPassReflection()
[6352]563{
[9235]564  // clear buffer
[7785]565  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[9235]566  //  glLoadIdentity();
[7785]567
568  MappedWater* mw;
569
[9715]570  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
[9709]571       it != MappedWater::objectList().end();
572       ++it)
[7785]573  {
[9709]574    mw =  (*it);
[7785]575
[9709]576    //camera and light
577    //this->dataTank->localCamera->apply ();
578    //this->dataTank->localCamera->project ();
[8312]579
[9709]580    LightManager::getInstance()->draw();
[8312]581
582
[9709]583    // prepare for reflection rendering
584    mw->activateReflection();
[8312]585
[9709]586    // draw everything to be included in the reflection
587    this->drawEntityList(State::getObjectManager()->getReflectionList());
588    //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
589    //         this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
[7785]590
[9709]591    // clean up from reflection rendering
592    mw->deactivateReflection();
[7785]593  }
594
595}
596
597
598/**
599 *  refraction rendering for water surfaces
600 */
601void GameWorld::renderPassRefraction()
[8037]602{
[9235]603  // clear buffer
[8037]604  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[8740]605  //glLoadIdentity();
[7785]606
[8037]607  MappedWater* mw;
608
[9715]609  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
[9709]610       it != MappedWater::objectList().end();
611       ++it)
[8037]612  {
[9709]613    mw =  dynamic_cast<MappedWater*>(*it);
[8037]614
[9709]615    //camera and light
616    //this->dataTank->localCamera->apply ();
617    //this->dataTank->localCamera->project ();
618    // prepare for reflection rendering
619    mw->activateRefraction();
[8037]620
[8312]621
[9709]622    LightManager::getInstance()->draw();
623    // draw everything to be included in the reflection
624    this->drawEntityList(State::getObjectManager()->getReflectionList());
625    //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
626    //         this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
[8037]627
[9709]628    // clean up from reflection rendering
629    mw->deactivateRefraction();
[8037]630  }
631}
632
633
[7785]634/**
635 *  this render pass renders the whole wolrd
636 */
637void GameWorld::renderPassAll()
638{
639  // clear buffer
640  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
[6352]641  GraphicsEngine* engine = GraphicsEngine::getInstance();
[6402]642
[7919]643
[8740]644  // glEnable(GL_DEPTH_TEST);
645  // glEnable(GL_LIGHTING);
[7919]646
[8740]647  // set Lighting
[7108]648  LightManager::getInstance()->draw();
[6416]649
[9406]650  // only render the world if its not dedicated mode
651  if( !GraphicsEngine::getInstance()->isDedicated())
652  {
653    /* Draw the BackGround */
[9709]654    this->drawEntityList(State::getObjectManager()->getEntityList(OM_BACKGROUND));
[9406]655    engine->drawBackgroundElements();
[7840]656
[9406]657    /* draw all WorldEntiy groups */
658    for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
[9709]659      this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
[6416]660
[9406]661    AtmosphericEngine::getInstance()->draw();
[8408]662
[9406]663    if( unlikely( this->showBV))
664    {
665      CDEngine* engine = CDEngine::getInstance();
666      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
[9709]667        engine->drawBV(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]), this->showBVLevel);
[9406]668    }
669
670    if( unlikely(this->showPNodes))
671      PNode::getNullParent()->debugDraw(0);
672
673    // draw the game ruls
674    if( likely(this->dataTank->gameRule != NULL))
675      this->dataTank->gameRule->draw();
[6402]676  }
[6416]677
[6780]678  engine->draw();
[6352]679}
680
[7785]681
[6352]682/**
[6402]683 *  shows the loading screen
684 */
685void GameWorld::displayLoadScreen ()
[6387]686{
[6402]687  PRINTF(3)("GameWorld::displayLoadScreen - start\n");
[6407]688  this->dataTank->glmis = new GLMenuImageScreen();
689  this->dataTank->glmis->setMaximum(8);
[6402]690  PRINTF(3)("GameWorld::displayLoadScreen - end\n");
[6387]691}
692
693
[6402]694/**
695 *  removes the loadscreen, and changes over to the game
696 */
697void GameWorld::releaseLoadScreen ()
[6387]698{
[6402]699  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
[6407]700  this->dataTank->glmis->setValue(this->dataTank->glmis->getMaximum());
[6402]701  PRINTF(3)("GameWorld::releaseLoadScreen - end\n");
[6387]702}
703
[7004]704
705
706/**
707 * @brief toggles the PNode visibility in the world (drawn as boxes)
708 */
709void GameWorld::togglePNodeVisibility()
710{
[7723]711  this->showPNodes = !this->showPNodes;
[7004]712};
713
714
715/**
716 * @brief toggles the bounding volume (BV) visibility
717*/
[7739]718void GameWorld::toggleBVVisibility(int level)
[7004]719{
[7739]720  if( level < 1)
721    this->showBV = false;
722  else
723  {
724    this->showBV = true;
725    this->showBVLevel = level;
726  }
727
[7004]728};
729
Note: See TracBrowser for help on using the repository browser.