Added a new argument to REMOVEINVENOBJ hook (from Mr.Stalin)

This commit is contained in:
NovaRain
2019-02-25 20:44:49 +08:00
parent 2ce1c0f36e
commit ce0f5ea8c9
2 changed files with 14 additions and 11 deletions
+1
View File
@@ -248,6 +248,7 @@ Obj arg1 - the owner that the object is being removed from
item arg2 - the item that is being removed
int arg3 - the number of items to remove
int arg4 - The reason the object is being removed (see RMOBJ_* constants)
Obj arg5 - The destination object when the item is moved to another object, otherwise 0
-------------------------------------------
+13 -11
View File
@@ -572,22 +572,24 @@ end:
static const DWORD RemoveObjHookRet = 0x477497;
static void __declspec(naked) RemoveObjHook() {
__asm {
push ecx;
mov ecx, [esp+4];
hookbegin(4);
mov args[0], eax;
mov args[4], edx;
mov args[8], ebx;
mov ecx, [esp + 8]; // call addr
hookbegin(5);
mov args[0], eax; // source
mov args[4], edx; // item
mov args[8], ebx; // count
mov args[12], ecx;
xor esi, esi;
xor ecx, 0x47761D; // from item_move_func_
cmovz esi, ebp; // target
mov args[16], esi;
push edi;
push ebp;
pushad;
push HOOK_REMOVEINVENOBJ;
call RunHookScript;
popad;
hookend;
push esi;
push edi;
push ebp;
sub esp, 0xc;
sub esp, 0x0C;
jmp RemoveObjHookRet;
}
}
@@ -1321,7 +1323,7 @@ static void HookScriptInit2() {
HookCall(0x473573, &UseObjOnHook_item_d_take_drug); // inven_action_cursor
LoadHookScript("hs_removeinvenobj", HOOK_REMOVEINVENOBJ);
MakeJump(0x477490, RemoveObjHook);
MakeJump(0x477492, RemoveObjHook); // old 0x477490
LoadHookScript("hs_barterprice", HOOK_BARTERPRICE);
HookCall(0x474D4C, &BarterPriceHook);