mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Some edits to the previous commit
Minor edits to some code.
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ WindowData=0
|
|||||||
;GlobalShaderFile=global.fx
|
;GlobalShaderFile=global.fx
|
||||||
|
|
||||||
;Set to 1 to enable linear texture filtering
|
;Set to 1 to enable linear texture filtering
|
||||||
;This can be used in conjunction with GlobalShaderFile
|
;This can be used in conjunction with the GlobalShaderFile option
|
||||||
TextureFilter=1
|
TextureFilter=1
|
||||||
|
|
||||||
;Set to 1 to do the palette conversion on the GPU
|
;Set to 1 to do the palette conversion on the GPU
|
||||||
|
|||||||
+2
-2
@@ -64,7 +64,7 @@ struct KnockbackModifier {
|
|||||||
double value;
|
double value;
|
||||||
};
|
};
|
||||||
|
|
||||||
long Combat_rawHitChance; // the value of hit chance w/o any cap
|
long Combat_determineHitChance; // the value of hit chance w/o any cap
|
||||||
|
|
||||||
static std::vector<long> noBursts; // object id
|
static std::vector<long> noBursts; // object id
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ static void __declspec(naked) compute_dmg_damage_hack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int __fastcall HitChanceMod(int base, TGameObj* critter) {
|
static int __fastcall HitChanceMod(int base, TGameObj* critter) {
|
||||||
Combat_rawHitChance = base;
|
Combat_determineHitChance = base;
|
||||||
for (size_t i = 0; i < hitChanceMods.size(); i++) {
|
for (size_t i = 0; i < hitChanceMods.size(); i++) {
|
||||||
if (critter->id == hitChanceMods[i].id) {
|
if (critter->id == hitChanceMods[i].id) {
|
||||||
return min(base + hitChanceMods[i].mod, hitChanceMods[i].maximum);
|
return min(base + hitChanceMods[i].mod, hitChanceMods[i].maximum);
|
||||||
|
|||||||
+1
-1
@@ -51,4 +51,4 @@ void __stdcall SetNoBurstMode(TGameObj* critter, bool on);
|
|||||||
void __stdcall DisableAimedShots(DWORD pid);
|
void __stdcall DisableAimedShots(DWORD pid);
|
||||||
void __stdcall ForceAimedShots(DWORD pid);
|
void __stdcall ForceAimedShots(DWORD pid);
|
||||||
|
|
||||||
extern long Combat_rawHitChance;
|
extern long Combat_determineHitChance;
|
||||||
|
|||||||
@@ -1783,7 +1783,7 @@ void __fastcall CheckForDeath(TGameObj* critter, long amountDamage, long* flags)
|
|||||||
WRAP_WATCOM_FCALL3(check_for_death_, critter, amountDamage, flags)
|
WRAP_WATCOM_FCALL3(check_for_death_, critter, amountDamage, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall CorrectFidForRemovedItemFunc(TGameObj* critter, TGameObj* item, long slotFlag) {
|
void __fastcall CorrectFidForRemovedItem(TGameObj* critter, TGameObj* item, long slotFlag) {
|
||||||
WRAP_WATCOM_FCALL3(correctFidForRemovedItem_, critter, item, slotFlag)
|
WRAP_WATCOM_FCALL3(correctFidForRemovedItem_, critter, item, slotFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1339,7 +1339,7 @@ long __stdcall XFSeek(DbFile* file, long fOffset, long origin);
|
|||||||
/* fastcall */
|
/* fastcall */
|
||||||
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count);
|
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count);
|
||||||
void __fastcall CheckForDeath(TGameObj* critter, long amountDamage, long* flags);
|
void __fastcall CheckForDeath(TGameObj* critter, long amountDamage, long* flags);
|
||||||
void __fastcall CorrectFidForRemovedItemFunc(TGameObj* critter, TGameObj* item, long slotFlag);
|
void __fastcall CorrectFidForRemovedItem(TGameObj* critter, TGameObj* item, long slotFlag);
|
||||||
long __fastcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, long color, long flags);
|
long __fastcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, long color, long flags);
|
||||||
long __fastcall DetermineToHit(TGameObj* source, TGameObj* target, long bodyPart, long hitMode);
|
long __fastcall DetermineToHit(TGameObj* source, TGameObj* target, long bodyPart, long hitMode);
|
||||||
void __fastcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode);
|
void __fastcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode);
|
||||||
|
|||||||
+27
-19
@@ -183,7 +183,7 @@ static void __declspec(naked) ToHitHook() {
|
|||||||
pushadc;
|
pushadc;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[7] = Combat_rawHitChance;
|
args[7] = Combat_determineHitChance;
|
||||||
RunHookScript(HOOK_TOHIT);
|
RunHookScript(HOOK_TOHIT);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -241,13 +241,13 @@ long __fastcall sf_item_w_mp_cost(TGameObj* source, long hitMode, long isCalled)
|
|||||||
long cost = ItemWMpCost(source, hitMode, isCalled);
|
long cost = ItemWMpCost(source, hitMode, isCalled);
|
||||||
|
|
||||||
BeginHook();
|
BeginHook();
|
||||||
|
argCount = 4;
|
||||||
|
|
||||||
args[0] = (DWORD)source;
|
args[0] = (DWORD)source;
|
||||||
args[1] = hitMode;
|
args[1] = hitMode;
|
||||||
args[2] = isCalled;
|
args[2] = isCalled;
|
||||||
args[3] = cost;
|
args[3] = cost;
|
||||||
|
|
||||||
argCount = 4;
|
|
||||||
RunHookScript(HOOK_CALCAPCOST);
|
RunHookScript(HOOK_CALCAPCOST);
|
||||||
|
|
||||||
if (cRet > 0) cost = rets[0];
|
if (cRet > 0) cost = rets[0];
|
||||||
@@ -283,7 +283,6 @@ static void __declspec(naked) CalcApCostHook() {
|
|||||||
static void __declspec(naked) CalcApCostHook2() {
|
static void __declspec(naked) CalcApCostHook2() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 4;
|
|
||||||
mov args[0], ecx; // critter
|
mov args[0], ecx; // critter
|
||||||
mov args[4], edx; // attack type (to determine hand)
|
mov args[4], edx; // attack type (to determine hand)
|
||||||
mov args[8], ebx;
|
mov args[8], ebx;
|
||||||
@@ -292,6 +291,7 @@ static void __declspec(naked) CalcApCostHook2() {
|
|||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 4;
|
||||||
RunHookScript(HOOK_CALCAPCOST);
|
RunHookScript(HOOK_CALCAPCOST);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -361,7 +361,6 @@ static void __declspec(naked) CalcDeathAnim2Hook() {
|
|||||||
__asm {
|
__asm {
|
||||||
call check_death_; // call original function
|
call check_death_; // call original function
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 5;
|
|
||||||
mov ebx, [esp + 60];
|
mov ebx, [esp + 60];
|
||||||
mov args[4], ebx; // attacker
|
mov args[4], ebx; // attacker
|
||||||
mov args[8], esi; // target
|
mov args[8], esi; // target
|
||||||
@@ -371,6 +370,7 @@ static void __declspec(naked) CalcDeathAnim2Hook() {
|
|||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 5;
|
||||||
args[0] = -1; // weaponPid
|
args[0] = -1; // weaponPid
|
||||||
RunHookScript(HOOK_DEATHANIM2);
|
RunHookScript(HOOK_DEATHANIM2);
|
||||||
|
|
||||||
@@ -439,10 +439,10 @@ static void __declspec(naked) OnDeathHook() {
|
|||||||
__asm {
|
__asm {
|
||||||
push edx;
|
push edx;
|
||||||
call BeginHook;
|
call BeginHook;
|
||||||
mov argCount, 1;
|
|
||||||
mov args[0], esi;
|
mov args[0], esi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 1;
|
||||||
RunHookScript(HOOK_ONDEATH);
|
RunHookScript(HOOK_ONDEATH);
|
||||||
EndHook();
|
EndHook();
|
||||||
|
|
||||||
@@ -457,13 +457,13 @@ static void __declspec(naked) OnDeathHook() {
|
|||||||
|
|
||||||
static void __declspec(naked) OnDeathHook2() {
|
static void __declspec(naked) OnDeathHook2() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
|
||||||
mov argCount, 1;
|
|
||||||
mov args[0], esi;
|
|
||||||
call partyMemberRemove_;
|
call partyMemberRemove_;
|
||||||
|
HookBegin;
|
||||||
|
mov args[0], esi;
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 1;
|
||||||
RunHookScript(HOOK_ONDEATH);
|
RunHookScript(HOOK_ONDEATH);
|
||||||
EndHook();
|
EndHook();
|
||||||
|
|
||||||
@@ -506,13 +506,13 @@ static void __declspec(naked) FindTargetHook() {
|
|||||||
static void __declspec(naked) UseObjOnHook() {
|
static void __declspec(naked) UseObjOnHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 3;
|
|
||||||
mov args[0], edx; // target
|
mov args[0], edx; // target
|
||||||
mov args[4], eax; // user
|
mov args[4], eax; // user
|
||||||
mov args[8], ebx; // object
|
mov args[8], ebx; // object
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 3;
|
||||||
RunHookScript(HOOK_USEOBJON);
|
RunHookScript(HOOK_USEOBJON);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -533,13 +533,13 @@ defaultHandler:
|
|||||||
static void __declspec(naked) Drug_UseObjOnHook() {
|
static void __declspec(naked) Drug_UseObjOnHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 3;
|
|
||||||
mov args[0], eax; // target
|
mov args[0], eax; // target
|
||||||
mov args[4], eax; // user
|
mov args[4], eax; // user
|
||||||
mov args[8], edx; // object
|
mov args[8], edx; // object
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 3;
|
||||||
RunHookScript(HOOK_USEOBJON);
|
RunHookScript(HOOK_USEOBJON);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -560,12 +560,12 @@ defaultHandler:
|
|||||||
static void __declspec(naked) UseObjHook() {
|
static void __declspec(naked) UseObjHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 2;
|
|
||||||
mov args[0], eax; // user
|
mov args[0], eax; // user
|
||||||
mov args[4], edx; // object
|
mov args[4], edx; // object
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 2;
|
||||||
RunHookScript(HOOK_USEOBJ);
|
RunHookScript(HOOK_USEOBJ);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -588,7 +588,6 @@ static void __declspec(naked) RemoveObjHook() {
|
|||||||
__asm {
|
__asm {
|
||||||
mov ecx, [esp + 8]; // call addr
|
mov ecx, [esp + 8]; // call addr
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 5;
|
|
||||||
mov args[0], eax; // source
|
mov args[0], eax; // source
|
||||||
mov args[4], edx; // item
|
mov args[4], edx; // item
|
||||||
mov args[8], ebx; // count
|
mov args[8], ebx; // count
|
||||||
@@ -603,6 +602,7 @@ static void __declspec(naked) RemoveObjHook() {
|
|||||||
push edx;
|
push edx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 5;
|
||||||
RunHookScript(HOOK_REMOVEINVENOBJ);
|
RunHookScript(HOOK_REMOVEINVENOBJ);
|
||||||
EndHook();
|
EndHook();
|
||||||
|
|
||||||
@@ -826,7 +826,6 @@ static void __declspec(naked) HexSightBlockingHook() {
|
|||||||
static void __declspec(naked) ItemDamageHook() {
|
static void __declspec(naked) ItemDamageHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 6;
|
|
||||||
mov args[0], eax; // min
|
mov args[0], eax; // min
|
||||||
mov args[4], edx; // max
|
mov args[4], edx; // max
|
||||||
mov args[8], edi; // weapon
|
mov args[8], edi; // weapon
|
||||||
@@ -835,6 +834,7 @@ static void __declspec(naked) ItemDamageHook() {
|
|||||||
mov args[20], ebp; // non-zero for weapon melee attack (add to min/max melee damage)
|
mov args[20], ebp; // non-zero for weapon melee attack (add to min/max melee damage)
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
argCount = 6;
|
||||||
|
|
||||||
if (args[2] == 0) { // weapon arg
|
if (args[2] == 0) { // weapon arg
|
||||||
args[4] += 8; // type arg
|
args[4] += 8; // type arg
|
||||||
@@ -929,7 +929,6 @@ void __stdcall MouseClickHook(DWORD button, bool pressed) {
|
|||||||
static void __declspec(naked) UseSkillHook() {
|
static void __declspec(naked) UseSkillHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 4;
|
|
||||||
mov args[0], eax; // user
|
mov args[0], eax; // user
|
||||||
mov args[4], edx; // target
|
mov args[4], edx; // target
|
||||||
mov args[8], ebx; // skill id
|
mov args[8], ebx; // skill id
|
||||||
@@ -937,6 +936,7 @@ static void __declspec(naked) UseSkillHook() {
|
|||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 4;
|
||||||
RunHookScript(HOOK_USESKILL);
|
RunHookScript(HOOK_USESKILL);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -957,7 +957,6 @@ defaultHandler:
|
|||||||
static void __declspec(naked) StealCheckHook() {
|
static void __declspec(naked) StealCheckHook() {
|
||||||
__asm {
|
__asm {
|
||||||
HookBegin;
|
HookBegin;
|
||||||
mov argCount, 4;
|
|
||||||
mov args[0], eax; // thief
|
mov args[0], eax; // thief
|
||||||
mov args[4], edx; // target
|
mov args[4], edx; // target
|
||||||
mov args[8], ebx; // item
|
mov args[8], ebx; // item
|
||||||
@@ -965,6 +964,7 @@ static void __declspec(naked) StealCheckHook() {
|
|||||||
pushadc;
|
pushadc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argCount = 4;
|
||||||
RunHookScript(HOOK_STEAL);
|
RunHookScript(HOOK_STEAL);
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
@@ -987,13 +987,13 @@ static long __fastcall PerceptionRangeHook_Script(TGameObj* watcher, TGameObj* t
|
|||||||
long result = IsWithinPerception(watcher, target);
|
long result = IsWithinPerception(watcher, target);
|
||||||
|
|
||||||
BeginHook();
|
BeginHook();
|
||||||
|
argCount = 4;
|
||||||
|
|
||||||
args[0] = (DWORD)watcher;
|
args[0] = (DWORD)watcher;
|
||||||
args[1] = (DWORD)target;
|
args[1] = (DWORD)target;
|
||||||
args[2] = result;
|
args[2] = result;
|
||||||
args[3] = type;
|
args[3] = type;
|
||||||
|
|
||||||
argCount = 4;
|
|
||||||
RunHookScript(HOOK_WITHINPERCEPTION);
|
RunHookScript(HOOK_WITHINPERCEPTION);
|
||||||
|
|
||||||
if (cRet > 0) result = rets[0];
|
if (cRet > 0) result = rets[0];
|
||||||
@@ -1335,6 +1335,7 @@ static long __fastcall InvenWieldHook_Script(TGameObj* critter, TGameObj* item,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BeginHook();
|
BeginHook();
|
||||||
|
argCount = 5;
|
||||||
|
|
||||||
args[0] = (DWORD)critter;
|
args[0] = (DWORD)critter;
|
||||||
args[1] = (DWORD)item;
|
args[1] = (DWORD)item;
|
||||||
@@ -1342,7 +1343,6 @@ static long __fastcall InvenWieldHook_Script(TGameObj* critter, TGameObj* item,
|
|||||||
args[3] = isWield; // unwield/wield event
|
args[3] = isWield; // unwield/wield event
|
||||||
args[4] = isRemove;
|
args[4] = isRemove;
|
||||||
|
|
||||||
argCount = 5;
|
|
||||||
RunHookScript(HOOK_INVENWIELD);
|
RunHookScript(HOOK_INVENWIELD);
|
||||||
|
|
||||||
long result = (cRet == 0 || rets[0] == -1);
|
long result = (cRet == 0 || rets[0] == -1);
|
||||||
@@ -1355,7 +1355,6 @@ static __declspec(noinline) bool InvenWieldHook_ScriptPart(long isWield, long is
|
|||||||
args[3] = isWield; // unwield/wield event
|
args[3] = isWield; // unwield/wield event
|
||||||
args[4] = isRemove;
|
args[4] = isRemove;
|
||||||
|
|
||||||
argCount = 5;
|
|
||||||
RunHookScript(HOOK_INVENWIELD);
|
RunHookScript(HOOK_INVENWIELD);
|
||||||
|
|
||||||
bool result = (cRet == 0 || rets[0] == -1);
|
bool result = (cRet == 0 || rets[0] == -1);
|
||||||
@@ -1372,6 +1371,8 @@ static void __declspec(naked) InvenWieldFuncHook() {
|
|||||||
mov args[8], ebx; // slot
|
mov args[8], ebx; // slot
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
argCount = 5;
|
||||||
|
|
||||||
// right hand slot?
|
// right hand slot?
|
||||||
if (args[2] != INVEN_TYPE_RIGHT_HAND && GetItemType((TGameObj*)args[1]) != item_type_armor) {
|
if (args[2] != INVEN_TYPE_RIGHT_HAND && GetItemType((TGameObj*)args[1]) != item_type_armor) {
|
||||||
args[2] = INVEN_TYPE_LEFT_HAND;
|
args[2] = INVEN_TYPE_LEFT_HAND;
|
||||||
@@ -1397,10 +1398,13 @@ static void __declspec(naked) InvenUnwieldFuncHook() {
|
|||||||
mov args[8], edx; // slot
|
mov args[8], edx; // slot
|
||||||
pushad;
|
pushad;
|
||||||
}
|
}
|
||||||
|
argCount = 5;
|
||||||
|
|
||||||
// set slot
|
// set slot
|
||||||
if (args[2] == 0) { // left hand slot?
|
if (args[2] == 0) { // left hand slot?
|
||||||
args[2] = INVEN_TYPE_LEFT_HAND;
|
args[2] = INVEN_TYPE_LEFT_HAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get item
|
// get item
|
||||||
args[1] = (DWORD)GetItemPtrSlot((TGameObj*)args[0], (InvenType)args[2]);
|
args[1] = (DWORD)GetItemPtrSlot((TGameObj*)args[0], (InvenType)args[2]);
|
||||||
|
|
||||||
@@ -1425,6 +1429,8 @@ static void __declspec(naked) CorrectFidForRemovedItemHook() {
|
|||||||
mov args[8], ebx; // item flag
|
mov args[8], ebx; // item flag
|
||||||
pushadc;
|
pushadc;
|
||||||
}
|
}
|
||||||
|
argCount = 5;
|
||||||
|
|
||||||
// set slot
|
// set slot
|
||||||
if (args[2] & ObjectFlag::Right_Hand) { // right hand slot
|
if (args[2] & ObjectFlag::Right_Hand) { // right hand slot
|
||||||
args[2] = INVEN_TYPE_RIGHT_HAND;
|
args[2] = INVEN_TYPE_RIGHT_HAND;
|
||||||
@@ -1433,7 +1439,9 @@ static void __declspec(naked) CorrectFidForRemovedItemHook() {
|
|||||||
} else {
|
} else {
|
||||||
args[2] = INVEN_TYPE_WORN; // armor slot
|
args[2] = INVEN_TYPE_WORN; // armor slot
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenWieldHook_ScriptPart(0, 1); // unwield event (armor by default)
|
InvenWieldHook_ScriptPart(0, 1); // unwield event (armor by default)
|
||||||
|
|
||||||
// engine handler is not overridden
|
// engine handler is not overridden
|
||||||
__asm {
|
__asm {
|
||||||
popadc;
|
popadc;
|
||||||
@@ -1563,7 +1571,7 @@ long __stdcall CorrectFidForRemovedItem_wHook(TGameObj* critter, TGameObj* item,
|
|||||||
}
|
}
|
||||||
result = InvenWieldHook_Script(critter, item, slot, 0, 0);
|
result = InvenWieldHook_Script(critter, item, slot, 0, 0);
|
||||||
}
|
}
|
||||||
if (result) CorrectFidForRemovedItemFunc(critter, item, flags);
|
if (result) CorrectFidForRemovedItem(critter, item, flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// END HOOKS
|
// END HOOKS
|
||||||
|
|||||||
Reference in New Issue
Block a user