revert this

This commit is contained in:
Alug committed 2024-09-02 17:58:35 +02:00
1 parent 94ddd01427
commit 882a3b7824
1 file changed
+28 -32
+28 -32
View File
@@ -10081,21 +10081,13 @@ void P_RemoveMobj(mobj_t *mobj)
if (mobj->hnext && !P_MobjWasRemoved(mobj->hnext))
{
if (mobj->hnext->hprev == mobj)
{
P_SetTarget(&mobj->hnext->hprev, mobj->hprev);
}
P_SetTarget(&mobj->hnext->hprev, mobj->hprev);
P_SetTarget(&mobj->hnext, NULL);
}
if (mobj->hprev && !P_MobjWasRemoved(mobj->hprev))
{
if (mobj->hprev->hnext == mobj)
{
P_SetTarget(&mobj->hprev->hnext, cachenext);
}
P_SetTarget(&mobj->hprev->hnext, cachenext);
P_SetTarget(&mobj->hprev, NULL);
}
@@ -10103,35 +10095,39 @@ void P_RemoveMobj(mobj_t *mobj)
if (mobj->spawnpoint)
mobj->spawnpoint->mobj = NULL;
R_RemoveMobjInterpolator(mobj);
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
// free block
if (!mobj->thinker.next)
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
if (mobj->flags & MF_NOTHINK && !mobj->thinker.next)
{ // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through!
INT32 prevreferences;
if (!mobj->thinker.references)
{
Z_Free(mobj); // No references? Can be removed immediately! :D
return;
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset(mobj, 0xff, sizeof(mobj_t));
#endif
Z_Free(mobj); // No refrences? Can be removed immediately! :D
}
prevreferences = mobj->thinker.references;
P_AddThinker((thinker_t *)mobj);
mobj->thinker.references = prevreferences;
else
{ // Add thinker just to delay removing it until refrences are gone.
mobj->flags &= ~MF_NOTHINK;
P_AddThinker((thinker_t *)mobj);
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
P_RemoveThinker((thinker_t *)mobj);
}
}
else
{
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
P_RemoveThinker((thinker_t *)mobj);
}
P_RemoveThinker((thinker_t *)mobj);
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
R_RemoveMobjInterpolator(mobj);
}
// This does not need to be added to Lua.