Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5887 in orxonox.OLD for branches/spaceshipcontrol


Ignore:
Timestamp:
Dec 3, 2005, 3:27:30 PM (19 years ago)
Author:
bensch
Message:

orxonox/spaceship-controll: world transformation

Location:
branches/spaceshipcontrol/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/story_entities/world.cc

    r5886 r5887  
    2626#include "null_parent.h"
    2727#include "pilot_node.h"
    28 #include "track_node.h"
    2928#include "world_entity.h"
    3029#include "player.h"
     
    4039#include "shell.h"
    4140
    42 #include "track_manager.h"
    4341#include "garbage_collector.h"
    4442#include "fast_factory.h"
     
    6361#include "weapons/projectile.h"
    6462#include "event_handler.h"
    65 
    6663#include "sound_engine.h"
    6764#include "ogg_player.h"
     
    122119  PRINTF(3)("World::~World() - deleting current world\n");
    123120
     121  delete this->localPlayer;
     122
    124123  // here everything that is alocated by the World is deleted
    125124  delete this->entities;
     
    130129  FastFactory::flushAll(true);
    131130  delete LightManager::getInstance();
    132   delete TrackManager::getInstance();
    133131  delete ParticleEngine::getInstance();
    134132  delete AnimationPlayer::getInstance();
     
    172170  this->shell = NULL;
    173171  this->entities = NULL;
     172  this->localPlayer = NULL;
     173  this->localCamera = NULL;
    174174
    175175  this->showPNodes = false;
     
    336336    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
    337337
    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);
    355340
    356341  // free the XML data
     
    362347  // Create a Player
    363348  this->localPlayer = new Player();
     349
    364350  Playable* playable;
    365351  list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
     
    368354    playable = dynamic_cast<Playable*>(playableList->front());
    369355    if (playable != NULL)
    370       this->localPlayer->setControllable(playable);
     356      ;//this->localPlayer->setControllable(playable);
    371357  }
    372358  // bind input
     
    385371
    386372
    387   //        TrackManager::getInstance()->setBindSlave(env);
    388   PNode* tn = TrackManager::getInstance()->getTrackNode();
    389   tn->addChild(playable);
    390 
    391373//   //localCamera->setParent(TrackNode::getInstance());
    392374//  tn->addChild(this->localCamera);
    393   localCamera->lookAt(tn);
    394375  localCamera->setClipRegion(1, 1000.0);
    395376//  this->localPlayer->setParentMode(PNODE_ALL);
    396   TrackManager::getInstance()->condition(1, LEFTRIGHT, this->localPlayer);
    397 
    398377  if (sky != NULL)
    399378  {
     
    406385  glNewList (objectList, GL_COMPILE);
    407386
    408   //TrackManager::getInstance()->drawGraph(.01);
    409   //TrackManager::getInstance()->debug(2);
    410387  glEndList();
    411388
     
    417394  // STATIC //
    418395  ////////////
    419 
    420   Gravity* test = new Gravity();
    421 
    422   // SYSTEM TRAILING THE PLAYER
    423   // Creating a Test Particle System
    424 
    425   //new PhysicsConnection(system, gravity);
    426   //    new PhysicsConnection(this->localPlayer, gravity);
    427396
    428397//   TestEntity* testEntity = new TestEntity();
     
    430399//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    431400//   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 
    475401
    476402  for(int i = 0; i < 100; i++)
     
    482408    tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
    483409    this->spawn(tmp);
    484 
    485 
    486410  }
    487 
    488 
    489 
    490 //  ClassList::debug();
    491411
    492412  this->music = NULL;//(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
     
    504424  this->glmis->step();
    505425  // stuff beyond this point remains to be loaded properly
    506 
    507   // initializing the TrackManager
    508   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 
    562426
    563427  // LIGHT initialisation
     
    577441      {
    578442        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));
    585443        /*monitor progress*/
    586444        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         */
    598445
    599446        // bind camera
     
    620467        this->glmis->step();
    621468
    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         */
    644469        this->glmis->step();
    645470        break;
     
    844669void World::handleInput ()
    845670{
    846   // localinput
    847   //CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    848   //cn->process();
    849 
    850671  EventHandler::getInstance()->process();
    851672
     
    899720
    900721      /* update tick the rest */
    901       TrackManager::getInstance()->tick(this->dtS);
    902722      this->localCamera->tick(this->dtS);
    903723      // tick the engines
  • branches/spaceshipcontrol/src/story_entities/world.h

    r5429 r5887  
    1616class Camera;
    1717class Player;
    18 class PNode;
    1918class GLMenuImageScreen;
    2019class Terrain;
Note: See TracChangeset for help on using the changeset viewer.