mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added the ability to move items out of bag/backpack and back into the main inventory list by dragging them to character's image (similar to Fallout 1 behavior) (derived from Crafty's code)
Added a fix for losing items from inventory when you try to drag them to bag/backpack in the inventory list and are overloaded (from Crafty) Removed gdBarterDispFix from ddraw.ini.
This commit is contained in:
+34
-1
@@ -858,6 +858,32 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
/*static void __declspec(naked) switch_hand_hack() {
|
||||
__asm {
|
||||
mov eax, ds:[_inven_dude]
|
||||
push eax
|
||||
mov [edi], ebp
|
||||
inc ecx
|
||||
jz skip
|
||||
xor ebx, ebx
|
||||
inc ebx
|
||||
mov edx, ebp
|
||||
call item_remove_mult_
|
||||
skip:
|
||||
pop edx
|
||||
mov eax, ebp
|
||||
call item_get_type_
|
||||
cmp eax, item_type_container
|
||||
jne end
|
||||
mov [ebp+0x7C], edx // iobj.owner = _inven_dude
|
||||
end:
|
||||
pop ebp
|
||||
pop edi
|
||||
pop esi
|
||||
retn
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
void BugsInit()
|
||||
{
|
||||
@@ -1096,9 +1122,16 @@ void BugsInit()
|
||||
//}
|
||||
|
||||
// Fix for display issues when calling gdialog_mod_barter with critters with no "Barter" flag set
|
||||
if (GetPrivateProfileIntA("Misc", "gdBarterDispFix", 1, ini)) {
|
||||
//if (GetPrivateProfileIntA("Misc", "gdBarterDispFix", 1, ini)) {
|
||||
dlog("Applying gdialog_mod_barter display fix.", DL_INIT);
|
||||
HookCall(0x448250, &gdActivateBarter_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
if (GetPrivateProfileIntA("Misc", "BagBackpackFix", 1, ini)) {
|
||||
// Fix for losing items from inventory when you try to drag them to bag/backpack in the inventory list and are overloaded
|
||||
HookCall(0x4764FC, (void*)item_add_force_);
|
||||
//
|
||||
//MakeCall(0x4715DB, &switch_hand_hack, true);
|
||||
}
|
||||
}
|
||||
|
||||
+33
-1
@@ -606,6 +606,34 @@ static void __declspec(naked) item_add_mult_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) inven_pickup_hook() {
|
||||
__asm {
|
||||
mov eax, ds:[_i_wid]
|
||||
call GNW_find_
|
||||
mov ebx, [eax+0x8+0x0] // ebx = _i_wid.rect.x
|
||||
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
|
||||
mov eax, 176
|
||||
add eax, ebx // x_start
|
||||
add ebx, 176+60 // x_end
|
||||
mov edx, 37
|
||||
add edx, ecx // y_start
|
||||
add ecx, 37+100 // y_end
|
||||
call mouse_click_in_
|
||||
test eax, eax
|
||||
jz end
|
||||
mov edx, ds:[_curr_stack]
|
||||
test edx, edx
|
||||
jnz end
|
||||
cmp edi, 1006 // Hands?
|
||||
jae skip // Yes
|
||||
skip:
|
||||
xor eax, eax
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InventoryInit() {
|
||||
mode=GetPrivateProfileInt("Misc", "CritterInvSizeLimitMode", 0, ini);
|
||||
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
|
||||
@@ -658,7 +686,7 @@ void InventoryInit() {
|
||||
HookCall(0x4772AA, &item_add_mult_hook);
|
||||
}
|
||||
|
||||
//Do not call the 'Move Items' window when using drap and drop to reload weapons in the inventory
|
||||
// Do not call the 'Move Items' window when using drap and drop to reload weapons in the inventory
|
||||
int ReloadReserve = GetPrivateProfileIntA("Misc", "ReloadReserve", 1, ini);
|
||||
if (ReloadReserve >= 0) {
|
||||
SafeWrite32(0x47655F, ReloadReserve); // mov eax, ReloadReserve
|
||||
@@ -666,6 +694,10 @@ void InventoryInit() {
|
||||
SafeWrite16(0x476567, 0xC129); // sub ecx, eax
|
||||
SafeWrite8(0x476569, 0x91); // xchg ecx, eax
|
||||
};
|
||||
|
||||
// Move items out of bag/backpack and back into the main inventory list by dragging them to character's image
|
||||
// (similar to Fallout 1 behavior)
|
||||
HookCall(0x471457, &inven_pickup_hook);
|
||||
}
|
||||
void InventoryReset() {
|
||||
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
|
||||
|
||||
Reference in New Issue
Block a user