Browse Source

ref: soft: acquire engine pointers

pull/2/head
Alibek Omarov 6 months 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.
ref_api_t gEngfuncs; ref_api_t gEngfuncs;
ref_globals_t *gpGlobals; ref_globals_t *gpGlobals;
ref_client_t *gp_cl;
ref_host_t *gp_host;
gl_globals_t tr; gl_globals_t tr;
ref_speeds_t r_stats; ref_speeds_t r_stats;
poolhandle_t r_temppool; poolhandle_t r_temppool;
@ -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 )); memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
gpGlobals = globals; 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; return REF_API_VERSION;
} }

17
ref/soft/r_local.h

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

7
ref/soft/r_main.c

@ -1939,10 +1939,9 @@ qboolean GAME_EXPORT R_Init( void )
} }
// see R_ProcessEntData for tr.entities initialization // see R_ProcessEntData for tr.entities initialization
tr.models = gEngfuncs.pfnGetModels(); tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
tr.movevars = gEngfuncs.pfnGetMoveVars(); tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
tr.palette = gEngfuncs.CL_GetPaletteColor(); tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
tr.viewent = gEngfuncs.GetViewModel();
R_InitBlit( glblit ); R_InitBlit( glblit );

Loading…
Cancel
Save