From: Rudolf Polzer Date: Fri, 30 Apr 2010 09:35:38 +0000 (+0200) Subject: first beginning of "messagebox" like function, does not compile yet X-Git-Tag: xonotic-v0.1.0preview~612^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5dbaf6bd72ff419c2dde2c68ec13e53fe6ca331d;p=xonotic%2Fxonotic-data.pk3dir.git first beginning of "messagebox" like function, does not compile yet --- diff --git a/qcsrc/menu/cmd_dialog.qc b/qcsrc/menu/cmd_dialog.qc new file mode 100644 index 000000000..3fe6ffcdf --- /dev/null +++ b/qcsrc/menu/cmd_dialog.qc @@ -0,0 +1,27 @@ +void showCommandLineDialog(float arg_min, float arg_count) +{ + string t; + string prefix; + float flags; + t = argv(arg_min); + prefix = argv(arg_min+1); + flags = stof(argv(arg_min+2)); + if(!(flags & 1)) + { + if(cmd_dialog_active) + return; + } + cmd_dialog_prefix = prefix; + cmd_dialog_flags = flags; + if(t == "MessageBox") + { + if(cmd_dialog_title) strunzone(cmd_dialog_title); cmd_dialog_title = strzone(argv(arg_min+3)); + if(cmd_dialog_message) strunzone(cmd_dialog_message); cmd_dialog_message = strzone(argv(arg_min+4)); + if(cmd_dialog_button1) strunzone(cmd_dialog_button1); cmd_dialog_button1 = strzone(argv(arg_min+5)); + if(cmd_dialog_button2) strunzone(cmd_dialog_button2); cmd_dialog_button2 = strzone(argv(arg_min+6)); + if(cmd_dialog_button3) strunzone(cmd_dialog_button3); cmd_dialog_button3 = strzone(argv(arg_min+7)); + cmd_dialog_active = 1; + cmd_dialog_messagebox.update(cmd_dialog_messagebox); + m_goto("cmd_dialog_messagebox"); + } +} diff --git a/qcsrc/menu/cmd_dialog.qh b/qcsrc/menu/cmd_dialog.qh new file mode 100644 index 000000000..eea83d474 --- /dev/null +++ b/qcsrc/menu/cmd_dialog.qh @@ -0,0 +1,12 @@ +#define DLG_REPLACE 1 +void showCommandLineDialog(float arg_min, float arg_count); +string cmd_dialog_prefix; +// on closing dialog: +// if the dialog has an input entry field, cvar_string(cmd_dialog_prefix) will be the entered value +// also, cmd_dialog_prefix_$buttonnumber is called when the dialog is closed (i.e. with 1, 2, 3 for the buttons, or 0 for the close button) +float cmd_dialog_flags; +string cmd_dialog_title; +string cmd_dialog_message; +string cmd_dialog_button1; +string cmd_dialog_button2; +string cmd_dialog_button3; diff --git a/qcsrc/menu/gamecommand.qc b/qcsrc/menu/gamecommand.qc index 84c98e0da..6e2401166 100644 --- a/qcsrc/menu/gamecommand.qc +++ b/qcsrc/menu/gamecommand.qc @@ -87,6 +87,13 @@ void GameCommand(string theCommand) return; } + if(argv(0) == "dialog") + { + if(!isdemo()) // don't allow this command in demos + showCommandLineDialog(1, argc-1); + return; + } + #if 0 if(argv(0) == "tokentest") {