Merge pull request #108 from lioncash/case

CAutoMapper: Collapse case statements in ProcessMapZoomInput()
This commit is contained in:
Phillip Stephens 2019-10-13 13:12:20 -07:00 committed by GitHub
commit 76f90569ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
nextZoomState = EZoomState::In;
else if (out)
nextZoomState = EZoomState::Out;
break;
case EZoomState::In: case EZoomState::In:
if (in)
nextZoomState = EZoomState::In;
else if (out)
nextZoomState = EZoomState::Out;
break;
case EZoomState::Out: case EZoomState::Out:
if (in) if (in) {
nextZoomState = EZoomState::In; return EZoomState::In;
else if (out)
nextZoomState = EZoomState::Out;
break;
default:
break;
} }
if (out) {
return EZoomState::Out;
}
return EZoomState::None;
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;