if(mode == "file")
{
if(file == "" || file == "0")
- LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+ LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu");
else
{
fh = fopen(file, FILE_READ);
if(fh < 0)
- LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", file);
+ LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu", file);
}
if(fh < 0)
mode = "default";
QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
QuickMenu_skip_submenu(substring(s, 1, -1));
}
- else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
+ else if(substring(s, 0, 1) == QM_TAG_TITLE)
{
++QuickMenu_Buffer_Index;
- cmd = QuickMenu_Buffer_Get();
- string command_code = substring(cmd, 0, 1);
- if(command_code == QM_TAG_COMMAND)
- cmd = substring(cmd, 1, -1);
- else if(command_code == QM_TAG_PLCOMMAND)
+ if(entry_num >= first_entry)
{
- // throw away the current quickmenu buffer and load a new one
- cmd = substring(cmd, 1, -1);
- strunzone(z_submenu);
- if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
- return QuickMenu_Page_Load("", 0);
- QuickMenu_Close();
- return false;
- }
+ cmd = QuickMenu_Buffer_Get();
+ string command_code = substring(cmd, 0, 1);
+ if(command_code == QM_TAG_COMMAND)
+ cmd = substring(cmd, 1, -1);
+ else if(command_code == QM_TAG_PLCOMMAND)
+ {
+ // throw away the current quickmenu buffer and load a new one
+ cmd = substring(cmd, 1, -1);
+ strunzone(z_submenu);
+ if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
+ return QuickMenu_Page_Load("", 0);
+ QuickMenu_Close();
+ return false;
+ }
+
+ tokenize_console(cmd);
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
- tokenize_console(cmd);
- QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
+ }
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
}
++entry_num;
if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
{
- float entry_num;
- entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+ int entry_num = min(QuickMenu_Page_Entries - 1, floor((mousepos.y - first_entry_pos) / fontsize.y));
if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
{
+ // recycling panel_pos as entry_pos
panel_pos.y = first_entry_pos + entry_num * fontsize.y;
vector color;
if(mouseClicked & S_MOUSE1)