diff --git a/src/sfall_config.h b/src/sfall_config.h index 73c7845..c6a64fd 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -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 diff --git a/src/world_map.cc b/src/world_map.cc index e33bbe8..3922895 100644 --- a/src/world_map.cc +++ b/src/world_map.cc @@ -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);