Fix mbf21 add / remove NOBLOCKMAP or NOSECTOR (#1930)

Co-authored-by: Xaser Acheron <xaser.88@gmail.com>
This commit is contained in:
Fabian Greffrath 2024-10-01 08:24:29 +02:00 committed by GitHub
parent ec0e91f1e2
commit 1d27148032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3270,6 +3270,7 @@ void A_JumpIfFlagsSet(mobj_t* actor)
void A_AddFlags(mobj_t* actor)
{
unsigned int flags, flags2;
boolean update_blockmap;
if (!mbf21 || !actor)
return;
@ -3277,8 +3278,19 @@ void A_AddFlags(mobj_t* actor)
flags = actor->state->args[0];
flags2 = actor->state->args[1];
// unlink/relink the thing from the blockmap if
// the NOBLOCKMAP or NOSECTOR flags are added
update_blockmap = ((flags & MF_NOBLOCKMAP) && !(actor->flags & MF_NOBLOCKMAP))
|| ((flags & MF_NOSECTOR) && !(actor->flags & MF_NOSECTOR));
if (update_blockmap)
P_UnsetThingPosition(actor);
actor->flags |= flags;
actor->flags2 |= flags2;
if (update_blockmap)
P_SetThingPosition(actor);
}
//
@ -3290,6 +3302,7 @@ void A_AddFlags(mobj_t* actor)
void A_RemoveFlags(mobj_t* actor)
{
unsigned int flags, flags2;
boolean update_blockmap;
if (!mbf21 || !actor)
return;
@ -3297,8 +3310,19 @@ void A_RemoveFlags(mobj_t* actor)
flags = actor->state->args[0];
flags2 = actor->state->args[1];
// unlink/relink the thing from the blockmap if
// the NOBLOCKMAP or NOSECTOR flags are removed
update_blockmap = ((flags & MF_NOBLOCKMAP) && (actor->flags & MF_NOBLOCKMAP))
|| ((flags & MF_NOSECTOR) && (actor->flags & MF_NOSECTOR));
if (update_blockmap)
P_UnsetThingPosition(actor);
actor->flags &= ~flags;
actor->flags2 &= ~flags2;
if (update_blockmap)
P_SetThingPosition(actor);
}
//----------------------------------------------------------------------------