mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-25 12:45:17 +00:00
[h&s menu] change: don't close after toggling the gravity button
This commit is contained in:
parent
6bc98f79ac
commit
94c6e74400
5 changed files with 37 additions and 16 deletions
|
@ -50,6 +50,7 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
private:
|
||||
inline void subMenuStart();
|
||||
inline void subMenuUpdate();
|
||||
inline void subMenuRefresh();
|
||||
|
||||
al::MessageSystem* mMsgSystem = nullptr;
|
||||
FooterParts* mFooterParts = nullptr;
|
||||
|
|
|
@ -4,11 +4,17 @@
|
|||
|
||||
class GameModeConfigMenu {
|
||||
public:
|
||||
enum UpdateAction {
|
||||
NOOP,
|
||||
CLOSE,
|
||||
REFRESH,
|
||||
};
|
||||
|
||||
GameModeConfigMenu() = default;
|
||||
|
||||
virtual void initMenu(const al::LayoutInitInfo &initInfo) {return;}
|
||||
|
||||
virtual bool updateMenu(int selectIndex) {return false;}
|
||||
virtual UpdateAction updateMenu(int selectIndex) {return UpdateAction::NOOP;}
|
||||
|
||||
virtual const sead::WFixedSafeString<0x200>* getStringData() {return nullptr;}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
|
||||
void initMenu(const al::LayoutInitInfo &initInfo) override;
|
||||
const sead::WFixedSafeString<0x200>* getStringData() override;
|
||||
bool updateMenu(int selectIndex) override;
|
||||
GameModeConfigMenu::UpdateAction updateMenu(int selectIndex) override;
|
||||
|
||||
const int getMenuSize() override { return mItemCount; }
|
||||
|
||||
|
|
|
@ -24,27 +24,24 @@ const sead::WFixedSafeString<0x200>* HideAndSeekConfigMenu::getStringData() {
|
|||
return mItems->mBuffer;
|
||||
}
|
||||
|
||||
bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
|
||||
|
||||
HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
||||
|
||||
GameModeConfigMenu::UpdateAction HideAndSeekConfigMenu::updateMenu(int selectIndex) {
|
||||
Logger::log("Setting Gravity Mode.\n");
|
||||
|
||||
if (!curMode) {
|
||||
Logger::log("Unable to Load Mode info!\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (selectIndex) {
|
||||
case 0: {
|
||||
HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
||||
if (!curMode) {
|
||||
Logger::log("Unable to Load Mode info!\n");
|
||||
return UpdateAction::NOOP;
|
||||
}
|
||||
if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
|
||||
curMode->mIsUseGravity = !curMode->mIsUseGravity;
|
||||
return UpdateAction::REFRESH;
|
||||
}
|
||||
return true;
|
||||
return UpdateAction::NOOP;
|
||||
}
|
||||
default:
|
||||
Logger::log("Failed to interpret Index!\n");
|
||||
return false;
|
||||
return UpdateAction::NOOP;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -237,8 +237,17 @@ void StageSceneStateServerConfig::exeGamemodeConfig() {
|
|||
subMenuUpdate();
|
||||
|
||||
if (mIsDecideConfig && mCurrentList->isDecideEnd()) {
|
||||
if (mGamemodeConfigMenu->mMenu->updateMenu(mCurrentList->mCurSelected)) {
|
||||
GameModeConfigMenu::UpdateAction action = mGamemodeConfigMenu->mMenu->updateMenu(mCurrentList->mCurSelected);
|
||||
switch (action) {
|
||||
case GameModeConfigMenu::UpdateAction::CLOSE:
|
||||
endSubMenu();
|
||||
break;
|
||||
case GameModeConfigMenu::UpdateAction::REFRESH:
|
||||
subMenuRefresh();
|
||||
break;
|
||||
case GameModeConfigMenu::UpdateAction::NOOP:
|
||||
activateInput();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,6 +325,14 @@ void StageSceneStateServerConfig::subMenuUpdate() {
|
|||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::subMenuRefresh() {
|
||||
mGamemodeConfigMenu = &mGamemodeConfigMenus[GameModeManager::instance()->getGameMode()];
|
||||
mGamemodeConfigMenu->mList->initDataNoResetSelected(mGamemodeConfigMenu->mMenu->getMenuSize());
|
||||
mGamemodeConfigMenu->mList->addStringData(mGamemodeConfigMenu->mMenu->getStringData(), "TxtContent");
|
||||
mGamemodeConfigMenu->mList->updateParts();
|
||||
activateInput();
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::activateInput() {
|
||||
mInput->reset();
|
||||
mCurrentList->activate();
|
||||
|
|
Loading…
Reference in a new issue