CleanXFac, CleanYFac, CleanWidth, &c.

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!)
Post Reply
User avatar
Marrub
 
 
Posts: 1193
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

CleanXFac, CleanYFac, CleanWidth, &c.

Post by Marrub »

Can someone explain to me how these variables work?

Code: Select all

readonly int  CleanHeight;
readonly int  CleanHeight_1;
readonly int  CleanWidth;
readonly int  CleanWidth_1;
readonly int  CleanXFac;
readonly int  CleanXFac_1;
readonly int  CleanYFac;
readonly int  CleanYFac_1;
I don't really understand what they do at all, and there appears to be no documentation on what they do anywhere.
I'm mostly asking this to help write my documentation, so please be aware your answers will be used for a public domain work!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Post by Graf Zahl »

They contain the closest full integer scaling factor from 320x200 to the actual screen size. Their purpose is to allow HUD graphics to be scaled so that all pixels are evenly scaled. I guess with HD screens or even larger most of their reason for existence no longer applies. When this code was written, screen sizes of 800x600 or 1024x768 were commonplace on which uneven scaling with the software renderer looked exceedinly bad.
User avatar
Marrub
 
 
Posts: 1193
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Post by Marrub »

Graf Zahl wrote:They contain the closest full integer scaling factor from 320x200 to the actual screen size. Their purpose is to allow HUD graphics to be scaled so that all pixels are evenly scaled. I guess with HD screens or even larger most of their reason for existence no longer applies. When this code was written, screen sizes of 800x600 or 1024x768 were commonplace on which uneven scaling with the software renderer looked exceedinly bad.
I see, so then:
CleanXFac would be the closest integer scaling for a `x` parameter from 320x200 to the virtual screen resolution, CleanYFac would be the closest integer scaling for a `y` parameter, and CleanWidth/CleanHeight are the screen width/height scaled to those.
What are the `_1` variables in that case?
Last edited by Marrub on Wed Nov 14, 2018 1:58 pm, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Post by Graf Zahl »

// if the width is between 800 and 960 the ratio between the screensize and CleanXFac-1 becomes too large.
That's all the info that is available. For any other screen sizes they are the same.
Post Reply

Return to “Scripting”