static int NehGameType;
enum m_state_e m_state;
-char m_return_reason[128];
void M_Menu_Main_f(cmd_state_t *cmd);
void M_Menu_SinglePlayer_f(cmd_state_t *cmd);
static qbool m_entersound; ///< play after drawing a frame, so caching won't disrupt the sound
-void M_Update_Return_Reason(const char *s)
-{
- strlcpy(m_return_reason, s, sizeof(m_return_reason));
- if (s)
- Con_DPrintf("%s\n", s);
-}
-
#define StartingGame (m_multiplayer_cursor == 1)
#define JoiningGame (m_multiplayer_cursor == 0)
lanConfig_port = 26000;
dpsnprintf(lanConfig_portname, sizeof(lanConfig_portname), "%u", (unsigned int) lanConfig_port);
- M_Update_Return_Reason("");
+ cl_connect_status[0] = '\0';
}
if (lanConfig_cursor == 3)
M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [lanConfig_cursor], 10+((int)(host.realtime*4)&1));
- if (*m_return_reason)
- M_Print(basex, 168, m_return_reason);
+ if (*cl_connect_status)
+ M_Print(basex, 168, cl_connect_status);
}
/* SLIST MENU */
static unsigned slist_cursor;
+static unsigned slist_visible;
void M_Menu_ServerList_f(cmd_state_t *cmd)
{
m_state = m_slist;
m_entersound = true;
slist_cursor = 0;
- M_Update_Return_Reason("");
+ cl_connect_status[0] = '\0';
if (lanConfig_cursor == 2)
Net_SlistQW_f(cmd);
else
static void M_ServerList_Draw (void)
{
- unsigned n, y, visible, start, end, statnumplayers, statmaxplayers;
+ unsigned n, y, start, end, statnumplayers, statmaxplayers;
cachepic_t *p;
const char *s;
char vabuf[1024];
ServerList_GetPlayerStatistics(&statnumplayers, &statmaxplayers);
s = va(vabuf, sizeof(vabuf), "%u/%u masters %u/%u servers %u/%u players", masterreplycount, masterquerycount, serverreplycount, serverquerycount, statnumplayers, statmaxplayers);
M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
- if (*m_return_reason)
- M_Print(16, menu_height - 8, m_return_reason);
+ if (*cl_connect_status)
+ M_Print(16, menu_height - 8, cl_connect_status);
y = 48;
- visible = (menu_height - 16 - y) / 8 / 2;
- start = min(slist_cursor - min(slist_cursor, visible >> 1), serverlist_viewcount - min(serverlist_viewcount, visible));
- end = min(start + visible, serverlist_viewcount);
+ slist_visible = (menu_height - 16 - y) / 8 / 2;
+ start = min(slist_cursor - min(slist_cursor, slist_visible >> 1), serverlist_viewcount - min(serverlist_viewcount, slist_visible));
+ end = min(start + slist_visible, serverlist_viewcount);
p = Draw_CachePic ("gfx/p_multi");
M_DrawPic((640 - Draw_GetPicWidth(p)) / 2, 4, "gfx/p_multi");
Net_Slist_f(cmd);
break;
+ case K_PGUP:
+ slist_cursor -= slist_visible - 2;
case K_UPARROW:
case K_LEFTARROW:
S_LocalSound ("sound/misc/menu1.wav");
slist_cursor = serverlist_viewcount - 1;
break;
+ case K_PGDN:
+ slist_cursor += slist_visible - 2;
case K_DOWNARROW:
case K_RIGHTARROW:
S_LocalSound ("sound/misc/menu1.wav");
slist_cursor = 0;
break;
+ case K_HOME:
+ S_LocalSound ("sound/misc/menu1.wav");
+ slist_cursor = 0;
+ break;
+
+ case K_END:
+ S_LocalSound ("sound/misc/menu1.wav");
+ slist_cursor = serverlist_viewcount - 1;
+ break;
+
case K_ENTER:
S_LocalSound ("sound/misc/menu2.wav");
if (serverlist_viewcount)
m_state = m_modlist;
m_entersound = true;
modlist_cursor = 0;
- M_Update_Return_Reason("");
+ cl_connect_status[0] = '\0';
ModList_RebuildList();
}
for (y = 0; y < modlist_numenabled; y++)
M_PrintRed(432, 48 + y * 8, modlist[modlist_enabled[y]].dir);
- if (*m_return_reason)
- M_Print(16, menu_height - 8, m_return_reason);
+ if (*cl_connect_status)
+ M_Print(16, menu_height - 8, cl_connect_status);
// scroll the list as the cursor moves
y = 48;
visible = (int)((menu_height - 16 - y) / 8 / 2);