Skip to content

Commit

Permalink
- Blood: add all statically stored EventObjects to the GC processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Dec 18, 2022
1 parent a9ad2a3 commit 2d551e6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 1 addition & 2 deletions source/core/shared_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ void CreateAltHUD()
{
if (AltHud)
{
GC::DelSoftRoot(AltHud);
AltHud->Destroy();
AltHud = nullptr;
}
Expand All @@ -152,7 +151,7 @@ void CreateAltHUD()
AltHud = DoCreateAltHUD(NAME_AltHud);

assert(AltHud);
GC::AddSoftRoot(AltHud);
GC::AddMarkerFunc([]() { GC::Mark(AltHud); });
}


Expand Down
12 changes: 12 additions & 0 deletions source/games/blood/src/blood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "texturemanager.h"
#include "statusbar.h"
#include "vm.h"
#include "nnexts.h"

BEGIN_BLD_NS

Expand All @@ -74,6 +75,8 @@ IMPLEMENT_POINTERS_END
//
//---------------------------------------------------------------------------
void MarkSprInSect();
void MarkSeq();


size_t DBloodActor::PropagateMark()
{
Expand Down Expand Up @@ -101,6 +104,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();
}


Expand Down
2 changes: 1 addition & 1 deletion source/games/blood/src/eventq.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ enum {
kChannelMax = 4096,
};

extern EventObject rxBucket[];
extern EventObject rxBucket[kChannelMax];
extern unsigned short bucketHead[];

enum COMMAND_ID {
Expand Down
10 changes: 10 additions & 0 deletions source/games/blood/src/seq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,20 @@ struct ActiveList
remove(SS_SPRITE, EventObject(actor));
}

void Mark()
{
for (auto& seqinst : list) seqinst.target.Mark();
}

};

static ActiveList activeList;

void MarkSeq()
{
activeList.Mark();
}

//---------------------------------------------------------------------------
//
//
Expand Down

0 comments on commit 2d551e6

Please sign in to comment.