- Fixed: Altering a link type with Sector_SetLink did not work.

- Fixed: player.crouchsprite had no proper means of unsetting the crouch
  sprite which is needed by the ChexPlayer.
- Fixed: A_ChangeFlags must unlink the actor from the world before changing
  the NOBLOCKMAP and NOSECTOR flags.

SVN r1514 (trunk)
This commit is contained in:
Christoph Oelckers 2009-03-29 08:55:15 +00:00
commit f62fcabb9c
4 changed files with 50 additions and 14 deletions

View file

@ -2298,16 +2298,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
if (fd != NULL)
{
bool kill_before, kill_after;
INTBOOL item_before, item_after;
kill_before = self->CountsAsKill();
item_before = self->flags & MF_COUNTITEM;
if (fd->structoffset == -1)
{
HandleDeprecatedFlags(self, cls->ActorInfo, expression, fd->flagbit);
}
else
{
int *flagp = (int*) (((char*)self) + fd->structoffset);
DWORD *flagp = (DWORD*) (((char*)self) + fd->structoffset);
// If these 2 flags get changed we need to update the blockmap and sector links.
bool linkchange = flagp == &self->flags && (fd->flagbit == MF_NOBLOCKMAP || fd->flagbit == MF_NOSECTOR);
if (linkchange) self->UnlinkFromWorld();
if (expression)
{
*flagp |= fd->flagbit;
@ -2316,8 +2323,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
{
*flagp &= ~fd->flagbit;
}
if (linkchange) self->LinkToWorld();
}
kill_after = self->CountsAsKill();
item_after = self->flags & MF_COUNTITEM;
// Was this monster previously worth a kill but no longer is?
// Or vice versa?
if (kill_before != kill_after)
@ -2331,6 +2340,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
level.total_monsters--;
}
}
// same for items
if (item_before != item_after)
{
if (item_after)
{ // It counts as an item now.
level.total_items++;
}
else
{ // It no longer counts as an item
level.total_items--;
}
}
}
else
{