tr2/shell: reload background image on aspect change

Resolves #2832.
This commit is contained in:
lahm86 2025-04-23 16:52:23 +01:00
parent 8be59fb652
commit 60d2bbe13e
4 changed files with 19 additions and 0 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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);

View file

@ -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