metaforce/Runtime/MP1/CAutoSave.cpp

28 lines
1008 B
C++
Raw Normal View History

2017-11-20 17:33:21 +00:00
#include "CAutoSave.hpp"
#include "CSaveGameScreen.hpp"
2020-09-13 01:13:38 +00:00
#include "Runtime/MP1/MP1.hpp"
2017-11-20 17:33:21 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce::MP1 {
2017-11-20 17:33:21 +00:00
CAutoSave::CAutoSave()
2020-09-13 01:13:38 +00:00
: CIOWin("AutoSave"sv), x14_savegameScreen(new CSaveGameScreen(ESaveContext::InGame, g_GameState->GetCardSerial())) {
static_cast<MP1::CMain*>(g_Main)->RefreshGameState();
}
2021-06-07 19:29:18 +00:00
void CAutoSave::Draw() { x14_savegameScreen->Draw(); }
2020-09-13 01:13:38 +00:00
CIOWin::EMessageReturn CAutoSave::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
if (g_GameState->GetCardSerial() == 0ull) {
return EMessageReturn ::RemoveIOWinAndExit;
}
if (msg.GetType() == EArchMsgType::UserInput) {
x14_savegameScreen->ProcessUserInput(MakeMsg::GetParmUserInput(msg).x4_parm);
2021-06-07 19:29:18 +00:00
} else if (msg.GetType() == EArchMsgType::TimerTick) {
2020-09-13 01:13:38 +00:00
auto ret = x14_savegameScreen->Update(MakeMsg::GetParmTimerTick(msg).x4_parm);
if (ret != EMessageReturn::Exit) {
return EMessageReturn::RemoveIOWinAndExit;
}
}
return EMessageReturn::Exit;
}
2021-04-10 08:42:06 +00:00
} // namespace metaforce::MP1