A_FireProjectile returns null sometimes.
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.
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.
A_FireProjectile returns null sometimes.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_FireProjectile returns null sometimes.
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.
Re: A_FireProjectile returns null sometimes.
I'll fix it on my end then. Thank you.