]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
first beginning of "messagebox" like function, does not compile yet
authorRudolf Polzer <divverent@alientrap.org>
Fri, 30 Apr 2010 09:35:38 +0000 (11:35 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 30 Apr 2010 09:35:38 +0000 (11:35 +0200)
qcsrc/menu/cmd_dialog.qc [new file with mode: 0644]
qcsrc/menu/cmd_dialog.qh [new file with mode: 0644]
qcsrc/menu/gamecommand.qc

diff --git a/qcsrc/menu/cmd_dialog.qc b/qcsrc/menu/cmd_dialog.qc
new file mode 100644 (file)
index 0000000..3fe6ffc
--- /dev/null
@@ -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 (file)
index 0000000..eea83d4
--- /dev/null
@@ -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;
index 84c98e0da2db4f2f8fb76e1cc3b5b374214072bc..6e2401166ccba5e1a5eb271c70dc4a2acd605851 100644 (file)
@@ -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")
        {