ref: gl: acquire engine pointers

This commit is contained in:
Alibek Omarov 2023-12-28 22:19:30 +03:00
parent a3c9538d12
commit 6a4bf4965f
3 changed files with 13 additions and 8 deletions

View File

@ -24,6 +24,8 @@ GNU General Public License for more details.
ref_api_t gEngfuncs;
ref_globals_t *gpGlobals;
ref_client_t *gp_cl;
ref_host_t *gp_host;
static void R_ClearScreen( void )
{
@ -518,5 +520,8 @@ int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs,
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
gpGlobals = globals;
gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR );
gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR );
return REF_API_VERSION;
}

View File

@ -258,7 +258,6 @@ typedef struct
struct world_static_s *world;
cl_entity_t *entities;
movevars_t *movevars;
model_t **models;
color24 *palette;
cl_entity_t *viewent;
@ -725,6 +724,8 @@ extern glstate_t glState;
extern glwstate_t glw_state;
extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals;
extern ref_client_t *gp_cl;
extern ref_host_t *gp_host;
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( ( parm ), 0 )
@ -739,10 +740,10 @@ static inline cl_entity_t *CL_GetEntityByIndex( int index )
static inline model_t *CL_ModelHandle( int index )
{
return tr.models[index];
return gp_cl->models[index];
}
#define WORLDMODEL (tr.models[1])
#define WORLDMODEL (gp_cl->models[1])
//
// renderer cvars

View File

@ -1287,11 +1287,10 @@ qboolean R_Init( void )
}
// see R_ProcessEntData for tr.entities initialization
tr.world = gEngfuncs.GetWorld();
tr.models = gEngfuncs.pfnGetModels();
tr.movevars = gEngfuncs.pfnGetMoveVars();
tr.palette = gEngfuncs.CL_GetPaletteColor();
tr.viewent = gEngfuncs.GetViewModel();
tr.world = (struct world_static_s *)ENGINE_GET_PARM( PARM_GET_WORLD_PTR );
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
GL_SetDefaults();
R_CheckVBO();