GC stuff plus one leftover commented out fragment.

This commit is contained in:
Christoph Oelckers 2023-10-16 23:41:52 +02:00
parent 6e0d61d137
commit 1f5ff06b91
4 changed files with 22 additions and 9 deletions

View file

@ -59,8 +59,9 @@ IMPLEMENT_CLASS(DBloodActor, false, true)
IMPLEMENT_POINTERS_START(DBloodActor)
#ifdef NOONE_EXTENSIONS
IMPLEMENT_POINTER(prevmarker)
IMPLEMENT_POINTER(ownerActor)
IMPLEMENT_POINTER(customDude)
#endif
IMPLEMENT_POINTER(ownerActor)
IMPLEMENT_POINTER(xspr.burnSource)
IMPLEMENT_POINTER(xspr.target)
IMPLEMENT_POINTERS_END
@ -105,8 +106,7 @@ size_t DBloodActor::PropagateMark()
if (hit.ceilhit.type == kHitSprite) GC::Mark(hit.ceilhit.hitActor);
if (hit.florhit.type == kHitSprite) GC::Mark(hit.florhit.hitActor);
#ifdef NOONE_EXTENSIONS
condition[0].Mark();
condition[1].Mark();
for(auto& cond : condition) cond.Mark();
#endif
return Super::PropagateMark();
}

View file

@ -460,6 +460,7 @@ void DBloodActor::Serialize(FSerializer& arc)
{
arc//("spritemass", spriteMass) // should always be cached and not written out.
("prevmarker", prevmarker)
("customdude", customDude)
.Array("conditions", condition, 4);
}

View file

@ -4452,6 +4452,20 @@ size_t DCustomDude::PropagateMark()
return pSlaves.Size() + Super::PropagateMark();
}
void DCustomDude::OnDestroy()
{
// free all allocations now and sever the link to the dude actor.
pSpr = nullptr;
pSlaves.Reset();
for (auto& ef : effects)
{
ef.pAnims.Reset();
ef.pFrames.Reset();
ef.pStates.Reset();
}
Super::Destroy();
}
END_BLD_NS
#endif

View file

@ -983,12 +983,9 @@ class CUSTOMDUDE_EFFECT
}
else if (nID >= kCudeFXEffectCallbackBase)
{
#pragma message("Fix " __FUNCTION__ " for custom callbacks")
#if 0
nID = gCdudeCustomCallback[nID - kCudeFXEffectCallbackBase];
evKill(pSpr->index, OBJ_SPRITE, (CALLBACK_ID)nID);
evPost(pSpr->index, OBJ_SPRITE, 0, (CALLBACK_ID)nID);
#endif
auto func = *gCdudeCustomCallback[nID - kCudeFXEffectCallbackBase];
evKillActor(pSpr, func);
evPostActor(pSpr, 0, func);
}
else
{
@ -1195,6 +1192,7 @@ class DCustomDude : public DObject
HAS_OBJECT_POINTERS
size_t PropagateMark() override;
void OnDestroy();
// Note: we will likely have to write out the entire shit here to make this savegame robust...
public: