Browse Source

ref: gl: acquire engine pointers

pull/2/head
Alibek Omarov 11 months ago
parent
commit
6a4bf4965f
  1. 5
      ref/gl/gl_context.c
  2. 7
      ref/gl/gl_local.h
  3. 9
      ref/gl/gl_opengl.c

5
ref/gl/gl_context.c

@ -24,6 +24,8 @@ GNU General Public License for more details. @@ -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, @@ -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;
}

7
ref/gl/gl_local.h

@ -258,7 +258,6 @@ typedef struct @@ -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; @@ -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 ) @@ -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

9
ref/gl/gl_opengl.c

@ -1287,11 +1287,10 @@ qboolean R_Init( void ) @@ -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();

Loading…
Cancel
Save