Browse Source

engine: remove Set/GetCurrentLoadingModel from RefAPI

pull/2/head
Alibek Omarov 1 year ago
parent
commit
30d1492b93
  1. 12
      engine/client/ref_common.c
  2. 2
      engine/common/mod_bmodel.c
  3. 4
      engine/ref_api.h
  4. 19
      ref/gl/gl_alias.c
  5. 2
      ref/gl/gl_local.h
  6. 12
      ref/gl/gl_rsurf.c
  7. 2
      ref/soft/r_context.c

12
engine/client/ref_common.c

@ -98,16 +98,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
return NULL; return NULL;
} }
static model_t *pfnMod_GetCurrentLoadingModel( void )
{
return loadmodel;
}
static void pfnMod_SetCurrentLoadingModel( model_t *m )
{
loadmodel = m;
}
static void pfnGetPredictedOrigin( vec3_t v ) static void pfnGetPredictedOrigin( vec3_t v )
{ {
VectorCopy( cl.simorg, v ); VectorCopy( cl.simorg, v );
@ -282,8 +272,6 @@ static ref_api_t gEngfuncs =
Mod_ForName, Mod_ForName,
pfnMod_Extradata, pfnMod_Extradata,
CL_ModelHandle, CL_ModelHandle,
pfnMod_GetCurrentLoadingModel,
pfnMod_SetCurrentLoadingModel,
CL_GetRemapInfoForEntity, CL_GetRemapInfoForEntity,
CL_AllocRemapInfo, CL_AllocRemapInfo,

2
engine/common/mod_bmodel.c

@ -2505,7 +2505,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
#if !XASH_DEDICATED // TODO: Do we need subdivide on server? #if !XASH_DEDICATED // TODO: Do we need subdivide on server?
if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() ) if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() )
ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps ref.dllFuncs.GL_SubdivideSurface( loadmodel, out ); // cut up polygon for warps
#endif #endif
} }

4
engine/ref_api.h

@ -330,8 +330,6 @@ typedef struct ref_api_s
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC ); model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
void *(*Mod_Extradata)( int type, model_t *model ); void *(*Mod_Extradata)( int type, model_t *model );
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
// remap // remap
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e ); struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
@ -506,7 +504,7 @@ typedef struct ref_interface_s
// bmodel // bmodel
void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette ); void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette );
void (*GL_SubdivideSurface)( msurface_t *fa ); void (*GL_SubdivideSurface)( model_t *mod, msurface_t *fa );
void (*CL_RunLightStyles)( void ); void (*CL_RunLightStyles)( void );
// sprites // sprites

19
ref/gl/gl_alias.c

