Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6874 in orxonox.OLD


Ignore:
Timestamp:
Jan 30, 2006, 11:03:30 PM (18 years ago)
Author:
patrick
Message:

trunk: the menu control better implemented

Location:
trunk/src
Files:
9 edited

Legend:

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

    r6862 r6874  
    4040  assert( root != NULL);
    4141
     42  this->bReturnToMenu = false;
     43
    4244  this->campaignData = new CampaignData(root);
    4345  this->loadParams(root);
     
    7779
    7880  this->isRunning = true;
     81  this->bReturnToMenu = false;
    7982  this->run();
    8083}
     
    106109{
    107110  PRINTF(4)("Stopping the current Campaign\n");
    108   //this->isRunning = false;
     111  this->bReturnToMenu = true;
    109112  if( this->currentEntity != NULL)
    110113  {
    111     this->currentEntity->setNextStoryID(0);
    112114    this->currentEntity->stop();
    113115  }
     
    129131    PRINTF(0)("Campaign is starting StoryEntity nr:%i\n", this->currentEntity->getStoryID());
    130132
     133    // check if return to menu
     134    if( this->bReturnToMenu)
     135    {
     136      this->currentEntity = this->campaignData->getLevel(WORLD_ID_MENU);
     137      this->bReturnToMenu = false;
     138    }
     139
     140    this->campaignData->setCurrentEntity(this->currentEntity);
     141
    131142    this->currentEntity->init();
    132 
    133143    this->currentEntity->loadData();
    134144    this->currentEntity->start();
    135145    this->currentEntity->unloadData();
    136146  }
    137   PRINTF(2)("There is no StoryEnity left to play, returning to Main Menu\n");
     147  PRINTF(2)("There is no StoryEnity left to play, quitting game\n");
    138148}
    139149
  • trunk/src/story_entities/campaign.h

    r6512 r6874  
    3737    StoryEntity*                        currentEntity;          //!< reference to the current StoryEntity
    3838    CampaignData*                       campaignData;           //!< reference to the CampaignData
     39
     40    bool                                bReturnToMenu;          //!< is true, if the StoryEntity should return to the Mainmenu after termination
    3941};
    4042
  • trunk/src/story_entities/campaign_data.cc

    r6834 r6874  
    139139
    140140
     141/**
     142 * @param storyID the story ID to look for
     143 * @returns a pointer to a StoryEntity with the storyID
     144 */
     145StoryEntity* CampaignData::getLevel(int storyID)
     146{
     147  list<StoryEntity*>::iterator   it;
     148  for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)
     149  {
     150    if( storyID == (*it)->getStoryID())
     151      return (*it);
     152  }
     153  return NULL;
     154}
    141155
    142 
  • trunk/src/story_entities/campaign_data.h

    r6512 r6874  
    2929    StoryEntity* getFirstLevel();
    3030    StoryEntity* getNextLevel();
     31    StoryEntity* getLevel(int storyID);
     32
     33    /** @param storyEntity the current entity to be set */
     34    inline void setCurrentEntity(StoryEntity* storyEntity) { this->currentEntity = storyEntity; }
     35    /** @return the current StoryEntity played*/
     36    inline StoryEntity* getCurrentEntity() { return this->currentEntity; }
    3137
    3238
  • trunk/src/story_entities/simple_game_menu.cc

    r6862 r6874  
    198198    {
    199199      this->menuLayer[1]->storyList.push_back(se);
    200       PRINTF(0)("Got a new menu entry |%s|\n", se->getName());
     200
     201      // generating menu item
    201202      ImageEntity* ie = new ImageEntity();
    202       PRINTF(0)("setting texture to: |%s|\n", se->getMenuItemImage());
    203203      ie->setTexture(se->getMenuItemImage());
    204204      ie->setRelCoor(0.0f,20.0f - (this->menuLayer[1]->menuList.size() * 10.0f), 0.0f);
    205205      ie->setVisibility(false);
    206206      this->menuLayer[1]->menuList.push_back(ie);
     207
     208      // generating screenshoot item
     209//       ie = new ImageEntity();
     210//       ie->setTexture(se->getMenuScreenshoot);
     211//       ie->setRelCoor(.0f, 10.0f, 0.0f);
     212//       this->menuLayer[1]->screenshootList.push_back(ie);
     213
    207214    }
    208215  }
  • trunk/src/story_entities/simple_game_menu.h

    r6862 r6874  
    3131    std::vector<ImageEntity*>         menuList;                        //!< the list of the menu items
    3232    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
     33    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
    3334};
    3435
  • trunk/src/story_entities/story_def.h

    r4597 r6874  
    1212#define DEBUG_WORLD_2 102
    1313
     14
    1415#define WORLD_ID_0 0
    1516#define WORLD_ID_1 1
     
    1819#define WORLD_ID_4 4
    1920#define WORLD_ID_5 5
     21
     22#define WORLD_ID_MENU    0
    2023#define WORLD_ID_GAMEEND 999
    2124
  • trunk/src/util/state.cc

    r6695 r6874  
    4343bool State::bOnline = false;
    4444
     45bool State::bMenuMode = false;
     46
     47
    4548/**
    4649 *  sets camera and target of the current Camera
  • trunk/src/util/state.h

    r6695 r6874  
    8282
    8383
     84  ////////////
     85  /// Menu ///
     86  ////////////
     87  /** sets the menu mode @param mode true if always exit to menu */
     88  static inline void setMenuMode(bool mode) { State::bMenuMode = mode; }
     89  /** @returns the menu mode */
     90  static inline bool getMenuMode() { return State::bMenuMode;}
     91
     92
     93
    8494 private:
    8595  State();
     
    97107
    98108  static bool                   bOnline;           //!< Is true if this node is in multiplayer mode (via network)
     109  static bool                   bMenuMode;         //!< True is orxonox is player in the menu mode (always returning to the menu after exit)
    99110
    100111  };
Note: See TracChangeset for help on using the changeset viewer.