Changeset 9869 in orxonox.OLD for trunk/src/story_entities/game_world.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r9494 r9869 20 20 #include "game_world_data.h" 21 21 22 #include "util/loading/resource_manager.h"23 22 #include "state.h" 24 #include "class_list.h"25 23 26 24 #include "util/loading/game_loader.h" … … 39 37 40 38 #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" 43 41 #include "shell_command.h" 44 42 45 43 #include "graphics_engine.h" 46 #include " effects/atmospheric_engine.h"44 #include "weather_effects/atmospheric_engine.h" 47 45 #include "event_handler.h" 48 46 #include "sound_engine.h" … … 50 48 #include "network_manager.h" 51 49 #include "physics_engine.h" 52 #include "fields.h"53 50 54 51 #include "glmenu_imagescreen.h" … … 63 60 64 61 #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)) 62 ObjectListDefinition(GameWorld); 63 CREATE_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)) 68 66 ); 69 67 … … 77 75 78 76 79 80 77 GameWorld::GameWorld() 81 78 : StoryEntity() 82 79 { 83 this-> setClassID(CL_GAME_WORLD, "GameWorld");80 this->registerObject(this, GameWorld::_objectList); 84 81 this->setName("Preloaded World - no name yet"); 85 82 … … 154 151 155 152 156 PRINTF( 0)("Loading the GameWorld\n");153 PRINTF(4)("Loading the GameWorld\n"); 157 154 158 155 PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str()); … … 339 336 } 340 337 341 PRINTF( 0)("GameWorld::mainLoop() - Exiting the main loop\n");338 PRINTF(4)("GameWorld::mainLoop() - Exiting the main loop\n"); 342 339 } 343 340 … … 416 413 if (currentFrame - this->lastFrame < .01) 417 414 { 418 SDL_Delay( 1000.0 * (0.01 - (currentFrame - lastFrame)));415 SDL_Delay((int)(1000.0 * (0.01 - (currentFrame - lastFrame)))); 419 416 currentFrame = Timer::getNow(); 420 417 } … … 432 429 // TICK everything 433 430 for (i = 0; i < this->dataTank->tickLists.size(); ++i) 434 this->tick(this->dataTank->objectManager->get ObjectList(this->dataTank->tickLists[i]), this->dtS);431 this->tick(this->dataTank->objectManager->getEntityList(this->dataTank->tickLists[i]), this->dtS); 435 432 436 433 /* update tick the rest */ … … 471 468 { 472 469 // object-object collision detection 473 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),474 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));475 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),476 this->dataTank->objectManager->get ObjectList(OM_GROUP_00_PROJ));477 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),478 this->dataTank->objectManager->get ObjectList(OM_GROUP_00));479 480 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),481 this->dataTank->objectManager->get ObjectList(OM_GROUP_02));482 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_02),483 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));484 485 486 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),487 this->dataTank->objectManager->get ObjectList(OM_COMMON));488 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),489 this->dataTank->objectManager->get ObjectList(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)); 490 487 491 488 // ground collision detection: BSP Model 492 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_GROUP_00));493 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(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)); 494 491 } 495 492 … … 567 564 // glLoadIdentity(); 568 565 569 const std::list<BaseObject*>* reflectedWaters;570 566 MappedWater* mw; 571 567 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(); 597 591 } 598 592 … … 609 603 //glLoadIdentity(); 610 604 611 const std::list<BaseObject*>* reflectedWaters;612 605 MappedWater* mw; 613 606 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(); 637 628 } 638 629 } … … 659 650 { 660 651 /* Draw the BackGround */ 661 this->drawEntityList(State::getObjectManager()->get ObjectList(OM_BACKGROUND));652 this->drawEntityList(State::getObjectManager()->getEntityList(OM_BACKGROUND)); 662 653 engine->drawBackgroundElements(); 663 654 664 655 /* draw all WorldEntiy groups */ 665 656 for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 666 this->drawEntityList(State::getObjectManager()->get ObjectList(this->dataTank->drawLists[i]));657 this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i])); 667 658 668 659 AtmosphericEngine::getInstance()->draw(); … … 672 663 CDEngine* engine = CDEngine::getInstance(); 673 664 for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 674 engine->drawBV(State::getObjectManager()->get ObjectList(this->dataTank->drawLists[i]), this->showBVLevel);665 engine->drawBV(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]), this->showBVLevel); 675 666 } 676 667 … … 702 693 * removes the loadscreen, and changes over to the game 703 694 */ 704 void GameWorld::releaseLoadScreen 695 void GameWorld::releaseLoadScreen() 705 696 { 706 697 PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
Note: See TracChangeset
for help on using the changeset viewer.