Expanded UI bug fixes (2)

- HRP compatibility: add support for the current HRP version by patching window Y value directly to it's code
- Barter Window: fixed mouse wheel scrolling not working over extended areas of 2 central tables
This commit is contained in:
phobos2077
2024-05-09 16:04:18 +02:00
parent b5af3b04fc
commit fa8a42eff3
2 changed files with 18 additions and 7 deletions
+8 -3
View File
@@ -1274,8 +1274,8 @@ static void ExpandedBarterPatch() {
dlog_f("Skipping expanded barter screen patch. Screen height = %d < %d\n", DL_INIT, Graphics::GetGameHeightRes(), dialogWindowHeight); dlog_f("Skipping expanded barter screen patch. Screen height = %d < %d\n", DL_INIT, Graphics::GetGameHeightRes(), dialogWindowHeight);
return; return;
} }
if (HRP::Setting::ExternalEnabled()) { if (HRP::Setting::ExternalEnabled() && !HRP::Setting::VersionIsValid) {
dlogr("Skipping expanded barter screen patch. Not compatible with external HRP.", DL_INIT); dlogr("Skipping expanded barter screen patch. Incompatible version of High-Resolution Patch (f2_res.dll) found.", DL_INIT);
return; return;
} }
if (!barterTallFrm.ArtExists() || !tradeTallFrm.ArtExists()) { if (!barterTallFrm.ArtExists() || !tradeTallFrm.ArtExists()) {
@@ -1290,7 +1290,12 @@ static void ExpandedBarterPatch() {
SafeWriteBatch<DWORD>(180 + extraBarterHeight, { // Trade sub-window height SafeWriteBatch<DWORD>(180 + extraBarterHeight, { // Trade sub-window height
0x46EDAB, 0x46EE13, // setup_inventory 0x46EDAB, 0x46EE13, // setup_inventory
}); });
SafeWrite32(0x46EDD4, 470 + extraBarterHeight); // Trade window max Y = Y pos + height = 290 + 180 = 470 if (HRP::Setting::VersionIsValid) {
// HRP overrides window creation code setup_inventory, so need to write correct max Y value into HRP itself.
SafeWrite32(HRP::Setting::GetAddress(0x1001220C), 470 + extraBarterHeight);
} else {
SafeWrite32(0x46EDD4, 470 + extraBarterHeight); // Trade window max Y = Y pos + height = 290 + 180 = 470
}
SafeWriteBatch<DWORD>(dialogWindowHeight, { // Game dialog BG window height (for Y calculation only) SafeWriteBatch<DWORD>(dialogWindowHeight, { // Game dialog BG window height (for Y calculation only)
0x44831E, // gdialog_barter_create_win_ 0x44831E, // gdialog_barter_create_win_
0x4485A7, // gdialog_barter_destroy_win_ 0x4485A7, // gdialog_barter_destroy_win_
+10 -4
View File
@@ -478,10 +478,13 @@ targetDown:
notTargetScroll: notTargetScroll:
mov ebx, ebp; mov ebx, ebp;
mov ecx, edi; mov ecx, edi;
mov eax, 48;
mul ds:[FO_VAR_inven_cur_disp];
add ecx, 20;
mov edx, ecx; // y_start
add ecx, eax; // y_end
lea eax, [ebp + 250]; // x_start lea eax, [ebp + 250]; // x_start
add ebx, 250 + 64; // x_end add ebx, 250 + 64; // x_end
lea edx, [edi + 20]; // y_start
add ecx, 20 + 3 * 48; // y_end
call fo::funcoffs::mouse_click_in_; call fo::funcoffs::mouse_click_in_;
test eax, eax; test eax, eax;
jz notTargetBarter; jz notTargetBarter;
@@ -495,10 +498,13 @@ barterTargetDown:
notTargetBarter: notTargetBarter:
mov ebx, ebp; mov ebx, ebp;
mov ecx, edi; mov ecx, edi;
mov eax, 48;
mul ds:[FO_VAR_inven_cur_disp];
add ecx, 20;
mov edx, ecx; // y_start
add ecx, eax; // y_end
lea eax, [ebp + 165]; // x_start lea eax, [ebp + 165]; // x_start
add ebx, 165 + 64; // x_end add ebx, 165 + 64; // x_end
lea edx, [edi + 20]; // y_start
add ecx, 20 + 3 * 48; // y_end
call fo::funcoffs::mouse_click_in_; call fo::funcoffs::mouse_click_in_;
test eax, eax; test eax, eax;
jz end; jz end;