]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
SV_FlyMove(): defer SV_Impact() call until after ground detection
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 13 Sep 2023 20:30:31 +0000 (06:30 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 13 Sep 2023 20:30:31 +0000 (06:30 +1000)
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 <bones_was_here@xonotic.au>
sv_phys.c

index 8a4d41dfc577a1c596ad08046762258cfeb7555f..e9cc191490e37ad3b10507102d04ce029e8ba9a1 100644 (file)
--- 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)
        {