From f8899f98fcb523a4e78fc739faacc81c0f8e216c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Aug 2013 11:14:48 +0200 Subject: [PATCH] - fixed: The secret counter was not incremented for items that had the UDMF COUNTSECRET flag set. --- src/g_shared/a_randomspawner.cpp | 9 +++++++-- src/p_mobj.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 293b17d3b..adfc09b6e 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -121,7 +121,11 @@ class ARandomSpawner : public AActor AActor * newmobj = NULL; bool boss = false; Super::PostBeginPlay(); - if (Species == NAME_None) { Destroy(); return; } + if (Species == NAME_None) + { + Destroy(); + return; + } const PClass * cls = PClass::FindClass(Species); if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile. { @@ -142,8 +146,9 @@ class ARandomSpawner : public AActor newmobj->args[4] = args[4]; newmobj->special1 = special1; newmobj->special2 = special2; - newmobj->SpawnFlags = SpawnFlags; + newmobj->SpawnFlags = SpawnFlags & ~MTF_SECRET; // MTF_SECRET needs special treatment to avoid incrementing the secret counter twice. It had already been processed for the spawner itself. newmobj->HandleSpawnFlags(); + newmobj->SpawnFlags = SpawnFlags; newmobj->tid = tid; newmobj->AddToHash(); newmobj->velx = velx; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 14607a682..03bbb4d8d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3993,8 +3993,12 @@ void AActor::HandleSpawnFlags () } if (SpawnFlags & MTF_SECRET) { - //Printf("Secret %s in sector %i!\n", GetTag(), Sector->sectornum); - flags5 |= MF5_COUNTSECRET; + if (!(flags5 & MF5_COUNTSECRET)) + { + //Printf("Secret %s in sector %i!\n", GetTag(), Sector->sectornum); + flags5 |= MF5_COUNTSECRET; + level.total_secrets++; + } } }