Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6839 in orxonox.OLD


Ignore:
Timestamp:
Jan 30, 2006, 12:52:08 AM (18 years ago)
Author:
patrick
Message:

trunk: the menu is processing

Location:
trunk/src/story_entities
Files:
6 edited

Legend:

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

    r6835 r6839  
    113113  LoadParam(root, "path", this, GameWorld, setPath)
    114114      .describe("The Filename of this GameWorld (relative from the data-dir)");
    115   LoadParam(root, "menu-entry", this, GameWorld, addToGameMenu)
    116       .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
    117 
    118115
    119116//   LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack);
  • trunk/src/story_entities/game_world.h

    r6835 r6839  
    5555    void toggleBVVisibility() { this->showBV = !this->showBV; };
    5656
    57     /** toggle the menu visibility: SimpleMenu specific */
    58     inline void addToGameMenu(int toggle) { this->bMenuEntry = (bool)toggle; }
    59     /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
    60     inline bool isContainedInMenu() { return this->bMenuEntry; }
     57
    6158
    6259
     
    9895    /* external modules interfaces */
    9996    Shell*              shell;
    100 
    101     bool                bMenuEntry;                   //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
    10297};
    10398
  • trunk/src/story_entities/simple_game_menu.cc

    r6837 r6839  
    5656  this->cameraVector = Vector(50.0, 0.0, 0.0);
    5757  this->menuLayer.push_back(new MenuLayer());
     58  this->menuLayer.push_back(new MenuLayer());
    5859  this->layerIndex = 0;
    5960
     
    150151  this->menuSelected = this->menuLayer[0]->menuList[this->menuSelectedIndex];
    151152  this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());
     153
     154
     155  // loading the storyentities submenu (singleplayer)
     156  const std::list<BaseObject*>* storyEntities = ClassList::getList(CL_STORY_ENTITY);
     157  std::list<BaseObject*>::const_iterator it;
     158  for( it = storyEntities->begin(); it != storyEntities->end(); it++)
     159  {
     160    StoryEntity* se = dynamic_cast<StoryEntity*>(*it);
     161    if( se->isContainedInMenu())
     162    {
     163      this->menuLayer[1]->storyList.push_back(se);
     164      PRINTF(0)("Got a new menu entry |%s|\n", se->getName());
     165    }
     166  }
    152167}
    153168
     
    217232void SimpleGameMenu::process(const Event &event)
    218233{
     234  /* ----------------- LAYER 1 ---------------*/
    219235  if( this->layerIndex == 0)
    220236  {
     
    230246        //this->stop();
    231247        // switch to first submenu
    232         if( this->menuLayer[1] == NULL)
     248        if( this->menuLayer[1]->menuList.size() == 0)
    233249        {
    234           PRINTF(1)("Haven't got any Story Entities to play!\n");
     250          PRINTF(1)("Haven't got any StoryEntities to play!\n");
    235251          return;
    236252        }
     
    257273      }
    258274    }
    259   }
     275  }  /* ----------------- LAYER 2 ---------------*/
    260276  else if( this->layerIndex == 1)
    261277  {
  • trunk/src/story_entities/simple_game_menu.h

    r6837 r6839  
    3030  public:
    3131    std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
     32    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
    3233};
    3334
  • trunk/src/story_entities/story_entity.cc

    r6837 r6839  
    4040
    4141  this->storyID = -1;
    42   this->name = NULL;
     42  this->description = NULL;
    4343  this->nextStoryID = WORLD_ID_GAMEEND;
     44  this->bMenuEntry = false;
    4445}
    4546
     
    6667      .describe("Sets the ID of the next StoryEntity");
    6768
    68   LoadParam(root, "name", this, StoryEntity, setName)
    69       .describe("Sets the name of this StoryEntity");
    70 
    7169  LoadParam(root, "description", this, StoryEntity, setDescription)
    7270      .describe("Sets the description of this StoryEntity");
    7371
     72  LoadParam(root, "menu-entry", this, StoryEntity, addToGameMenu)
     73      .describe("If this entry is 1, the world is contained in the SimpleGameMenu");
    7474
    7575  PRINTF(4)("Loaded StoryEntity specific stuff\n");
  • trunk/src/story_entities/story_entity.h

    r6837 r6839  
    6767  /**  gets the story id of the current entity @returns story id */
    6868  inline int getNextStoryID() { return this->nextStoryID; }
    69   /** sets the name of this StoryEntity @param name name */
    70   inline void setName(const char* name) { this->name = name; }
    71   /** @returns the name of this StoryEntity */
    72   inline const char* getName() { return this->name; }
    7369  /** sets the descroption of this StoryEntity @param name name */
    7470  inline void setDescription(const char* description) { this->description = description; }
    7571  /** @returns the description of this StoryEntity */
    7672  inline const char* getDescription() { return this->description; }
     73  /** toggle the menu visibility: SimpleMenu specific */
     74  inline void addToGameMenu(int toggle) { this->bMenuEntry = (bool)toggle; }
     75  /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
     76  inline bool isContainedInMenu() { return this->bMenuEntry; }
    7777
    7878
     
    8686    int storyID;            //!< this is the number of this entity, identifying it in a list/tree...
    8787    int nextStoryID;        //!< if this entity has finished, this entity shall be called
    88     const char* name;       //!< name of this StoryEntity
    8988    const char* description;//!< the description of the StoryEntity
     89    bool        bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
    9090};
    9191
Note: See TracChangeset for help on using the changeset viewer.