- Timestamp:
- Dec 3, 2005, 4:11:35 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/story_entities/world.cc
r5891 r5892 119 119 PRINTF(3)("World::~World() - deleting current world\n"); 120 120 121 delete this->localPlayer;122 121 123 122 // here everything that is alocated by the World is deleted … … 125 124 State::setWorldEntityList(NULL); 126 125 126 delete this->localPlayer; 127 127 128 128 // delete all the initialized Engines. … … 140 140 // erease everything that is left. 141 141 delete NullParent::getInstance(); 142 142 143 Shader::suspendShader(); 143 144 … … 242 243 } 243 244 244 TiXmlDocument* XMLDoc = new TiXmlDocument( path);245 TiXmlDocument* XMLDoc = new TiXmlDocument( getPath()); 245 246 // load the campaign document 246 247 if( !XMLDoc->LoadFile()) 247 248 { 248 249 // 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()); 250 251 delete XMLDoc; 251 252 return (ErrorMessage){213,"XML File parsing error","World::load()"}; … … 313 314 while( element != NULL) 314 315 { 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 317 324 // if we load a 'Player' we use it as localPlayer 318 325 326 319 327 //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); 321 330 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 322 331 { 323 terrain = (Terrain*) created;332 terrain = dynamic_cast<Terrain*>(created); 324 333 CDEngine::getInstance()->setTerrain(terrain); 325 334 } … … 336 345 LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams); 337 346 338 // 339 // 347 // LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 348 // LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 340 349 341 350 // free the XML data … … 354 363 playable = dynamic_cast<Playable*>(playableList->front()); 355 364 if (playable != NULL) 356 ;//this->localPlayer->setControllable(playable);365 this->localPlayer->setControllable(playable); 357 366 } 358 // bind input359 360 367 361 368 // bind camera 362 369 playable->addChild (this->localCamera); 363 370 364 365 371 // //localCamera->setParent(TrackNode::getInstance()); 366 372 // tn->addChild(this->localCamera); 367 localCamera->setClipRegion(1, 1000.0); 373 localCamera->setClipRegion(1, 10000.0); 374 localCamera->lookAt(playable); 368 375 // this->localPlayer->setParentMode(PNODE_ALL); 369 376 if (sky != NULL) … … 386 393 // STATIC // 387 394 //////////// 395 388 396 389 397 // TestEntity* testEntity = new TestEntity(); … … 486 494 { 487 495 this->bPause = false; 488 this->pilotNode = NULL;489 496 490 497 /* 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 21 21 class Text; 22 22 class TiXmlElement; 23 class PilotNode;24 23 25 24 class Shell; … … 120 119 tList<WorldEntity>* entities; //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. 121 120 Player* localPlayer; //!< The Player, you fly through the level. 122 PilotNode* pilotNode; //!< THe pilot node to fly with the mouse123 124 125 121 }; 126 122
Note: See TracChangeset
for help on using the changeset viewer.