From e62e6f563b475060fca315b875aa672c692ad052 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 14 Sep 2023 06:30:31 +1000 Subject: [PATCH] SV_FlyMove(): defer SV_Impact() call until after ground detection Quake didn't use SV_PushEntity in SV_FlyMove() and id1 fiends depend on the original behaviour of setting ONGROUND (etc) before calling SV_Impact(). Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/94 Signed-off-by: bones_was_here --- sv_phys.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sv_phys.c b/sv_phys.c index 8a4d41df..e9cc1914 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1332,6 +1332,14 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float if (stepnormal) VectorCopy(trace.plane.normal, stepnormal); } + + // Unlike some other movetypes Quake's SV_FlyMove calls SV_Impact only after setting ONGROUND which id1 fiends rely on. + // If we stepped up (sv_gameplayfix_stepmultipletimes) this will impact the steptrace2 plane instead of the original. + if (PRVM_serveredictfloat(ent, solid) >= SOLID_TRIGGER && trace.ent) + SV_Impact(ent, &trace); + if (ent->free) + return blocked; // removed by the impact function + if (trace.fraction >= 0.001) { // actually covered some distance @@ -1627,10 +1635,12 @@ static qbool SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, qboo #endif if (dolink) + { SV_LinkEdict_TouchAreaGrid(ent); - if((PRVM_serveredictfloat(ent, solid) >= SOLID_TRIGGER && trace->ent && (!((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND) || PRVM_serveredictedict(ent, groundentity) != PRVM_EDICT_TO_PROG(trace->ent)))) - SV_Impact (ent, trace); + if((PRVM_serveredictfloat(ent, solid) >= SOLID_TRIGGER && trace->ent && (!((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND) || PRVM_serveredictedict(ent, groundentity) != PRVM_EDICT_TO_PROG(trace->ent)))) + SV_Impact (ent, trace); + } if(ent->priv.required->mark == PRVM_EDICT_MARK_SETORIGIN_CAUGHT) { -- 2.39.2