Browse Source

common: cleanup port.h

pull/2/head
Alibek Omarov 3 years ago
parent
commit
4f89288ccf
  1. 87
      common/port.h
  2. 6
      engine/client/cl_main.c
  3. 2
      engine/client/cl_parse.c
  4. 2
      engine/client/cl_render.c
  5. 4
      engine/client/cl_tent.c
  6. 2
      engine/client/console.c
  7. 2
      engine/client/s_dsp.c
  8. 2
      engine/client/s_mix.c
  9. 4
      engine/common/filesystem.c
  10. 4
      engine/common/imagelib/img_utils.c
  11. 6
      engine/common/lib_common.c
  12. 2
      engine/common/system.c
  13. 2
      engine/platform/android/lib_android.c
  14. 3
      engine/platform/posix/lib_posix.c
  15. 2
      engine/platform/win32/con_win.c
  16. 2
      engine/server/sv_filter.c
  17. 3
      public/crtlib.c
  18. 3
      public/xash3d_mathlib.h
  19. 6
      ref_gl/gl_backend.c
  20. 4
      ref_gl/gl_decals.c
  21. 2
      ref_gl/gl_image.c
  22. 2
      ref_gl/gl_rmain.c
  23. 4
      ref_gl/gl_rsurf.c
  24. 4
      ref_soft/r_decals.c
  25. 2
      ref_soft/r_main.c

87
common/port.h

@ -20,8 +20,6 @@ GNU General Public License for more details.
#include "build.h" #include "build.h"
#if !XASH_WIN32 #if !XASH_WIN32
#if XASH_APPLE #if XASH_APPLE
#include <sys/syslimits.h> #include <sys/syslimits.h>
#define OS_LIB_EXT "dylib" #define OS_LIB_EXT "dylib"
@ -30,67 +28,38 @@ GNU General Public License for more details.
#define OS_LIB_EXT "so" #define OS_LIB_EXT "so"
#define OPEN_COMMAND "xdg-open" #define OPEN_COMMAND "xdg-open"
#endif #endif
#define OS_LIB_PREFIX "lib" #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 #define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT
// Windows-specific // Windows-specific
#define __cdecl #define __cdecl
#define __stdcall #define __stdcall
#define _inline static inline #define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline)) #define FORCEINLINE inline __attribute__((always_inline))
#if XASH_POSIX #if XASH_POSIX
#define PATH_SPLITTER "/" #include <unistd.h>
#include <unistd.h> #include <dlfcn.h>
#include <dlfcn.h>
#define O_BINARY 0 // O_BINARY is Windows extension #define PATH_SPLITTER "/"
#define O_TEXT 0 // O_TEXT is Windows extension #define HAVE_DUP
// Windows functions to posix equivalent
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) #define O_BINARY 0
#define LoadLibrary( x ) dlopen( x, RTLD_NOW ) #define O_TEXT 0
#define GetProcAddress( x, y ) dlsym( x, y ) #define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
#define FreeLibrary( x ) dlclose( x ) #define LoadLibrary( x ) dlopen( x, RTLD_NOW )
#define tell( a ) lseek(a, 0, SEEK_CUR) #define GetProcAddress( x, y ) dlsym( x, y )
#define HAVE_DUP #define FreeLibrary( x ) dlclose( x )
#endif #elif XASH_DOS4GW
#define PATH_SPLITTER "\\"
#if XASH_DOS4GW #define LoadLibrary( x ) (0)
#define PATH_SPLITTER "\\" #define GetProcAddress( x, y ) (0)
#define LoadLibrary( x ) (0) #define FreeLibrary( x ) (0)
#define GetProcAddress( x, y ) (0) #endif
#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;
typedef void* HANDLE; typedef void* HANDLE;
typedef void* HMODULE;
typedef void* HINSTANCE; typedef void* HINSTANCE;
typedef char* LPSTR;
typedef struct tagPOINT typedef struct tagPOINT
{ {
int x, y; int x, y;
@ -108,19 +77,6 @@ GNU General Public License for more details.
#define read _read #define read _read
#define alloca _alloca #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 HSPRITE WINAPI_HSPRITE
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <winsock2.h> #include <winsock2.h>
@ -130,12 +86,7 @@ GNU General Public License for more details.
#define OS_LIB_PREFIX "" #define OS_LIB_PREFIX ""
#define OS_LIB_EXT "dll" #define OS_LIB_EXT "dll"
#define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT #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 #define HAVE_DUP
#endif //WIN32 #endif //WIN32
#ifndef XASH_LOW_MEMORY #ifndef XASH_LOW_MEMORY

6
engine/client/cl_main.c

@ -243,7 +243,7 @@ void CL_SignonReply( void )
float CL_LerpInterval( 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 ) if( cl_interp->value > 0.001f )
{ {
// manual lerp value (goldsrc mode) // 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(); frac = td / CL_LerpInterval();
} }
else if( server_frametime > 0.001f ) else if( server_frametime > 0.001f )
@ -528,7 +528,7 @@ qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
if( released & ( IN_RIGHT|IN_MOVERIGHT )) if( released & ( IN_RIGHT|IN_MOVERIGHT ))
Cvar_SetValue( "r_showtextures", gl_showtextures->value + 1 ); Cvar_SetValue( "r_showtextures", gl_showtextures->value + 1 );
if( released & ( IN_LEFT|IN_MOVELEFT )) 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; oldbuttons = cmd->buttons;
return true; return true;

2
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.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.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.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 clgame.shake.next_shake = 0.0f; // apply immediately
} }

