Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 12, 2006, 1:13:20 AM (19 years ago)
Author:
patrick
Message:

network: some more menu work. There is no menu visible yet (only for your info)

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

Legend:

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

    r6424 r6504  
    7676  LOAD_PARAM_START_CYCLE(root, element);
    7777  {
    78     StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
     78    StoryEntity* created = dynamic_cast<StoryEntity*>(Factory::fabricate(element));
    7979    if( created != NULL)
    8080      this->addStoryEntity(created);
  • branches/network/src/story_entities/game_world.cc

    r6500 r6504  
    115115  .describe("The Filename of this GameWorld (relative from the data-dir)");
    116116
     117//   LoadParam(root, "soundtrack", this->dataTank, GameWorldData, setSoundTrack);
     118
    117119  PRINTF(4)("Loaded GameWorld specific stuff\n");
    118120}
     
    151153  if( getPath() == NULL)
    152154  {
    153     PRINTF(1)("GameWorld has no path specified for loading");
     155    PRINTF(1)("GameWorld has no path specified for loading\n");
    154156    return (ErrorMessage){213,"Path not specified","GameWorld::load()"};
    155157  }
     
    242244void GameWorld::run()
    243245{
     246  /* start the music */
     247  if(this->dataTank->music != NULL)
     248    this->dataTank->music->playback();
     249
    244250  this->lastFrame = SDL_GetTicks ();
    245251  PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n");
  • branches/network/src/story_entities/game_world_data.cc

    r6434 r6504  
    7373  this->setClassID(CL_GAME_WORLD_DATA, "GameWorldData");
    7474
    75   this->localPlayer = NULL;
    76   this->localCamera = NULL;
    77 
    7875  this->glmis = NULL;
    7976
     
    285282  if( this->sky != NULL)
    286283    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();
    292284  SoundEngine::getInstance()->setListener(this->localCamera);
    293285}
     
    313305}
    314306
     307
     308void 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  
    4040    virtual ErrorMessage unloadData();
    4141
     42    /* interface functions */
     43    void setSoundTrack(const char* name);
    4244
    4345  protected:
  • branches/network/src/story_entities/simple_game_menu.cc

    r6502 r6504  
    2929#include "terrain.h"
    3030
     31#include "event_handler.h"
     32
    3133#include "cd_engine.h"
    3234
     
    7476{
    7577  /* 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);
    7779
    7880  PRINTF(4)("Loaded SimpleGameMenu specific stuff\n");
    7981}
     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 */
     90ErrorMessage 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
     103bool SimpleGameMenu::start()
     104{
     105  EventHandler::getInstance()->pushState(ES_MENU);
     106
     107  /* now call the underlying*/
     108  GameWorld::start();
     109}
     110
     111
     112
     113bool SimpleGameMenu::stop()
     114{
     115  EventHandler::getInstance()->popState();
     116
     117  /* now call the underlying*/
     118  GameWorld::stop();
     119}
     120
    80121
    81122
     
    87128
    88129
    89 
     130/**
     131 * event dispatcher funciton
     132 * @param event the incoming event
     133 */
     134void 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}
    90143
    91144
     
    164217        this->sky = dynamic_cast<WorldEntity*>(created);
    165218      if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    166       {
    167219        this->terrain = dynamic_cast<Terrain*>(created);
    168         CDEngine::getInstance()->setTerrain(terrain);
    169       }
    170220      element = element->NextSiblingElement();
    171221    }
  • branches/network/src/story_entities/simple_game_menu.h

    r6502 r6504  
    99
    1010#include "game_world.h"
     11#include "event_listener.h"
    1112#include "game_world_data.h"
     13
    1214
    1315
     
    2123 * loadable and is exchangeable very easely :D
    2224 */
    23 class SimpleGameMenu : public GameWorld
     25class SimpleGameMenu : virtual public GameWorld, virtual public EventListener
    2426{
    2527
     
    3032    void loadParams(const TiXmlElement* root);
    3133
     34    virtual ErrorMessage init();
     35    virtual bool start();
     36    virtual bool stop();
     37
     38    virtual void process(const Event &event);
     39
     40
     41  protected:
    3242    virtual void collide();
    3343};
  • branches/network/src/story_entities/story_entity.h

    r6424 r6504  
    2424
    2525//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
    26 class StoryEntity : public BaseObject {
     26class StoryEntity : virtual public BaseObject {
    2727
    2828 public:
Note: See TracChangeset for help on using the changeset viewer.