Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6407 in orxonox.OLD for branches/network/src/story_entities


Ignore:
Timestamp:
Jan 4, 2006, 3:40:30 PM (19 years ago)
Author:
patrick
Message:

network: the worlds get loaded again in the new framework

Location:
branches/network/src/story_entities
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/campaign.cc

    r6402 r6407  
    7777  this->isRunning = true;
    7878  this->run();
    79 
    80   PRINTF(2)("There is no StoryEnity left to play, quitting\n");
    8179}
    8280
     
    130128
    131129    this->currentEntity->init();
     130
    132131    this->currentEntity->loadData();
    133132    this->currentEntity->start();
    134133    this->currentEntity->unloadData();
    135134  }
     135  PRINTF(2)("There is no StoryEnity left to play, quitting\n");
    136136}
    137137
  • branches/network/src/story_entities/campaign_data.cc

    r6404 r6407  
    3333
    3434  this->currentEntity = NULL;
     35
    3536  this->loadParams(root);
    3637}
     
    4243CampaignData::~CampaignData()
    4344{
    44   PRINTF(3)("Deleting CampaignData\n");
     45  PRINTF(4)("Deleting CampaignData\n");
    4546  while( !this->storyEntities.empty())
    4647  {
    4748    StoryEntity* bo = this->storyEntities.back();
    4849    this->storyEntities.pop_back();
    49     PRINTF(3)("CampaignData is been deleted: nr %i\n", bo->getStoryID());
     50    PRINTF(4)("CampaignData is been deleted: nr %i\n", bo->getStoryID());
    5051    delete bo;
    5152  }
    5253}
    53 
    5454
    5555
     
    5858 * @param root: The XML-element to load from
    5959 */
    60 void CampaignData::loadData(const TiXmlElement* root)
     60void CampaignData::loadParams(const TiXmlElement* root)
    6161{
    62   LoadParamXML(root, "WorldList", this, CampaignData, loadParamsWorldList)
     62  LoadParamXML(root, "WorldList", this, CampaignData, loadData)
    6363      .describe("A List of Worlds to be loaded in this Campaign");
    6464}
     
    6969 * @param root: the XML-element to load from
    7070 */
    71 void CampaignData::loadParamsWorldList(const TiXmlElement* root)
     71void CampaignData::loadData(const TiXmlElement* root)
    7272{
    7373  if( root == NULL)
     
    7979    if( created != NULL)
    8080      this->addStoryEntity(created);
     81    PRINTF(4)("Created a new StoryEntity and added it to the Campaign: id=%i\n", created->getStoryID());
    8182  }
    8283  LOAD_PARAM_END_CYCLE(element);
  • branches/network/src/story_entities/campaign_data.h

    r6404 r6407  
    2121    virtual ~CampaignData();
    2222
     23    void loadParams(const TiXmlElement* root);
     24
    2325    void loadData(const TiXmlElement* root);
    2426
     
    2729    StoryEntity* getFirstLevel();
    2830    StoryEntity* getNextLevel();
    29 
    30 
    31   private:
    32     void loadParamsWorldList(const TiXmlElement* root);
    3331
    3432
  • branches/network/src/story_entities/game_world.cc

    r6404 r6407  
    9090  this->path = NULL;
    9191
    92   this->gameWorldData = new GameWorldData();
     92  //this->dataTank = new GameWorldData();
    9393}
    9494
     
    101101GameWorld::~GameWorld ()
    102102{
    103   if( this->gameWorldData)
    104     delete this->gameWorldData;
     103  if( this->dataTank)
     104    delete this->dataTank;
    105105
    106106  PRINTF(0)("Deleted GameWorld\n");
     
    136136  this->shell = new Shell();
    137137
    138   this->gameWorldData->init();
     138  this->dataTank->init();
    139139}
    140140
     
    146146{
    147147  this->displayLoadScreen();
     148
     149  PRINTF(0)("Loading the GameWorld\n");
    148150
    149151  PRINTF(3)("> Loading world: '%s'\n", getPath());
     
    176178  }
    177179  /* the whole loading process for the GameWorld */
    178   this->gameWorldData->loadData(root);
     180  this->dataTank->loadData(root);
    179181
    180182  delete XMLDoc;
     
    191193  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
    192194
    193   this->gameWorldData->unloadData();
     195  this->dataTank->unloadData();
    194196}
    195197
     
    330332    this->gameTime += this->dtS;
    331333
    332     this->tick(this->gameWorldData->objectManager->getObjectList(OM_DEAD_TICK), this->dtS);
    333     this->tick(this->gameWorldData->objectManager->getObjectList(OM_COMMON), this->dtS);
    334     this->tick(this->gameWorldData->objectManager->getObjectList(OM_GROUP_00), this->dtS);
    335     this->tick(this->gameWorldData->objectManager->getObjectList(OM_GROUP_01), this->dtS);
    336     this->tick(this->gameWorldData->objectManager->getObjectList(OM_GROUP_01_PROJ), this->dtS);
     334    this->tick(this->dataTank->objectManager->getObjectList(OM_DEAD_TICK), this->dtS);
     335    this->tick(this->dataTank->objectManager->getObjectList(OM_COMMON), this->dtS);
     336    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_00), this->dtS);
     337    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_01), this->dtS);
     338    this->tick(this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ), this->dtS);
    337339
    338340    /* update tick the rest */
    339     this->gameWorldData->localCamera->tick(this->dtS);
     341    this->dataTank->localCamera->tick(this->dtS);
    340342    AnimationPlayer::getInstance()->tick(this->dtS);
    341343    ParticleEngine::getInstance()->tick(this->dtS);
     
    368370void GameWorld::collide()
    369371{
    370   CDEngine::getInstance()->checkCollisions(this->gameWorldData->objectManager->getObjectList(OM_GROUP_00),
    371       this->gameWorldData->objectManager->getObjectList(OM_GROUP_01_PROJ));
    372   CDEngine::getInstance()->checkCollisions(this->gameWorldData->objectManager->getObjectList(OM_GROUP_01),
    373       this->gameWorldData->objectManager->getObjectList(OM_COMMON));
     372  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
     373      this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
     374  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
     375      this->dataTank->objectManager->getObjectList(OM_COMMON));
    374376}
    375377
     
    384386  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    385387  // set camera
    386   this->gameWorldData->localCamera->apply ();
     388  this->dataTank->localCamera->apply ();
    387389  // draw world
    388390  this->draw();
     
    456458{
    457459  PRINTF(3)("GameWorld::displayLoadScreen - start\n");
    458   this->gameWorldData->glmis = new GLMenuImageScreen();
    459   this->gameWorldData->glmis->setMaximum(8);
     460  this->dataTank->glmis = new GLMenuImageScreen();
     461  this->dataTank->glmis->setMaximum(8);
    460462  PRINTF(3)("GameWorld::displayLoadScreen - end\n");
    461463}
     
    468470{
    469471  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
    470   this->gameWorldData->glmis->setValue(this->gameWorldData->glmis->getMaximum());
     472  this->dataTank->glmis->setValue(this->dataTank->glmis->getMaximum());
    471473  PRINTF(3)("GameWorld::releaseLoadScreen - end\n");
    472474}
  • branches/network/src/story_entities/game_world.h

    r6402 r6407  
    7474
    7575  protected:
    76     GameWorldData*      gameWorldData;                //!< reference to the GameWorld Data Tank
     76    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
    7777    char*               path;                         //!< The file from which this world is loaded
    7878
  • branches/network/src/story_entities/single_player_world.cc

    r6404 r6407  
    4242  this->setName("SinglePlayerWorld uninitialized");
    4343
     44  this->dataTank = new SinglePlayerWorldData();
     45
    4446  this->loadParams(root);
    45 
    46   this->singlePlayerWorldData = new SinglePlayerWorldData();
    4747}
    4848
  • branches/network/src/story_entities/single_player_world.h

    r6404 r6407  
    66#ifndef _SINGLE_PLAYER_WORLD_H
    77#define _SINGLE_PLAYER_WORLD_H
     8
    89
    910#include "game_world.h"
     
    2728
    2829    void loadParams(const TiXmlElement* root);
    29 
    30   private:
    31     SinglePlayerWorldData*        singlePlayerWorldData;             //!< reference to the data tank
    3230};
    3331
  • branches/network/src/story_entities/single_player_world_data.cc

    r6404 r6407  
    4646  /* call underlying function */
    4747  GameWorldData::init();
    48 }
    49 
    50 
    51 /**
    52  *  loads the data from the xml file
    53  * @param root reference to the xml root element
    54  */
    55 ErrorMessage SinglePlayerWorldData::loadData(TiXmlElement* root)
    56 {
    57   // load the parameters
    58   // name
    59   const char* string = grabParameter( root, "name");
    60   if( string == NULL)
    61   {
    62     PRINTF(2)("GameWorld is missing a proper 'name'\n");
    63     this->setName("Unknown");
    64   }
    65   else
    66     this->setName(string);
    67 
    68   this->loadGUI(root);
    69   this->loadWorldEntities(root);
    70   this->loadScene(root);
    71 }
    72 
    73 
    74 /**
    75  *  unloads the data from the xml file
    76  */
    77 ErrorMessage SinglePlayerWorldData::unloadData()
    78 {
    79   this->unloadGUI();
    80   this->unloadWorldEntities();
    81   this->unloadScene();
    8248}
    8349
  • branches/network/src/story_entities/single_player_world_data.h

    r6404 r6407  
    2020
    2121    virtual ErrorMessage init();
    22     virtual ErrorMessage loadData(TiXmlElement* root);
    23     virtual ErrorMessage unloadData();
    2422
    2523
Note: See TracChangeset for help on using the changeset viewer.