• R/O
  • SSH

zandronum-zdoom-sync: Commit


Commit MetaInfo

Revisionbd094d66ebfd387c9514c83a84fdd63c933c69ba (tree)
Time2018-01-08 06:48:04
AuthorBenjamin Berkels <torr.samaho@quan...>
CommiterBenjamin Berkels

Log Message

Merged with main repository.

Change Summary

Incremental Difference

diff -r 402d470e1341 -r bd094d66ebfd src/c_dispatch.cpp
--- a/src/c_dispatch.cpp Sun Jan 07 22:42:31 2018 +0100
+++ b/src/c_dispatch.cpp Sun Jan 07 22:48:04 2018 +0100
@@ -137,7 +137,7 @@
137137 Button_ShowMedals; // [BC] Added the "show medals" button.
138138
139139
140-bool ParsingKeyConf;
140+bool ParsingKeyConf, ParsingMenuDef = false;
141141
142142 // To add new actions, go to the console and type "key <action name>".
143143 // This will give you the key value to use in the first column. Then
@@ -199,6 +199,49 @@
199199 "clearplayerclasses"
200200 };
201201
202+static const char *MenuDefCommands[] =
203+{
204+ "snd_reset",
205+ "reset2defaults",
206+ "reset2saved",
207+ "menuconsole",
208+ "clearnodecache",
209+ "am_restorecolors",
210+ "undocolorpic",
211+ "special",
212+ "puke",
213+ "fpuke",
214+ "pukename",
215+ //"event", // [SP] these won't be useful until zscript
216+ //"netevent",
217+ "openmenu",
218+
219+ // begin zandronum specific commands
220+ "menu_spectate",
221+ "menu_changeteam",
222+ "menu_disconnect",
223+ "menu_startskirmish",
224+ "querymaster",
225+ "menu_join_selected_server",
226+ "menu_callkickvote",
227+ "menu_callmapvote",
228+ "menu_calllimitvote",
229+ "menu_ignore",
230+ "menu_joingame",
231+ "menu_help",
232+ "menu_autoselect",
233+ "menu_joingame",
234+ "menu_joingamewithclass",
235+ "menu_login",
236+ "rcon",
237+ "menu_rconlogin",
238+ "spectate",
239+ "join",
240+ "team",
241+ "changeteam",
242+ "callvote",
243+};
244+
202245 // CODE --------------------------------------------------------------------
203246
204247 IMPLEMENT_CLASS(DWaitingCommand, false, false)
@@ -597,6 +640,25 @@
597640 }
598641 }
599642
643+ if (ParsingMenuDef)
644+ {
645+ int i;
646+
647+ for (i = countof(MenuDefCommands)-1; i >= 0; --i)
648+ {
649+ if (strnicmp (beg, MenuDefCommands[i], len) == 0 &&
650+ MenuDefCommands[i][len] == 0)
651+ {
652+ break;
653+ }
654+ }
655+ if (i < 0)
656+ {
657+ Printf ("Invalid command for MENUDEF: %s\n", beg);
658+ return;
659+ }
660+ }
661+
600662 // Check if this is an action
601663 if (*beg == '+' || *beg == '-')
602664 {
diff -r 402d470e1341 -r bd094d66ebfd src/menu/optionmenuitems.h
--- a/src/menu/optionmenuitems.h Sun Jan 07 22:42:31 2018 +0100
+++ b/src/menu/optionmenuitems.h Sun Jan 07 22:48:04 2018 +0100
@@ -37,6 +37,7 @@
3737
3838 void M_DrawConText (int color, int x, int y, const char *str);
3939 void M_SetVideoMode();
40+extern bool ParsingMenuDef; // needed to stop some skulldruggery
4041
4142
4243
@@ -88,7 +89,9 @@
8889 bool Activate()
8990 {
9091 S_Sound (CHAN_VOICE | CHAN_UI, "menu/choose", snd_menuvolume, ATTN_NONE);
92+ ParsingMenuDef = true;
9193 C_DoCommand(mAction);
94+ ParsingMenuDef = false;
9295 return true;
9396 }
9497
@@ -117,7 +120,9 @@
117120 {
118121 if (mkey == MKEY_MBYes)
119122 {
123+ ParsingMenuDef = true;
120124 C_DoCommand(mAction);
125+ ParsingMenuDef = false;
121126 return true;
122127 }
123128 return FOptionMenuItemCommand::MenuEvent(mkey, fromcontroller);
Show on old repository browser