2
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; else cls.scrshot_action = scrshot_envshot;
// catch negative values // catch negative values
cls.envshot_viewsize = max( 0, shotsize ); cls.envshot_viewsize = Q_max( 0, shotsize );
} }
/* /*

4
engine/client/cl_tent.c

@ -361,8 +361,8 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
sound_t handle; sound_t handle;
if( isshellcasing ) if( isshellcasing )
fvol *= min ( 1.0f, ((float)zvel) / 350.0f ); fvol *= Q_min( 1.0f, ((float)zvel) / 350.0f );
else fvol *= min ( 1.0f, ((float)zvel) / 450.0f ); else fvol *= Q_min( 1.0f, ((float)zvel) / 450.0f );
if( !COM_RandomLong( 0, 3 ) && !isshellcasing ) if( !COM_RandomLong( 0, 3 ) && !isshellcasing )
pitch = COM_RandomLong( 95, 105 ); pitch = COM_RandomLong( 95, 105 );

2
engine/client/console.c

@ -2172,7 +2172,7 @@ void Con_DrawSolidConsole( int lines )
Con_DrawInput( lines ); Con_DrawInput( lines );
y = lines - ( con.curFont->charHeight * 1.2f ); 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 ); ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
} }

2
engine/client/s_dsp.c

@ -482,7 +482,7 @@ void DLY_CheckNewDelayVal( void )
} }
else else
{ {
delay = min( delay, MAX_MONO_DELAY ); delay = Q_min( delay, MAX_MONO_DELAY );
dly->delaysamples = (int)(delay * idsp_dma_speed) << sxhires; dly->delaysamples = (int)(delay * idsp_dma_speed) << sxhires;
// init dly // init dly

2
engine/client/s_mix.c

@ -809,7 +809,7 @@ void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_
// zero out all paintbuffers // zero out all paintbuffers
void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters ) void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
{ {
int count = min( SampleCount, PAINTBUFFER_SIZE ); int count = Q_min( SampleCount, PAINTBUFFER_SIZE );
int i; int i;
// zero out all paintbuffer data (ignore sampleCount) // zero out all paintbuffer data (ignore sampleCount)

4
engine/common/filesystem.c

@ -3649,8 +3649,8 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
slash = Q_strrchr( pattern, '/' ); slash = Q_strrchr( pattern, '/' );
backslash = Q_strrchr( pattern, '\\' ); backslash = Q_strrchr( pattern, '\\' );
colon = Q_strrchr( pattern, ':' ); colon = Q_strrchr( pattern, ':' );
separator = max( slash, backslash ); separator = Q_max( slash, backslash );
separator = max( separator, colon ); separator = Q_max( separator, colon );
basepathlength = separator ? (separator + 1 - pattern) : 0; basepathlength = separator ? (separator + 1 - pattern) : 0;
basepath = Mem_Calloc( fs_mempool, basepathlength + 1 ); basepath = Mem_Calloc( fs_mempool, basepathlength + 1 );
if( basepathlength ) memcpy( basepath, pattern, basepathlength ); if( basepathlength ) memcpy( basepath, pattern, basepathlength );

4
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]; g = palSrc[i*pal_size+1];
b = palSrc[i*pal_size+2]; b = palSrc[i*pal_size+2];
maxcol = max( max( r, g ), b ) / 255.0f; maxcol = Q_max( Q_max( r, g ), b ) / 255.0f;
mincol = min( min( r, g ), b ) / 255.0f; mincol = Q_min( Q_min( r, g ), b ) / 255.0f;
if( maxcol == 0 ) continue; if( maxcol == 0 ) continue;

6
engine/common/lib_common.c

@ -291,12 +291,12 @@ static char *COM_GetItaniumName( const char * const in_name )
len = len * 10 + ( *f - '0' ); len = len * 10 + ( *f - '0' );
// sane value // sane value
len = min( remaining, len ); len = Q_min( remaining, len );
if( len == 0 ) if( len == 0 )
goto invalid_format; 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; f += len;
remaining -= len; remaining -= len;
@ -361,7 +361,7 @@ char **COM_ConvertToLocalPlatform( EFunctionMangleType to, const char *from, siz
if( at ) len = (uint)( at - prev ); if( at ) len = (uint)( at - prev );
else len = (uint)Q_strlen( 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; prev = at + 1;
if( !at ) if( !at )

2
engine/common/system.c

@ -107,7 +107,7 @@ void Sys_Sleep( int msec )
if( !msec ) if( !msec )
return; return;
msec = min( msec, 1000 ); msec = Q_min( msec, 1000 );
Platform_Sleep( msec ); Platform_Sleep( msec );
} }

2
engine/platform/android/lib_android.c

@ -34,7 +34,7 @@ void *ANDROID_LoadLibrary( const char *dllname )
if( !libdir[i] ) if( !libdir[i] )
continue; 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 ); pHandle = dlopen( path, RTLD_LAZY );
if( pHandle ) if( pHandle )
return pHandle; return pHandle;

3
engine/platform/posix/lib_posix.c

@ -15,8 +15,7 @@ GNU General Public License for more details.
#define _GNU_SOURCE #define _GNU_SOURCE
#include "platform/platform.h" #include "platform/platform.h"
#if XASH_LIB == LIB_POSIX #if XASH_LIB == LIB_POSIX
#include <dlfcn.h>
#include "common.h" #include "common.h"
#include "library.h" #include "library.h"
#include "filesystem.h" #include "filesystem.h"

2
engine/platform/win32/con_win.c

@ -349,7 +349,7 @@ void Wcon_CreateConsole( void )
// create the scrollbuffer // create the scrollbuffer
GetClientRect( s_wcd.hWnd, &rect ); 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 ); SendMessage( s_wcd.hwndBuffer, WM_SETFONT, (WPARAM)s_wcd.hfBufferFont, 0 );
if( host.type == HOST_DEDICATED ) if( host.type == HOST_DEDICATED )

2
engine/server/sv_filter.c

@ -101,7 +101,7 @@ qboolean SV_CheckID( const char *id )
for( filter = cidfilter; filter; filter = filter->next ) for( filter = cidfilter; filter; filter = filter->next )
{ {
int len1 = Q_strlen( id ), len2 = Q_strlen( filter->id ); 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 ) while( filter->endTime && host.realtime > filter->endTime )
{ {

3
public/crtlib.c

@ -21,6 +21,7 @@ GNU General Public License for more details.
#include <time.h> #include <time.h>
#include "stdio.h" #include "stdio.h"
#include "crtlib.h" #include "crtlib.h"
#include "xash3d_mathlib.h"
void Q_strnupr( const char *in, char *out, size_t size_out ) 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" ); else Q_sprintf( suffix, " bytes" );
// clamp to >= 0 // clamp to >= 0
digitsafterdecimal = max( digitsafterdecimal, 0 ); digitsafterdecimal = Q_max( digitsafterdecimal, 0 );
// if it's basically integral, don't do any decimals // if it's basically integral, don't do any decimals
if( fabs( value - (int)value ) < 0.00001f ) if( fabs( value - (int)value ) < 0.00001f )

3
public/xash3d_mathlib.h

@ -22,6 +22,7 @@ GNU General Public License for more details.
#endif #endif
#include "build.h" #include "build.h"
#include "com_model.h"
#ifdef XASH_MSVC #ifdef XASH_MSVC
#pragma warning(disable : 4201) // nonstandard extension used #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 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 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 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 VectorAvg(a) ( ((a)[0] + (a)[1] + (a)[2]) / 3 )
#define VectorLength(a) ( sqrt( DotProduct( a, a ))) #define VectorLength(a) ( sqrt( DotProduct( a, a )))
#define VectorLength2(a) (DotProduct( a, a )) #define VectorLength2(a) (DotProduct( a, a ))

6
ref_gl/gl_backend.c

@ -300,7 +300,7 @@ GL_TexGen
*/ */
void GL_TexGen( GLenum coord, GLenum mode ) 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; int bit, gen;
switch( coord ) switch( coord )
@ -350,7 +350,7 @@ GL_SetTexCoordArrayMode
*/ */
void GL_SetTexCoordArrayMode( GLenum mode ) 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]; int bit, cmode = glState.texCoordArrayMode[tmu];
if( mode == GL_TEXTURE_COORD_ARRAY ) if( mode == GL_TEXTURE_COORD_ARRAY )
@ -656,7 +656,7 @@ rebuild_page:
if( i == MAX_TEXTURES && gl_showtextures->value != 1 ) if( i == MAX_TEXTURES && gl_showtextures->value != 1 )
{ {
// bad case, rewind to one and try again // 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 if( ++numTries < 2 ) goto rebuild_page; // to prevent infinite loop
} }

