From 8b6140ddb232360dd48f90cd8f25a7d5fba6ee1c Mon Sep 17 00:00:00 2001
From: MascaraSnake <jonassauer27@gmail.com>
Date: Tue, 21 Sep 2021 12:55:56 +0200
Subject: [PATCH] Linedef type 464: Use taglist search to find egg capsule
 center

---
 src/p_spec.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/p_spec.c b/src/p_spec.c
index 589b311451..8a8997697e 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -3614,25 +3614,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
 
 		case 464: // Trigger Egg Capsule
 			{
-				thinker_t *th;
+				INT32 mtnum;
 				mobj_t *mo2;
 
 				// Find the center of the Eggtrap and release all the pretty animals!
 				// The chimps are my friends.. heeheeheheehehee..... - LouisJM
-				for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
+				TAG_ITER_THINGS(line->args[0], mtnum)
 				{
-					if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
-						continue;
-
-					mo2 = (mobj_t *)th;
-
-					if (mo2->type != MT_EGGTRAP)
-						continue;
+					mo2 = mapthings[mtnum].mobj;
 
-					if (!mo2->spawnpoint)
+					if (!mo2)
 						continue;
 
-					if (!Tag_Find(&mo2->spawnpoint->tags, line->args[0]))
+					if (mo2->thinker.function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
 						continue;
 
 					P_KillMobj(mo2, NULL, mo, 0);
-- 
GitLab