CheckReplacement()'s e.IsFinal is ignored in ACS spawning

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

CheckReplacement()'s e.IsFinal is ignored in ACS spawning

Postby FishyClockwork » Mon Sep 24, 2018 12:32 pm

(This has nothing to do with the other CheckReplacement() bug report)

Spawning something via ACS (or the old Thing_Spawn* functions, which can be line specials by themselves) completely ignores e.IsFinal being explicitly set to 'true'.

checkrepfinal_acsspawn_test.pk3
Load with DOOM2, start New Game
(1.98 KiB) Downloaded 30 times

In this test PK3, ZombieMan is replaced with ShotgunGuy via CheckReplacemet(), with e.IsFinal being true.
ShotgunGuy is replaced by a Cacodemon copy via the 'replaces' keyword.

In the test map, one zombieman is placed via map editor, it gets replaced with a shotgunner as it should be. There are three mapspots which a ACS script will also spawn zombiemen at. However, it is here where e.IsFinal is ignored and cacodemons spawn instead. The ACS script uses various spawning functions.

I think I've narrowed it down to these three: P_Thing_Spawn, P_Thing_Projectile and DLevelScript::DoSpawn

In particular, each of them has this pattern:
Code: Select allExpand view
kind = kind->GetReplacement(); //This is called first
....
actor = Spawn (kind, pos, ALLOW_REPLACE); //ALLOW_REPLACE ensures GetReplacement() is called again
User avatar
FishyClockwork
 
Joined: 23 Feb 2011

Re: CheckReplacement()'s e.IsFinal is ignored in ACS spawnin

Postby Marisa Kirisame » Mon Sep 24, 2018 12:44 pm

Makes sense that it would behave that way if it's being called twice.

If these functions are already checking for replacement before they call Spawn, then they shouldn't do the same again.
User avatar
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia GTX or Quadro with Vulkan support


Return to Bugs

Who is online

Users browsing this forum: No registered users and 3 guests