Skip to content

Commit

Permalink
tr1/option: fix crash on toggling bilinear filter
Browse files Browse the repository at this point in the history
Resolves #1942.
  • Loading branch information
rr- committed Nov 25, 2024
1 parent 9364aa6 commit 5d1c3d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Importantly, Asian and Arabic languages remain unsupported at the moment.
- fixed invisible walls being present in front of some doors (#1948, regression from 4.6)
- fixed missing FMVs causing the game to go silent (#1931, regression from 4.6)
- fixed game crashing when toggling the bilinear filter in passport (#1942, regression from 4.5)

## [4.6](https://github.com/LostArtefacts/TRX/compare/tr1-4.5.1...tr1-4.6) - 2024-11-18
- added support for wading, similar to TR2+ (#1537)
Expand Down
15 changes: 15 additions & 0 deletions src/tr1/game/option/option_passport.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static void M_ShutdownText(void);
static void M_Close(INVENTORY_ITEM *inv_item);
static void M_DeterminePages(void);
static void M_InitSaveRequester(int16_t page_num);
static void M_RestoreSaveRequester(void);
static void M_InitSelectLevelRequester(void);
static void M_InitNewGameRequester(void);
static void M_ShowSaves(PASSPORT_MODE pending_mode);
Expand All @@ -118,6 +119,8 @@ void M_InitRequesters(void)
{
Requester_Shutdown(&m_SelectLevelRequester);
Requester_Shutdown(&m_NewGameRequester);
Requester_Shutdown(&g_SavegameRequester);
Requester_Init(&g_SavegameRequester, Savegame_GetSlotCount());
Requester_Init(&m_SelectLevelRequester, g_GameFlow.level_count + 1);
Requester_Init(&m_NewGameRequester, MAX_GAME_MODES);
}
Expand Down Expand Up @@ -287,6 +290,16 @@ static void M_InitSaveRequester(int16_t page_num)
Savegame_ScanSavedGames();
}

static void M_RestoreSaveRequester(void)
{
// Reload the savegame requester items in case something cleared them in
// the meantime (for example the player changed the save slot count with a
// console command.)
if (g_SavegameRequester.items_used == 0) {
M_InitSaveRequester(m_PassportStatus.page);
}
}

static void M_InitSelectLevelRequester(void)
{
REQUEST_INFO *req = &m_SelectLevelRequester;
Expand Down Expand Up @@ -398,6 +411,7 @@ static void M_LoadGame(void)
m_PassportStatus.mode = PASSPORT_MODE_LOAD_GAME;
}
} else if (m_PassportStatus.mode == PASSPORT_MODE_LOAD_GAME) {
M_RestoreSaveRequester();
if (!g_SavegameRequester.items[g_SavegameRequester.requested].is_blocked
|| !g_SavegameRequester.is_blockable) {
if (g_InputDB.menu_right) {
Expand Down Expand Up @@ -478,6 +492,7 @@ static void M_SaveGame(void)
m_PassportStatus.mode = PASSPORT_MODE_SAVE_GAME;
}
} else if (m_PassportStatus.mode == PASSPORT_MODE_SAVE_GAME) {
M_RestoreSaveRequester();
M_ShowSaves(PASSPORT_MODE_SAVE_GAME);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/tr1/game/savegame.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "global/types.h"

#include <libtrx/game/savegame.h>

#include <stdbool.h>
#include <stdint.h>

Expand Down

0 comments on commit 5d1c3d2

Please sign in to comment.