mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added new scripting functions to show/hide/redraw main interface and to exec map_update_p_proc for all map objects #51
This commit is contained in:
@@ -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_
|
||||
}
|
||||
}
|
||||
|
||||
+12
-9
@@ -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@<eax>, int slot@<edx>, int a3@<ebx>) - int result (-1 on error, 0 on success)
|
||||
extern const DWORD invenWieldFunc_; // (int who@<eax>, int item@<edx>, int a3@<ecx>, int slot@<ebx>) - 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);
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -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_
|
||||
}
|
||||
Reference in New Issue
Block a user