2019-12-22 12:04:07 -08:00
|
|
|
#include "Runtime/World/CScriptMemoryRelay.hpp"
|
|
|
|
|
2021-06-03 14:39:49 -07:00
|
|
|
#include "Runtime/CScriptMailbox.hpp"
|
2019-12-22 12:04:07 -08:00
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
|
2019-09-21 06:07:13 -07:00
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
2016-05-17 20:57:43 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2016-05-17 20:57:43 -07:00
|
|
|
|
2021-06-07 12:29:18 -07:00
|
|
|
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
|
|
|
bool defaultActive, bool skipSendActive, bool ignoreMessages)
|
2018-12-07 21:30:43 -08:00
|
|
|
: CEntity(uid, info, true, name)
|
2019-07-16 19:10:57 -07:00
|
|
|
, x34_24_defaultActive(defaultActive)
|
2018-12-07 21:30:43 -08:00
|
|
|
, x34_25_skipSendActive(skipSendActive)
|
|
|
|
, x34_26_ignoreMessages(ignoreMessages) {}
|
2016-05-17 20:57:43 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
void CScriptMemoryRelay::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
2017-01-14 19:07:01 -08:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) {
|
2020-05-07 10:05:21 -07:00
|
|
|
if (x34_26_ignoreMessages) {
|
2018-12-07 21:30:43 -08:00
|
|
|
return;
|
2020-05-07 10:05:21 -07:00
|
|
|
}
|
2016-07-24 23:24:57 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
if (msg == EScriptObjectMessage::Deactivate) {
|
2021-06-03 23:08:05 -07:00
|
|
|
stateMgr.GetMailbox()->RemoveMsg(xc_editorId);
|
2018-12-07 21:30:43 -08:00
|
|
|
return;
|
|
|
|
} else if (msg == EScriptObjectMessage::Activate) {
|
2021-06-03 23:08:05 -07:00
|
|
|
stateMgr.GetMailbox()->AddMsg(xc_editorId);
|
2020-05-07 10:05:21 -07:00
|
|
|
if (!x34_25_skipSendActive) {
|
2018-12-07 21:30:43 -08:00
|
|
|
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
|
2020-05-07 10:05:21 -07:00
|
|
|
}
|
2018-12-07 21:30:43 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
2016-05-17 20:57:43 -07:00
|
|
|
}
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|