SuperMarioOdysseyOnline/source/server/hns/HideAndSeekConfigMenu.cpp

53 lines
1.6 KiB
C++
Raw Normal View History

2022-08-07 21:42:56 +00:00
#include "server/hns/HideAndSeekConfigMenu.hpp"
2022-06-16 21:33:18 +00:00
#include <cmath>
#include "logger.hpp"
2022-08-07 21:42:56 +00:00
#include "server/gamemode/GameModeManager.hpp"
#include "server/hns/HideAndSeekMode.hpp"
2022-06-16 21:33:18 +00:00
#include "server/Client.hpp"
HideAndSeekConfigMenu::HideAndSeekConfigMenu() : GameModeConfigMenu() {}
void HideAndSeekConfigMenu::initMenu(const al::LayoutInitInfo &initInfo) {
}
const sead::WFixedSafeString<0x200> *HideAndSeekConfigMenu::getStringData() {
sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>* gamemodeConfigOptions =
new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
gamemodeConfigOptions->mBuffer[0].copy(u"Toggle H&S Gravity On");
gamemodeConfigOptions->mBuffer[1].copy(u"Toggle H&S Gravity Off");
return gamemodeConfigOptions->mBuffer;
}
bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
2022-08-07 21:42:56 +00:00
HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
2022-06-16 21:33:18 +00:00
Logger::log("Setting Gravity Mode.\n");
if (!curMode) {
Logger::log("Unable to Load Mode info!\n");
return true;
}
switch (selectIndex) {
case 0: {
2022-08-07 21:42:56 +00:00
if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
2022-06-16 21:33:18 +00:00
curMode->mIsUseGravity = true;
}
return true;
}
case 1: {
2022-08-07 21:42:56 +00:00
if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
2022-06-16 21:33:18 +00:00
curMode->mIsUseGravity = false;
}
return true;
}
default:
Logger::log("Failed to interpret Index!\n");
return false;
}
}