CHudFreeLookInterface: Collapse conditional within SetFreeLookState()

Same behavior, less code.
This commit is contained in:
Lioncash 2020-03-29 02:01:06 -04:00
parent 59fbefbd58
commit ad07b993c8
1 changed files with 5 additions and 11 deletions

View File

@ -84,13 +84,9 @@ void CHudFreeLookInterface::SetFreeLookState(bool inFreeLook, bool lookControlHe
x8c_basewidget_outlinesb->SetColor(color); x8c_basewidget_outlinesb->SetColor(color);
} }
if (totalInterp == 0.f) { const bool visible = totalInterp != 0.0f;
x74_basewidget_freelookleft->SetVisibility(false, ETraversalMode::Children); x74_basewidget_freelookleft->SetVisibility(visible, ETraversalMode::Children);
x80_basewidget_freelookright->SetVisibility(false, ETraversalMode::Children); x80_basewidget_freelookright->SetVisibility(visible, ETraversalMode::Children);
} else {
x74_basewidget_freelookleft->SetVisibility(true, ETraversalMode::Children);
x80_basewidget_freelookright->SetVisibility(true, ETraversalMode::Children);
}
} }
CHudFreeLookInterfaceXRay::CHudFreeLookInterfaceXRay(CGuiFrame& selHud, bool inFreeLook, bool lookControlHeld, CHudFreeLookInterfaceXRay::CHudFreeLookInterfaceXRay(CGuiFrame& selHud, bool inFreeLook, bool lookControlHeld,
@ -146,10 +142,8 @@ void CHudFreeLookInterfaceXRay::SetFreeLookState(bool inFreeLook, bool lookContr
color.a() = x1c_freeLookInterp; color.a() = x1c_freeLookInterp;
x24_basewidget_freelook->SetColor(color); x24_basewidget_freelook->SetColor(color);
if (x1c_freeLookInterp == 0.f) const bool visible = x1c_freeLookInterp != 0.0f;
x24_basewidget_freelook->SetVisibility(false, ETraversalMode::Children); x24_basewidget_freelook->SetVisibility(visible, ETraversalMode::Children);
else
x24_basewidget_freelook->SetVisibility(true, ETraversalMode::Children);
} }
} // namespace urde } // namespace urde