diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 9aac02c2..cc6a024b 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -563,10 +563,11 @@ int ret1 - overrides the result of engine calculation: 0/1 - failure, 2/3 - HOOK_DESCRIPTIONOBJ (hs_descriptionobj.int) -Runs when using the examine action icon to display item description. You can override the description of the item. +Runs when using the examine action icon to display the description of an object. You can override the description text. An example usage would be to add an additional description to the item based on player's stats/skills. +Does not run if the script of the object overrides the description. -Obj arg0 - the item +Obj arg0 - the object int ret0 - a pointer to the new text received by using "get_string_pointer" function @@ -731,7 +732,7 @@ int arg0 - event type: 3 - checks the chance when using skills (not listed below) 4 - check the chance of using Repair skill 5 - check the chance of using Doctor skill - 6 - check the chance of using Steal skill for the thief + 6 - check the chance of using Steal skill for the thief (usually the player) 7 - the second Steal skill chance check for the target to catch the thief, in which the target's failure is the thief's success result int arg1 - the value of roll result (see ROLL_* constants), which is calculated as: for ROLL_CRITICAL_SUCCESS: random(1, 100) <= (random_chance / 10) + bonus diff --git a/sfall/CheckAddress.cpp b/sfall/CheckAddress.cpp index 3a992075..9d7b6a74 100644 --- a/sfall/CheckAddress.cpp +++ b/sfall/CheckAddress.cpp @@ -11,7 +11,7 @@ std::multimap writeAddress; static std::vector excludeWarning = { 0x44E949, 0x44E94A, 0x44E937, 0x4F5F40, 0x44E932, // from movies.cpp - 0x42D21C, // CritterPoison.cpp + 0x42D21C, // CritterPoison.cpp }; static std::vector excludeConflict = { @@ -107,6 +107,7 @@ static std::vector hackAddr = { // module: Skills {0x4AA59D, 5}, {0x4AA738, 5}, {0x4AA940, 5}, {0x4AA9E1, 1}, {0x4AA9E2, 4}, {0x4AA9F1, 1}, {0x4AA9F2, 4}, {0x4AA9EC, 1}, {0x4AA9ED, 4}, // hookcalls + {0x4AA60E, 2}, {0x4AA612, 1}, // module: Stats {0x4AF6FC, 5}, // module: Worldmap @@ -116,6 +117,10 @@ static std::vector hackAddr = { {0x49952C, 1}, {0x497557, 1}, {0x42E587, 1}, {0x42E588, 4}, {0x499FD4, 2}, {0x499E93, 2}, // module: MiscPatches {0x41276A, 1}, {0x480AAA, 4}, {0x444BA5, 4}, {0x444BCA, 4}, + + // Called from engine + // MiscHS.cpp (HOOK_ROLLCHECK) + {0x42388E, 5}, {0x4234D1, 5}, {0x42356C, 5}, {0x4AAB29, 5}, {0x4AB3B6, 5}, {0x4AB8B5, 5}, {0x4ABC9F, 5}, {0x4ABCE6, 5}, }; //static std::vector jumpAddr = { diff --git a/sfall/Modules/HookScripts/ObjectHs.cpp b/sfall/Modules/HookScripts/ObjectHs.cpp index 4482f5ee..79b9e68a 100644 --- a/sfall/Modules/HookScripts/ObjectHs.cpp +++ b/sfall/Modules/HookScripts/ObjectHs.cpp @@ -134,7 +134,7 @@ end: } } -static DWORD __stdcall DescriptionObjHook_Script(DWORD object) { +static DWORD __fastcall DescriptionObjHook_Script(DWORD object) { BeginHook(); argCount = 1; @@ -150,20 +150,18 @@ static DWORD __stdcall DescriptionObjHook_Script(DWORD object) { static void __declspec(naked) DescriptionObjHook() { __asm { - push eax; - push edx; push ecx; - push eax; // object + push edx; + mov ecx, eax; // object call DescriptionObjHook_Script; - pop ecx; pop edx; - test eax, eax; // pointer to text - jz skip; - add esp, 4; // destroy push eax - retn; + pop ecx; + test eax, eax; // pointer to text + jnz skip; + mov eax, ebp; + jmp fo::funcoffs::object_description_; skip: - pop eax; - jmp fo::funcoffs::item_description_; + retn; } } @@ -387,7 +385,7 @@ void Inject_UseAnimateObjHook() { } void Inject_DescriptionObjHook() { - HookCall(0x48C925, DescriptionObjHook); + HookCall(0x49AE28, DescriptionObjHook); } void Inject_SetLightingHook() {