engine: client: make few function between pmove and client interface shared, remove unused CL_PointContents wrapper

This commit is contained in:
Alibek Omarov 2023-01-06 00:09:36 +03:00
parent e305b81df0
commit 0bec78a958
5 changed files with 8 additions and 59 deletions

View File

@ -234,22 +234,6 @@ void CL_InitCDAudio( const char *filename )
Mem_Free( afile ); Mem_Free( afile );
} }
/*
====================
CL_PointContents
Return contents for point
====================
*/
int CL_PointContents( const vec3_t p )
{
int cont = PM_PointContents( clgame.pmove, p );
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
cont = CONTENTS_WATER;
return cont;
}
/* /*
============= =============
CL_AdjustXPos CL_AdjustXPos
@ -2220,38 +2204,14 @@ pfnPointContents
============= =============
*/ */
static int GAME_EXPORT pfnPointContents( const float *p, int *truecontents ) int GAME_EXPORT PM_CL_PointContents( const float *p, int *truecontents )
{ {
return PM_PointContentsPmove( clgame.pmove, p, truecontents ); return PM_PointContentsPmove( clgame.pmove, p, truecontents );
} }
/* pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
=============
pfnTraceLine
=============
*/
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
{ {
static pmtrace_t tr; return PM_TraceLine( clgame.pmove, start, end, flags, usehull, ignore_pe );
int old_usehull;
old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = usehull;
switch( flags )
{
case PM_TRACELINE_PHYSENTSONLY:
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
break;
case PM_TRACELINE_ANYVISIBLE:
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numvisent, clgame.pmove->visents, ignore_pe, NULL );
break;
}
clgame.pmove->usehull = old_usehull;
return &tr;
} }
static void GAME_EXPORT pfnPlaySoundByNameAtLocation( char *szSound, float volume, float *origin ) static void GAME_EXPORT pfnPlaySoundByNameAtLocation( char *szSound, float volume, float *origin )
@ -3827,9 +3787,9 @@ static cl_enginefunc_t gEngfuncs =
pfnGetClientTime, pfnGetClientTime,
pfnCalcShake, pfnCalcShake,
pfnApplyShake, pfnApplyShake,
pfnPointContents, PM_CL_PointContents,
CL_WaterEntity, CL_WaterEntity,
pfnTraceLine, PM_CL_TraceLine,
CL_LoadModel, CL_LoadModel,
CL_AddEntity, CL_AddEntity,
CL_GetSpritePointer, CL_GetSpritePointer,

View File

@ -716,11 +716,6 @@ static void GAME_EXPORT pfnStuckTouch( int hitent, pmtrace_t *tr )
return PM_StuckTouch( clgame.pmove, hitent, tr ); return PM_StuckTouch( clgame.pmove, hitent, tr );
} }
static int GAME_EXPORT pfnPointContents( float *p, int *truecontents )
{
return PM_PointContentsPmove( clgame.pmove, p, truecontents );
}
static int GAME_EXPORT pfnTruePointContents( float *p ) static int GAME_EXPORT pfnTruePointContents( float *p )
{ {
return PM_TruePointContents( clgame.pmove, p ); return PM_TruePointContents( clgame.pmove, p );
@ -736,11 +731,6 @@ static pmtrace_t GAME_EXPORT pfnPlayerTrace( float *start, float *end, int trace
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL ); return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
} }
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
{
return PM_TraceLine( clgame.pmove, start, end, flags, usehull, ignore_pe );
}
static void *pfnHullForBsp( physent_t *pe, float *offset ) static void *pfnHullForBsp( physent_t *pe, float *offset )
{ {
return PM_HullForBsp( pe, clgame.pmove, offset ); return PM_HullForBsp( pe, clgame.pmove, offset );
@ -817,7 +807,7 @@ void CL_InitClientMove( void )
clgame.pmove->Con_Printf = Con_Printf; clgame.pmove->Con_Printf = Con_Printf;
clgame.pmove->Sys_FloatTime = Sys_DoubleTime; clgame.pmove->Sys_FloatTime = Sys_DoubleTime;
clgame.pmove->PM_StuckTouch = pfnStuckTouch; clgame.pmove->PM_StuckTouch = pfnStuckTouch;
clgame.pmove->PM_PointContents = pfnPointContents; clgame.pmove->PM_PointContents = PM_CL_PointContents;
clgame.pmove->PM_TruePointContents = pfnTruePointContents; clgame.pmove->PM_TruePointContents = pfnTruePointContents;
clgame.pmove->PM_HullPointContents = pfnHullPointContents; clgame.pmove->PM_HullPointContents = pfnHullPointContents;
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace; clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;

View File

@ -1037,7 +1037,7 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t
vecSpot[1] = pos[1] + COM_RandomFloat( -0.5f, 0.5f ) * size[1]; vecSpot[1] = pos[1] + COM_RandomFloat( -0.5f, 0.5f ) * size[1];
vecSpot[2] = pos[2] + COM_RandomFloat( -0.5f, 0.5f ) * size[2]; vecSpot[2] = pos[2] + COM_RandomFloat( -0.5f, 0.5f ) * size[2];
if( CL_PointContents( vecSpot ) != CONTENTS_SOLID ) if( PM_CL_PointContents( vecSpot, NULL ) != CONTENTS_SOLID )
break; // valid spot break; // valid spot
} }

View File

@ -832,6 +832,7 @@ void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pm
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr ); void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe ); pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend ); const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
int PM_CL_PointContents( const float *p, int *truecontents );
void CL_SetTraceHull( int hull ); void CL_SetTraceHull( int hull );
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
cl_entity_t* CL_GetViewModel( void ); cl_entity_t* CL_GetViewModel( void );
@ -914,7 +915,6 @@ void CL_PredictMovement( qboolean repredicting );
void CL_CheckPredictionError( void ); void CL_CheckPredictionError( void );
qboolean CL_IsPredicted( void ); qboolean CL_IsPredicted( void );
int CL_TruePointContents( const vec3_t p ); int CL_TruePointContents( const vec3_t p );
int CL_PointContents( const vec3_t p );
int CL_WaterEntity( const float *rgflPos ); int CL_WaterEntity( const float *rgflPos );
cl_entity_t *CL_GetWaterEntity( const float *rgflPos ); cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time ); void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time );

View File

@ -744,7 +744,6 @@ char *CL_Userinfo( void );
void CL_LegacyUpdateInfo( void ); void CL_LegacyUpdateInfo( void );
void CL_CharEvent( int key ); void CL_CharEvent( int key );
qboolean CL_DisableVisibility( void ); qboolean CL_DisableVisibility( void );
int CL_PointContents( const vec3_t point );
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength ); byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
int CL_GetDemoComment( const char *demoname, char *comment ); int CL_GetDemoComment( const char *demoname, char *comment );
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName ); void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );