engine, ref: eliminate calls to global arrays, instead store array pointers at renderer side

This commit is contained in:
Alibek Omarov
2023-11-02 02:44:50 +03:00
parent 67737446ac
commit 7e9f87de2d
28 changed files with 140 additions and 82 deletions

View File

@@ -1846,7 +1846,7 @@ void R_StudioRenderShadow( int iSprite, float *p1, float *p2, float *p3, float *
if( !p1 || !p2 || !p3 || !p4 )
return;
if( TriSpriteTexture( gEngfuncs.pfnGetModelByIndex( iSprite ), 0 ))
if( TriSpriteTexture( CL_ModelHandle( iSprite ), 0 ))
{
TriRenderMode( kRenderTransAlpha );
_TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
@@ -3137,7 +3137,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
// copy attachments into global entity array
if( RI.currententity->index > 0 )
{
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( RI.currententity->index );
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
}
}
@@ -3180,7 +3180,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
if( pplayer->weaponmodel )
{
cl_entity_t saveent = *RI.currententity;
model_t *pweaponmodel = gEngfuncs.pfnGetModelByIndex( pplayer->weaponmodel );
model_t *pweaponmodel = CL_ModelHandle( pplayer->weaponmodel );
m_pStudioHeader = (studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, pweaponmodel );
@@ -3266,7 +3266,7 @@ static int R_StudioDrawModel( int flags )
// copy attachments into global entity array
if( RI.currententity->index > 0 )
{
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( RI.currententity->index );
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
}
}
@@ -3335,7 +3335,7 @@ void R_DrawStudioModel( cl_entity_t *e )
{
if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
{
cl_entity_t *parent = gEngfuncs.GetEntityByIndex( e->curstate.aiment );
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment );
if( parent && parent->model && parent->model->type == mod_studio )
{
@@ -3610,7 +3610,7 @@ void Mod_StudioUnloadTextures( void *data )
static model_t *pfnModelHandle( int modelindex )
{
return gEngfuncs.pfnGetModelByIndex( modelindex );
return CL_ModelHandle( modelindex );
}
static void *pfnMod_CacheCheck( struct cache_user_s *c )