mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-12 05:51:02 +00:00
engine: make playermove funcs truly shared between client and server
This commit is contained in:
parent
49a65edfc3
commit
4cb109abe0
@ -2222,14 +2222,7 @@ pfnPointContents
|
||||
*/
|
||||
static int GAME_EXPORT pfnPointContents( const float *p, int *truecontents )
|
||||
{
|
||||
int cont, truecont;
|
||||
|
||||
truecont = cont = PM_PointContents( clgame.pmove, p );
|
||||
if( truecontents ) *truecontents = truecont;
|
||||
|
||||
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
|
||||
cont = CONTENTS_WATER;
|
||||
return cont;
|
||||
return PM_PointContentsPmove( clgame.pmove, p, truecontents );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2534,19 +2527,13 @@ void GAME_EXPORT CL_PlayerTraceExt( float *start, float *end, int traceFlags, in
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnTraceTexture
|
||||
CL_TraceTexture
|
||||
|
||||
=============
|
||||
*/
|
||||
static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
|
||||
const char * GAME_EXPORT PM_CL_TraceTexture( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= clgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &clgame.pmove->physents[ground];
|
||||
return PM_TraceTexture( pe, vstart, vend );
|
||||
return PM_TraceTexturePmove( clgame.pmove, ground, vstart, vend );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2557,13 +2544,7 @@ pfnTraceSurface
|
||||
*/
|
||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= clgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &clgame.pmove->physents[ground];
|
||||
return PM_TraceSurface( pe, vstart, vend );
|
||||
return PM_TraceSurfacePmove( clgame.pmove, ground, vstart, vend );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3741,7 +3722,7 @@ static event_api_t gEventApi =
|
||||
CL_WeaponAnim,
|
||||
pfnPrecacheEvent,
|
||||
CL_PlaybackEvent,
|
||||
pfnTraceTexture,
|
||||
PM_CL_TraceTexture,
|
||||
pfnStopAllSounds,
|
||||
pfnKillEvents,
|
||||
CL_PlayerTraceExt, // Xash3D added
|
||||
|
@ -713,33 +713,12 @@ static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
|
||||
static void GAME_EXPORT pfnStuckTouch( int hitent, pmtrace_t *tr )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < clgame.pmove->numtouch; i++ )
|
||||
{
|
||||
if( clgame.pmove->touchindex[i].ent == hitent )
|
||||
return;
|
||||
}
|
||||
|
||||
if( clgame.pmove->numtouch >= MAX_PHYSENTS )
|
||||
return;
|
||||
|
||||
VectorCopy( clgame.pmove->velocity, tr->deltavelocity );
|
||||
tr->ent = hitent;
|
||||
|
||||
clgame.pmove->touchindex[clgame.pmove->numtouch++] = *tr;
|
||||
return PM_StuckTouch( clgame.pmove, hitent, tr );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnPointContents( float *p, int *truecontents )
|
||||
{
|
||||
int cont, truecont;
|
||||
|
||||
truecont = cont = PM_PointContents( clgame.pmove, p );
|
||||
if( truecontents ) *truecontents = truecont;
|
||||
|
||||
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
|
||||
cont = CONTENTS_WATER;
|
||||
return cont;
|
||||
return PM_PointContentsPmove( clgame.pmove, p, truecontents );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnTruePointContents( float *p )
|
||||
@ -757,91 +736,19 @@ 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 );
|
||||
}
|
||||
|
||||
pmtrace_t *PM_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 )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
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;
|
||||
return PM_TraceLine( clgame.pmove, start, end, flags, usehull, ignore_pe );
|
||||
}
|
||||
|
||||
static hull_t *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
static void *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
{
|
||||
return PM_HullForBsp( pe, clgame.pmove, offset );
|
||||
}
|
||||
|
||||
static float GAME_EXPORT pfnTraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
|
||||
{
|
||||
int old_usehull;
|
||||
vec3_t start_l, end_l;
|
||||
vec3_t offset, temp;
|
||||
qboolean rotated;
|
||||
matrix4x4 matrix;
|
||||
hull_t *hull;
|
||||
|
||||
PM_InitTrace( trace, end );
|
||||
|
||||
old_usehull = clgame.pmove->usehull;
|
||||
clgame.pmove->usehull = 2;
|
||||
|
||||
hull = PM_HullForBsp( pe, clgame.pmove, offset );
|
||||
|
||||
clgame.pmove->usehull = old_usehull;
|
||||
|
||||
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
|
||||
rotated = true;
|
||||
else rotated = false;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
|
||||
Matrix4x4_VectorITransform( matrix, start, start_l );
|
||||
Matrix4x4_VectorITransform( matrix, end, end_l );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( start, offset, start_l );
|
||||
VectorSubtract( end, offset, end_l );
|
||||
}
|
||||
|
||||
PM_RecursiveHullCheck( hull, hull->firstclipnode, 0, 1, start_l, end_l, (pmtrace_t *)trace );
|
||||
trace->ent = NULL;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
VectorCopy( trace->plane.normal, temp );
|
||||
Matrix4x4_TransformPositivePlane( matrix, temp, trace->plane.dist, trace->plane.normal, &trace->plane.dist );
|
||||
}
|
||||
|
||||
VectorLerp( start, trace->fraction, end, trace->endpos );
|
||||
|
||||
return trace->fraction;
|
||||
}
|
||||
|
||||
static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= clgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &clgame.pmove->physents[ground];
|
||||
return PM_TraceTexture( pe, vstart, vend );
|
||||
return PM_TraceModel( clgame.pmove, pe, start, end, trace );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
|
||||
@ -870,25 +777,7 @@ static int GAME_EXPORT pfnTestPlayerPositionEx( float *pos, pmtrace_t *ptrace, p
|
||||
|
||||
static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehull, pfnIgnore pmFilter )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
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, -1, pmFilter );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( clgame.pmove, start, end, 0, clgame.pmove->numvisent, clgame.pmove->visents, -1, pmFilter );
|
||||
break;
|
||||
}
|
||||
|
||||
clgame.pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
return PM_TraceLineEx( clgame.pmove, start, end, flags, usehull, pmFilter );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -932,19 +821,19 @@ void CL_InitClientMove( void )
|
||||
clgame.pmove->PM_TruePointContents = pfnTruePointContents;
|
||||
clgame.pmove->PM_HullPointContents = pfnHullPointContents;
|
||||
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
|
||||
clgame.pmove->PM_TraceLine = PM_TraceLine;
|
||||
clgame.pmove->PM_TraceLine = PM_CL_TraceLine;
|
||||
clgame.pmove->RandomLong = COM_RandomLong;
|
||||
clgame.pmove->RandomFloat = COM_RandomFloat;
|
||||
clgame.pmove->PM_GetModelType = pfnGetModelType;
|
||||
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
|
||||
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
|
||||
clgame.pmove->PM_HullForBsp = pfnHullForBsp;
|
||||
clgame.pmove->PM_TraceModel = pfnTraceModel;
|
||||
clgame.pmove->COM_FileSize = COM_FileSize;
|
||||
clgame.pmove->COM_LoadFile = COM_LoadFile;
|
||||
clgame.pmove->COM_FreeFile = COM_FreeFile;
|
||||
clgame.pmove->memfgets = COM_MemFgets;
|
||||
clgame.pmove->PM_PlaySound = pfnPlaySound;
|
||||
clgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
||||
clgame.pmove->PM_TraceTexture = PM_CL_TraceTexture;
|
||||
clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
||||
clgame.pmove->PM_PlayerTraceEx = pfnPlayerTraceEx;
|
||||
clgame.pmove->PM_TestPlayerPositionEx = pfnTestPlayerPositionEx;
|
||||
|
@ -830,6 +830,8 @@ int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_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 );
|
||||
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
||||
void CL_SetTraceHull( int hull );
|
||||
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
||||
cl_entity_t* CL_GetViewModel( void );
|
||||
|
@ -359,7 +359,7 @@ static ref_api_t gEngfuncs =
|
||||
|
||||
pfnGetPhysent,
|
||||
pfnTraceSurface,
|
||||
PM_TraceLine,
|
||||
PM_CL_TraceLine,
|
||||
CL_VisTraceLine,
|
||||
CL_TraceLine,
|
||||
pfnGetMoveVars,
|
||||
|
@ -753,7 +753,6 @@ struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
||||
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
||||
struct cmdalias_s *Cmd_AliasGetList( void );
|
||||
const char *Cmd_GetName( struct cmd_s *cmd );
|
||||
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||
void SV_StartMusic( const char *curtrack, const char *looptrack, int position );
|
||||
void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int entityIndex, int modelIndex, int flags, float scale );
|
||||
|
@ -38,6 +38,13 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pmtrace_t *ptrace, p
|
||||
int PM_HullPointContents( hull_t *hull, int num, const vec3_t p );
|
||||
int PM_TruePointContents( playermove_t *pmove, const vec3_t p );
|
||||
int PM_PointContents( playermove_t *pmove, const vec3_t p );
|
||||
float PM_TraceModel( playermove_t *pmove, physent_t *pe, float *start, float *end, trace_t *trace );
|
||||
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 );
|
||||
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 );
|
||||
|
||||
static inline void PM_InitTrace( trace_t *trace, const vec3_t end )
|
||||
|
@ -732,3 +732,150 @@ int PM_PointContents( playermove_t *pmove, const vec3_t p )
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
PM_TraceModel
|
||||
|
||||
=============
|
||||
*/
|
||||
float PM_TraceModel( playermove_t *pmove, physent_t *pe, float *start, float *end, trace_t *trace )
|
||||
{
|
||||
int old_usehull;
|
||||
vec3_t start_l, end_l;
|
||||
vec3_t offset, temp;
|
||||
qboolean rotated;
|
||||
matrix4x4 matrix;
|
||||
hull_t *hull;
|
||||
|
||||
PM_InitTrace( trace, end );
|
||||
|
||||
old_usehull = pmove->usehull;
|
||||
pmove->usehull = 2;
|
||||
|
||||
hull = PM_HullForBsp( pe, pmove, offset );
|
||||
|
||||
pmove->usehull = old_usehull;
|
||||
|
||||
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
|
||||
rotated = true;
|
||||
else rotated = false;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
|
||||
Matrix4x4_VectorITransform( matrix, start, start_l );
|
||||
Matrix4x4_VectorITransform( matrix, end, end_l );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( start, offset, start_l );
|
||||
VectorSubtract( end, offset, end_l );
|
||||
}
|
||||
|
||||
PM_RecursiveHullCheck( hull, hull->firstclipnode, 0, 1, start_l, end_l, (pmtrace_t *)trace );
|
||||
trace->ent = NULL;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
VectorCopy( trace->plane.normal, temp );
|
||||
Matrix4x4_TransformPositivePlane( matrix, temp, trace->plane.dist, trace->plane.normal, &trace->plane.dist );
|
||||
}
|
||||
|
||||
VectorLerp( start, trace->fraction, end, trace->endpos );
|
||||
|
||||
return trace->fraction;
|
||||
}
|
||||
|
||||
pmtrace_t *PM_TraceLine( playermove_t *pmove, float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = pmove->usehull;
|
||||
pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( pmove, start, end, 0, pmove->numphysent, pmove->physents, ignore_pe, NULL );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( pmove, start, end, 0, pmove->numvisent, pmove->visents, ignore_pe, NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
}
|
||||
|
||||
pmtrace_t *PM_TraceLineEx( playermove_t *pmove, float *start, float *end, int flags, int usehull, pfnIgnore pmFilter )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = pmove->usehull;
|
||||
pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( pmove, start, end, 0, pmove->numphysent, pmove->physents, -1, pmFilter );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( pmove, start, end, 0, pmove->numvisent, pmove->visents, -1, pmFilter );
|
||||
break;
|
||||
}
|
||||
|
||||
pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
}
|
||||
|
||||
struct msurface_s *PM_TraceSurfacePmove( playermove_t *pmove, int ground, float *vstart, float *vend )
|
||||
{
|
||||
if( ground < 0 || ground >= pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
return PM_TraceSurface( &pmove->physents[ground], vstart, vend );
|
||||
}
|
||||
|
||||
const char *PM_TraceTexturePmove( playermove_t *pmove, int ground, float *vstart, float *vend )
|
||||
{
|
||||
if( ground < 0 || ground >= pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
return PM_TraceTexture( &pmove->physents[ground], vstart, vend );
|
||||
}
|
||||
|
||||
int PM_PointContentsPmove( playermove_t *pmove, const float *p, int *truecontents )
|
||||
{
|
||||
int cont, truecont;
|
||||
|
||||
truecont = cont = PM_PointContents( pmove, p );
|
||||
if( truecontents ) *truecontents = truecont;
|
||||
|
||||
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
|
||||
cont = CONTENTS_WATER;
|
||||
return cont;
|
||||
}
|
||||
|
||||
void PM_StuckTouch( playermove_t *pmove, int hitent, pmtrace_t *tr )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < pmove->numtouch; i++ )
|
||||
{
|
||||
if( pmove->touchindex[i].ent == hitent )
|
||||
return;
|
||||
}
|
||||
|
||||
if( pmove->numtouch >= MAX_PHYSENTS )
|
||||
return;
|
||||
|
||||
VectorCopy( pmove->velocity, tr->deltavelocity );
|
||||
tr->ent = hitent;
|
||||
|
||||
pmove->touchindex[pmove->numtouch++] = *tr;
|
||||
}
|
||||
|
@ -374,33 +374,12 @@ static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
|
||||
static void GAME_EXPORT pfnStuckTouch( int hitent, pmtrace_t *tr )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < svgame.pmove->numtouch; i++ )
|
||||
{
|
||||
if( svgame.pmove->touchindex[i].ent == hitent )
|
||||
return;
|
||||
}
|
||||
|
||||
if( svgame.pmove->numtouch >= MAX_PHYSENTS )
|
||||
return;
|
||||
|
||||
VectorCopy( svgame.pmove->velocity, tr->deltavelocity );
|
||||
tr->ent = hitent;
|
||||
|
||||
svgame.pmove->touchindex[svgame.pmove->numtouch++] = *tr;
|
||||
return PM_StuckTouch( svgame.pmove, hitent, tr );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnPointContents( float *p, int *truecontents )
|
||||
{
|
||||
int cont, truecont;
|
||||
|
||||
truecont = cont = PM_PointContents( svgame.pmove, p );
|
||||
if( truecontents ) *truecontents = truecont;
|
||||
|
||||
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
|
||||
cont = CONTENTS_WATER;
|
||||
return cont;
|
||||
return PM_PointContentsPmove( svgame.pmove, p, truecontents );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnTruePointContents( float *p )
|
||||
@ -420,25 +399,7 @@ static pmtrace_t GAME_EXPORT pfnPlayerTrace( float *start, float *end, int trace
|
||||
|
||||
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = svgame.pmove->usehull;
|
||||
svgame.pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( svgame.pmove, start, end, 0, svgame.pmove->numphysent, svgame.pmove->physents, ignore_pe, NULL );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( svgame.pmove, start, end, 0, svgame.pmove->numvisent, svgame.pmove->visents, ignore_pe, NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
svgame.pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
return PM_TraceLine( svgame.pmove, start, end, flags, usehull, ignore_pe );
|
||||
}
|
||||
|
||||
static hull_t *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
@ -448,61 +409,12 @@ static hull_t *pfnHullForBsp( physent_t *pe, float *offset )
|
||||
|
||||
static float GAME_EXPORT pfnTraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
|
||||
{
|
||||
int old_usehull;
|
||||
vec3_t start_l, end_l;
|
||||
vec3_t offset, temp;
|
||||
qboolean rotated;
|
||||
matrix4x4 matrix;
|
||||
hull_t *hull;
|
||||
|
||||
PM_InitTrace( trace, end );
|
||||
|
||||
old_usehull = svgame.pmove->usehull;
|
||||
svgame.pmove->usehull = 2;
|
||||
|
||||
hull = PM_HullForBsp( pe, svgame.pmove, offset );
|
||||
|
||||
svgame.pmove->usehull = old_usehull;
|
||||
|
||||
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
|
||||
rotated = true;
|
||||
else rotated = false;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
|
||||
Matrix4x4_VectorITransform( matrix, start, start_l );
|
||||
Matrix4x4_VectorITransform( matrix, end, end_l );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( start, offset, start_l );
|
||||
VectorSubtract( end, offset, end_l );
|
||||
}
|
||||
|
||||
PM_RecursiveHullCheck( hull, hull->firstclipnode, 0, 1, start_l, end_l, (pmtrace_t *)trace );
|
||||
trace->ent = NULL;
|
||||
|
||||
if( rotated )
|
||||
{
|
||||
VectorCopy( trace->plane.normal, temp );
|
||||
Matrix4x4_TransformPositivePlane( matrix, temp, trace->plane.dist, trace->plane.normal, &trace->plane.dist );
|
||||
}
|
||||
|
||||
VectorLerp( start, trace->fraction, end, trace->endpos );
|
||||
|
||||
return trace->fraction;
|
||||
return PM_TraceModel( svgame.pmove, pe, start, end, trace );
|
||||
}
|
||||
|
||||
static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= svgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &svgame.pmove->physents[ground];
|
||||
return PM_TraceTexture( pe, vstart, vend );
|
||||
return PM_TraceTexturePmove( svgame.pmove, ground, vstart, vend );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
|
||||
@ -545,36 +457,12 @@ static int GAME_EXPORT pfnTestPlayerPositionEx( float *pos, pmtrace_t *ptrace, p
|
||||
|
||||
static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehull, pfnIgnore pmFilter )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
|
||||
old_usehull = svgame.pmove->usehull;
|
||||
svgame.pmove->usehull = usehull;
|
||||
|
||||
switch( flags )
|
||||
{
|
||||
case PM_TRACELINE_PHYSENTSONLY:
|
||||
tr = PM_PlayerTraceExt( svgame.pmove, start, end, 0, svgame.pmove->numphysent, svgame.pmove->physents, -1, pmFilter );
|
||||
break;
|
||||
case PM_TRACELINE_ANYVISIBLE:
|
||||
tr = PM_PlayerTraceExt( svgame.pmove, start, end, 0, svgame.pmove->numvisent, svgame.pmove->visents, -1, pmFilter );
|
||||
break;
|
||||
}
|
||||
|
||||
svgame.pmove->usehull = old_usehull;
|
||||
|
||||
return &tr;
|
||||
return PM_TraceLineEx( svgame.pmove, start, end, flags, usehull, pmFilter );
|
||||
}
|
||||
|
||||
static struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= svgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &svgame.pmove->physents[ground];
|
||||
return PM_TraceSurface( pe, vstart, vend );
|
||||
return PM_TraceSurfacePmove( svgame.pmove, ground, vstart, vend );
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user