From 2bec1ae1d92fbcac5374a7039269199ddefbc7dc Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 22 Dec 2011 13:08:24 +0900 Subject: [PATCH] Make qw's push/block handing the same as nq's. NQ's handling seems to be more correct. The only likely problems are if something is pushed into (eg) a button, and things will be a little slower. --- nq/source/sv_phys.c | 6 +++--- qw/source/sv_phys.c | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index 2aa948cd2..7baa93400 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -413,7 +413,7 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove) vec3_t up = {0, 0, 1}; int mark; int c_flags, c_movetype, c_groundentity, c_solid; - vec_t *c_absmin, *c_absmax, *c_origin, *c_mins, *c_maxs; + vec_t *c_absmin, *c_absmax, *c_origin, *c_angles, *c_mins, *c_maxs; vec_t *p_origin, *p_angles; VectorAdd (SVvector (pusher, absmin), tmove, mins); @@ -505,8 +505,8 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove) block = SV_TestEntityPosition (check); if (!block) { - VectorAdd (SVvector (check, angles), amove, - SVvector (check, angles)); + c_angles = SVvector (check, angles); + VectorAdd (c_angles, amove, c_angles); continue; } // if it is still inside the pusher, block diff --git a/qw/source/sv_phys.c b/qw/source/sv_phys.c index 734c5695a..c38c50fdf 100644 --- a/qw/source/sv_phys.c +++ b/qw/source/sv_phys.c @@ -416,7 +416,7 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove) vec3_t up = {0, 0, 1}; int mark; int c_flags, c_movetype, c_groundentity, c_solid; - vec_t *c_absmin, *c_absmax, *c_origin, *c_mins, *c_maxs; + vec_t *c_absmin, *c_absmax, *c_origin, *c_angles, *c_mins, *c_maxs; vec_t *p_origin, *p_angles; VectorAdd (SVvector (pusher, absmin), tmove, mins); @@ -501,17 +501,15 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove) VectorAdd (move, tmove, move); // try moving the contacted entity - VectorAdd (c_origin, move, c_origin); - block = SV_TestEntityPosition (check); - if (!block) { // pushed ok - SV_LinkEdict (check, false); - continue; - } - // if it is ok to leave in the old position, do it - VectorSubtract (c_origin, move, c_origin); + solid_save = SVfloat (pusher, solid); + SVfloat (pusher, solid) = SOLID_NOT; + SV_PushEntity (check, move); + SVfloat (pusher, solid) = solid_save; + block = SV_TestEntityPosition (check); if (!block) { - num_moved--; + c_angles = SVvector (check, angles); + VectorAdd (c_angles, amove, c_angles); continue; } // if it is still inside the pusher, block