Added support for LocalMapXLimit/LocalMapYLimit options to sfall HRP

This commit is contained in:
NovaRain
2022-02-20 08:39:02 +08:00
parent 15c512ff7b
commit a392e5620a
3 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -332,7 +332,7 @@ Movie17=credits.mve
;To change the limit of the distance away from the player to which you're allowed to scroll the local maps, uncomment the next two lines
;Defaults are 480 in the x direction and 400 in the y direction.
;Not compatible with the hi-res patch!
;Does not work with the hi-res patch by Mash!
;LocalMapXLimit=480
;LocalMapYLimit=400
+4 -5
View File
@@ -11,7 +11,6 @@
#include "..\main.h"
#include "..\FalloutEngine\Fallout2.h"
#include "..\Translate.h"
#include "..\Utils.h"
#include "..\WinProc.h"
#include "..\Modules\Graphics.h"
#include "..\Modules\LoadOrder.h"
@@ -258,10 +257,10 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
SlidesScreen::END_SLIDE_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "END_SLIDE_SIZE", 1, f2ResIni);
MoviesScreen::MOVIE_SIZE = sf::IniReader::GetInt("MOVIES", "MOVIE_SIZE", 1, f2ResIni);
std::string x = sf::trim(sf::IniReader::GetString("MAPS", "SCROLL_DIST_X", "480", 16, f2ResIni));
std::string y = sf::trim(sf::IniReader::GetString("MAPS", "SCROLL_DIST_Y", "400", 16, f2ResIni));
ViewMap::SCROLL_DIST_X = (!x.compare(0, 9, "HALF_SCRN")) ? (SCR_WIDTH / 2) + 32 : std::atol(x.c_str());
ViewMap::SCROLL_DIST_Y = (!y.compare(0, 9, "HALF_SCRN")) ? (SCR_HEIGHT / 2) + 24 : std::atol(y.c_str());
long x = sf::IniReader::GetInt("MAPS", "SCROLL_DIST_X", 0, f2ResIni);
long y = sf::IniReader::GetInt("MAPS", "SCROLL_DIST_Y", 0, f2ResIni);
ViewMap::SCROLL_DIST_X = (x <= 0) ? (SCR_WIDTH / 2) + 32 : x;
ViewMap::SCROLL_DIST_Y = (y <= 0) ? (SCR_HEIGHT / 2) + 24 : y;
ViewMap::IGNORE_PLAYER_SCROLL_LIMITS = (sf::IniReader::GetInt("MAPS", "IGNORE_PLAYER_SCROLL_LIMITS", 0, f2ResIni) != 0);
ViewMap::IGNORE_MAP_EDGES = (sf::IniReader::GetInt("MAPS", "IGNORE_MAP_EDGES", 0, f2ResIni) != 0);
+11 -6
View File
@@ -26,6 +26,8 @@
#include "ScriptExtender.h"
#include "SpeedPatch.h"
#include "..\HRP\viewmap\ViewMap.h"
#include "Worldmap.h"
namespace sfall
@@ -369,24 +371,27 @@ static void RestRestore() {
SafeWrite16(0x499E93, 0x0574);
}
static void WorldLimitsPatches() {
DWORD data = IniReader::GetConfigInt("Misc", "LocalMapXLimit", 0);
if (data) {
static void MapLimitsPatches() {
// This has priority over the SCROLL_DIST_X/Y options in f2_res.ini
long data = IniReader::GetConfigInt("Misc", "LocalMapXLimit", 0);
if (data > 0) {
dlog("Applying local map x limit patch.", DL_INIT);
SafeWrite32(0x4B13B9, data);
HRP::ViewMap::SCROLL_DIST_X = data;
dlogr(" Done", DL_INIT);
}
data = IniReader::GetConfigInt("Misc", "LocalMapYLimit", 0);
if (data) {
if (data > 0) {
dlog("Applying local map y limit patch.", DL_INIT);
SafeWrite32(0x4B13C7, data);
HRP::ViewMap::SCROLL_DIST_Y = data;
dlogr(" Done", DL_INIT);
}
//if (IniReader::GetConfigInt("Misc", "CitiesLimitFix", 0)) {
dlog("Applying cities limit patch.", DL_INIT);
if (*((BYTE*)0x4BF3BB) != CodeType::JumpShort) {
SafeWrite8(0x4BF3BB, CodeType::JumpShort);
SafeWrite8(0x4BF3BB, CodeType::JumpShort); // wmAreaInit_
}
dlogr(" Done", DL_INIT);
//}
@@ -697,7 +702,7 @@ void Worldmap::init() {
PathfinderFixInit();
StartingStatePatches();
TimeLimitPatch();
WorldLimitsPatches();
MapLimitsPatches();
WorldmapFpsPatch();
PipBoyAutomapsPatch();