diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h index 73830192..4a24582b 100644 --- a/artifacts/scripting/headers/sfall.h +++ b/artifacts/scripting/headers/sfall.h @@ -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) diff --git a/artifacts/scripting/sfall function notes.md b/artifacts/scripting/sfall function notes.md index 759e987e..5dc0e431 100644 --- a/artifacts/scripting/sfall function notes.md +++ b/artifacts/scripting/sfall function notes.md @@ -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)` diff --git a/sfall/FalloutEngine/Functions_def.h b/sfall/FalloutEngine/Functions_def.h index 0615429c..7669ea32 100644 --- a/sfall/FalloutEngine/Functions_def.h +++ b/sfall/FalloutEngine/Functions_def.h @@ -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) diff --git a/sfall/Modules/Scripting/Handlers/Interface.cpp b/sfall/Modules/Scripting/Handlers/Interface.cpp index 0fef9c18..3c942eab 100644 --- a/sfall/Modules/Scripting/Handlers/Interface.cpp +++ b/sfall/Modules/Scripting/Handlers/Interface.cpp @@ -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() diff --git a/sfall/Modules/Scripting/Handlers/Interface.h b/sfall/Modules/Scripting/Handlers/Interface.h index 54d87633..a3851c36 100644 --- a/sfall/Modules/Scripting/Handlers/Interface.h +++ b/sfall/Modules/Scripting/Handlers/Interface.h @@ -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&); diff --git a/sfall/Modules/Scripting/Handlers/Metarule.cpp b/sfall/Modules/Scripting/Handlers/Metarule.cpp index dbd1592e..28b8eab9 100644 --- a/sfall/Modules/Scripting/Handlers/Metarule.cpp +++ b/sfall/Modules/Scripting/Handlers/Metarule.cpp @@ -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}},