- Fixed: AMageStaffFX2::IsOkayToAttack() / A_MStaffAttack aimed at friendlies.

- Added kill count awareness to A_ChangeFlag.
- P_NightmareRespawn() now clears the MTF_AMBUSH flag, so respawned monsters
  aren't dormant (since there would be no way to activate them, and they
  were certainly not dormant when they died).


SVN r1287 (trunk)
This commit is contained in:
Randy Heit 2008-11-14 23:12:15 +00:00
parent c1cefee2f4
commit 183b765cf2
7 changed files with 52 additions and 17 deletions

View file

@ -1,3 +1,10 @@
November 14, 2008
- Fixed: AMageStaffFX2::IsOkayToAttack() / A_MStaffAttack aimed at friendlies.
- Added kill count awareness to A_ChangeFlag.
- P_NightmareRespawn() now clears the MTF_AMBUSH flag, so respawned monsters
aren't dormant (since there would be no way to activate them, and they
were certainly not dormant when they died).
November 8, 2008 November 8, 2008
- Made sdl/i_system.cpp:I_GetTimePolled() functionally equivalent to the - Made sdl/i_system.cpp:I_GetTimePolled() functionally equivalent to the
Win32 version. Win32 version.

View file

@ -155,7 +155,7 @@ bool AHolySpirit::IsOkayToAttack (AActor *link)
{ {
return false; return false;
} }
if (!(link->flags&MF_SHOOTABLE)) if (!(link->flags & MF_SHOOTABLE))
{ {
return false; return false;
} }

View file

@ -108,10 +108,9 @@ int AMageStaffFX2::SpecialMissileHit (AActor *victim)
bool AMageStaffFX2::IsOkayToAttack (AActor *link) bool AMageStaffFX2::IsOkayToAttack (AActor *link)
{ {
if (((link->flags3&MF3_ISMONSTER) || link->player) if (((link->flags3 & MF3_ISMONSTER) || link->player) && !(link->flags2 & MF2_DORMANT))
&& !(link->flags2&MF2_DORMANT))
{ {
if (!(link->flags&MF_SHOOTABLE)) if (!(link->flags & MF_SHOOTABLE))
{ {
return false; return false;
} }
@ -123,7 +122,11 @@ bool AMageStaffFX2::IsOkayToAttack (AActor *link)
{ {
return false; return false;
} }
else if (P_CheckSight (this, link)) if (target != NULL && target->IsFriend(link))
{
return false;
}
if (P_CheckSight (this, link))
{ {
AActor *master = target; AActor *master = target;
angle_t angle = R_PointToAngle2 (master->x, master->y, angle_t angle = R_PointToAngle2 (master->x, master->y,

View file

@ -84,7 +84,7 @@ void AMinotaurFriend::Serialize (FArchive &arc)
bool AMinotaurFriend::IsOkayToAttack (AActor *link) bool AMinotaurFriend::IsOkayToAttack (AActor *link)
{ {
if ((link->flags3&MF3_ISMONSTER) && (link != tracer)) if ((link->flags3 & MF3_ISMONSTER) && (link != tracer))
{ {
if (!((link->flags ^ flags) & MF_FRIENDLY)) if (!((link->flags ^ flags) & MF_FRIENDLY))
{ // Don't attack friends { // Don't attack friends
@ -542,9 +542,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
while ((mo = iterator.Next()) != NULL) while ((mo = iterator.Next()) != NULL)
{ {
if (!(mo->flags3&MF3_ISMONSTER)) continue; if (!(mo->flags3 & MF3_ISMONSTER)) continue;
if (mo->health <= 0) continue; if (mo->health <= 0) continue;
if (!(mo->flags&MF_SHOOTABLE)) continue; if (!(mo->flags & MF_SHOOTABLE)) continue;
dist = P_AproxDistance (self->x - mo->x, self->y - mo->y); dist = P_AproxDistance (self->x - mo->x, self->y - mo->y);
if (dist > MINOTAUR_LOOK_DIST) continue; if (dist > MINOTAUR_LOOK_DIST) continue;
if ((mo == master) || (mo == self)) continue; if ((mo == master) || (mo == self)) continue;

View file

@ -1360,4 +1360,3 @@ static AActor *RoughBlockCheck (AActor *mo, int index)
} }
return NULL; return NULL;
} }

View file

@ -2184,7 +2184,7 @@ void P_NightmareRespawn (AActor *mobj)
mo->SpawnPoint[1] = mobj->SpawnPoint[1]; mo->SpawnPoint[1] = mobj->SpawnPoint[1];
mo->SpawnPoint[2] = mobj->SpawnPoint[2]; mo->SpawnPoint[2] = mobj->SpawnPoint[2];
mo->SpawnAngle = mobj->SpawnAngle; mo->SpawnAngle = mobj->SpawnAngle;
mo->SpawnFlags = mobj->SpawnFlags; mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either.
mo->angle = ANG45 * (mobj->SpawnAngle/45); mo->angle = ANG45 * (mobj->SpawnAngle/45);
mo->HandleSpawnFlags (); mo->HandleSpawnFlags ();
@ -2403,14 +2403,17 @@ bool AActor::IsOkayToAttack (AActor *link)
{ {
if (player) // Minotaur looking around player if (player) // Minotaur looking around player
{ {
if ((link->flags3 & MF3_ISMONSTER) || if ((link->flags3 & MF3_ISMONSTER) || (link->player && (link != this)))
(link->player && (link != this)))
{ {
if (!(link->flags&MF_SHOOTABLE)) if (IsFriend(link))
{ {
return false; return false;
} }
if (link->flags2&MF2_DORMANT) if (!(link->flags & MF_SHOOTABLE))
{
return false;
}
if (link->flags2 & MF2_DORMANT)
{ {
return false; return false;
} }

View file

@ -2216,16 +2216,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
if (fd != NULL) if (fd != NULL)
{ {
bool kill_before, kill_after;
kill_before = self->CountsAsKill();
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); int *flagp = (int*) (((char*)self) + fd->structoffset);
if (expression) *flagp |= fd->flagbit; if (expression)
else *flagp &= ~fd->flagbit; {
*flagp |= fd->flagbit;
}
else
{
*flagp &= ~fd->flagbit;
}
}
kill_after = self->CountsAsKill();
// Was this monster previously worth a kill but no longer is?
// Or vice versa?
if (kill_before != kill_after)
{
if (kill_after)
{ // It counts as a kill now.
level.total_monsters++;
}
else
{ // It no longer counts as a kill.
level.total_monsters--;
}
} }
} }
else else