diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 70b8369d..d29bff19 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -194,7 +194,12 @@ typedef struct playermove_s int (*PM_PointContents)( float *p, int *truecontents /*filled in if this is non-null*/ ); int (*PM_TruePointContents)( float *p ); int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p ); +#ifdef __MINGW32__ + pmtrace_t *(*PM_PlayerTrace_real)( pmtrace_t * retvalue, float *start, float *end, int traceFlags, int ignore_pe ); + +#else pmtrace_t (*PM_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe ); +#endif struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); long (*RandomLong)( long lLow, long lHigh ); float (*RandomFloat)( float flLow, float flHigh ); @@ -213,9 +218,32 @@ typedef struct playermove_s void (*PM_PlaySound)( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); const char *(*PM_TraceTexture)( int ground, float *vstart, float *vend ); void (*PM_PlaybackEventFull)( int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +#ifdef __MINGW32__ + pmtrace_t *(*PM_PlayerTraceEx_real) (pmtrace_t *retvalue, float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe )); +#else pmtrace_t (*PM_PlayerTraceEx) (float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe )); +#endif int (*PM_TestPlayerPositionEx) (float *pos, pmtrace_t *ptrace, int (*pfnIgnore)( physent_t *pe )); struct pmtrace_s *(*PM_TraceLineEx)( float *start, float *end, int flags, int usehulll, int (*pfnIgnore)( physent_t *pe )); struct msurface_s *(*PM_TraceSurface)( int ground, float *vstart, float *vend ); } playermove_t; + +#ifdef __MINGW32__ +static pmtrace_t _pm_globalresult, _pm_globaltmp; + static inline pmtrace_t PM_PlayerTrace_wrap( float *start, float *end, int traceFlags, int ignore_pe, playermove_t *pmove ) + { + _pm_globaltmp = pmove->touchindex[MAX_PHYSENTS -1]; + pmove->PM_PlayerTrace_real( &_pm_globalresult, start, end, traceFlags, ignore_pe ); + return _pm_globalresult; + } + static inline pmtrace_t PM_PlayerTraceEx_wrap( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), playermove_t *pmove ) + { + _pm_globaltmp = pmove->touchindex[MAX_PHYSENTS -1]; + pmove->PM_PlayerTraceEx_real( &_pm_globalresult, start, end, traceFlags, pfnIgnore ); + return _pm_globalresult; + } +#define PM_PlayerTrace(a,b,c,d) touchindex[MAX_PHYSENTS -1] = PM_PlayerTrace_wrap( a, b, c, d, pmove );pmove->touchindex[MAX_PHYSENTS -1] = _pm_globaltmp +#define PM_PlayerTraceEx(a,b,c,d) touchindex[MAX_PHYSENTS -1] = PM_PlayerTraceEx_wrap( a, b, c, d, pmove );pmove->touchindex[MAX_PHYSENTS -1] = _pm_globaltmp +#endif + #endif//PM_DEFS_H