Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6993 in orxonox.OLD


Ignore:
Timestamp:
Feb 2, 2006, 11:23:43 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: level's LoadImage is loadable within the level instead of the Campaign file

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/story_entity.cc

    r6992 r6993  
    6666
    6767  LoadParam(root, "identifier", this, StoryEntity, setStoryID)
    68       .describe("A Unique Identifier for this StoryEntity");
     68  .describe("A Unique Identifier for this StoryEntity");
    6969
    7070  LoadParam(root, "path", this, StoryEntity, setLoadFile)
    71       .describe("DEPRICATED FORM OF file. The Filename of this StoryEntity (relative from the data-dir)");
     71  .describe("DEPRICATED FORM OF file. The Filename of this StoryEntity (relative from the data-dir)");
    7272
    7373  LoadParam(root, "file", this, StoryEntity, setLoadFile)
    74       .describe("The Filename of this StoryEntity (relative from the data-dir)");
     74  .describe("The Filename of this StoryEntity (relative from the data-dir)");
    7575
    7676  LoadParam(root, "nextid", this, StoryEntity, setNextStoryID)
    77       .describe("Sets the ID of the next StoryEntity");
    78 
    79   LoadParam(root, "description", this, StoryEntity, setDescription)
    80       .describe("Sets the description of this StoryEntity");
    81 
    82   LoadParam(root, "menu-entry", this, StoryEntity, addToGameMenu)
    83       .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
    84 
    85   LoadParam(root, "menu-item-image", this, StoryEntity, setMenuItemImage)
    86       .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
    87 
    88   LoadParam(root, "screenshoot", this, StoryEntity, setMenuScreenshoot)
    89       .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
     77  .describe("Sets the ID of the next StoryEntity");
    9078
    9179  PRINTF(4)("Loaded StoryEntity specific stuff\n");
     
    10896  else
    10997    this->loadFile = ResourceManager::getFullName(fileName);
     98
     99  this->grabWorldInfo();
    110100}
    111101
     
    135125void StoryEntity::setNextStoryID(int nextStoryID)
    136126{
    137    this->nextStoryID = nextStoryID;
     127  this->nextStoryID = nextStoryID;
     128}
     129
     130/**
     131 * @brief grabs settings needed for displaying a MenuScreen.
     132 */
     133void StoryEntity::grabWorldInfo()
     134{
     135  PRINTF(3)("Grabbing the Worlds Settings\n", this->getLoadFile());
     136  if( getLoadFile() == NULL)
     137    return;
     138  TiXmlDocument XMLDoc(this->getLoadFile());
     139  // load the xml world file for further loading
     140  if( !XMLDoc.LoadFile())
     141  {
     142    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc.ErrorDesc(), this->getLoadFile(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
     143    return;
     144  }
     145  TiXmlElement* root = XMLDoc.RootElement();
     146  if (root == NULL)
     147    return;
     148
     149  if (root->Value() != NULL && !strcmp(root->Value(), "WorldDataFile"))
     150  {
     151    LoadParam(root, "description", this, StoryEntity, setDescription)
     152    .describe("Sets the description of this StoryEntity");
     153
     154    LoadParam(root, "menu-entry", this, StoryEntity, addToGameMenu)
     155    .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
     156
     157    LoadParam(root, "menu-item-image", this, StoryEntity, setMenuItemImage)
     158    .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
     159
     160    LoadParam(root, "screenshoot", this, StoryEntity, setMenuScreenshoot)
     161    .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
     162  }
    138163}
    139164
  • trunk/src/story_entities/story_entity.h

    r6992 r6993  
    7272  inline const char* getDescription() { return this->description; }
    7373
    74 
    75 
     74  void grabWorldInfo();
    7675  /** toggle the menu visibility: SimpleMenu specific */
    77   inline void addToGameMenu(int toggle) { this->bMenuEntry = (bool)toggle; }
     76  inline void addToGameMenu(bool toggle) { this->bMenuEntry = toggle; }
    7877  /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
    7978  inline bool isContainedInMenu() { return this->bMenuEntry; }
     
    8584  /** @returns the menu screenshoot of this StoryEntity */
    8685  inline const char* getMenuScreenshoot() { return this->menuScreenshoot; }
    87 
    8886
    8987  protected:
Note: See TracChangeset for help on using the changeset viewer.