Page 1 of 1

CleanXFac, CleanYFac, CleanWidth, &c.

Posted: Wed Nov 14, 2018 12:30 pm
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!

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Posted: Wed Nov 14, 2018 12:52 pm
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.

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Posted: Wed Nov 14, 2018 1:23 pm
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?

Re: CleanXFac, CleanYFac, CleanWidth, &c.

Posted: Wed Nov 14, 2018 1:46 pm
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.