From 4f89288ccf5a3f84ebf30de2cb57267b90c1f3b2 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 23 Dec 2021 19:17:11 +0300 Subject: [PATCH] common: cleanup port.h --- common/port.h | 87 ++++++--------------------- engine/client/cl_main.c | 6 +- engine/client/cl_parse.c | 2 +- engine/client/cl_render.c | 2 +- engine/client/cl_tent.c | 4 +- engine/client/console.c | 2 +- engine/client/s_dsp.c | 2 +- engine/client/s_mix.c | 2 +- engine/common/filesystem.c | 4 +- engine/common/imagelib/img_utils.c | 4 +- engine/common/lib_common.c | 6 +- engine/common/system.c | 2 +- engine/platform/android/lib_android.c | 2 +- engine/platform/posix/lib_posix.c | 3 +- engine/platform/win32/con_win.c | 2 +- engine/server/sv_filter.c | 2 +- public/crtlib.c | 3 +- public/xash3d_mathlib.h | 3 +- ref_gl/gl_backend.c | 6 +- ref_gl/gl_decals.c | 4 +- ref_gl/gl_image.c | 2 +- ref_gl/gl_rmain.c | 2 +- ref_gl/gl_rsurf.c | 4 +- ref_soft/r_decals.c | 4 +- ref_soft/r_main.c | 2 +- 25 files changed, 57 insertions(+), 105 deletions(-) diff --git a/common/port.h b/common/port.h index 9b6317ce..435de115 100644 --- a/common/port.h +++ b/common/port.h @@ -20,8 +20,6 @@ GNU General Public License for more details. #include "build.h" #if !XASH_WIN32 - - #if XASH_APPLE #include #define OS_LIB_EXT "dylib" @@ -30,67 +28,38 @@ GNU General Public License for more details. #define OS_LIB_EXT "so" #define OPEN_COMMAND "xdg-open" #endif - #define OS_LIB_PREFIX "lib" - - #if XASH_ANDROID - //#if defined(LOAD_HARDFP) - // #define POSTFIX "_hardfp" - //#else - #define POSTFIX - //#endif - #else - #endif - #define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT // Windows-specific #define __cdecl #define __stdcall - #define _inline static inline #define FORCEINLINE inline __attribute__((always_inline)) -#if XASH_POSIX - #define PATH_SPLITTER "/" - #include - #include - #define O_BINARY 0 // O_BINARY is Windows extension - #define O_TEXT 0 // O_TEXT is Windows extension - // Windows functions to posix equivalent - #define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) - #define LoadLibrary( x ) dlopen( x, RTLD_NOW ) - #define GetProcAddress( x, y ) dlsym( x, y ) - #define FreeLibrary( x ) dlclose( x ) - #define tell( a ) lseek(a, 0, SEEK_CUR) - #define HAVE_DUP -#endif - -#if XASH_DOS4GW - #define PATH_SPLITTER "\\" - #define LoadLibrary( x ) (0) - #define GetProcAddress( x, y ) (0) - #define FreeLibrary( x ) (0) -#endif - //#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8))) - #define max( a, b ) (((a) > (b)) ? (a) : (b)) - #define min( a, b ) (((a) < (b)) ? (a) : (b)) - - /// TODO: check if we may clean this defines, it should not appear in non-platform code! - typedef unsigned char BYTE; - typedef short int WORD; - typedef unsigned int DWORD; - typedef int LONG; - typedef unsigned int ULONG; - typedef int WPARAM; - typedef unsigned int LPARAM; + #if XASH_POSIX + #include + #include + + #define PATH_SPLITTER "/" + #define HAVE_DUP + + #define O_BINARY 0 + #define O_TEXT 0 + #define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) + #define LoadLibrary( x ) dlopen( x, RTLD_NOW ) + #define GetProcAddress( x, y ) dlsym( x, y ) + #define FreeLibrary( x ) dlclose( x ) + #elif XASH_DOS4GW + #define PATH_SPLITTER "\\" + #define LoadLibrary( x ) (0) + #define GetProcAddress( x, y ) (0) + #define FreeLibrary( x ) (0) + #endif typedef void* HANDLE; - typedef void* HMODULE; typedef void* HINSTANCE; - typedef char* LPSTR; - typedef struct tagPOINT { int x, y; @@ -108,19 +77,6 @@ GNU General Public License for more details. #define read _read #define alloca _alloca - // shut-up compiler warnings - #pragma warning(disable : 4244) // MIPS - #pragma warning(disable : 4018) // signed/unsigned mismatch - #pragma warning(disable : 4305) // truncation from const double to float - #pragma warning(disable : 4115) // named type definition in parentheses - #pragma warning(disable : 4100) // unreferenced formal parameter - #pragma warning(disable : 4127) // conditional expression is constant - #pragma warning(disable : 4057) // differs in indirection to slightly different base types - #pragma warning(disable : 4201) // nonstandard extension used - #pragma warning(disable : 4706) // assignment within conditional expression - #pragma warning(disable : 4054) // type cast' : from function pointer - #pragma warning(disable : 4310) // cast truncates constant value - #define HSPRITE WINAPI_HSPRITE #define WIN32_LEAN_AND_MEAN #include @@ -130,12 +86,7 @@ GNU General Public License for more details. #define OS_LIB_PREFIX "" #define OS_LIB_EXT "dll" #define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT - #ifdef XASH_64BIT - // windows NameForFunction not implemented yet - #define XASH_ALLOW_SAVERESTORE_OFFSETS - #endif #define HAVE_DUP - #endif //WIN32 #ifndef XASH_LOW_MEMORY diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 0cc2790a..c4a3b9f9 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -243,7 +243,7 @@ void CL_SignonReply( void ) float CL_LerpInterval( void ) { - return max( cl_interp->value, 1.f / cl_updaterate->value ); + return Q_max( cl_interp->value, 1.f / cl_updaterate->value ); } /* @@ -296,7 +296,7 @@ static float CL_LerpPoint( void ) if( cl_interp->value > 0.001f ) { // manual lerp value (goldsrc mode) - float td = max( 0.f, cl.time - cl.mtime[0] ); + float td = Q_max( 0.f, cl.time - cl.mtime[0] ); frac = td / CL_LerpInterval(); } else if( server_frametime > 0.001f ) @@ -528,7 +528,7 @@ qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd ) if( released & ( IN_RIGHT|IN_MOVERIGHT )) Cvar_SetValue( "r_showtextures", gl_showtextures->value + 1 ); if( released & ( IN_LEFT|IN_MOVELEFT )) - Cvar_SetValue( "r_showtextures", max( 1, gl_showtextures->value - 1 )); + Cvar_SetValue( "r_showtextures", Q_max( 1, gl_showtextures->value - 1 )); oldbuttons = cmd->buttons; return true; diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 997edebc..24dc19d7 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1819,7 +1819,7 @@ void CL_ParseScreenShake( sizebuf_t *msg ) clgame.shake.amplitude = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12)); clgame.shake.duration = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<12)); clgame.shake.frequency = (float)(word)MSG_ReadShort( msg ) * (1.0f / (float)(1<<8)); - clgame.shake.time = cl.time + max( clgame.shake.duration, 0.01f ); + clgame.shake.time = cl.time + Q_max( clgame.shake.duration, 0.01f ); clgame.shake.next_shake = 0.0f; // apply immediately } diff --git a/engine/client/cl_render.c b/engine/client/cl_render.c index 88a25f69..9af5aec7 100644 --- a/engine/client/cl_render.c +++ b/engine/client/cl_render.c @@ -117,7 +117,7 @@ static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, else cls.scrshot_action = scrshot_envshot; // catch negative values - cls.envshot_viewsize = max( 0, shotsize ); + cls.envshot_viewsize = Q_max( 0, shotsize ); } /* diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 6c9aeb47..89d74aa5 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -361,8 +361,8 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp ) sound_t handle; if( isshellcasing ) - fvol *= min ( 1.0f, ((float)zvel) / 350.0f ); - else fvol *= min ( 1.0f, ((float)zvel) / 450.0f ); + fvol *= Q_min( 1.0f, ((float)zvel) / 350.0f ); + else fvol *= Q_min( 1.0f, ((float)zvel) / 450.0f ); if( !COM_RandomLong( 0, 3 ) && !isshellcasing ) pitch = COM_RandomLong( 95, 105 ); diff --git a/engine/client/console.c b/engine/client/console.c index c908972e..34fbce4f 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -2172,7 +2172,7 @@ void Con_DrawSolidConsole( int lines ) Con_DrawInput( lines ); y = lines - ( con.curFont->charHeight * 1.2f ); - SCR_DrawFPS( max( y, 4 )); // to avoid to hide fps counter + SCR_DrawFPS( Q_max( y, 4 )); // to avoid to hide fps counter ref.dllFuncs.Color4ub( 255, 255, 255, 255 ); } diff --git a/engine/client/s_dsp.c b/engine/client/s_dsp.c index 39a54d4d..4d57675c 100644 --- a/engine/client/s_dsp.c +++ b/engine/client/s_dsp.c @@ -482,7 +482,7 @@ void DLY_CheckNewDelayVal( void ) } else { - delay = min( delay, MAX_MONO_DELAY ); + delay = Q_min( delay, MAX_MONO_DELAY ); dly->delaysamples = (int)(delay * idsp_dma_speed) << sxhires; // init dly diff --git a/engine/client/s_mix.c b/engine/client/s_mix.c index f79f7aee..8cceac98 100644 --- a/engine/client/s_mix.c +++ b/engine/client/s_mix.c @@ -809,7 +809,7 @@ void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_ // zero out all paintbuffers void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters ) { - int count = min( SampleCount, PAINTBUFFER_SIZE ); + int count = Q_min( SampleCount, PAINTBUFFER_SIZE ); int i; // zero out all paintbuffer data (ignore sampleCount) diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index ff1139c3..e3c3e402 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -3649,8 +3649,8 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly ) slash = Q_strrchr( pattern, '/' ); backslash = Q_strrchr( pattern, '\\' ); colon = Q_strrchr( pattern, ':' ); - separator = max( slash, backslash ); - separator = max( separator, colon ); + separator = Q_max( slash, backslash ); + separator = Q_max( separator, colon ); basepathlength = separator ? (separator + 1 - pattern) : 0; basepath = Mem_Calloc( fs_mempool, basepathlength + 1 ); if( basepathlength ) memcpy( basepath, pattern, basepathlength ); diff --git a/engine/common/imagelib/img_utils.c b/engine/common/imagelib/img_utils.c index 49976277..5ff568cf 100644 --- a/engine/common/imagelib/img_utils.c +++ b/engine/common/imagelib/img_utils.c @@ -456,8 +456,8 @@ void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int g = palSrc[i*pal_size+1]; b = palSrc[i*pal_size+2]; - maxcol = max( max( r, g ), b ) / 255.0f; - mincol = min( min( r, g ), b ) / 255.0f; + maxcol = Q_max( Q_max( r, g ), b ) / 255.0f; + mincol = Q_min( Q_min( r, g ), b ) / 255.0f; if( maxcol == 0 ) continue; diff --git a/engine/common/lib_common.c b/engine/common/lib_common.c index 9fd9e31e..e18161db 100644 --- a/engine/common/lib_common.c +++ b/engine/common/lib_common.c @@ -291,12 +291,12 @@ static char *COM_GetItaniumName( const char * const in_name ) len = len * 10 + ( *f - '0' ); // sane value - len = min( remaining, len ); + len = Q_min( remaining, len ); if( len == 0 ) goto invalid_format; - Q_strncpy( symbols[i], f, min( len + 1, sizeof( out_name ))); + Q_strncpy( symbols[i], f, Q_min( len + 1, sizeof( out_name ))); f += len; remaining -= len; @@ -361,7 +361,7 @@ char **COM_ConvertToLocalPlatform( EFunctionMangleType to, const char *from, siz if( at ) len = (uint)( at - prev ); else len = (uint)Q_strlen( prev ); - Q_strncpy( symbols[i], prev, min( len + 1, sizeof( symbols[i] ))); + Q_strncpy( symbols[i], prev, Q_min( len + 1, sizeof( symbols[i] ))); prev = at + 1; if( !at ) diff --git a/engine/common/system.c b/engine/common/system.c index ff62096a..b2a0a659 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -107,7 +107,7 @@ void Sys_Sleep( int msec ) if( !msec ) return; - msec = min( msec, 1000 ); + msec = Q_min( msec, 1000 ); Platform_Sleep( msec ); } diff --git a/engine/platform/android/lib_android.c b/engine/platform/android/lib_android.c index 143552d7..506c4e70 100644 --- a/engine/platform/android/lib_android.c +++ b/engine/platform/android/lib_android.c @@ -34,7 +34,7 @@ void *ANDROID_LoadLibrary( const char *dllname ) if( !libdir[i] ) continue; - Q_snprintf( path, MAX_SYSPATH, "%s/lib%s"POSTFIX"."OS_LIB_EXT, libdir[i], dllname ); + Q_snprintf( path, MAX_SYSPATH, "%s/lib%s."OS_LIB_EXT, libdir[i], dllname ); pHandle = dlopen( path, RTLD_LAZY ); if( pHandle ) return pHandle; diff --git a/engine/platform/posix/lib_posix.c b/engine/platform/posix/lib_posix.c index 9e6af461..c4026706 100644 --- a/engine/platform/posix/lib_posix.c +++ b/engine/platform/posix/lib_posix.c @@ -15,8 +15,7 @@ GNU General Public License for more details. #define _GNU_SOURCE #include "platform/platform.h" #if XASH_LIB == LIB_POSIX - - +#include #include "common.h" #include "library.h" #include "filesystem.h" diff --git a/engine/platform/win32/con_win.c b/engine/platform/win32/con_win.c index 1605c9f8..74d5a0a5 100644 --- a/engine/platform/win32/con_win.c +++ b/engine/platform/win32/con_win.c @@ -349,7 +349,7 @@ void Wcon_CreateConsole( void ) // create the scrollbuffer GetClientRect( s_wcd.hWnd, &rect ); - s_wcd.hwndBuffer = CreateWindowEx( WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE, "edit", NULL, CONSTYLE, 0, 0, rect.right - rect.left, min(365, rect.bottom), s_wcd.hWnd, (HMENU)EDIT_ID, host.hInst, NULL ); + s_wcd.hwndBuffer = CreateWindowEx( WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE, "edit", NULL, CONSTYLE, 0, 0, rect.right - rect.left, Q_min(365, rect.bottom), s_wcd.hWnd, (HMENU)EDIT_ID, host.hInst, NULL ); SendMessage( s_wcd.hwndBuffer, WM_SETFONT, (WPARAM)s_wcd.hfBufferFont, 0 ); if( host.type == HOST_DEDICATED ) diff --git a/engine/server/sv_filter.c b/engine/server/sv_filter.c index b36908b2..fa7164a0 100644 --- a/engine/server/sv_filter.c +++ b/engine/server/sv_filter.c @@ -101,7 +101,7 @@ qboolean SV_CheckID( const char *id ) for( filter = cidfilter; filter; filter = filter->next ) { int len1 = Q_strlen( id ), len2 = Q_strlen( filter->id ); - int len = min( len1, len2 ); + int len = Q_min( len1, len2 ); while( filter->endTime && host.realtime > filter->endTime ) { diff --git a/public/crtlib.c b/public/crtlib.c index 9aca2cf6..e92e2d82 100644 --- a/public/crtlib.c +++ b/public/crtlib.c @@ -21,6 +21,7 @@ GNU General Public License for more details. #include #include "stdio.h" #include "crtlib.h" +#include "xash3d_mathlib.h" void Q_strnupr( const char *in, char *out, size_t size_out ) { @@ -651,7 +652,7 @@ char *Q_pretifymem( float value, int digitsafterdecimal ) else Q_sprintf( suffix, " bytes" ); // clamp to >= 0 - digitsafterdecimal = max( digitsafterdecimal, 0 ); + digitsafterdecimal = Q_max( digitsafterdecimal, 0 ); // if it's basically integral, don't do any decimals if( fabs( value - (int)value ) < 0.00001f ) diff --git a/public/xash3d_mathlib.h b/public/xash3d_mathlib.h index 4e37788b..b2ae966f 100644 --- a/public/xash3d_mathlib.h +++ b/public/xash3d_mathlib.h @@ -22,6 +22,7 @@ GNU General Public License for more details. #endif #include "build.h" +#include "com_model.h" #ifdef XASH_MSVC #pragma warning(disable : 4201) // nonstandard extension used @@ -104,7 +105,7 @@ GNU General Public License for more details. #define VectorScale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale)) #define VectorCompare(v1,v2) ((v1)[0]==(v2)[0] && (v1)[1]==(v2)[1] && (v1)[2]==(v2)[2]) #define VectorDivide( in, d, out ) VectorScale( in, (1.0f / (d)), out ) -#define VectorMax(a) ( max((a)[0], max((a)[1], (a)[2])) ) +#define VectorMax(a) ( Q_max((a)[0], Q_max((a)[1], (a)[2])) ) #define VectorAvg(a) ( ((a)[0] + (a)[1] + (a)[2]) / 3 ) #define VectorLength(a) ( sqrt( DotProduct( a, a ))) #define VectorLength2(a) (DotProduct( a, a )) diff --git a/ref_gl/gl_backend.c b/ref_gl/gl_backend.c index ffc56ab0..88881f9f 100644 --- a/ref_gl/gl_backend.c +++ b/ref_gl/gl_backend.c @@ -300,7 +300,7 @@ GL_TexGen */ void GL_TexGen( GLenum coord, GLenum mode ) { - int tmu = min( glConfig.max_texture_coords, glState.activeTMU ); + int tmu = Q_min( glConfig.max_texture_coords, glState.activeTMU ); int bit, gen; switch( coord ) @@ -350,7 +350,7 @@ GL_SetTexCoordArrayMode */ void GL_SetTexCoordArrayMode( GLenum mode ) { - int tmu = min( glConfig.max_texture_coords, glState.activeTMU ); + int tmu = Q_min( glConfig.max_texture_coords, glState.activeTMU ); int bit, cmode = glState.texCoordArrayMode[tmu]; if( mode == GL_TEXTURE_COORD_ARRAY ) @@ -656,7 +656,7 @@ rebuild_page: if( i == MAX_TEXTURES && gl_showtextures->value != 1 ) { // bad case, rewind to one and try again - gEngfuncs.Cvar_SetValue( "r_showtextures", max( 1, gl_showtextures->value - 1 )); + gEngfuncs.Cvar_SetValue( "r_showtextures", Q_max( 1, gl_showtextures->value - 1 )); if( ++numTries < 2 ) goto rebuild_page; // to prevent infinite loop } diff --git a/ref_gl/gl_decals.c b/ref_gl/gl_decals.c index 2266df1e..c9e70983 100644 --- a/ref_gl/gl_decals.c +++ b/ref_gl/gl_decals.c @@ -476,8 +476,8 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int // Now figure out the part of the projection that intersects pDecal's // clip box [0,0,1,1]. - Vector2Set( vUnionMin, max( vDecalMin[0], 0 ), max( vDecalMin[1], 0 )); - Vector2Set( vUnionMax, min( vDecalMax[0], 1 ), min( vDecalMax[1], 1 )); + Vector2Set( vUnionMin, Q_max( vDecalMin[0], 0 ), Q_max( vDecalMin[1], 0 )); + Vector2Set( vUnionMax, Q_min( vDecalMax[0], 1 ), Q_min( vDecalMax[1], 1 )); if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 ) { diff --git a/ref_gl/gl_image.c b/ref_gl/gl_image.c index 643325d9..ee006a5a 100644 --- a/ref_gl/gl_image.c +++ b/ref_gl/gl_image.c @@ -1620,7 +1620,7 @@ int GL_LoadTextureArray( const char **names, int flags ) mipsize = srcsize = dstsize = 0; - for( j = 0; j < max( 1, pic->numMips ); j++ ) + for( j = 0; j < Q_max( 1, pic->numMips ); j++ ) { int width = Q_max( 1, ( pic->width >> j )); int height = Q_max( 1, ( pic->height >> j )); diff --git a/ref_gl/gl_rmain.c b/ref_gl/gl_rmain.c index 664bbcc0..21eabbdc 100644 --- a/ref_gl/gl_rmain.c +++ b/ref_gl/gl_rmain.c @@ -379,7 +379,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m ) RI.farClip = R_GetFarClip(); zNear = 4.0f; - zFar = max( 256.0f, RI.farClip ); + zFar = Q_max( 256.0f, RI.farClip ); yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f ); yMin = -yMax; diff --git a/ref_gl/gl_rsurf.c b/ref_gl/gl_rsurf.c index 297296d1..d9f3d4ae 100644 --- a/ref_gl/gl_rsurf.c +++ b/ref_gl/gl_rsurf.c @@ -2934,8 +2934,8 @@ static qboolean R_CheckLightMap( msurface_t *fa ) } else { - smax = min( smax, 132 ); - tmax = min( tmax, 132 ); + smax = Q_min( smax, 132 ); + tmax = Q_min( tmax, 132 ); //Host_MapDesignError( "R_RenderBrushPoly: bad surface extents: %d %d", fa->extents[0], fa->extents[1] ); memset( temp, 255, sizeof( temp ) ); } diff --git a/ref_soft/r_decals.c b/ref_soft/r_decals.c index 04370cd8..49fa6111 100644 --- a/ref_soft/r_decals.c +++ b/ref_soft/r_decals.c @@ -480,8 +480,8 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int // Now figure out the part of the projection that intersects pDecal's // clip box [0,0,1,1]. - Vector2Set( vUnionMin, max( vDecalMin[0], 0 ), max( vDecalMin[1], 0 )); - Vector2Set( vUnionMax, min( vDecalMax[0], 1 ), min( vDecalMax[1], 1 )); + Vector2Set( vUnionMin, Q_max( vDecalMin[0], 0 ), Q_max( vDecalMin[1], 0 )); + Vector2Set( vUnionMax, Q_min( vDecalMax[0], 1 ), Q_min( vDecalMax[1], 1 )); if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 ) { diff --git a/ref_soft/r_main.c b/ref_soft/r_main.c index 829304ef..96a1d160 100644 --- a/ref_soft/r_main.c +++ b/ref_soft/r_main.c @@ -496,7 +496,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m ) RI.farClip = R_GetFarClip(); zNear = 4.0f; - zFar = max( 256.0f, RI.farClip ); + zFar = Q_max( 256.0f, RI.farClip ); yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f ); yMin = -yMax;