CScriptCameraHintTrigger: Brace statements where applicable

Same behavior, more consistent code.
This commit is contained in:
Lioncash 2020-05-07 07:45:05 -04:00
parent ed231b85e9
commit a8fd2a1992
1 changed files with 11 additions and 6 deletions

View File

@ -21,33 +21,38 @@ CScriptCameraHintTrigger::CScriptCameraHintTrigger(TUniqueId uid, bool active, s
void CScriptCameraHintTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); } void CScriptCameraHintTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptCameraHintTrigger::Think(float dt, CStateManager& mgr) { void CScriptCameraHintTrigger::Think(float dt, CStateManager& mgr) {
if (!GetActive()) if (!GetActive()) {
return; return;
}
if (x130_26_playerInside && !x130_27_playerWasInside) { if (x130_26_playerInside && !x130_27_playerWasInside) {
x130_27_playerWasInside = true; x130_27_playerWasInside = true;
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
if (x130_24_deactivateOnEnter) if (x130_24_deactivateOnEnter) {
mgr.SendScriptMsg(this, kInvalidUniqueId, EScriptObjectMessage::Deactivate); mgr.SendScriptMsg(this, kInvalidUniqueId, EScriptObjectMessage::Deactivate);
}
} }
if (!x130_26_playerInside && x130_27_playerWasInside) { if (!x130_26_playerInside && x130_27_playerWasInside) {
x130_27_playerWasInside = false; x130_27_playerWasInside = false;
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
if (x130_25_deactivateOnExit) if (x130_25_deactivateOnExit) {
mgr.SendScriptMsg(this, kInvalidUniqueId, EScriptObjectMessage::Deactivate); mgr.SendScriptMsg(this, kInvalidUniqueId, EScriptObjectMessage::Deactivate);
}
} }
if (x130_26_playerInside) if (x130_26_playerInside) {
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
}
x130_26_playerInside = false; x130_26_playerInside = false;
} }
void CScriptCameraHintTrigger::Touch(CActor& other, CStateManager& mgr) { void CScriptCameraHintTrigger::Touch(CActor& other, CStateManager& mgr) {
if (TCastToPtr<CPlayer>(other)) { if (TCastToConstPtr<CPlayer>(other)) {
if (auto tb = other.GetTouchBounds()) if (const auto tb = other.GetTouchBounds()) {
x130_26_playerInside = xe8_obb.OBBIntersectsBox(zeus::COBBox::FromAABox(*tb, {})); x130_26_playerInside = xe8_obb.OBBIntersectsBox(zeus::COBBox::FromAABox(*tb, {}));
}
} }
} }