Browse Source

engine: change RenderAPI's RenderGetParm return type to intptr_t to insure compatibility with 64-bit

pull/2/head
Alibek Omarov 2 years ago
parent
commit
69b0954007
  1. 2
      common/render_api.h
  2. 8
      engine/client/cl_render.c
  3. 2
      engine/client/client.h
  4. 2
      engine/client/ref_common.c
  5. 2
      engine/ref_api.h

2
common/render_api.h

@ -161,7 +161,7 @@ struct ref_viewpass_s;
typedef struct render_api_s typedef struct render_api_s
{ {
// Get renderer info (doesn't changes engine state at all) // Get renderer info (doesn't changes engine state at all)
int (*RenderGetParm)( int parm, int arg ); // generic intptr_t (*RenderGetParm)( int parm, int arg ); // generic
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha ); void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
lightstyle_t* (*GetLightStyle)( int number ); lightstyle_t* (*GetLightStyle)( int number );

8
engine/client/cl_render.c

@ -133,7 +133,7 @@ const char *CL_GenericHandle( int fileindex )
return cl.files_precache[fileindex]; return cl.files_precache[fileindex];
} }
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef ) intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
{ {
switch( parm ) switch( parm )
{ {
@ -161,9 +161,9 @@ int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
case PARM_WATER_ALPHA: case PARM_WATER_ALPHA:
return FBitSet( world.flags, FWORLD_WATERALPHA ); return FBitSet( world.flags, FWORLD_WATERALPHA );
case PARM_DELUXEDATA: case PARM_DELUXEDATA:
return *(int *)&world.deluxedata; return (intptr_t)world.deluxedata;
case PARM_SHADOWDATA: case PARM_SHADOWDATA:
return *(int *)&world.shadowdata; return (intptr_t)world.shadowdata;
default: default:
// indicates call from client.dll // indicates call from client.dll
if( checkRef ) if( checkRef )
@ -204,7 +204,7 @@ int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
return 0; return 0;
} }
static int pfnRenderGetParm( int parm, int arg ) static intptr_t pfnRenderGetParm( int parm, int arg )
{ {
return CL_RenderGetParm( parm, arg, true ); return CL_RenderGetParm( parm, arg, true );
} }

2
engine/client/client.h

@ -964,7 +964,7 @@ void CL_ClearAllRemaps( void );
// cl_render.c // cl_render.c
// //
qboolean R_InitRenderAPI( void ); qboolean R_InitRenderAPI( void );
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef ); intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef );
lightstyle_t *CL_GetLightStyle( int number ); lightstyle_t *CL_GetLightStyle( int number );
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis ); int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
const ref_overview_t *GL_GetOverviewParms( void ); const ref_overview_t *GL_GetOverviewParms( void );

2
engine/client/ref_common.c

@ -60,7 +60,7 @@ void GL_RenderFrame( const ref_viewpass_t *rvp )
ref.dllFuncs.GL_RenderFrame( rvp ); ref.dllFuncs.GL_RenderFrame( rvp );
} }
static int pfnEngineGetParm( int parm, int arg ) static intptr_t pfnEngineGetParm( int parm, int arg )
{ {
return CL_RenderGetParm( parm, arg, false ); // prevent recursion return CL_RenderGetParm( parm, arg, false ); // prevent recursion
} }

2
engine/ref_api.h

@ -256,7 +256,7 @@ typedef enum
typedef struct ref_api_s typedef struct ref_api_s
{ {
int (*EngineGetParm)( int parm, int arg ); // generic intptr_t (*EngineGetParm)( int parm, int arg ); // generic
// cvar handlers // cvar handlers
cvar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description ); cvar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );

Loading…
Cancel
Save