@ -418,7 +418,6 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
static rgbdata_t skin; static rgbdata_t skin;
char name[MAX_QPATH]; char name[MAX_QPATH];
int i; int i;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
skin.width = width; skin.width = width;
skin.height = height; skin.height = height;
@ -443,7 +442,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
} }
} }
COM_FileBase( loadmodel->name, name, sizeof( name )); COM_FileBase( mod->name, name, sizeof( name ));
// for alias models only player can have remap textures // for alias models only player can have remap textures
if( mod != NULL && !Q_stricmp( name, "player" )) if( mod != NULL && !Q_stricmp( name, "player" ))
@ -476,12 +475,11 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
return gEngfuncs.FS_CopyImage( &skin ); return gEngfuncs.FS_CopyImage( &skin );
} }
void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size ) void *Mod_LoadSingleSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
{ {
string name, lumaname; string name, lumaname;
string checkname; string checkname;
rgbdata_t *pic; rgbdata_t *pic;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum ); Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum ); Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
@ -508,14 +506,13 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
return ((byte *)(pskintype + 1) + size); return ((byte *)(pskintype + 1) + size);
} }
void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size ) void *Mod_LoadGroupSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
{ {
daliasskininterval_t *pinskinintervals; daliasskininterval_t *pinskinintervals;
daliasskingroup_t *pinskingroup; daliasskingroup_t *pinskingroup;
string name, lumaname; string name, lumaname;
rgbdata_t *pic; rgbdata_t *pic;
int i, j; int i, j;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
// animating skin group. yuck. // animating skin group. yuck.
pskintype++; pskintype++;
@ -555,7 +552,7 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
Mod_LoadAllSkins Mod_LoadAllSkins
=============== ===============
*/ */
void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype ) void *Mod_LoadAllSkins( model_t *mod, int numskins, daliasskintype_t *pskintype )
{ {
int i, size; int i, size;
@ -568,11 +565,11 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
{ {
if( pskintype->type == ALIAS_SKIN_SINGLE ) if( pskintype->type == ALIAS_SKIN_SINGLE )
{ {
pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( pskintype, i, size ); pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( mod, pskintype, i, size );
} }
else else
{ {
pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( pskintype, i, size ); pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( mod, pskintype, i, size );
} }
} }
@ -680,7 +677,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
// load the skins // load the skins
pskintype = (daliasskintype_t *)&pinmodel[1]; pskintype = (daliasskintype_t *)&pinmodel[1];
pskintype = Mod_LoadAllSkins( m_pAliasHeader->numskins, pskintype ); pskintype = Mod_LoadAllSkins( mod, m_pAliasHeader->numskins, pskintype );
// load base s and t vertices // load base s and t vertices
pinstverts = (stvert_t *)pskintype; pinstverts = (stvert_t *)pskintype;
@ -725,7 +722,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
GL_MakeAliasModelDisplayLists( mod ); GL_MakeAliasModelDisplayLists( mod );
// move the complete, relocatable alias model to the cache // move the complete, relocatable alias model to the cache
gEngfuncs.Mod_GetCurrentLoadingModel()->cache.data = m_pAliasHeader; mod->cache.data = m_pAliasHeader;
if( loaded ) *loaded = true; // done if( loaded ) *loaded = true; // done
} }

2
ref/gl/gl_local.h

@ -426,7 +426,7 @@ void R_MarkLeaves( void );
void R_DrawWorld( void ); void R_DrawWorld( void );
void R_DrawWaterSurfaces( void ); void R_DrawWaterSurfaces( void );
void R_DrawBrushModel( cl_entity_t *e ); void R_DrawBrushModel( cl_entity_t *e );
void GL_SubdivideSurface( msurface_t *fa ); void GL_SubdivideSurface( model_t *mod, msurface_t *fa );
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa ); void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa );
void DrawGLPoly( glpoly_t *p, float xScale, float yScale ); void DrawGLPoly( glpoly_t *p, float xScale, float yScale );
texture_t *R_TextureAnimation( msurface_t *s ); texture_t *R_TextureAnimation( msurface_t *s );

12
ref/gl/gl_rsurf.c

@ -78,7 +78,7 @@ static void BoundPoly( int numverts, float *verts, vec3_t mins, vec3_t maxs )
} }
} }
static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts ) static void SubdividePolygon_r( model_t *loadmodel, msurface_t *warpface, int numverts, float *verts )
{ {
vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE]; vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE];
mextrasurf_t *warpinfo = warpface->info; mextrasurf_t *warpinfo = warpface->info;
@ -88,7 +88,6 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
float sample_size; float sample_size;
vec3_t mins, maxs; vec3_t mins, maxs;
glpoly_t *poly; glpoly_t *poly;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
if( numverts > ( SUBDIVIDE_SIZE - 4 )) if( numverts > ( SUBDIVIDE_SIZE - 4 ))
gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts ); gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
@ -143,8 +142,8 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
} }
} }
SubdividePolygon_r( warpface, f, front[0] ); SubdividePolygon_r( loadmodel, warpface, f, front[0] );
SubdividePolygon_r( warpface, b, back[0] ); SubdividePolygon_r( loadmodel, warpface, b, back[0] );
return; return;
} }
@ -238,13 +237,12 @@ boundaries so that turbulent and sky warps
can be done reasonably. can be done reasonably.
================ ================
*/ */
void GL_SubdivideSurface( msurface_t *fa ) void GL_SubdivideSurface( model_t *loadmodel, msurface_t *fa )
{ {
vec3_t verts[SUBDIVIDE_SIZE]; vec3_t verts[SUBDIVIDE_SIZE];
int numverts; int numverts;
int i, lindex; int i, lindex;
float *vec; float *vec;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
// convert edges back to a normal polygon // convert edges back to a normal polygon
numverts = 0; numverts = 0;
@ -261,7 +259,7 @@ void GL_SubdivideSurface( msurface_t *fa )
SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state
// do subdivide // do subdivide
SubdividePolygon_r( fa, numverts, verts[0] ); SubdividePolygon_r( loadmodel, fa, numverts, verts[0] );
} }
/* /*

2
ref/soft/r_context.c

@ -329,7 +329,7 @@ void R_InitSkyClouds(mip_t *mt, texture_t *tx, qboolean custom_palette)
} }
void GAME_EXPORT GL_SubdivideSurface(msurface_t *fa) void GAME_EXPORT GL_SubdivideSurface( model_t *mod, msurface_t *fa )
{ {
} }

Loading…
Cancel
Save