mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed HOOK_DESCRIPTIONOBJ to run for all types of objects (#293)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -11,7 +11,7 @@ std::multimap<long, long> writeAddress;
|
||||
|
||||
static std::vector<long> excludeWarning = {
|
||||
0x44E949, 0x44E94A, 0x44E937, 0x4F5F40, 0x44E932, // from movies.cpp
|
||||
0x42D21C, // CritterPoison.cpp
|
||||
0x42D21C, // CritterPoison.cpp
|
||||
};
|
||||
|
||||
static std::vector<long> excludeConflict = {
|
||||
@@ -107,6 +107,7 @@ static std::vector<HackPair> 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<HackPair> 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<long> jumpAddr = {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user