Use helper for bounding check
This commit is contained in:
parent
ed8484f096
commit
f11e787ef3
|
@ -122,6 +122,19 @@ extern const ushort acos_table[258];
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
static inline void clamp_fix_lh(fix& f, const fix& low, const fix& high)
|
||||
{
|
||||
if (f < low)
|
||||
f = low;
|
||||
else if (high < f)
|
||||
f = high;
|
||||
}
|
||||
|
||||
static inline void clamp_fix_symmetric(fix& f, const fix& bound)
|
||||
{
|
||||
clamp_fix_lh(f, -bound, bound);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -774,12 +774,9 @@ static int automap_process_input(window *wind, d_event *event, automap *am)
|
|||
vm_vec_scale_add2( &am->view_position, &am->viewMatrix.rvec, am->controls.sideways_thrust_time*SLIDE_SPEED );
|
||||
|
||||
// Crude wrapping check
|
||||
if (am->view_position.x > F1_0*32000) am->view_position.x = F1_0*32000;
|
||||
if (am->view_position.x < -F1_0*32000) am->view_position.x = -F1_0*32000;
|
||||
if (am->view_position.y > F1_0*32000) am->view_position.y = F1_0*32000;
|
||||
if (am->view_position.y < -F1_0*32000) am->view_position.y = -F1_0*32000;
|
||||
if (am->view_position.z > F1_0*32000) am->view_position.z = F1_0*32000;
|
||||
if (am->view_position.z < -F1_0*32000) am->view_position.z = -F1_0*32000;
|
||||
clamp_fix_symmetric(am->view_position.x, F1_0*32000);
|
||||
clamp_fix_symmetric(am->view_position.y, F1_0*32000);
|
||||
clamp_fix_symmetric(am->view_position.z, F1_0*32000);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue