Skip to content

Loadscreen - Multiple resolutions and stretch modes#218

Merged
kitty624 merged 3 commits into
1dot13:masterfrom
andrzejfalkowski:loading-screens-multi-res
Sep 2, 2023
Merged

Loadscreen - Multiple resolutions and stretch modes#218
kitty624 merged 3 commits into
1dot13:masterfrom
andrzejfalkowski:loading-screens-multi-res

Conversation

@andrzejfalkowski
Copy link
Copy Markdown
Contributor

@andrzejfalkowski andrzejfalkowski commented Sep 1, 2023

Multiple resolutions of loading screens can be used by adding a prefix to the loading screen file. Similar feature was previously available for _800x600 and _1024x786 at one point, but seems to be removed since. In this version, the "best" resolution variant will always be used; the game will select the largest variant equal to or exceeding the current screen resolution. For instance, if we have only the 800x600 and 1920x1080 variants, the 800x600 variant will be used for all resolutions between 640x480 and 800x600, and the 1920x1080 variant will be used for all resolutions above.

Loading screens can be configured to use different stretch modes:
Stretch - Always stretch to fit the screen.
Match Height - Stretch the image so its height matches the screen height, maintaining aspect ratio. This will add black bars on the sides if the screen is wider and crop the image otherwise.
Match Height for Widescreen - Maintain the aspect ratio for images wider than the screen; otherwise, stretch. This ensures no black bars and won't scale down widescreen images. It's particularly useful for derivative mods using mixed aspect ratios for loading screen images.

The stretch mode also affects the loading bar, ensuring it always aligns with the image (all standard loading screens incorporate a loading bar frame within the asset).

My recommended default setting: Match Height. Matter of taste, I personally find black bars better than a skewed aspect ratio.

Related fixes:

  • the loading bar fill was a pixel or more short relative to its border due to rounding errors and some early returns, changed this to a clamp instead
  • the loading bar wouldn't align accurately with its border on higher resolutions due to a hardcoded offset of 2, combined with rounding errors after scaling it skewed alignment. This offset was removed since it seemed only relevant when fDrawBorder is set to TRUE (coordinates are set for bar fill, ignoring the border). Applied the same rounding approach used in image scaling (nearest neighbor).
  • loading a save directly into tactical mode would result in the loading hint and phase text receiving a black background, but only during the last second of loading, due to tactical panel rendering order

640x480 before - bar pixel short, black outline last second only
640x480_before
640x480 after
640x480_after

1920x1080 before - bar not fitting the frame
1920x1080_before
1920x1080 after - stretch mode
1920x1080_after_stretch
1920x1080 after - match height mode
1920x1080_after_match_height

1920x1080 with default asset - match height mode
1920x1080_after_lq
1920x1080 if upscaled asset is provided - match height mode
1920x1080_after_hq

Gamedir PR: 1dot13/gamedir#58

@kitty624 kitty624 merged commit cd186a2 into 1dot13:master Sep 2, 2023
@andrzejfalkowski andrzejfalkowski deleted the loading-screens-multi-res branch October 2, 2023 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants