Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/story_entities/game_world.cc


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r9494 r9869  
    2020#include "game_world_data.h"
    2121
    22 #include "util/loading/resource_manager.h"
    2322#include "state.h"
    24 #include "class_list.h"
    2523
    2624#include "util/loading/game_loader.h"
     
    3937
    4038#include "util/loading/factory.h"
    41 #include "util/loading/load_param.h"
    42 #include "fast_factory.h"
     39#include "util/loading/load_param_xml.h"
     40#include "loading/fast_factory.h"
    4341#include "shell_command.h"
    4442
    4543#include "graphics_engine.h"
    46 #include "effects/atmospheric_engine.h"
     44#include "weather_effects/atmospheric_engine.h"
    4745#include "event_handler.h"
    4846#include "sound_engine.h"
     
    5048#include "network_manager.h"
    5149#include "physics_engine.h"
    52 #include "fields.h"
    5350
    5451#include "glmenu_imagescreen.h"
     
    6360
    6461#include "script_class.h"
    65 CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD,
    66                         addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))
    67                         ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack))
     62ObjectListDefinition(GameWorld);
     63CREATE_SCRIPTABLE_CLASS(GameWorld,
     64                        addMethod("setPlaymode", Executor1<GameWorld, lua_State*,const std::string&>(&GameWorld::setPlaymode))
     65                        ->addMethod("setSoundtrack", Executor1<GameWorld, lua_State*, const std::string&>(&GameWorld::setSoundtrack))
    6866                       );
    6967
     
    7775
    7876
    79 
    8077GameWorld::GameWorld()
    8178    : StoryEntity()
    8279{
    83   this->setClassID(CL_GAME_WORLD, "GameWorld");
     80  this->registerObject(this, GameWorld::_objectList);
    8481  this->setName("Preloaded World - no name yet");
    8582
     
    154151
    155152
    156   PRINTF(0)("Loading the GameWorld\n");
     153  PRINTF(4)("Loading the GameWorld\n");
    157154
    158155  PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str());
     
    339336  }
    340337
    341   PRINTF(0)("GameWorld::mainLoop() - Exiting the main loop\n");
     338  PRINTF(4)("GameWorld::mainLoop() - Exiting the main loop\n");
    342339}
    343340
     
    416413    if (currentFrame - this->lastFrame < .01)
    417414    {
    418       SDL_Delay(1000.0 * (0.01 - (currentFrame - lastFrame)));
     415      SDL_Delay((int)(1000.0 * (0.01 - (currentFrame - lastFrame))));
    419416      currentFrame = Timer::getNow();
    420417    }
     
    432429    // TICK everything
    433430    for (i = 0; i < this->dataTank->tickLists.size(); ++i)
    434       this->tick(this->dataTank->objectManager->getObjectList(this->dataTank->tickLists[i]), this->dtS);
     431      this->tick(this->dataTank->objectManager->getEntityList(this->dataTank->tickLists[i]), this->dtS);
    435432
    436433    /* update tick the rest */
     
    471468{
    472469  // object-object collision detection
    473   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
    474       this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
    475   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    476       this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
    477   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    478       this->dataTank->objectManager->getObjectList(OM_GROUP_00));
    479 
    480   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    481       this->dataTank->objectManager->getObjectList(OM_GROUP_02));
    482   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_02),
    483       this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
    484 
    485 
    486   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
    487       this->dataTank->objectManager->getObjectList(OM_COMMON));
    488   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    489       this->dataTank->objectManager->getObjectList(OM_COMMON));
     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));
     476
     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));
     481
     482
     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));
    490487
    491488  // ground collision detection: BSP Model
    492   CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_00));
    493   CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_01));
     489  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_00));
     490  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_01));
    494491}
    495492
     
    567564  //  glLoadIdentity();
    568565
    569   const std::list<BaseObject*>* reflectedWaters;
    570566  MappedWater* mw;
    571567
    572   if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
    573   {
    574     std::list<BaseObject*>::const_iterator it;
    575     for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
    576     {
    577       mw =  dynamic_cast<MappedWater*>(*it);
    578 
    579       //camera and light
    580       //this->dataTank->localCamera->apply ();
    581       //this->dataTank->localCamera->project ();
    582 
    583       LightManager::getInstance()->draw();
    584 
    585 
    586       // prepare for reflection rendering
    587       mw->activateReflection();
    588 
    589       // draw everything to be included in the reflection
    590       this->drawEntityList(State::getObjectManager()->getReflectionList());
    591       //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    592       //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    593 
    594       // clean up from reflection rendering
    595       mw->deactivateReflection();
    596     }
     568  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
     569       it != MappedWater::objectList().end();
     570       ++it)
     571  {
     572    mw =  (*it);
     573
     574    //camera and light
     575    //this->dataTank->localCamera->apply ();
     576    //this->dataTank->localCamera->project ();
     577
     578    LightManager::getInstance()->draw();
     579
     580
     581    // prepare for reflection rendering
     582    mw->activateReflection();
     583
     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]));
     588
     589    // clean up from reflection rendering
     590    mw->deactivateReflection();
    597591  }
    598592
     
    609603  //glLoadIdentity();
    610604
    611   const std::list<BaseObject*>* reflectedWaters;
    612605  MappedWater* mw;
    613606
    614   if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL)
    615   {
    616     std::list<BaseObject*>::const_iterator it;
    617     for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++)
    618     {
    619       mw =  dynamic_cast<MappedWater*>(*it);
    620 
    621       //camera and light
    622       //this->dataTank->localCamera->apply ();
    623       //this->dataTank->localCamera->project ();
    624       // prepare for reflection rendering
    625       mw->activateRefraction();
    626 
    627 
    628       LightManager::getInstance()->draw();
    629       // draw everything to be included in the reflection
    630       this->drawEntityList(State::getObjectManager()->getReflectionList());
    631       //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    632       //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    633 
    634       // clean up from reflection rendering
    635       mw->deactivateRefraction();
    636     }
     607  for (ObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin();
     608       it != MappedWater::objectList().end();
     609       ++it)
     610  {
     611    mw =  dynamic_cast<MappedWater*>(*it);
     612
     613    //camera and light
     614    //this->dataTank->localCamera->apply ();
     615    //this->dataTank->localCamera->project ();
     616    // prepare for reflection rendering
     617    mw->activateRefraction();
     618
     619
     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]));
     625
     626    // clean up from reflection rendering
     627    mw->deactivateRefraction();
    637628  }
    638629}
     
    659650  {
    660651    /* Draw the BackGround */
    661     this->drawEntityList(State::getObjectManager()->getObjectList(OM_BACKGROUND));
     652    this->drawEntityList(State::getObjectManager()->getEntityList(OM_BACKGROUND));
    662653    engine->drawBackgroundElements();
    663654
    664655    /* draw all WorldEntiy groups */
    665656    for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    666       this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     657      this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]));
    667658
    668659    AtmosphericEngine::getInstance()->draw();
     
    672663      CDEngine* engine = CDEngine::getInstance();
    673664      for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    674         engine->drawBV(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]), this->showBVLevel);
     665        engine->drawBV(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]), this->showBVLevel);
    675666    }
    676667
     
    702693 *  removes the loadscreen, and changes over to the game
    703694 */
    704 void GameWorld::releaseLoadScreen ()
     695void GameWorld::releaseLoadScreen()
    705696{
    706697  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
Note: See TracChangeset for help on using the changeset viewer.