Custom HUD without a statur bar may cause a visual glitch

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Custom HUD without a statur bar may cause a visual glitch

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

by _mental_ » Sat Nov 09, 2019 11:21 am

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.

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

by phantombeta » Sat Nov 09, 2019 10:43 am

_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.

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

by _mental_ » Sat Nov 09, 2019 10:00 am

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.

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

by phantombeta » Sat Nov 09, 2019 9:51 am

_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.

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

by _mental_ » Sat Nov 09, 2019 7:04 am

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().

Custom HUD without a statur bar may cause a visual glitch

by Player701 » Sat Nov 09, 2019 1:27 am

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

Top