diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index b72c57a8..58846d7a 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/Functions_def.h b/sfall/FalloutEngine/Functions_def.h index 6e0a08e5..59b5576d 100644 --- a/sfall/FalloutEngine/Functions_def.h +++ b/sfall/FalloutEngine/Functions_def.h @@ -41,6 +41,7 @@ WRAP_WATCOM_FUNC1(Window*, GNW_find, long, winRef) WRAP_WATCOM_FUNC0(long, intface_is_item_right_hand) WRAP_WATCOM_FUNC0(void, intface_toggle_item_state) WRAP_WATCOM_FUNC0(void, intface_use_item) +WRAP_WATCOM_FUNC0(long, is_pc_sneak_working) WRAP_WATCOM_FUNC1(long, item_w_max_ammo, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_w_curr_ammo, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_weight, GameObject*, item) diff --git a/sfall/Modules/Scripting/Handlers/Misc.cpp b/sfall/Modules/Scripting/Handlers/Misc.cpp index 69cfe19e..5eb320d0 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.cpp +++ b/sfall/Modules/Scripting/Handlers/Misc.cpp @@ -1708,7 +1708,7 @@ end: } void sf_sneak_success(OpcodeContext& ctx) { - ctx.setReturn(static_cast(fo::var::sneak_working)); + ctx.setReturn(fo::func::is_pc_sneak_working()); } void sf_tile_light(OpcodeContext& ctx) {