diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index c01f51ccf..9d31fe22d 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...develop) - ××××-××-×× - fixed the selected keyboard/controller layout not being saved (#2830, regression from 1.0) - fixed toggling the PSX FOV option not having an immediate effect (#2831, regression from 1.0) +- fixed changing the aspect ratio not updating the current background image (#2832, regression from 1.0) ## [1.0](https://github.com/LostArtefacts/TRX/compare/tr2-0.10...tr2-1.0) - 2025-04-23 - added support for The Golden Mask (#1621) diff --git a/src/libtrx/game/output/background.c b/src/libtrx/game/output/background.c index 855047d01..4a8a680c4 100644 --- a/src/libtrx/game/output/background.c +++ b/src/libtrx/game/output/background.c @@ -2,6 +2,7 @@ #include "debug.h" #include "filesystem.h" +#include "game/output/common.h" #include "game/viewport.h" #include "log.h" #include "memory.h" @@ -198,6 +199,18 @@ bool Output_LoadBackgroundFromFile(const char *const path) return result; } +void Output_ReloadBackgroundImage(void) +{ + if (m_LastPath == nullptr) { + return; + } + + char *prev = Memory_DupStr(m_LastPath); + Output_UnloadBackground(); + Output_LoadBackgroundFromFile(prev); + Memory_FreePointer(&prev); +} + char *Output_GetLastBackgroundPath(void) { return m_LastPath; diff --git a/src/libtrx/include/libtrx/game/output/background.h b/src/libtrx/include/libtrx/game/output/background.h index 444896925..7c028ec32 100644 --- a/src/libtrx/include/libtrx/game/output/background.h +++ b/src/libtrx/include/libtrx/game/output/background.h @@ -3,6 +3,7 @@ #include "../../engine/image.h" bool Output_LoadBackgroundFromFile(const char *path); +void Output_ReloadBackgroundImage(void); extern bool Output_LoadBackgroundFromImage(const IMAGE *image); extern void Output_LoadBackgroundFromObject(void); diff --git a/src/tr2/game/shell/common.c b/src/tr2/game/shell/common.c index f418d734b..f7d00b73d 100644 --- a/src/tr2/game/shell/common.c +++ b/src/tr2/game/shell/common.c @@ -427,6 +427,10 @@ static void M_HandleConfigChange(const EVENT *const event, void *const data) || CHANGED(visuals.water_color.r)) { Output_ApplyLevelSettings(); } + + if (CHANGED(rendering.aspect_mode)) { + Output_ReloadBackgroundImage(); + } } // TODO: refactor the hell out of me