From 607ac811f0b091571dbabdf20c0311cec77cf8ae Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 26 Apr 2025 11:55:23 +0200 Subject: [PATCH] tr2/viewport: fix screenshots at wrong resolution Resolves #2845. --- docs/tr2/CHANGELOG.md | 1 + src/tr2/game/viewport.c | 11 +++++++---- src/tr2/game/viewport.h | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index fbea5db6c..7df45025d 100644 --- a/docs/tr2/CHANGELOG.md +++ b/docs/tr2/CHANGELOG.md @@ -1,6 +1,7 @@ ## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-1.0.1...develop) - ××××-××-×× - fixed guns carried by enemies not being converted to ammo if Lara has picked up the same gun elsewhere in the same level (#2856) - fixed guns carried by enemies not being converted to ammo if Lara starts the level with the gun and the game has later been reloaded (#2850, regression from 1.0) +- fixed 1920x1080 screenshots in 16:9 aspect mode being saved as 1919x1080 (#2845, regression from 0.8) ## [1.0.1](https://github.com/LostArtefacts/TRX/compare/tr2-1.0...tr2-1.0.1) - 2025-04-24 - added an option to wraparound when scrolling UI dialogs, such as save/load (#2834) diff --git a/src/tr2/game/viewport.c b/src/tr2/game/viewport.c index 245e1c11c..424039f73 100644 --- a/src/tr2/game/viewport.c +++ b/src/tr2/game/viewport.c @@ -125,20 +125,23 @@ void Viewport_Reset(void) VIEWPORT *const vp = &m_Viewport; switch (g_Config.rendering.aspect_mode) { case AM_4_3: - vp->render_ar = 4.0 / 3.0; + vp->render_ar.w = 4; + vp->render_ar.h = 3; break; case AM_16_9: - vp->render_ar = 16.0 / 9.0; + vp->render_ar.w = 16; + vp->render_ar.h = 9; break; case AM_ANY: - vp->render_ar = size.w / (double)size.h; + vp->render_ar.w = size.w; + vp->render_ar.h = size.h; break; } vp->width = size.w / g_Config.rendering.scaler; vp->height = size.h / g_Config.rendering.scaler; if (g_Config.rendering.aspect_mode != AM_ANY) { - vp->width = vp->height * vp->render_ar; + vp->width = vp->height * vp->render_ar.w / vp->render_ar.h; } vp->near_z = Output_GetNearZ() >> W2V_SHIFT; diff --git a/src/tr2/game/viewport.h b/src/tr2/game/viewport.h index 9af7d0105..8ec3d7485 100644 --- a/src/tr2/game/viewport.h +++ b/src/tr2/game/viewport.h @@ -8,7 +8,10 @@ typedef struct { int32_t near_z; int32_t far_z; int16_t view_angle; - double render_ar; + struct { + int32_t w; + int32_t h; + } render_ar; // TODO: remove most of these variables if possible struct {