mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Integrated Crafty's updated fix to prevent the game with old (pre-3.0) versions of f2_res from crashing/hanging while trying to use drag&drop to reload weapons in the inventory list.
Added a few new engine-related defines and constants.
This commit is contained in:
+31
-27
@@ -432,37 +432,43 @@ static void __declspec(naked) inven_pickup_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD inven_pickup_loop=-1;
|
||||
static void __declspec(naked) inven_pickup_hack2() {
|
||||
__asm {
|
||||
cmp inven_pickup_loop, -1
|
||||
jne inLoop
|
||||
test eax, eax
|
||||
jnz startLoop
|
||||
mov eax, 0x47125C
|
||||
jmp eax
|
||||
startLoop:
|
||||
jz end
|
||||
mov eax, ds:[_i_wid]
|
||||
call GNW_find_
|
||||
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
|
||||
mov eax, [eax+0x8+0x0] // eax = _i_wid.rect.x
|
||||
add eax, 44 // x_start
|
||||
mov ebx, 64
|
||||
add ebx, eax // x_end
|
||||
xor edx, edx
|
||||
mov inven_pickup_loop, edx
|
||||
nextLoop:
|
||||
mov ebx, 188 // x_end
|
||||
add edx, 35 // y_start
|
||||
next:
|
||||
push eax
|
||||
push edx
|
||||
push ecx
|
||||
push ebx
|
||||
imul edx, edx, 48
|
||||
add edx, 35
|
||||
add edx, ecx // y_start
|
||||
mov ecx, edx
|
||||
add ecx, 48 // y_end
|
||||
mov eax, 0x471140 // x_start address
|
||||
jmp eax
|
||||
inLoop:
|
||||
call mouse_click_in_
|
||||
pop ebx
|
||||
pop ecx
|
||||
pop edx
|
||||
test eax, eax
|
||||
mov eax, inven_pickup_loop
|
||||
jnz foundRect
|
||||
inc eax
|
||||
mov inven_pickup_loop, eax
|
||||
imul edx, eax, 48
|
||||
jmp nextLoop
|
||||
foundRect:
|
||||
mov inven_pickup_loop, -1
|
||||
mov edx, [esp+0x40] // inventory_offset
|
||||
add edx, eax
|
||||
pop eax
|
||||
jnz found
|
||||
inc edx
|
||||
cmp edx, 6
|
||||
jb next
|
||||
end:
|
||||
mov eax, 0x47125C
|
||||
jmp eax
|
||||
found:
|
||||
add edx, [esp+0x40] // inventory_offset
|
||||
mov eax, ds:[_pud]
|
||||
push eax
|
||||
mov eax, [eax] // itemsCount
|
||||
@@ -470,7 +476,7 @@ foundRect:
|
||||
jz skip
|
||||
dec eax
|
||||
cmp edx, eax
|
||||
jle inRange
|
||||
jbe inRange
|
||||
skip:
|
||||
pop eax
|
||||
mov ebx, 0x4711DF
|
||||
@@ -806,9 +812,7 @@ void BugsInit()
|
||||
MakeCall(0x470EC2, &inven_pickup_hack, true);
|
||||
// Fix for error in player's inventory, related to IFACE_BAR_MODE=1 in f2_res.ini, and
|
||||
// also for reverse order error
|
||||
if (*((DWORD*)0x471140) == 0x00007CB8) { // check for old (pre-3.0) versions of f2_res
|
||||
MakeCall(0x47114A, &inven_pickup_hack2, true);
|
||||
}
|
||||
// Fix for using only one box of ammo when a weapon is above the ammo in the inventory list
|
||||
HookCall(0x476598, &drop_ammo_into_weapon_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
@@ -245,8 +245,10 @@ const DWORD message_init_ = 0x48494C;
|
||||
const DWORD message_load_ = 0x484AA4;
|
||||
const DWORD message_make_path_ = 0x484CB8;
|
||||
const DWORD message_search_ = 0x484C30;
|
||||
const DWORD mouse_click_in_ = 0x4CA934;
|
||||
const DWORD mouse_get_position_ = 0x4CA9DC;
|
||||
const DWORD mouse_hide_ = 0x4CA534;
|
||||
const DWORD mouse_in_ = 0x4CA8C8;
|
||||
const DWORD mouse_show_ = 0x4CA34C;
|
||||
const DWORD move_inventory_ = 0x474708;
|
||||
const DWORD NixHotLines_ = 0x4999C0;
|
||||
@@ -271,6 +273,7 @@ const DWORD obj_scroll_blocking_at_ = 0x48BB44;
|
||||
const DWORD obj_set_light_ = 0x48AC90; // <eax>(int aObj<eax>, signed int aDist<edx>, int a3<ecx>, int aIntensity<ebx>)
|
||||
const DWORD obj_shoot_blocking_at_ = 0x48B930; // (EAX *obj, EDX hexNum, EBX level)
|
||||
const DWORD obj_sight_blocking_at_ = 0x48BB88;
|
||||
const DWORD obj_top_environment_ = 0x48B304;
|
||||
const DWORD obj_use_book_ = 0x49B9F0;
|
||||
const DWORD obj_use_power_on_car_ = 0x49BDE8;
|
||||
const DWORD OptionWindow_ = 0x437C08;
|
||||
|
||||
@@ -393,8 +393,10 @@ extern const DWORD message_init_;
|
||||
extern const DWORD message_load_;
|
||||
extern const DWORD message_make_path_;
|
||||
extern const DWORD message_search_;
|
||||
extern const DWORD mouse_click_in_;
|
||||
extern const DWORD mouse_get_position_;
|
||||
extern const DWORD mouse_hide_;
|
||||
extern const DWORD mouse_in_;
|
||||
extern const DWORD mouse_show_;
|
||||
extern const DWORD move_inventory_;
|
||||
extern const DWORD NixHotLines_;
|
||||
@@ -419,6 +421,7 @@ extern const DWORD obj_scroll_blocking_at_;
|
||||
extern const DWORD obj_set_light_; // <eax>(int aObj<eax>, signed int aDist<edx>, int a3<ecx>, int aIntensity<ebx>)
|
||||
extern const DWORD obj_shoot_blocking_at_;
|
||||
extern const DWORD obj_sight_blocking_at_;
|
||||
extern const DWORD obj_top_environment_;
|
||||
extern const DWORD obj_use_book_;
|
||||
extern const DWORD obj_use_power_on_car_;
|
||||
extern const DWORD OptionWindow_;
|
||||
|
||||
Reference in New Issue
Block a user