mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed premature assignment of arguments before the beginning of the hooks in InventoryHs.cpp. (#173)
(cherry picked from commit fff48407c3)
Updated version number.
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v4.0.5
|
||||
;v4.0.6
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
|
||||
@@ -42,6 +42,8 @@ void _stdcall BeginHook();
|
||||
void _stdcall RunHookScript(DWORD hook);
|
||||
void _stdcall EndHook();
|
||||
|
||||
#define HookBegin __asm pushad __asm call BeginHook __asm popad
|
||||
|
||||
#define hookbegin(a) __asm pushad __asm call BeginHook __asm popad __asm mov argCount, a
|
||||
#define hookend __asm pushad __asm call EndHook __asm popad
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ static const DWORD RemoveObjHookRet = 0x477497;
|
||||
static void __declspec(naked) RemoveObjHook() {
|
||||
__asm {
|
||||
mov ecx, [esp + 8]; // call addr
|
||||
HookBegin;
|
||||
mov args[0], eax;
|
||||
mov args[4], edx;
|
||||
mov args[8], ebx;
|
||||
@@ -22,7 +23,6 @@ static void __declspec(naked) RemoveObjHook() {
|
||||
pushad;
|
||||
}
|
||||
|
||||
BeginHook();
|
||||
argCount = 4;
|
||||
RunHookScript(HOOK_REMOVEINVENOBJ);
|
||||
EndHook();
|
||||
@@ -38,6 +38,7 @@ static void __declspec(naked) RemoveObjHook() {
|
||||
|
||||
static void __declspec(naked) MoveCostHook() {
|
||||
__asm {
|
||||
HookBegin;
|
||||
mov args[0], eax;
|
||||
mov args[4], edx;
|
||||
call fo::funcoffs::critter_compute_ap_from_distance_
|
||||
@@ -45,7 +46,6 @@ static void __declspec(naked) MoveCostHook() {
|
||||
pushad;
|
||||
}
|
||||
|
||||
BeginHook();
|
||||
argCount = 3;
|
||||
RunHookScript(HOOK_MOVECOST);
|
||||
EndHook();
|
||||
@@ -78,16 +78,19 @@ static int __fastcall SwitchHandHook_Script(fo::GameObject* item, fo::GameObject
|
||||
if (itemReplaced && fo::GetItemType(itemReplaced) == fo::item_type_weapon && fo::GetItemType(item) == fo::item_type_ammo) {
|
||||
return -1; // to prevent inappropriate hook call after dropping ammo on weapon
|
||||
}
|
||||
|
||||
BeginHook();
|
||||
argCount = 3;
|
||||
|
||||
args[0] = (addr < 0x47136D) ? 1 : 2; // slot: 1 - left, 2 - right
|
||||
args[1] = (DWORD)item;
|
||||
args[2] = (DWORD)itemReplaced;
|
||||
|
||||
RunHookScript(HOOK_INVENTORYMOVE);
|
||||
int tmp = PartyControl::SwitchHandHook(item);
|
||||
if (tmp != -1) {
|
||||
int result = PartyControl::SwitchHandHook(item);
|
||||
if (result != -1) {
|
||||
cRetTmp = 0;
|
||||
SetHSReturn(tmp);
|
||||
SetHSReturn(result);
|
||||
}
|
||||
EndHook();
|
||||
|
||||
@@ -255,7 +258,7 @@ donothing:
|
||||
|
||||
/* Common InvenWield hook */
|
||||
static void InvenWieldHook_Script(int flag) {
|
||||
BeginHook();
|
||||
|
||||
argCount = 4;
|
||||
args[3] = flag; // invenwield flag
|
||||
RunHookScript(HOOK_INVENWIELD);
|
||||
@@ -265,6 +268,7 @@ static void InvenWieldHook_Script(int flag) {
|
||||
static void _declspec(naked) InvenWieldFuncHook() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
HookBegin;
|
||||
mov args[0], eax; // critter
|
||||
mov args[4], edx; // item
|
||||
mov args[8], ebx; // slot
|
||||
@@ -288,6 +292,7 @@ static void _declspec(naked) InvenWieldFuncHook() {
|
||||
// called when unwielding weapons
|
||||
static void _declspec(naked) InvenUnwieldFuncHook() {
|
||||
__asm {
|
||||
HookBegin;
|
||||
mov args[0], eax; // critter
|
||||
mov args[8], edx; // slot
|
||||
pushad;
|
||||
@@ -310,6 +315,7 @@ static void _declspec(naked) InvenUnwieldFuncHook() {
|
||||
|
||||
static void _declspec(naked) CorrectFidForRemovedItemHook() {
|
||||
__asm {
|
||||
HookBegin;
|
||||
mov args[0], eax; // critter
|
||||
mov args[4], edx; // item
|
||||
mov args[8], ebx; // item flag
|
||||
|
||||
+3
-3
@@ -24,13 +24,13 @@
|
||||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_BUILD 5
|
||||
#define VERSION_BUILD 6
|
||||
#define VERSION_REV 0
|
||||
|
||||
#ifdef WIN2K
|
||||
#define VERSION_STRING "4.0.5 win2k"
|
||||
#define VERSION_STRING "4.0.6 win2k"
|
||||
#else
|
||||
#define VERSION_STRING "4.0.5"
|
||||
#define VERSION_STRING "4.0.6"
|
||||
#endif
|
||||
|
||||
#define CHECK_VAL (4)
|
||||
|
||||
Reference in New Issue
Block a user