Fix town map hotkeys

This commit is contained in:
Alexander Batalov 2022-08-15 00:16:36 +03:00
parent 957c5af66b
commit 79f5e00f6e
2 changed files with 16 additions and 0 deletions

View File

@ -56,6 +56,7 @@
#define SFALL_CONFIG_GAME_DIALOG_FIX_KEY "DialogueFix"
#define SFALL_CONFIG_TWEAKS_FILE_KEY "TweaksFile"
#define SFALL_CONFIG_GAME_DIALOG_GENDER_WORDS_KEY "DialogGenderWords"
#define SFALL_CONFIG_TOWN_MAP_HOTKEYS_FIX "TownMapHotkeysFix"
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3

View File

@ -28,6 +28,7 @@
#include "queue.h"
#include "random.h"
#include "scripts.h"
#include "sfall_config.h"
#include "skill.h"
#include "stat.h"
#include "string_parsers.h"
@ -902,6 +903,8 @@ static int _wmMaxEncBaseTypes;
// 0x67303C
static int gEncounterTablesLength;
static bool gTownMapHotkeysFix;
static int _wmGenDataInit();
static int _wmGenDataReset();
static int _wmWorldMapSaveTempData();
@ -1026,6 +1029,10 @@ int worldmapInit()
_wmMarkSubTileRadiusVisited(_world_xpos, _world_ypos);
_wmWorldMapSaveTempData();
// SFALL
gTownMapHotkeysFix = true;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_TOWN_MAP_HOTKEYS_FIX, &gTownMapHotkeysFix);
return 0;
}
@ -6104,6 +6111,14 @@ int worldmapCityMapViewSelect(int* mapIndexPtr)
if (keyCode >= KEY_1 && keyCode < KEY_1 + city->entrancesLength) {
EntranceInfo* entrance = &(city->entrances[keyCode - KEY_1]);
// SFALL: Prevent using number keys to enter unvisited areas on
// a town map.
if (gTownMapHotkeysFix) {
if (entrance->state == 0 || entrance->x == -1 || entrance->y == -1) {
continue;
}
}
*mapIndexPtr = entrance->map;
mapSetEnteringLocation(entrance->elevation, entrance->tile, entrance->rotation);