Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/new_class_id: almost killed off the old ResourceManager

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