Changeset 6839 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Jan 30, 2006, 12:52:08 AM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r6835 r6839 113 113 LoadParam(root, "path", this, GameWorld, setPath) 114 114 .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 118 115 119 116 // LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack); -
trunk/src/story_entities/game_world.h
r6835 r6839 55 55 void toggleBVVisibility() { this->showBV = !this->showBV; }; 56 56 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 61 58 62 59 … … 98 95 /* external modules interfaces */ 99 96 Shell* shell; 100 101 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific102 97 }; 103 98 -
trunk/src/story_entities/simple_game_menu.cc
r6837 r6839 56 56 this->cameraVector = Vector(50.0, 0.0, 0.0); 57 57 this->menuLayer.push_back(new MenuLayer()); 58 this->menuLayer.push_back(new MenuLayer()); 58 59 this->layerIndex = 0; 59 60 … … 150 151 this->menuSelected = this->menuLayer[0]->menuList[this->menuSelectedIndex]; 151 152 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 } 152 167 } 153 168 … … 217 232 void SimpleGameMenu::process(const Event &event) 218 233 { 234 /* ----------------- LAYER 1 ---------------*/ 219 235 if( this->layerIndex == 0) 220 236 { … … 230 246 //this->stop(); 231 247 // switch to first submenu 232 if( this->menuLayer[1] == NULL)248 if( this->menuLayer[1]->menuList.size() == 0) 233 249 { 234 PRINTF(1)("Haven't got any Story 250 PRINTF(1)("Haven't got any StoryEntities to play!\n"); 235 251 return; 236 252 } … … 257 273 } 258 274 } 259 } 275 } /* ----------------- LAYER 2 ---------------*/ 260 276 else if( this->layerIndex == 1) 261 277 { -
trunk/src/story_entities/simple_game_menu.h
r6837 r6839 30 30 public: 31 31 std::vector<ImageEntity*> menuList; //!< the list of the menu items 32 std::vector<StoryEntity*> storyList; //!< the list of the StoryEntities for the menu 32 33 }; 33 34 -
trunk/src/story_entities/story_entity.cc
r6837 r6839 40 40 41 41 this->storyID = -1; 42 this-> name= NULL;42 this->description = NULL; 43 43 this->nextStoryID = WORLD_ID_GAMEEND; 44 this->bMenuEntry = false; 44 45 } 45 46 … … 66 67 .describe("Sets the ID of the next StoryEntity"); 67 68 68 LoadParam(root, "name", this, StoryEntity, setName)69 .describe("Sets the name of this StoryEntity");70 71 69 LoadParam(root, "description", this, StoryEntity, setDescription) 72 70 .describe("Sets the description of this StoryEntity"); 73 71 72 LoadParam(root, "menu-entry", this, StoryEntity, addToGameMenu) 73 .describe("If this entry is 1, the world is contained in the SimpleGameMenu"); 74 74 75 75 PRINTF(4)("Loaded StoryEntity specific stuff\n"); -
trunk/src/story_entities/story_entity.h
r6837 r6839 67 67 /** gets the story id of the current entity @returns story id */ 68 68 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; }73 69 /** sets the descroption of this StoryEntity @param name name */ 74 70 inline void setDescription(const char* description) { this->description = description; } 75 71 /** @returns the description of this StoryEntity */ 76 72 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; } 77 77 78 78 … … 86 86 int storyID; //!< this is the number of this entity, identifying it in a list/tree... 87 87 int nextStoryID; //!< if this entity has finished, this entity shall be called 88 const char* name; //!< name of this StoryEntity89 88 const char* description;//!< the description of the StoryEntity 89 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific 90 90 }; 91 91
Note: See TracChangeset
for help on using the changeset viewer.