Browse Source

ref: soft: acquire engine pointers

pull/2/head
Alibek Omarov 1 year ago
parent
commit
6386782674
  1. 5
      ref/soft/r_context.c
  2. 17
      ref/soft/r_local.h
  3. 7
      ref/soft/r_main.c

5
ref/soft/r_context.c

@ -17,6 +17,8 @@ GNU General Public License for more details. @@ -17,6 +17,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;
gl_globals_t tr;
ref_speeds_t r_stats;
poolhandle_t r_temppool;
@ -564,5 +566,8 @@ int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t @@ -564,5 +566,8 @@ int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t
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;
}

17
ref/soft/r_local.h

@ -297,7 +297,6 @@ typedef struct @@ -297,7 +297,6 @@ typedef struct
// get from engine
cl_entity_t *entities;
movevars_t *movevars;
model_t **models;
color24 *palette;
cl_entity_t *viewent;
@ -676,6 +675,13 @@ void TriBrightness( float brightness ); @@ -676,6 +675,13 @@ void TriBrightness( float brightness );
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( (parm), 0 )
extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals;
extern ref_client_t *gp_cl;
extern ref_host_t *gp_host;
DECLARE_ENGINE_SHARED_CVAR_LIST()
//
// helper funcs
//
@ -686,15 +692,10 @@ static inline cl_entity_t *CL_GetEntityByIndex( int index ) @@ -686,15 +692,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])
extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals;
DECLARE_ENGINE_SHARED_CVAR_LIST()
#define WORLDMODEL (gp_cl->models[1])
// todo: gl_cull.c
#define R_CullModel(...) 0

7
ref/soft/r_main.c

@ -1939,10 +1939,9 @@ qboolean GAME_EXPORT R_Init( void ) @@ -1939,10 +1939,9 @@ 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();
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 );
R_InitBlit( glblit );

Loading…
Cancel
Save