Fixed Scout perk being taken into account for mark_area_known function.

* technically it should only effect the visibility of tiles when you're
exploring on the world map.

Fixed the incorrect coordinates for small/medium location circles when
highlighting their sub-tiles (one of bugs listed in #228)

Moved the fix for the position of the target marker from Worldmap.cpp to
BugFixes.cpp.

Slightly adjusted the position/size for Local variables button in debug
editor.
This commit is contained in:
NovaRain
2019-06-17 11:24:57 +08:00
parent c4f6c762c4
commit a75e634c96
5 changed files with 87 additions and 23 deletions
+2 -2
View File
@@ -158,9 +158,9 @@
//
this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bCrittersLvar.Enabled = false;
this.bCrittersLvar.Location = new System.Drawing.Point(119, 401);
this.bCrittersLvar.Location = new System.Drawing.Point(118, 401);
this.bCrittersLvar.Name = "bCrittersLvar";
this.bCrittersLvar.Size = new System.Drawing.Size(99, 23);
this.bCrittersLvar.Size = new System.Drawing.Size(100, 23);
this.bCrittersLvar.TabIndex = 7;
this.bCrittersLvar.Text = "Local variables";
this.bCrittersLvar.UseVisualStyleBackColor = true;
+79
View File
@@ -2090,6 +2090,77 @@ static void __declspec(naked) action_use_an_item_on_object_hack() {
}
}
//static const DWORD wmAreaMarkVisitedState_Error = 0x4C4698;
static const DWORD wmAreaMarkVisitedState_Ret = 0x4C46A2;
static void __declspec(naked) wmAreaMarkVisitedState_hack() {
__asm {
mov [ecx + 0x40], esi; // wmAreaInfoList.visited
test esi, esi; // mark "unknown" state
jz skip;
mov eax, [ecx + 0x2C]; // wmAreaInfoList.world_posx
mov edx, [ecx + 0x30]; // wmAreaInfoList.world_posy
// fix loc coordinates
cmp [ecx + 0x34], 1; // wmAreaInfoList.size
jg largeLoc;
je mediumLoc;
//smallLoc:
sub eax, 5;
lea edx, [edx - 5];
mediumLoc:
sub eax, 10;
lea edx, [edx - 10];
largeLoc:
mov ebx, esp; // ppSubTile out
push edx;
push eax;
call wmFindCurSubTileFromPos_;
// cmp eax, -1; // always return 0
// jz error;
pop eax;
pop edx;
mov ebx, [esp];
mov ebx, [ebx + 0x18]; // sub-tile state
test ebx, ebx;
jnz skip;
inc ebx; // 1
skip:
cmp [ecx + 0x38], 1; // wmAreaInfoList.start_state
jne hideLoc;
cmp esi, 2; // mark visited state
jne fix;
call wmMarkSubTileRadiusVisited_;
hideLoc:
jmp wmAreaMarkVisitedState_Ret;
fix:
push ebx;
mov ebx, 1; // radius (fix w/o PERK_scout)
call wmSubTileMarkRadiusVisited_;
pop ebx;
jmp wmAreaMarkVisitedState_Ret;
//error:
// add esp, 8;
// jmp wmAreaMarkVisitedState_Error;
}
}
static void __declspec(naked) wmWorldMap_hack() {
__asm {
mov ebx, [ebx + 0x34]; // wmAreaInfoList.size
cmp ebx, 1;
jg largeLoc;
je mediumLoc;
//smallLoc:
sub eax, 5;
lea edx, [edx - 5];
mediumLoc:
sub eax, 10;
lea edx, [edx - 10];
largeLoc:
xor ebx, ebx;
jmp wmPartyInitWalking_;
}
}
void BugFixesInit()
{
#ifndef NDEBUG
@@ -2644,4 +2715,12 @@ void BugFixesInit()
// Fix for the player's movement in combat being interrupted when trying to use objects with Bonus Move APs available
MakeCall(0x411FD6, action_use_an_item_on_object_hack);
// Fix for Scout perk being taken into account when setting the visibility of locations with mark_area_known function
// also fix the incorrect coordinates for small/medium location circles when highlighting their sub-tiles
MakeJump(0x4C466F, wmAreaMarkVisitedState_hack);
SafeWrite8(0x4C46AB, 0x58); // esi > ebx
// Fix the position of the target marker for small/medium location circles
MakeCall(0x4C03AA, wmWorldMap_hack, 2);
}
+3
View File
@@ -661,9 +661,12 @@ const DWORD win_register_button_ = 0x4D8260;
const DWORD win_register_button_disable_ = 0x4D8674;
const DWORD win_register_button_sound_func_ = 0x4D87F8;
const DWORD win_show_ = 0x4D6DAC;
const DWORD wmFindCurSubTileFromPos_ = 0x4C0C00;
const DWORD wmInterfaceScrollTabsStart_ = 0x4C219C;
const DWORD wmMarkSubTileRadiusVisited_ = 0x4C3550;
const DWORD wmPartyInitWalking_ = 0x4C1E54;
const DWORD wmPartyWalkingStep_ = 0x4C1F90;
const DWORD wmSubTileMarkRadiusVisited_ = 0x4C35A8;
const DWORD wmWorldMapFunc_ = 0x4BFE10;
const DWORD wmWorldMapLoadTempData_ = 0x4BD6B4;
const DWORD xfclose_ = 0x4DED6C;
+3
View File
@@ -892,9 +892,12 @@ extern const DWORD win_register_button_;
extern const DWORD win_register_button_disable_;
extern const DWORD win_register_button_sound_func_;
extern const DWORD win_show_;
extern const DWORD wmFindCurSubTileFromPos_;
extern const DWORD wmInterfaceScrollTabsStart_;
extern const DWORD wmMarkSubTileRadiusVisited_;
extern const DWORD wmPartyInitWalking_;
extern const DWORD wmPartyWalkingStep_;
extern const DWORD wmSubTileMarkRadiusVisited_;
extern const DWORD wmWorldMapFunc_;
extern const DWORD wmWorldMapLoadTempData_;
extern const DWORD xfclose_;
-21
View File
@@ -307,24 +307,6 @@ end:
}
}
static void __declspec(naked) wmWorldMap_hack() {
__asm {
mov ebx, [ebx + 0x34]; // wmAreaInfoList.size
cmp ebx, 1;
jg largeLoc;
je mediumLoc;
//smallLoc:
sub eax, 5;
sub edx, 5;
mediumLoc:
sub eax, 10;
sub edx, 10;
largeLoc:
xor ebx, ebx;
jmp wmPartyInitWalking_;
}
}
void WorldLimitsPatches() {
DWORD data = GetPrivateProfileIntA("Misc", "LocalMapXLimit", 0, ini);
if (data) {
@@ -505,9 +487,6 @@ void WorldMapInterfacePatch() {
SafeWrite8(0x4C2C7C, 0x43); // dec ebx > inc ebx
SafeWrite32(0x4C2C92, 181); // index of DNARWOFF.FRM
SafeWrite8(0x4C2D04, 0x46); // dec esi > inc esi
// Fix the position of the target marker for small/medium location circles
MakeCall(0x4C03AA, wmWorldMap_hack, 2);
}
void PipBoyAutomapsPatch() {