From ef7c72ce9f7aaa8563c5fa2de8d4ddfca0d1b96f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 18 Dec 2022 17:48:25 +0100 Subject: [PATCH] - Blood: add all statically stored EventObjects to the GC processor. --- source/core/shared_hud.cpp | 3 +-- source/games/blood/src/blood.cpp | 12 ++++++++++++ source/games/blood/src/eventq.h | 2 +- source/games/blood/src/seq.cpp | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source/core/shared_hud.cpp b/source/core/shared_hud.cpp index 6dc49e226..292420d66 100644 --- a/source/core/shared_hud.cpp +++ b/source/core/shared_hud.cpp @@ -138,7 +138,6 @@ void CreateAltHUD() { if (AltHud) { - GC::DelSoftRoot(AltHud); AltHud->Destroy(); AltHud = nullptr; } @@ -152,7 +151,7 @@ void CreateAltHUD() AltHud = DoCreateAltHUD(NAME_AltHud); assert(AltHud); - GC::AddSoftRoot(AltHud); + GC::AddMarkerFunc([]() { GC::Mark(AltHud); }); } diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 371295d9b..f67eefaf8 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "statusbar.h" #include "vm.h" #include "tilesetbuilder.h" +#include "nnexts.h" BEGIN_BLD_NS @@ -75,6 +76,8 @@ IMPLEMENT_POINTERS_END // //--------------------------------------------------------------------------- void MarkSprInSect(); +void MarkSeq(); + size_t DBloodActor::PropagateMark() { @@ -102,6 +105,15 @@ static void markgcroots() GC::Mark(pl.fragger); GC::Mark(pl.voodooTarget); } + for (auto& evobj : rxBucket) + { + evobj.Mark(); + } + for (auto& cond : gConditions) + { + for (auto& obj : cond.objects) obj.obj.Mark(); + } + MarkSeq(); } diff --git a/source/games/blood/src/eventq.h b/source/games/blood/src/eventq.h index c767b9de1..461482928 100644 --- a/source/games/blood/src/eventq.h +++ b/source/games/blood/src/eventq.h @@ -118,7 +118,7 @@ enum { kChannelMax = 4096, }; -extern EventObject rxBucket[]; +extern EventObject rxBucket[kChannelMax]; extern unsigned short bucketHead[]; enum COMMAND_ID { diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index e85f76948..724da41f2 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -468,10 +468,20 @@ struct ActiveList remove(SS_SPRITE, EventObject(actor)); } + void Mark() + { + for (auto& seqinst : list) seqinst.target.Mark(); + } + }; static ActiveList activeList; +void MarkSeq() +{ + activeList.Mark(); +} + //--------------------------------------------------------------------------- // //