4
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 // Now figure out the part of the projection that intersects pDecal's
// clip box [0,0,1,1]. // clip box [0,0,1,1].
Vector2Set( vUnionMin, max( vDecalMin[0], 0 ), max( vDecalMin[1], 0 )); Vector2Set( vUnionMin, Q_max( vDecalMin[0], 0 ), Q_max( vDecalMin[1], 0 ));
Vector2Set( vUnionMax, min( vDecalMax[0], 1 ), min( vDecalMax[1], 1 )); 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 ) if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 )
{ {

2
ref_gl/gl_image.c

@ -1620,7 +1620,7 @@ int GL_LoadTextureArray( const char **names, int flags )
mipsize = srcsize = dstsize = 0; 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 width = Q_max( 1, ( pic->width >> j ));
int height = Q_max( 1, ( pic->height >> j )); int height = Q_max( 1, ( pic->height >> j ));

2
ref_gl/gl_rmain.c

@ -379,7 +379,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
RI.farClip = R_GetFarClip(); RI.farClip = R_GetFarClip();
zNear = 4.0f; 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 ); yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f );
yMin = -yMax; yMin = -yMax;

4
ref_gl/gl_rsurf.c

@ -2934,8 +2934,8 @@ static qboolean R_CheckLightMap( msurface_t *fa )
} }
else else
{ {
smax = min( smax, 132 ); smax = Q_min( smax, 132 );
tmax = min( tmax, 132 ); tmax = Q_min( tmax, 132 );
//Host_MapDesignError( "R_RenderBrushPoly: bad surface extents: %d %d", fa->extents[0], fa->extents[1] ); //Host_MapDesignError( "R_RenderBrushPoly: bad surface extents: %d %d", fa->extents[0], fa->extents[1] );
memset( temp, 255, sizeof( temp ) ); memset( temp, 255, sizeof( temp ) );
} }

4
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 // Now figure out the part of the projection that intersects pDecal's
// clip box [0,0,1,1]. // clip box [0,0,1,1].
Vector2Set( vUnionMin, max( vDecalMin[0], 0 ), max( vDecalMin[1], 0 )); Vector2Set( vUnionMin, Q_max( vDecalMin[0], 0 ), Q_max( vDecalMin[1], 0 ));
Vector2Set( vUnionMax, min( vDecalMax[0], 1 ), min( vDecalMax[1], 1 )); 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 ) if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 )
{ {

2
ref_soft/r_main.c

@ -496,7 +496,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
RI.farClip = R_GetFarClip(); RI.farClip = R_GetFarClip();
zNear = 4.0f; 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 ); yMax = zNear * tan( RI.fov_y * M_PI_F / 360.0f );
yMin = -yMax; yMin = -yMax;

Loading…
Cancel
Save