Changeset 6504 in orxonox.OLD for branches/network/src/story_entities
- Timestamp:
- Jan 12, 2006, 1:13:20 AM (19 years ago)
- Location:
- branches/network/src/story_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/campaign_data.cc
r6424 r6504 76 76 LOAD_PARAM_START_CYCLE(root, element); 77 77 { 78 StoryEntity* created = (StoryEntity*) Factory::fabricate(element);78 StoryEntity* created = dynamic_cast<StoryEntity*>(Factory::fabricate(element)); 79 79 if( created != NULL) 80 80 this->addStoryEntity(created); -
branches/network/src/story_entities/game_world.cc
r6500 r6504 115 115 .describe("The Filename of this GameWorld (relative from the data-dir)"); 116 116 117 // LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack); 118 117 119 PRINTF(4)("Loaded GameWorld specific stuff\n"); 118 120 } … … 151 153 if( getPath() == NULL) 152 154 { 153 PRINTF(1)("GameWorld has no path specified for loading ");155 PRINTF(1)("GameWorld has no path specified for loading\n"); 154 156 return (ErrorMessage){213,"Path not specified","GameWorld::load()"}; 155 157 } … … 242 244 void GameWorld::run() 243 245 { 246 /* start the music */ 247 if(this->dataTank->music != NULL) 248 this->dataTank->music->playback(); 249 244 250 this->lastFrame = SDL_GetTicks (); 245 251 PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n"); -
branches/network/src/story_entities/game_world_data.cc
r6434 r6504 73 73 this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData"); 74 74 75 this->localPlayer = NULL;76 this->localCamera = NULL;77 78 75 this->glmis = NULL; 79 76 … … 285 282 if( this->sky != NULL) 286 283 this->localCamera->addChild(this->sky); 287 288 /* sound loading */289 this->music = NULL;290 //(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);291 //music->playback();292 284 SoundEngine::getInstance()->setListener(this->localCamera); 293 285 } … … 313 305 } 314 306 307 308 void GameWorldData::setSoundTrack(const char* name) 309 { 310 PRINTF(3)("Setting Sound Track to %s\n", name); 311 this->music = (OggPlayer*)ResourceManager::getInstance()->load(name, OGG, RP_LEVEL); 312 } 313 314 -
branches/network/src/story_entities/game_world_data.h
r6424 r6504 40 40 virtual ErrorMessage unloadData(); 41 41 42 /* interface functions */ 43 void setSoundTrack(const char* name); 42 44 43 45 protected: -
branches/network/src/story_entities/simple_game_menu.cc
r6502 r6504 29 29 #include "terrain.h" 30 30 31 #include "event_handler.h" 32 31 33 #include "cd_engine.h" 32 34 … … 74 76 { 75 77 /* skip the GameWorld, since it does not define any useful loadParams for this class */ 76 static_cast< StoryEntity*>(this)->loadParams(root);78 static_cast<GameWorld*>(this)->loadParams(root); 77 79 78 80 PRINTF(4)("Loaded SimpleGameMenu specific stuff\n"); 79 81 } 82 83 84 /** 85 * this is executed just before load 86 * 87 * since the load function sometimes needs data, that has been initialized 88 * before the load and after the proceeding storyentity has finished 89 */ 90 ErrorMessage SimpleGameMenu::init() 91 { 92 /* call underlying init funciton */ 93 GameWorld::init(); 94 95 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_UP); 96 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_DOWN); 97 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_RETURN); 98 EventHandler::getInstance()->subscribe(this, ES_MENU, SDLK_SPACE); 99 } 100 101 102 103 bool SimpleGameMenu::start() 104 { 105 EventHandler::getInstance()->pushState(ES_MENU); 106 107 /* now call the underlying*/ 108 GameWorld::start(); 109 } 110 111 112 113 bool SimpleGameMenu::stop() 114 { 115 EventHandler::getInstance()->popState(); 116 117 /* now call the underlying*/ 118 GameWorld::stop(); 119 } 120 80 121 81 122 … … 87 128 88 129 89 130 /** 131 * event dispatcher funciton 132 * @param event the incoming event 133 */ 134 void SimpleGameMenu::process(const Event &event) 135 { 136 PRINTF(0)("Got Event: %i\n", event.type); 137 138 if( event.type == SDLK_RETURN) 139 { 140 this->stop(); 141 } 142 } 90 143 91 144 … … 164 217 this->sky = dynamic_cast<WorldEntity*>(created); 165 218 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 166 {167 219 this->terrain = dynamic_cast<Terrain*>(created); 168 CDEngine::getInstance()->setTerrain(terrain);169 }170 220 element = element->NextSiblingElement(); 171 221 } -
branches/network/src/story_entities/simple_game_menu.h
r6502 r6504 9 9 10 10 #include "game_world.h" 11 #include "event_listener.h" 11 12 #include "game_world_data.h" 13 12 14 13 15 … … 21 23 * loadable and is exchangeable very easely :D 22 24 */ 23 class SimpleGameMenu : public GameWorld25 class SimpleGameMenu : virtual public GameWorld, virtual public EventListener 24 26 { 25 27 … … 30 32 void loadParams(const TiXmlElement* root); 31 33 34 virtual ErrorMessage init(); 35 virtual bool start(); 36 virtual bool stop(); 37 38 virtual void process(const Event &event); 39 40 41 protected: 32 42 virtual void collide(); 33 43 }; -
branches/network/src/story_entities/story_entity.h
r6424 r6504 24 24 25 25 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 26 class StoryEntity : public BaseObject {26 class StoryEntity : virtual public BaseObject { 27 27 28 28 public:
Note: See TracChangeset
for help on using the changeset viewer.