A_BossDeath doesn't fully check replaced actors

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

A_BossDeath doesn't fully check replaced actors

Post by Major Cooke »

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 all

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 27 times
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_BossDeath doesn't fully check replaced actors

Post by Gez »

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
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: A_BossDeath doesn't fully check replaced actors

Post by Major Cooke »

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
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: A_BossDeath doesn't fully check replaced actors

Post by Major Cooke »

The PR was merged. This can be closed.
Post Reply

Return to “Closed Bugs [GZDoom]”