- 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
parent 7060f72186
commit f62fcabb9c
4 changed files with 50 additions and 14 deletions

View file

@ -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. - Fixed: Dehacked string replacement did not check the clusters' finaleflats.
- Changed the definition of several typedef'd structs so that they are - Changed the definition of several typedef'd structs so that they are
properly named. properly named.

View file

@ -51,6 +51,9 @@ enum
LINK_CEILINGMIRROR=10, LINK_CEILINGMIRROR=10,
LINK_BOTHMIRROR=15, LINK_BOTHMIRROR=15,
LINK_FLOORBITS=5,
LINK_CEILINGBITS=10,
LINK_FLAGMASK = 15 LINK_FLAGMASK = 15
}; };
@ -236,26 +239,20 @@ void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t
static void AddSingleSector(extsector_t::linked::plane &scrollplane, sector_t *sector, int movetype) 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 // 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++) for(unsigned i = 0; i < scrollplane.Sectors.Size(); i++)
{ {
if (scrollplane.Sectors[i].Sector == sector) if (scrollplane.Sectors[i].Sector == sector)
{ {
int oldtype = scrollplane.Sectors[i].Type; if (movetype & LINK_FLOORBITS)
if ((oldtype & (LINK_FLOOR|LINK_FLOORMIRROR)) &&
(movetype & (LINK_FLOORMIRROR|LINK_FLOOR)))
{ {
// Invalid combination for floor. scrollplane.Sectors[i].Type &= ~LINK_FLOORBITS;
movetype &= ~(LINK_FLOOR + LINK_FLOORMIRROR);
} }
if ((oldtype & (LINK_CEILING|LINK_CEILINGMIRROR)) && if (movetype & LINK_CEILINGBITS)
(movetype == LINK_CEILINGMIRROR || movetype == LINK_CEILING))
{ {
// Invalid combination for CEILING. scrollplane.Sectors[i].Type &= ~LINK_CEILINGBITS;
movetype &= ~(LINK_CEILING + LINK_CEILINGMIRROR);
} }
scrollplane.Sectors[i].Type |= movetype; scrollplane.Sectors[i].Type |= movetype;

View file

@ -2298,16 +2298,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
if (fd != NULL) if (fd != NULL)
{ {
bool kill_before, kill_after; bool kill_before, kill_after;
INTBOOL item_before, item_after;
kill_before = self->CountsAsKill(); kill_before = self->CountsAsKill();
item_before = self->flags & MF_COUNTITEM;
if (fd->structoffset == -1) if (fd->structoffset == -1)
{ {
HandleDeprecatedFlags(self, cls->ActorInfo, expression, fd->flagbit); HandleDeprecatedFlags(self, cls->ActorInfo, expression, fd->flagbit);
} }
else 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) if (expression)
{ {
*flagp |= fd->flagbit; *flagp |= fd->flagbit;
@ -2316,8 +2323,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
{ {
*flagp &= ~fd->flagbit; *flagp &= ~fd->flagbit;
} }
if (linkchange) self->LinkToWorld();
} }
kill_after = self->CountsAsKill(); kill_after = self->CountsAsKill();
item_after = self->flags & MF_COUNTITEM;
// Was this monster previously worth a kill but no longer is? // Was this monster previously worth a kill but no longer is?
// Or vice versa? // Or vice versa?
if (kill_before != kill_after) if (kill_before != kill_after)
@ -2331,6 +2340,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
level.total_monsters--; 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 else
{ {

View file

@ -1776,7 +1776,18 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, scoreicon, S, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, crouchsprite, S, PlayerPawn) DEFINE_CLASS_PROPERTY_PREFIX(player, crouchsprite, S, PlayerPawn)
{ {
PROP_STRING_PARM(z, 0); 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");
}
} }
//========================================================================== //==========================================================================