SuperMarioOdysseyOnline/source/server/hns/HideAndSeekConfigMenu.cpp

55 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() {
gravityOn = new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
gravityOn->mBuffer[0].copy(u"Toggle H&S Gravity (ON)");
gravityOff = new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
gravityOff->mBuffer[0].copy(u"Toggle H&S Gravity (OFF)");
}
2022-06-16 21:33:18 +00:00
void HideAndSeekConfigMenu::initMenu(const al::LayoutInitInfo &initInfo) {
}
const sead::WFixedSafeString<0x200>* HideAndSeekConfigMenu::getStringData() {
HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
return (
GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)
&& curMode != nullptr
&& curMode->mIsUseGravity
? gravityOn->mBuffer
: gravityOff->mBuffer
);
2022-06-16 21:33:18 +00:00
}
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)) {
curMode->mIsUseGravity = !curMode->mIsUseGravity;
2022-06-16 21:33:18 +00:00
}
return true;
}
default:
Logger::log("Failed to interpret Index!\n");
return false;
}
}