Changeset 5887 in orxonox.OLD for branches/spaceshipcontrol/src
- Timestamp:
- Dec 3, 2005, 3:27:30 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/story_entities/world.cc
r5886 r5887 26 26 #include "null_parent.h" 27 27 #include "pilot_node.h" 28 #include "track_node.h"29 28 #include "world_entity.h" 30 29 #include "player.h" … … 40 39 #include "shell.h" 41 40 42 #include "track_manager.h"43 41 #include "garbage_collector.h" 44 42 #include "fast_factory.h" … … 63 61 #include "weapons/projectile.h" 64 62 #include "event_handler.h" 65 66 63 #include "sound_engine.h" 67 64 #include "ogg_player.h" … … 122 119 PRINTF(3)("World::~World() - deleting current world\n"); 123 120 121 delete this->localPlayer; 122 124 123 // here everything that is alocated by the World is deleted 125 124 delete this->entities; … … 130 129 FastFactory::flushAll(true); 131 130 delete LightManager::getInstance(); 132 delete TrackManager::getInstance();133 131 delete ParticleEngine::getInstance(); 134 132 delete AnimationPlayer::getInstance(); … … 172 170 this->shell = NULL; 173 171 this->entities = NULL; 172 this->localPlayer = NULL; 173 this->localCamera = NULL; 174 174 175 175 this->showPNodes = false; … … 336 336 LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams); 337 337 338 LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 339 LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 340 341 // find Track 342 element = root->FirstChildElement( "Track"); 343 if( element == NULL) 344 { 345 PRINTF(0)("World is missing a 'Track'\n"); 346 } 347 else 348 { 349 //load track 350 PRINTF(4)("Loading Track\n"); 351 352 TrackManager::getInstance()->loadParams( element); 353 TrackManager::getInstance()->finalize(); 354 } 338 // LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 339 // LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 355 340 356 341 // free the XML data … … 362 347 // Create a Player 363 348 this->localPlayer = new Player(); 349 364 350 Playable* playable; 365 351 list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); … … 368 354 playable = dynamic_cast<Playable*>(playableList->front()); 369 355 if (playable != NULL) 370 this->localPlayer->setControllable(playable);356 ;//this->localPlayer->setControllable(playable); 371 357 } 372 358 // bind input … … 385 371 386 372 387 // TrackManager::getInstance()->setBindSlave(env);388 PNode* tn = TrackManager::getInstance()->getTrackNode();389 tn->addChild(playable);390 391 373 // //localCamera->setParent(TrackNode::getInstance()); 392 374 // tn->addChild(this->localCamera); 393 localCamera->lookAt(tn);394 375 localCamera->setClipRegion(1, 1000.0); 395 376 // this->localPlayer->setParentMode(PNODE_ALL); 396 TrackManager::getInstance()->condition(1, LEFTRIGHT, this->localPlayer);397 398 377 if (sky != NULL) 399 378 { … … 406 385 glNewList (objectList, GL_COMPILE); 407 386 408 //TrackManager::getInstance()->drawGraph(.01);409 //TrackManager::getInstance()->debug(2);410 387 glEndList(); 411 388 … … 417 394 // STATIC // 418 395 //////////// 419 420 Gravity* test = new Gravity();421 422 // SYSTEM TRAILING THE PLAYER423 // Creating a Test Particle System424 425 //new PhysicsConnection(system, gravity);426 // new PhysicsConnection(this->localPlayer, gravity);427 396 428 397 // TestEntity* testEntity = new TestEntity(); … … 430 399 // testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 431 400 // this->spawn(testEntity); 432 433 // TestEntity* testEntity2 = new TestEntity();434 // testEntity2->setAnim(STAND);435 // testEntity2->setRelCoor(Vector(2400.0, 10.0, -30.0));436 // testEntity2->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));437 // //testEntity2->setParent(this->localPlayer);438 // this->spawn(testEntity2);439 //440 // TestEntity* testEntity3 = new TestEntity();441 // testEntity3->setAnim(BOOM);442 // testEntity3->setRelCoor(Vector(2450.0, 10.0, -40.0));443 // testEntity3->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));444 // this->spawn(testEntity3);445 //446 // TestEntity* testEntity4 = new TestEntity();447 // testEntity4->setAnim(FLIP);448 // testEntity4->setRelCoor(Vector(2500.0, 10.0, -22.0));449 // testEntity4->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));450 // this->spawn(testEntity4);451 //452 // TestEntity* testEntity5 = new TestEntity();453 // testEntity5->setAnim(WAVE);454 // testEntity5->setRelCoor(Vector(2420.0, 10.0, -50.0));455 // testEntity5->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));456 // this->spawn(testEntity5);457 //458 // TestEntity* testEntity6 = new TestEntity();459 // testEntity6->setAnim(WAVE);460 // testEntity6->setRelCoor(Vector(2420.0, 10.0, -20.0));461 // testEntity6->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));462 // this->spawn(testEntity6);463 //464 // TestEntity* testEntity7 = new TestEntity();465 // testEntity7->setAnim(WAVE);466 // testEntity7->setRelCoor(Vector(2500.0, 10.0, -50.0));467 // testEntity7->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));468 // this->spawn(testEntity7);469 470 471 472 // PhysicsEngine::getInstance()->debug();473 474 475 401 476 402 for(int i = 0; i < 100; i++) … … 482 408 tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30); 483 409 this->spawn(tmp); 484 485 486 410 } 487 488 489 490 // ClassList::debug();491 411 492 412 this->music = NULL;//(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL); … … 504 424 this->glmis->step(); 505 425 // stuff beyond this point remains to be loaded properly 506 507 // initializing the TrackManager508 TrackManager::getInstance()->addPointV(Vector(150, -35, 5));509 TrackManager::getInstance()->addPointV(Vector(200,-35, 5));510 TrackManager::getInstance()->addPointV(Vector(250, -35, 5));511 TrackManager::getInstance()->addPointV(Vector(320,-33,-.55));512 TrackManager::getInstance()->setDuration(1);513 TrackManager::getInstance()->setSavePoint();514 515 TrackManager::getInstance()->addPointV(Vector(410, 0, 0));516 TrackManager::getInstance()->addPointV(Vector(510, 20, -10));517 TrackManager::getInstance()->addPointV(Vector(550, 20, -10));518 TrackManager::getInstance()->addPointV(Vector(570, 20, -10));519 TrackManager::getInstance()->setDuration(2);520 521 TrackManager::getInstance()->forkS("testFork1,testFork2");522 TrackManager::getInstance()->workOnS("testFork1");523 TrackManager::getInstance()->addPointV(Vector(640, 25, -30));524 TrackManager::getInstance()->addPointV(Vector(700, 40, -120));525 TrackManager::getInstance()->addPointV(Vector(800, 50, -150));526 TrackManager::getInstance()->addPointV(Vector(900, 60, -100));527 TrackManager::getInstance()->addPointV(Vector(900, 60, -70));528 TrackManager::getInstance()->addPointV(Vector(990, 65, -15));529 TrackManager::getInstance()->addPointV(Vector(1050, 65, -10));530 TrackManager::getInstance()->addPointV(Vector(1100, 65, -20));531 TrackManager::getInstance()->setDuration(4);532 533 TrackManager::getInstance()->workOnS("testFork2");534 TrackManager::getInstance()->addPointV(Vector(640, 25, 20));535 TrackManager::getInstance()->addPointV(Vector(670, 50, 120));536 TrackManager::getInstance()->addPointV(Vector(700, 70, 80));537 TrackManager::getInstance()->addPointV(Vector(800, 70, 65));538 TrackManager::getInstance()->addPointV(Vector(850, 65, 65));539 TrackManager::getInstance()->addPointV(Vector(920, 35, 40));540 TrackManager::getInstance()->addPointV(Vector(945, 40, 40));541 TrackManager::getInstance()->addPointV(Vector(970, 24, 40));542 TrackManager::getInstance()->addPointV(Vector(1000, 40, -7));543 544 TrackManager::getInstance()->setDuration(4);545 546 547 TrackManager::getInstance()->joinS("testFork1,testFork2");548 549 TrackManager::getInstance()->addPointV(Vector(1200, 60, -50));550 TrackManager::getInstance()->addPointV(Vector(1300, 50, -50));551 TrackManager::getInstance()->addPointV(Vector(1400, 40, -50));552 TrackManager::getInstance()->addPointV(Vector(1500, 40, -60));553 TrackManager::getInstance()->addPointV(Vector(1600, 35, -55));554 TrackManager::getInstance()->addPointV(Vector(1700, 45, -40));555 TrackManager::getInstance()->addPointV(Vector(1750, 60, -40));556 TrackManager::getInstance()->addPointV(Vector(1770, 80, -40));557 TrackManager::getInstance()->addPointV(Vector(1800, 100, -40));558 TrackManager::getInstance()->setDuration(10);559 560 TrackManager::getInstance()->finalize();561 562 426 563 427 // LIGHT initialisation … … 577 441 { 578 442 LightManager::getInstance()->getLight()->setAbsCoor(-5.0, 10.0, -40.0); 579 580 581 // this->localPlayer = new Player ();582 // this->localPlayer->setName ("player");583 // this->spawn (this->localPlayer);584 // this->localPlayer->setRelCoor(Vector(5,0,0));585 443 /*monitor progress*/ 586 444 this->glmis->step(); 587 588 589 EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);590 EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);591 EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);592 593 /*594 Field* testField = new Gravity();595 testField->setMagnitude(10);596 new PhysicsConnection(this->localPlayer, testField);597 */598 445 599 446 // bind camera … … 620 467 this->glmis->step(); 621 468 622 // this->pilotNode = new PilotNode();623 // this->spawn(this->pilotNode);624 // this->pilotNode->setAbsCoor(Vector(150, -35, 5));625 // this->pilotNode->addChild(this->localPlayer);626 // this->pilotNode->addChild(this->localCamera);627 // this->localCamera->lookAt(this->localPlayer);628 629 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_UP);630 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_DOWN);631 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_LEFT);632 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_RIGHT);633 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);634 635 /*636 PNode* tn = TrackManager::getInstance()->getTrackNode();637 tn->addChild(this->localPlayer);638 this->localCamera->lookAt(tn);639 640 tn->addChild(this->localCamera);641 this->localPlayer->setParentMode(PNODE_ALL);642 TrackManager::getInstance()->condition(2, LEFTRIGHT, this->localPlayer);643 */644 469 this->glmis->step(); 645 470 break; … … 844 669 void World::handleInput () 845 670 { 846 // localinput847 //CommandNode* cn = Orxonox::getInstance()->getLocalInput();848 //cn->process();849 850 671 EventHandler::getInstance()->process(); 851 672 … … 899 720 900 721 /* update tick the rest */ 901 TrackManager::getInstance()->tick(this->dtS);902 722 this->localCamera->tick(this->dtS); 903 723 // tick the engines -
branches/spaceshipcontrol/src/story_entities/world.h
r5429 r5887 16 16 class Camera; 17 17 class Player; 18 class PNode;19 18 class GLMenuImageScreen; 20 19 class Terrain;
Note: See TracChangeset
for help on using the changeset viewer.