CScriptWorldTeleporter: Unindent code in StartTransition()

We can make use of an early-return to unindent code by one level.
This commit is contained in:
Lioncash 2020-05-03 10:28:25 -04:00
parent d0233b7767
commit 40ede53949
1 changed files with 21 additions and 19 deletions

View File

@ -97,27 +97,29 @@ void CScriptWorldTeleporter::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
} }
void CScriptWorldTeleporter::StartTransition(CStateManager& mgr) { void CScriptWorldTeleporter::StartTransition(CStateManager& mgr) {
if (!x40_25_inTransition) { if (x40_25_inTransition) {
const auto& transMgr = mgr.WorldTransManager(); return;
switch (x3c_type) { }
case ETeleporterType::NoTransition:
transMgr->DisableTransition(); const auto& transMgr = mgr.WorldTransManager();
break; switch (x3c_type) {
case ETeleporterType::Elevator: case ETeleporterType::NoTransition:
if (x50_playerAnim.GetACSFile().IsValid() && x50_playerAnim.GetCharacter() != u32(-1)) { transMgr->DisableTransition();
transMgr->EnableTransition(CAnimRes(x50_playerAnim.GetACSFile(), x50_playerAnim.GetCharacter(), x5c_playerScale, break;
x50_playerAnim.GetInitialAnimation(), true), case ETeleporterType::Elevator:
x68_platformModel, x6c_platformScale, x78_backgroundModel, x7c_backgroundScale, if (x50_playerAnim.GetACSFile().IsValid() && x50_playerAnim.GetCharacter() != u32(-1)) {
x40_24_upElevator); transMgr->EnableTransition(CAnimRes(x50_playerAnim.GetACSFile(), x50_playerAnim.GetCharacter(), x5c_playerScale,
x40_25_inTransition = true; x50_playerAnim.GetInitialAnimation(), true),
} x68_platformModel, x6c_platformScale, x78_backgroundModel, x7c_backgroundScale,
break; x40_24_upElevator);
case ETeleporterType::Text:
transMgr->EnableTransition(x8c_fontId, x90_stringId, 0, x40_27_fadeWhite, x44_charFadeIn, x48_charsPerSecond,
x4c_showDelay);
x40_25_inTransition = true; x40_25_inTransition = true;
break;
} }
break;
case ETeleporterType::Text:
transMgr->EnableTransition(x8c_fontId, x90_stringId, 0, x40_27_fadeWhite, x44_charFadeIn, x48_charsPerSecond,
x4c_showDelay);
x40_25_inTransition = true;
break;
} }
} }