fix some abs() type conversion warnings

This commit is contained in:
Taylor Richards committed 2025-08-18 11:56:39 -04:00
1 parent 21c9b65c99
commit 908f306985
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -204,7 +204,7 @@ bool ik_constraint_window::constrain(matrix& localRot, bool /*backwardsPass*/) c
//Clamp absolute value of individual angles to window
for (float angles::* i : pbh) {
const float absAngle = abs(currentAngles.*i);
const float absAngle = std::abs(currentAngles.*i);
if(absAngle > absLimit.*i){
needsClamp = true;
currentAngles.*i = copysignf(std::min(absAngle, absLimit.*i), currentAngles.*i);
+2 -2
View File
@@ -1065,7 +1065,7 @@ float get_submodel_delta_angle(const submodel_instance *smi)
float get_submodel_delta_shift(const submodel_instance *smi)
{
// this is a bit simpler
return abs(smi->cur_offset - smi->prev_offset);
return std::abs(smi->cur_offset - smi->prev_offset);
}
void do_new_subsystem( int n_subsystems, model_subsystem *slist, int subobj_num, float rad, const vec3d *pnt, char *props, const char *subobj_name, int model_num )
@@ -4388,7 +4388,7 @@ void submodel_look_at(polymodel *pm, polymodel_instance *pmi, int submodel_num)
// calculate turn rate
// (try to avoid a one-frame dramatic spike in the turn rate if the angle passes 0.0 or PI2)
if (abs(smi->cur_angle - smi->prev_angle) < PI)
if (std::abs(smi->cur_angle - smi->prev_angle) < PI)
smi->current_turn_rate = smi->desired_turn_rate = (smi->cur_angle - smi->prev_angle) / flFrametime;
// and now set the other submodel fields
+1 -1
View File
@@ -1249,7 +1249,7 @@ bool physics_lead_ballistic_trajectory(const vec3d* start, const vec3d* end_pos,
time = range / (weapon_speed * cosf(angle));
if (abs(time - best_guess_time) < 0.01f)
if (std::abs(time - best_guess_time) < 0.01f)
break;
else
best_guess_time = time;