Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2005, 10:39:01 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: merged trunk into branche using: svn merge ../trunk/ md2_loader -r 4063:HEAD

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  
    4141  int id;
    4242 
    43   PRINTF0("Loading Campaign...\n");
     43  PRINTF(3)("Loading Campaign...\n");
    4444 
    4545  assert( root != NULL);
     
    5353  if( string == NULL || sscanf(string, "%d", &id) != 1)
    5454    {
    55       PRINTF0("Campaign is missing a proper 'identifier'\n");
     55      PRINTF(2)("Campaign is missing a proper 'identifier'\n");
    5656      this->setStoryID( -1);
    5757    }
     
    6262  if( element == NULL)
    6363    {
    64       PRINTF0("Campaign is missing a proper 'WorldList'\n");
     64      PRINTF(2)("Campaign is missing a proper 'WorldList'\n");
    6565    }
    6666  else
  • orxonox/branches/md2_loader/src/story_entities/world.cc

    r4138 r4139  
    124124{
    125125  this->constuctorInit("", -1);
    126 
     126  this->path = NULL;
    127127  const char *string;
    128128  char *name;
     
    172172World::World (char* name)
    173173{
     174  this->path = NULL;
    174175  this->constuctorInit(name, -1);
    175176  //NullParent* np = NullParent::getInstance();
     
    182183World::World (int worldID)
    183184{
     185  this->path = NULL;
    184186  this->constuctorInit(NULL, worldID);
    185187}
     
    198200  cn->reset();
    199201
    200   //ResourceManager::getInstance()->debug();
    201202  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
    202   //ResourceManager::getInstance()->debug();
    203 
    204203  delete WorldInterface::getInstance();
    205 
    206204  delete this->nullParent;
    207205  delete this->entities;
     
    209207  delete this->trackManager;
    210208  TextEngine::getInstance()->flush();
    211 
    212   //AnimationPlayer::getInstance()->debug();
    213209  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);
    218211}
    219212
     
    271264ErrorMessage World::load()
    272265{       
    273   PRINTF0("> Loading world: '%s'\n", getPath());
    274  
     266  PRINTF(3)("> Loading world: '%s'\n", getPath());
     267  TiXmlElement* element;
    275268  GameLoader* loader = GameLoader::getInstance();
    276269 
    277270  if( getPath() == NULL)
    278271    {
    279       PRINTF0("World has no path specified for loading");
     272      PRINTF(1)("World has no path specified for loading");
    280273      return (ErrorMessage){213,"Path not specified","World::load()"};
    281274    }
     
    283276  TiXmlDocument* XMLDoc = new TiXmlDocument( path);
    284277  // load the campaign document
    285   if( !XMLDoc->LoadFile())
    286     //this->glmis->step();
    287  
     278  if( !XMLDoc->LoadFile()) 
    288279  {
    289280    // report an error
    290     PRINTF0("Error loading 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());
    291282    delete XMLDoc;
    292283    return (ErrorMessage){213,"XML File parsing error","World::load()"};
     
    300291    {
    301292      // report an error
    302       PRINTF0("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");
    303294      delete XMLDoc;
    304295      return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
     
    311302  if( string == NULL)
    312303    {
    313       PRINTF0("World is missing a proper 'name'\n");
     304      PRINTF(2)("World is missing a proper 'name'\n");
    314305      string = "Unknown";
    315306      temp = new char[strlen(string + 2)];
     
    323314      this->worldName = temp;
    324315    }
    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();
    327334  // find WorldEntities
    328   TiXmlElement* element = root->FirstChildElement( "WorldEntities");
     335  element = root->FirstChildElement("WorldEntities");
    329336 
    330337  if( element == NULL)
    331338    {
    332       PRINTF0("World is missing 'WorldEntities'\n");
     339      PRINTF(1)("World is missing 'WorldEntities'\n");
    333340    }
    334341  else
     
    336343      element = element->FirstChildElement();
    337344      // load Players/Objects/Whatever
    338       PRINTF0("Loading WorldEntities\n");
     345      PRINTF(4)("Loading WorldEntities\n");
    339346      while( element != NULL)
    340347        {
     
    346353          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created;
    347354          element = element->NextSiblingElement();
     355          glmis->step(); //! \todo temporary
    348356        }
    349       PRINTF0("Done loading WorldEntities\n");
     357      PRINTF(4)("Done loading WorldEntities\n");
    350358    }
    351359 
     
    458466  tn->addChild(this->localCamera);
    459467  localCamera->lookAt(tn);
     468  localCamera->setMode(PNODE_MOVEMENT);
    460469  this->localPlayer->setMode(PNODE_ALL);
    461470  Vector* cameraOffset = new Vector (0, 5, -10);
     
    472481  glEndList();
    473482
    474   terrain = new Terrain("../data/worlds/newGround.obj");
     483  terrain = new Terrain("worlds/newGround.obj");
    475484  terrain->setRelCoor(Vector(0,-10,0));
    476485  this->spawn(terrain);
     
    604613
    605614        // Create SkySphere
    606         sky = new Skysphere("../data/pictures/sky-replace.jpg");
     615        sky = new Skysphere("pictures/sky-replace.jpg");
    607616        this->localPlayer->addChild(this->sky);
    608617        this->spawn(this->sky);
     
    649658
    650659        // Create SkySphere
    651         this->sky = new Skysphere("../data/pictures/sky-replace.jpg");
     660        this->sky = new Skysphere("pictures/sky-replace.jpg");
    652661        this->sky->setName("SkySphere");
    653662        this->spawn(this->sky);
     
    838847 
    839848  //GLMenuImageScreen*
    840   this->glmis = GLMenuImageScreen::getInstance();
     849  this->glmis = new GLMenuImageScreen();
    841850  this->glmis->init();
    842851  this->glmis->setMaximum(8);
    843   this->glmis->draw();
     852  //  this->glmis->draw();
    844853 
    845854  PRINTF(3)("World::displayLoadScreen - end\n");
     
    855864  PRINTF(3)("World::releaseLoadScreen - start\n");
    856865  this->glmis->setValue(this->glmis->getMaximum());
    857   //SDL_Delay(500);
    858866  PRINTF(3)("World::releaseLoadScreen - end\n");
     867  delete this->glmis;
    859868}
    860869
     
    12421251bool World::command(Command* cmd)
    12431252{
    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);
    12501259
    12511260  return false;
     
    12541263void World::setPath( const char* name)
    12551264{
    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    }
    12581277}
    12591278
Note: See TracChangeset for help on using the changeset viewer.