2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 05:47:42 +00:00

Formatting, and more script object implementations

This commit is contained in:
2016-12-19 10:27:58 -08:00
parent 03a93c52b9
commit 37aab51253
55 changed files with 921 additions and 978 deletions

View File

@@ -0,0 +1,35 @@
#include "CScriptSwitch.hpp"
#include "CStateManager.hpp"
namespace urde
{
CScriptSwitch::CScriptSwitch(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool active, bool opened,
bool closeOnOpened)
: CEntity(uid, info, active, name), x34_opened(opened), x35_closeOnOpened(closeOnOpened)
{
}
void CScriptSwitch::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
if (GetActive())
{
if (msg == EScriptObjectMessage::Open)
x34_opened = true;
else if (msg == EScriptObjectMessage::Close)
x34_opened = false;
else if (msg == EScriptObjectMessage::SetToZero)
{
if (x34_opened)
{
SendScriptMsgs(EScriptObjectState::Open, mgr, EScriptObjectMessage::None);
if (x35_closeOnOpened)
x34_opened = false;
}
else
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
}
}
CEntity::AcceptScriptMsg(msg, objId, mgr);
}
}