mobj hnext/hprev list fixes for phobos build

too lazy to cherry pick so
https://gitlab.com/kart-krew-dev/ring-racers/-/commit/a392996a5437742d5b7a91d0fce9da49c3a8bd76
and
https://gitlab.com/kart-krew-dev/ring-racers/-/commit/8b5bd645ca5d8ef9269aa6ccf4375337bd0c1672

both of which might change behavior so phobos only
This commit is contained in:
alufolie91 committed 2026-09-25 19:03:46 +02:00
1 parent 9521183eb3
commit dd2a227529
3 files changed
+36 -4

No files matched your search

+21 -2
View File
@@ -4399,8 +4399,7 @@ void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source)
mobj_t *cachenext;
killnext:
if (!banana)
if (P_MobjWasRemovedCompat(banana))
return;
cachenext = banana->hnext;
@@ -4439,10 +4438,21 @@ void K_UpdateHnextList(player_t *player, boolean clean)
nextwork = work->hnext;
if (!clean && (!work->movedir || work->movedir <= (UINT16)player->kartstuff[k_itemamount]))
{
continue;
}
P_RemoveMobj(work);
}
#ifdef PHOBOS_BUILD
if (P_MobjWasRemoved(player->mo->hnext))
{
// Like below, try to clean up the pointer if it's NULL.
// Maybe this was a cause of the shrink/eggbox fails?
P_SetTarget(&player->mo->hnext, NULL);
}
#endif
}
// For getting hit!
@@ -4507,7 +4517,9 @@ void K_DropHnextList(player_t *player)
}
dropwork = P_SpawnMobj(work->x, work->y, work->z, type);
P_SetTarget(&dropwork->target, player->mo);
dropwork->angle = work->angle;
dropwork->flags2 = work->flags2;
dropwork->flags |= MF_NOCLIPTHING;
@@ -4575,10 +4587,13 @@ void K_DropHnextList(player_t *player)
// we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic...
P_SetTarget(&player->mo->hnext, NULL);
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld])
{
player->kartstuff[k_eggmanheld] = 0;
}
else if (player->kartstuff[k_itemheld]
&& (dropall || (--player->kartstuff[k_itemamount] <= 0)))
{
@@ -4879,7 +4894,9 @@ static void K_MoveHeldObjects(player_t *player)
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld])
{
player->kartstuff[k_eggmanheld] = 0;
}
else if (player->kartstuff[k_itemheld])
{
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
@@ -4896,7 +4913,9 @@ static void K_MoveHeldObjects(player_t *player)
player->kartstuff[k_bananadrag] = 0;
if (player->kartstuff[k_eggmanheld])
{
player->kartstuff[k_eggmanheld] = 0;
}
else if (player->kartstuff[k_itemheld])
{
player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0;
+14 -2
View File
@@ -10338,13 +10338,25 @@ void P_RemoveMobj(mobj_t *mobj)
if (!P_MobjWasRemoved(mobj->hnext))
{
P_SetTarget(&mobj->hnext->hprev, mobj->hprev);
#ifdef PHOBOS_BUILD
if (mobj->hnext->hprev == mobj)
#endif
{
P_SetTarget(&mobj->hnext->hprev, mobj->hprev);
}
P_SetTarget(&mobj->hnext, NULL);
}
if (!P_MobjWasRemoved(mobj->hprev))
{
P_SetTarget(&mobj->hprev->hnext, cachenext);
#ifdef PHOBOS_BUILD
if (mobj->hprev->hnext == mobj)
#endif
{
P_SetTarget(&mobj->hprev->hnext, cachenext);
}
P_SetTarget(&mobj->hprev, NULL);
}
+1
View File
@@ -3328,6 +3328,7 @@ static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
return false;
}
//
// P_CheckReplacMapReplacements
//