diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 8a72eafbd..bc7aaa6d2 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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 - Made sdl/i_system.cpp:I_GetTimePolled() functionally equivalent to the Win32 version. diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 9573cadfa..f4bf83204 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -155,7 +155,7 @@ bool AHolySpirit::IsOkayToAttack (AActor *link) { return false; } - if (!(link->flags&MF_SHOOTABLE)) + if (!(link->flags & MF_SHOOTABLE)) { return false; } diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index 2eb15c730..85b51d330 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -108,10 +108,9 @@ int AMageStaffFX2::SpecialMissileHit (AActor *victim) bool AMageStaffFX2::IsOkayToAttack (AActor *link) { - if (((link->flags3&MF3_ISMONSTER) || link->player) - && !(link->flags2&MF2_DORMANT)) + if (((link->flags3 & MF3_ISMONSTER) || link->player) && !(link->flags2 & MF2_DORMANT)) { - if (!(link->flags&MF_SHOOTABLE)) + if (!(link->flags & MF_SHOOTABLE)) { return false; } @@ -123,7 +122,11 @@ bool AMageStaffFX2::IsOkayToAttack (AActor *link) { return false; } - else if (P_CheckSight (this, link)) + if (target != NULL && target->IsFriend(link)) + { + return false; + } + if (P_CheckSight (this, link)) { AActor *master = target; angle_t angle = R_PointToAngle2 (master->x, master->y, diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index d6a199ec5..1ad98c25a 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -84,7 +84,7 @@ void AMinotaurFriend::Serialize (FArchive &arc) 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)) { // Don't attack friends @@ -542,9 +542,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook) while ((mo = iterator.Next()) != NULL) { - if (!(mo->flags3&MF3_ISMONSTER)) continue; + if (!(mo->flags3 & MF3_ISMONSTER)) 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); if (dist > MINOTAUR_LOOK_DIST) continue; if ((mo == master) || (mo == self)) continue; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 310b642cb..b1e0ebcd8 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1360,4 +1360,3 @@ static AActor *RoughBlockCheck (AActor *mo, int index) } return NULL; } - diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 014763e75..dfdde521f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2184,7 +2184,7 @@ void P_NightmareRespawn (AActor *mobj) mo->SpawnPoint[1] = mobj->SpawnPoint[1]; mo->SpawnPoint[2] = mobj->SpawnPoint[2]; 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->HandleSpawnFlags (); @@ -2403,14 +2403,17 @@ bool AActor::IsOkayToAttack (AActor *link) { if (player) // Minotaur looking around player { - if ((link->flags3 & MF3_ISMONSTER) || - (link->player && (link != this))) + if ((link->flags3 & MF3_ISMONSTER) || (link->player && (link != this))) { - if (!(link->flags&MF_SHOOTABLE)) + if (IsFriend(link)) { return false; } - if (link->flags2&MF2_DORMANT) + if (!(link->flags & MF_SHOOTABLE)) + { + return false; + } + if (link->flags2 & MF2_DORMANT) { return false; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index fc576c87b..1f3151e08 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2216,16 +2216,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) if (fd != NULL) { + bool kill_before, kill_after; + + kill_before = self->CountsAsKill(); if (fd->structoffset == -1) { HandleDeprecatedFlags(self, cls->ActorInfo, expression, fd->flagbit); } else { - int * flagp = (int*) (((char*)self) + fd->structoffset); + int *flagp = (int*) (((char*)self) + fd->structoffset); - if (expression) *flagp |= fd->flagbit; - else *flagp &= ~fd->flagbit; + if (expression) + { + *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