Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3989 in orxonox.OLD for orxonox/branches/ll2trunktemp


Ignore:
Timestamp:
Apr 27, 2005, 1:21:26 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/ll2trunktemp: some more headers, now the level really gets loaded

Location:
orxonox/branches/ll2trunktemp/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/ll2trunktemp/src/game_loader.cc

    r3940 r3989  
    164164     can load everything it needs into memory then.
    165165  */
     166 
     167  if( name == NULL)
     168  {
     169                PRINTF0("No filename specified for loading");
     170                return NULL;
     171  }
     172 
     173        TiXmlDocument* XMLDoc = new TiXmlDocument( name);
     174        // load the campaign document
     175        if( !XMLDoc->LoadFile())
     176        {
     177                // report an error
     178                PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     179                delete XMLDoc;
     180                return NULL;
     181        }
     182       
     183        // check basic validity
     184        TiXmlElement* root = XMLDoc->RootElement();
     185        assert( root != NULL);
     186       
     187        if( strcmp( root->Value(), "Campaign"))
     188        {
     189                // report an error
     190                PRINTF0("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
     191                delete XMLDoc;
     192                return NULL;
     193        }
     194       
     195        // construct campaign
     196        Campaign* c = new Campaign( root);
     197       
     198        // free the XML data
     199        delete XMLDoc;
     200       
     201        return c;
    166202}
    167203
  • orxonox/branches/ll2trunktemp/src/orxonox.cc

    r3940 r3989  
    200200 
    201201  this->gameLoader = GameLoader::getInstance();
    202   this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0);
     202  this->gameLoader->loadCampaign("../data/worlds/DefaultCampaign.oxc");
     203  //  this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0);
    203204  this->gameLoader->init();
    204205  this->gameLoader->start();
  • orxonox/branches/ll2trunktemp/src/story_entities/campaign.cc

    r3832 r3989  
    1919#include "campaign.h"
    2020
     21#include "game_loader.h"
    2122#include "story_entity.h"
    2223
     
    3435  this->isInit = false;
    3536}
    36 
     37Campaign::Campaign ( TiXmlElement* root)
     38{
     39        TiXmlElement* element;
     40        const char* string;
     41        int id;
     42       
     43        PRINTF0("Loading Campaign...\n");
     44       
     45        assert( root != NULL);
     46        GameLoader* loader = GameLoader::getInstance();
     47       
     48  this->entities = new tList<StoryEntity>();
     49  this->isInit = false;
     50 
     51  // grab all the necessary parameters
     52        string = grabParameter( root, "identifier");
     53        if( string == NULL || sscanf(string, "%d", &id) != 1)
     54        {
     55                PRINTF0("Campaign is missing a proper 'identifier'\n");
     56                this->setStoryID( -1);
     57        }
     58        else this->setStoryID( id);
     59 
     60  // find WorldList
     61  element = root->FirstChildElement( "WorldList");
     62  if( element == NULL)
     63  {
     64                PRINTF0("Campaign is missing a proper 'WorldList'\n");
     65  }
     66  else
     67        element = element->FirstChildElement();
     68 
     69  // load Worlds/Subcampaigns/Whatever
     70  StoryEntity* lastCreated = NULL;
     71        while( element != NULL)
     72        {
     73                StoryEntity* created = (StoryEntity*) loader->fabricate( element);
     74                if( lastCreated != NULL) created->setNextStoryID( lastCreated->getStoryID());
     75                if( created != NULL)
     76                {
     77                        this->addEntity( created);     
     78                        lastCreated = created;
     79                }
     80                element = element->NextSiblingElement();
     81        }
     82        if( lastCreated != NULL)        lastCreated->setStoryID( WORLD_ID_GAMEEND);
     83}
    3784
    3885Campaign::~Campaign () {}
  • orxonox/branches/ll2trunktemp/src/story_entities/campaign.h

    r3608 r3989  
    1414 public:
    1515  Campaign ();
     16  Campaign ( TiXmlElement* root);
    1617  virtual ~Campaign ();
    1718
  • orxonox/branches/ll2trunktemp/src/story_entities/world.cc

    r3940 r3989  
    118118World::World( TiXmlElement* root)
    119119{
     120  this->constuctorInit("", -1);
     121
    120122        const char *string;
    121123        char *name;
     
    148150       
    149151  this->localPlayer = NULL;
    150   this->entities = new tList<WorldEntity>();
    151        
    152 
    153   this->setClassName ("World");
     152
    154153}
    155154
     
    161160World::World (char* name)
    162161{
    163   this->init(name, -1);
     162  this->constuctorInit(name, -1);
    164163  //NullParent* np = NullParent::getInstance();
    165164}
     
    171170World::World (int worldID)
    172171{
    173   this->init(NULL, worldID);
     172  this->constuctorInit(NULL, worldID);
    174173}
    175174
     
    216215   NO LEVEL LOADING HERE - NEVER!
    217216*/
    218 void World::init(char* name, int worldID)
     217void World::constuctorInit(char* name, int worldID)
    219218{
    220219  this->setClassName ("World");
     
    225224  this->debugWorldNr = worldID;
    226225  this->entities = new tList<WorldEntity>();
    227   AnimationPlayer::getInstance(); // initializes the animationPlayer
    228226}
    229227
     
    241239  wi->init(this);
    242240  this->garbageCollector = GarbageCollector::getInstance();
     241  AnimationPlayer::getInstance(); // initializes the animationPlayer
     242
     243  this->nullParent = NullParent::getInstance();
    243244}
    244245
     
    376377 
    377378      // initializing the TrackManager
    378       trackManager = TrackManager::getInstance();
     379  this->trackManager = TrackManager::getInstance();
    379380      //trackManager->addPoint(Vector(0,0,0));
    380381      trackManager->addPoint(Vector(150, -35, 5));
     
    838839     
    839840      /* update tick the rest */
    840       this->trackManager->tick(this->dt);
    841       this->localCamera->tick(this->dt);
     841      //      this->trackManager->tick(this->dt);
     842      //      this->localCamera->tick(this->dt);
    842843      this->garbageCollector->tick(seconds);
    843844
  • orxonox/branches/ll2trunktemp/src/story_entities/world.h

    r3940 r3989  
    9090
    9191 private:
    92   void init(char* name, int worldID);
     92  void constuctorInit(char* name, int worldID);
    9393
    9494  Uint32 lastFrame;                   //!< last time of frame
  • orxonox/branches/ll2trunktemp/src/world_entities/player.cc

    r3940 r3989  
    225225  //this->activeWeapon->tick(time);
    226226  //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
    227   this->weaponMan->tick(time);
     227  //  this->weaponMan->tick(time);
    228228  // player controlled movement
    229229  this->move(time);
Note: See TracChangeset for help on using the changeset viewer.