OverlayID() fails on weapon functions

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: 8215
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

OverlayID() fails on weapon functions

Post by Major Cooke »

It appears OverlayID() only works properly when, if called on a weapon, it's only ever done inside the states themselves. Players on the other hand can return the OverlayID() perfectly, provided the function is 'action' prepended.

Right now, OverlayID() is the ONLY way to clear ambiguity if using multiple overlays, where each could use the same one at once, at any given time. Example: An akimbo system where you can wield two different guns at once and switch to any other, and naturally, things like offsets and projectile spawning will rely upon the ID of the psprite.

Here's a test case. When starting a new game, wait for the weapon to raise, then check the console.
Attachments
test.pk3
Simply start a new game.
(735 Bytes) Downloaded 20 times
User avatar
Major Cooke
Posts: 8215
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: OverlayID() fails on weapon functions

Post by Major Cooke »

A little digging revealed the stateinfo is not being passed along through the action functions on weapons.

Code: Select all

if (stateinfo == null) return;
Toss that inside of the weapon's PrintOIDAction() at the top and you'll see it outright stops printing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: OverlayID() fails on weapon functions

Post by Graf Zahl »

This is a user error.

You are calling PrintOIDAction through 'invoker', not 'self'. This changes ownership of the called function to the weapon. The overlay belongs to the player, i.e. 'self' and cannot be found when queried from the weapon.

This works as intended:

Code: Select all

		BFGG A 35 { invoker.PrintOID(); PrintOIDAction(); }
Post Reply

Return to “Closed Bugs [GZDoom]”