mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed the behavior of ObjCanSeeObj_ShootThru_Fix
* now the critter can only see through objects in front of it.
This commit is contained in:
+1
-1
@@ -577,7 +577,7 @@ InventoryApCost=4
|
||||
QuickPocketsApCostReduction=2
|
||||
|
||||
;Set to 1 to fix obj_can_see_obj script function to allow critters to see through other critters and objects with 'ShootThru' flag set
|
||||
;Note that enabling this option can cause unexpected NPC behavior in some situations, e.g. able to attack or enter into a dialogue with the player behind some objects
|
||||
;Note that enabling this option can cause unexpected NPC behavior in some cases, e.g. initiating combat or dialogue when the player is hiding behind some obstacles
|
||||
ObjCanSeeObj_ShootThru_Fix=0
|
||||
|
||||
;Set to 1 to fix the broken obj_can_hear_obj script function
|
||||
|
||||
@@ -274,8 +274,8 @@
|
||||
|
||||
// returns the corrected tile distance between two objects to the distance variable (return value >= 9996 is an error when getting the distance)
|
||||
#define distance_objs(distance, obj1, obj2) distance := tile_distance_objs(obj1, obj2) - 1; \
|
||||
if (get_flags(obj1) bwand FLAG_MULTIHEX) distance--; \
|
||||
if (get_flags(obj2) bwand FLAG_MULTIHEX) distance--
|
||||
if (get_flags(obj1) bwand FLAG_MULTIHEX) then distance--; \
|
||||
if (get_flags(obj2) bwand FLAG_MULTIHEX) then distance--
|
||||
|
||||
|
||||
/* sfall metalure3 function macros */
|
||||
|
||||
@@ -15,6 +15,7 @@ static std::vector<long> excludeWarning = {
|
||||
|
||||
static std::vector<long> excludeConflict = {
|
||||
0x42A0F8, // bugfixes.cpp
|
||||
0x461495, // BarBoxes.cpp
|
||||
};
|
||||
|
||||
struct HackPair {
|
||||
|
||||
@@ -136,16 +136,27 @@ static void __declspec(naked) op_obj_can_see_obj_hook() {
|
||||
using namespace Fields;
|
||||
__asm {
|
||||
mov edi, [esp + 4]; // buf **ret_objStruct
|
||||
test ebp, ebp;
|
||||
jz onlyOnce;
|
||||
xor ebp, ebp;
|
||||
push edx;
|
||||
mov edx, [edi - 8]; // target
|
||||
push eax; // source
|
||||
call fo::funcoffs::can_see_;
|
||||
test eax, eax;
|
||||
pop eax;
|
||||
pop edx;
|
||||
jz normal;
|
||||
onlyOnce:
|
||||
push fo::funcoffs::obj_shoot_blocking_at_; // check hex objects func pointer
|
||||
push 0x20; // flags, 0x20 = check ShootThru
|
||||
push edi;
|
||||
call fo::funcoffs::make_straight_path_func_;
|
||||
// fix: see through critters
|
||||
mov edx, [esp + 4];
|
||||
mov ebx, [edx];
|
||||
// see through critter
|
||||
mov ebx, [edi];
|
||||
test ebx, ebx;
|
||||
jz skip;
|
||||
cmp ebx, [edx - 8]; // target
|
||||
cmp ebx, [edi - 8]; // target
|
||||
jne noTarget;
|
||||
skip:
|
||||
retn 8;
|
||||
@@ -156,9 +167,14 @@ noTarget:
|
||||
je isCritter;
|
||||
retn 8;
|
||||
isCritter:
|
||||
mov [edx - 4], ebx; // replace source
|
||||
mov [edi - 4], ebx; // replace source
|
||||
mov dword ptr [esp], 0x456BAB; // continue
|
||||
retn 8;
|
||||
normal: // vanilla behavior
|
||||
push 0x10;
|
||||
push edi;
|
||||
call fo::funcoffs::make_straight_path_;
|
||||
retn 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user