CScriptMazeNode: Implement Reset

This commit is contained in:
Luke Street 2020-09-19 13:44:32 -04:00
parent e486e01b2a
commit 529e8f6a07
2 changed files with 13 additions and 2 deletions

View File

@ -50,8 +50,7 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
mgr.SetIsGeneratingObject(true);
const auto genObj = mgr.GenerateObject(conn.x8_objId);
mgr.SetIsGeneratingObject(wasGeneratingObject);
auto* actor = static_cast<CActor*>(mgr.ObjectById(genObj.second));
if (actor != nullptr) {
if (auto* actor = static_cast<CActor*>(mgr.ObjectById(genObj.second))) {
mgr.SendScriptMsg(actor, GetUniqueId(), EScriptObjectMessage::Activate);
if (scriptEffect) {
actor->SetTranslation(GetTranslation() + x120_effectPos);
@ -69,4 +68,15 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
}
}
}
void CScriptMazeNode::Reset(CStateManager& mgr) {
mgr.FreeScriptObject(x11c_effectId);
mgr.FreeScriptObject(xfc_actorId);
mgr.FreeScriptObject(x10c_triggerId);
mgr.FreeScriptObject(xf4_);
xf4_ = kInvalidUniqueId;
xfc_actorId = kInvalidUniqueId;
x10c_triggerId = kInvalidUniqueId;
x11c_effectId = kInvalidUniqueId;
}
} // namespace urde

View File

@ -61,5 +61,6 @@ public:
private:
void GenerateObjects(CStateManager& mgr);
void Reset(CStateManager& mgr);
};
} // namespace urde