[Not a bug] A_FireProjectile returns null sometimes.

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

A_FireProjectile returns null sometimes.

Postby Accensus » Wed May 20, 2020 7:54 pm

This happens if it's used at point-blank range and the projectile explodes immediately. The projectile itself does not have a zero tic duration Death state. I have narrowed it down to this line. This most definitely seems intentional, but I can't figure out the reasoning for not returning a pointer to the projectile if it explodes immediately, provided it exists for a few tics after death. In my case I store some important data on the projectile when it is spawned, but cannot store it if the pointer to it is null on spawn.
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: A_FireProjectile returns null sometimes.

Postby Graf Zahl » Fri May 22, 2020 1:59 am

That's what the second return value of SpawnPlayerMissile is there for. The behavior is by design. This happens if the projectile gets destroyed right away, you have to check this case in your code.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_FireProjectile returns null sometimes.

Postby Accensus » Fri May 22, 2020 2:33 am

I'll fix it on my end then. Thank you.
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


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest