Changeset 4139 in orxonox.OLD for orxonox/branches/md2_loader/src/story_entities
- Timestamp:
- May 10, 2005, 10:39:01 AM (20 years ago)
- Location:
- orxonox/branches/md2_loader/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/story_entities/campaign.cc
r4010 r4139 41 41 int id; 42 42 43 PRINTF 0("Loading Campaign...\n");43 PRINTF(3)("Loading Campaign...\n"); 44 44 45 45 assert( root != NULL); … … 53 53 if( string == NULL || sscanf(string, "%d", &id) != 1) 54 54 { 55 PRINTF 0("Campaign is missing a proper 'identifier'\n");55 PRINTF(2)("Campaign is missing a proper 'identifier'\n"); 56 56 this->setStoryID( -1); 57 57 } … … 62 62 if( element == NULL) 63 63 { 64 PRINTF 0("Campaign is missing a proper 'WorldList'\n");64 PRINTF(2)("Campaign is missing a proper 'WorldList'\n"); 65 65 } 66 66 else -
orxonox/branches/md2_loader/src/story_entities/world.cc
r4138 r4139 124 124 { 125 125 this->constuctorInit("", -1); 126 126 this->path = NULL; 127 127 const char *string; 128 128 char *name; … … 172 172 World::World (char* name) 173 173 { 174 this->path = NULL; 174 175 this->constuctorInit(name, -1); 175 176 //NullParent* np = NullParent::getInstance(); … … 182 183 World::World (int worldID) 183 184 { 185 this->path = NULL; 184 186 this->constuctorInit(NULL, worldID); 185 187 } … … 198 200 cn->reset(); 199 201 200 //ResourceManager::getInstance()->debug();201 202 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); 202 //ResourceManager::getInstance()->debug();203 204 203 delete WorldInterface::getInstance(); 205 206 204 delete this->nullParent; 207 205 delete this->entities; … … 209 207 delete this->trackManager; 210 208 TextEngine::getInstance()->flush(); 211 212 //AnimationPlayer::getInstance()->debug();213 209 delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence. 214 //delete garbagecollecor 215 //delete animator 216 217 210 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); 218 211 } 219 212 … … 271 264 ErrorMessage World::load() 272 265 { 273 PRINTF 0("> Loading world: '%s'\n", getPath());274 266 PRINTF(3)("> Loading world: '%s'\n", getPath()); 267 TiXmlElement* element; 275 268 GameLoader* loader = GameLoader::getInstance(); 276 269 277 270 if( getPath() == NULL) 278 271 { 279 PRINTF 0("World has no path specified for loading");272 PRINTF(1)("World has no path specified for loading"); 280 273 return (ErrorMessage){213,"Path not specified","World::load()"}; 281 274 } … … 283 276 TiXmlDocument* XMLDoc = new TiXmlDocument( path); 284 277 // load the campaign document 285 if( !XMLDoc->LoadFile()) 286 //this->glmis->step(); 287 278 if( !XMLDoc->LoadFile()) 288 279 { 289 280 // report an error 290 PRINTF 0("Errorloading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());281 PRINTF(1)("loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol()); 291 282 delete XMLDoc; 292 283 return (ErrorMessage){213,"XML File parsing error","World::load()"}; … … 300 291 { 301 292 // report an error 302 PRINTF 0("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");293 PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n"); 303 294 delete XMLDoc; 304 295 return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"}; … … 311 302 if( string == NULL) 312 303 { 313 PRINTF 0("World is missing a proper 'name'\n");304 PRINTF(2)("World is missing a proper 'name'\n"); 314 305 string = "Unknown"; 315 306 temp = new char[strlen(string + 2)]; … … 323 314 this->worldName = temp; 324 315 } 325 326 316 //////////////// 317 // LOADSCREEN // 318 //////////////// 319 element = root->FirstChildElement("LoadScreen"); 320 if (element == NULL) 321 { 322 PRINTF(2)("no LoadScreen specified, loading default\n"); 323 324 glmis->setBackgroundImage("pictures/load_screen.jpg"); 325 this->glmis->setMaximum(8); 326 this->glmis->draw(); 327 } 328 else 329 { 330 this->glmis->load(element); 331 this->glmis->draw(); 332 } 333 this->glmis->draw(); 327 334 // find WorldEntities 328 TiXmlElement* element = root->FirstChildElement("WorldEntities");335 element = root->FirstChildElement("WorldEntities"); 329 336 330 337 if( element == NULL) 331 338 { 332 PRINTF 0("World is missing 'WorldEntities'\n");339 PRINTF(1)("World is missing 'WorldEntities'\n"); 333 340 } 334 341 else … … 336 343 element = element->FirstChildElement(); 337 344 // load Players/Objects/Whatever 338 PRINTF 0("Loading WorldEntities\n");345 PRINTF(4)("Loading WorldEntities\n"); 339 346 while( element != NULL) 340 347 { … … 346 353 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created; 347 354 element = element->NextSiblingElement(); 355 glmis->step(); //! \todo temporary 348 356 } 349 PRINTF 0("Done loading WorldEntities\n");357 PRINTF(4)("Done loading WorldEntities\n"); 350 358 } 351 359 … … 458 466 tn->addChild(this->localCamera); 459 467 localCamera->lookAt(tn); 468 localCamera->setMode(PNODE_MOVEMENT); 460 469 this->localPlayer->setMode(PNODE_ALL); 461 470 Vector* cameraOffset = new Vector (0, 5, -10); … … 472 481 glEndList(); 473 482 474 terrain = new Terrain(" ../data/worlds/newGround.obj");483 terrain = new Terrain("worlds/newGround.obj"); 475 484 terrain->setRelCoor(Vector(0,-10,0)); 476 485 this->spawn(terrain); … … 604 613 605 614 // Create SkySphere 606 sky = new Skysphere(" ../data/pictures/sky-replace.jpg");615 sky = new Skysphere("pictures/sky-replace.jpg"); 607 616 this->localPlayer->addChild(this->sky); 608 617 this->spawn(this->sky); … … 649 658 650 659 // Create SkySphere 651 this->sky = new Skysphere(" ../data/pictures/sky-replace.jpg");660 this->sky = new Skysphere("pictures/sky-replace.jpg"); 652 661 this->sky->setName("SkySphere"); 653 662 this->spawn(this->sky); … … 838 847 839 848 //GLMenuImageScreen* 840 this->glmis = GLMenuImageScreen::getInstance();849 this->glmis = new GLMenuImageScreen(); 841 850 this->glmis->init(); 842 851 this->glmis->setMaximum(8); 843 this->glmis->draw();852 // this->glmis->draw(); 844 853 845 854 PRINTF(3)("World::displayLoadScreen - end\n"); … … 855 864 PRINTF(3)("World::releaseLoadScreen - start\n"); 856 865 this->glmis->setValue(this->glmis->getMaximum()); 857 //SDL_Delay(500);858 866 PRINTF(3)("World::releaseLoadScreen - end\n"); 867 delete this->glmis; 859 868 } 860 869 … … 1242 1251 bool World::command(Command* cmd) 1243 1252 { 1244 if( !strcmp( cmd->cmd, "view0")) this->localCamera->setViewMode(VIEW_NORMAL);1245 else if( !strcmp( cmd->cmd, "view1")) this->localCamera->setViewMode(VIEW_BEHIND);1246 else if( !strcmp( cmd->cmd, "view2")) this->localCamera->setViewMode(VIEW_FRONT);1247 else if( !strcmp( cmd->cmd, "view3")) this->localCamera->setViewMode(VIEW_LEFT);1248 else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);1249 else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);1253 if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW0)) this->localCamera->setViewMode(VIEW_NORMAL); 1254 else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW1)) this->localCamera->setViewMode(VIEW_BEHIND); 1255 else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW2)) this->localCamera->setViewMode(VIEW_FRONT); 1256 else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW3)) this->localCamera->setViewMode(VIEW_LEFT); 1257 else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW4)) this->localCamera->setViewMode(VIEW_RIGHT); 1258 else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW5)) this->localCamera->setViewMode(VIEW_TOP); 1250 1259 1251 1260 return false; … … 1254 1263 void World::setPath( const char* name) 1255 1264 { 1256 this->path = new char[strlen(name)+1]; 1257 strcpy(this->path, name); 1265 if (this->path) 1266 delete this->path; 1267 if (ResourceManager::isFile(name)) 1268 { 1269 this->path = new char[strlen(name)+1]; 1270 strcpy(this->path, name); 1271 } 1272 else 1273 { 1274 this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1]; 1275 sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name); 1276 } 1258 1277 } 1259 1278
Note: See TracChangeset
for help on using the changeset viewer.