UE1 - UT Getting resolution setting from script

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

G-Flex

New Member
Oct 25, 2012
16
0
0
(Note: This is for Deus Ex)

I'm trying to get the player's desired resolution from script code in order to automatically adjust FOV based on aspect ratio.

Right now I'm doing this in PreTravel() for the player pawn class used:

//G-Flex: make sure we have the right FOV angle
newDefaultFOV = class'Tools'.static.AspectCorrectHFOV(75.000,4.0000/3.0000,rootWindow.width/rootWindow.height);

DefaultFOV = newDefaultFOV;
desiredFOV = newDefaultFOV;
//G-Flex: I really hate changing default values, but couldn't think of anything better
//G-Flex: blame the devs for using default.desiredFOV so much instead of defaultFOV
default.DefaultFOV = newDefaultFOV;
default.desiredFOV = newDefaultFOV;

I can't use it in Possess(), or in TravelPostAccept(), because in those cases, the root window is not properly initialized yet when the function is called. This is, unfortunately, also sometimes the case in PreTravel(), but only rarely (it seems to only happen when I click through the intro so fast it doesn't quite load the intro map fully or initialize the player in it, or something like that).

So my question is: Is there a better way to access the desired resolution? Presumably the game gets it somehow in order to set the default FOV in the first place, but I'm not sure how to go about doing it.
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
You will have to wait for the first tick to finish. FOV does not really depend on aspect ratio, btw. It simply is the view angle for the larger dimension of the screen.
You should be able to try that in window mode by changing the window size to various heights and widths. As long as you only change the height and leave it smaller than the width, you should always see the same things on the left and right side, while the game clips stuff at the top and bottom edges.
 

G-Flex

New Member
Oct 25, 2012
16
0
0
You misinterpret what I'm doing here. Allow me to be a little more clear:

I'm locking the vertical FOV angle to a fixed value, scaling the horizontal FOV angle instead. This seems like a pretty standard thing to do. In doing this, two different displays will display objects at the same size, but a wider display will show more to the right and left due to higher hFOV. This is fairly normal, is quasi-implemented by kentie's Deus Ex launcher already, and is more or less required in order for elements at the top and bottom of the screen (like your weapon) to not be cut off.

What you're talking about is how the engine handles it by itself, keeping hFOV the same regardless of aspect ratio, which allows the vFOV to vary, which is more problematic. In effect, without my corrections, playing on a 16:9 display instead of a 4:3 display causes the view to look zoomed-in, with things at the bottom and top cut off, and with objects appearing to be different sizes.

I did find a GetCurrentRes console command that the game apparently uses to get your current resolution in the display options menu; I'll have to see if that responds properly even when the HUD/root window isn't properly initialized yet.

EDIT: Nope, that's returning 0x0 during the Possess() and TravelPostaccept() functions. I really need to find whatever the game uses to grab the desired resolution, and go directly for that if possible, but I'm not sure where it is. It seems that the settings in the game's ini file always correspond to the in-game resolution one way or another, though, so perhaps that's a place to start.

EDIT 2: Okay, GetConfig("WinDrv.WindowsClient", "FullscreenViewportX") and GetConfig("WinDrv.WindowsClient", "FullscreenViewportY") seem to work fine... however, I want this to work in windowed mode as well. Now I need to find a way to get the game to tell me whether or not it's currently windowed, and also how to get the game to respond to the window being resized manually via mouse dragging, ideally.
 
Last edited: