Backported "dialog_message" script function

Updated documents for the function.
This commit is contained in:
NovaRain
2022-08-19 09:12:48 +08:00
parent b7fc0fb1d7
commit aea263eddd
6 changed files with 18 additions and 0 deletions
+1
View File
@@ -280,6 +280,7 @@
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define dialog_message(text) sfall_func1("dialog_message", text)
#define dialog_obj sfall_func0("dialog_obj")
#define display_stats sfall_func0("display_stats")
#define draw_image(artFile, frame, x, y, noTrans) sfall_func5("draw_image", artFile, frame, x, y, noTrans)
@@ -668,6 +668,11 @@ sfall_funcX metarule functions
- Redraws inventory list in the inventory/use inventory item on/loot/barter screens
- `invSide` specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument)
----
#### dialog_message
`void sfall_func1("dialog_message", string text)`
- Displays a message in the NPC response window in dialog or barter screen
----
#### get_current_inven_size
`int sfall_func1("get_current_inven_size", object)`
+1
View File
@@ -102,6 +102,7 @@ WRAP_WATCOM_FUNC1(long, FMtext_width, const char*, text)
WRAP_WATCOM_FUNC0(long, get_input)
// Searches for message ID in given message file and places result in result argument
WRAP_WATCOM_FUNC3(const char*, getmsg, const fo::MessageList*, fileAddr, fo::MessageNode*, result, long, messageId)
WRAP_WATCOM_FUNC1(void, gdialogDisplayMsg, const char*, message)
WRAP_WATCOM_FUNC1(void, gmouse_3d_set_mode, long, mode)
WRAP_WATCOM_FUNC1(long, gmouse_set_cursor, long, picNum)
WRAP_WATCOM_FUNC1(long, gsound_background_volume_get_set, long, setVolume)
@@ -385,6 +385,14 @@ void mf_inventory_redraw(OpcodeContext& ctx) {
}
}
void mf_dialog_message(OpcodeContext& ctx) {
DWORD loopFlag = GetLoopFlags();
if ((loopFlag & DIALOGVIEW) == 0 && (loopFlag & DIALOG)) {
const char* message = ctx.arg(0).strValue();
fo::func::gdialogDisplayMsg(message);
}
}
void mf_create_win(OpcodeContext& ctx) {
int flags = (ctx.numArgs() > 5)
? ctx.arg(5).rawValue()
@@ -97,6 +97,8 @@ void mf_set_iface_tag_text(OpcodeContext&);
void mf_inventory_redraw(OpcodeContext&);
void mf_dialog_message(OpcodeContext&);
void mf_create_win(OpcodeContext&);
void mf_show_window(OpcodeContext&);
@@ -75,6 +75,7 @@ static const SfallMetarule metarules[] = {
{"combat_data", mf_combat_data, 0, 0},
{"create_win", mf_create_win, 5, 6, -1, {ARG_STRING, ARG_INT, ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{"critter_inven_obj2", mf_critter_inven_obj2, 2, 2, 0, {ARG_OBJECT, ARG_INT}},
{"dialog_message", mf_dialog_message, 1, 1, -1, {ARG_STRING}},
{"dialog_obj", mf_get_dialog_object, 0, 0},
{"display_stats", mf_display_stats, 0, 0}, // refresh
{"draw_image", mf_draw_image, 1, 5, -1, {ARG_INTSTR, ARG_INT, ARG_INT, ARG_INT, ARG_INT}},