From 45632d68876e5280cd8aab8fda9d06351961b97c Mon Sep 17 00:00:00 2001 From: NovaRain Date: Tue, 5 Dec 2017 10:25:11 +0800 Subject: [PATCH] Changed sneak_success to call is_pc_sneak_working_ engine function, which takes player's current sneaking status into account as well, instead of only returning the result of last sneak attempt. --- artifacts/scripting/sfall function notes.txt | 4 ++-- sfall/FalloutEngine.cpp | 1 + sfall/FalloutEngine.h | 1 + sfall/ScriptOps/MiscOps.hpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index 2c21cb44..8e52dd41 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -299,8 +299,8 @@ Some utility/math functions are available: - Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.) > int sneak_success -- returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise -- this is an internal engine variable wich is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION) +- returns 1 if the player is currently sneaking, and last sneak attempt (roll against skill) was successful; 0 otherwise +- this calls an internal engine function which is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION) > int tile_light(int elevation, int tileNum) - returns light intensity at the given tile in range from 0 to 65535 diff --git a/sfall/FalloutEngine.cpp b/sfall/FalloutEngine.cpp index d2c45072..3a99841e 100644 --- a/sfall/FalloutEngine.cpp +++ b/sfall/FalloutEngine.cpp @@ -378,6 +378,7 @@ const DWORD inven_right_hand_ = 0x471B70; const DWORD inven_unwield_ = 0x472A54; const DWORD inven_wield_ = 0x472758; const DWORD inven_worn_ = 0x471C08; +const DWORD is_pc_sneak_working_ = 0x42E3F4; const DWORD is_within_perception_ = 0x42BA04; const DWORD isPartyMember_ = 0x494FC4; const DWORD item_add_force_ = 0x4772B8; diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index b00652e3..4a9ca790 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -551,6 +551,7 @@ extern const DWORD inven_right_hand_; extern const DWORD inven_unwield_; extern const DWORD inven_wield_; extern const DWORD inven_worn_; +extern const DWORD is_pc_sneak_working_; extern const DWORD is_within_perception_; extern const DWORD isPartyMember_; // ( - object) - bool result extern const DWORD item_add_force_; diff --git a/sfall/ScriptOps/MiscOps.hpp b/sfall/ScriptOps/MiscOps.hpp index b802e3f7..fcc7273e 100644 --- a/sfall/ScriptOps/MiscOps.hpp +++ b/sfall/ScriptOps/MiscOps.hpp @@ -1650,7 +1650,7 @@ end: static void __declspec(naked) op_sneak_success() { _OP_BEGIN(ebp) __asm { - mov eax, ds:[_sneak_working] + call is_pc_sneak_working_ } _RET_VAL_INT(ebp) _OP_END