From 8ab2f0b3081f53692836035aedd2546b607decc8 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Mon, 2 Feb 2015 00:14:07 +0100 Subject: fix some usages of abs(), part 1: non-gamelogic-changing changes detected by Clang changes in tr_main.c reviewed by SmileTheory --- src/cgame/cg_buildable.c | 3 +-- src/renderergl2/tr_main.c | 4 ++-- src/ui/ui_shared.c | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 5aae1d20..ca170fd6 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -897,8 +897,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) VectorCopy( cent->lerpOrigin, origin ); // center point - origin[ 2 ] += mins[ 2 ]; - origin[ 2 ] += ( abs( mins[ 2 ] ) + abs( maxs[ 2 ] ) ) / 2; + origin[ 2 ] += ( mins[ 2 ] + maxs[ 2 ] ) / 2; entNum = cg.predictedPlayerState.clientNum; diff --git a/src/renderergl2/tr_main.c b/src/renderergl2/tr_main.c index 9751ecb3..3fc7c06c 100644 --- a/src/renderergl2/tr_main.c +++ b/src/renderergl2/tr_main.c @@ -2363,7 +2363,7 @@ void R_RenderPshadowMaps(const refdef_t *fd) VectorScale(lightDir, -1.0f, shadow->lightViewAxis[0]); VectorSet(up, 0, 0, -1); - if ( abs(DotProduct(up, shadow->lightViewAxis[0])) > 0.9f ) + if ( fabsf(DotProduct(up, shadow->lightViewAxis[0])) > 0.9f ) { VectorSet(up, -1, 0, 0); } @@ -2606,7 +2606,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level) } // Check if too close to parallel to light direction - if (abs(DotProduct(lightViewAxis[2], lightViewAxis[0])) > 0.9f) + if (fabsf(DotProduct(lightViewAxis[2], lightViewAxis[0])) > 0.9f) { if (level == 3 || lightViewIndependentOfCameraView) { diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 2b491579..b027b513 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1689,10 +1689,10 @@ void Menu_TransitionItemByName( menuDef_t *menu, const char *p, rectDef_t rectFr item->window.offsetTime = time; memcpy( &item->window.rectClient, &rectFrom, sizeof( rectDef_t ) ); memcpy( &item->window.rectEffects, &rectTo, sizeof( rectDef_t ) ); - item->window.rectEffects2.x = abs( rectTo.x - rectFrom.x ) / amt; - item->window.rectEffects2.y = abs( rectTo.y - rectFrom.y ) / amt; - item->window.rectEffects2.w = abs( rectTo.w - rectFrom.w ) / amt; - item->window.rectEffects2.h = abs( rectTo.h - rectFrom.h ) / amt; + item->window.rectEffects2.x = fabs( rectTo.x - rectFrom.x ) / amt; + item->window.rectEffects2.y = fabs( rectTo.y - rectFrom.y ) / amt; + item->window.rectEffects2.w = fabs( rectTo.w - rectFrom.w ) / amt; + item->window.rectEffects2.h = fabs( rectTo.h - rectFrom.h ) / amt; Item_UpdatePosition( item ); } } -- cgit