CAutoMapper: Collapse case statements in ProcessMapZoomInput()

Same behavior as the game executable, but without the code duplication.
This commit is contained in:
Lioncash 2019-10-12 13:52:37 -04:00
parent c4ecf972f5
commit 040c724a8a
1 changed files with 17 additions and 23 deletions

View File

@ -615,31 +615,25 @@ void CAutoMapper::ProcessMapZoomInput(const CFinalInput& input, const CStateMana
} }
} }
EZoomState nextZoomState = EZoomState::None; const EZoomState nextZoomState = [this, in, out] {
switch (x324_zoomState) { switch (x324_zoomState) {
case EZoomState::None: case EZoomState::None:
if (in) case EZoomState::In:
nextZoomState = EZoomState::In; case EZoomState::Out:
else if (out) if (in) {
nextZoomState = EZoomState::Out; return EZoomState::In;
break; }
case EZoomState::In: if (out) {
if (in) return EZoomState::Out;
nextZoomState = EZoomState::In; }
else if (out) return EZoomState::None;
nextZoomState = EZoomState::Out;
break;
case EZoomState::Out:
if (in)
nextZoomState = EZoomState::In;
else if (out)
nextZoomState = EZoomState::Out;
break;
default:
break;
}
default:
return EZoomState::None;
}
}();
x324_zoomState = nextZoomState; x324_zoomState = nextZoomState;
float delta = input.DeltaTime() * 60.f * (x1bc_state == EAutoMapperState::MapScreen ? 1.f : 4.f) * float delta = input.DeltaTime() * 60.f * (x1bc_state == EAutoMapperState::MapScreen ? 1.f : 4.f) *
g_tweakAutoMapper->GetCamZoomUnitsPerFrame() * zoomSpeed; g_tweakAutoMapper->GetCamZoomUnitsPerFrame() * zoomSpeed;
float oldDist = xa8_renderStates[0].x18_camDist; float oldDist = xa8_renderStates[0].x18_camDist;