2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/World/CScriptHUDMemo.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CSimplePool.hpp"
|
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
|
|
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
|
|
|
#include "Runtime/MP1/CSamusHud.hpp"
|
|
|
|
|
2019-09-21 13:07:13 +00:00
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
2016-05-20 09:17:51 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-05-20 09:17:51 +00:00
|
|
|
|
2018-05-10 02:56:54 +00:00
|
|
|
CScriptHUDMemo::CScriptHUDMemo(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
|
|
|
const CHUDMemoParms& parms, EDisplayType disp, CAssetId msg, bool active)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CEntity(uid, info, active, name), x34_parms(parms), x3c_dispType(disp), x40_stringTableId(msg) {
|
2020-05-07 17:06:47 +00:00
|
|
|
if (msg.IsValid()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x44_stringTable.emplace(g_SimplePool->GetObj({FOURCC('STRG'), msg}));
|
2020-05-07 17:06:47 +00:00
|
|
|
}
|
2016-05-20 09:17:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptHUDMemo::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
2017-01-15 03:07:01 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CScriptHUDMemo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
|
|
|
if (msg == EScriptObjectMessage::SetToZero) {
|
|
|
|
if (GetActive()) {
|
2020-05-07 17:06:47 +00:00
|
|
|
if (x3c_dispType == EDisplayType::MessageBox) {
|
2018-12-08 05:30:43 +00:00
|
|
|
mgr.ShowPausedHUDMemo(x40_stringTableId, x34_parms.GetDisplayTime());
|
2020-05-07 17:06:47 +00:00
|
|
|
} else if (x3c_dispType == EDisplayType::StatusMessage) {
|
|
|
|
if (x44_stringTable) {
|
2018-12-08 05:30:43 +00:00
|
|
|
MP1::CSamusHud::DisplayHudMemo((*x44_stringTable)->GetString(0), x34_parms);
|
2020-05-07 17:06:47 +00:00
|
|
|
} else {
|
2018-12-08 05:30:43 +00:00
|
|
|
MP1::CSamusHud::DisplayHudMemo(u"", x34_parms);
|
2020-05-07 17:06:47 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2018-05-10 02:56:54 +00:00
|
|
|
}
|
2020-05-07 17:06:47 +00:00
|
|
|
} else if (msg == EScriptObjectMessage::Deactivate && GetActive() && x3c_dispType == EDisplayType::StatusMessage) {
|
2018-12-08 05:30:43 +00:00
|
|
|
MP1::CSamusHud::DisplayHudMemo(u"", CHUDMemoParms(0.f, false, true, false));
|
2020-05-07 17:06:47 +00:00
|
|
|
}
|
2018-05-10 02:56:54 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
2018-05-10 02:56:54 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|