diff --git a/MPClient/DebugEditor.Designer.cs b/MPClient/DebugEditor.Designer.cs index 5a3f7614..c18777ed 100644 --- a/MPClient/DebugEditor.Designer.cs +++ b/MPClient/DebugEditor.Designer.cs @@ -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; diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 4f483b41..a671d204 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -2121,6 +2121,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 fo::funcoffs::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 fo::funcoffs::wmMarkSubTileRadiusVisited_; +hideLoc: + jmp wmAreaMarkVisitedState_Ret; +fix: + push ebx; + mov ebx, 1; // radius (fix w/o PERK_scout) + call fo::funcoffs::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 fo::funcoffs::wmPartyInitWalking_; + } +} + void BugFixes::init() { #ifndef NDEBUG @@ -2686,6 +2757,14 @@ void BugFixes::init() // 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); } } diff --git a/sfall/Modules/Worldmap.cpp b/sfall/Modules/Worldmap.cpp index bf70b633..087e47f0 100644 --- a/sfall/Modules/Worldmap.cpp +++ b/sfall/Modules/Worldmap.cpp @@ -344,24 +344,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 fo::funcoffs::wmPartyInitWalking_; - } -} - static void RestRestore() { if (!restMode) return; @@ -554,9 +536,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() {