Fix trace initialization in PM_TraceModel usage. Related issue: https://github.com/ValveSoftware/halflife/issues/3283 (#287)

This commit is contained in:
Roman Chistokhodov 2022-07-21 17:23:09 +03:00 committed by GitHub
parent 0207817bf4
commit 4e7d64180b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -120,6 +120,20 @@ static char grgchTextureType[CTEXTURESMAX];
int g_onladder = 0;
static inline void PM_InitTrace( trace_t *trace, const vec3_t end )
{
memset( trace, 0, sizeof( *trace ));
VectorCopy( end, trace->endpos );
trace->allsolid = true;
trace->fraction = 1.0f;
}
static void PM_TraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
{
PM_InitTrace( trace, end );
pmove->PM_TraceModel(pe, start, end, trace);
}
void PM_SwapTextures( int i, int j )
{
char chTemp;
@ -2108,7 +2122,7 @@ void PM_LadderMove( physent_t *pLadder )
onFloor = false;
pmove->gravity = 0;
pmove->PM_TraceModel( pLadder, pmove->origin, ladderCenter, &trace );
PM_TraceModel(pLadder, pmove->origin, ladderCenter, &trace);
if( trace.fraction != 1.0f )
{
float forward = 0, right = 0;