diff --git a/sfall/FalloutEngine.cpp b/sfall/FalloutEngine.cpp index e2b82502..7ef25235 100644 --- a/sfall/FalloutEngine.cpp +++ b/sfall/FalloutEngine.cpp @@ -361,6 +361,9 @@ const DWORD intface_update_hit_points_ = 0x45EBD8; const DWORD intface_update_items_ = 0x45EFEC; const DWORD intface_update_move_points_ = 0x45EE0C; const DWORD intface_use_item_ = 0x45F5EC; +const DWORD intface_show_ = 0x45EA10; +const DWORD intface_hide_ = 0x45E9E0; +const DWORD intface_is_hidden_ = 0x45EA5C; const DWORD invenUnwieldFunc_ = 0x472A64; const DWORD invenWieldFunc_ = 0x472768; const DWORD inven_display_msg_ = 0x472D24; @@ -735,9 +738,7 @@ int __stdcall ScrPtr(int scriptId, TScript** scriptPtr) { // redraws the main game interface windows (useful after changing some data like active hand, etc.) void InterfaceRedraw() { - __asm { - call intface_redraw_ - } + __asm call intface_redraw_ } // pops value type from Data stack (must be followed by InterpretPopLong) @@ -823,4 +824,4 @@ TGameObj* __stdcall InvenLeftHand(TGameObj* critter) { TGameObj* __stdcall InvenRightHand(TGameObj* critter) { __asm mov eax, critter __asm call inven_right_hand_ -} \ No newline at end of file +} diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index 0d073ab9..9c585288 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -529,6 +529,9 @@ extern const DWORD intface_update_hit_points_; extern const DWORD intface_update_items_; extern const DWORD intface_update_move_points_; extern const DWORD intface_use_item_; +extern const DWORD intface_show_; +extern const DWORD intface_hide_; +extern const DWORD intface_is_hidden_; extern const DWORD invenUnwieldFunc_; // (int critter@, int slot@, int a3@) - int result (-1 on error, 0 on success) extern const DWORD invenWieldFunc_; // (int who@, int item@, int a3@, int slot@) - int result (-1 on error, 0 on success) extern const DWORD inven_display_msg_; @@ -864,6 +867,15 @@ void SkillSetTags(int* tags, DWORD num); // redraws the main game interface windows (useful after changing some data like active hand, etc.) void InterfaceRedraw(); +// critter worn item (armor) +TGameObj* __stdcall InvenWorn(TGameObj* critter); + +// item in critter's left hand slot +TGameObj* __stdcall InvenLeftHand(TGameObj* critter); + +// item in critter's right hand slot +TGameObj* __stdcall InvenRightHand(TGameObj* critter); + // pops value type from Data stack (must be followed by InterpretPopLong) DWORD __stdcall InterpretPopShort(TProgram* scriptPtr); @@ -889,12 +901,3 @@ void __declspec() DebugPrintf(const char* fmt, ...); // returns the name of current procedure by program pointer const char* __stdcall FindCurrentProc(TProgram* program); - -// critter worn item (armor) -TGameObj* __stdcall InvenWorn(TGameObj* critter); - -// item in critter's left hand slot -TGameObj* __stdcall InvenLeftHand(TGameObj* critter); - -// item in critter's right hand slot -TGameObj* __stdcall InvenRightHand(TGameObj* critter); \ No newline at end of file diff --git a/sfall/ScriptExtender.cpp b/sfall/ScriptExtender.cpp index b6b9ca70..5556349d 100644 --- a/sfall/ScriptExtender.cpp +++ b/sfall/ScriptExtender.cpp @@ -149,6 +149,9 @@ static void _stdcall PrintOpcodeError(const char* fmt, ...) { } // Handle opcodes +// scriptPtr - pointer to script program (from the engine) +// func - opcode handler +// hasReturn - true if opcode has return value (is expression) static void __stdcall HandleOpcode(TProgram* scriptPtr, void(*func)(), int argNum, bool hasReturn) { assert(argNum < OP_MAX_ARGUMENTS); diff --git a/sfall/ScriptOps/InterfaceOp.hpp b/sfall/ScriptOps/InterfaceOp.hpp index 37751eaf..62f4c6c2 100644 --- a/sfall/ScriptOps/InterfaceOp.hpp +++ b/sfall/ScriptOps/InterfaceOp.hpp @@ -440,3 +440,24 @@ end: retn; } } + +static void sf_intface_redraw() { + InterfaceRedraw(); +} + +static void sf_intface_show() { + __asm call intface_show_ +} + +static void sf_intface_hide() { + __asm call intface_hide_ +} + +static void sf_intface_is_hidden() { + int isHidden; + __asm { + call intface_is_hidden_ + mov isHidden, eax; + } + SetOpReturn(isHidden); +} \ No newline at end of file diff --git a/sfall/ScriptOps/MetaruleOp.hpp b/sfall/ScriptOps/MetaruleOp.hpp index 32214df4..6f419d90 100644 --- a/sfall/ScriptOps/MetaruleOp.hpp +++ b/sfall/ScriptOps/MetaruleOp.hpp @@ -113,6 +113,11 @@ static const SfallMetarule metaruleArray[] = { {"validate_test", sf_test, 2, 5, {DATATYPE_MASK_INT, DATATYPE_MASK_INT | DATATYPE_MASK_FLOAT, DATATYPE_MASK_STR, DATATYPE_NONE}}, {"spatial_radius", sf_spatial_radius, 1, 1, {DATATYPE_MASK_VALID_OBJ}}, {"critter_inven_obj2", sf_critter_inven_obj2, 2, 2, {DATATYPE_MASK_VALID_OBJ, DATATYPE_MASK_INT}}, + {"intface_redraw", sf_intface_redraw, 0, 0, {}}, + {"intface_show", sf_intface_show, 0, 0, {}}, + {"intface_hide", sf_intface_hide, 0, 0, {}}, + {"intface_is_hidden", sf_intface_is_hidden, 0, 0, {}}, + {"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0, {}}, }; static void InitMetaruleTable() { diff --git a/sfall/ScriptOps/MiscOps.hpp b/sfall/ScriptOps/MiscOps.hpp index 3e45d422..dc2aa98f 100644 --- a/sfall/ScriptOps/MiscOps.hpp +++ b/sfall/ScriptOps/MiscOps.hpp @@ -1674,3 +1674,8 @@ end: _RET_VAL_INT(ebp) _OP_END } + + +static void sf_exec_map_update_scripts() { + __asm call scr_exec_map_update_scripts_ +} \ No newline at end of file