From: bones_was_here <bones_was_here@xonotic.au>
Date: Sat, 15 Jul 2023 12:28:23 +0000 (+1000)
Subject: droptofloor(): fix collisions between entities, including on id1 maps
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8cdc1ef0cdd81246599aee0e99d96e42faab34b8;p=xonotic%2Fdarkplaces.git

droptofloor(): fix collisions between entities, including on id1 maps

The presence of a monster bbox shouldn't cause a health to be considered
"in solid".

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
---

diff --git a/svvm_cmds.c b/svvm_cmds.c
index bb261700..b3992c47 100644
--- a/svvm_cmds.c
+++ b/svvm_cmds.c
@@ -1219,16 +1219,23 @@ static void VM_SV_droptofloor(prvm_prog_t *prog)
 			VM_Warning(prog, "droptofloor at \"%f %f %f\": sv_gameplayfix_droptofloorstartsolid_nudgetocorrect FIXED badly placed entity \"%s\" before drop\n", PRVM_gameedictvector(ent, origin)[0], PRVM_gameedictvector(ent, origin)[1], PRVM_gameedictvector(ent, origin)[2], PRVM_GetString(prog, PRVM_gameedictstring(ent, classname)));
 	}
 
+	/* bones_was_here: not using SV_GenericHitSuperContentsMask(ent) anymore because it was setting:
+	 * items:    SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY
+	 * monsters: SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_PLAYERCLIP
+	 * explobox: SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_CORPSE
+	 * which caused (startsolid == true) when, for example, a health was touching a monster.
+	 * Changing MOVE_NORMAL also fixes that, but other engines are using MOVE_NORMAL here.
+	 */
 	VectorCopy(PRVM_serveredictvector(ent, origin), entorigin);
 	VectorCopy(PRVM_serveredictvector(ent, mins), entmins);
 	VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs);
-	trace = SV_TraceBox(entorigin, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value);
+	trace = SV_TraceBox(entorigin, entmins, entmaxs, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID, 0, 0, collision_extendmovelength.value);
 	if (trace.startsolid && sv_gameplayfix_droptofloorstartsolid.integer)
 	{
 		vec3_t offset, org;
 		VectorSet(offset, 0.5f * (PRVM_serveredictvector(ent, mins)[0] + PRVM_serveredictvector(ent, maxs)[0]), 0.5f * (PRVM_serveredictvector(ent, mins)[1] + PRVM_serveredictvector(ent, maxs)[1]), PRVM_serveredictvector(ent, mins)[2]);
 		VectorAdd(PRVM_serveredictvector(ent, origin), offset, org);
-		trace = SV_TraceLine(org, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value);
+		trace = SV_TraceLine(org, end, MOVE_NORMAL, ent, SUPERCONTENTS_SOLID, 0, 0, collision_extendmovelength.value);
 		VectorSubtract(trace.endpos, offset, trace.endpos);
 		if (trace.startsolid)
 		{