From 9231cb92836ebfe99b2742b5ca38a89dc5f818f9 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 22 Apr 2013 19:43:09 +1000 Subject: [PATCH] add some casts so gcc can pick an overloaded abs/max/min func --- code/cgame/FxScheduler.cpp | 4 ++-- code/cgame/cg_credits.cpp | 2 +- code/client/cl_cin.cpp | 2 +- code/client/cl_input.cpp | 4 ++-- code/ui/ui_main.cpp | 4 ++-- code/ui/ui_shared.cpp | 24 ++++++++++++------------ 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/code/cgame/FxScheduler.cpp b/code/cgame/FxScheduler.cpp index 0528836..092dbc5 100644 --- a/code/cgame/FxScheduler.cpp +++ b/code/cgame/FxScheduler.cpp @@ -980,7 +980,7 @@ void CFxScheduler::PlayEffect( const char *file, int clientID, bool isPortal ) if ( prim->mSpawnFlags & FX_EVEN_DISTRIBUTION ) { - factor = abs(prim->mSpawnDelay.GetMax() - prim->mSpawnDelay.GetMin()) / (float)count; + factor = abs((long)(prim->mSpawnDelay.GetMax() - prim->mSpawnDelay.GetMin())) / (float)count; } // Schedule the random number of bits @@ -1296,7 +1296,7 @@ void CFxScheduler::PlayEffect( int id, vec3_t origin, vec3_t axis[3], const int if ( prim->mSpawnFlags & FX_EVEN_DISTRIBUTION ) { - factor = abs(prim->mSpawnDelay.GetMax() - prim->mSpawnDelay.GetMin()) / (float)count; + factor = abs((long)(prim->mSpawnDelay.GetMax() - prim->mSpawnDelay.GetMin())) / (float)count; } // Schedule the random number of bits diff --git a/code/cgame/cg_credits.cpp b/code/cgame/cg_credits.cpp index 7894b12..191e2a0 100644 --- a/code/cgame/cg_credits.cpp +++ b/code/cgame/cg_credits.cpp @@ -605,7 +605,7 @@ qboolean CG_Credits_Draw( void ) int iYpos = SCREEN_HEIGHT + (CreditLine.iLine * iFontHeight); iYpos-= (int) (fPixelsPerSecond * fSecondsElapsed); - int iTextLinesThisItem = max(CreditLine.vstrText.size(),1); + int iTextLinesThisItem = max((int)CreditLine.vstrText.size(),1); if (iYpos + (iTextLinesThisItem * iFontHeight) < 0) { // scrolled off top of screen, so erase it... diff --git a/code/client/cl_cin.cpp b/code/client/cl_cin.cpp index 94d2fc6..39d17b7 100644 --- a/code/client/cl_cin.cpp +++ b/code/client/cl_cin.cpp @@ -1323,7 +1323,7 @@ e_status CIN_RunCinematic (int handle) } thisTime = Sys_Milliseconds()*com_timescale->value; - if (cinTable[currentHandle].shader && (abs(thisTime - cinTable[currentHandle].lastTime))>100) { + if (cinTable[currentHandle].shader && (abs((long)(thisTime - cinTable[currentHandle].lastTime)))>100) { cinTable[currentHandle].startTime += thisTime - cinTable[currentHandle].lastTime; } cinTable[currentHandle].tfps = ((((Sys_Milliseconds()*com_timescale->value) - cinTable[currentHandle].startTime)*cinTable[currentHandle].roqFPS)/1000); diff --git a/code/client/cl_input.cpp b/code/client/cl_input.cpp index 4d8b21e..52116ca 100644 --- a/code/client/cl_input.cpp +++ b/code/client/cl_input.cpp @@ -802,10 +802,10 @@ usercmd_t CL_CreateCmd( void ) { #ifndef _XBOX if ( cl_debugMove->integer ) { if ( cl_debugMove->integer == 1 ) { - SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 ); + SCR_DebugGraph( abs((long)(cl.viewangles[YAW] - oldAngles[YAW])), 0 ); } if ( cl_debugMove->integer == 2 ) { - SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 ); + SCR_DebugGraph( abs((long)(cl.viewangles[PITCH] - oldAngles[PITCH])), 0 ); } } #endif diff --git a/code/ui/ui_main.cpp b/code/ui/ui_main.cpp index 59a9558..9b2f35b 100644 --- a/code/ui/ui_main.cpp +++ b/code/ui/ui_main.cpp @@ -583,8 +583,8 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha // now print the cursor as well... // char sTemp[1024]; - int iCopyCount = min(strlen(text), cursorPos); - iCopyCount = min(iCopyCount,sizeof(sTemp)); + int iCopyCount = min((int)strlen(text), cursorPos); + iCopyCount = min(iCopyCount,(int)sizeof(sTemp)); // copy text into temp buffer for pixel measure... // diff --git a/code/ui/ui_shared.cpp b/code/ui/ui_shared.cpp index 976936a..fb833c3 100644 --- a/code/ui/ui_shared.cpp +++ b/code/ui/ui_shared.cpp @@ -1787,10 +1787,10 @@ void Menu_TransitionItemByName(menuDef_t *menu, const char *p, const rectDef_t * 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 = abs((int)(rectTo->x - rectFrom->x)) / amt; + item->window.rectEffects2.y = abs((int)(rectTo->y - rectFrom->y)) / amt; + item->window.rectEffects2.w = abs((int)(rectTo->w - rectFrom->w)) / amt; + item->window.rectEffects2.h = abs((int)(rectTo->h - rectFrom->h)) / amt; Item_UpdatePosition(item); } } @@ -1837,17 +1837,17 @@ void Menu_Transition3ItemByName(menuDef_t *menu, const char *p, const float minx // VectorSet(modelptr->g2maxs2, maxx, maxy, maxz); - modelptr->g2maxsEffect[0] = abs(modelptr->g2maxs2[0] - modelptr->g2maxs[0]) / amt; - modelptr->g2maxsEffect[1] = abs(modelptr->g2maxs2[1] - modelptr->g2maxs[1]) / amt; - modelptr->g2maxsEffect[2] = abs(modelptr->g2maxs2[2] - modelptr->g2maxs[2]) / amt; + modelptr->g2maxsEffect[0] = abs((long)(modelptr->g2maxs2[0] - modelptr->g2maxs[0])) / amt; + modelptr->g2maxsEffect[1] = abs((long)(modelptr->g2maxs2[1] - modelptr->g2maxs[1])) / amt; + modelptr->g2maxsEffect[2] = abs((long)(modelptr->g2maxs2[2] - modelptr->g2maxs[2])) / amt; - modelptr->g2minsEffect[0] = abs(modelptr->g2mins2[0] - modelptr->g2mins[0]) / amt; - modelptr->g2minsEffect[1] = abs(modelptr->g2mins2[1] - modelptr->g2mins[1]) / amt; - modelptr->g2minsEffect[2] = abs(modelptr->g2mins2[2] - modelptr->g2mins[2]) / amt; + modelptr->g2minsEffect[0] = abs((long)(modelptr->g2mins2[0] - modelptr->g2mins[0])) / amt; + modelptr->g2minsEffect[1] = abs((long)(modelptr->g2mins2[1] - modelptr->g2mins[1])) / amt; + modelptr->g2minsEffect[2] = abs((long)(modelptr->g2mins2[2] - modelptr->g2mins[2])) / amt; - modelptr->fov_Effectx = abs(modelptr->fov_x2 - modelptr->fov_x) / amt; - modelptr->fov_Effecty = abs(modelptr->fov_y2 - modelptr->fov_y) / amt; + modelptr->fov_Effectx = abs((long)(modelptr->fov_x2 - modelptr->fov_x)) / amt; + modelptr->fov_Effecty = abs((long)(modelptr->fov_y2 - modelptr->fov_y)) / amt; } }