From ffe591afeee2b48875235e86bc3480ce99850cb3 Mon Sep 17 00:00:00 2001
From: Sally Coolatta <tehrealsalt@gmail.com>
Date: Mon, 28 Feb 2022 17:36:02 -0500
Subject: [PATCH] Tie emblem spawning to Coop gametypes

---
 src/g_game.c | 6 +++++-
 src/p_mobj.c | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/g_game.c b/src/g_game.c
index b3dffd0e62..106682aeee 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -3843,16 +3843,19 @@ static void G_UpdateVisited(gamedata_t *data, boolean silent)
 {
 	boolean spec = G_IsSpecialStage(gamemap);
 	// Update visitation flags?
-	if (!demoplayback && (gametype == GT_COOP) // SP/RA/NiGHTS mode
+	if (!demoplayback
+		&& G_CoopGametype() // Campaign mode
 		&& !stagefailed) // Did not fail the stage
 	{
 		UINT8 earnedEmblems;
 
 		// Update visitation flags
 		data->mapvisited[gamemap-1] |= MV_BEATEN;
+
 		// eh, what the hell
 		if (ultimatemode)
 			data->mapvisited[gamemap-1] |= MV_ULTIMATE;
+
 		// may seem incorrect but IS possible in what the main game uses as mp special stages, and nummaprings will be -1 in NiGHTS
 		if (nummaprings > 0 && players[consoleplayer].rings >= nummaprings)
 		{
@@ -3860,6 +3863,7 @@ static void G_UpdateVisited(gamedata_t *data, boolean silent)
 			if (modeattacking)
 				data->mapvisited[gamemap-1] |= MV_PERFECTRA;
 		}
+
 		if (!spec)
 		{
 			// not available to special stages because they can only really be done in one order in an unmodified game, so impossible for first six and trivial for seventh
diff --git a/src/p_mobj.c b/src/p_mobj.c
index f198a1a69a..e79977c487 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -12009,6 +12009,10 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i)
 			return false; // You already got this token
 
 		break;
+	case MT_EMBLEM:
+		if (!G_CoopGametype())
+			return false; // Gametype's not right
+		break;
 	default:
 		break;
 	}
-- 
GitLab