diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index e58bf515..e3c437a7 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -2533,7 +2533,7 @@ CL_TraceTexture */ 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 ); } /* diff --git a/engine/common/pm_local.h b/engine/common/pm_local.h index 1c2b08cf..b283973b 100644 --- a/engine/common/pm_local.h +++ b/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_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 ); -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 ); void PM_StuckTouch( playermove_t *pmove, int hitent, pmtrace_t *tr ); 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 // -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_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 ); diff --git a/engine/common/pm_surface.c b/engine/common/pm_surface.c index 6ba55a55..d1124a3d 100644 --- a/engine/common/pm_surface.c +++ b/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 ); } -/* -================== -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 diff --git a/engine/common/pm_trace.c b/engine/common/pm_trace.c index 6b62a564..fb1e29bd 100644 --- a/engine/common/pm_trace.c +++ b/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 ); } -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 ) 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 ) diff --git a/engine/server/sv_pmove.c b/engine/server/sv_pmove.c index 02b85f0a..53cd010d 100644 --- a/engine/server/sv_pmove.c +++ b/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 ) { - 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 )