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) {
if (!x40_25_inTransition) {
const auto& transMgr = mgr.WorldTransManager();
switch (x3c_type) {
case ETeleporterType::NoTransition:
transMgr->DisableTransition();
break;
case ETeleporterType::Elevator:
if (x50_playerAnim.GetACSFile().IsValid() && x50_playerAnim.GetCharacter() != u32(-1)) {
transMgr->EnableTransition(CAnimRes(x50_playerAnim.GetACSFile(), x50_playerAnim.GetCharacter(), x5c_playerScale,
x50_playerAnim.GetInitialAnimation(), true),
x68_platformModel, x6c_platformScale, x78_backgroundModel, x7c_backgroundScale,
x40_24_upElevator);
x40_25_inTransition = true;
}
break;
case ETeleporterType::Text:
transMgr->EnableTransition(x8c_fontId, x90_stringId, 0, x40_27_fadeWhite, x44_charFadeIn, x48_charsPerSecond,
x4c_showDelay);
if (x40_25_inTransition) {
return;
}
const auto& transMgr = mgr.WorldTransManager();
switch (x3c_type) {
case ETeleporterType::NoTransition:
transMgr->DisableTransition();
break;
case ETeleporterType::Elevator:
if (x50_playerAnim.GetACSFile().IsValid() && x50_playerAnim.GetCharacter() != u32(-1)) {
transMgr->EnableTransition(CAnimRes(x50_playerAnim.GetACSFile(), x50_playerAnim.GetCharacter(), x5c_playerScale,
x50_playerAnim.GetInitialAnimation(), true),
x68_platformModel, x6c_platformScale, x78_backgroundModel, x7c_backgroundScale,
x40_24_upElevator);
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;
}
}