Custom HUD without a statur bar may cause a visual glitch

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
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Custom HUD without a statur bar may cause a visual glitch

Post by Player701 »

Found this while experimenting with custom ZScript HUDs. Turns out that if I want just a fullscreen HUD without a status bar, this may cause the following glitch to appear:



The only way to avoid this glitch is to call SetSize(...) in the Init method of the custom HUD class, which is apparently used to set the virtual dimensions of the status bar area. Calling Super.Draw(), BeginStatusBar(), BeginHUD() and other things like that does not seem to have any effect on this.

The only workaround that removes the glitch, if I don't want an empty status bar to appear, seems to be to call SetSize(0, 0, 0). However, do note that the only time the glitch appears is when the value of the "screenblocks" CVAR is less than or equal to 10 BEFORE the level is started. Changing the value in-game will remove the glitch, and it will not reappear later (until the next level) no matter what other values screenblocks is set to afterwards. Because of such inconsistent behavior, I believe this is actually a bug and not a user error. Besides, why should I be concerned with calling status bar related stuff if I only want the fullscreen HUD?...

Test WAD attached. Tested in GZDoom 4.2.4a and g4.3pre-317-g48d0ebab5.
Attachments
empty_hud.wad
(128 Bytes) Downloaded 36 times
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom HUD without a statur bar may cause a visual glitc

Post by _mental_ »

Some internals of status bar are initialized as a result of SetSize() call. For such degenerated case as an empty status bar I see no other options except to invoke this function explicitly from BaseStatusBar.Init().
User avatar
phantombeta
Posts: 2183
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Custom HUD without a statur bar may cause a visual glitc

Post by phantombeta »

_mental_ wrote:Some internals of status bar are initialized as a result of SetSize() call. For such degenerated case as an empty status bar I see no other options except to invoke this function explicitly from BaseStatusBar.Init().
To be honest, doing this should cause a VM abort IMO. I think it's better to outright tell the coder that they're doing something wrong, than to silently accept broken code.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom HUD without a statur bar may cause a visual glitc

Post by _mental_ »

That code isn’t broken. A game without a status bar is not something unusual. I don’t see any reason to require a call to SetSize here.
User avatar
phantombeta
Posts: 2183
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Custom HUD without a statur bar may cause a visual glitc

Post by phantombeta »

_mental_ wrote:That code isn’t broken. A game without a status bar is not something unusual. I don’t see any reason to require a call to SetSize here.
SetSize performs things that are required by both HUDs and statusbars - both still require a virtual resolution and setting scaling factors. I'd say the previous results were due to undefined behaviour, and the OP is actually lucky that his code worked at all before.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom HUD without a statur bar may cause a visual glitc

Post by _mental_ »

If SetSize() is required to work, Init() should accept its arguments and call it under the hood. The problem is it’s too late to change this.
This doesn’t mean, however, that we should ignore issues like the given case. Init() must do all preparations needed to have usable object.
Post Reply

Return to “Closed Bugs [GZDoom]”