metaforce/Runtime/MP1/CAutoSave.cpp

28 lines
1008 B
C++
Raw Permalink Normal View History

2017-11-20 09:33:21 -08:00
#include "CAutoSave.hpp"
#include "CSaveGameScreen.hpp"
2020-09-12 18:13:38 -07:00
#include "Runtime/MP1/MP1.hpp"
2017-11-20 09:33:21 -08:00
2021-04-10 01:42:06 -07:00
namespace metaforce::MP1 {
2017-11-20 09:33:21 -08:00
CAutoSave::CAutoSave()
2020-09-12 18:13:38 -07:00
: CIOWin("AutoSave"sv), x14_savegameScreen(new CSaveGameScreen(ESaveContext::InGame, g_GameState->GetCardSerial())) {
static_cast<MP1::CMain*>(g_Main)->RefreshGameState();
}
2021-06-07 12:29:18 -07:00
void CAutoSave::Draw() { x14_savegameScreen->Draw(); }
2020-09-12 18:13:38 -07: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 12:29:18 -07:00
} else if (msg.GetType() == EArchMsgType::TimerTick) {
2020-09-12 18:13:38 -07:00
auto ret = x14_savegameScreen->Update(MakeMsg::GetParmTimerTick(msg).x4_parm);
if (ret != EMessageReturn::Exit) {
return EMessageReturn::RemoveIOWinAndExit;
}
}
return EMessageReturn::Exit;
}
2021-04-10 01:42:06 -07:00
} // namespace metaforce::MP1