#define QM_TAG_TITLE "T"
#define QM_TAG_SUBMENU "S"
#define QM_TAG_COMMAND "C"
+#define QM_TAG_KCOMMAND "K"
#define QM_TAG_PLCOMMAND "P"
+// QuickMenu_Page_Command_Type
+#define QM_PCT_NONE 0
+#define QM_PCT_TOGGLE 1
+#define QM_PCT_KEEP 2
+
#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
++QuickMenu_Buffer_Size;
QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
}
+ else if(argc == 3 && argv(2) == "KEEP_OPEN")
+ {
+ if(argv(1) == "")
+ continue;
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_KCOMMAND, argv(1));
+ }
else if(argc == 3)
{
// check for special keywords
cmd = QuickMenu_Buffer_Get();
string command_code = substring(cmd, 0, 1);
if(command_code == QM_TAG_COMMAND)
+ {
cmd = substring(cmd, 1, -1);
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = QM_PCT_NONE;
+ }
+ else if(command_code == QM_TAG_KCOMMAND)
+ {
+ cmd = substring(cmd, 1, -1);
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = QM_PCT_KEEP;
+ }
else if(command_code == QM_TAG_PLCOMMAND)
{
// throw away the current quickmenu buffer and load a new one
}
tokenize_console(cmd);
- QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+ if(argv(1) && argv(0) == "toggle")
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = QM_PCT_TOGGLE;
QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
}
QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
QuickMenu_TimeOut_Set();
- return true;
+ if(QuickMenu_Page_Command_Type[num] == QM_PCT_TOGGLE || QuickMenu_Page_Command_Type[num] == QM_PCT_KEEP)
+ return false;
+ else
+ return true;
}
if (QuickMenu_Page_Description[num] != "")
QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
{
bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
- // toggle commands don't close the quickmenu
- if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
- QuickMenu_Page_ActivatedEntry_Close = false;
- else
- QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
+ QuickMenu_Page_ActivatedEntry_Close = (hudShiftState & S_CTRL) ? !f : f;
}
else
QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
color = "^6"; // special command
else
color = "^3";
- if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
+ if(QuickMenu_Page_Command_Type[i] == QM_PCT_TOGGLE) // toggle command
{
int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
if(end < 0)