[Fixed] A_BossDeath doesn't fully check replaced actors

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

A_BossDeath doesn't fully check replaced actors

Postby Major Cooke » Tue Sep 10, 2019 11:32 am

Load the attached file and start on MAP07 (hard skill to ensure the fatsos are randomized). Kill all of one color, and the walls will lower, which is not supposed to happen.

CheckReplacee was developed with the idea of not needing to to use RandomSpawners or any custom spawners. In particular, RandomSpawners rely upon the BOSS flag, which makes sense for cyberdemon and spider mastermind classes, but not barons, fatsos and arachnotrons.

The problematic code lies in CheckBossDeath function in p_enemy.cpp:

Code: Select allExpand view
while ( (other = iterator.Next ()) )
{
   if (other != actor &&
      (other->health > 0 || (other->flags & MF_ICECORPSE))
      && other->GetClass() == actor->GetClass())
   { // Found a living boss
      // [RH] Frozen bosses don't count as dead until they shatter
      return false;
   }
}


In particular this only compares direct classes instead of checking the replacees. As seen in my example package, I have an event handler set up to indicate the replacee of Fatsos 1 & 2 to be Fatso itself.
Attachments
BossDeathBug.pk3
(570 Bytes) Downloaded 2 times
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: A_BossDeath doesn't fully check replaced actors

Postby Gez » Tue Sep 10, 2019 12:06 pm

Major Cooke wrote:In particular, RandomSpawners rely upon the BOSS flag, which makes sense for cyberdemon and spider mastermind classes, but not barons, fatsos and arachnotrons.

It looks for the BOSSDEATH flag too.

https://github.com/coelckers/gzdoom/blo ... #L235:L241
Gez
 
 
 
Joined: 06 Jul 2007

Re: A_BossDeath doesn't fully check replaced actors

Postby Major Cooke » Tue Oct 01, 2019 1:27 pm

Fair enough.

I've made a PR which fixes the issue. Used the same PK3 in the first post for testing to make sure.

A_BossDeath itself rightfully checks for the replacee type, but the reliance upon CheckBossDeath itself from within meant it would succeed if just that singular type alone was all dead, instead of the replaced actor type. That PR simply changes the function so it requires all replaced of the matching type to be dead, since CheckReplacee allows for assigning multiple replacees. This will finally allow for a perfect alternative and fully functioning RandomSpawner system replacement.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: A_BossDeath doesn't fully check replaced actors

Postby Major Cooke » Tue Oct 15, 2019 1:46 pm

The PR was merged. This can be closed.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007


Return to Closed Bugs

Who is online

Users browsing this forum: D2JK, Majestic-12 [Bot] and 0 guests