- added a ClearCounters function to AActor that handles everything necessary to un-count an item that is not supposed to be counted but has some of the COUNT* flags set.

- merged all places where secrets are credited into one common function.
- added the Doom64 COUNTSECRET actor flag.
- fixed: AInventory::CreateCopy did not clear the COUNTITEM flag.
- fixed: Dropping an item did not increase the item count but the dropped item could still have the COUNTITEM flag. Now this flag gets cleared when the item gets picked up so that dropped items don't count a second time.

SVN r2826 (trunk)
This commit is contained in:
Christoph Oelckers 2010-09-19 00:06:45 +00:00
commit df138fe4f9
20 changed files with 137 additions and 100 deletions

View file

@ -105,15 +105,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
{
// If this is a monster, subtract it from the total monster
// count, because it already added to it during spawning.
if (mobj->CountsAsKill())
{
level.total_monsters--;
}
// Same, for items
if (mobj->flags & MF_COUNTITEM)
{
level.total_items--;
}
mobj->ClearCounters();
mobj->Destroy ();
}
}
@ -352,15 +344,7 @@ nolead: mobj->angle = R_PointToAngle2 (mobj->x, mobj->y, targ->x, targ->y);
{
// If this is a monster, subtract it from the total monster
// count, because it already added to it during spawning.
if (mobj->CountsAsKill())
{
level.total_monsters--;
}
// Same, for items
if (mobj->flags & MF_COUNTITEM)
{
level.total_items--;
}
mobj->ClearCounters();
mobj->Destroy ();
}
else
@ -418,8 +402,7 @@ void P_RemoveThing(AActor * actor)
if (actor->player == NULL || actor != actor->player->mo)
{
// be friendly to the level statistics. ;)
if (actor->CountsAsKill() && actor->health > 0) level.total_monsters--;
if (actor->flags&MF_COUNTITEM) level.total_items--;
actor->ClearCounters();
actor->Destroy ();
}
}