Quickly moving items in inventory. (#162)

* Added an option for quickly moving items (w/o dialog box) in inventory.

* An separate option is added to set the counter of maximum number of items when moving items.
This commit is contained in:
Mr.Stalin
2018-06-06 06:23:07 +08:00
committed by NovaRain
parent ea1c00ec91
commit aaa76cb3d1
+31
View File
@@ -35,6 +35,7 @@ static Delegate<DWORD> onAdjustFid;
static DWORD mode;
static DWORD maxItemSize;
static DWORD reloadWeaponKey = 0;
static DWORD itemFastMoveKey = 0;
long& GetActiveItemMode() {
return fo::var::itemButtonItems[fo::var::itemCurrentItem].mode;
@@ -794,6 +795,27 @@ void __declspec(naked) adjust_fid_replacement() {
}
}
void __declspec(naked) do_move_timer_hook() {
__asm {
cmp eax, 4;
jnz end;
pushad;
}
KeyDown(itemFastMoveKey);
__asm {
test eax, eax;
popad;
jz end;
mov dword ptr [esp], 0x476920;
retn;
end:
call fo::funcoffs::setup_move_timer_win_;
retn;
}
}
void InventoryReset() {
invenapcost = GetConfigInt("Misc", "InventoryApCost", 4);
}
@@ -866,6 +888,15 @@ void Inventory::init() {
SafeWrite8(0x476569, 0x91); // xchg ecx, eax
};
itemFastMoveKey = GetConfigInt("Input", "ItemFastMoveKey", DIK_LCONTROL);
if (itemFastMoveKey > 0) {
HookCall(0x476897, do_move_timer_hook);
}
if (GetConfigInt("Misc", "ItemCounterDefaultMax", 0)) {
BlockCall(0x4768A3); // mov ebx, 1
}
// 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);