Skip to content

Commit

Permalink
Backported "dialog_message" script function
Browse files Browse the repository at this point in the history
Updated documents for the function.
  • Loading branch information
NovaRain committed Aug 19, 2022
1 parent b7fc0fb commit aea263e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions artifacts/scripting/headers/sfall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions artifacts/scripting/sfall function notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down
1 change: 1 addition & 0 deletions sfall/FalloutEngine/Functions_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions sfall/Modules/Scripting/Handlers/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions sfall/Modules/Scripting/Handlers/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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&);
Expand Down
1 change: 1 addition & 0 deletions sfall/Modules/Scripting/Handlers/Metarule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand Down

0 comments on commit aea263e

Please sign in to comment.