ZScript: Status Bar Questions

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

In what way is it broken?
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript: Status Bar Questions

Post by Major Cooke »

D4D's credit counter for example, which uses ACS's HUDMessage. That thing is tiny now...
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

I'm on the phone right now, but you might remember how statusbar gets squished with nonstandard video modes, I've made a bug about it earlier. Thanks to this fine example of weird aspect heuristics I'd want to use manual scaling and positioning whenever possible now, but first I need to know what needs to be done before handmade library can compete with builtin statusbar code (provided all the statusbar info is available).
Also, apparently it's not possible to create a non-fullscreen non-4:3 statusbar.

And either way I'd like to know some of the magic that I don't do, but BaseStatusBar does.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

ZZYZX wrote:Thanks to this fine example of weird aspect heuristics I'd want to use manual scaling and positioning whenever possible now

It does work for all screen sizes without a forced aspect ratio. I already fixed a huge part of the problems in the scaling logic and most importantly consolidated most of it into a single function. To say that this was a gigantic mess would be a huge understatement.

The ones with a forced aspect ratio that cause a non-1:1 pixel ratio are a different story, but it's still better to work towards a generic solution than trying to cook up some workaround that is bound to bite you in the ass later like a hungry piranha.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

...yet still no answer about what exactly does statusbar do that I can't.
You've been talking about it 3 months ago, you're talking about it now, but you don't specify what exactly is this advanced processing that people don't do in RenderOverlay that's done in statusbar.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript: Status Bar Questions

Post by Major Cooke »

I would like to know as well.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

ZZYZX wrote:...yet still no answer about what exactly does statusbar do that I can't.
You've been talking about it 3 months ago, you're talking about it now, but you don't specify what exactly is this advanced processing that people don't do in RenderOverlay that's done in statusbar.

There is no advanced processing. The problem with your render overlay was that it did not properly integrate with the rest of the HUD drawing and that it had no access to the current HUD state. It wasn't so much about what it cannot do but what it could not check. Having a HUD that doesn't obey user settings is bound to annoy those users.
The key part of the status bar code is that its draw functions automatically adjust to the user settings for UI scale and that the standard use cases allow calling them with far less parameters than the low level draw functions. Remember, this is supposed to replace SBARINFO, and that'd make explicitly specifying the scale size for each element exceedingly clumsy.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

Ok, thanks.

But anyway, I already have my own library to manage scaling automatically for all current Screen static methods, and I'll only need to make it support uiscale.
My main problem was that you told me at least twice that this way is wrong (in this thread) and I was like o_O why.

Although I personally don't like obeying uiscale much because uiscale can't even be fractional according to what I've seen — int only. As well as other explicit scale variables...
From my experience, for example, with 1280x1024 con_scale 2 looks too large while con_scale 1 too small.

Previous virtualwidth/virtualheight approach (custom scaling under messages options menu that was in GZDoom ~1.8 or so) would produce way better results even though it'd mean uneven scaling of rows/columns.

btw: how do I adjust the size of the regular (non-fullscreen) doom statusbar? Currently it's 1:1 and centered, which means it's really small.
hud_scale only works with fullscreen.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

ZZYZX wrote: Although I personally don't like obeying uiscale much because uiscale can't even be fractional according to what I've seen — int only. As well as other explicit scale variables...
From my experience, for example, with 1280x1024 con_scale 2 looks too large while con_scale 1 too small.
The point here is not precision but that this is a user setting. The reason for non-integer scales is that without texture filtering it tends to look quite bad at low scaling factors. Proper UI stretching to the 1.2 pixel ratio of 320x200 only looks acceptable, for example, if the actual screen is at least 4-5x as large as 320x200, that's why the existing code couldn't even deal with that.

In order to allow proper adherence to user settings I'll have to export the GetUIScale function to ZScript first, that's what all internal code is using now, with the proper override CVAR being specified - for HUDs that'd either be hud_scale or st_scale, depending on context.
User avatar
Nash
 
 
Posts: 17454
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: ZScript: Status Bar Questions

Post by Nash »

Is it possible to retrieve only the (clean)scaled coordinates of a given set of numbers? There's something I'd like to draw but the built-in BaseStatusBar methods don't support it (DTA_Overlay) so it looks like I'm going to have to draw it manually...

I basically want to draw something with the benefits of the status bar methods, but not actually use the drawing portion of them, if that makes sense. o_O
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

Not at the moment but what can be added is a function that receives a rectangle in virtual status bar coordinates and then returns a rectangle in screen coordinates so that you can draw it with DTA_DestWidth and DTA_DestHeight.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript: Status Bar Questions

Post by Major Cooke »

That would actually be appreciated because right now, I'm still trying to figure out just how I should be handling the scaling and detection of resolutions.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

You shouldn't do that at all. You should set a default resolution and align everything to that, leaving the rest to the engine. I tried to mimic SBARINFO's approach here as good as was possible.
The more you fudge around the more likely there's problems if users start altering the scaling.
User avatar
Major Cooke
Posts: 8193
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript: Status Bar Questions

Post by Major Cooke »

Good to know. I'll keep that in mind.

One other question, if they aren't already, can the x and y coordinates be made to support floats much like you did the menus?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49138
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

They are all Vector2's which are floats. For something that can get scaled by a factor of 6 and more this is a necessity.

Return to “Scripting”