spingle/source/menu.c

2781 lines
56 KiB
C
Raw Normal View History

2019-11-24 20:45:15 -08:00
/*
Copyright (C) 1996-2001 Id Software, Inc.
Copyright (C) 2002-2009 John Fitzgibbons and others
Copyright (C) 2010-2014 QuakeSpasm developers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
2019-12-02 07:07:37 -08:00
#include "q_defs.h"
2019-11-24 20:45:15 -08:00
#include "bgmusic.h"
void (*vid_menucmdfn)(void); //johnfitz
void (*vid_menudrawfn)(void);
2019-11-25 16:49:58 -08:00
void (*vid_menukeyfn)(int32_t key);
2019-11-24 20:45:15 -08:00
enum m_state_e m_state;
2019-11-25 17:40:18 -08:00
void M_Menu_Main_f(void);
void M_Menu_SinglePlayer_f(void);
void M_Menu_Load_f(void);
void M_Menu_Save_f(void);
void M_Menu_MultiPlayer_f(void);
void M_Menu_Setup_f(void);
void M_Menu_Net_f(void);
void M_Menu_LanConfig_f(void);
void M_Menu_GameOptions_f(void);
void M_Menu_Search_f(void);
void M_Menu_ServerList_f(void);
void M_Menu_Options_f(void);
void M_Menu_Keys_f(void);
void M_Menu_Video_f(void);
void M_Menu_Help_f(void);
void M_Menu_Quit_f(void);
void M_Main_Draw(void);
void M_SinglePlayer_Draw(void);
void M_Load_Draw(void);
void M_Save_Draw(void);
void M_MultiPlayer_Draw(void);
void M_Setup_Draw(void);
void M_Net_Draw(void);
void M_LanConfig_Draw(void);
void M_GameOptions_Draw(void);
void M_Search_Draw(void);
void M_ServerList_Draw(void);
void M_Options_Draw(void);
void M_Keys_Draw(void);
void M_Video_Draw(void);
void M_Help_Draw(void);
void M_Quit_Draw(void);
void M_Main_Key(int32_t key);
void M_SinglePlayer_Key(int32_t key);
void M_Load_Key(int32_t key);
void M_Save_Key(int32_t key);
void M_MultiPlayer_Key(int32_t key);
void M_Setup_Key(int32_t key);
void M_Net_Key(int32_t key);
void M_LanConfig_Key(int32_t key);
void M_GameOptions_Key(int32_t key);
void M_Search_Key(int32_t key);
void M_ServerList_Key(int32_t key);
void M_Options_Key(int32_t key);
void M_Keys_Key(int32_t key);
void M_Video_Key(int32_t key);
void M_Help_Key(int32_t key);
void M_Quit_Key(int32_t key);
bool m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
bool m_recursiveDraw;
enum m_state_e m_return_state;
bool m_return_onerror;
char m_return_reason [32];
#define StartingGame (m_multiplayer_cursor == 1)
#define JoiningGame (m_multiplayer_cursor == 0)
#define IPXConfig (m_net_cursor == 0)
#define TCPIPConfig (m_net_cursor == 1)
2019-11-24 20:45:15 -08:00
void M_ConfigureNetSubsystem(void);
/*
================
M_DrawCharacter
Draws one solid graphics character
================
*/
2019-11-25 17:40:18 -08:00
void M_DrawCharacter(int32_t cx, int32_t line, int32_t num)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Draw_Character(cx, line, num);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Print(int32_t cx, int32_t cy, const char *str)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
while(*str)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_DrawCharacter(cx, cy, (*str) + 128);
2019-11-24 20:45:15 -08:00
str++;
cx += 8;
}
}
2019-11-25 17:40:18 -08:00
void M_PrintWhite(int32_t cx, int32_t cy, const char *str)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
while(*str)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_DrawCharacter(cx, cy, *str);
2019-11-24 20:45:15 -08:00
str++;
cx += 8;
}
}
2019-11-25 17:40:18 -08:00
void M_DrawTransPic(int32_t x, int32_t y, qpic_t *pic)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Draw_Pic(x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_DrawPic(int32_t x, int32_t y, qpic_t *pic)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Draw_Pic(x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_DrawTransPicTranslate(int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom) //johnfitz -- more parameters
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Draw_TransPicTranslate(x, y, pic, top, bottom); //johnfitz -- simplified becuase centering is handled elsewhere
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_DrawTextBox(int32_t x, int32_t y, int32_t width, int32_t lines)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
qpic_t *p;
int32_t cx, cy;
int32_t n;
2019-11-24 20:45:15 -08:00
// draw left side
cx = x;
cy = y;
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_tl.lmp");
M_DrawTransPic(cx, cy, p);
p = Draw_CachePic("gfx/box_ml.lmp");
for(n = 0; n < lines; n++)
2019-11-24 20:45:15 -08:00
{
cy += 8;
2019-11-25 17:40:18 -08:00
M_DrawTransPic(cx, cy, p);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_bl.lmp");
M_DrawTransPic(cx, cy + 8, p);
2019-11-24 20:45:15 -08:00
// draw middle
cx += 8;
2019-11-25 17:40:18 -08:00
while(width > 0)
2019-11-24 20:45:15 -08:00
{
cy = y;
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_tm.lmp");
M_DrawTransPic(cx, cy, p);
p = Draw_CachePic("gfx/box_mm.lmp");
for(n = 0; n < lines; n++)
2019-11-24 20:45:15 -08:00
{
cy += 8;
2019-11-25 17:40:18 -08:00
if(n == 1)
p = Draw_CachePic("gfx/box_mm2.lmp");
M_DrawTransPic(cx, cy, p);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_bm.lmp");
M_DrawTransPic(cx, cy + 8, p);
2019-11-24 20:45:15 -08:00
width -= 2;
cx += 16;
}
// draw right side
cy = y;
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_tr.lmp");
M_DrawTransPic(cx, cy, p);
p = Draw_CachePic("gfx/box_mr.lmp");
for(n = 0; n < lines; n++)
2019-11-24 20:45:15 -08:00
{
cy += 8;
2019-11-25 17:40:18 -08:00
M_DrawTransPic(cx, cy, p);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/box_br.lmp");
M_DrawTransPic(cx, cy + 8, p);
2019-11-24 20:45:15 -08:00
}
//=============================================================================
2019-11-25 16:49:58 -08:00
int32_t m_save_demonum;
2019-11-24 20:45:15 -08:00
/*
================
M_ToggleMenu_f
================
*/
2019-11-25 17:40:18 -08:00
void M_ToggleMenu_f(void)
2019-11-24 20:45:15 -08:00
{
m_entersound = true;
2019-11-25 17:40:18 -08:00
if(key_dest == key_menu)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(m_state != m_main)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
return;
}
IN_Activate();
key_dest = key_game;
m_state = m_none;
return;
}
2019-11-25 17:40:18 -08:00
if(key_dest == key_console)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Con_ToggleConsole_f();
2019-11-24 20:45:15 -08:00
}
else
{
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
}
}
//=============================================================================
/* MAIN MENU */
2019-11-25 17:40:18 -08:00
int32_t m_main_cursor;
#define MAIN_ITEMS 5
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Main_f(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(key_dest != key_menu)
2019-11-24 20:45:15 -08:00
{
m_save_demonum = cls.demonum;
cls.demonum = -1;
}
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_main;
m_entersound = true;
}
2019-11-25 17:40:18 -08:00
void M_Main_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t f;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/ttl_main.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
M_DrawTransPic(72, 32, Draw_CachePic("gfx/mainmenu.lmp"));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
f = (int32_t)(realtime * 10) % 6;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(54, 32 + m_main_cursor * 20, Draw_CachePic(va("gfx/menudot%" PRIi32 ".lmp", f + 1)));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Main_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
IN_Activate();
key_dest = key_game;
m_state = m_none;
cls.demonum = m_save_demonum;
2019-11-25 17:40:18 -08:00
if(cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
CL_NextDemo();
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(++m_main_cursor >= MAIN_ITEMS)
2019-11-24 20:45:15 -08:00
m_main_cursor = 0;
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(--m_main_cursor < 0)
2019-11-24 20:45:15 -08:00
m_main_cursor = MAIN_ITEMS - 1;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_entersound = true;
2019-11-25 17:40:18 -08:00
switch(m_main_cursor)
2019-11-24 20:45:15 -08:00
{
case 0:
2019-11-25 17:40:18 -08:00
M_Menu_SinglePlayer_f();
2019-11-24 20:45:15 -08:00
break;
case 1:
2019-11-25 17:40:18 -08:00
M_Menu_MultiPlayer_f();
2019-11-24 20:45:15 -08:00
break;
case 2:
2019-11-25 17:40:18 -08:00
M_Menu_Options_f();
2019-11-24 20:45:15 -08:00
break;
case 3:
2019-11-25 17:40:18 -08:00
M_Menu_Help_f();
2019-11-24 20:45:15 -08:00
break;
case 4:
2019-11-25 17:40:18 -08:00
M_Menu_Quit_f();
2019-11-24 20:45:15 -08:00
break;
}
}
}
//=============================================================================
/* SINGLE PLAYER MENU */
2019-11-25 17:40:18 -08:00
int32_t m_singleplayer_cursor;
#define SINGLEPLAYER_ITEMS 3
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_SinglePlayer_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_singleplayer;
m_entersound = true;
}
2019-11-25 17:40:18 -08:00
void M_SinglePlayer_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t f;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/ttl_sgl.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
M_DrawTransPic(72, 32, Draw_CachePic("gfx/sp_menu.lmp"));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
f = (int32_t)(realtime * 10) % 6;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(54, 32 + m_singleplayer_cursor * 20, Draw_CachePic(va("gfx/menudot%" PRIi32 ".lmp", f + 1)));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_SinglePlayer_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
2019-11-24 20:45:15 -08:00
m_singleplayer_cursor = 0;
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(--m_singleplayer_cursor < 0)
2019-11-24 20:45:15 -08:00
m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_entersound = true;
2019-11-25 17:40:18 -08:00
switch(m_singleplayer_cursor)
2019-11-24 20:45:15 -08:00
{
case 0:
2019-11-25 17:40:18 -08:00
if(sv.active)
if(!SCR_ModalMessage("Are you sure you want to\nstart a new game?\n", 0.0f))
2019-11-24 20:45:15 -08:00
break;
IN_Activate();
key_dest = key_game;
2019-11-25 17:40:18 -08:00
if(sv.active)
Cbuf_AddText("disconnect\n");
Cbuf_AddText("maxplayers 1\n");
Cbuf_AddText("deathmatch 0\n"); //johnfitz
Cbuf_AddText("coop 0\n"); //johnfitz
Cbuf_AddText("map start\n");
2019-11-24 20:45:15 -08:00
break;
case 1:
2019-11-25 17:40:18 -08:00
M_Menu_Load_f();
2019-11-24 20:45:15 -08:00
break;
case 2:
2019-11-25 17:40:18 -08:00
M_Menu_Save_f();
2019-11-24 20:45:15 -08:00
break;
}
}
}
//=============================================================================
/* LOAD/SAVE MENU */
2019-11-25 17:40:18 -08:00
int32_t load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
#define MAX_SAVEGAMES 20 /* johnfitz -- increased from 12 */
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH + 1];
int32_t loadable[MAX_SAVEGAMES];
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_ScanSaves(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t i, j;
char name[MAX_OSPATH];
FILE *f;
int32_t version;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
for(i = 0; i < MAX_SAVEGAMES; i++)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
strcpy(m_filenames[i], "--- UNUSED SLOT ---");
2019-11-24 20:45:15 -08:00
loadable[i] = false;
2019-11-25 17:40:18 -08:00
q_snprintf(name, sizeof(name), "%s/s%" PRIi32 ".sav", com_gamedir, i);
f = fopen(name, "r");
if(!f)
2019-11-24 20:45:15 -08:00
continue;
2019-11-25 17:40:18 -08:00
fscanf(f, "%" PRIi32 "\n", &version);
fscanf(f, "%79s\n", name);
strncpy(m_filenames[i], name, strsizeof(m_filenames[i]));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
// change _ back to space
for(j = 0; j < SAVEGAME_COMMENT_LENGTH; j++)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(m_filenames[i][j] == '_')
2019-11-24 20:45:15 -08:00
m_filenames[i][j] = ' ';
}
loadable[i] = true;
2019-11-25 17:40:18 -08:00
fclose(f);
2019-11-24 20:45:15 -08:00
}
}
2019-11-25 17:40:18 -08:00
void M_Menu_Load_f(void)
2019-11-24 20:45:15 -08:00
{
m_entersound = true;
m_state = m_load;
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
2019-11-25 17:40:18 -08:00
M_ScanSaves();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Menu_Save_f(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(!sv.active)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
if(cl.intermission)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
if(svs.maxclients != 1)
2019-11-24 20:45:15 -08:00
return;
m_entersound = true;
m_state = m_save;
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
2019-11-25 17:40:18 -08:00
M_ScanSaves();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Load_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t i;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/p_load.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
for(i = 0; i < MAX_SAVEGAMES; i++)
M_Print(16, 32 + 8 * i, m_filenames[i]);
2019-11-24 20:45:15 -08:00
// line cursor
2019-11-25 17:40:18 -08:00
M_DrawCharacter(8, 32 + load_cursor * 8, 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Save_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t i;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/p_save.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
for(i = 0; i < MAX_SAVEGAMES; i++)
M_Print(16, 32 + 8 * i, m_filenames[i]);
2019-11-24 20:45:15 -08:00
// line cursor
2019-11-25 17:40:18 -08:00
M_DrawCharacter(8, 32 + load_cursor * 8, 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Load_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_SinglePlayer_f();
2019-11-24 20:45:15 -08:00
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu2.wav");
if(!loadable[load_cursor])
2019-11-24 20:45:15 -08:00
return;
m_state = m_none;
IN_Activate();
key_dest = key_game;
2019-11-25 17:40:18 -08:00
// Host_Loadgame_f can't bring up the loading plaque because too much
// stack space has been used, so do it now
SCR_BeginLoadingPlaque();
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
// issue the load command
Cbuf_AddText(va("load s%" PRIi32 "\n", load_cursor));
2019-11-24 20:45:15 -08:00
return;
case K_UPARROW:
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
load_cursor--;
2019-11-25 17:40:18 -08:00
if(load_cursor < 0)
load_cursor = MAX_SAVEGAMES - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
load_cursor++;
2019-11-25 17:40:18 -08:00
if(load_cursor >= MAX_SAVEGAMES)
2019-11-24 20:45:15 -08:00
load_cursor = 0;
break;
}
}
2019-11-25 17:40:18 -08:00
void M_Save_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_SinglePlayer_f();
2019-11-24 20:45:15 -08:00
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_state = m_none;
IN_Activate();
key_dest = key_game;
2019-11-25 17:40:18 -08:00
Cbuf_AddText(va("save s%" PRIi32 "\n", load_cursor));
2019-11-24 20:45:15 -08:00
return;
case K_UPARROW:
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
load_cursor--;
2019-11-25 17:40:18 -08:00
if(load_cursor < 0)
load_cursor = MAX_SAVEGAMES - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
load_cursor++;
2019-11-25 17:40:18 -08:00
if(load_cursor >= MAX_SAVEGAMES)
2019-11-24 20:45:15 -08:00
load_cursor = 0;
break;
}
}
//=============================================================================
/* MULTIPLAYER MENU */
2019-11-25 17:40:18 -08:00
int32_t m_multiplayer_cursor;
#define MULTIPLAYER_ITEMS 3
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_MultiPlayer_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_multiplayer;
m_entersound = true;
}
2019-11-25 17:40:18 -08:00
void M_MultiPlayer_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t f;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
M_DrawTransPic(72, 32, Draw_CachePic("gfx/mp_menu.lmp"));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
f = (int32_t)(realtime * 10) % 6;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(54, 32 + m_multiplayer_cursor * 20, Draw_CachePic(va("gfx/menudot%" PRIi32 ".lmp", f + 1)));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(ipxAvailable || tcpipAvailable)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
M_PrintWhite((320 / 2) - ((27 * 8) / 2), 148, "No Communications Available");
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_MultiPlayer_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
2019-11-24 20:45:15 -08:00
m_multiplayer_cursor = 0;
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(--m_multiplayer_cursor < 0)
2019-11-24 20:45:15 -08:00
m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_entersound = true;
2019-11-25 17:40:18 -08:00
switch(m_multiplayer_cursor)
2019-11-24 20:45:15 -08:00
{
case 0:
2019-11-25 17:40:18 -08:00
if(ipxAvailable || tcpipAvailable)
M_Menu_Net_f();
2019-11-24 20:45:15 -08:00
break;
case 1:
2019-11-25 17:40:18 -08:00
if(ipxAvailable || tcpipAvailable)
M_Menu_Net_f();
2019-11-24 20:45:15 -08:00
break;
case 2:
2019-11-25 17:40:18 -08:00
M_Menu_Setup_f();
2019-11-24 20:45:15 -08:00
break;
}
}
}
//=============================================================================
/* SETUP MENU */
2019-11-25 17:40:18 -08:00
int32_t setup_cursor = 4;
int32_t setup_cursor_table[] = {40, 56, 80, 104, 140};
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
char setup_hostname[16];
char setup_myname[16];
int32_t setup_oldtop;
int32_t setup_oldbottom;
int32_t setup_top;
int32_t setup_bottom;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
#define NUM_SETUP_CMDS 5
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Setup_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_setup;
m_entersound = true;
2019-12-07 09:27:26 -08:00
strcpy(setup_myname, cl_name.string);
strcpy(setup_hostname, hostname.string);
2019-11-25 16:49:58 -08:00
setup_top = setup_oldtop = ((int32_t)cl_color.value) >> 4;
setup_bottom = setup_oldbottom = ((int32_t)cl_color.value) & 15;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Setup_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(64, 40, "Hostname");
M_DrawTextBox(160, 32, 16, 1);
M_Print(168, 40, setup_hostname);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(64, 56, "Your name");
M_DrawTextBox(160, 48, 16, 1);
M_Print(168, 56, setup_myname);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(64, 80, "Shirt color");
M_Print(64, 104, "Pants color");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTextBox(64, 140 - 8, 14, 1);
M_Print(72, 140, "Accept Changes");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/bigbox.lmp");
M_DrawTransPic(160, 64, p);
p = Draw_CachePic("gfx/menuplyr.lmp");
M_DrawTransPicTranslate(172, 72, p, setup_top, setup_bottom);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawCharacter(56, setup_cursor_table [setup_cursor], 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(setup_cursor == 0)
M_DrawCharacter(168 + 8 * strlen(setup_hostname), setup_cursor_table [setup_cursor], 10 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(setup_cursor == 1)
M_DrawCharacter(168 + 8 * strlen(setup_myname), setup_cursor_table [setup_cursor], 10 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Setup_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_MultiPlayer_f();
2019-11-24 20:45:15 -08:00
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
setup_cursor--;
2019-11-25 17:40:18 -08:00
if(setup_cursor < 0)
setup_cursor = NUM_SETUP_CMDS - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
setup_cursor++;
2019-11-25 17:40:18 -08:00
if(setup_cursor >= NUM_SETUP_CMDS)
2019-11-24 20:45:15 -08:00
setup_cursor = 0;
break;
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
if(setup_cursor < 2)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu3.wav");
if(setup_cursor == 2)
2019-11-24 20:45:15 -08:00
setup_top = setup_top - 1;
2019-11-25 17:40:18 -08:00
if(setup_cursor == 3)
2019-11-24 20:45:15 -08:00
setup_bottom = setup_bottom - 1;
break;
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
if(setup_cursor < 2)
2019-11-24 20:45:15 -08:00
return;
forward:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu3.wav");
if(setup_cursor == 2)
2019-11-24 20:45:15 -08:00
setup_top = setup_top + 1;
2019-11-25 17:40:18 -08:00
if(setup_cursor == 3)
2019-11-24 20:45:15 -08:00
setup_bottom = setup_bottom + 1;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
if(setup_cursor == 0 || setup_cursor == 1)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
if(setup_cursor == 2 || setup_cursor == 3)
2019-11-24 20:45:15 -08:00
goto forward;
// setup_cursor == 4 (OK)
2019-12-07 09:27:26 -08:00
if(strcmp(cl_name.string, setup_myname) != 0)
2019-11-25 17:40:18 -08:00
Cbuf_AddText(va("name \"%s\"\n", setup_myname));
2019-12-07 09:27:26 -08:00
if(strcmp(hostname.string, setup_hostname) != 0)
2019-11-24 20:45:15 -08:00
Cvar_Set("hostname", setup_hostname);
2019-11-25 17:40:18 -08:00
if(setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
Cbuf_AddText(va("color %" PRIi32 " %" PRIi32 "\n", setup_top, setup_bottom));
2019-11-24 20:45:15 -08:00
m_entersound = true;
2019-11-25 17:40:18 -08:00
M_Menu_MultiPlayer_f();
2019-11-24 20:45:15 -08:00
break;
case K_BACKSPACE:
2019-11-25 17:40:18 -08:00
if(setup_cursor == 0)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(strlen(setup_hostname))
setup_hostname[strlen(setup_hostname) - 1] = 0;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
if(setup_cursor == 1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(strlen(setup_myname))
setup_myname[strlen(setup_myname) - 1] = 0;
2019-11-24 20:45:15 -08:00
}
break;
}
2019-11-25 17:40:18 -08:00
if(setup_top > 13)
2019-11-24 20:45:15 -08:00
setup_top = 0;
2019-11-25 17:40:18 -08:00
if(setup_top < 0)
2019-11-24 20:45:15 -08:00
setup_top = 13;
2019-11-25 17:40:18 -08:00
if(setup_bottom > 13)
2019-11-24 20:45:15 -08:00
setup_bottom = 0;
2019-11-25 17:40:18 -08:00
if(setup_bottom < 0)
2019-11-24 20:45:15 -08:00
setup_bottom = 13;
}
2019-11-25 17:40:18 -08:00
void M_Setup_Char(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 16:49:58 -08:00
int32_t l;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(setup_cursor)
2019-11-24 20:45:15 -08:00
{
case 0:
l = strlen(setup_hostname);
2019-11-25 17:40:18 -08:00
if(l < 15)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
setup_hostname[l + 1] = 0;
2019-11-24 20:45:15 -08:00
setup_hostname[l] = k;
}
break;
case 1:
l = strlen(setup_myname);
2019-11-25 17:40:18 -08:00
if(l < 15)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
setup_myname[l + 1] = 0;
2019-11-24 20:45:15 -08:00
setup_myname[l] = k;
}
break;
}
}
2019-11-25 17:40:18 -08:00
bool M_Setup_TextEntry(void)
2019-11-24 20:45:15 -08:00
{
return (setup_cursor == 0 || setup_cursor == 1);
}
//=============================================================================
/* NET MENU */
2019-11-25 17:40:18 -08:00
int32_t m_net_cursor;
2019-11-25 16:49:58 -08:00
int32_t m_net_items;
2019-11-24 20:45:15 -08:00
const char *net_helpMessage [] =
{
2019-11-25 17:40:18 -08:00
/* .........1.........2.... */
" Novell network LANs ",
" or Windows 95 DOS-box. ",
" ",
"(LAN=Local Area Network)",
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
" Commonly used to play ",
" over the Internet, but ",
" also used on a Local ",
" Area Network. "
2019-11-24 20:45:15 -08:00
};
2019-11-25 17:40:18 -08:00
void M_Menu_Net_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_net;
m_entersound = true;
m_net_items = 2;
2019-11-25 17:40:18 -08:00
if(m_net_cursor >= m_net_items)
2019-11-24 20:45:15 -08:00
m_net_cursor = 0;
m_net_cursor--;
2019-11-25 17:40:18 -08:00
M_Net_Key(K_DOWNARROW);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Net_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t f;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
f = 32;
2019-11-25 17:40:18 -08:00
if(ipxAvailable)
p = Draw_CachePic("gfx/netmen3.lmp");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/dim_ipx.lmp");
M_DrawTransPic(72, f, p);
2019-11-24 20:45:15 -08:00
f += 19;
2019-11-25 17:40:18 -08:00
if(tcpipAvailable)
p = Draw_CachePic("gfx/netmen4.lmp");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/dim_tcp.lmp");
M_DrawTransPic(72, f, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
f = (320 - 26 * 8) / 2;
M_DrawTextBox(f, 96, 24, 4);
2019-11-24 20:45:15 -08:00
f += 8;
2019-11-25 17:40:18 -08:00
M_Print(f, 104, net_helpMessage[m_net_cursor * 4 + 0]);
M_Print(f, 112, net_helpMessage[m_net_cursor * 4 + 1]);
M_Print(f, 120, net_helpMessage[m_net_cursor * 4 + 2]);
M_Print(f, 128, net_helpMessage[m_net_cursor * 4 + 3]);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
f = (int32_t)(realtime * 10) % 6;
M_DrawTransPic(54, 32 + m_net_cursor * 20, Draw_CachePic(va("gfx/menudot%" PRIi32 ".lmp", f + 1)));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Net_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
again:
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_MultiPlayer_f();
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(++m_net_cursor >= m_net_items)
2019-11-24 20:45:15 -08:00
m_net_cursor = 0;
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
if(--m_net_cursor < 0)
2019-11-24 20:45:15 -08:00
m_net_cursor = m_net_items - 1;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_entersound = true;
2019-11-25 17:40:18 -08:00
M_Menu_LanConfig_f();
2019-11-24 20:45:15 -08:00
break;
}
2019-11-25 17:40:18 -08:00
if(m_net_cursor == 0 && !ipxAvailable)
2019-11-24 20:45:15 -08:00
goto again;
2019-11-25 17:40:18 -08:00
if(m_net_cursor == 1 && !tcpipAvailable)
2019-11-24 20:45:15 -08:00
goto again;
}
//=============================================================================
/* OPTIONS MENU */
enum
{
OPT_CUSTOMIZE = 0,
2019-11-25 17:40:18 -08:00
OPT_CONSOLE, // 1
OPT_DEFAULTS, // 2
2019-11-24 20:45:15 -08:00
OPT_SCALE,
OPT_SCRSIZE,
OPT_GAMMA,
OPT_CONTRAST,
OPT_MOUSESPEED,
OPT_SBALPHA,
OPT_SNDVOL,
OPT_MUSICVOL,
OPT_MUSICEXT,
OPT_ALWAYRUN,
OPT_INVMOUSE,
OPT_ALWAYSMLOOK,
OPT_LOOKSPRING,
OPT_LOOKSTRAFE,
2019-12-02 04:24:20 -08:00
OPT_VIDEO, // This is the last before OPTIONS_ITEMS
2019-11-24 20:45:15 -08:00
OPTIONS_ITEMS
};
enum
{
ALWAYSRUN_OFF = 0,
ALWAYSRUN_VANILLA,
ALWAYSRUN_QUAKESPASM,
ALWAYSRUN_ITEMS
};
2019-11-25 17:40:18 -08:00
#define SLIDER_RANGE 10
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
int32_t options_cursor;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Options_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_options;
m_entersound = true;
}
2019-11-25 17:40:18 -08:00
void M_AdjustSliders(int32_t dir)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t curr_alwaysrun, target_alwaysrun;
float f, l;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu3.wav");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(options_cursor)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
case OPT_SCALE: // console and menu scale
2019-11-24 20:45:15 -08:00
l = ((vid.width + 31) / 32) / 10.0;
f = scr_conscale.value + dir * .1;
2019-11-25 17:40:18 -08:00
if(f < 1) f = 1;
else if(f > l) f = l;
Cvar_SetValue("scr_conscale", f);
Cvar_SetValue("scr_menuscale", f);
Cvar_SetValue("scr_sbarscale", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_SCRSIZE: // screen size
2019-11-24 20:45:15 -08:00
f = scr_viewsize.value + dir * 10;
2019-11-25 17:40:18 -08:00
if(f > 120) f = 120;
else if(f < 30) f = 30;
Cvar_SetValue("viewsize", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_GAMMA: // gamma
2019-11-24 20:45:15 -08:00
f = vid_gamma.value - dir * 0.05;
2019-11-25 17:40:18 -08:00
if(f < 0.5) f = 0.5;
else if(f > 1) f = 1;
Cvar_SetValue("gamma", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_CONTRAST: // contrast
2019-11-24 20:45:15 -08:00
f = vid_contrast.value + dir * 0.1;
2019-11-25 17:40:18 -08:00
if(f < 1) f = 1;
else if(f > 2) f = 2;
Cvar_SetValue("contrast", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_MOUSESPEED: // mouse speed
2019-11-24 20:45:15 -08:00
f = sensitivity.value + dir * 0.5;
2019-11-25 17:40:18 -08:00
if(f > 11) f = 11;
else if(f < 1) f = 1;
Cvar_SetValue("sensitivity", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_SBALPHA: // statusbar alpha
2019-11-24 20:45:15 -08:00
f = scr_sbaralpha.value - dir * 0.05;
2019-11-25 17:40:18 -08:00
if(f < 0) f = 0;
else if(f > 1) f = 1;
Cvar_SetValue("scr_sbaralpha", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_MUSICVOL: // music volume
2019-11-24 20:45:15 -08:00
f = bgmvolume.value + dir * 0.1;
2019-11-25 17:40:18 -08:00
if(f < 0) f = 0;
else if(f > 1) f = 1;
Cvar_SetValue("bgmvolume", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_MUSICEXT: // enable external music vs cdaudio
Cvar_Set("bgm_extmusic", bgm_extmusic.value ? "0" : "1");
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_SNDVOL: // sfx volume
2019-11-24 20:45:15 -08:00
f = sfxvolume.value + dir * 0.1;
2019-11-25 17:40:18 -08:00
if(f < 0) f = 0;
else if(f > 1) f = 1;
Cvar_SetValue("volume", f);
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_ALWAYRUN: // always run
if(cl_alwaysrun.value)
2019-11-24 20:45:15 -08:00
curr_alwaysrun = ALWAYSRUN_QUAKESPASM;
2019-11-25 17:40:18 -08:00
else if(cl_forwardspeed.value > 200)
2019-11-24 20:45:15 -08:00
curr_alwaysrun = ALWAYSRUN_VANILLA;
else
curr_alwaysrun = ALWAYSRUN_OFF;
2019-11-24 22:55:47 -08:00
2019-11-24 20:45:15 -08:00
target_alwaysrun = (ALWAYSRUN_ITEMS + curr_alwaysrun + dir) % ALWAYSRUN_ITEMS;
2019-11-24 22:55:47 -08:00
2019-11-25 17:40:18 -08:00
if(target_alwaysrun == ALWAYSRUN_VANILLA)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Cvar_SetValue("cl_alwaysrun", 0);
Cvar_SetValue("cl_forwardspeed", 400);
Cvar_SetValue("cl_backspeed", 400);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
else if(target_alwaysrun == ALWAYSRUN_QUAKESPASM)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Cvar_SetValue("cl_alwaysrun", 1);
Cvar_SetValue("cl_forwardspeed", 200);
Cvar_SetValue("cl_backspeed", 200);
2019-11-24 20:45:15 -08:00
}
else // ALWAYSRUN_OFF
{
2019-11-25 17:40:18 -08:00
Cvar_SetValue("cl_alwaysrun", 0);
Cvar_SetValue("cl_forwardspeed", 200);
Cvar_SetValue("cl_backspeed", 200);
2019-11-24 20:45:15 -08:00
}
break;
2019-11-25 17:40:18 -08:00
case OPT_INVMOUSE: // invert mouse
Cvar_SetValue("m_pitch", -m_pitch.value);
2019-11-24 20:45:15 -08:00
break;
case OPT_ALWAYSMLOOK:
2019-11-25 17:40:18 -08:00
if(in_mlook.state & 1)
2019-11-24 20:45:15 -08:00
Cbuf_AddText("-mlook");
else
Cbuf_AddText("+mlook");
break;
2019-11-25 17:40:18 -08:00
case OPT_LOOKSPRING: // lookspring
Cvar_Set("lookspring", lookspring.value ? "0" : "1");
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
case OPT_LOOKSTRAFE: // lookstrafe
Cvar_Set("lookstrafe", lookstrafe.value ? "0" : "1");
2019-11-24 20:45:15 -08:00
break;
}
}
2019-11-25 17:40:18 -08:00
void M_DrawSlider(int32_t x, int32_t y, float range)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t i;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(range < 0)
2019-11-24 20:45:15 -08:00
range = 0;
2019-11-25 17:40:18 -08:00
if(range > 1)
2019-11-24 20:45:15 -08:00
range = 1;
2019-11-25 17:40:18 -08:00
M_DrawCharacter(x - 8, y, 128);
for(i = 0; i < SLIDER_RANGE; i++)
M_DrawCharacter(x + i * 8, y, 129);
M_DrawCharacter(x + i * 8, y, 130);
M_DrawCharacter(x + (SLIDER_RANGE - 1) * 8 * range, y, 131);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_DrawCheckbox(int32_t x, int32_t y, int32_t on)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(on)
M_Print(x, y, "on");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(x, y, "off");
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Options_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
float r, l;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_option.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
// Draw the items in the order of the enum defined above:
// OPT_CUSTOMIZE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32, " Controls");
2019-11-24 20:45:15 -08:00
// OPT_CONSOLE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_CONSOLE, " Goto console");
2019-11-24 20:45:15 -08:00
// OPT_DEFAULTS:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_DEFAULTS, " Reset config");
2019-11-24 20:45:15 -08:00
// OPT_SCALE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_SCALE, " Scale");
2019-11-24 20:45:15 -08:00
l = (vid.width / 320.0) - 1;
r = l > 0 ? (scr_conscale.value - 1) / l : 0;
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_SCALE, r);
2019-11-24 20:45:15 -08:00
// OPT_SCRSIZE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_SCRSIZE, " Screen size");
2019-11-24 20:45:15 -08:00
r = (scr_viewsize.value - 30) / (120 - 30);
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_SCRSIZE, r);
2019-11-24 20:45:15 -08:00
// OPT_GAMMA:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_GAMMA, " Brightness");
2019-11-24 20:45:15 -08:00
r = (1.0 - vid_gamma.value) / 0.5;
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_GAMMA, r);
2019-11-24 20:45:15 -08:00
// OPT_CONTRAST:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_CONTRAST, " Contrast");
2019-11-24 20:45:15 -08:00
r = vid_contrast.value - 1.0;
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_CONTRAST, r);
2019-11-24 22:55:47 -08:00
2019-11-24 20:45:15 -08:00
// OPT_MOUSESPEED:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_MOUSESPEED, " Mouse Speed");
r = (sensitivity.value - 1) / 10;
M_DrawSlider(220, 32 + 8 * OPT_MOUSESPEED, r);
2019-11-24 20:45:15 -08:00
// OPT_SBALPHA:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_SBALPHA, " Statusbar alpha");
2019-11-24 20:45:15 -08:00
r = (1.0 - scr_sbaralpha.value) ; // scr_sbaralpha range is 1.0 to 0.0
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_SBALPHA, r);
2019-11-24 20:45:15 -08:00
// OPT_SNDVOL:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_SNDVOL, " Sound Volume");
2019-11-24 20:45:15 -08:00
r = sfxvolume.value;
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_SNDVOL, r);
2019-11-24 20:45:15 -08:00
// OPT_MUSICVOL:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_MUSICVOL, " Music Volume");
2019-11-24 20:45:15 -08:00
r = bgmvolume.value;
2019-11-25 17:40:18 -08:00
M_DrawSlider(220, 32 + 8 * OPT_MUSICVOL, r);
2019-11-24 20:45:15 -08:00
// OPT_MUSICEXT:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_MUSICEXT, " External Music");
M_DrawCheckbox(220, 32 + 8 * OPT_MUSICEXT, bgm_extmusic.value);
2019-11-24 20:45:15 -08:00
// OPT_ALWAYRUN:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_ALWAYRUN, " Always Run");
if(cl_alwaysrun.value)
M_Print(220, 32 + 8 * OPT_ALWAYRUN, "quakespasm");
else if(cl_forwardspeed.value > 200.0)
M_Print(220, 32 + 8 * OPT_ALWAYRUN, "vanilla");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(220, 32 + 8 * OPT_ALWAYRUN, "off");
2019-11-24 20:45:15 -08:00
// OPT_INVMOUSE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_INVMOUSE, " Invert Mouse");
M_DrawCheckbox(220, 32 + 8 * OPT_INVMOUSE, m_pitch.value < 0);
2019-11-24 20:45:15 -08:00
// OPT_ALWAYSMLOOK:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_ALWAYSMLOOK, " Mouse Look");
M_DrawCheckbox(220, 32 + 8 * OPT_ALWAYSMLOOK, in_mlook.state & 1);
2019-11-24 20:45:15 -08:00
// OPT_LOOKSPRING:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_LOOKSPRING, " Lookspring");
M_DrawCheckbox(220, 32 + 8 * OPT_LOOKSPRING, lookspring.value);
2019-11-24 20:45:15 -08:00
// OPT_LOOKSTRAFE:
2019-11-25 17:40:18 -08:00
M_Print(16, 32 + 8 * OPT_LOOKSTRAFE, " Lookstrafe");
M_DrawCheckbox(220, 32 + 8 * OPT_LOOKSTRAFE, lookstrafe.value);
2019-11-24 20:45:15 -08:00
// OPT_VIDEO:
2019-11-25 17:40:18 -08:00
if(vid_menudrawfn)
M_Print(16, 32 + 8 * OPT_VIDEO, " Video Options");
2019-11-24 20:45:15 -08:00
// cursor
2019-11-25 17:40:18 -08:00
M_DrawCharacter(200, 32 + options_cursor * 8, 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Options_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
m_entersound = true;
2019-11-25 17:40:18 -08:00
switch(options_cursor)
2019-11-24 20:45:15 -08:00
{
case OPT_CUSTOMIZE:
2019-11-25 17:40:18 -08:00
M_Menu_Keys_f();
2019-11-24 20:45:15 -08:00
break;
case OPT_CONSOLE:
m_state = m_none;
2019-11-25 17:40:18 -08:00
Con_ToggleConsole_f();
2019-11-24 20:45:15 -08:00
break;
case OPT_DEFAULTS:
2019-11-25 17:40:18 -08:00
if(SCR_ModalMessage("This will reset all controls\n"
"and stored cvars. Continue? (y/n)\n", 15.0f))
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Cbuf_AddText("resetcfg\n");
Cbuf_AddText("exec default.cfg\n");
2019-11-24 20:45:15 -08:00
}
break;
case OPT_VIDEO:
2019-11-25 17:40:18 -08:00
M_Menu_Video_f();
2019-11-24 20:45:15 -08:00
break;
default:
2019-11-25 17:40:18 -08:00
M_AdjustSliders(1);
2019-11-24 20:45:15 -08:00
break;
}
return;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
options_cursor--;
2019-11-25 17:40:18 -08:00
if(options_cursor < 0)
options_cursor = OPTIONS_ITEMS - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
options_cursor++;
2019-11-25 17:40:18 -08:00
if(options_cursor >= OPTIONS_ITEMS)
2019-11-24 20:45:15 -08:00
options_cursor = 0;
break;
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
M_AdjustSliders(-1);
2019-11-24 20:45:15 -08:00
break;
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
M_AdjustSliders(1);
2019-11-24 20:45:15 -08:00
break;
}
2019-11-25 17:40:18 -08:00
if(options_cursor == OPTIONS_ITEMS - 1 && vid_menudrawfn == NULL)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(k == K_UPARROW)
2019-11-24 20:45:15 -08:00
options_cursor = OPTIONS_ITEMS - 2;
else
options_cursor = 0;
}
}
//=============================================================================
/* KEYS MENU */
const char *bindnames[][2] =
{
2019-11-25 17:40:18 -08:00
{"+attack", "attack"},
{"impulse 10", "next weapon"},
{"impulse 12", "prev weapon"},
{"+jump", "jump / swim up"},
{"+forward", "walk forward"},
{"+back", "backpedal"},
{"+left", "turn left"},
{"+right", "turn right"},
{"+speed", "run"},
{"+moveleft", "step left"},
{"+moveright", "step right"},
{"+strafe", "sidestep"},
{"+lookup", "look up"},
{"+lookdown", "look down"},
{"centerview", "center view"},
{"+mlook", "mouse look"},
{"+klook", "keyboard look"},
{"+moveup", "swim up"},
{"+movedown", "swim down"}
2019-11-24 20:45:15 -08:00
};
2019-11-25 17:40:18 -08:00
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
static int32_t keys_cursor;
static bool bind_grab;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Keys_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_keys;
m_entersound = true;
}
2019-11-25 17:40:18 -08:00
void M_FindKeysForCommand(const char *command, int32_t *threekeys)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t count;
int32_t j;
int32_t l;
char *b;
2019-11-24 20:45:15 -08:00
threekeys[0] = threekeys[1] = threekeys[2] = -1;
l = strlen(command);
count = 0;
2019-11-25 17:40:18 -08:00
for(j = 0; j < MAX_KEYS; j++)
2019-11-24 20:45:15 -08:00
{
b = keybindings[j];
2019-11-25 17:40:18 -08:00
if(!b)
2019-11-24 20:45:15 -08:00
continue;
2019-11-25 17:40:18 -08:00
if(!strncmp(b, command, l))
2019-11-24 20:45:15 -08:00
{
threekeys[count] = j;
count++;
2019-11-25 17:40:18 -08:00
if(count == 3)
2019-11-24 20:45:15 -08:00
break;
}
}
}
2019-11-25 17:40:18 -08:00
void M_UnbindCommand(const char *command)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t j;
int32_t l;
char *b;
2019-11-24 20:45:15 -08:00
l = strlen(command);
2019-11-25 17:40:18 -08:00
for(j = 0; j < MAX_KEYS; j++)
2019-11-24 20:45:15 -08:00
{
b = keybindings[j];
2019-11-25 17:40:18 -08:00
if(!b)
2019-11-24 20:45:15 -08:00
continue;
2019-11-25 17:40:18 -08:00
if(!strncmp(b, command, l))
Key_SetBinding(j, NULL);
2019-11-24 20:45:15 -08:00
}
}
2019-11-25 17:40:18 -08:00
extern qpic_t *pic_up, *pic_down;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Keys_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t i, x, y;
int32_t keys[3];
const char *name;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/ttl_cstm.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(bind_grab)
M_Print(12, 32, "Press a key or button for this action");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(18, 32, "Enter to change, backspace to clear");
2019-11-24 20:45:15 -08:00
// search for known bindings
2019-11-25 17:40:18 -08:00
for(i = 0; i < (int32_t)NUMCOMMANDS; i++)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
y = 48 + 8 * i;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(16, y, bindnames[i][1]);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_FindKeysForCommand(bindnames[i][0], keys);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(keys[0] == -1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Print(140, y, "???");
2019-11-24 20:45:15 -08:00
}
else
{
2019-11-25 17:40:18 -08:00
name = Key_KeynumToString(keys[0]);
M_Print(140, y, name);
2019-11-24 20:45:15 -08:00
x = strlen(name) * 8;
2019-11-25 17:40:18 -08:00
if(keys[1] != -1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
name = Key_KeynumToString(keys[1]);
M_Print(140 + x + 8, y, "or");
M_Print(140 + x + 32, y, name);
2019-11-24 20:45:15 -08:00
x = x + 32 + strlen(name) * 8;
2019-11-25 17:40:18 -08:00
if(keys[2] != -1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Print(140 + x + 8, y, "or");
M_Print(140 + x + 32, y, Key_KeynumToString(keys[2]));
2019-11-24 20:45:15 -08:00
}
}
}
}
2019-11-25 17:40:18 -08:00
if(bind_grab)
M_DrawCharacter(130, 48 + keys_cursor * 8, '=');
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_DrawCharacter(130, 48 + keys_cursor * 8, 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Keys_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
char cmd[80];
int32_t keys[3];
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(bind_grab)
{
// defining a key
S_LocalSound("misc/menu1.wav");
if((k != K_ESCAPE) && (k != '`'))
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
sprintf(cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString(k), bindnames[keys_cursor][0]);
Cbuf_InsertText(cmd);
2019-11-24 20:45:15 -08:00
}
bind_grab = false;
IN_Deactivate(modestate == MS_WINDOWED); // deactivate because we're returning to the menu
return;
}
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Options_f();
2019-11-24 20:45:15 -08:00
break;
case K_LEFTARROW:
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
keys_cursor--;
2019-11-25 17:40:18 -08:00
if(keys_cursor < 0)
keys_cursor = NUMCOMMANDS - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
keys_cursor++;
2019-11-25 17:40:18 -08:00
if(keys_cursor >= (int32_t)NUMCOMMANDS)
2019-11-24 20:45:15 -08:00
keys_cursor = 0;
break;
2019-11-25 17:40:18 -08:00
case K_ENTER: // go into bind mode
2019-11-24 20:45:15 -08:00
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
M_FindKeysForCommand(bindnames[keys_cursor][0], keys);
S_LocalSound("misc/menu2.wav");
if(keys[2] != -1)
M_UnbindCommand(bindnames[keys_cursor][0]);
2019-11-24 20:45:15 -08:00
bind_grab = true;
IN_Activate(); // activate to allow mouse key binding
break;
2019-11-25 17:40:18 -08:00
case K_BACKSPACE: // delete bindings
2019-11-24 20:45:15 -08:00
case K_DEL:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu2.wav");
M_UnbindCommand(bindnames[keys_cursor][0]);
2019-11-24 20:45:15 -08:00
break;
}
}
//=============================================================================
/* VIDEO MENU */
2019-11-25 17:40:18 -08:00
void M_Menu_Video_f(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
(*vid_menucmdfn)(); //johnfitz
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Video_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
(*vid_menudrawfn)();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Video_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
(*vid_menukeyfn)(key);
2019-11-24 20:45:15 -08:00
}
//=============================================================================
/* HELP MENU */
2019-11-25 17:40:18 -08:00
int32_t help_page;
#define NUM_HELP_PAGES 6
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Help_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_help;
m_entersound = true;
help_page = 0;
}
2019-11-25 17:40:18 -08:00
void M_Help_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_DrawPic(0, 0, Draw_CachePic(va("gfx/help%" PRIi32 ".lmp", help_page)));
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Help_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Main_f();
2019-11-24 20:45:15 -08:00
break;
case K_UPARROW:
case K_RIGHTARROW:
m_entersound = true;
2019-11-25 17:40:18 -08:00
if(++help_page >= NUM_HELP_PAGES)
2019-11-24 20:45:15 -08:00
help_page = 0;
break;
case K_DOWNARROW:
case K_LEFTARROW:
m_entersound = true;
2019-11-25 17:40:18 -08:00
if(--help_page < 0)
help_page = NUM_HELP_PAGES - 1;
2019-11-24 20:45:15 -08:00
break;
}
}
//=============================================================================
/* QUIT MENU */
2019-11-25 17:40:18 -08:00
int32_t msgNumber;
enum m_state_e m_quit_prevstate;
bool wasInMenus;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Quit_f(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(m_state == m_quit)
2019-11-24 20:45:15 -08:00
return;
wasInMenus = (key_dest == key_menu);
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_quit_prevstate = m_state;
m_state = m_quit;
m_entersound = true;
2019-11-25 17:40:18 -08:00
msgNumber = rand() & 7;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Quit_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(key == K_ESCAPE)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(wasInMenus)
2019-11-24 20:45:15 -08:00
{
m_state = m_quit_prevstate;
m_entersound = true;
}
else
{
IN_Activate();
key_dest = key_game;
m_state = m_none;
}
}
}
2019-11-25 17:40:18 -08:00
void M_Quit_Char(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case 'n':
case 'N':
2019-11-25 17:40:18 -08:00
if(wasInMenus)
2019-11-24 20:45:15 -08:00
{
m_state = m_quit_prevstate;
m_entersound = true;
}
else
{
IN_Activate();
key_dest = key_game;
m_state = m_none;
}
break;
case 'y':
case 'Y':
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_console;
2019-11-25 17:40:18 -08:00
Host_Quit_f();
2019-11-24 20:45:15 -08:00
break;
default:
break;
}
}
2019-11-25 17:40:18 -08:00
bool M_Quit_TextEntry(void)
2019-11-24 20:45:15 -08:00
{
return true;
}
2019-12-02 07:01:47 -08:00
void M_Quit_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-12-02 07:01:47 -08:00
static char const msg1[] = ENGINE_NAME " " VERSION;
static char const msg2[] = "FIXME: make this customizable";
static char const msg3[] = "Press y to quit";
int32_t boxlen;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(wasInMenus)
2019-11-24 20:45:15 -08:00
{
m_state = m_quit_prevstate;
m_recursiveDraw = true;
2019-11-25 17:40:18 -08:00
M_Draw();
2019-11-24 20:45:15 -08:00
m_state = m_quit;
}
boxlen = q_max(strsizeof(msg1), q_max(strsizeof(msg2), strsizeof(msg3))) + 1;
2019-11-25 17:40:18 -08:00
if(boxlen & 1) boxlen++;
M_DrawTextBox(160 - 4 * (boxlen + 2), 76, boxlen, 4);
2019-11-24 20:45:15 -08:00
M_Print(160 - 4 * strsizeof(msg1), 88, msg1);
M_Print(160 - 4 * strsizeof(msg2), 96, msg2);
M_PrintWhite(160 - 4 * strsizeof(msg3), 104, msg3);
2019-11-24 20:45:15 -08:00
}
//=============================================================================
/* LAN CONFIG MENU */
2019-11-25 17:40:18 -08:00
int32_t lanConfig_cursor = -1;
int32_t lanConfig_cursor_table [] = {72, 92, 124};
#define NUM_LANCONFIG_CMDS 3
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
int32_t lanConfig_port;
char lanConfig_portname[6];
char lanConfig_joinname[22];
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_LanConfig_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_lanconfig;
m_entersound = true;
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == -1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(JoiningGame && TCPIPConfig)
2019-11-24 20:45:15 -08:00
lanConfig_cursor = 2;
else
lanConfig_cursor = 1;
}
2019-11-25 17:40:18 -08:00
if(StartingGame && lanConfig_cursor == 2)
2019-11-24 20:45:15 -08:00
lanConfig_cursor = 1;
lanConfig_port = DEFAULTnet_hostport;
sprintf(lanConfig_portname, "%" PRIu32, lanConfig_port);
2019-11-24 20:45:15 -08:00
m_return_onerror = false;
m_return_reason[0] = 0;
}
2019-11-25 17:40:18 -08:00
void M_LanConfig_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
qpic_t *p;
int32_t basex;
const char *startJoin;
const char *protocol;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_multi.lmp");
basex = (320 - p->width) / 2;
M_DrawPic(basex, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(StartingGame)
2019-11-24 20:45:15 -08:00
startJoin = "New Game";
else
startJoin = "Join Game";
2019-11-25 17:40:18 -08:00
if(IPXConfig)
2019-11-24 20:45:15 -08:00
protocol = "IPX";
else
protocol = "TCP/IP";
2019-11-25 17:40:18 -08:00
M_Print(basex, 32, va("%s - %s", startJoin, protocol));
2019-11-24 20:45:15 -08:00
basex += 8;
2019-11-25 17:40:18 -08:00
M_Print(basex, 52, "Address:");
if(IPXConfig)
M_Print(basex + 9 * 8, 52, my_ipx_address);
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(basex + 9 * 8, 52, my_tcpip_address);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(basex, lanConfig_cursor_table[0], "Port");
M_DrawTextBox(basex + 8 * 8, lanConfig_cursor_table[0] - 8, 6, 1);
M_Print(basex + 9 * 8, lanConfig_cursor_table[0], lanConfig_portname);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(JoiningGame)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Print(basex, lanConfig_cursor_table[1], "Search for local games...");
M_Print(basex, 108, "Join game at:");
M_DrawTextBox(basex + 8, lanConfig_cursor_table[2] - 8, 22, 1);
M_Print(basex + 16, lanConfig_cursor_table[2], lanConfig_joinname);
2019-11-24 20:45:15 -08:00
}
else
{
2019-11-25 17:40:18 -08:00
M_DrawTextBox(basex, lanConfig_cursor_table[1] - 8, 2, 1);
M_Print(basex + 8, lanConfig_cursor_table[1], "OK");
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
M_DrawCharacter(basex - 8, lanConfig_cursor_table [lanConfig_cursor], 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 0)
M_DrawCharacter(basex + 9 * 8 + 8 * strlen(lanConfig_portname), lanConfig_cursor_table [0], 10 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 2)
M_DrawCharacter(basex + 16 + 8 * strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(*m_return_reason)
M_PrintWhite(basex, 148, m_return_reason);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_LanConfig_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t l;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Net_f();
2019-11-24 20:45:15 -08:00
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
lanConfig_cursor--;
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor < 0)
lanConfig_cursor = NUM_LANCONFIG_CMDS - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
lanConfig_cursor++;
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2019-11-24 20:45:15 -08:00
lanConfig_cursor = 0;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 0)
2019-11-24 20:45:15 -08:00
break;
m_entersound = true;
2019-11-25 17:40:18 -08:00
M_ConfigureNetSubsystem();
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 1)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(StartingGame)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Menu_GameOptions_f();
2019-11-24 20:45:15 -08:00
break;
}
M_Menu_Search_f();
break;
}
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 2)
2019-11-24 20:45:15 -08:00
{
m_return_state = m_state;
m_return_onerror = true;
IN_Activate();
key_dest = key_game;
m_state = m_none;
2019-11-25 17:40:18 -08:00
Cbuf_AddText(va("connect \"%s\"\n", lanConfig_joinname));
2019-11-24 20:45:15 -08:00
break;
}
break;
case K_BACKSPACE:
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 0)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(strlen(lanConfig_portname))
lanConfig_portname[strlen(lanConfig_portname) - 1] = 0;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
if(lanConfig_cursor == 2)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(strlen(lanConfig_joinname))
lanConfig_joinname[strlen(lanConfig_joinname) - 1] = 0;
2019-11-24 20:45:15 -08:00
}
break;
}
2019-11-25 17:40:18 -08:00
if(StartingGame && lanConfig_cursor == 2)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(key == K_UPARROW)
2019-11-24 20:45:15 -08:00
lanConfig_cursor = 1;
else
lanConfig_cursor = 0;
}
2019-12-07 09:27:26 -08:00
l = atoi(lanConfig_portname);
2019-11-25 17:40:18 -08:00
if(l > 65535)
2019-11-24 20:45:15 -08:00
l = lanConfig_port;
else
lanConfig_port = l;
sprintf(lanConfig_portname, "%" PRIu32, lanConfig_port);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_LanConfig_Char(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 16:49:58 -08:00
int32_t l;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(lanConfig_cursor)
2019-11-24 20:45:15 -08:00
{
case 0:
2019-11-25 17:40:18 -08:00
if(key < '0' || key > '9')
2019-11-24 20:45:15 -08:00
return;
l = strlen(lanConfig_portname);
2019-11-25 17:40:18 -08:00
if(l < 5)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
lanConfig_portname[l + 1] = 0;
2019-11-24 20:45:15 -08:00
lanConfig_portname[l] = key;
}
break;
case 2:
l = strlen(lanConfig_joinname);
2019-11-25 17:40:18 -08:00
if(l < 21)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
lanConfig_joinname[l + 1] = 0;
2019-11-24 20:45:15 -08:00
lanConfig_joinname[l] = key;
}
break;
}
}
2019-11-25 17:40:18 -08:00
bool M_LanConfig_TextEntry(void)
2019-11-24 20:45:15 -08:00
{
return (lanConfig_cursor == 0 || lanConfig_cursor == 2);
}
//=============================================================================
/* GAME OPTIONS MENU */
typedef struct
{
2019-11-25 17:40:18 -08:00
const char *name;
const char *description;
2019-11-24 20:45:15 -08:00
} level_t;
2019-11-25 17:40:18 -08:00
level_t levels[] =
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
{"start", "Entrance"}, // 0
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
{"e1m1", "Slipgate Complex"}, // 1
2019-11-24 20:45:15 -08:00
{"e1m2", "Castle of the Damned"},
{"e1m3", "The Necropolis"},
{"e1m4", "The Grisly Grotto"},
{"e1m5", "Gloom Keep"},
{"e1m6", "The Door To Chthon"},
{"e1m7", "The House of Chthon"},
{"e1m8", "Ziggurat Vertigo"},
2019-11-25 17:40:18 -08:00
{"e2m1", "The Installation"}, // 9
2019-11-24 20:45:15 -08:00
{"e2m2", "Ogre Citadel"},
{"e2m3", "Crypt of Decay"},
{"e2m4", "The Ebon Fortress"},
{"e2m5", "The Wizard's Manse"},
{"e2m6", "The Dismal Oubliette"},
{"e2m7", "Underearth"},
2019-11-25 17:40:18 -08:00
{"e3m1", "Termination Central"}, // 16
2019-11-24 20:45:15 -08:00
{"e3m2", "The Vaults of Zin"},
{"e3m3", "The Tomb of Terror"},
{"e3m4", "Satan's Dark Delight"},
{"e3m5", "Wind Tunnels"},
{"e3m6", "Chambers of Torment"},
{"e3m7", "The Haunted Halls"},
2019-11-25 17:40:18 -08:00
{"e4m1", "The Sewage System"}, // 23
2019-11-24 20:45:15 -08:00
{"e4m2", "The Tower of Despair"},
{"e4m3", "The Elder God Shrine"},
{"e4m4", "The Palace of Hate"},
{"e4m5", "Hell's Atrium"},
{"e4m6", "The Pain Maze"},
{"e4m7", "Azure Agony"},
{"e4m8", "The Nameless City"},
2019-11-25 17:40:18 -08:00
{"end", "Shub-Niggurath's Pit"}, // 31
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
{"dm1", "Place of Two Deaths"}, // 32
2019-11-24 20:45:15 -08:00
{"dm2", "Claustrophobopolis"},
{"dm3", "The Abandoned Base"},
{"dm4", "The Bad Place"},
{"dm5", "The Cistern"},
{"dm6", "The Dark Zone"}
};
//MED 01/06/97 added hipnotic levels
level_t hipnoticlevels[] =
{
2019-11-25 17:40:18 -08:00
{"start", "Command HQ"}, // 0
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
{"hip1m1", "The Pumping Station"}, // 1
2019-11-24 20:45:15 -08:00
{"hip1m2", "Storage Facility"},
{"hip1m3", "The Lost Mine"},
{"hip1m4", "Research Facility"},
{"hip1m5", "Military Complex"},
2019-11-25 17:40:18 -08:00
{"hip2m1", "Ancient Realms"}, // 6
2019-11-24 20:45:15 -08:00
{"hip2m2", "The Black Cathedral"},
{"hip2m3", "The Catacombs"},
{"hip2m4", "The Crypt"},
{"hip2m5", "Mortum's Keep"},
{"hip2m6", "The Gremlin's Domain"},
2019-11-25 17:40:18 -08:00
{"hip3m1", "Tur Torment"}, // 12
2019-11-24 20:45:15 -08:00
{"hip3m2", "Pandemonium"},
{"hip3m3", "Limbo"},
{"hip3m4", "The Gauntlet"},
2019-11-25 17:40:18 -08:00
{"hipend", "Armagon's Lair"}, // 16
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
{"hipdm1", "The Edge of Oblivion"} // 17
2019-11-24 20:45:15 -08:00
};
//PGM 01/07/97 added rogue levels
//PGM 03/02/97 added dmatch level
2019-11-25 17:40:18 -08:00
level_t roguelevels[] =
{
{"start", "Split Decision"},
{"r1m1", "Deviant's Domain"},
{"r1m2", "Dread Portal"},
{"r1m3", "Judgement Call"},
{"r1m4", "Cave of Death"},
{"r1m5", "Towers of Wrath"},
{"r1m6", "Temple of Pain"},
{"r1m7", "Tomb of the Overlord"},
{"r2m1", "Tempus Fugit"},
{"r2m2", "Elemental Fury I"},
{"r2m3", "Elemental Fury II"},
{"r2m4", "Curse of Osiris"},
{"r2m5", "Wizard's Keep"},
{"r2m6", "Blood Sacrifice"},
{"r2m7", "Last Bastion"},
{"r2m8", "Source of Evil"},
2019-11-24 20:45:15 -08:00
{"ctf1", "Division of Change"}
};
typedef struct
{
2019-11-25 17:40:18 -08:00
const char *description;
int32_t firstLevel;
int32_t levels;
2019-11-24 20:45:15 -08:00
} episode_t;
2019-11-25 17:40:18 -08:00
episode_t episodes[] =
2019-11-24 20:45:15 -08:00
{
{"Welcome to Quake", 0, 1},
{"Doomed Dimension", 1, 8},
{"Realm of Black Magic", 9, 7},
{"Netherworld", 16, 7},
{"The Elder World", 23, 8},
{"Final Level", 31, 1},
{"Deathmatch Arena", 32, 6}
};
//MED 01/06/97 added hipnotic episodes
episode_t hipnoticepisodes[] =
{
{"Scourge of Armagon", 0, 1},
{"Fortress of the Dead", 1, 5},
{"Dominion of Darkness", 6, 6},
{"The Rift", 12, 4},
{"Final Level", 16, 1},
{"Deathmatch Arena", 17, 1}
};
//PGM 01/07/97 added rogue episodes
//PGM 03/02/97 added dmatch episode
2019-11-25 17:40:18 -08:00
episode_t rogueepisodes[] =
2019-11-24 20:45:15 -08:00
{
{"Introduction", 0, 1},
{"Hell's Fortress", 1, 7},
{"Corridors of Time", 8, 8},
{"Deathmatch Arena", 16, 1}
};
2019-11-25 17:40:18 -08:00
int32_t startepisode;
int32_t startlevel;
2019-11-25 16:49:58 -08:00
int32_t maxplayers;
2019-11-25 15:28:38 -08:00
bool m_serverInfoMessage = false;
2019-11-24 20:45:15 -08:00
double m_serverInfoMessageTime;
2019-11-25 17:40:18 -08:00
void M_Menu_GameOptions_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_gameoptions;
m_entersound = true;
2019-11-25 17:40:18 -08:00
if(maxplayers == 0)
2019-11-24 20:45:15 -08:00
maxplayers = svs.maxclients;
2019-11-25 17:40:18 -08:00
if(maxplayers < 2)
2019-11-24 20:45:15 -08:00
maxplayers = svs.maxclientslimit;
}
2019-11-25 16:49:58 -08:00
int32_t gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2019-11-25 17:40:18 -08:00
#define NUM_GAMEOPTIONS 9
int32_t gameoptions_cursor;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_GameOptions_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
qpic_t *p;
int32_t x;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTransPic(16, 4, Draw_CachePic("gfx/qplaque.lmp"));
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_DrawTextBox(152, 32, 10, 1);
M_Print(160, 40, "begin game");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 56, " Max players");
M_Print(160, 56, va("%" PRIi32, maxplayers));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 64, " Game Type");
if(coop.value)
M_Print(160, 64, "Cooperative");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(160, 64, "Deathmatch");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 72, " Teamplay");
if(rogue)
2019-11-24 20:45:15 -08:00
{
const char *msg;
2019-11-25 16:49:58 -08:00
switch((int32_t)teamplay.value)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
case 1:
msg = "No Friendly Fire";
break;
case 2:
msg = "Friendly Fire";
break;
case 3:
msg = "Tag";
break;
case 4:
msg = "Capture the Flag";
break;
case 5:
msg = "One Flag CTF";
break;
case 6:
msg = "Three Team CTF";
break;
default:
msg = "Off";
break;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
M_Print(160, 72, msg);
2019-11-24 20:45:15 -08:00
}
else
{
const char *msg;
2019-11-25 16:49:58 -08:00
switch((int32_t)teamplay.value)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
case 1:
msg = "No Friendly Fire";
break;
case 2:
msg = "Friendly Fire";
break;
default:
msg = "Off";
break;
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
M_Print(160, 72, msg);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
M_Print(0, 80, " Skill");
if(skill.value == 0)
M_Print(160, 80, "Easy difficulty");
else if(skill.value == 1)
M_Print(160, 80, "Normal difficulty");
else if(skill.value == 2)
M_Print(160, 80, "Hard difficulty");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(160, 80, "Nightmare difficulty");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 88, " Frag Limit");
if(fraglimit.value == 0)
M_Print(160, 88, "none");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(160, 88, va("%" PRIi32 " frags", (int32_t)fraglimit.value));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 96, " Time Limit");
if(timelimit.value == 0)
M_Print(160, 96, "none");
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(160, 96, va("%" PRIi32 " minutes", (int32_t)timelimit.value));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 112, " Episode");
2019-11-24 20:45:15 -08:00
// MED 01/06/97 added hipnotic episodes
2019-11-25 17:40:18 -08:00
if(hipnotic)
M_Print(160, 112, hipnoticepisodes[startepisode].description);
2019-11-24 20:45:15 -08:00
// PGM 01/07/97 added rogue episodes
2019-11-25 17:40:18 -08:00
else if(rogue)
M_Print(160, 112, rogueepisodes[startepisode].description);
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
M_Print(160, 112, episodes[startepisode].description);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
M_Print(0, 120, " Level");
2019-11-24 20:45:15 -08:00
// MED 01/06/97 added hipnotic episodes
2019-11-25 17:40:18 -08:00
if(hipnotic)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Print(160, 120, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].description);
M_Print(160, 128, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name);
2019-11-24 20:45:15 -08:00
}
// PGM 01/07/97 added rogue episodes
2019-11-25 17:40:18 -08:00
else if(rogue)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Print(160, 120, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].description);
M_Print(160, 128, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name);
2019-11-24 20:45:15 -08:00
}
else
{
2019-11-25 17:40:18 -08:00
M_Print(160, 120, levels[episodes[startepisode].firstLevel + startlevel].description);
M_Print(160, 128, levels[episodes[startepisode].firstLevel + startlevel].name);
2019-11-24 20:45:15 -08:00
}
// line cursor
2019-11-25 17:40:18 -08:00
M_DrawCharacter(144, gameoptions_cursor_table[gameoptions_cursor], 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(m_serverInfoMessage)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if((realtime - m_serverInfoMessageTime) < 5.0)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
x = (320 - 26 * 8) / 2;
M_DrawTextBox(x, 138, 24, 4);
2019-11-24 20:45:15 -08:00
x += 8;
2019-11-25 17:40:18 -08:00
M_Print(x, 146, " More than 4 players ");
M_Print(x, 154, " requires using command ");
M_Print(x, 162, "line parameters; please ");
M_Print(x, 170, " see techinfo.txt. ");
2019-11-24 20:45:15 -08:00
}
else
{
m_serverInfoMessage = false;
}
}
}
2019-11-25 17:40:18 -08:00
void M_NetStart_Change(int32_t dir)
2019-11-24 20:45:15 -08:00
{
2019-11-25 16:49:58 -08:00
int32_t count;
2019-11-25 17:40:18 -08:00
float f;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(gameoptions_cursor)
2019-11-24 20:45:15 -08:00
{
case 1:
maxplayers += dir;
2019-11-25 17:40:18 -08:00
if(maxplayers > svs.maxclientslimit)
2019-11-24 20:45:15 -08:00
{
maxplayers = svs.maxclientslimit;
m_serverInfoMessage = true;
m_serverInfoMessageTime = realtime;
}
2019-11-25 17:40:18 -08:00
if(maxplayers < 2)
2019-11-24 20:45:15 -08:00
maxplayers = 2;
break;
case 2:
2019-11-25 17:40:18 -08:00
Cvar_Set("coop", coop.value ? "0" : "1");
2019-11-24 20:45:15 -08:00
break;
case 3:
count = (rogue) ? 6 : 2;
f = teamplay.value + dir;
2019-11-25 17:40:18 -08:00
if(f > count) f = 0;
else if(f < 0) f = count;
Cvar_SetValue("teamplay", f);
2019-11-24 20:45:15 -08:00
break;
case 4:
f = skill.value + dir;
2019-11-25 17:40:18 -08:00
if(f > 3) f = 0;
else if(f < 0) f = 3;
Cvar_SetValue("skill", f);
2019-11-24 20:45:15 -08:00
break;
case 5:
f = fraglimit.value + dir * 10;
2019-11-25 17:40:18 -08:00
if(f > 100) f = 0;
else if(f < 0) f = 100;
Cvar_SetValue("fraglimit", f);
2019-11-24 20:45:15 -08:00
break;
case 6:
f = timelimit.value + dir * 5;
2019-11-25 17:40:18 -08:00
if(f > 60) f = 0;
else if(f < 0) f = 60;
Cvar_SetValue("timelimit", f);
2019-11-24 20:45:15 -08:00
break;
case 7:
startepisode += dir;
2019-11-25 17:40:18 -08:00
//MED 01/06/97 added hipnotic count
if(hipnotic)
2019-11-24 20:45:15 -08:00
count = 6;
2019-11-25 17:40:18 -08:00
//PGM 01/07/97 added rogue count
//PGM 03/02/97 added 1 for dmatch episode
else if(rogue)
2019-11-24 20:45:15 -08:00
count = 4;
else
2019-11-26 17:37:03 -08:00
count = 7;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(startepisode < 0)
2019-11-24 20:45:15 -08:00
startepisode = count - 1;
2019-11-25 17:40:18 -08:00
if(startepisode >= count)
2019-11-24 20:45:15 -08:00
startepisode = 0;
startlevel = 0;
break;
case 8:
startlevel += dir;
2019-11-25 17:40:18 -08:00
//MED 01/06/97 added hipnotic episodes
if(hipnotic)
2019-11-24 20:45:15 -08:00
count = hipnoticepisodes[startepisode].levels;
2019-11-25 17:40:18 -08:00
//PGM 01/06/97 added hipnotic episodes
else if(rogue)
2019-11-24 20:45:15 -08:00
count = rogueepisodes[startepisode].levels;
else
count = episodes[startepisode].levels;
2019-11-25 17:40:18 -08:00
if(startlevel < 0)
2019-11-24 20:45:15 -08:00
startlevel = count - 1;
2019-11-25 17:40:18 -08:00
if(startlevel >= count)
2019-11-24 20:45:15 -08:00
startlevel = 0;
break;
}
}
2019-11-25 17:40:18 -08:00
void M_GameOptions_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(key)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_Net_f();
2019-11-24 20:45:15 -08:00
break;
case K_UPARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
gameoptions_cursor--;
2019-11-25 17:40:18 -08:00
if(gameoptions_cursor < 0)
gameoptions_cursor = NUM_GAMEOPTIONS - 1;
2019-11-24 20:45:15 -08:00
break;
case K_DOWNARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
gameoptions_cursor++;
2019-11-25 17:40:18 -08:00
if(gameoptions_cursor >= NUM_GAMEOPTIONS)
2019-11-24 20:45:15 -08:00
gameoptions_cursor = 0;
break;
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
if(gameoptions_cursor == 0)
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu3.wav");
M_NetStart_Change(-1);
2019-11-24 20:45:15 -08:00
break;
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
if(gameoptions_cursor == 0)
2019-11-24 20:45:15 -08:00
break;
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu3.wav");
M_NetStart_Change(1);
2019-11-24 20:45:15 -08:00
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu2.wav");
if(gameoptions_cursor == 0)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(sv.active)
Cbuf_AddText("disconnect\n");
Cbuf_AddText("listen 0\n"); // so host_netport will be re-examined
Cbuf_AddText(va("maxplayers %" PRIu32 "\n", maxplayers));
SCR_BeginLoadingPlaque();
if(hipnotic)
Cbuf_AddText(va("map %s\n", hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name));
else if(rogue)
Cbuf_AddText(va("map %s\n", roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name));
2019-11-24 20:45:15 -08:00
else
2019-11-25 17:40:18 -08:00
Cbuf_AddText(va("map %s\n", levels[episodes[startepisode].firstLevel + startlevel].name));
2019-11-24 20:45:15 -08:00
return;
}
2019-11-25 17:40:18 -08:00
M_NetStart_Change(1);
2019-11-24 20:45:15 -08:00
break;
}
}
//=============================================================================
/* SEARCH MENU */
2019-11-25 17:40:18 -08:00
bool searchComplete = false;
double searchCompleteTime;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_Search_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_search;
m_entersound = false;
slistSilent = true;
slistLocal = false;
searchComplete = false;
NET_Slist_f();
}
2019-11-25 17:40:18 -08:00
void M_Search_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
qpic_t *p;
2019-11-25 16:49:58 -08:00
int32_t x;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
x = (320 / 2) - ((12 * 8) / 2) + 4;
M_DrawTextBox(x - 8, 32, 12, 1);
M_Print(x, 40, "Searching...");
2019-11-24 20:45:15 -08:00
if(slistInProgress)
{
NET_Poll();
return;
}
2019-11-25 17:40:18 -08:00
if(! searchComplete)
2019-11-24 20:45:15 -08:00
{
searchComplete = true;
searchCompleteTime = realtime;
}
2019-11-25 17:40:18 -08:00
if(hostCacheCount)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
M_Menu_ServerList_f();
2019-11-24 20:45:15 -08:00
return;
}
2019-11-25 17:40:18 -08:00
M_PrintWhite((320 / 2) - ((22 * 8) / 2), 64, "No Quake servers found");
if((realtime - searchCompleteTime) < 3.0)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
M_Menu_LanConfig_f();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Search_Key(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 13:20:03 -08:00
(void)key;
2019-11-24 20:45:15 -08:00
}
//=============================================================================
/* SLIST MENU */
2019-11-25 17:40:18 -08:00
int32_t slist_cursor;
2019-11-25 15:28:38 -08:00
bool slist_sorted;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
void M_Menu_ServerList_f(void)
2019-11-24 20:45:15 -08:00
{
IN_Deactivate(modestate == MS_WINDOWED);
key_dest = key_menu;
m_state = m_slist;
m_entersound = true;
slist_cursor = 0;
m_return_onerror = false;
m_return_reason[0] = 0;
slist_sorted = false;
}
2019-11-25 17:40:18 -08:00
void M_ServerList_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
int32_t n;
qpic_t *p;
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(!slist_sorted)
2019-11-24 20:45:15 -08:00
{
slist_sorted = true;
2019-11-25 17:40:18 -08:00
NET_SlistSort();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
p = Draw_CachePic("gfx/p_multi.lmp");
M_DrawPic((320 - p->width) / 2, 4, p);
for(n = 0; n < hostCacheCount; n++)
M_Print(16, 32 + 8 * n, NET_SlistPrintServer(n));
M_DrawCharacter(0, 32 + slist_cursor * 8, 12 + ((int32_t)(realtime * 4) & 1));
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(*m_return_reason)
M_PrintWhite(16, 148, m_return_reason);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_ServerList_Key(int32_t k)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(k)
2019-11-24 20:45:15 -08:00
{
case K_ESCAPE:
case K_BBUTTON:
2019-11-25 17:40:18 -08:00
M_Menu_LanConfig_f();
2019-11-24 20:45:15 -08:00
break;
case K_SPACE:
2019-11-25 17:40:18 -08:00
M_Menu_Search_f();
2019-11-24 20:45:15 -08:00
break;
case K_UPARROW:
case K_LEFTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
slist_cursor--;
2019-11-25 17:40:18 -08:00
if(slist_cursor < 0)
2019-11-24 20:45:15 -08:00
slist_cursor = hostCacheCount - 1;
break;
case K_DOWNARROW:
case K_RIGHTARROW:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu1.wav");
2019-11-24 20:45:15 -08:00
slist_cursor++;
2019-11-25 17:40:18 -08:00
if(slist_cursor >= hostCacheCount)
2019-11-24 20:45:15 -08:00
slist_cursor = 0;
break;
case K_ENTER:
case K_KP_ENTER:
case K_ABUTTON:
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu2.wav");
2019-11-24 20:45:15 -08:00
m_return_state = m_state;
m_return_onerror = true;
slist_sorted = false;
IN_Activate();
key_dest = key_game;
m_state = m_none;
2019-11-25 17:40:18 -08:00
Cbuf_AddText(va("connect \"%s\"\n", NET_SlistPrintServerName(slist_cursor)));
2019-11-24 20:45:15 -08:00
break;
default:
break;
}
}
//=============================================================================
/* Menu Subsystem */
2019-11-25 17:40:18 -08:00
void M_Init(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Cmd_AddCommand("togglemenu", M_ToggleMenu_f);
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
Cmd_AddCommand("menu_main", M_Menu_Main_f);
Cmd_AddCommand("menu_singleplayer", M_Menu_SinglePlayer_f);
Cmd_AddCommand("menu_load", M_Menu_Load_f);
Cmd_AddCommand("menu_save", M_Menu_Save_f);
Cmd_AddCommand("menu_multiplayer", M_Menu_MultiPlayer_f);
Cmd_AddCommand("menu_setup", M_Menu_Setup_f);
Cmd_AddCommand("menu_options", M_Menu_Options_f);
Cmd_AddCommand("menu_keys", M_Menu_Keys_f);
Cmd_AddCommand("menu_video", M_Menu_Video_f);
Cmd_AddCommand("help", M_Menu_Help_f);
Cmd_AddCommand("menu_quit", M_Menu_Quit_f);
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Draw(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(m_state == m_none || key_dest != key_menu)
2019-11-24 20:45:15 -08:00
return;
2019-11-25 17:40:18 -08:00
if(!m_recursiveDraw)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
if(scr_con_current)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
Draw_ConsoleBackground();
S_ExtraUpdate();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
Draw_FadeScreen(); //johnfitz -- fade even if console fills screen
2019-11-24 20:45:15 -08:00
}
else
{
m_recursiveDraw = false;
}
2019-11-25 17:40:18 -08:00
GL_SetCanvas(CANVAS_MENU); //johnfitz
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
switch(m_state)
2019-11-24 20:45:15 -08:00
{
case m_none:
break;
case m_main:
2019-11-25 17:40:18 -08:00
M_Main_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_singleplayer:
2019-11-25 17:40:18 -08:00
M_SinglePlayer_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_load:
2019-11-25 17:40:18 -08:00
M_Load_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_save:
2019-11-25 17:40:18 -08:00
M_Save_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_multiplayer:
2019-11-25 17:40:18 -08:00
M_MultiPlayer_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_setup:
2019-11-25 17:40:18 -08:00
M_Setup_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_net:
2019-11-25 17:40:18 -08:00
M_Net_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_options:
2019-11-25 17:40:18 -08:00
M_Options_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_keys:
2019-11-25 17:40:18 -08:00
M_Keys_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_video:
2019-11-25 17:40:18 -08:00
M_Video_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_help:
2019-11-25 17:40:18 -08:00
M_Help_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_quit:
2019-11-25 17:40:18 -08:00
M_Quit_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_lanconfig:
2019-11-25 17:40:18 -08:00
M_LanConfig_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_gameoptions:
2019-11-25 17:40:18 -08:00
M_GameOptions_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_search:
2019-11-25 17:40:18 -08:00
M_Search_Draw();
2019-11-24 20:45:15 -08:00
break;
case m_slist:
2019-11-25 17:40:18 -08:00
M_ServerList_Draw();
2019-11-24 20:45:15 -08:00
break;
}
2019-11-25 17:40:18 -08:00
if(m_entersound)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
S_LocalSound("misc/menu2.wav");
2019-11-24 20:45:15 -08:00
m_entersound = false;
}
2019-11-25 17:40:18 -08:00
S_ExtraUpdate();
2019-11-24 20:45:15 -08:00
}
2019-11-25 17:40:18 -08:00
void M_Keydown(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(m_state)
2019-11-24 20:45:15 -08:00
{
case m_none:
return;
case m_main:
2019-11-25 17:40:18 -08:00
M_Main_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_singleplayer:
2019-11-25 17:40:18 -08:00
M_SinglePlayer_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_load:
2019-11-25 17:40:18 -08:00
M_Load_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_save:
2019-11-25 17:40:18 -08:00
M_Save_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_multiplayer:
2019-11-25 17:40:18 -08:00
M_MultiPlayer_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_setup:
2019-11-25 17:40:18 -08:00
M_Setup_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_net:
2019-11-25 17:40:18 -08:00
M_Net_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_options:
2019-11-25 17:40:18 -08:00
M_Options_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_keys:
2019-11-25 17:40:18 -08:00
M_Keys_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_video:
2019-11-25 17:40:18 -08:00
M_Video_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_help:
2019-11-25 17:40:18 -08:00
M_Help_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_quit:
2019-11-25 17:40:18 -08:00
M_Quit_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_lanconfig:
2019-11-25 17:40:18 -08:00
M_LanConfig_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_gameoptions:
2019-11-25 17:40:18 -08:00
M_GameOptions_Key(key);
2019-11-24 20:45:15 -08:00
return;
case m_search:
2019-11-25 17:40:18 -08:00
M_Search_Key(key);
2019-11-24 20:45:15 -08:00
break;
case m_slist:
2019-11-25 17:40:18 -08:00
M_ServerList_Key(key);
2019-11-24 20:45:15 -08:00
return;
}
}
2019-11-25 17:40:18 -08:00
void M_Charinput(int32_t key)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(m_state)
2019-11-24 20:45:15 -08:00
{
case m_setup:
2019-11-25 17:40:18 -08:00
M_Setup_Char(key);
2019-11-24 20:45:15 -08:00
return;
case m_quit:
2019-11-25 17:40:18 -08:00
M_Quit_Char(key);
2019-11-24 20:45:15 -08:00
return;
case m_lanconfig:
2019-11-25 17:40:18 -08:00
M_LanConfig_Char(key);
2019-11-24 20:45:15 -08:00
return;
default:
return;
}
}
2019-11-25 17:40:18 -08:00
bool M_TextEntry(void)
2019-11-24 20:45:15 -08:00
{
2019-11-25 17:40:18 -08:00
switch(m_state)
2019-11-24 20:45:15 -08:00
{
case m_setup:
2019-11-25 17:40:18 -08:00
return M_Setup_TextEntry();
2019-11-24 20:45:15 -08:00
case m_quit:
2019-11-25 17:40:18 -08:00
return M_Quit_TextEntry();
2019-11-24 20:45:15 -08:00
case m_lanconfig:
2019-11-25 17:40:18 -08:00
return M_LanConfig_TextEntry();
2019-11-24 20:45:15 -08:00
default:
return false;
}
}
void M_ConfigureNetSubsystem(void)
{
// enable/disable net systems to match desired config
2019-11-25 17:40:18 -08:00
Cbuf_AddText("stopdemo\n");
2019-11-24 20:45:15 -08:00
2019-11-25 17:40:18 -08:00
if(IPXConfig || TCPIPConfig)
2019-11-24 20:45:15 -08:00
net_hostport = lanConfig_port;
}