mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-11 15:47:55 +00:00
engine, ref: RefAPI 5. Remove unused calls
This commit is contained in:
parent
7e9f87de2d
commit
9c66e86be1
@ -104,9 +104,9 @@ static void pfnGetPredictedOrigin( vec3_t v )
|
||||
VectorCopy( cl.simorg, v );
|
||||
}
|
||||
|
||||
static color24 *pfnCL_GetPaletteColor( int color ) // clgame.palette[color]
|
||||
static color24 *pfnCL_GetPaletteColor( void ) // clgame.palette[color]
|
||||
{
|
||||
return &clgame.palette[color];
|
||||
return clgame.palette;
|
||||
}
|
||||
|
||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||
@ -158,11 +158,6 @@ static int pfnGetStudioModelInterface( int version, struct r_studio_interface_s
|
||||
0;
|
||||
}
|
||||
|
||||
static poolhandle_t pfnImage_GetPool( void )
|
||||
{
|
||||
return host.imagepool;
|
||||
}
|
||||
|
||||
static const bpc_desc_t *pfnImage_GetPFDesc( int idx )
|
||||
{
|
||||
return &PFDesc[idx];
|
||||
@ -251,7 +246,6 @@ static ref_api_t gEngfuncs =
|
||||
Con_DrawString,
|
||||
CL_DrawCenterPrint,
|
||||
|
||||
CL_GetLocalPlayer,
|
||||
CL_GetViewModel,
|
||||
R_BeamGetEntity,
|
||||
CL_GetWaterEntity,
|
||||
@ -289,7 +283,6 @@ static ref_api_t gEngfuncs =
|
||||
COM_RandomFloat,
|
||||
COM_RandomLong,
|
||||
pfnRefGetScreenFade,
|
||||
CL_TextMessageGet,
|
||||
pfnGetPredictedOrigin,
|
||||
pfnCL_GetPaletteColor,
|
||||
pfnCL_GetScreenInfo,
|
||||
@ -353,7 +346,6 @@ static ref_api_t gEngfuncs =
|
||||
FS_CopyImage,
|
||||
FS_FreeImage,
|
||||
Image_SetMDLPointer,
|
||||
pfnImage_GetPool,
|
||||
pfnImage_GetPFDesc,
|
||||
|
||||
pfnDrawNormalTriangles,
|
||||
|
@ -34,7 +34,9 @@ GNU General Public License for more details.
|
||||
// 2. FS functions are removed, instead we have full fs_api_t
|
||||
// 3. SlerpBones, CalcBonePosition/Quaternion calls were moved to libpublic/mathlib
|
||||
// 4. R_StudioEstimateFrame now has time argument
|
||||
#define REF_API_VERSION 4
|
||||
// 5. Removed GetSomethingByIndex calls, renderers are supposed to cache pointer values.
|
||||
// Removed previously unused calls
|
||||
#define REF_API_VERSION 5
|
||||
|
||||
|
||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
||||
@ -299,7 +301,6 @@ typedef struct ref_api_s
|
||||
void (*CL_DrawCenterPrint)( void );
|
||||
|
||||
// entity management
|
||||
struct cl_entity_s *(*GetLocalPlayer)( void );
|
||||
struct cl_entity_s *(*GetViewModel)( void );
|
||||
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
||||
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
||||
@ -343,9 +344,8 @@ typedef struct ref_api_s
|
||||
float (*COM_RandomFloat)( float rmin, float rmax );
|
||||
int (*COM_RandomLong)( int rmin, int rmax );
|
||||
struct screenfade_s *(*GetScreenFade)( void );
|
||||
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
|
||||
void (*GetPredictedOrigin)( vec3_t v );
|
||||
color24 *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
|
||||
color24 *(*CL_GetPaletteColor)( void ); // clgame.palette[color]
|
||||
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
||||
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
||||
int (*Sys_CheckParm)( const char *flag );
|
||||
@ -419,7 +419,6 @@ typedef struct ref_api_s
|
||||
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
|
||||
void (*FS_FreeImage)( rgbdata_t *pack );
|
||||
void (*Image_SetMDLPointer)( byte *p );
|
||||
poolhandle_t (*Image_GetPool)( void );
|
||||
const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );
|
||||
|
||||
// client exports
|
||||
|
@ -427,7 +427,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
||||
skin.encode = DXT_ENCODE_DEFAULT;
|
||||
skin.numMips = 1;
|
||||
skin.buffer = data;
|
||||
skin.palette = (byte *)gEngfuncs.CL_GetPaletteColor( 0 );
|
||||
skin.palette = (byte *)tr.palette;
|
||||
skin.size = width * height;
|
||||
|
||||
if( !gEngfuncs.Image_CustomPalette() )
|
||||
@ -1261,7 +1261,7 @@ static void R_AliasDrawAbsBBox( cl_entity_t *e, const vec3_t absmin, const vec3_
|
||||
int i;
|
||||
|
||||
// looks ugly, skip
|
||||
if( r_drawentities->value != 5 || e == gEngfuncs.GetViewModel() )
|
||||
if( r_drawentities->value != 5 || e == tr.viewent )
|
||||
return;
|
||||
|
||||
// compute a full bounding box
|
||||
|
@ -42,7 +42,7 @@ R_CullModel
|
||||
*/
|
||||
int R_CullModel( cl_entity_t *e, const vec3_t absmin, const vec3_t absmax )
|
||||
{
|
||||
if( e == gEngfuncs.GetViewModel() )
|
||||
if( e == tr.viewent )
|
||||
{
|
||||
if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW ))
|
||||
return 1;
|
||||
|
@ -1668,11 +1668,11 @@ int GL_LoadTextureArray( const char **names, int flags )
|
||||
else
|
||||
{
|
||||
// create new image
|
||||
pic = Mem_Malloc( gEngfuncs.Image_GetPool(), sizeof( rgbdata_t ));
|
||||
pic = Mem_Malloc( r_temppool, sizeof( rgbdata_t ));
|
||||
memcpy( pic, src, sizeof( rgbdata_t ));
|
||||
|
||||
// expand pic buffer for all layers
|
||||
pic->buffer = Mem_Malloc( gEngfuncs.Image_GetPool(), pic->size * numLayers );
|
||||
pic->buffer = Mem_Malloc( r_temppool, pic->size * numLayers );
|
||||
pic->depth = 0;
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,8 @@ typedef struct
|
||||
cl_entity_t *entities;
|
||||
movevars_t *movevars;
|
||||
model_t **models;
|
||||
color24 *palette;
|
||||
cl_entity_t *viewent;
|
||||
|
||||
uint max_entities;
|
||||
} gl_globals_t;
|
||||
|
@ -1288,6 +1288,8 @@ qboolean R_Init( void )
|
||||
tr.world = gEngfuncs.GetWorld();
|
||||
tr.models = gEngfuncs.pfnGetModels();
|
||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
||||
tr.viewent = gEngfuncs.GetViewModel();
|
||||
|
||||
GL_SetDefaults();
|
||||
R_CheckVBO();
|
||||
|
@ -49,7 +49,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
||||
{
|
||||
particle_t *p;
|
||||
vec3_t right, up;
|
||||
color24 *pColor;
|
||||
color24 сolor;
|
||||
int alpha;
|
||||
float size;
|
||||
|
||||
@ -85,15 +85,15 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
||||
VectorScale( RI.cull_vup, size, up );
|
||||
|
||||
p->color = bound( 0, p->color, 255 );
|
||||
pColor = gEngfuncs.CL_GetPaletteColor( p->color );
|
||||
сolor = tr.palette[p->color];
|
||||
|
||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
||||
if( alpha > 255 || p->type == pt_static )
|
||||
alpha = 255;
|
||||
|
||||
pglColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
|
||||
gEngfuncs.LightToTexGamma( pColor->g ),
|
||||
gEngfuncs.LightToTexGamma( pColor->b ), alpha );
|
||||
pglColor4ub( gEngfuncs.LightToTexGamma( сolor.r ),
|
||||
gEngfuncs.LightToTexGamma( сolor.g ),
|
||||
gEngfuncs.LightToTexGamma( сolor.b ), alpha );
|
||||
|
||||
pglTexCoord2f( 0.0f, 1.0f );
|
||||
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
||||
@ -205,7 +205,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
{
|
||||
vec3_t verts[4], tmp2;
|
||||
vec3_t tmp, normal;
|
||||
color24 *pColor;
|
||||
color24 color;
|
||||
|
||||
// Transform point into screen space
|
||||
TriWorldToScreen( start, screen );
|
||||
@ -235,8 +235,8 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
p->color = 0;
|
||||
}
|
||||
|
||||
pColor = &gTracerColors[p->color];
|
||||
pglColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
|
||||
color = gTracerColors[p->color];
|
||||
pglColor4ub( color.r, color.g, color.b, p->packedColor );
|
||||
|
||||
pglBegin( GL_QUADS );
|
||||
pglTexCoord2f( 0.0f, 0.8f );
|
||||
|
@ -196,7 +196,7 @@ static qboolean R_AllowFlipViewModel( cl_entity_t *e )
|
||||
{
|
||||
if( cl_righthand && cl_righthand->value > 0 )
|
||||
{
|
||||
if( e == gEngfuncs.GetViewModel() )
|
||||
if( e == tr.viewent )
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ pfnGetViewEntity
|
||||
*/
|
||||
static cl_entity_t *pfnGetViewEntity( void )
|
||||
{
|
||||
return gEngfuncs.GetViewModel();
|
||||
return tr.viewent;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2488,7 +2488,7 @@ static void R_StudioDrawAbsBBox( void )
|
||||
int i;
|
||||
|
||||
// looks ugly, skip
|
||||
if( RI.currententity == gEngfuncs.GetViewModel() )
|
||||
if( RI.currententity == tr.viewent )
|
||||
return;
|
||||
|
||||
if( !R_StudioComputeBBox( p ))
|
||||
@ -3605,7 +3605,7 @@ void R_RunViewmodelEvents( void )
|
||||
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
|
||||
return;
|
||||
|
||||
RI.currententity = gEngfuncs.GetViewModel();
|
||||
RI.currententity = tr.viewent;
|
||||
|
||||
if( !RI.currententity->model || RI.currententity->model->type != mod_studio )
|
||||
return;
|
||||
@ -3627,7 +3627,7 @@ R_GatherPlayerLight
|
||||
*/
|
||||
void R_GatherPlayerLight( void )
|
||||
{
|
||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
||||
cl_entity_t *view = tr.viewent;
|
||||
colorVec c;
|
||||
|
||||
tr.ignore_lightgamma = true;
|
||||
@ -3643,7 +3643,7 @@ R_DrawViewModel
|
||||
*/
|
||||
void R_DrawViewModel( void )
|
||||
{
|
||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
||||
cl_entity_t *view = tr.viewent;
|
||||
|
||||
R_GatherPlayerLight();
|
||||
|
||||
|
@ -298,6 +298,8 @@ typedef struct
|
||||
cl_entity_t *entities;
|
||||
movevars_t *movevars;
|
||||
model_t **models;
|
||||
color24 *palette;
|
||||
cl_entity_t *viewent;
|
||||
|
||||
uint max_entities;
|
||||
} gl_globals_t;
|
||||
|
@ -1941,6 +1941,8 @@ qboolean GAME_EXPORT R_Init( void )
|
||||
// see R_ProcessEntData for tr.entities initialization
|
||||
tr.models = gEngfuncs.pfnGetModels();
|
||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
||||
tr.viewent = gEngfuncs.GetViewModel();
|
||||
|
||||
R_InitBlit( glblit );
|
||||
|
||||
|
@ -49,7 +49,7 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
|
||||
{
|
||||
particle_t *p;
|
||||
vec3_t right, up;
|
||||
color24 *pColor;
|
||||
color24 color;
|
||||
int alpha;
|
||||
float size;
|
||||
|
||||
@ -84,17 +84,17 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
|
||||
VectorScale( RI.cull_vup, size, up );
|
||||
|
||||
p->color = bound( 0, p->color, 255 );
|
||||
pColor = gEngfuncs.CL_GetPaletteColor( p->color );
|
||||
color = tr.palette[p->color];
|
||||
|
||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
||||
if( alpha > 255 || p->type == pt_static )
|
||||
alpha = 255;
|
||||
|
||||
//TriColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
|
||||
// gEngfuncs.LightToTexGamma( pColor->g ),
|
||||
// gEngfuncs.LightToTexGamma( pColor->b ), alpha );
|
||||
//TriColor4ub( gEngfuncs.LightToTexGamma( color.r ),
|
||||
// gEngfuncs.LightToTexGamma( color.g ),
|
||||
// gEngfuncs.LightToTexGamma( color.b ), alpha );
|
||||
//TriBrightness( alpha / 255.0f );
|
||||
_TriColor4f(1.0f*alpha/255/255*pColor->r,1.0f*alpha/255/255*pColor->g,1.0f*alpha/255/255* pColor->b,1.0f );
|
||||
_TriColor4f(1.0f*alpha/255/255*color.r,1.0f*alpha/255/255*color.g,1.0f*alpha/255/255* color.b,1.0f );
|
||||
|
||||
TriBegin( TRI_QUADS );
|
||||
TriTexCoord2f( 0.0f, 1.0f );
|
||||
@ -211,7 +211,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
{
|
||||
vec3_t verts[4], tmp2;
|
||||
vec3_t tmp, normal;
|
||||
color24 *pColor;
|
||||
color24 color;
|
||||
short alpha = p->packedColor;
|
||||
|
||||
// Transform point into screen space
|
||||
@ -242,9 +242,9 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
p->color = 0;
|
||||
}
|
||||
|
||||
pColor = &gTracerColors[p->color];
|
||||
//TriColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
|
||||
_TriColor4f(1.0f*alpha/255/255*pColor->r,1.0f*alpha/255/255*pColor->g,1.0f*alpha/255/255* pColor->b,1.0f );
|
||||
color = gTracerColors[p->color];
|
||||
//TriColor4ub( color.r, color.g, color.b, p->packedColor );
|
||||
_TriColor4f(1.0f*alpha/255/255*color.r,1.0f*alpha/255/255*color.g,1.0f*alpha/255/255* color.b,1.0f );
|
||||
|
||||
|
||||
TriBegin( TRI_QUADS );
|
||||
|
@ -185,7 +185,7 @@ static qboolean R_AllowFlipViewModel( cl_entity_t *e )
|
||||
{
|
||||
if( cl_righthand && cl_righthand->value > 0 )
|
||||
{
|
||||
if( e == gEngfuncs.GetViewModel() )
|
||||
if( e == tr.viewent )
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ pfnGetViewEntity
|
||||
*/
|
||||
static cl_entity_t *pfnGetViewEntity( void )
|
||||
{
|
||||
return gEngfuncs.GetViewModel();
|
||||
return tr.viewent;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2246,7 +2246,7 @@ static void R_StudioDrawAbsBBox( void )
|
||||
int i;
|
||||
|
||||
// looks ugly, skip
|
||||
if( RI.currententity == gEngfuncs.GetViewModel() )
|
||||
if( RI.currententity == tr.viewent )
|
||||
return;
|
||||
|
||||
if( !R_StudioComputeBBox( p ))
|
||||
@ -3371,7 +3371,7 @@ void R_RunViewmodelEvents( void )
|
||||
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
|
||||
return;
|
||||
|
||||
RI.currententity = gEngfuncs.GetViewModel();
|
||||
RI.currententity = tr.viewent;
|
||||
|
||||
if( !RI.currententity->model || RI.currententity->model->type != mod_studio )
|
||||
return;
|
||||
@ -3393,7 +3393,7 @@ R_GatherPlayerLight
|
||||
*/
|
||||
void R_GatherPlayerLight( void )
|
||||
{
|
||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
||||
cl_entity_t *view = tr.viewent;
|
||||
colorVec c;
|
||||
|
||||
tr.ignore_lightgamma = true;
|
||||
@ -3409,7 +3409,7 @@ R_DrawViewModel
|
||||
*/
|
||||
void R_DrawViewModel( void )
|
||||
{
|
||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
||||
cl_entity_t *view = tr.viewent;
|
||||
|
||||
R_GatherPlayerLight();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user