2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 enum m_state_e m_state;
32 void M_Menu_Main_f (void);
33 void M_Menu_SinglePlayer_f (void);
34 void M_Menu_Load_f (void);
35 void M_Menu_Save_f (void);
36 void M_Menu_MultiPlayer_f (void);
37 void M_Menu_Setup_f (void);
38 void M_Menu_Options_f (void);
39 void M_Menu_Options_Effects_f (void);
40 void M_Menu_Options_ColorControl_f (void);
41 void M_Menu_Keys_f (void);
42 void M_Menu_Video_f (void);
43 void M_Menu_Help_f (void);
44 void M_Menu_Quit_f (void);
45 void M_Menu_LanConfig_f (void);
46 void M_Menu_GameOptions_f (void);
47 void M_Menu_ServerList_f (void);
49 void M_Main_Draw (void);
50 void M_SinglePlayer_Draw (void);
51 void M_Load_Draw (void);
52 void M_Save_Draw (void);
53 void M_MultiPlayer_Draw (void);
54 void M_Setup_Draw (void);
55 void M_Options_Draw (void);
56 void M_Options_Effects_Draw (void);
57 void M_Options_ColorControl_Draw (void);
58 void M_Keys_Draw (void);
59 void M_Video_Draw (void);
60 void M_Help_Draw (void);
61 void M_Quit_Draw (void);
62 void M_LanConfig_Draw (void);
63 void M_GameOptions_Draw (void);
64 void M_ServerList_Draw (void);
66 void M_Main_Key (int key);
67 void M_SinglePlayer_Key (int key);
68 void M_Load_Key (int key);
69 void M_Save_Key (int key);
70 void M_MultiPlayer_Key (int key);
71 void M_Setup_Key (int key);
72 void M_Options_Key (int key);
73 void M_Options_Effects_Key (int key);
74 void M_Options_ColorControl_Key (int key);
75 void M_Keys_Key (int key);
76 void M_Video_Key (int key);
77 void M_Help_Key (int key);
78 void M_Quit_Key (int key);
79 void M_LanConfig_Key (int key);
80 void M_GameOptions_Key (int key);
81 void M_ServerList_Key (int key);
83 qboolean m_entersound; // play after drawing a frame, so caching
84 // won't disrupt the sound
86 char m_return_reason [32];
88 #define StartingGame (m_multiplayer_cursor == 1)
89 #define JoiningGame (m_multiplayer_cursor == 0)
92 #define NumberOfNehahraDemos 34
99 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
101 {"intro", "Prologue"},
102 {"genf", "The Beginning"},
103 {"genlab", "A Doomed Project"},
104 {"nehcre", "The New Recruits"},
105 {"maxneh", "Breakthrough"},
106 {"maxchar", "Renewal and Duty"},
107 {"crisis", "Worlds Collide"},
108 {"postcris", "Darkening Skies"},
109 {"hearing", "The Hearing"},
110 {"getjack", "On a Mexican Radio"},
111 {"prelude", "Honor and Justice"},
112 {"abase", "A Message Sent"},
113 {"effect", "The Other Side"},
114 {"uhoh", "Missing in Action"},
115 {"prepare", "The Response"},
116 {"vision", "Farsighted Eyes"},
117 {"maxturns", "Enter the Immortal"},
118 {"backlot", "Separate Ways"},
119 {"maxside", "The Ancient Runes"},
120 {"counter", "The New Initiative"},
121 {"warprep", "Ghosts to the World"},
122 {"counter1", "A Fate Worse Than Death"},
123 {"counter2", "Friendly Fire"},
124 {"counter3", "Minor Setback"},
125 {"madmax", "Scores to Settle"},
126 {"quake", "One Man"},
127 {"cthmm", "Shattered Masks"},
128 {"shades", "Deal with the Dead"},
129 {"gophil", "An Unlikely Hero"},
130 {"cstrike", "War in Hell"},
131 {"shubset", "The Conspiracy"},
132 {"shubdie", "Even Death May Die"},
133 {"newranks", "An Empty Throne"},
134 {"seal", "The Seal is Broken"}
137 float menu_x, menu_y, menu_width, menu_height;
139 void M_Background(int width, int height)
142 menu_height = height;
143 menu_x = (vid.conwidth - menu_width) * 0.5;
144 menu_y = (vid.conheight - menu_height) * 0.5;
145 DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
146 //DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
153 Draws one solid graphics character
156 void M_DrawCharacter (float cx, float cy, int num)
161 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
164 void M_Print (float cx, float cy, const char *str)
166 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
169 void M_PrintWhite (float cx, float cy, const char *str)
171 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
174 void M_ItemPrint (float cx, float cy, char *str, int unghosted)
177 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
179 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
182 void M_DrawPic (float cx, float cy, char *picname)
184 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
187 qbyte identityTable[256];
188 qbyte translationTable[256];
190 void M_BuildTranslationTable(int top, int bottom)
193 qbyte *dest, *source;
195 for (j = 0; j < 256; j++)
196 identityTable[j] = j;
197 dest = translationTable;
198 source = identityTable;
199 memcpy (dest, source, 256);
201 // LordHavoc: corrected skin color ranges
202 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
203 memcpy (dest + TOP_RANGE, source + top, 16);
205 for (j=0 ; j<16 ; j++)
206 dest[TOP_RANGE+j] = source[top+15-j];
208 // LordHavoc: corrected skin color ranges
209 if (bottom < 128 || (bottom >= 224 && bottom < 240))
210 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
212 for (j=0 ; j<16 ; j++)
213 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
217 void M_DrawTextBox (float x, float y, float width, float height)
225 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
226 for (n = 0; n < height; n++)
229 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
231 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
238 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
239 for (n = 0; n < height; n++)
243 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
245 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
247 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
254 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
255 for (n = 0; n < height; n++)
258 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
260 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
263 //=============================================================================
265 //int m_save_demonum;
272 void M_ToggleMenu_f (void)
276 if (key_dest != key_menu || m_state != m_main)
287 void M_Demo_Draw (void)
291 M_Background(320, 200);
293 for (i = 0;i < NumberOfNehahraDemos;i++)
294 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
297 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
301 void M_Menu_Demos_f (void)
308 void M_Demo_Key (int k)
317 S_LocalSound ("misc/menu2.wav");
320 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
325 S_LocalSound ("misc/menu1.wav");
328 demo_cursor = NumberOfNehahraDemos;
333 S_LocalSound ("misc/menu1.wav");
335 if (demo_cursor > NumberOfNehahraDemos)
341 //=============================================================================
346 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
348 void M_Menu_Main_f (void)
350 if (gamemode == GAME_NEHAHRA)
352 if (NehGameType == TYPE_DEMO)
354 else if (NehGameType == TYPE_GAME)
363 if (key_dest != key_menu)
365 m_save_demonum = cls.demonum;
375 void M_Main_Draw (void)
380 M_Background(320, 200);
382 M_DrawPic (16, 4, "gfx/qplaque.lmp");
383 p = Draw_CachePic ("gfx/ttl_main.lmp");
384 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
386 if (gamemode == GAME_NEHAHRA)
388 if (NehGameType == TYPE_BOTH)
389 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
390 else if (NehGameType == TYPE_GAME)
391 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
393 M_DrawPic (72, 32, "gfx/demomenu.lmp");
396 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
398 f = (int)(realtime * 10)%6;
400 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
404 void M_Main_Key (int key)
411 //cls.demonum = m_save_demonum;
412 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
417 S_LocalSound ("misc/menu1.wav");
418 if (++m_main_cursor >= MAIN_ITEMS)
423 S_LocalSound ("misc/menu1.wav");
424 if (--m_main_cursor < 0)
425 m_main_cursor = MAIN_ITEMS - 1;
431 if (gamemode == GAME_NEHAHRA)
436 switch (m_main_cursor)
439 M_Menu_SinglePlayer_f ();
447 M_Menu_MultiPlayer_f ();
457 Cbuf_AddText ("disconnect\n");
458 Cbuf_AddText ("playdemo endcred\n");
467 switch (m_main_cursor)
470 M_Menu_SinglePlayer_f ();
474 M_Menu_MultiPlayer_f ();
484 Cbuf_AddText ("disconnect\n");
485 Cbuf_AddText ("playdemo endcred\n");
494 switch (m_main_cursor)
503 Cbuf_AddText ("disconnect\n");
504 Cbuf_AddText ("playdemo endcred\n");
520 switch (m_main_cursor)
523 M_Menu_SinglePlayer_f ();
527 M_Menu_MultiPlayer_f ();
546 //=============================================================================
547 /* SINGLE PLAYER MENU */
549 int m_singleplayer_cursor;
550 #define SINGLEPLAYER_ITEMS 3
553 void M_Menu_SinglePlayer_f (void)
556 m_state = m_singleplayer;
561 void M_SinglePlayer_Draw (void)
565 M_Background(320, 200);
567 M_DrawPic (16, 4, "gfx/qplaque.lmp");
568 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
570 // Transfusion doesn't have a single player mode
571 if (gamemode == GAME_TRANSFUSION)
573 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
575 M_DrawTextBox (60, 8 * 8, 23, 4);
576 M_PrintWhite (95, 10 * 8, "Transfusion is for");
577 M_PrintWhite (83, 11 * 8, "multiplayer play only");
583 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
584 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
586 f = (int)(realtime * 10)%6;
588 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
593 void M_SinglePlayer_Key (int key)
595 if (gamemode == GAME_TRANSFUSION)
597 if (key == K_ESCAPE || key == K_ENTER)
609 S_LocalSound ("misc/menu1.wav");
610 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
611 m_singleplayer_cursor = 0;
615 S_LocalSound ("misc/menu1.wav");
616 if (--m_singleplayer_cursor < 0)
617 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
623 switch (m_singleplayer_cursor)
628 Cbuf_AddText ("disconnect\n");
629 Cbuf_AddText ("maxplayers 1\n");
630 Cbuf_AddText ("deathmatch 0\n");
631 Cbuf_AddText ("coop 0\n");
632 if (gamemode == GAME_NEHAHRA)
633 Cbuf_AddText ("map nehstart\n");
635 Cbuf_AddText ("map start\n");
649 //=============================================================================
652 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
654 #define MAX_SAVEGAMES 12
655 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
656 int loadable[MAX_SAVEGAMES];
658 void M_ScanSaves (void)
661 char name[MAX_OSPATH];
666 for (i=0 ; i<MAX_SAVEGAMES ; i++)
668 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
670 sprintf (name, "s%i.sav", i);
671 f = FS_Open (name, "r", false);
674 str = FS_Getline (f);
675 sscanf (str, "%i\n", &version);
676 str = FS_Getline (f);
677 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
679 // change _ back to space
680 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
681 if (m_filenames[i][j] == '_')
682 m_filenames[i][j] = ' ';
688 void M_Menu_Load_f (void)
697 void M_Menu_Save_f (void)
703 if (svs.maxclients != 1)
712 void M_Load_Draw (void)
717 M_Background(320, 200);
719 p = Draw_CachePic ("gfx/p_load.lmp");
720 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
722 for (i=0 ; i< MAX_SAVEGAMES; i++)
723 M_Print (16, 32 + 8*i, m_filenames[i]);
726 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
730 void M_Save_Draw (void)
735 M_Background(320, 200);
737 p = Draw_CachePic ("gfx/p_save.lmp");
738 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
740 for (i=0 ; i<MAX_SAVEGAMES ; i++)
741 M_Print (16, 32 + 8*i, m_filenames[i]);
744 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
748 void M_Load_Key (int k)
753 M_Menu_SinglePlayer_f ();
757 S_LocalSound ("misc/menu2.wav");
758 if (!loadable[load_cursor])
763 // issue the load command
764 Cbuf_AddText (va ("load s%i\n", load_cursor) );
769 S_LocalSound ("misc/menu1.wav");
772 load_cursor = MAX_SAVEGAMES-1;
777 S_LocalSound ("misc/menu1.wav");
779 if (load_cursor >= MAX_SAVEGAMES)
786 void M_Save_Key (int k)
791 M_Menu_SinglePlayer_f ();
797 Cbuf_AddText (va("save s%i\n", load_cursor));
802 S_LocalSound ("misc/menu1.wav");
805 load_cursor = MAX_SAVEGAMES-1;
810 S_LocalSound ("misc/menu1.wav");
812 if (load_cursor >= MAX_SAVEGAMES)
818 //=============================================================================
819 /* MULTIPLAYER MENU */
821 int m_multiplayer_cursor;
822 #define MULTIPLAYER_ITEMS 3
825 void M_Menu_MultiPlayer_f (void)
828 m_state = m_multiplayer;
833 void M_MultiPlayer_Draw (void)
838 M_Background(320, 200);
840 M_DrawPic (16, 4, "gfx/qplaque.lmp");
841 p = Draw_CachePic ("gfx/p_multi.lmp");
842 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
843 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
845 f = (int)(realtime * 10)%6;
847 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
851 void M_MultiPlayer_Key (int key)
860 S_LocalSound ("misc/menu1.wav");
861 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
862 m_multiplayer_cursor = 0;
866 S_LocalSound ("misc/menu1.wav");
867 if (--m_multiplayer_cursor < 0)
868 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
873 switch (m_multiplayer_cursor)
877 M_Menu_LanConfig_f ();
887 //=============================================================================
890 int setup_cursor = 4;
891 int setup_cursor_table[] = {40, 56, 80, 104, 140};
893 char setup_hostname[16];
894 char setup_myname[16];
900 #define NUM_SETUP_CMDS 5
902 void M_Menu_Setup_f (void)
907 strcpy(setup_myname, cl_name.string);
908 strcpy(setup_hostname, hostname.string);
909 setup_top = setup_oldtop = cl_color.integer >> 4;
910 setup_bottom = setup_oldbottom = cl_color.integer & 15;
913 // LordHavoc: rewrote this code greatly
914 void M_MenuPlayerTranslate (qbyte *translation, int top, int bottom)
917 unsigned int trans[4096];
919 static qbyte pixels[4096];
920 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load = true, menuplyr_failed = false;
924 if (menuplyr_top == top && menuplyr_bottom == bottom)
928 menuplyr_bottom = bottom;
932 menuplyr_load = false;
933 f = FS_LoadFile("gfx/menuplyr.lmp", true);
936 menuplyr_failed = true;
939 data = LoadLMPAs8Bit (f, 0, 0);
941 if (image_width * image_height > 4096)
943 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
945 menuplyr_failed = true;
948 menuplyr_width = image_width;
949 menuplyr_height = image_height;
950 memcpy(pixels, data, menuplyr_width * menuplyr_height);
954 M_BuildTranslationTable (menuplyr_top*16, menuplyr_bottom*16);
956 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
957 trans[i] = palette_complete[translation[pixels[i]]];
959 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)trans);
962 void M_Setup_Draw (void)
966 M_Background(320, 200);
968 M_DrawPic (16, 4, "gfx/qplaque.lmp");
969 p = Draw_CachePic ("gfx/p_multi.lmp");
970 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
972 M_Print (64, 40, "Hostname");
973 M_DrawTextBox (160, 32, 16, 1);
974 M_Print (168, 40, setup_hostname);
976 M_Print (64, 56, "Your name");
977 M_DrawTextBox (160, 48, 16, 1);
978 M_Print (168, 56, setup_myname);
980 M_Print (64, 80, "Shirt color");
981 M_Print (64, 104, "Pants color");
983 M_DrawTextBox (64, 140-8, 14, 1);
984 M_Print (72, 140, "Accept Changes");
986 M_DrawPic (160, 64, "gfx/bigbox.lmp");
988 // LordHavoc: rewrote this code greatly
989 M_MenuPlayerTranslate (translationTable, setup_top, setup_bottom);
990 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
992 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
994 if (setup_cursor == 0)
995 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
997 if (setup_cursor == 1)
998 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1002 void M_Setup_Key (int k)
1009 M_Menu_MultiPlayer_f ();
1013 S_LocalSound ("misc/menu1.wav");
1015 if (setup_cursor < 0)
1016 setup_cursor = NUM_SETUP_CMDS-1;
1020 S_LocalSound ("misc/menu1.wav");
1022 if (setup_cursor >= NUM_SETUP_CMDS)
1027 if (setup_cursor < 2)
1029 S_LocalSound ("misc/menu3.wav");
1030 if (setup_cursor == 2)
1031 setup_top = setup_top - 1;
1032 if (setup_cursor == 3)
1033 setup_bottom = setup_bottom - 1;
1036 if (setup_cursor < 2)
1039 S_LocalSound ("misc/menu3.wav");
1040 if (setup_cursor == 2)
1041 setup_top = setup_top + 1;
1042 if (setup_cursor == 3)
1043 setup_bottom = setup_bottom + 1;
1047 if (setup_cursor == 0 || setup_cursor == 1)
1050 if (setup_cursor == 2 || setup_cursor == 3)
1053 // setup_cursor == 4 (OK)
1054 if (strcmp(cl_name.string, setup_myname) != 0)
1055 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1056 if (strcmp(hostname.string, setup_hostname) != 0)
1057 Cvar_Set("hostname", setup_hostname);
1058 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1059 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1060 m_entersound = true;
1061 M_Menu_MultiPlayer_f ();
1065 if (setup_cursor == 0)
1067 if (strlen(setup_hostname))
1068 setup_hostname[strlen(setup_hostname)-1] = 0;
1071 if (setup_cursor == 1)
1073 if (strlen(setup_myname))
1074 setup_myname[strlen(setup_myname)-1] = 0;
1079 if (k < 32 || k > 127)
1081 if (setup_cursor == 0)
1083 l = strlen(setup_hostname);
1086 setup_hostname[l+1] = 0;
1087 setup_hostname[l] = k;
1090 if (setup_cursor == 1)
1092 l = strlen(setup_myname);
1095 setup_myname[l+1] = 0;
1096 setup_myname[l] = k;
1105 if (setup_bottom > 15)
1107 if (setup_bottom < 0)
1111 //=============================================================================
1114 #define SLIDER_RANGE 10
1116 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1121 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1122 M_DrawCharacter (x-8, y, 128);
1123 for (i = 0;i < SLIDER_RANGE;i++)
1124 M_DrawCharacter (x + i*8, y, 129);
1125 M_DrawCharacter (x+i*8, y, 130);
1126 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1127 sprintf(text, "%g", num);
1128 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1131 void M_DrawCheckbox (int x, int y, int on)
1134 M_Print (x, y, "on");
1136 M_Print (x, y, "off");
1140 #define OPTIONS_ITEMS 28
1144 void M_Menu_Options_f (void)
1146 key_dest = key_menu;
1147 m_state = m_options;
1148 m_entersound = true;
1151 extern cvar_t gl_delayfinish;
1152 extern cvar_t slowmo;
1153 extern dllhandle_t jpeg_dll;
1155 void M_Menu_Options_AdjustSliders (int dir)
1157 S_LocalSound ("misc/menu3.wav");
1159 switch (options_cursor)
1162 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1165 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1168 if (jpeg_dll != NULL)
1169 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1172 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1175 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1178 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1181 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1184 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1187 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1189 case 15: // music volume
1191 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1193 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1196 case 16: // sfx volume
1197 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1200 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1203 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1205 case 19: // static crosshair
1206 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1208 case 20: // show framerate
1209 Cvar_SetValueQuick (&showfps, !showfps.integer);
1211 case 21: // always run
1212 if (cl_forwardspeed.value > 200)
1214 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1215 Cvar_SetValueQuick (&cl_backspeed, 200);
1219 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1220 Cvar_SetValueQuick (&cl_backspeed, 400);
1223 case 22: // lookspring
1224 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1226 case 23: // lookstrafe
1227 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1229 case 24: // mouse speed
1230 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1232 case 25: // mouse look
1233 Cvar_SetValueQuick (&freelook, !freelook.integer);
1235 case 26: // invert mouse
1236 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1238 case 27: // windowed mouse
1239 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1244 void M_Options_Draw (void)
1249 M_Background(320, 240);
1251 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1252 p = Draw_CachePic("gfx/p_option.lmp");
1253 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1256 M_Print(16, y, " Customize controls");y += 8;
1257 M_Print(16, y, " Go to console");y += 8;
1258 M_Print(16, y, " Reset to defaults");y += 8;
1259 M_Print(16, y, " Video Options");y += 8;
1260 M_Print(16, y, " Effects Options");y += 8;
1261 M_Print(16, y, " Color Control Options");y += 8;
1262 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value, 0, 1);y += 8;
1263 M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8;
1264 M_ItemPrint(16, y, " JPEG screenshots", jpeg_dll != NULL);M_DrawCheckbox(220, y, scr_screenshot_jpeg.integer);y += 8;
1265 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1266 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8;
1267 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1268 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1269 M_Print(16, y, "Delay refresh (faster)");M_DrawCheckbox(220, y, gl_delayfinish.integer);y += 8;
1270 M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8;
1271 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8;
1272 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8;
1273 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8;
1274 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8;
1275 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1276 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1277 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1278 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1279 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1280 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, sensitivity.value, 1, 50);y += 8;
1281 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1282 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1283 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1286 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1290 void M_Options_Key (int k)
1299 m_entersound = true;
1300 switch (options_cursor)
1307 key_dest = key_game;
1308 Con_ToggleConsole_f ();
1311 Cbuf_AddText ("exec default.cfg\n");
1317 M_Menu_Options_Effects_f ();
1320 M_Menu_Options_ColorControl_f ();
1323 M_Menu_Options_AdjustSliders (1);
1329 S_LocalSound ("misc/menu1.wav");
1331 if (options_cursor < 0)
1332 options_cursor = OPTIONS_ITEMS-1;
1336 S_LocalSound ("misc/menu1.wav");
1338 if (options_cursor >= OPTIONS_ITEMS)
1343 M_Menu_Options_AdjustSliders (-1);
1347 M_Menu_Options_AdjustSliders (1);
1352 #define OPTIONS_EFFECTS_ITEMS 16
1354 int options_effects_cursor;
1356 void M_Menu_Options_Effects_f (void)
1358 key_dest = key_menu;
1359 m_state = m_options_effects;
1360 m_entersound = true;
1364 extern cvar_t r_detailtextures;
1365 extern cvar_t cl_particles;
1366 extern cvar_t cl_explosions;
1367 extern cvar_t cl_stainmaps;
1368 extern cvar_t r_explosionclip;
1369 extern cvar_t r_dlightmap;
1370 extern cvar_t r_modellights;
1371 extern cvar_t r_coronas;
1372 extern cvar_t gl_flashblend;
1373 extern cvar_t cl_particles_bulletimpacts;
1374 extern cvar_t cl_particles_smoke;
1375 extern cvar_t cl_particles_sparks;
1376 extern cvar_t cl_particles_bubbles;
1377 extern cvar_t cl_particles_blood;
1378 extern cvar_t cl_particles_blood_size;
1379 extern cvar_t cl_particles_blood_alpha;
1381 void M_Menu_Options_Effects_AdjustSliders (int dir)
1383 S_LocalSound ("misc/menu3.wav");
1385 switch (options_effects_cursor)
1388 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1391 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1394 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1397 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1400 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1403 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1406 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1409 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1412 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1415 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1418 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1421 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1424 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1427 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1430 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1433 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1438 void M_Options_Effects_Draw (void)
1443 M_Background(320, 200);
1445 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1446 p = Draw_CachePic("gfx/p_option.lmp");
1447 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1450 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value, 0, 8);y += 8;
1451 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1452 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1453 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1454 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1455 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1456 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1457 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1458 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1459 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1460 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1461 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1462 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1463 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1464 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, cl_particles_blood_size.value, 2, 20);y += 8;
1465 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, cl_particles_blood_alpha.value, 0.2, 1);y += 8;
1468 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1472 void M_Options_Effects_Key (int k)
1477 M_Menu_Options_f ();
1481 M_Menu_Options_Effects_AdjustSliders (1);
1485 S_LocalSound ("misc/menu1.wav");
1486 options_effects_cursor--;
1487 if (options_effects_cursor < 0)
1488 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1492 S_LocalSound ("misc/menu1.wav");
1493 options_effects_cursor++;
1494 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1495 options_effects_cursor = 0;
1499 M_Menu_Options_Effects_AdjustSliders (-1);
1503 M_Menu_Options_Effects_AdjustSliders (1);
1512 #define OPTIONS_COLORCONTROL_ITEMS 18
1514 int options_colorcontrol_cursor;
1516 // intensity value to match up to 50% dither to 'correct' quake
1517 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1519 void M_Menu_Options_ColorControl_f (void)
1521 key_dest = key_menu;
1522 m_state = m_options_colorcontrol;
1523 m_entersound = true;
1527 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1530 S_LocalSound ("misc/menu3.wav");
1532 switch (options_colorcontrol_cursor)
1535 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1538 Cvar_SetValueQuick (&v_color_enable, 0);
1539 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1542 Cvar_SetValueQuick (&v_color_enable, 0);
1543 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1546 Cvar_SetValueQuick (&v_color_enable, 0);
1547 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1550 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1553 Cvar_SetValueQuick (&v_color_enable, 1);
1554 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1557 Cvar_SetValueQuick (&v_color_enable, 1);
1558 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1561 Cvar_SetValueQuick (&v_color_enable, 1);
1562 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1565 Cvar_SetValueQuick (&v_color_enable, 1);
1566 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1567 Cvar_SetValueQuick (&v_color_black_r, f);
1568 Cvar_SetValueQuick (&v_color_black_g, f);
1569 Cvar_SetValueQuick (&v_color_black_b, f);
1572 Cvar_SetValueQuick (&v_color_enable, 1);
1573 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1576 Cvar_SetValueQuick (&v_color_enable, 1);
1577 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1580 Cvar_SetValueQuick (&v_color_enable, 1);
1581 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1584 Cvar_SetValueQuick (&v_color_enable, 1);
1585 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1586 Cvar_SetValueQuick (&v_color_grey_r, f);
1587 Cvar_SetValueQuick (&v_color_grey_g, f);
1588 Cvar_SetValueQuick (&v_color_grey_b, f);
1591 Cvar_SetValueQuick (&v_color_enable, 1);
1592 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1595 Cvar_SetValueQuick (&v_color_enable, 1);
1596 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1599 Cvar_SetValueQuick (&v_color_enable, 1);
1600 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1603 Cvar_SetValueQuick (&v_color_enable, 1);
1604 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1605 Cvar_SetValueQuick (&v_color_white_r, f);
1606 Cvar_SetValueQuick (&v_color_white_g, f);
1607 Cvar_SetValueQuick (&v_color_white_b, f);
1612 void M_Options_ColorControl_Draw (void)
1614 float x, y, c, s, t, u, v;
1617 M_Background(320, 256);
1619 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1620 p = Draw_CachePic("gfx/p_option.lmp");
1621 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1624 M_Print(16, y, " Reset to defaults");y += 8;
1625 M_ItemPrint(16, y, "Hardware Gamma Control", vid_hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1626 M_ItemPrint(16, y, " Gamma", !v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_gamma.value, 1, 5);y += 8;
1627 M_ItemPrint(16, y, " Contrast", !v_color_enable.integer);M_DrawSlider(220, y, v_contrast.value, 1, 5);y += 8;
1628 M_ItemPrint(16, y, " Brightness", !v_color_enable.integer);M_DrawSlider(220, y, v_brightness.value, 0, 0.8);y += 8;
1629 M_Print(16, y, " Color Level Controls");M_DrawCheckbox(220, y, v_color_enable.integer);y += 8;
1630 M_ItemPrint(16, y, " Black: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_r.value, 0, 0.8);y += 8;
1631 M_ItemPrint(16, y, " Black: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_g.value, 0, 0.8);y += 8;
1632 M_ItemPrint(16, y, " Black: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_b.value, 0, 0.8);y += 8;
1633 M_ItemPrint(16, y, " Black: Grey ", v_color_enable.integer);M_DrawSlider(220, y, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3, 0, 0.8);y += 8;
1634 M_ItemPrint(16, y, " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_r.value, 0, 0.95);y += 8;
1635 M_ItemPrint(16, y, " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_g.value, 0, 0.95);y += 8;
1636 M_ItemPrint(16, y, " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_b.value, 0, 0.95);y += 8;
1637 M_ItemPrint(16, y, " Grey: Grey ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3, 0, 0.95);y += 8;
1638 M_ItemPrint(16, y, " White: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_r.value, 1, 5);y += 8;
1639 M_ItemPrint(16, y, " White: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_g.value, 1, 5);y += 8;
1640 M_ItemPrint(16, y, " White: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_b.value, 1, 5);y += 8;
1641 M_ItemPrint(16, y, " White: Grey ", v_color_enable.integer);M_DrawSlider(220, y, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3, 1, 5);y += 8;
1644 DrawQ_Fill(menu_x, menu_y + y, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);y += 4;
1645 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1646 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1647 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);y += 4;
1648 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,0,0,1, 0,1, 0,0,0,1, 1,1, 1,0,0,1, 0);y += 4;
1649 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);y += 4;
1650 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,1,0,1, 0,1, 0,0,0,1, 1,1, 0,1,0,1, 0);y += 4;
1651 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);y += 4;
1652 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,0,1,1, 0,1, 0,0,0,1, 1,1, 0,0,1,1, 0);y += 4;
1653 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);y += 4;
1654 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);y += 4;
1656 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1657 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1658 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1663 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, 0, 0, 1, 0);
1664 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);
1665 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,0,0,1, u,0, 1,0,0,1, 0,v, 1,0,0,1, u,v, 1,0,0,1, 0);
1667 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, c, 0, 1, 0);
1668 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);
1669 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,1,0,1, u,0, 0,1,0,1, 0,v, 0,1,0,1, u,v, 0,1,0,1, 0);
1671 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, 0, c, 1, 0);
1672 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);
1673 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,0,1,1, u,0, 0,0,1,1, 0,v, 0,0,1,1, u,v, 0,0,1,1, 0);
1675 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, c, c, 1, 0);
1676 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);
1677 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,1,1,1, u,0, 1,1,1,1, 0,v, 1,1,1,1, u,v, 1,1,1,1, 0);
1680 M_DrawCharacter(200, 32 + options_colorcontrol_cursor*8, 12+((int)(realtime*4)&1));
1684 void M_Options_ColorControl_Key (int k)
1693 m_entersound = true;
1694 switch (options_colorcontrol_cursor)
1697 Cvar_SetValueQuick(&v_hwgamma, 1);
1698 Cvar_SetValueQuick(&v_gamma, 1);
1699 Cvar_SetValueQuick(&v_contrast, 1);
1700 Cvar_SetValueQuick(&v_brightness, 0);
1701 Cvar_SetValueQuick(&v_color_enable, 0);
1702 Cvar_SetValueQuick(&v_color_black_r, 0);
1703 Cvar_SetValueQuick(&v_color_black_g, 0);
1704 Cvar_SetValueQuick(&v_color_black_b, 0);
1705 Cvar_SetValueQuick(&v_color_grey_r, 0);
1706 Cvar_SetValueQuick(&v_color_grey_g, 0);
1707 Cvar_SetValueQuick(&v_color_grey_b, 0);
1708 Cvar_SetValueQuick(&v_color_white_r, 1);
1709 Cvar_SetValueQuick(&v_color_white_g, 1);
1710 Cvar_SetValueQuick(&v_color_white_b, 1);
1711 Cbuf_AddText ("exec default.cfg\n");
1714 M_Menu_Options_ColorControl_AdjustSliders (1);
1720 S_LocalSound ("misc/menu1.wav");
1721 options_colorcontrol_cursor--;
1722 if (options_colorcontrol_cursor < 0)
1723 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1727 S_LocalSound ("misc/menu1.wav");
1728 options_colorcontrol_cursor++;
1729 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1730 options_colorcontrol_cursor = 0;
1734 M_Menu_Options_ColorControl_AdjustSliders (-1);
1738 M_Menu_Options_ColorControl_AdjustSliders (1);
1744 //=============================================================================
1747 char *quakebindnames[][2] =
1749 {"+attack", "attack"},
1750 {"impulse 10", "next weapon"},
1751 {"impulse 12", "previous weapon"},
1752 {"+jump", "jump / swim up"},
1753 {"+forward", "walk forward"},
1754 {"+back", "backpedal"},
1755 {"+left", "turn left"},
1756 {"+right", "turn right"},
1758 {"+moveleft", "step left"},
1759 {"+moveright", "step right"},
1760 {"+strafe", "sidestep"},
1761 {"+lookup", "look up"},
1762 {"+lookdown", "look down"},
1763 {"centerview", "center view"},
1764 {"+mlook", "mouse look"},
1765 {"+klook", "keyboard look"},
1766 {"+moveup", "swim up"},
1767 {"+movedown", "swim down"}
1770 char *transfusionbindnames[][2] =
1772 {"+forward", "walk forward"},
1773 {"+back", "backpedal"},
1774 {"+left", "turn left"},
1775 {"+right", "turn right"},
1776 {"+moveleft", "step left"},
1777 {"+moveright", "step right"},
1778 {"+jump", "jump / swim up"},
1779 {"+movedown", "swim down"},
1780 {"+attack", "attack"},
1781 {"+button3", "altfire"},
1782 {"impulse 1", "Pitch Fork"},
1783 {"impulse 2", "Flare Gun"},
1784 {"impulse 3", "Shotgun"},
1785 {"impulse 4", "Machine Gun"},
1786 {"impulse 5", "Incinerator"},
1787 {"impulse 6", "Bombs"},
1788 {"impulse 7", "Aerosol Can"},
1789 {"impulse 8", "Tesla Cannon"},
1790 {"impulse 9", "Life Leech"},
1791 {"impulse 17", "Voodoo Doll"},
1792 {"impulse 11", "previous weapon"},
1793 {"impulse 10", "next weapon"},
1794 {"impulse 14", "previous item"},
1795 {"impulse 15", "next item"},
1796 {"impulse 13", "use item"},
1797 {"impulse 100", "add bot (red)"},
1798 {"impulse 101", "add bot (blue)"},
1799 {"impulse 102", "kick a bot"},
1800 {"impulse 50", "voting menu"},
1801 {"impulse 141", "identify player"},
1802 {"impulse 16", "next armor type"},
1803 {"impulse 20", "observer mode"}
1807 char *(*bindnames)[2];
1810 typedef struct binditem_s
1812 char *command, *description;
1813 struct binditem_s *next;
1817 typedef struct bindcategory_s
1821 struct bindcategory_s *next;
1825 bindcategory_t *bindcategories = NULL;
1827 void M_ClearBinds (void)
1829 for (c = bindcategories;c;c = cnext)
1832 for (b = c->binds;b;b = bnext)
1839 bindcategories = NULL;
1842 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1844 for (b = &c->binds;*b;*b = &(*b)->next);
1845 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1846 *b->command = (char *)((*b) + 1);
1847 *b->description = *b->command + strlen(command) + 1;
1848 strcpy(*b->command, command);
1849 strcpy(*b->description, description);
1852 void M_AddBind (char *category, char *command, char *description)
1854 for (c = &bindcategories;*c;c = &(*c)->next)
1856 if (!strcmp(category, (*c)->name))
1858 M_AddBindToCategory(*c, command, description);
1862 *c = Z_Alloc(sizeof(bindcategory_t));
1863 M_AddBindToCategory(*c, command, description);
1866 void M_DefaultBinds (void)
1869 M_AddBind("movement", "+jump", "jump / swim up");
1870 M_AddBind("movement", "+forward", "walk forward");
1871 M_AddBind("movement", "+back", "backpedal");
1872 M_AddBind("movement", "+left", "turn left");
1873 M_AddBind("movement", "+right", "turn right");
1874 M_AddBind("movement", "+speed", "run");
1875 M_AddBind("movement", "+moveleft", "step left");
1876 M_AddBind("movement", "+moveright", "step right");
1877 M_AddBind("movement", "+strafe", "sidestep");
1878 M_AddBind("movement", "+lookup", "look up");
1879 M_AddBind("movement", "+lookdown", "look down");
1880 M_AddBind("movement", "centerview", "center view");
1881 M_AddBind("movement", "+mlook", "mouse look");
1882 M_AddBind("movement", "+klook", "keyboard look");
1883 M_AddBind("movement", "+moveup", "swim up");
1884 M_AddBind("movement", "+movedown", "swim down");
1885 M_AddBind("weapons", "+attack", "attack");
1886 M_AddBind("weapons", "impulse 10", "next weapon");
1887 M_AddBind("weapons", "impulse 12", "previous weapon");
1888 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1889 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1890 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1891 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1892 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1893 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1894 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1895 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1903 void M_Menu_Keys_f (void)
1905 key_dest = key_menu;
1907 m_entersound = true;
1912 void M_FindKeysForCommand (char *command, int *keys)
1918 for (j = 0;j < NUMKEYS;j++)
1923 for (j=0 ; j<256 ; j++)
1928 if (!strcmp (b, command) )
1931 if (count == NUMKEYS)
1937 void M_UnbindCommand (char *command)
1942 for (j=0 ; j<256 ; j++)
1947 if (!strcmp (b, command))
1948 Key_SetBinding (j, "");
1953 void M_Keys_Draw (void)
1959 char keystring[1024];
1961 M_Background(320, 200);
1963 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1964 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1967 M_Print (12, 32, "Press a key or button for this action");
1969 M_Print (18, 32, "Enter to change, backspace to clear");
1971 // search for known bindings
1972 for (i=0 ; i<numcommands ; i++)
1976 M_Print (16, y, bindnames[i][1]);
1978 M_FindKeysForCommand (bindnames[i][0], keys);
1980 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1982 strcpy(keystring, "???");
1986 for (j = 0;j < NUMKEYS;j++)
1991 strcat(keystring, " or ");
1992 strcat(keystring, Key_KeynumToString (keys[j]));
1996 M_Print (150, y, keystring);
2000 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2002 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2006 void M_Keys_Key (int k)
2013 S_LocalSound ("misc/menu1.wav");
2018 else //if (k != '`')
2020 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2021 Cbuf_InsertText (cmd);
2031 M_Menu_Options_f ();
2036 S_LocalSound ("misc/menu1.wav");
2038 if (keys_cursor < 0)
2039 keys_cursor = numcommands-1;
2044 S_LocalSound ("misc/menu1.wav");
2046 if (keys_cursor >= numcommands)
2050 case K_ENTER: // go into bind mode
2051 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2052 S_LocalSound ("misc/menu2.wav");
2053 if (keys[NUMKEYS - 1] != -1)
2054 M_UnbindCommand (bindnames[keys_cursor][0]);
2058 case K_BACKSPACE: // delete bindings
2059 case K_DEL: // delete bindings
2060 S_LocalSound ("misc/menu2.wav");
2061 M_UnbindCommand (bindnames[keys_cursor][0]);
2066 //=============================================================================
2069 #define VIDEO_ITEMS 5
2071 int video_cursor = 0;
2072 int video_cursor_table[] = {56, 68, 80, 92, 116};
2073 // note: if modes are added to the beginning of this list, update the
2074 // video_resolution = x; in M_Menu_Video_f below
2075 unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,480}, {800,600}, {1024,768}, {1152,864}, {1280,960}, {1280,1024}, {1600,1200}, {1792,1344}, {1920,1440}, {2048,1536}};
2076 int video_resolution;
2078 extern int current_vid_fullscreen;
2079 extern int current_vid_width;
2080 extern int current_vid_height;
2081 extern int current_vid_bitsperpixel;
2082 extern int current_vid_stencil;
2085 void M_Menu_Video_f (void)
2087 key_dest = key_menu;
2089 m_entersound = true;
2091 // Look for the current resolution
2092 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
2094 if (video_resolutions[video_resolution][0] == current_vid_width &&
2095 video_resolutions[video_resolution][1] == current_vid_height)
2099 // Default to 800x600 if we didn't find it
2100 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
2102 // may need to update this number if mode list changes
2103 video_resolution = 4;
2104 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2105 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2110 void M_Video_Draw (void)
2115 M_Background(320, 200);
2117 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2118 p = Draw_CachePic("gfx/vidmodes.lmp");
2119 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2122 M_Print(16, video_cursor_table[0], " Resolution");
2123 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2124 M_Print (220, video_cursor_table[0], string);
2127 M_Print(16, video_cursor_table[1], " Bits per pixel");
2128 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2131 M_Print(16, video_cursor_table[2], " Fullscreen");
2132 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2135 M_Print(16, video_cursor_table[3], " Stencil");
2136 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2139 M_Print(220, video_cursor_table[4], "Apply");
2142 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2146 void M_Menu_Video_AdjustSliders (int dir)
2148 S_LocalSound ("misc/menu3.wav");
2150 switch (video_cursor)
2155 int new_resolution = video_resolution + dir;
2156 if (new_resolution < 0)
2157 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2158 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2159 video_resolution = 0;
2161 video_resolution = new_resolution;
2163 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2164 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2170 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2173 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2176 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2182 void M_Video_Key (int key)
2187 // vid_shared.c has a copy of the current video config. We restore it
2188 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2189 Cvar_SetValueQuick(&vid_width, current_vid_width);
2190 Cvar_SetValueQuick(&vid_height, current_vid_height);
2191 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2192 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2194 S_LocalSound ("misc/menu1.wav");
2195 M_Menu_Options_f ();
2199 m_entersound = true;
2200 switch (video_cursor)
2203 Cbuf_AddText ("vid_restart\n");
2204 M_Menu_Options_f ();
2207 M_Menu_Video_AdjustSliders (1);
2212 S_LocalSound ("misc/menu1.wav");
2214 if (video_cursor < 0)
2215 video_cursor = VIDEO_ITEMS-1;
2219 S_LocalSound ("misc/menu1.wav");
2221 if (video_cursor >= VIDEO_ITEMS)
2226 M_Menu_Video_AdjustSliders (-1);
2230 M_Menu_Video_AdjustSliders (1);
2235 //=============================================================================
2239 #define NUM_HELP_PAGES 6
2242 void M_Menu_Help_f (void)
2244 key_dest = key_menu;
2246 m_entersound = true;
2252 void M_Help_Draw (void)
2254 M_Background(320, 200);
2255 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2259 void M_Help_Key (int key)
2269 m_entersound = true;
2270 if (++help_page >= NUM_HELP_PAGES)
2276 m_entersound = true;
2277 if (--help_page < 0)
2278 help_page = NUM_HELP_PAGES-1;
2284 //=============================================================================
2288 int m_quit_prevstate;
2289 qboolean wasInMenus;
2291 char *quitMessage [] =
2293 /* .........1.........2.... */
2295 " Are you gonna quit ",
2296 " this game just like ",
2297 " everything else? ",
2300 " Milord, methinks that ",
2301 " thou art a lowly ",
2302 " quitter. Is this true? ",
2305 " Do I need to bust your ",
2306 " face open for trying ",
2310 " Man, I oughta smack you",
2311 " for trying to quit! ",
2315 " Press Y to quit like a ",
2316 " big loser in life. ",
2317 " Press N to stay proud ",
2318 " and successful! ",
2320 " If you press Y to ",
2321 " quit, I will summon ",
2322 " Satan all over your ",
2325 " Um, Asmodeus dislikes ",
2326 " his children trying to ",
2327 " quit. Press Y to return",
2328 " to your Tinkertoys. ",
2330 " If you quit now, I'll ",
2331 " throw a blanket-party ",
2332 " for you next time! ",
2336 /* .........1.........2.... */
2338 " Tired of fragging ",
2343 " Quit now and forfeit ",
2344 " your bodycount? ",
2348 " Are you sure you ",
2353 " Off to do something ",
2358 void M_Menu_Quit_f (void)
2360 if (m_state == m_quit)
2362 wasInMenus = (key_dest == key_menu);
2363 key_dest = key_menu;
2364 m_quit_prevstate = m_state;
2366 m_entersound = true;
2367 msgNumber = rand()&3; //&7;
2371 void M_Quit_Key (int key)
2380 m_state = m_quit_prevstate;
2381 m_entersound = true;
2385 key_dest = key_game;
2402 void M_Quit_Draw (void)
2404 M_Background(208, 48);
2405 M_DrawTextBox(0, 0, 24, 4);
2406 M_Print(8, 8, quitMessage[msgNumber*4+0]);
2407 M_Print(8, 16, quitMessage[msgNumber*4+1]);
2408 M_Print(8, 24, quitMessage[msgNumber*4+2]);
2409 M_Print(8, 32, quitMessage[msgNumber*4+3]);
2412 //=============================================================================
2413 /* LAN CONFIG MENU */
2415 int lanConfig_cursor = -1;
2416 int lanConfig_cursor_table [] = {56, 76, 112};
2417 #define NUM_LANCONFIG_CMDS 3
2420 char lanConfig_portname[6];
2421 char lanConfig_joinname[22];
2423 void M_Menu_LanConfig_f (void)
2425 key_dest = key_menu;
2426 m_state = m_lanconfig;
2427 m_entersound = true;
2428 if (lanConfig_cursor == -1)
2431 lanConfig_cursor = 1;
2434 lanConfig_cursor = 1;
2435 lanConfig_port = 26000;
2436 sprintf(lanConfig_portname, "%u", lanConfig_port);
2438 m_return_reason[0] = 0;
2442 void M_LanConfig_Draw (void)
2449 M_Background(320, 200);
2451 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2452 p = Draw_CachePic ("gfx/p_multi.lmp");
2453 basex = (320-p->width)/2;
2454 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2457 startJoin = "New Game";
2459 startJoin = "Join Game";
2460 protocol = "TCP/IP";
2461 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2464 M_Print (basex, lanConfig_cursor_table[0], "Port");
2465 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2466 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2470 M_Print (basex, lanConfig_cursor_table[1], "Search for games...");
2471 M_Print (basex, lanConfig_cursor_table[2]-16, "Join game at:");
2472 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2473 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2477 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2478 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2481 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2483 if (lanConfig_cursor == 0)
2484 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2486 if (lanConfig_cursor == 2)
2487 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2489 if (*m_return_reason)
2490 M_PrintWhite (basex, 168, m_return_reason);
2494 void M_LanConfig_Key (int key)
2501 M_Menu_MultiPlayer_f ();
2505 S_LocalSound ("misc/menu1.wav");
2507 if (lanConfig_cursor < 0)
2508 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2512 S_LocalSound ("misc/menu1.wav");
2514 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2515 lanConfig_cursor = 0;
2519 if (lanConfig_cursor == 0)
2522 m_entersound = true;
2524 Cbuf_AddText ("stopdemo\n");
2526 Cvar_SetValue("port", lanConfig_port);
2528 if (lanConfig_cursor == 1)
2532 M_Menu_GameOptions_f ();
2535 M_Menu_ServerList_f();
2539 if (lanConfig_cursor == 2)
2540 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2544 if (lanConfig_cursor == 0)
2546 if (strlen(lanConfig_portname))
2547 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2550 if (lanConfig_cursor == 2)
2552 if (strlen(lanConfig_joinname))
2553 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2558 if (key < 32 || key > 127)
2561 if (lanConfig_cursor == 2)
2563 l = strlen(lanConfig_joinname);
2566 lanConfig_joinname[l+1] = 0;
2567 lanConfig_joinname[l] = key;
2571 if (key < '0' || key > '9')
2573 if (lanConfig_cursor == 0)
2575 l = strlen(lanConfig_portname);
2578 lanConfig_portname[l+1] = 0;
2579 lanConfig_portname[l] = key;
2584 if (StartingGame && lanConfig_cursor == 2)
2586 if (key == K_UPARROW)
2587 lanConfig_cursor = 1;
2589 lanConfig_cursor = 0;
2592 l = atoi(lanConfig_portname);
2595 sprintf(lanConfig_portname, "%u", lanConfig_port);
2598 //=============================================================================
2599 /* GAME OPTIONS MENU */
2618 episode_t *episodes;
2623 level_t quakelevels[] =
2625 {"start", "Entrance"}, // 0
2627 {"e1m1", "Slipgate Complex"}, // 1
2628 {"e1m2", "Castle of the Damned"},
2629 {"e1m3", "The Necropolis"},
2630 {"e1m4", "The Grisly Grotto"},
2631 {"e1m5", "Gloom Keep"},
2632 {"e1m6", "The Door To Chthon"},
2633 {"e1m7", "The House of Chthon"},
2634 {"e1m8", "Ziggurat Vertigo"},
2636 {"e2m1", "The Installation"}, // 9
2637 {"e2m2", "Ogre Citadel"},
2638 {"e2m3", "Crypt of Decay"},
2639 {"e2m4", "The Ebon Fortress"},
2640 {"e2m5", "The Wizard's Manse"},
2641 {"e2m6", "The Dismal Oubliette"},
2642 {"e2m7", "Underearth"},
2644 {"e3m1", "Termination Central"}, // 16
2645 {"e3m2", "The Vaults of Zin"},
2646 {"e3m3", "The Tomb of Terror"},
2647 {"e3m4", "Satan's Dark Delight"},
2648 {"e3m5", "Wind Tunnels"},
2649 {"e3m6", "Chambers of Torment"},
2650 {"e3m7", "The Haunted Halls"},
2652 {"e4m1", "The Sewage System"}, // 23
2653 {"e4m2", "The Tower of Despair"},
2654 {"e4m3", "The Elder God Shrine"},
2655 {"e4m4", "The Palace of Hate"},
2656 {"e4m5", "Hell's Atrium"},
2657 {"e4m6", "The Pain Maze"},
2658 {"e4m7", "Azure Agony"},
2659 {"e4m8", "The Nameless City"},
2661 {"end", "Shub-Niggurath's Pit"}, // 31
2663 {"dm1", "Place of Two Deaths"}, // 32
2664 {"dm2", "Claustrophobopolis"},
2665 {"dm3", "The Abandoned Base"},
2666 {"dm4", "The Bad Place"},
2667 {"dm5", "The Cistern"},
2668 {"dm6", "The Dark Zone"}
2671 episode_t quakeepisodes[] =
2673 {"Welcome to Quake", 0, 1},
2674 {"Doomed Dimension", 1, 8},
2675 {"Realm of Black Magic", 9, 7},
2676 {"Netherworld", 16, 7},
2677 {"The Elder World", 23, 8},
2678 {"Final Level", 31, 1},
2679 {"Deathmatch Arena", 32, 6}
2682 //MED 01/06/97 added hipnotic levels
2683 level_t hipnoticlevels[] =
2685 {"start", "Command HQ"}, // 0
2687 {"hip1m1", "The Pumping Station"}, // 1
2688 {"hip1m2", "Storage Facility"},
2689 {"hip1m3", "The Lost Mine"},
2690 {"hip1m4", "Research Facility"},
2691 {"hip1m5", "Military Complex"},
2693 {"hip2m1", "Ancient Realms"}, // 6
2694 {"hip2m2", "The Black Cathedral"},
2695 {"hip2m3", "The Catacombs"},
2696 {"hip2m4", "The Crypt"},
2697 {"hip2m5", "Mortum's Keep"},
2698 {"hip2m6", "The Gremlin's Domain"},
2700 {"hip3m1", "Tur Torment"}, // 12
2701 {"hip3m2", "Pandemonium"},
2702 {"hip3m3", "Limbo"},
2703 {"hip3m4", "The Gauntlet"},
2705 {"hipend", "Armagon's Lair"}, // 16
2707 {"hipdm1", "The Edge of Oblivion"} // 17
2710 //MED 01/06/97 added hipnotic episodes
2711 episode_t hipnoticepisodes[] =
2713 {"Scourge of Armagon", 0, 1},
2714 {"Fortress of the Dead", 1, 5},
2715 {"Dominion of Darkness", 6, 6},
2716 {"The Rift", 12, 4},
2717 {"Final Level", 16, 1},
2718 {"Deathmatch Arena", 17, 1}
2721 //PGM 01/07/97 added rogue levels
2722 //PGM 03/02/97 added dmatch level
2723 level_t roguelevels[] =
2725 {"start", "Split Decision"},
2726 {"r1m1", "Deviant's Domain"},
2727 {"r1m2", "Dread Portal"},
2728 {"r1m3", "Judgement Call"},
2729 {"r1m4", "Cave of Death"},
2730 {"r1m5", "Towers of Wrath"},
2731 {"r1m6", "Temple of Pain"},
2732 {"r1m7", "Tomb of the Overlord"},
2733 {"r2m1", "Tempus Fugit"},
2734 {"r2m2", "Elemental Fury I"},
2735 {"r2m3", "Elemental Fury II"},
2736 {"r2m4", "Curse of Osiris"},
2737 {"r2m5", "Wizard's Keep"},
2738 {"r2m6", "Blood Sacrifice"},
2739 {"r2m7", "Last Bastion"},
2740 {"r2m8", "Source of Evil"},
2741 {"ctf1", "Division of Change"}
2744 //PGM 01/07/97 added rogue episodes
2745 //PGM 03/02/97 added dmatch episode
2746 episode_t rogueepisodes[] =
2748 {"Introduction", 0, 1},
2749 {"Hell's Fortress", 1, 7},
2750 {"Corridors of Time", 8, 8},
2751 {"Deathmatch Arena", 16, 1}
2754 level_t nehahralevels[] =
2756 {"nehstart", "Welcome to Nehahra"},
2757 {"neh1m1", "Forge City1: Slipgates"},
2758 {"neh1m2", "Forge City2: Boiler"},
2759 {"neh1m3", "Forge City3: Escape"},
2760 {"neh1m4", "Grind Core"},
2761 {"neh1m5", "Industrial Silence"},
2762 {"neh1m6", "Locked-Up Anger"},
2763 {"neh1m7", "Wanderer of the Wastes"},
2764 {"neh1m8", "Artemis System Net"},
2765 {"neh1m9", "To the Death"},
2766 {"neh2m1", "The Gates of Ghoro"},
2767 {"neh2m2", "Sacred Trinity"},
2768 {"neh2m3", "Realm of the Ancients"},
2769 {"neh2m4", "Temple of the Ancients"},
2770 {"neh2m5", "Dreams Made Flesh"},
2771 {"neh2m6", "Your Last Cup of Sorrow"},
2772 {"nehsec", "Ogre's Bane"},
2773 {"nehahra", "Nehahra's Den"},
2774 {"nehend", "Quintessence"}
2777 episode_t nehahraepisodes[] =
2779 {"Welcome to Nehahra", 0, 1},
2780 {"The Fall of Forge", 1, 9},
2781 {"The Outlands", 10, 7},
2782 {"Dimension of the Lost", 17, 2}
2785 // Map list for Transfusion
2786 level_t transfusionlevels[] =
2788 {"bb1", "The Stronghold"},
2789 {"bb2", "Winter Wonderland"},
2791 {"bb4", "The Tower"},
2793 {"bb6", "Twin Fortress"},
2795 {"bb8", "Fun With Heads"},
2797 {"e1m1", "Cradle to Grave"},
2798 {"e1m2", "Wrong Side of the Tracks"},
2799 {"e1m7", "Altar of Stone"},
2800 {"e2m8", "The Lair of Shial"},
2801 {"e3m7", "The Pit of Cerberus"},
2802 {"e4m8", "The Hall of the Epiphany"},
2803 {"e4m9", "Mall of the Dead"},
2805 {"dm1", "Monolith Building 11"},
2808 {"e6m1", "Welcome to Your Life"},
2809 {"e6m8", "Beauty and the Beast"},
2811 {"cpbb01", "Crypt of Despair"},
2812 {"cpbb03", "Unholy Cathedral"},
2814 {"b2a15", "Area 15 (B2)"},
2815 {"barena", "Blood Arena"},
2816 {"bkeep", "Blood Keep"},
2817 {"bstar", "Brown Star"},
2818 {"crypt", "The Crypt"},
2820 {"bb3_2k1", "Bodies Infusion"},
2821 {"dcamp", "DeathCamp"},
2822 {"highnoon", "HighNoon"},
2823 {"qbb1", "The Confluence"},
2824 {"qbb2", "KathartiK"},
2825 {"qbb3", "Caleb's Woodland Retreat"},
2827 {"dranzbb6", "Black Coffee"},
2828 {"fragm", "Frag'M"},
2830 {"qe1m7", "The House of Chthon"},
2831 {"simple", "Dead Simple"}
2834 episode_t transfusionepisodes[] =
2837 {"Blood Single Player", 8, 7},
2838 {"Plasma Pack", 15, 5},
2839 {"Cryptic Passage", 20, 2},
2841 {"Transfusion", 27, 6},
2842 {"Conversions", 33, 5}
2845 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2846 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2847 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2848 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2849 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2850 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
2855 gamelevels_t *notregistered;
2856 gamelevels_t *registered;
2860 gameinfo_t gamelist[] =
2862 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2863 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2864 {GAME_ROGUE, &roguegame, &roguegame},
2865 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2866 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2867 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2870 gamelevels_t *lookupgameinfo(void)
2873 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2874 if (registered.integer)
2875 return gamelist[i].registered;
2877 return gamelist[i].notregistered;
2883 qboolean m_serverInfoMessage = false;
2884 double m_serverInfoMessageTime;
2886 extern cvar_t sv_public;
2888 void M_Menu_GameOptions_f (void)
2890 key_dest = key_menu;
2891 m_state = m_gameoptions;
2892 m_entersound = true;
2893 if (maxplayers == 0)
2894 maxplayers = svs.maxclients;
2896 maxplayers = MAX_SCOREBOARD;
2900 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 120, 128};
2901 #define NUM_GAMEOPTIONS 10
2902 int gameoptions_cursor;
2904 void M_GameOptions_Draw (void)
2910 M_Background(320, 200);
2912 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2913 p = Draw_CachePic ("gfx/p_multi.lmp");
2914 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2916 M_DrawTextBox (152, 32, 10, 1);
2917 M_Print (160, 40, "begin game");
2919 M_Print (0, 56, " Max players");
2920 M_Print (160, 56, va("%i", maxplayers) );
2922 M_Print (0, 64, " Game Type");
2923 if (gamemode == GAME_TRANSFUSION)
2925 if (!deathmatch.integer)
2926 Cvar_SetValue("deathmatch", 1);
2927 if (deathmatch.integer == 2)
2928 M_Print (160, 64, "Capture the Flag");
2930 M_Print (160, 64, "Blood Bath");
2934 if (!coop.integer && !deathmatch.integer)
2935 Cvar_SetValue("deathmatch", 1);
2937 M_Print (160, 64, "Cooperative");
2939 M_Print (160, 64, "Deathmatch");
2942 M_Print (0, 72, " Teamplay");
2943 if (gamemode == GAME_ROGUE)
2947 switch((int)teamplay.integer)
2949 case 1: msg = "No Friendly Fire"; break;
2950 case 2: msg = "Friendly Fire"; break;
2951 case 3: msg = "Tag"; break;
2952 case 4: msg = "Capture the Flag"; break;
2953 case 5: msg = "One Flag CTF"; break;
2954 case 6: msg = "Three Team CTF"; break;
2955 default: msg = "Off"; break;
2957 M_Print (160, 72, msg);
2959 else if (gamemode == GAME_TRANSFUSION)
2963 switch (teamplay.integer)
2965 case 0: msg = "Off"; break;
2966 case 2: msg = "Friendly Fire"; break;
2967 default: msg = "No Friendly Fire"; break;
2969 M_Print (160, 72, msg);
2975 switch((int)teamplay.integer)
2977 case 1: msg = "No Friendly Fire"; break;
2978 case 2: msg = "Friendly Fire"; break;
2979 default: msg = "Off"; break;
2981 M_Print (160, 72, msg);
2984 M_Print (0, 80, " Skill");
2985 if (skill.integer == 0)
2986 M_Print (160, 80, "Easy difficulty");
2987 else if (skill.integer == 1)
2988 M_Print (160, 80, "Normal difficulty");
2989 else if (skill.integer == 2)
2990 M_Print (160, 80, "Hard difficulty");
2992 M_Print (160, 80, "Nightmare difficulty");
2994 M_Print (0, 88, " Frag Limit");
2995 if (fraglimit.integer == 0)
2996 M_Print (160, 88, "none");
2998 M_Print (160, 88, va("%i frags", fraglimit.integer));
3000 M_Print (0, 96, " Time Limit");
3001 if (timelimit.integer == 0)
3002 M_Print (160, 96, "none");
3004 M_Print (160, 96, va("%i minutes", timelimit.integer));
3006 M_Print (0, 104, " Public server");
3007 M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes");
3009 g = lookupgameinfo();
3011 M_Print (0, 120, " Episode");
3012 M_Print (160, 120, g->episodes[startepisode].description);
3014 M_Print (0, 128, " Level");
3015 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3016 M_Print (160, 136, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3019 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3021 if (m_serverInfoMessage)
3023 if ((realtime - m_serverInfoMessageTime) < 5.0)
3026 M_DrawTextBox (x, 138, 24, 4);
3028 M_Print (x, 146, " More than 64 players?? ");
3029 M_Print (x, 154, " First, question your ");
3030 M_Print (x, 162, " sanity, then email ");
3031 M_Print (x, 170, " havoc@telefragged.com ");
3035 m_serverInfoMessage = false;
3041 void M_NetStart_Change (int dir)
3046 switch (gameoptions_cursor)
3050 if (maxplayers > MAX_SCOREBOARD)
3052 maxplayers = MAX_SCOREBOARD;
3053 m_serverInfoMessage = true;
3054 m_serverInfoMessageTime = realtime;
3061 if (gamemode == GAME_TRANSFUSION)
3063 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3064 Cvar_SetValueQuick (&deathmatch, 0);
3065 else // changing from BloodBath to CTF
3066 Cvar_SetValueQuick (&deathmatch, 2);
3070 if (deathmatch.integer) // changing from deathmatch to coop
3072 Cvar_SetValueQuick (&coop, 1);
3073 Cvar_SetValueQuick (&deathmatch, 0);
3075 else // changing from coop to deathmatch
3077 Cvar_SetValueQuick (&coop, 0);
3078 Cvar_SetValueQuick (&deathmatch, 1);
3084 if (gamemode == GAME_ROGUE)
3089 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3090 if (teamplay.integer > count)
3091 Cvar_SetValueQuick (&teamplay, 0);
3092 else if (teamplay.integer < 0)
3093 Cvar_SetValueQuick (&teamplay, count);
3097 Cvar_SetValueQuick (&skill, skill.integer + dir);
3098 if (skill.integer > 3)
3099 Cvar_SetValueQuick (&skill, 0);
3100 if (skill.integer < 0)
3101 Cvar_SetValueQuick (&skill, 3);
3105 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3106 if (fraglimit.integer > 100)
3107 Cvar_SetValueQuick (&fraglimit, 0);
3108 if (fraglimit.integer < 0)
3109 Cvar_SetValueQuick (&fraglimit, 100);
3113 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3114 if (timelimit.value > 60)
3115 Cvar_SetValueQuick (&timelimit, 0);
3116 if (timelimit.value < 0)
3117 Cvar_SetValueQuick (&timelimit, 60);
3121 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3125 startepisode += dir;
3126 g = lookupgameinfo();
3128 if (startepisode < 0)
3129 startepisode = g->numepisodes - 1;
3131 if (startepisode >= g->numepisodes)
3139 g = lookupgameinfo();
3142 startlevel = g->episodes[startepisode].levels - 1;
3144 if (startlevel >= g->episodes[startepisode].levels)
3150 void M_GameOptions_Key (int key)
3157 M_Menu_MultiPlayer_f ();
3161 S_LocalSound ("misc/menu1.wav");
3162 gameoptions_cursor--;
3163 if (gameoptions_cursor < 0)
3164 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3168 S_LocalSound ("misc/menu1.wav");
3169 gameoptions_cursor++;
3170 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3171 gameoptions_cursor = 0;
3175 if (gameoptions_cursor == 0)
3177 S_LocalSound ("misc/menu3.wav");
3178 M_NetStart_Change (-1);
3182 if (gameoptions_cursor == 0)
3184 S_LocalSound ("misc/menu3.wav");
3185 M_NetStart_Change (1);
3189 S_LocalSound ("misc/menu2.wav");
3190 if (gameoptions_cursor == 0)
3193 Cbuf_AddText ("disconnect\n");
3194 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3196 g = lookupgameinfo();
3197 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3201 M_NetStart_Change (1);
3206 //=============================================================================
3211 void M_Menu_ServerList_f (void)
3213 key_dest = key_menu;
3215 m_entersound = true;
3217 m_return_reason[0] = 0;
3222 void M_ServerList_Draw (void)
3224 int n, y, visible, start, end;
3227 // use as much vertical space as available
3228 M_Background(640, vid.conheight);
3229 // scroll the list as the cursor moves
3230 visible = (vid.conheight - 16 - 32) / 8;
3231 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3232 end = min(start + visible, hostCacheCount);
3234 p = Draw_CachePic("gfx/p_multi.lmp");
3235 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3237 for (n = start;n < end;n++)
3239 M_Print(0, y, hostcache[n].line1);y += 8;
3240 M_Print(0, y, hostcache[n].line2);y += 8;
3242 M_DrawCharacter(0, 32 + (slist_cursor - start) * 16, 12+((int)(realtime*4)&1));
3244 if (*m_return_reason)
3245 M_PrintWhite(16, vid.conheight - 8, m_return_reason);
3249 void M_ServerList_Key(int k)
3254 M_Menu_LanConfig_f();
3263 S_LocalSound("misc/menu1.wav");
3265 if (slist_cursor < 0)
3266 slist_cursor = hostCacheCount - 1;
3271 S_LocalSound("misc/menu1.wav");
3273 if (slist_cursor >= hostCacheCount)
3278 S_LocalSound("misc/menu2.wav");
3279 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3288 //=============================================================================
3289 /* Menu Subsystem */
3294 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3296 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3297 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3298 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3299 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3300 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3301 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3302 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3303 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3304 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3305 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3306 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3307 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3308 Cmd_AddCommand ("help", M_Menu_Help_f);
3309 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3311 if (gamemode == GAME_TRANSFUSION)
3313 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3314 bindnames = transfusionbindnames;
3318 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3319 bindnames = quakebindnames;
3322 if (gamemode == GAME_NEHAHRA)
3324 if (FS_FileExists("maps/neh1m4.bsp"))
3326 if (FS_FileExists("hearing.dem"))
3328 Con_Printf("Nehahra movie and game detected.\n");
3329 NehGameType = TYPE_BOTH;
3333 Con_Printf("Nehahra game detected.\n");
3334 NehGameType = TYPE_GAME;
3339 if (FS_FileExists("hearing.dem"))
3341 Con_Printf("Nehahra movie detected.\n");
3342 NehGameType = TYPE_DEMO;
3346 Con_Printf("Nehahra not found.\n");
3347 NehGameType = TYPE_GAME; // could just complain, but...
3355 if (key_dest != key_menu)
3357 if (m_state == m_none)
3373 case m_singleplayer:
3374 M_SinglePlayer_Draw ();
3386 M_MultiPlayer_Draw ();
3397 case m_options_effects:
3398 M_Options_Effects_Draw ();
3401 case m_options_colorcontrol:
3402 M_Options_ColorControl_Draw ();
3422 M_LanConfig_Draw ();
3426 M_GameOptions_Draw ();
3430 M_ServerList_Draw ();
3436 S_LocalSound ("misc/menu2.wav");
3437 m_entersound = false;
3444 void M_Keydown (int key)
3459 case m_singleplayer:
3460 M_SinglePlayer_Key (key);
3472 M_MultiPlayer_Key (key);
3480 M_Options_Key (key);
3483 case m_options_effects:
3484 M_Options_Effects_Key (key);
3487 case m_options_colorcontrol:
3488 M_Options_ColorControl_Key (key);
3508 M_LanConfig_Key (key);
3512 M_GameOptions_Key (key);
3516 M_ServerList_Key (key);