Browse Source

engine: merge PM_TraceTexture into PM_TraceTexturePmove

pull/2/head
Alibek Omarov 2 years ago
parent
commit
e305b81df0
  1. 2
      engine/client/cl_game.c
  2. 3
      engine/common/pm_local.h
  3. 18
      engine/common/pm_surface.c
  4. 11
      engine/common/pm_trace.c
  5. 2
      engine/server/sv_pmove.c

2
engine/client/cl_game.c

@ -2533,7 +2533,7 @@ CL_TraceTexture
*/ */
const char * GAME_EXPORT PM_CL_TraceTexture( int ground, float *vstart, float *vend ) const char * GAME_EXPORT PM_CL_TraceTexture( int ground, float *vstart, float *vend )
{ {
return PM_TraceTexturePmove( clgame.pmove, ground, vstart, vend ); return PM_TraceTexture( clgame.pmove, ground, vstart, vend );
} }
/* /*

3
engine/common/pm_local.h

@ -42,7 +42,7 @@ float PM_TraceModel( playermove_t *pmove, physent_t *pe, float *start, float *en
pmtrace_t *PM_TraceLine( playermove_t *pmove, float *start, float *end, int flags, int usehull, int ignore_pe ); pmtrace_t *PM_TraceLine( playermove_t *pmove, float *start, float *end, int flags, int usehull, int ignore_pe );
pmtrace_t *PM_TraceLineEx( playermove_t *pmove, float *start, float *end, int flags, int usehull, pfnIgnore pmFilter ); pmtrace_t *PM_TraceLineEx( playermove_t *pmove, float *start, float *end, int flags, int usehull, pfnIgnore pmFilter );
struct msurface_s *PM_TraceSurfacePmove( playermove_t *pmove, int ground, float *vstart, float *vend ); struct msurface_s *PM_TraceSurfacePmove( playermove_t *pmove, int ground, float *vstart, float *vend );
const char *PM_TraceTexturePmove( playermove_t *pmove, int ground, float *vstart, float *vend ); const char *PM_TraceTexture( playermove_t *pmove, int ground, float *vstart, float *vend );
int PM_PointContentsPmove( playermove_t *pmove, const float *p, int *truecontents ); int PM_PointContentsPmove( playermove_t *pmove, const float *p, int *truecontents );
void PM_StuckTouch( playermove_t *pmove, int hitent, pmtrace_t *tr ); void PM_StuckTouch( playermove_t *pmove, int hitent, pmtrace_t *tr );
void PM_ConvertTrace( trace_t *out, pmtrace_t *in, edict_t *ent ); void PM_ConvertTrace( trace_t *out, pmtrace_t *in, edict_t *ent );
@ -66,7 +66,6 @@ static inline void PM_InitPMTrace( pmtrace_t *trace, const vec3_t end )
// //
// pm_surface.c // pm_surface.c
// //
const char *PM_TraceTexture( physent_t *pe, vec3_t vstart, vec3_t vend );
msurface_t *PM_RecursiveSurfCheck( model_t *model, mnode_t *node, vec3_t p1, vec3_t p2 ); msurface_t *PM_RecursiveSurfCheck( model_t *model, mnode_t *node, vec3_t p1, vec3_t p2 );
msurface_t *PM_TraceSurface( physent_t *pe, vec3_t start, vec3_t end ); msurface_t *PM_TraceSurface( physent_t *pe, vec3_t start, vec3_t end );
int PM_TestLineExt( playermove_t *pmove, physent_t *ents, int numents, const vec3_t start, const vec3_t end, int flags ); int PM_TestLineExt( playermove_t *pmove, physent_t *ents, int numents, const vec3_t start, const vec3_t end, int flags );

18
engine/common/pm_surface.c

@ -214,24 +214,6 @@ msurface_t *PM_TraceSurface( physent_t *pe, vec3_t start, vec3_t end )
return PM_RecursiveSurfCheck( bmodel, &bmodel->nodes[hull->firstclipnode], start_l, end_l ); return PM_RecursiveSurfCheck( bmodel, &bmodel->nodes[hull->firstclipnode], start_l, end_l );
} }
/*
==================
PM_TraceTexture
find the face where the traceline hit
assume physentity is valid
==================
*/
const char *PM_TraceTexture( physent_t *pe, vec3_t start, vec3_t end )
{
msurface_t *surf = PM_TraceSurface( pe, start, end );
if( !surf || !surf->texinfo || !surf->texinfo->texture )
return NULL;
return surf->texinfo->texture->name;
}
/* /*
================== ==================
PM_TestLine_r PM_TestLine_r

11
engine/common/pm_trace.c

@ -841,12 +841,19 @@ struct msurface_s *PM_TraceSurfacePmove( playermove_t *pmove, int ground, float
return PM_TraceSurface( &pmove->physents[ground], vstart, vend ); return PM_TraceSurface( &pmove->physents[ground], vstart, vend );
} }
const char *PM_TraceTexturePmove( playermove_t *pmove, int ground, float *vstart, float *vend ) const char *PM_TraceTexture( playermove_t *pmove, int ground, float *vstart, float *vend )
{ {
msurface_t *surf;
if( ground < 0 || ground >= pmove->numphysent ) if( ground < 0 || ground >= pmove->numphysent )
return NULL; // bad ground return NULL; // bad ground
return PM_TraceTexture( &pmove->physents[ground], vstart, vend ); surf = PM_TraceSurface( &pmove->physents[ground], vstart, vend );
if( !surf || !surf->texinfo || !surf->texinfo->texture )
return NULL;
return surf->texinfo->texture->name;
} }
int PM_PointContentsPmove( playermove_t *pmove, const float *p, int *truecontents ) int PM_PointContentsPmove( playermove_t *pmove, const float *p, int *truecontents )

2
engine/server/sv_pmove.c

@ -414,7 +414,7 @@ static float GAME_EXPORT pfnTraceModel( physent_t *pe, float *start, float *end,
static const char *pfnTraceTexture( int ground, float *vstart, float *vend ) static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
{ {
return PM_TraceTexturePmove( svgame.pmove, ground, vstart, vend ); return PM_TraceTexture( svgame.pmove, ground, vstart, vend );
} }
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ) static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )

Loading…
Cancel
Save