As-is, A_OverlayPivotAlign can never reset halign/valign to 0 (and further can induce undefined behavior)

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!
User avatar
Zhs2
Posts: 1294
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere

As-is, A_OverlayPivotAlign can never reset halign/valign to 0 (and further can induce undefined behavior)

Post by Zhs2 »

I'm not sure if anyone has actually looked into this for the going on four years that it has existed, but A_OverlayPivotAlign sets the values halign and valign via |=, as per the scripting definition for A_OverlayPivotAlign. This means it will never reset halign or valign back to PSPA_LEFT or PSPA_TOP, respectively, and further if you manage to set both to PSPA_CENTER and then PSPA_RIGHT/PSPA_BOTTOM you will be entering undefined behavior territory. Currently the only obscure workaround for resetting to PSPA_LEFT/PSPA_TOP is setting the values directly:

Code: Select all

let psp = invoker.Owner.Player.GetPSprite(PSP_WEAPON);
if(psp)
{
    psp.halign = PSPA_LEFT; // 0
    psp.valign = PSPA_TOP; // 0
}

Return to “Bugs [GZDoom]”