diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a6c0e064af..9f444321c4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,11 @@ -March 28, 2009 (Changes by Graf Zahl) +March 29, 2009 (Changes by Graf Zahl) +- 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. + +March 28, 2009 (Changes by Graf Zahl) - Fixed: Dehacked string replacement did not check the clusters' finaleflats. - Changed the definition of several typedef'd structs so that they are properly named. diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index ac75f472e9..4fa4a699d2 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -51,6 +51,9 @@ enum LINK_CEILINGMIRROR=10, LINK_BOTHMIRROR=15, + LINK_FLOORBITS=5, + LINK_CEILINGBITS=10, + LINK_FLAGMASK = 15 }; @@ -236,26 +239,20 @@ void P_StartLinkedSectorInterpolations(TArray &list, sector_t static void AddSingleSector(extsector_t::linked::plane &scrollplane, sector_t *sector, int movetype) { // First we have to check the list if the sector is already in it - // If so the move type may have to be adjusted or the link to be removed + // If so the move type must be adjusted for(unsigned i = 0; i < scrollplane.Sectors.Size(); i++) { if (scrollplane.Sectors[i].Sector == sector) { - int oldtype = scrollplane.Sectors[i].Type; - - if ((oldtype & (LINK_FLOOR|LINK_FLOORMIRROR)) && - (movetype & (LINK_FLOORMIRROR|LINK_FLOOR))) + if (movetype & LINK_FLOORBITS) { - // Invalid combination for floor. - movetype &= ~(LINK_FLOOR + LINK_FLOORMIRROR); + scrollplane.Sectors[i].Type &= ~LINK_FLOORBITS; } - if ((oldtype & (LINK_CEILING|LINK_CEILINGMIRROR)) && - (movetype == LINK_CEILINGMIRROR || movetype == LINK_CEILING)) + if (movetype & LINK_CEILINGBITS) { - // Invalid combination for CEILING. - movetype &= ~(LINK_CEILING + LINK_CEILINGMIRROR); + scrollplane.Sectors[i].Type &= ~LINK_CEILINGBITS; } scrollplane.Sectors[i].Type |= movetype; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index f63441416f..0fd476a44d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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 { diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index f08e5ed9bf..65b527100f 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1776,7 +1776,18 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, scoreicon, S, PlayerPawn) DEFINE_CLASS_PROPERTY_PREFIX(player, crouchsprite, S, PlayerPawn) { PROP_STRING_PARM(z, 0); - defaults->crouchsprite = GetSpriteIndex (z); + if (strlen(z) == 4) + { + defaults->crouchsprite = GetSpriteIndex (z); + } + else if (*z == 0) + { + defaults->crouchsprite = 0; + } + else + { + I_Error("Sprite name must have exactly 4 characters"); + } } //==========================================================================