From b3c239b58510cfc013408361b48008f948b713af Mon Sep 17 00:00:00 2001 From: cholleme <> Date: Sun, 16 Feb 2003 20:02:36 +0000 Subject: [PATCH] Fixed decails (RecursiveHullCheck bug) --- r_part.c | 6 ++++-- world.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/r_part.c b/r_part.c index 1b967fd..c7aea4a 100644 --- a/r_part.c +++ b/r_part.c @@ -54,7 +54,7 @@ ParticleEffect_t *particleEffects; vec3_t r_pright, r_pup, r_ppn; // missing prototypes -extern qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace); +extern qboolean SV_RecursiveHullCheck (model_t *m, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace); ParticleEffect_t *ParticleEffectDefinedForName(const char *name); @@ -1409,10 +1409,12 @@ void R_DrawParticles (void) memset (&trace, 0, sizeof(trace)); trace.fraction = 1; - SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, p->org, neworg, &trace); + SV_RecursiveHullCheck (cl.worldmodel, 0, 0, 1, p->org, neworg, &trace); if (trace.fraction < 1) { + vec3_t tangent; + //calc reflection vector d = DotProduct (p->vel, trace.plane.normal); VectorMA (p->vel, -2*d, trace.plane.normal, p->vel); diff --git a/world.c b/world.c index 0f0fb3d..3ba4d78 100644 --- a/world.c +++ b/world.c @@ -633,14 +633,14 @@ extern vec3_t trace_mins, trace_maxs; extern vec3_t trace_extents; extern int trace_contents; extern qboolean trace_ispoint; // optimized case -void CM_RecursiveHullCheck (int num, float p1f, float p2f, vec3_t p1, vec3_t p2); +void CM_RecursiveHullCheck (model_t *m, int num, float p1f, float p2f, vec3_t p1, vec3_t p2); /* ================== SV_RecursiveHullCheck ================== */ -qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) +qboolean SV_RecursiveHullCheck (model_t *m, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) { VectorCopy (p1, trace_start); VectorCopy (p2, trace_end); @@ -650,8 +650,14 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec trace_contents = CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_MONSTERCLIP; trace_trace = *trace; - CM_RecursiveHullCheck (0, p1f, p2f, p1, p2); + + CM_RecursiveHullCheck (m, 0, p1f, p2f, p1, p2); *trace = trace_trace; + + trace->endpos[0] = p1[0] + trace->fraction * (p2[0] - p1[0]); + trace->endpos[1] = p1[1] + trace->fraction * (p2[1] - p1[1]); + trace->endpos[2] = p1[2] + trace->fraction * (p2[2] - p1[2]); + return false; /* dclipnode_t *node;