Skip to content

Commit

Permalink
FC stuff plus one leftover commented out fragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Oct 16, 2023
1 parent 84a31a8 commit f65553c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions source/games/blood/src/blood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions source/games/blood/src/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Expand Down
14 changes: 14 additions & 0 deletions source/games/blood/src/nnextcdud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions source/games/blood/src/nnextcdud.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f65553c

Please sign in to comment.