Calling DepleteAmmo in DECORATE crashes.

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!

Calling DepleteAmmo in DECORATE crashes.

Postby Accensus » Sat May 23, 2020 6:40 pm

Tested on GZDoom g4.4pre-326-g3dfb417f0 x64.

1. give CrashyPistol
2. use CrashyPistol

I assume this isn't an issue only with DepleteAmmo; it just so happened that it crashed on me with that. If I use it in an anonymous function, it errors out properly (i.e. complains about trying to call it with incompatible self-pointer, which isn't gonna happen in DECORATE).

Code: Select allExpand view
Actor CrashyPistol : Pistol
{
   States
   {
      Fire:
          PISG A 4 DepleteAmmo(false, false, 1)
          PISG B 6 A_FirePistol
          PISG C 4
          PISG B 5 A_ReFire
          Goto Ready
   }
}


Attached CrashReport.zip.
Attachments
CrashReport.zip
(37.44 KiB) Not downloaded yet
User avatar
Accensus
Vector, locked in.
 
Joined: 11 Feb 2016
Location: Somalia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Calling DepleteAmmo in DECORATE crashes.

Postby Graf Zahl » Sat May 23, 2020 11:51 pm

DepleteAmmo cannot be used from DECORATE. The function would be called with the wrong parameters, but unfortunately the compiler cannot easily detect this. The function needs to be visible for ZScript to compile, but that means it's also visible to DECORATE. Only functions whose name starts with A_ are DECORATE safe. Adding any restriction here could block valid use cases.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Calling DepleteAmmo in DECORATE crashes.

Postby phantombeta » Sun May 24, 2020 1:52 am

Graf Zahl wrote:DepleteAmmo cannot be used from DECORATE. The function would be called with the wrong parameters, but unfortunately the compiler cannot easily detect this. The function needs to be visible for ZScript to compile, but that means it's also visible to DECORATE. Only functions whose name starts with A_ are DECORATE safe. Adding any restriction here could block valid use cases.

I told him to make this report. The point of it is not that he thinks it should work - he knows that, it's the crash that's the issue.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: Brazil, South America, Earth, Orion-Cygnus Arm, Milky Way
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Calling DepleteAmmo in DECORATE crashes.

Postby Graf Zahl » Sun May 24, 2020 10:52 am

I don't know how to plug this in DECORATE.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Bugs

Who is online

Users browsing this forum: No registered users and 9 guests