Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5892 in orxonox.OLD for branches/spaceshipcontrol/src


Ignore:
Timestamp:
Dec 3, 2005, 4:11:35 PM (19 years ago)
Author:
bensch
Message:

controll: some fixing in world

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

Legend:

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

    r5891 r5892  
    119119  PRINTF(3)("World::~World() - deleting current world\n");
    120120
    121   delete this->localPlayer;
    122121
    123122  // here everything that is alocated by the World is deleted
     
    125124  State::setWorldEntityList(NULL);
    126125
     126  delete this->localPlayer;
    127127
    128128  // delete all the initialized Engines.
     
    140140  // erease everything that is left.
    141141  delete NullParent::getInstance();
     142
    142143  Shader::suspendShader();
    143144
     
    242243    }
    243244
    244   TiXmlDocument* XMLDoc = new TiXmlDocument( path);
     245  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
    245246  // load the campaign document
    246247  if( !XMLDoc->LoadFile())
    247248  {
    248249    // report an error
    249     PRINTF(1)("loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     250    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    250251    delete XMLDoc;
    251252    return (ErrorMessage){213,"XML File parsing error","World::load()"};
     
    313314      while( element != NULL)
    314315        {
    315           WorldEntity* created = dynamic_cast<WorldEntity*>( loader->fabricate( element));
    316           if( created != NULL) this->spawn( created);
     316          BaseObject* created = (loader->fabricate(element));
     317          if( created != NULL )
     318          {
     319            if(created->isA(CL_WORLD_ENTITY))
     320              this->spawn(dynamic_cast<WorldEntity*>(created));
     321            printf("Created a %s: %s\n", created->getClassName(), created->getName());
     322          }
     323
    317324          // if we load a 'Player' we use it as localPlayer
    318325
     326
    319327          //todo do this more elegant
    320           if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created;
     328          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     329            sky = dynamic_cast<SkyBox*>(created);
    321330          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    322331          {
    323             terrain = (Terrain*) created;
     332            terrain = dynamic_cast<Terrain*>(created);
    324333            CDEngine::getInstance()->setTerrain(terrain);
    325334          }
     
    336345    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
    337346
    338 //    LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
    339 //    LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
     347//   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
     348//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    340349
    341350  // free the XML data
     
    354363    playable = dynamic_cast<Playable*>(playableList->front());
    355364    if (playable != NULL)
    356       ;//this->localPlayer->setControllable(playable);
     365      this->localPlayer->setControllable(playable);
    357366  }
    358   // bind input
    359 
    360367
    361368  // bind camera
    362369  playable->addChild (this->localCamera);
    363370
    364 
    365371//   //localCamera->setParent(TrackNode::getInstance());
    366372//  tn->addChild(this->localCamera);
    367   localCamera->setClipRegion(1, 1000.0);
     373  localCamera->setClipRegion(1, 10000.0);
     374  localCamera->lookAt(playable);
    368375//  this->localPlayer->setParentMode(PNODE_ALL);
    369376  if (sky != NULL)
     
    386393  // STATIC //
    387394  ////////////
     395
    388396
    389397//   TestEntity* testEntity = new TestEntity();
     
    486494{
    487495  this->bPause = false;
    488   this->pilotNode = NULL;
    489496
    490497  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
  • branches/spaceshipcontrol/src/story_entities/world.h

    r5887 r5892  
    2121class Text;
    2222class TiXmlElement;
    23 class PilotNode;
    2423
    2524class Shell;
     
    120119    tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
    121120    Player* localPlayer;                //!< The Player, you fly through the level.
    122     PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
    123 
    124 
    125121};
    126122
Note: See TracChangeset for help on using the changeset viewer.