2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
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
|
2005-11-03 23:49:49 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
#include "quakedef.h"
|
|
|
|
#include "winquake.h"
|
|
|
|
|
|
|
|
void M_Menu_Audio_f (void);
|
|
|
|
void M_Menu_Demos_f (void);
|
|
|
|
|
|
|
|
m_state_t m_state;
|
|
|
|
|
|
|
|
extern menu_t *menu_script;
|
|
|
|
|
|
|
|
qboolean m_recursiveDraw;
|
|
|
|
|
|
|
|
int m_return_state;
|
|
|
|
qboolean m_return_onerror;
|
|
|
|
char m_return_reason [32];
|
|
|
|
|
|
|
|
#define StartingGame (m_multiplayer_cursor == 1)
|
|
|
|
#define JoiningGame (m_multiplayer_cursor == 0)
|
|
|
|
#define SerialConfig (m_net_cursor == 0)
|
|
|
|
#define DirectConfig (m_net_cursor == 1)
|
|
|
|
#define IPXConfig (m_net_cursor == 2)
|
|
|
|
#define TCPIPConfig (m_net_cursor == 3)
|
|
|
|
|
|
|
|
void M_ConfigureNetSubsystem(void);
|
|
|
|
|
2006-02-11 02:09:43 +00:00
|
|
|
cvar_t m_helpismedia = SCVAR("m_helpismedia", "0");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* Support Routines */
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
M_DrawCharacter
|
|
|
|
|
|
|
|
Draws one solid graphics character
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void M_DrawCharacter (int cx, int line, unsigned int num)
|
|
|
|
{
|
|
|
|
Draw_Character ( cx + ((vid.width - 320)>>1), line, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_DrawColouredCharacter (int cx, int line, unsigned int num)
|
|
|
|
{
|
|
|
|
Draw_ColouredCharacter( cx + ((vid.width - 320)>>1), line, num);
|
|
|
|
}
|
|
|
|
void M_Print (int cx, int cy, qbyte *str)
|
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
2006-01-01 09:01:15 +00:00
|
|
|
M_DrawCharacter (cx, cy, (*str)|CON_HIGHCHARSMASK);
|
2004-08-23 00:15:46 +00:00
|
|
|
str++;
|
|
|
|
cx += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_PrintColoured (int cx, int cy, int colour, qbyte *str)
|
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
2006-01-29 03:38:43 +00:00
|
|
|
M_DrawColouredCharacter (cx, cy, (*str) + (colour<<CON_FGSHIFT));
|
2004-08-23 00:15:46 +00:00
|
|
|
str++;
|
|
|
|
cx += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_PrintWhite (int cx, int cy, qbyte *str)
|
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
M_DrawCharacter (cx, cy, *str);
|
|
|
|
str++;
|
|
|
|
cx += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-24 08:45:56 +00:00
|
|
|
void M_DrawTransPic (int x, int y, mpic_t *pic)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
Draw_TransPic (x + ((vid.width - 320)>>1), y, pic);
|
|
|
|
}
|
|
|
|
|
2004-12-24 08:45:56 +00:00
|
|
|
void M_DrawPic (int x, int y, mpic_t *pic)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
|
|
|
|
}
|
|
|
|
|
|
|
|
qbyte identityTable[256];
|
|
|
|
qbyte translationTable[256];
|
|
|
|
|
|
|
|
void M_BuildTranslationTable(int top, int bottom)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
qbyte *dest, *source;
|
|
|
|
|
|
|
|
for (j = 0; j < 256; j++)
|
|
|
|
identityTable[j] = j;
|
|
|
|
dest = translationTable;
|
|
|
|
source = identityTable;
|
|
|
|
memcpy (dest, source, 256);
|
|
|
|
|
|
|
|
if (top < 128) // the artists made some backwards ranges. sigh.
|
|
|
|
memcpy (dest + TOP_RANGE, source + top, 16);
|
|
|
|
else
|
|
|
|
for (j=0 ; j<16 ; j++)
|
|
|
|
dest[TOP_RANGE+j] = source[top+15-j];
|
|
|
|
|
|
|
|
if (bottom < 128)
|
|
|
|
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
|
|
|
|
else
|
|
|
|
for (j=0 ; j<16 ; j++)
|
2005-11-03 23:49:49 +00:00
|
|
|
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2005-02-12 18:56:04 +00:00
|
|
|
/*
|
2004-12-24 08:45:56 +00:00
|
|
|
void M_DrawTransPicTranslate (int x, int y, mpic_t *pic)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
|
2005-02-12 18:56:04 +00:00
|
|
|
}*/
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
void M_DrawTextBox (int x, int y, int width, int lines)
|
|
|
|
{
|
2004-12-24 08:45:56 +00:00
|
|
|
mpic_t *p;
|
2004-08-23 00:15:46 +00:00
|
|
|
int cx, cy;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
// draw left side
|
|
|
|
cx = x;
|
|
|
|
cy = y;
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_tl.lmp");
|
2005-09-28 23:30:10 +00:00
|
|
|
if (!p)
|
|
|
|
return; //assume we can't find any
|
|
|
|
M_DrawTransPic (cx, cy, p);
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_ml.lmp");
|
|
|
|
if (p)
|
|
|
|
for (n = 0; n < lines; n++)
|
|
|
|
{
|
|
|
|
cy += 8;
|
|
|
|
M_DrawTransPic (cx, cy, p);
|
|
|
|
}
|
|
|
|
p = Draw_SafeCachePic ("gfx/box_bl.lmp");
|
|
|
|
if (p)
|
|
|
|
M_DrawTransPic (cx, cy+8, p);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// draw middle
|
|
|
|
cx += 8;
|
|
|
|
while (width > 0)
|
|
|
|
{
|
|
|
|
cy = y;
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_tm.lmp");
|
|
|
|
if (p)
|
2004-08-23 00:15:46 +00:00
|
|
|
M_DrawTransPic (cx, cy, p);
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_mm.lmp");
|
|
|
|
if (p)
|
|
|
|
for (n = 0; n < lines; n++)
|
|
|
|
{
|
|
|
|
cy += 8;
|
|
|
|
if (n == 1)
|
2006-04-02 08:11:17 +00:00
|
|
|
{
|
|
|
|
p = Draw_SafeCachePic ("gfx/box_mm2.lmp");
|
|
|
|
if (!p)
|
|
|
|
break;
|
|
|
|
}
|
2005-06-14 04:52:10 +00:00
|
|
|
M_DrawTransPic (cx, cy, p);
|
|
|
|
}
|
|
|
|
p = Draw_SafeCachePic ("gfx/box_bm.lmp");
|
|
|
|
if (p)
|
|
|
|
M_DrawTransPic (cx, cy+8, p);
|
2004-08-23 00:15:46 +00:00
|
|
|
width -= 2;
|
|
|
|
cx += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw right side
|
|
|
|
cy = y;
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_tr.lmp");
|
|
|
|
if (p)
|
2004-08-23 00:15:46 +00:00
|
|
|
M_DrawTransPic (cx, cy, p);
|
2005-06-14 04:52:10 +00:00
|
|
|
p = Draw_SafeCachePic ("gfx/box_mr.lmp");
|
|
|
|
if (p)
|
|
|
|
for (n = 0; n < lines; n++)
|
|
|
|
{
|
|
|
|
cy += 8;
|
|
|
|
M_DrawTransPic (cx, cy, p);
|
|
|
|
}
|
|
|
|
p = Draw_SafeCachePic ("gfx/box_br.lmp");
|
|
|
|
if (p)
|
|
|
|
M_DrawTransPic (cx, cy+8, p);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
int m_save_demonum;
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
================
|
|
|
|
M_ToggleMenu_f
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void M_ToggleMenu_f (void)
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
if (m_state)
|
|
|
|
{
|
|
|
|
key_dest = key_menu;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-29 01:21:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2004-11-23 01:10:10 +00:00
|
|
|
if (MP_Toggle())
|
|
|
|
return;
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if (key_dest == key_menu)
|
|
|
|
{
|
|
|
|
key_dest = key_game;
|
|
|
|
m_state = m_none;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (key_dest == key_console)
|
|
|
|
{
|
|
|
|
if (cls.state != ca_active)
|
|
|
|
M_Menu_Main_f();
|
|
|
|
else
|
|
|
|
Con_ToggleConsole_f ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
M_Menu_Main_f ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* OPTIONS MENU */
|
|
|
|
#define SLIDER_RANGE 10
|
|
|
|
|
|
|
|
void M_DrawSlider (int x, int y, float range)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (range < 0)
|
|
|
|
range = 0;
|
|
|
|
if (range > 1)
|
|
|
|
range = 1;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_DrawCheckbox (int x, int y, int on)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
if (on)
|
|
|
|
M_DrawCharacter (x, y, 131);
|
|
|
|
else
|
|
|
|
M_DrawCharacter (x, y, 129);
|
|
|
|
#endif
|
|
|
|
if (on)
|
|
|
|
M_Print (x, y, "on");
|
|
|
|
else
|
|
|
|
M_Print (x, y, "off");
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* KEYS MENU */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *command;
|
|
|
|
char *name;
|
|
|
|
} bindnames_t;
|
|
|
|
|
|
|
|
bindnames_t qwbindnames[] =
|
|
|
|
{
|
2006-01-28 06:41:20 +00:00
|
|
|
{"+attack", "attack "},
|
|
|
|
{"impulse 10", "change weapon "},
|
|
|
|
{"impulse 12", "prev weapon "},
|
2004-08-23 00:15:46 +00:00
|
|
|
{"+jump", "jump / swim up"},
|
2006-01-28 06:41:20 +00:00
|
|
|
{"+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 "},
|
2004-08-23 00:15:46 +00:00
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
bindnames_t q2bindnames[] =
|
|
|
|
{
|
2006-01-28 06:41:20 +00:00
|
|
|
{"+attack", "attack "},
|
|
|
|
{"cmd weapnext", "next weapon "},
|
|
|
|
{"+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", "up / jump "},
|
|
|
|
{"+movedown", "down / crouch "},
|
|
|
|
|
|
|
|
{"cmd inven", "inventory "},
|
|
|
|
{"cmd invuse", "use item "},
|
|
|
|
{"cmd invdrop", "drop item "},
|
|
|
|
{"cmd invprev", "prev item "},
|
|
|
|
{"cmd invnext", "next item "},
|
|
|
|
|
|
|
|
{"cmd help", "help computer "},
|
2004-08-23 00:15:46 +00:00
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-05-25 22:16:29 +00:00
|
|
|
|
|
|
|
bindnames_t h2bindnames[] =
|
|
|
|
{
|
|
|
|
{"+attack", "attack "},
|
|
|
|
{"impulse 10", "change 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 "},
|
|
|
|
{"+crouch", "crouch "},
|
|
|
|
{"+lookup", "look up "},
|
|
|
|
{"+lookdown", "look down "},
|
|
|
|
{"centerview", "center view "},
|
|
|
|
{"+mlook", "mouse look "},
|
|
|
|
{"+klook", "keyboard look "},
|
|
|
|
{"+moveup", "swim up "},
|
|
|
|
{"+movedown", "swim down "},
|
|
|
|
{"impulse 13", "lift object "},
|
|
|
|
{"invuse", "use inv item "},
|
|
|
|
{"impulse 44", "drop inv item "},
|
|
|
|
{"+showinfo", "full inventory"},
|
|
|
|
{"+showdm", "info / frags "},
|
|
|
|
//{"toggle_dm", "toggle frags "},
|
|
|
|
//{"+infoplaque", "objectives "}, //requires pulling info out of the mod... on the client.
|
|
|
|
{"invleft", "inv move left "},
|
|
|
|
{"invright", "inv move right"},
|
|
|
|
{"impulse 100", "inv:torch "},
|
|
|
|
{"impulse 101", "inv:qrtz flask"},
|
|
|
|
{"impulse 102", "inv:mystic urn"},
|
|
|
|
{"impulse 103", "inv:krater "},
|
|
|
|
{"impulse 104", "inv:chaos devc"},
|
|
|
|
{"impulse 105", "inv:tome power"},
|
|
|
|
{"impulse 106", "inv:summon stn"},
|
|
|
|
{"impulse 107", "inv:invisiblty"},
|
|
|
|
{"impulse 108", "inv:glyph "},
|
|
|
|
{"impulse 109", "inv:boots "},
|
|
|
|
{"impulse 110", "inv:repulsion "},
|
|
|
|
{"impulse 111", "inv:bo peep "},
|
|
|
|
{"impulse 112", "inv:flight "},
|
|
|
|
{"impulse 113", "inv:force cube"},
|
|
|
|
{"impulse 114", "inv:icon defn "},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
bindnames_t *bindnames;
|
|
|
|
int numbindnames;
|
|
|
|
|
|
|
|
int keys_cursor;
|
|
|
|
int bind_grab;
|
|
|
|
|
|
|
|
void M_Menu_Keys_f (void)
|
2006-01-28 06:41:20 +00:00
|
|
|
{
|
|
|
|
int y;
|
|
|
|
menu_t *menu;
|
2007-05-25 22:16:29 +00:00
|
|
|
int mgt;
|
2006-01-29 00:50:13 +00:00
|
|
|
|
2006-01-28 06:41:20 +00:00
|
|
|
key_dest = key_menu;
|
|
|
|
m_state = m_complex;
|
|
|
|
|
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
|
|
|
|
MC_AddCenterPicture(menu, 4, "gfx/ttl_cstm.lmp");
|
|
|
|
|
2007-05-25 22:16:29 +00:00
|
|
|
mgt = M_GameType();
|
2006-01-28 06:41:20 +00:00
|
|
|
#ifdef Q2CLIENT
|
2007-05-25 22:16:29 +00:00
|
|
|
if (mgt == MGT_QUAKE2) //quake2 main menu.
|
2006-01-28 06:41:20 +00:00
|
|
|
bindnames = q2bindnames;
|
|
|
|
else
|
|
|
|
#endif
|
2007-05-25 22:16:29 +00:00
|
|
|
if (mgt == MGT_HEXEN2)
|
|
|
|
bindnames = h2bindnames;
|
|
|
|
else
|
2006-01-28 06:41:20 +00:00
|
|
|
bindnames = qwbindnames;
|
|
|
|
|
|
|
|
y = 48;
|
|
|
|
while (bindnames->name)
|
|
|
|
{
|
|
|
|
MC_AddBind(menu, 16, y, bindnames->name, bindnames->command);
|
|
|
|
y += 8;
|
|
|
|
|
|
|
|
bindnames++;
|
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
void M_FindKeysForCommand (char *command, int *twokeys)
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
int j;
|
|
|
|
int l;
|
|
|
|
char *b;
|
|
|
|
|
|
|
|
twokeys[0] = twokeys[1] = -1;
|
|
|
|
l = strlen(command);
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
for (j=0 ; j<256 ; j++)
|
|
|
|
{
|
|
|
|
b = keybindings[j][0];
|
|
|
|
if (!b)
|
|
|
|
continue;
|
|
|
|
if (!strncmp (b, command, l) )
|
|
|
|
{
|
|
|
|
twokeys[count] = j;
|
|
|
|
count++;
|
|
|
|
if (count == 2)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_UnbindCommand (char *command)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
int l;
|
|
|
|
char *b;
|
|
|
|
|
|
|
|
l = strlen(command);
|
|
|
|
|
|
|
|
for (j=0 ; j<256 ; j++)
|
|
|
|
{
|
|
|
|
b = keybindings[j][0];
|
|
|
|
if (!b)
|
|
|
|
continue;
|
|
|
|
if (!strncmp (b, command, l) )
|
|
|
|
Key_SetBinding (j, ~0, "", RESTRICT_LOCAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Keys_Draw (void)
|
|
|
|
{
|
|
|
|
int i, l;
|
|
|
|
int keys[2];
|
|
|
|
char *name;
|
|
|
|
int x, y;
|
2004-12-24 08:45:56 +00:00
|
|
|
mpic_t *p;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
p = Draw_SafeCachePic ("gfx/ttl_cstm.lmp");
|
|
|
|
if (p)
|
|
|
|
M_DrawPic ( (320-p->width)/2, 4, p);
|
|
|
|
|
|
|
|
if (bind_grab)
|
|
|
|
M_Print (12, 32, "Press a key or button for this action");
|
|
|
|
else
|
|
|
|
M_Print (18, 32, "Enter to change, backspace to clear");
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// search for known bindings
|
|
|
|
for (i=0 ; ; i++)
|
|
|
|
{
|
|
|
|
if (!bindnames[i].command)
|
|
|
|
break;
|
|
|
|
y = 48 + 8*i;
|
|
|
|
|
|
|
|
M_Print (16, y, bindnames[i].name);
|
|
|
|
|
|
|
|
l = strlen (bindnames[i].command);
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
M_FindKeysForCommand (bindnames[i].command, keys);
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if (keys[0] == -1)
|
|
|
|
{
|
|
|
|
M_Print (140, y, "???");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
name = Key_KeynumToString (keys[0]);
|
|
|
|
M_Print (140, y, name);
|
|
|
|
x = strlen(name) * 8;
|
|
|
|
if (keys[1] != -1)
|
|
|
|
{
|
|
|
|
M_Print (140 + x + 8, y, "or");
|
|
|
|
M_Print (140 + x + 32, y, Key_KeynumToString (keys[1]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if (bind_grab)
|
|
|
|
M_DrawCharacter (130, 48 + keys_cursor*8, '=');
|
|
|
|
else
|
|
|
|
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Keys_Key (int k)
|
|
|
|
{
|
|
|
|
char cmd[80];
|
|
|
|
int keys[2];
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if (bind_grab)
|
|
|
|
{ // defining a key
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
if (k == K_ESCAPE)
|
|
|
|
{
|
|
|
|
bind_grab = false;
|
|
|
|
}
|
|
|
|
else if (k != '`')
|
|
|
|
{
|
2006-02-17 19:54:47 +00:00
|
|
|
sprintf (cmd, "bind %s \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor].command);
|
2006-02-06 01:06:17 +00:00
|
|
|
Cbuf_InsertText (cmd, RESTRICT_LOCAL, false);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
bind_grab = false;
|
|
|
|
return;
|
|
|
|
}
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
switch (k)
|
|
|
|
{
|
|
|
|
case K_ESCAPE:
|
|
|
|
M_Menu_Options_f ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case K_LEFTARROW:
|
|
|
|
case K_UPARROW:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
keys_cursor--;
|
|
|
|
if (keys_cursor < 0)
|
|
|
|
keys_cursor = numbindnames-1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case K_DOWNARROW:
|
|
|
|
case K_RIGHTARROW:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
keys_cursor++;
|
|
|
|
if (keys_cursor >= numbindnames)
|
|
|
|
keys_cursor = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case K_ENTER: // go into bind mode
|
|
|
|
M_FindKeysForCommand (bindnames[keys_cursor].command, keys);
|
|
|
|
S_LocalSound ("misc/menu2.wav");
|
|
|
|
if (keys[1] != -1)
|
|
|
|
M_UnbindCommand (bindnames[keys_cursor].command);
|
|
|
|
bind_grab = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case K_BACKSPACE: // delete bindings
|
|
|
|
case K_DEL: // delete bindings
|
|
|
|
S_LocalSound ("misc/menu2.wav");
|
|
|
|
M_UnbindCommand (bindnames[keys_cursor].command);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* HELP MENU */
|
|
|
|
|
|
|
|
int help_page;
|
|
|
|
char *helpstyle;
|
|
|
|
int num_help_pages;
|
|
|
|
int helppagemin;
|
|
|
|
|
|
|
|
|
|
|
|
void M_Menu_Help_f (void)
|
2005-11-03 23:49:49 +00:00
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
key_dest = key_menu;
|
|
|
|
m_state = m_help;
|
|
|
|
help_page = 0;
|
|
|
|
|
|
|
|
if (COM_FDepthFile("gfx/help1.lmp", true) < COM_FDepthFile("gfx/menu/help1.lmp", true))
|
|
|
|
{
|
|
|
|
helpstyle = "gfx/help%i.lmp";
|
|
|
|
num_help_pages = 6;
|
|
|
|
helppagemin=0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
helpstyle = "gfx/menu/help%02i.lmp";
|
|
|
|
num_help_pages = 5;
|
|
|
|
helppagemin = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_Help_Draw (void)
|
|
|
|
{
|
2004-12-24 08:45:56 +00:00
|
|
|
mpic_t *pic;
|
2004-08-23 00:15:46 +00:00
|
|
|
pic = Draw_SafeCachePic(va(helpstyle, help_page+helppagemin));
|
|
|
|
if (!pic)
|
|
|
|
M_Menu_Main_f ();
|
|
|
|
else
|
|
|
|
M_DrawPic (0, 0, pic);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Help_Key (int key)
|
|
|
|
{
|
|
|
|
switch (key)
|
|
|
|
{
|
|
|
|
case K_ESCAPE:
|
|
|
|
M_Menu_Main_f ();
|
|
|
|
break;
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_UPARROW:
|
|
|
|
case K_RIGHTARROW:
|
2006-01-01 09:01:15 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
2004-08-23 00:15:46 +00:00
|
|
|
if (++help_page >= num_help_pages)
|
|
|
|
help_page = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case K_DOWNARROW:
|
|
|
|
case K_LEFTARROW:
|
2006-01-01 09:01:15 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
2004-08-23 00:15:46 +00:00
|
|
|
if (--help_page < 0)
|
|
|
|
help_page = num_help_pages-1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* QUIT MENU */
|
|
|
|
|
|
|
|
int msgNumber;
|
|
|
|
int m_quit_prevstate;
|
|
|
|
qboolean wasInMenus;
|
|
|
|
|
2005-11-03 23:49:49 +00:00
|
|
|
char *quitMessage [] =
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
/* .........1.........2.... */
|
|
|
|
" Are you gonna quit ",
|
|
|
|
" this game just like ",
|
|
|
|
" everything else? ",
|
|
|
|
" ",
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
" Milord, methinks that ",
|
|
|
|
" thou art a lowly ",
|
|
|
|
" quitter. Is this true? ",
|
|
|
|
" ",
|
|
|
|
|
|
|
|
" Do I need to bust your ",
|
|
|
|
" face open for trying ",
|
|
|
|
" to quit? ",
|
|
|
|
" ",
|
|
|
|
|
|
|
|
" Man, I oughta smack you",
|
|
|
|
" for trying to quit! ",
|
|
|
|
" Press Y to get ",
|
|
|
|
" smacked out. ",
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
" Press Y to quit like a ",
|
|
|
|
" big loser in life. ",
|
|
|
|
" Press N to stay proud ",
|
|
|
|
" and successful! ",
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
" If you press Y to ",
|
|
|
|
" quit, I will summon ",
|
|
|
|
" Satan all over your ",
|
|
|
|
" hard drive! ",
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
" Um, Asmodeus dislikes ",
|
|
|
|
" his children trying to ",
|
|
|
|
" quit. Press Y to return",
|
|
|
|
" to your Tinkertoys. ",
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
" If you quit now, I'll ",
|
|
|
|
" throw a blanket-party ",
|
|
|
|
" for you next time! ",
|
|
|
|
" "
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
void OldM_Menu_Quit_f (void)
|
|
|
|
{
|
|
|
|
if (m_state == m_quit)
|
|
|
|
return;
|
|
|
|
wasInMenus = (key_dest == key_menu);
|
|
|
|
key_dest = key_menu;
|
|
|
|
m_quit_prevstate = m_state;
|
|
|
|
m_state = m_quit;
|
|
|
|
m_entersound = true;
|
|
|
|
msgNumber = rand()&7;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Quit_Key (int key)
|
|
|
|
{
|
|
|
|
switch (key)
|
|
|
|
{
|
|
|
|
case K_ESCAPE:
|
|
|
|
case 'n':
|
|
|
|
case 'N':
|
|
|
|
if (wasInMenus)
|
|
|
|
{
|
|
|
|
m_state = m_quit_prevstate;
|
|
|
|
m_entersound = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
key_dest = key_game;
|
|
|
|
m_state = m_none;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y':
|
|
|
|
case 'y':
|
|
|
|
key_dest = key_console;
|
|
|
|
CL_Disconnect ();
|
|
|
|
Sys_Quit ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_Quit_Draw (void)
|
|
|
|
{
|
|
|
|
#define VSTR(x) #x
|
|
|
|
#define VSTR2(x) VSTR(x)
|
|
|
|
char *cmsg[] = {
|
|
|
|
// 0123456789012345678901234567890123456789
|
|
|
|
"0 QuakeWorld",
|
|
|
|
"1 version " VSTR2(VERSION),
|
|
|
|
"1modified by Forethought Entertainment",
|
2005-11-03 23:49:49 +00:00
|
|
|
"0Based on QuakeWorld Version 2.40",
|
2004-08-23 00:15:46 +00:00
|
|
|
"1",
|
|
|
|
"0Additional Programming",
|
|
|
|
"1 David Walton",
|
|
|
|
"1",
|
|
|
|
"0Id Software is not responsible for",
|
|
|
|
"0providing technical support for",
|
|
|
|
"0QUAKEWORLD(tm). (c)1996 Id Software,",
|
|
|
|
"0Inc. All Rights Reserved.",
|
|
|
|
"0QUAKEWORLD(tm) is a trademark of Id",
|
|
|
|
"0Software, Inc.",
|
|
|
|
"1NOTICE: THE COPYRIGHT AND TRADEMARK",
|
|
|
|
"1NOTICES APPEARING IN YOUR COPY OF",
|
|
|
|
"1QUAKE(r) ARE NOT MODIFIED BY THE USE",
|
|
|
|
"1OF QUAKEWORLD(tm) AND REMAIN IN FULL",
|
|
|
|
"1FORCE.",
|
|
|
|
"0NIN(r) is a registered trademark",
|
|
|
|
"0licensed to Nothing Interactive, Inc.",
|
|
|
|
"0All rights reserved. Press y to exit",
|
|
|
|
NULL };
|
|
|
|
char **p;
|
|
|
|
int y;
|
|
|
|
|
|
|
|
if (wasInMenus)
|
|
|
|
{
|
|
|
|
m_state = m_quit_prevstate;
|
|
|
|
m_recursiveDraw = true;
|
|
|
|
M_Draw ();
|
|
|
|
m_state = m_quit;
|
|
|
|
}
|
|
|
|
#if 1
|
|
|
|
M_DrawTextBox (0, 0, 38, 23);
|
|
|
|
y = 12;
|
|
|
|
for (p = cmsg; *p; p++, y += 8) {
|
|
|
|
if (**p == '0')
|
|
|
|
M_PrintWhite (16, y, *p + 1);
|
|
|
|
else
|
|
|
|
M_Print (16, y, *p + 1);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
M_DrawTextBox (56, 76, 24, 4);
|
|
|
|
M_Print (64, 84, quitMessage[msgNumber*4+0]);
|
|
|
|
M_Print (64, 92, quitMessage[msgNumber*4+1]);
|
|
|
|
M_Print (64, 100, quitMessage[msgNumber*4+2]);
|
|
|
|
M_Print (64, 108, quitMessage[msgNumber*4+3]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
qboolean MC_Quit_Key (int key, menu_t *menu)
|
|
|
|
{
|
|
|
|
switch (key)
|
|
|
|
{
|
|
|
|
case K_ESCAPE:
|
|
|
|
case 'n':
|
|
|
|
case 'N':
|
|
|
|
M_RemoveMenu(menu);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y':
|
|
|
|
case 'y':
|
|
|
|
M_RemoveMenu(menu);
|
|
|
|
key_dest = key_console;
|
|
|
|
CL_Disconnect ();
|
|
|
|
Sys_Quit ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
menu_t quitmenu;
|
|
|
|
void M_Menu_Quit_f (void)
|
2005-11-03 23:49:49 +00:00
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
int i;
|
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
if (1)
|
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
CL_Disconnect ();
|
|
|
|
Sys_Quit ();
|
2009-04-01 22:03:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
key_dest = key_menu;
|
|
|
|
m_state = m_complex;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
M_RemoveMenu(&quitmenu);
|
|
|
|
memset(&quitmenu, 0, sizeof(quitmenu));
|
|
|
|
M_AddMenuFront(&quitmenu);
|
|
|
|
quitmenu.exclusive = false;
|
|
|
|
quitmenu.key = MC_Quit_Key;
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
i = rand()&7;
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
MC_AddWhiteText(&quitmenu, 64, 84, quitMessage[i*4+0], false);
|
|
|
|
MC_AddWhiteText(&quitmenu, 64, 92, quitMessage[i*4+1], false);
|
|
|
|
MC_AddWhiteText(&quitmenu, 64, 100, quitMessage[i*4+2], false);
|
|
|
|
MC_AddWhiteText(&quitmenu, 64, 108, quitMessage[i*4+3], false);
|
|
|
|
MC_AddBox (&quitmenu, 56, 76, 24, 4);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/* Menu Subsystem */
|
|
|
|
|
2006-02-28 00:46:04 +00:00
|
|
|
void M_Menu_ServerList2_f(void);
|
2006-12-25 18:29:05 +00:00
|
|
|
void M_QuickConnect_f(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
void M_Menu_MediaFiles_f (void);
|
2004-11-23 01:10:10 +00:00
|
|
|
void M_Menu_FPS_f (void);
|
|
|
|
void M_Menu_Particles_f (void);
|
2005-03-28 00:11:59 +00:00
|
|
|
void M_Menu_ParticleSets_f (void);
|
2005-01-13 16:29:20 +00:00
|
|
|
void M_Menu_Audio_Speakers_f (void);
|
2005-04-16 16:21:27 +00:00
|
|
|
void Menu_DownloadStuff_f (void);
|
2004-11-23 01:10:10 +00:00
|
|
|
static qboolean internalmenusregistered;
|
|
|
|
void M_Init_Internal (void)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2004-11-29 01:21:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2004-11-23 01:10:10 +00:00
|
|
|
MP_Shutdown();
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-11-23 01:10:10 +00:00
|
|
|
|
|
|
|
if (internalmenusregistered)
|
|
|
|
return;
|
|
|
|
internalmenusregistered = true;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifndef CLIENTONLY
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_save", M_Menu_Save_f);
|
|
|
|
Cmd_AddRemCommand ("menu_load", M_Menu_Load_f);
|
|
|
|
Cmd_AddRemCommand ("menu_loadgame", M_Menu_Load_f); //q2...
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_single", M_Menu_SinglePlayer_f);
|
|
|
|
Cmd_AddRemCommand ("menu_multi", M_Menu_MultiPlayer_f);
|
|
|
|
Cmd_AddRemCommand ("menu_demo", M_Menu_Demos_f);
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_keys", M_Menu_Keys_f);
|
|
|
|
Cmd_AddRemCommand ("help", M_Menu_Help_f);
|
|
|
|
Cmd_AddRemCommand ("menu_quit", M_Menu_Quit_f);
|
|
|
|
Cmd_AddRemCommand ("menu_media", M_Menu_Media_f);
|
|
|
|
Cmd_AddRemCommand ("menu_mediafiles", M_Menu_MediaFiles_f);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
#ifdef CL_MASTER
|
2006-04-05 03:15:08 +00:00
|
|
|
Cmd_AddRemCommand ("menu_servers", M_Menu_ServerList2_f);
|
2006-02-28 00:46:04 +00:00
|
|
|
|
2006-04-05 03:15:08 +00:00
|
|
|
Cmd_AddRemCommand ("menu_serversold", M_Menu_ServerList_f);
|
|
|
|
Cmd_AddRemCommand ("menu_slist", M_Menu_ServerList2_f);
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_setup", M_Menu_Setup_f);
|
|
|
|
Cmd_AddRemCommand ("menu_newmulti", M_Menu_GameOptions_f);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_main", M_Menu_Main_f); //I've moved main to last because that way tab give us main and not quit.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_options", M_Menu_Options_f);
|
|
|
|
Cmd_AddRemCommand ("menu_video", M_Menu_Video_f);
|
|
|
|
Cmd_AddRemCommand ("menu_audio", M_Menu_Audio_f);
|
2005-12-15 19:15:39 +00:00
|
|
|
#ifndef __CYGWIN__
|
2005-01-13 16:29:20 +00:00
|
|
|
Cmd_AddRemCommand ("menu_speakers", M_Menu_Audio_Speakers_f);
|
2005-12-15 19:15:39 +00:00
|
|
|
#endif
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_AddRemCommand ("menu_fps", M_Menu_FPS_f);
|
|
|
|
Cmd_AddRemCommand ("menu_particles", M_Menu_Particles_f);
|
2005-03-28 00:11:59 +00:00
|
|
|
Cmd_AddRemCommand ("menu_particlesets", M_Menu_ParticleSets_f);
|
2005-04-16 16:21:27 +00:00
|
|
|
|
2005-11-03 23:49:49 +00:00
|
|
|
#ifdef WEBCLIENT
|
2005-04-16 16:21:27 +00:00
|
|
|
Cmd_AddRemCommand ("menu_download", Menu_DownloadStuff_f);
|
|
|
|
#endif
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
Cmd_AddRemCommand ("quickconnect", M_QuickConnect_f);
|
2004-11-23 01:10:10 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
void M_DeInit_Internal (void)
|
|
|
|
{
|
2005-11-03 23:49:49 +00:00
|
|
|
M_RemoveAllMenus();
|
2004-11-23 01:10:10 +00:00
|
|
|
|
|
|
|
if (!internalmenusregistered)
|
|
|
|
return;
|
|
|
|
internalmenusregistered = false;
|
|
|
|
|
|
|
|
#ifndef CLIENTONLY
|
|
|
|
Cmd_RemoveCommand ("menu_save");
|
|
|
|
Cmd_RemoveCommand ("menu_load");
|
|
|
|
Cmd_RemoveCommand ("menu_loadgame"); //q2...
|
|
|
|
#endif
|
|
|
|
Cmd_RemoveCommand ("menu_single");
|
|
|
|
Cmd_RemoveCommand ("menu_multi");
|
|
|
|
Cmd_RemoveCommand ("menu_demo");
|
2005-11-03 23:49:49 +00:00
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_RemoveCommand ("menu_keys");
|
|
|
|
Cmd_RemoveCommand ("help");
|
|
|
|
Cmd_RemoveCommand ("menu_quit");
|
|
|
|
Cmd_RemoveCommand ("menu_media");
|
|
|
|
Cmd_RemoveCommand ("menu_mediafiles");
|
|
|
|
|
|
|
|
#ifdef CL_MASTER
|
|
|
|
Cmd_RemoveCommand ("menu_servers");
|
2006-04-05 03:15:08 +00:00
|
|
|
Cmd_RemoveCommand ("menu_servers2");
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_RemoveCommand ("menu_slist");
|
|
|
|
#endif
|
|
|
|
Cmd_RemoveCommand ("menu_setup");
|
|
|
|
Cmd_RemoveCommand ("menu_newmulti");
|
|
|
|
Cmd_RemoveCommand ("menu_main"); //I've moved main to last because that way tab give us main and not quit.
|
|
|
|
|
|
|
|
Cmd_RemoveCommand ("menu_options");
|
|
|
|
Cmd_RemoveCommand ("menu_video");
|
|
|
|
Cmd_RemoveCommand ("menu_audio");
|
2005-09-14 04:07:57 +00:00
|
|
|
Cmd_RemoveCommand ("menu_speakers");
|
2004-11-23 01:10:10 +00:00
|
|
|
Cmd_RemoveCommand ("menu_fps");
|
|
|
|
Cmd_RemoveCommand ("menu_particles");
|
2005-03-28 00:11:59 +00:00
|
|
|
Cmd_RemoveCommand ("menu_particlesets");
|
2005-04-16 16:21:27 +00:00
|
|
|
|
|
|
|
Cmd_RemoveCommand ("menu_download");
|
2006-12-25 18:29:05 +00:00
|
|
|
|
|
|
|
Cmd_RemoveCommand ("quickconnect");
|
2004-11-23 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2005-09-14 20:56:34 +00:00
|
|
|
void FPS_Preset_f(void);
|
|
|
|
|
2004-11-23 01:10:10 +00:00
|
|
|
//menu.dat is loaded later... after the video and everything is up.
|
|
|
|
void M_Init (void)
|
|
|
|
{
|
|
|
|
M_Init_Internal();
|
|
|
|
|
|
|
|
Cmd_AddCommand("togglemenu", M_ToggleMenu_f);
|
2005-09-14 20:56:34 +00:00
|
|
|
Cmd_AddCommand("fps_preset", FPS_Preset_f);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
Cvar_Register(&m_helpismedia, "Menu thingumiebobs");
|
|
|
|
|
|
|
|
Media_Init();
|
|
|
|
#ifdef CL_MASTER
|
|
|
|
M_Serverlist_Init();
|
|
|
|
#endif
|
|
|
|
M_Script_Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Draw (int uimenu)
|
|
|
|
{
|
|
|
|
if (uimenu)
|
|
|
|
{
|
|
|
|
if (uimenu == 2)
|
|
|
|
Draw_FadeScreen ();
|
2005-09-09 23:40:55 +00:00
|
|
|
#ifdef VM_UI
|
2004-08-23 00:15:46 +00:00
|
|
|
UI_DrawMenu();
|
2005-09-09 23:40:55 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state != m_complex)
|
|
|
|
{
|
|
|
|
M_RemoveAllMenus();
|
|
|
|
}
|
|
|
|
if (key_dest != key_menu)
|
|
|
|
{
|
|
|
|
m_state = m_none;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state == m_none)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((!menu_script || scr_con_current) && !m_recursiveDraw)
|
|
|
|
{
|
|
|
|
scr_copyeverything = 1;
|
2009-04-06 00:34:32 +00:00
|
|
|
Draw_FadeScreen ();
|
2004-08-23 00:15:46 +00:00
|
|
|
scr_fullupdate = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_recursiveDraw = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (m_state)
|
|
|
|
{
|
|
|
|
case m_none:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case m_keys:
|
|
|
|
M_Keys_Draw ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case m_help:
|
|
|
|
M_Help_Draw ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case m_slist:
|
|
|
|
M_ServerList_Draw ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case m_media:
|
|
|
|
M_Media_Draw ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case m_complex:
|
|
|
|
M_Complex_Draw ();
|
|
|
|
break;
|
2004-09-30 22:42:34 +00:00
|
|
|
#ifdef PLUGINS
|
2004-09-26 00:30:42 +00:00
|
|
|
case m_plugin:
|
|
|
|
Plug_Menu_Event (0, (int)(realtime*1000));
|
|
|
|
break;
|
2004-09-30 22:42:34 +00:00
|
|
|
#endif
|
2004-11-29 01:21:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2004-11-23 01:10:10 +00:00
|
|
|
case m_menu_dat:
|
2007-06-20 00:02:54 +00:00
|
|
|
// MP_Draw();
|
2004-11-23 01:10:10 +00:00
|
|
|
return;
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Keydown (int key)
|
|
|
|
{
|
|
|
|
switch (m_state)
|
|
|
|
{
|
|
|
|
case m_none:
|
|
|
|
key_dest = key_console;
|
|
|
|
return;
|
|
|
|
|
|
|
|
case m_keys:
|
|
|
|
M_Keys_Key (key);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case m_help:
|
|
|
|
M_Help_Key (key);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case m_slist:
|
|
|
|
M_ServerList_Key (key);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case m_media:
|
|
|
|
M_Media_Key (key);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case m_complex:
|
|
|
|
M_Complex_Key (key);
|
|
|
|
return;
|
2004-09-30 22:42:34 +00:00
|
|
|
#ifdef PLUGINS
|
2004-09-26 00:30:42 +00:00
|
|
|
case m_plugin:
|
|
|
|
Plug_Menu_Event (1, key);
|
|
|
|
return;
|
2004-09-30 22:42:34 +00:00
|
|
|
#endif
|
2004-11-29 01:21:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2004-11-23 01:10:10 +00:00
|
|
|
case m_menu_dat:
|
|
|
|
MP_Keydown(key);
|
|
|
|
return;
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_Keyup (int key)
|
|
|
|
{
|
|
|
|
switch (m_state)
|
|
|
|
{
|
2004-09-30 22:42:34 +00:00
|
|
|
#ifdef PLUGINS
|
2004-09-26 00:30:42 +00:00
|
|
|
case m_plugin:
|
|
|
|
Plug_Menu_Event (2, key);
|
|
|
|
return;
|
2004-09-30 22:42:34 +00:00
|
|
|
#endif
|
2004-11-29 01:21:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2004-11-23 01:10:10 +00:00
|
|
|
case m_menu_dat:
|
|
|
|
MP_Keyup(key);
|
|
|
|
return;
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-09-13 04:16:52 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-15 22:51:01 +00:00
|
|
|
// Generic function to choose which game menu to draw
|
|
|
|
int M_GameType (void)
|
|
|
|
{
|
2009-04-06 00:34:32 +00:00
|
|
|
int cached;
|
2005-03-15 22:51:01 +00:00
|
|
|
int q1, h2, q2;
|
|
|
|
|
|
|
|
q1 = COM_FDepthFile("gfx/sp_menu.lmp", true);
|
|
|
|
h2 = COM_FDepthFile("gfx/menu/title2.lmp", true);
|
|
|
|
q2 = COM_FDepthFile("pics/m_banner_game.pcx", true);
|
|
|
|
|
|
|
|
if (q2 < h2 && q2 < q1)
|
2009-04-06 00:34:32 +00:00
|
|
|
cached = MGT_QUAKE2;
|
2005-03-15 22:51:01 +00:00
|
|
|
else if (h2 < q1)
|
2009-04-06 00:34:32 +00:00
|
|
|
cached = MGT_HEXEN2;
|
|
|
|
else
|
|
|
|
cached = MGT_QUAKE1;
|
2005-03-15 22:51:01 +00:00
|
|
|
|
2009-04-06 00:34:32 +00:00
|
|
|
return cached;
|
2005-03-15 22:51:01 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|