From 340b32827f5f4d44484be7e9394a83ad8a7bb7a0 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Wed, 19 Feb 2020 18:49:54 +0100 Subject: [PATCH] Limit the fix against black debris (1f1a45a) to gibs, debris, monsters. Pushing all entities slightly away from non-horizontal may let items to slide to unreachable locations, or let monsters getting stuck. This is part of yquake2/xatrix#50 --- src/game/g_phys.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/g_phys.c b/src/game/g_phys.c index 3a6a183a..671183bb 100644 --- a/src/game/g_phys.c +++ b/src/game/g_phys.c @@ -540,7 +540,15 @@ retry: the entity to be rendered in full black. */ if (trace.plane.type != 2) { - VectorAdd(ent->s.origin, trace.plane.normal, ent->s.origin); + /* Limit the fix to gibs, debris and dead monsters. + Everything else may break existing maps. Items + may slide to unreachable locations, monsters may + get stuck, etc. */ + if (((strncmp(ent->classname, "monster_", 8) == 0) && ent->health < 1) || + (strcmp(ent->classname, "debris") == 0) || (ent->s.effects & EF_GIB)) + { + VectorAdd(ent->s.origin, trace.plane.normal, ent->s.origin); + } } if (trace.fraction != 1.0)