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_Net_f (void);
39 void M_Menu_Options_f (void);
40 void M_Menu_Options_Effects_f (void);
41 void M_Menu_Options_ColorControl_f (void);
42 void M_Menu_Keys_f (void);
43 void M_Menu_Video_f (void);
44 void M_Menu_Help_f (void);
45 void M_Menu_Quit_f (void);
46 void M_Menu_LanConfig_f (void);
47 void M_Menu_GameOptions_f (void);
48 void M_Menu_Search_f (void);
49 void M_Menu_InetSearch_f (void);
50 void M_Menu_ServerList_f (void);
52 void M_Main_Draw (void);
53 void M_SinglePlayer_Draw (void);
54 void M_Load_Draw (void);
55 void M_Save_Draw (void);
56 void M_MultiPlayer_Draw (void);
57 void M_Setup_Draw (void);
58 void M_Net_Draw (void);
59 void M_Options_Draw (void);
60 void M_Options_Effects_Draw (void);
61 void M_Options_ColorControl_Draw (void);
62 void M_Keys_Draw (void);
63 void M_Video_Draw (void);
64 void M_Help_Draw (void);
65 void M_Quit_Draw (void);
66 void M_LanConfig_Draw (void);
67 void M_GameOptions_Draw (void);
68 void M_Search_Draw (void);
69 void M_InetSearch_Draw (void);
70 void M_ServerList_Draw (void);
72 void M_Main_Key (int key);
73 void M_SinglePlayer_Key (int key);
74 void M_Load_Key (int key);
75 void M_Save_Key (int key);
76 void M_MultiPlayer_Key (int key);
77 void M_Setup_Key (int key);
78 void M_Net_Key (int key);
79 void M_Options_Key (int key);
80 void M_Options_Effects_Key (int key);
81 void M_Options_ColorControl_Key (int key);
82 void M_Keys_Key (int key);
83 void M_Video_Key (int key);
84 void M_Help_Key (int key);
85 void M_Quit_Key (int key);
86 void M_LanConfig_Key (int key);
87 void M_GameOptions_Key (int key);
88 void M_Search_Key (int key);
89 void M_InetSearch_Key (int key);
90 void M_ServerList_Key (int key);
92 qboolean m_entersound; // play after drawing a frame, so caching
93 // won't disrupt the sound
96 qboolean m_return_onerror;
97 char m_return_reason [32];
99 #define StartingGame (m_multiplayer_cursor == 1)
100 #define JoiningGame (m_multiplayer_cursor == 0)
101 #define IPXConfig (m_net_cursor == 0)
102 #define TCPIPConfig (m_net_cursor == 1)
104 void M_ConfigureNetSubsystem(void);
107 #define NumberOfNehahraDemos 34
112 } nehahrademonames_t;
114 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
116 {"intro", "Prologue"},
117 {"genf", "The Beginning"},
118 {"genlab", "A Doomed Project"},
119 {"nehcre", "The New Recruits"},
120 {"maxneh", "Breakthrough"},
121 {"maxchar", "Renewal and Duty"},
122 {"crisis", "Worlds Collide"},
123 {"postcris", "Darkening Skies"},
124 {"hearing", "The Hearing"},
125 {"getjack", "On a Mexican Radio"},
126 {"prelude", "Honor and Justice"},
127 {"abase", "A Message Sent"},
128 {"effect", "The Other Side"},
129 {"uhoh", "Missing in Action"},
130 {"prepare", "The Response"},
131 {"vision", "Farsighted Eyes"},
132 {"maxturns", "Enter the Immortal"},
133 {"backlot", "Separate Ways"},
134 {"maxside", "The Ancient Runes"},
135 {"counter", "The New Initiative"},
136 {"warprep", "Ghosts to the World"},
137 {"counter1", "A Fate Worse Than Death"},
138 {"counter2", "Friendly Fire"},
139 {"counter3", "Minor Setback"},
140 {"madmax", "Scores to Settle"},
141 {"quake", "One Man"},
142 {"cthmm", "Shattered Masks"},
143 {"shades", "Deal with the Dead"},
144 {"gophil", "An Unlikely Hero"},
145 {"cstrike", "War in Hell"},
146 {"shubset", "The Conspiracy"},
147 {"shubdie", "Even Death May Die"},
148 {"newranks", "An Empty Throne"},
149 {"seal", "The Seal is Broken"}
152 float menu_x, menu_y, menu_width, menu_height;
154 void M_DrawBackground(void)
158 menu_x = (vid.conwidth - menu_width) * 0.5;
159 menu_y = (vid.conheight - menu_height) * 0.5;
160 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
167 Draws one solid graphics character
170 void M_DrawCharacter (float cx, float cy, int num)
175 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
178 void M_Print (float cx, float cy, const char *str)
180 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
183 void M_PrintWhite (float cx, float cy, const char *str)
185 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
188 void M_ItemPrint (float cx, float cy, char *str, int unghosted)
191 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
193 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
196 void M_DrawPic (float cx, float cy, char *picname)
198 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
201 qbyte identityTable[256];
202 qbyte translationTable[256];
204 void M_BuildTranslationTable(int top, int bottom)
207 qbyte *dest, *source;
209 for (j = 0; j < 256; j++)
210 identityTable[j] = j;
211 dest = translationTable;
212 source = identityTable;
213 memcpy (dest, source, 256);
215 // LordHavoc: corrected skin color ranges
216 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
217 memcpy (dest + TOP_RANGE, source + top, 16);
219 for (j=0 ; j<16 ; j++)
220 dest[TOP_RANGE+j] = source[top+15-j];
222 // LordHavoc: corrected skin color ranges
223 if (bottom < 128 || (bottom >= 224 && bottom < 240))
224 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
226 for (j=0 ; j<16 ; j++)
227 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
231 void M_DrawTextBox (float x, float y, float width, float height)
239 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
240 for (n = 0; n < height; n++)
243 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
245 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
252 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
253 for (n = 0; n < height; n++)
257 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
259 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
261 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
268 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
269 for (n = 0; n < height; n++)
272 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
274 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
277 //=============================================================================
279 //int m_save_demonum;
286 void M_ToggleMenu_f (void)
290 if (key_dest == key_menu)
292 if (m_state != m_main)
301 //if (key_dest == key_console)
302 // Con_ToggleConsole_f ();
309 void M_Demo_Draw (void)
313 for (i = 0;i < NumberOfNehahraDemos;i++)
314 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
317 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
321 void M_Menu_Demos_f (void)
328 void M_Demo_Key (int k)
337 S_LocalSound ("misc/menu2.wav");
340 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
345 S_LocalSound ("misc/menu1.wav");
348 demo_cursor = NumberOfNehahraDemos;
353 S_LocalSound ("misc/menu1.wav");
355 if (demo_cursor > NumberOfNehahraDemos)
361 //=============================================================================
366 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
368 void M_Menu_Main_f (void)
370 if (gamemode == GAME_NEHAHRA)
372 if (NehGameType == TYPE_DEMO)
374 else if (NehGameType == TYPE_GAME)
383 if (key_dest != key_menu)
385 m_save_demonum = cls.demonum;
395 void M_Main_Draw (void)
400 M_DrawPic (16, 4, "gfx/qplaque.lmp");
401 p = Draw_CachePic ("gfx/ttl_main.lmp");
402 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
404 if (gamemode == GAME_NEHAHRA)
406 if (NehGameType == TYPE_BOTH)
407 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
408 else if (NehGameType == TYPE_GAME)
409 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
411 M_DrawPic (72, 32, "gfx/demomenu.lmp");
414 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
416 f = (int)(realtime * 10)%6;
418 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
422 void M_Main_Key (int key)
429 //cls.demonum = m_save_demonum;
430 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
435 S_LocalSound ("misc/menu1.wav");
436 if (++m_main_cursor >= MAIN_ITEMS)
441 S_LocalSound ("misc/menu1.wav");
442 if (--m_main_cursor < 0)
443 m_main_cursor = MAIN_ITEMS - 1;
449 if (gamemode == GAME_NEHAHRA)
454 switch (m_main_cursor)
457 M_Menu_SinglePlayer_f ();
465 M_Menu_MultiPlayer_f ();
475 Cbuf_AddText ("disconnect\n");
476 Cbuf_AddText ("playdemo endcred\n");
485 switch (m_main_cursor)
488 M_Menu_SinglePlayer_f ();
492 M_Menu_MultiPlayer_f ();
502 Cbuf_AddText ("disconnect\n");
503 Cbuf_AddText ("playdemo endcred\n");
512 switch (m_main_cursor)
521 Cbuf_AddText ("disconnect\n");
522 Cbuf_AddText ("playdemo endcred\n");
538 switch (m_main_cursor)
541 M_Menu_SinglePlayer_f ();
545 M_Menu_MultiPlayer_f ();
564 //=============================================================================
565 /* SINGLE PLAYER MENU */
567 int m_singleplayer_cursor;
568 #define SINGLEPLAYER_ITEMS 3
571 void M_Menu_SinglePlayer_f (void)
574 m_state = m_singleplayer;
579 void M_SinglePlayer_Draw (void)
583 M_DrawPic (16, 4, "gfx/qplaque.lmp");
584 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
586 // Transfusion doesn't have a single player mode
587 if (gamemode == GAME_TRANSFUSION)
589 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
591 M_DrawTextBox (60, 8 * 8, 23, 4);
592 M_PrintWhite (95, 10 * 8, "Transfusion is for");
593 M_PrintWhite (83, 11 * 8, "multiplayer play only");
599 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
600 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
602 f = (int)(realtime * 10)%6;
604 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
609 void M_SinglePlayer_Key (int key)
611 if (gamemode == GAME_TRANSFUSION)
613 if (key == K_ESCAPE || key == K_ENTER)
625 S_LocalSound ("misc/menu1.wav");
626 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
627 m_singleplayer_cursor = 0;
631 S_LocalSound ("misc/menu1.wav");
632 if (--m_singleplayer_cursor < 0)
633 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
639 switch (m_singleplayer_cursor)
644 Cbuf_AddText ("disconnect\n");
645 Cbuf_AddText ("maxplayers 1\n");
646 Cbuf_AddText ("deathmatch 0\n");
647 Cbuf_AddText ("coop 0\n");
648 if (gamemode == GAME_NEHAHRA)
649 Cbuf_AddText ("map nehstart\n");
651 Cbuf_AddText ("map start\n");
665 //=============================================================================
668 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
670 #define MAX_SAVEGAMES 12
671 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
672 int loadable[MAX_SAVEGAMES];
674 void M_ScanSaves (void)
677 char name[MAX_OSPATH];
682 for (i=0 ; i<MAX_SAVEGAMES ; i++)
684 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
686 sprintf (name, "s%i.sav", i);
687 f = FS_Open (name, "r", false);
690 str = FS_Getline (f);
691 sscanf (str, "%i\n", &version);
692 str = FS_Getline (f);
693 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
695 // change _ back to space
696 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
697 if (m_filenames[i][j] == '_')
698 m_filenames[i][j] = ' ';
704 void M_Menu_Load_f (void)
713 void M_Menu_Save_f (void)
719 if (svs.maxclients != 1)
728 void M_Load_Draw (void)
733 p = Draw_CachePic ("gfx/p_load.lmp");
734 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
736 for (i=0 ; i< MAX_SAVEGAMES; i++)
737 M_Print (16, 32 + 8*i, m_filenames[i]);
740 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
744 void M_Save_Draw (void)
749 p = Draw_CachePic ("gfx/p_save.lmp");
750 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
752 for (i=0 ; i<MAX_SAVEGAMES ; i++)
753 M_Print (16, 32 + 8*i, m_filenames[i]);
756 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
760 void M_Load_Key (int k)
765 M_Menu_SinglePlayer_f ();
769 S_LocalSound ("misc/menu2.wav");
770 if (!loadable[load_cursor])
775 // issue the load command
776 Cbuf_AddText (va ("load s%i\n", load_cursor) );
781 S_LocalSound ("misc/menu1.wav");
784 load_cursor = MAX_SAVEGAMES-1;
789 S_LocalSound ("misc/menu1.wav");
791 if (load_cursor >= MAX_SAVEGAMES)
798 void M_Save_Key (int k)
803 M_Menu_SinglePlayer_f ();
809 Cbuf_AddText (va("save s%i\n", load_cursor));
814 S_LocalSound ("misc/menu1.wav");
817 load_cursor = MAX_SAVEGAMES-1;
822 S_LocalSound ("misc/menu1.wav");
824 if (load_cursor >= MAX_SAVEGAMES)
830 //=============================================================================
831 /* MULTIPLAYER MENU */
833 int m_multiplayer_cursor;
834 #define MULTIPLAYER_ITEMS 3
837 void M_Menu_MultiPlayer_f (void)
840 m_state = m_multiplayer;
845 void M_MultiPlayer_Draw (void)
850 M_DrawPic (16, 4, "gfx/qplaque.lmp");
851 p = Draw_CachePic ("gfx/p_multi.lmp");
852 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
853 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
855 f = (int)(realtime * 10)%6;
857 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
859 if (ipxAvailable || tcpipAvailable)
861 M_PrintWhite ((320/2) - ((27*8)/2), 168, "No Communications Available");
865 void M_MultiPlayer_Key (int key)
874 S_LocalSound ("misc/menu1.wav");
875 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
876 m_multiplayer_cursor = 0;
880 S_LocalSound ("misc/menu1.wav");
881 if (--m_multiplayer_cursor < 0)
882 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
887 switch (m_multiplayer_cursor)
890 if (ipxAvailable || tcpipAvailable)
895 if (ipxAvailable || tcpipAvailable)
906 //=============================================================================
909 int setup_cursor = 4;
910 int setup_cursor_table[] = {40, 56, 80, 104, 140};
912 char setup_hostname[16];
913 char setup_myname[16];
919 #define NUM_SETUP_CMDS 5
921 void M_Menu_Setup_f (void)
926 strcpy(setup_myname, cl_name.string);
927 strcpy(setup_hostname, hostname.string);
928 setup_top = setup_oldtop = cl_color.integer >> 4;
929 setup_bottom = setup_oldbottom = cl_color.integer & 15;
932 // LordHavoc: rewrote this code greatly
933 void M_MenuPlayerTranslate (qbyte *translation, int top, int bottom)
936 unsigned int trans[4096];
938 static qbyte pixels[4096];
939 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load = true, menuplyr_failed = false;
943 if (menuplyr_top == top && menuplyr_bottom == bottom)
947 menuplyr_bottom = bottom;
951 menuplyr_load = false;
952 f = FS_LoadFile("gfx/menuplyr.lmp", true);
955 menuplyr_failed = true;
958 data = LoadLMPAs8Bit (f, 0, 0);
960 if (image_width * image_height > 4096)
962 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
964 menuplyr_failed = true;
967 menuplyr_width = image_width;
968 menuplyr_height = image_height;
969 memcpy(pixels, data, menuplyr_width * menuplyr_height);
973 M_BuildTranslationTable (menuplyr_top*16, menuplyr_bottom*16);
975 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
976 trans[i] = palette_complete[translation[pixels[i]]];
978 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)trans);
981 void M_Setup_Draw (void)
985 M_DrawPic (16, 4, "gfx/qplaque.lmp");
986 p = Draw_CachePic ("gfx/p_multi.lmp");
987 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
989 M_Print (64, 40, "Hostname");
990 M_DrawTextBox (160, 32, 16, 1);
991 M_Print (168, 40, setup_hostname);
993 M_Print (64, 56, "Your name");
994 M_DrawTextBox (160, 48, 16, 1);
995 M_Print (168, 56, setup_myname);
997 M_Print (64, 80, "Shirt color");
998 M_Print (64, 104, "Pants color");
1000 M_DrawTextBox (64, 140-8, 14, 1);
1001 M_Print (72, 140, "Accept Changes");
1003 M_DrawPic (160, 64, "gfx/bigbox.lmp");
1005 // LordHavoc: rewrote this code greatly
1006 M_MenuPlayerTranslate (translationTable, setup_top, setup_bottom);
1007 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
1009 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1011 if (setup_cursor == 0)
1012 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1014 if (setup_cursor == 1)
1015 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1019 void M_Setup_Key (int k)
1026 M_Menu_MultiPlayer_f ();
1030 S_LocalSound ("misc/menu1.wav");
1032 if (setup_cursor < 0)
1033 setup_cursor = NUM_SETUP_CMDS-1;
1037 S_LocalSound ("misc/menu1.wav");
1039 if (setup_cursor >= NUM_SETUP_CMDS)
1044 if (setup_cursor < 2)
1046 S_LocalSound ("misc/menu3.wav");
1047 if (setup_cursor == 2)
1048 setup_top = setup_top - 1;
1049 if (setup_cursor == 3)
1050 setup_bottom = setup_bottom - 1;
1053 if (setup_cursor < 2)
1056 S_LocalSound ("misc/menu3.wav");
1057 if (setup_cursor == 2)
1058 setup_top = setup_top + 1;
1059 if (setup_cursor == 3)
1060 setup_bottom = setup_bottom + 1;
1064 if (setup_cursor == 0 || setup_cursor == 1)
1067 if (setup_cursor == 2 || setup_cursor == 3)
1070 // setup_cursor == 4 (OK)
1071 if (strcmp(cl_name.string, setup_myname) != 0)
1072 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1073 if (strcmp(hostname.string, setup_hostname) != 0)
1074 Cvar_Set("hostname", setup_hostname);
1075 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1076 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1077 m_entersound = true;
1078 M_Menu_MultiPlayer_f ();
1082 if (setup_cursor == 0)
1084 if (strlen(setup_hostname))
1085 setup_hostname[strlen(setup_hostname)-1] = 0;
1088 if (setup_cursor == 1)
1090 if (strlen(setup_myname))
1091 setup_myname[strlen(setup_myname)-1] = 0;
1096 if (k < 32 || k > 127)
1098 if (setup_cursor == 0)
1100 l = strlen(setup_hostname);
1103 setup_hostname[l+1] = 0;
1104 setup_hostname[l] = k;
1107 if (setup_cursor == 1)
1109 l = strlen(setup_myname);
1112 setup_myname[l+1] = 0;
1113 setup_myname[l] = k;
1122 if (setup_bottom > 15)
1124 if (setup_bottom < 0)
1128 //=============================================================================
1133 int m_net_saveHeight;
1135 char *net_helpMessage [] =
1137 /* .........1.........2.... */
1138 " Novell network LANs ",
1139 " or Windows 95 DOS-box. ",
1141 "(LAN=Local Area Network)",
1143 " Commonly used to play ",
1144 " over the Internet, but ",
1145 " also used on a Local ",
1149 void M_Menu_Net_f (void)
1151 key_dest = key_menu;
1153 m_entersound = true;
1156 if (m_net_cursor >= m_net_items)
1159 M_Net_Key (K_DOWNARROW);
1163 void M_Net_Draw (void)
1168 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1169 p = Draw_CachePic ("gfx/p_multi.lmp");
1170 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1175 M_DrawPic (72, f, "gfx/netmen3.lmp");
1177 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1181 M_DrawPic (72, f, "gfx/netmen4.lmp");
1183 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1185 if (m_net_items == 5) // JDC, could just be removed
1188 M_DrawPic (72, f, "gfx/netmen5.lmp");
1192 M_DrawTextBox (f, 134, 24, 4);
1194 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1195 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1197 f = (int)(realtime * 10)%6;
1198 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1202 void M_Net_Key (int k)
1208 M_Menu_MultiPlayer_f ();
1212 S_LocalSound ("misc/menu1.wav");
1213 if (++m_net_cursor >= m_net_items)
1218 S_LocalSound ("misc/menu1.wav");
1219 if (--m_net_cursor < 0)
1220 m_net_cursor = m_net_items - 1;
1224 m_entersound = true;
1226 switch (m_net_cursor)
1229 M_Menu_LanConfig_f ();
1233 M_Menu_LanConfig_f ();
1242 if (m_net_cursor == 0 && !ipxAvailable)
1244 if (m_net_cursor == 1 && !tcpipAvailable)
1248 //=============================================================================
1251 #define SLIDER_RANGE 10
1253 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1258 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1259 M_DrawCharacter (x-8, y, 128);
1260 for (i = 0;i < SLIDER_RANGE;i++)
1261 M_DrawCharacter (x + i*8, y, 129);
1262 M_DrawCharacter (x+i*8, y, 130);
1263 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1264 sprintf(text, "%g", num);
1265 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1268 void M_DrawCheckbox (int x, int y, int on)
1271 M_Print (x, y, "on");
1273 M_Print (x, y, "off");
1277 #define OPTIONS_ITEMS 28
1281 void M_Menu_Options_f (void)
1283 key_dest = key_menu;
1284 m_state = m_options;
1285 m_entersound = true;
1288 extern cvar_t gl_delayfinish;
1289 extern cvar_t slowmo;
1290 extern dllhandle_t jpeg_dll;
1292 void M_Menu_Options_AdjustSliders (int dir)
1294 S_LocalSound ("misc/menu3.wav");
1296 switch (options_cursor)
1299 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1302 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1305 if (jpeg_dll != NULL)
1306 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1309 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1312 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1315 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1318 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1321 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1324 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1326 case 15: // music volume
1328 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1330 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1333 case 16: // sfx volume
1334 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1337 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1340 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1342 case 19: // static crosshair
1343 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1345 case 20: // show framerate
1346 Cvar_SetValueQuick (&showfps, !showfps.integer);
1348 case 21: // always run
1349 if (cl_forwardspeed.value > 200)
1351 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1352 Cvar_SetValueQuick (&cl_backspeed, 200);
1356 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1357 Cvar_SetValueQuick (&cl_backspeed, 400);
1360 case 22: // lookspring
1361 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1363 case 23: // lookstrafe
1364 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1366 case 24: // mouse speed
1367 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1369 case 25: // mouse look
1370 Cvar_SetValueQuick (&freelook, !freelook.integer);
1372 case 26: // invert mouse
1373 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1375 case 27: // windowed mouse
1376 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1381 void M_Options_Draw (void)
1386 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1387 p = Draw_CachePic("gfx/p_option.lmp");
1388 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1391 M_Print(16, y, " Customize controls");y += 8;
1392 M_Print(16, y, " Go to console");y += 8;
1393 M_Print(16, y, " Reset to defaults");y += 8;
1394 M_Print(16, y, " Video Options");y += 8;
1395 M_Print(16, y, " Effects Options");y += 8;
1396 M_Print(16, y, " Color Control Options");y += 8;
1397 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value, 0, 1);y += 8;
1398 M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8;
1399 M_ItemPrint(16, y, " JPEG screenshots", jpeg_dll != NULL);M_DrawCheckbox(220, y, scr_screenshot_jpeg.integer);y += 8;
1400 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1401 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8;
1402 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1403 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1404 M_Print(16, y, "Delay refresh (faster)");M_DrawCheckbox(220, y, gl_delayfinish.integer);y += 8;
1405 M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8;
1406 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8;
1407 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8;
1408 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8;
1409 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8;
1410 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1411 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1412 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1413 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1414 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1415 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, sensitivity.value, 1, 50);y += 8;
1416 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1417 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1418 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1421 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1425 void M_Options_Key (int k)
1434 m_entersound = true;
1435 switch (options_cursor)
1442 Con_ToggleConsole_f ();
1445 Cbuf_AddText ("exec default.cfg\n");
1451 M_Menu_Options_Effects_f ();
1454 M_Menu_Options_ColorControl_f ();
1457 M_Menu_Options_AdjustSliders (1);
1463 S_LocalSound ("misc/menu1.wav");
1465 if (options_cursor < 0)
1466 options_cursor = OPTIONS_ITEMS-1;
1470 S_LocalSound ("misc/menu1.wav");
1472 if (options_cursor >= OPTIONS_ITEMS)
1477 M_Menu_Options_AdjustSliders (-1);
1481 M_Menu_Options_AdjustSliders (1);
1486 #define OPTIONS_EFFECTS_ITEMS 16
1488 int options_effects_cursor;
1490 void M_Menu_Options_Effects_f (void)
1492 key_dest = key_menu;
1493 m_state = m_options_effects;
1494 m_entersound = true;
1498 extern cvar_t r_detailtextures;
1499 extern cvar_t cl_particles;
1500 extern cvar_t cl_explosions;
1501 extern cvar_t cl_stainmaps;
1502 extern cvar_t r_explosionclip;
1503 extern cvar_t r_dlightmap;
1504 extern cvar_t r_modellights;
1505 extern cvar_t r_coronas;
1506 extern cvar_t gl_flashblend;
1507 extern cvar_t cl_particles_bulletimpacts;
1508 extern cvar_t cl_particles_smoke;
1509 extern cvar_t cl_particles_sparks;
1510 extern cvar_t cl_particles_bubbles;
1511 extern cvar_t cl_particles_blood;
1512 extern cvar_t cl_particles_blood_size;
1513 extern cvar_t cl_particles_blood_alpha;
1515 void M_Menu_Options_Effects_AdjustSliders (int dir)
1517 S_LocalSound ("misc/menu3.wav");
1519 switch (options_effects_cursor)
1522 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1525 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1528 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1531 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1534 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1537 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1540 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1543 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1546 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1549 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1552 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1555 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1558 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1561 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1564 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1567 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1572 void M_Options_Effects_Draw (void)
1577 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1578 p = Draw_CachePic("gfx/p_option.lmp");
1579 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1582 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value, 0, 8);y += 8;
1583 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1584 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1585 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1586 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1587 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1588 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1589 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1590 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1591 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1592 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1593 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1594 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1595 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1596 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, cl_particles_blood_size.value, 2, 20);y += 8;
1597 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, cl_particles_blood_alpha.value, 0.2, 1);y += 8;
1600 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1604 void M_Options_Effects_Key (int k)
1609 M_Menu_Options_f ();
1613 M_Menu_Options_Effects_AdjustSliders (1);
1617 S_LocalSound ("misc/menu1.wav");
1618 options_effects_cursor--;
1619 if (options_effects_cursor < 0)
1620 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1624 S_LocalSound ("misc/menu1.wav");
1625 options_effects_cursor++;
1626 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1627 options_effects_cursor = 0;
1631 M_Menu_Options_Effects_AdjustSliders (-1);
1635 M_Menu_Options_Effects_AdjustSliders (1);
1644 #define OPTIONS_COLORCONTROL_ITEMS 18
1646 int options_colorcontrol_cursor;
1648 // intensity value to match up to 50% dither to 'correct' quake
1649 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1651 void M_Menu_Options_ColorControl_f (void)
1653 key_dest = key_menu;
1654 m_state = m_options_colorcontrol;
1655 m_entersound = true;
1659 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1662 S_LocalSound ("misc/menu3.wav");
1664 switch (options_colorcontrol_cursor)
1667 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1670 Cvar_SetValueQuick (&v_color_enable, 0);
1671 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1674 Cvar_SetValueQuick (&v_color_enable, 0);
1675 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1678 Cvar_SetValueQuick (&v_color_enable, 0);
1679 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1682 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1685 Cvar_SetValueQuick (&v_color_enable, 1);
1686 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1689 Cvar_SetValueQuick (&v_color_enable, 1);
1690 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1693 Cvar_SetValueQuick (&v_color_enable, 1);
1694 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1697 Cvar_SetValueQuick (&v_color_enable, 1);
1698 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1699 Cvar_SetValueQuick (&v_color_black_r, f);
1700 Cvar_SetValueQuick (&v_color_black_g, f);
1701 Cvar_SetValueQuick (&v_color_black_b, f);
1704 Cvar_SetValueQuick (&v_color_enable, 1);
1705 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1708 Cvar_SetValueQuick (&v_color_enable, 1);
1709 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1712 Cvar_SetValueQuick (&v_color_enable, 1);
1713 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1716 Cvar_SetValueQuick (&v_color_enable, 1);
1717 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1718 Cvar_SetValueQuick (&v_color_grey_r, f);
1719 Cvar_SetValueQuick (&v_color_grey_g, f);
1720 Cvar_SetValueQuick (&v_color_grey_b, f);
1723 Cvar_SetValueQuick (&v_color_enable, 1);
1724 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1727 Cvar_SetValueQuick (&v_color_enable, 1);
1728 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1731 Cvar_SetValueQuick (&v_color_enable, 1);
1732 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1735 Cvar_SetValueQuick (&v_color_enable, 1);
1736 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1737 Cvar_SetValueQuick (&v_color_white_r, f);
1738 Cvar_SetValueQuick (&v_color_white_g, f);
1739 Cvar_SetValueQuick (&v_color_white_b, f);
1744 void M_Options_ColorControl_Draw (void)
1746 float x, y, c, s, t, u, v;
1749 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1750 p = Draw_CachePic("gfx/p_option.lmp");
1751 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1754 M_Print(16, y, " Reset to defaults");y += 8;
1755 M_ItemPrint(16, y, "Hardware Gamma Control", vid_hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1756 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;
1757 M_ItemPrint(16, y, " Contrast", !v_color_enable.integer);M_DrawSlider(220, y, v_contrast.value, 1, 5);y += 8;
1758 M_ItemPrint(16, y, " Brightness", !v_color_enable.integer);M_DrawSlider(220, y, v_brightness.value, 0, 0.8);y += 8;
1759 M_Print(16, y, " Color Level Controls");M_DrawCheckbox(220, y, v_color_enable.integer);y += 8;
1760 M_ItemPrint(16, y, " Black: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_r.value, 0, 0.8);y += 8;
1761 M_ItemPrint(16, y, " Black: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_g.value, 0, 0.8);y += 8;
1762 M_ItemPrint(16, y, " Black: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_b.value, 0, 0.8);y += 8;
1763 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;
1764 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;
1765 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;
1766 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;
1767 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;
1768 M_ItemPrint(16, y, " White: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_r.value, 1, 5);y += 8;
1769 M_ItemPrint(16, y, " White: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_g.value, 1, 5);y += 8;
1770 M_ItemPrint(16, y, " White: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_b.value, 1, 5);y += 8;
1771 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;
1774 DrawQ_Fill(menu_x, menu_y + y, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);y += 4;
1775 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1776 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1777 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;
1778 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;
1779 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;
1780 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;
1781 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;
1782 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;
1783 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;
1784 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;
1786 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1787 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1788 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1793 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, 0, 0, 1, 0);
1794 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);
1795 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);
1797 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, c, 0, 1, 0);
1798 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);
1799 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);
1801 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, 0, c, 1, 0);
1802 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);
1803 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);
1805 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, c, c, 1, 0);
1806 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);
1807 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);
1810 M_DrawCharacter(200, 32 + options_colorcontrol_cursor*8, 12+((int)(realtime*4)&1));
1814 void M_Options_ColorControl_Key (int k)
1823 m_entersound = true;
1824 switch (options_colorcontrol_cursor)
1827 Cvar_SetValueQuick(&v_hwgamma, 1);
1828 Cvar_SetValueQuick(&v_gamma, 1);
1829 Cvar_SetValueQuick(&v_contrast, 1);
1830 Cvar_SetValueQuick(&v_brightness, 0);
1831 Cvar_SetValueQuick(&v_color_enable, 0);
1832 Cvar_SetValueQuick(&v_color_black_r, 0);
1833 Cvar_SetValueQuick(&v_color_black_g, 0);
1834 Cvar_SetValueQuick(&v_color_black_b, 0);
1835 Cvar_SetValueQuick(&v_color_grey_r, 0);
1836 Cvar_SetValueQuick(&v_color_grey_g, 0);
1837 Cvar_SetValueQuick(&v_color_grey_b, 0);
1838 Cvar_SetValueQuick(&v_color_white_r, 1);
1839 Cvar_SetValueQuick(&v_color_white_g, 1);
1840 Cvar_SetValueQuick(&v_color_white_b, 1);
1841 Cbuf_AddText ("exec default.cfg\n");
1844 M_Menu_Options_ColorControl_AdjustSliders (1);
1850 S_LocalSound ("misc/menu1.wav");
1851 options_colorcontrol_cursor--;
1852 if (options_colorcontrol_cursor < 0)
1853 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1857 S_LocalSound ("misc/menu1.wav");
1858 options_colorcontrol_cursor++;
1859 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1860 options_colorcontrol_cursor = 0;
1864 M_Menu_Options_ColorControl_AdjustSliders (-1);
1868 M_Menu_Options_ColorControl_AdjustSliders (1);
1874 //=============================================================================
1877 char *quakebindnames[][2] =
1879 {"+attack", "attack"},
1880 {"impulse 10", "next weapon"},
1881 {"impulse 12", "previous weapon"},
1882 {"+jump", "jump / swim up"},
1883 {"+forward", "walk forward"},
1884 {"+back", "backpedal"},
1885 {"+left", "turn left"},
1886 {"+right", "turn right"},
1888 {"+moveleft", "step left"},
1889 {"+moveright", "step right"},
1890 {"+strafe", "sidestep"},
1891 {"+lookup", "look up"},
1892 {"+lookdown", "look down"},
1893 {"centerview", "center view"},
1894 {"+mlook", "mouse look"},
1895 {"+klook", "keyboard look"},
1896 {"+moveup", "swim up"},
1897 {"+movedown", "swim down"}
1900 char *transfusionbindnames[][2] =
1902 {"+forward", "walk forward"},
1903 {"+back", "backpedal"},
1904 {"+left", "turn left"},
1905 {"+right", "turn right"},
1906 {"+moveleft", "step left"},
1907 {"+moveright", "step right"},
1908 {"+jump", "jump / swim up"},
1909 {"+movedown", "swim down"},
1910 {"+attack", "attack"},
1911 {"+button3", "altfire"},
1912 {"impulse 1", "Pitch Fork"},
1913 {"impulse 2", "Flare Gun"},
1914 {"impulse 3", "Shotgun"},
1915 {"impulse 4", "Machine Gun"},
1916 {"impulse 5", "Incinerator"},
1917 {"impulse 6", "Bombs"},
1918 {"impulse 7", "Aerosol Can"},
1919 {"impulse 8", "Tesla Cannon"},
1920 {"impulse 9", "Life Leech"},
1921 {"impulse 17", "Voodoo Doll"},
1922 {"impulse 11", "previous weapon"},
1923 {"impulse 10", "next weapon"},
1924 {"impulse 14", "previous item"},
1925 {"impulse 15", "next item"},
1926 {"impulse 13", "use item"},
1927 {"impulse 100", "add bot (red)"},
1928 {"impulse 101", "add bot (blue)"},
1929 {"impulse 102", "kick a bot"},
1930 {"impulse 50", "voting menu"},
1931 {"impulse 141", "identify player"},
1932 {"impulse 16", "next armor type"},
1933 {"impulse 20", "observer mode"}
1937 char *(*bindnames)[2];
1940 typedef struct binditem_s
1942 char *command, *description;
1943 struct binditem_s *next;
1947 typedef struct bindcategory_s
1951 struct bindcategory_s *next;
1955 bindcategory_t *bindcategories = NULL;
1957 void M_ClearBinds (void)
1959 for (c = bindcategories;c;c = cnext)
1962 for (b = c->binds;b;b = bnext)
1969 bindcategories = NULL;
1972 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1974 for (b = &c->binds;*b;*b = &(*b)->next);
1975 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1976 *b->command = (char *)((*b) + 1);
1977 *b->description = *b->command + strlen(command) + 1;
1978 strcpy(*b->command, command);
1979 strcpy(*b->description, description);
1982 void M_AddBind (char *category, char *command, char *description)
1984 for (c = &bindcategories;*c;c = &(*c)->next)
1986 if (!strcmp(category, (*c)->name))
1988 M_AddBindToCategory(*c, command, description);
1992 *c = Z_Alloc(sizeof(bindcategory_t));
1993 M_AddBindToCategory(*c, command, description);
1996 void M_DefaultBinds (void)
1999 M_AddBind("movement", "+jump", "jump / swim up");
2000 M_AddBind("movement", "+forward", "walk forward");
2001 M_AddBind("movement", "+back", "backpedal");
2002 M_AddBind("movement", "+left", "turn left");
2003 M_AddBind("movement", "+right", "turn right");
2004 M_AddBind("movement", "+speed", "run");
2005 M_AddBind("movement", "+moveleft", "step left");
2006 M_AddBind("movement", "+moveright", "step right");
2007 M_AddBind("movement", "+strafe", "sidestep");
2008 M_AddBind("movement", "+lookup", "look up");
2009 M_AddBind("movement", "+lookdown", "look down");
2010 M_AddBind("movement", "centerview", "center view");
2011 M_AddBind("movement", "+mlook", "mouse look");
2012 M_AddBind("movement", "+klook", "keyboard look");
2013 M_AddBind("movement", "+moveup", "swim up");
2014 M_AddBind("movement", "+movedown", "swim down");
2015 M_AddBind("weapons", "+attack", "attack");
2016 M_AddBind("weapons", "impulse 10", "next weapon");
2017 M_AddBind("weapons", "impulse 12", "previous weapon");
2018 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2019 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2020 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2021 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2022 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2023 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2024 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2025 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2033 void M_Menu_Keys_f (void)
2035 key_dest = key_menu;
2037 m_entersound = true;
2042 void M_FindKeysForCommand (char *command, int *keys)
2048 for (j = 0;j < NUMKEYS;j++)
2053 for (j=0 ; j<256 ; j++)
2058 if (!strcmp (b, command) )
2061 if (count == NUMKEYS)
2067 void M_UnbindCommand (char *command)
2072 for (j=0 ; j<256 ; j++)
2077 if (!strcmp (b, command))
2078 Key_SetBinding (j, "");
2083 void M_Keys_Draw (void)
2089 char keystring[1024];
2091 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2092 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2095 M_Print (12, 32, "Press a key or button for this action");
2097 M_Print (18, 32, "Enter to change, backspace to clear");
2099 // search for known bindings
2100 for (i=0 ; i<numcommands ; i++)
2104 M_Print (16, y, bindnames[i][1]);
2106 M_FindKeysForCommand (bindnames[i][0], keys);
2108 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2110 strcpy(keystring, "???");
2114 for (j = 0;j < NUMKEYS;j++)
2119 strcat(keystring, " or ");
2120 strcat(keystring, Key_KeynumToString (keys[j]));
2124 M_Print (150, y, keystring);
2128 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2130 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2134 void M_Keys_Key (int k)
2141 S_LocalSound ("misc/menu1.wav");
2146 else //if (k != '`')
2148 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2149 Cbuf_InsertText (cmd);
2159 M_Menu_Options_f ();
2164 S_LocalSound ("misc/menu1.wav");
2166 if (keys_cursor < 0)
2167 keys_cursor = numcommands-1;
2172 S_LocalSound ("misc/menu1.wav");
2174 if (keys_cursor >= numcommands)
2178 case K_ENTER: // go into bind mode
2179 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2180 S_LocalSound ("misc/menu2.wav");
2181 if (keys[NUMKEYS - 1] != -1)
2182 M_UnbindCommand (bindnames[keys_cursor][0]);
2186 case K_BACKSPACE: // delete bindings
2187 case K_DEL: // delete bindings
2188 S_LocalSound ("misc/menu2.wav");
2189 M_UnbindCommand (bindnames[keys_cursor][0]);
2194 //=============================================================================
2197 #define VIDEO_ITEMS 5
2199 int video_cursor = 0;
2200 int video_cursor_table[] = {56, 68, 80, 92, 116};
2201 // note: if modes are added to the beginning of this list, update the
2202 // video_resolution = x; in M_Menu_Video_f below
2203 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}};
2204 int video_resolution;
2206 extern int current_vid_fullscreen;
2207 extern int current_vid_width;
2208 extern int current_vid_height;
2209 extern int current_vid_bitsperpixel;
2210 extern int current_vid_stencil;
2213 void M_Menu_Video_f (void)
2215 key_dest = key_menu;
2217 m_entersound = true;
2219 // Look for the current resolution
2220 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
2222 if (video_resolutions[video_resolution][0] == current_vid_width &&
2223 video_resolutions[video_resolution][1] == current_vid_height)
2227 // Default to 800x600 if we didn't find it
2228 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
2230 // may need to update this number if mode list changes
2231 video_resolution = 4;
2232 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2233 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2238 void M_Video_Draw (void)
2243 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2244 p = Draw_CachePic("gfx/vidmodes.lmp");
2245 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2248 M_Print(16, video_cursor_table[0], " Resolution");
2249 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2250 M_Print (220, video_cursor_table[0], string);
2253 M_Print(16, video_cursor_table[1], " Bits per pixel");
2254 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2257 M_Print(16, video_cursor_table[2], " Fullscreen");
2258 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2261 M_Print(16, video_cursor_table[3], " Stencil");
2262 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2265 M_Print(220, video_cursor_table[4], "Apply");
2268 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2272 void M_Menu_Video_AdjustSliders (int dir)
2274 S_LocalSound ("misc/menu3.wav");
2276 switch (video_cursor)
2281 int new_resolution = video_resolution + dir;
2282 if (new_resolution < 0)
2283 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2284 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2285 video_resolution = 0;
2287 video_resolution = new_resolution;
2289 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2290 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2296 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2299 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2302 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2308 void M_Video_Key (int key)
2313 // vid_shared.c has a copy of the current video config. We restore it
2314 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2315 Cvar_SetValueQuick(&vid_width, current_vid_width);
2316 Cvar_SetValueQuick(&vid_height, current_vid_height);
2317 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2318 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2320 S_LocalSound ("misc/menu1.wav");
2321 M_Menu_Options_f ();
2325 m_entersound = true;
2326 switch (video_cursor)
2329 Cbuf_AddText ("vid_restart\n");
2330 M_Menu_Options_f ();
2333 M_Menu_Video_AdjustSliders (1);
2338 S_LocalSound ("misc/menu1.wav");
2340 if (video_cursor < 0)
2341 video_cursor = VIDEO_ITEMS-1;
2345 S_LocalSound ("misc/menu1.wav");
2347 if (video_cursor >= VIDEO_ITEMS)
2352 M_Menu_Video_AdjustSliders (-1);
2356 M_Menu_Video_AdjustSliders (1);
2361 //=============================================================================
2365 #define NUM_HELP_PAGES 6
2368 void M_Menu_Help_f (void)
2370 key_dest = key_menu;
2372 m_entersound = true;
2378 void M_Help_Draw (void)
2380 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2384 void M_Help_Key (int key)
2394 m_entersound = true;
2395 if (++help_page >= NUM_HELP_PAGES)
2401 m_entersound = true;
2402 if (--help_page < 0)
2403 help_page = NUM_HELP_PAGES-1;
2409 //=============================================================================
2413 int m_quit_prevstate;
2414 qboolean wasInMenus;
2416 char *quitMessage [] =
2418 /* .........1.........2.... */
2420 " Are you gonna quit ",
2421 " this game just like ",
2422 " everything else? ",
2425 " Milord, methinks that ",
2426 " thou art a lowly ",
2427 " quitter. Is this true? ",
2430 " Do I need to bust your ",
2431 " face open for trying ",
2435 " Man, I oughta smack you",
2436 " for trying to quit! ",
2440 " Press Y to quit like a ",
2441 " big loser in life. ",
2442 " Press N to stay proud ",
2443 " and successful! ",
2445 " If you press Y to ",
2446 " quit, I will summon ",
2447 " Satan all over your ",
2450 " Um, Asmodeus dislikes ",
2451 " his children trying to ",
2452 " quit. Press Y to return",
2453 " to your Tinkertoys. ",
2455 " If you quit now, I'll ",
2456 " throw a blanket-party ",
2457 " for you next time! ",
2461 /* .........1.........2.... */
2463 " Tired of fragging ",
2468 " Quit now and forfeit ",
2469 " your bodycount? ",
2473 " Are you sure you ",
2478 " Off to do something ",
2483 void M_Menu_Quit_f (void)
2485 if (m_state == m_quit)
2487 wasInMenus = (key_dest == key_menu);
2488 key_dest = key_menu;
2489 m_quit_prevstate = m_state;
2491 m_entersound = true;
2492 msgNumber = rand()&3; //&7;
2496 void M_Quit_Key (int key)
2505 m_state = m_quit_prevstate;
2506 m_entersound = true;
2510 key_dest = key_game;
2527 void M_Quit_Draw (void)
2529 M_DrawTextBox (56, 76, 24, 4);
2530 M_Print (64, 84, quitMessage[msgNumber*4+0]);
2531 M_Print (64, 92, quitMessage[msgNumber*4+1]);
2532 M_Print (64, 100, quitMessage[msgNumber*4+2]);
2533 M_Print (64, 108, quitMessage[msgNumber*4+3]);
2536 //=============================================================================
2537 /* LAN CONFIG MENU */
2539 int lanConfig_cursor = -1;
2540 int lanConfig_cursor_table [] = {72, 92, 112, 144};
2541 #define NUM_LANCONFIG_CMDS 4
2544 char lanConfig_portname[6];
2545 char lanConfig_joinname[22];
2547 void M_Menu_LanConfig_f (void)
2549 key_dest = key_menu;
2550 m_state = m_lanconfig;
2551 m_entersound = true;
2552 if (lanConfig_cursor == -1)
2554 if (JoiningGame && TCPIPConfig)
2555 lanConfig_cursor = 2;
2557 lanConfig_cursor = 1;
2559 if (StartingGame && lanConfig_cursor == 2)
2560 lanConfig_cursor = 1;
2561 lanConfig_port = DEFAULTnet_hostport;
2562 sprintf(lanConfig_portname, "%u", lanConfig_port);
2564 m_return_onerror = false;
2565 m_return_reason[0] = 0;
2569 void M_LanConfig_Draw (void)
2576 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2577 p = Draw_CachePic ("gfx/p_multi.lmp");
2578 basex = (320-p->width)/2;
2579 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2582 startJoin = "New Game";
2584 startJoin = "Join Game";
2588 protocol = "TCP/IP";
2589 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2592 M_Print (basex, 52, "Address:");
2594 M_Print (basex+9*8, 52, my_ipx_address);
2596 M_Print (basex+9*8, 52, my_tcpip_address);
2598 M_Print (basex, lanConfig_cursor_table[0], "Port");
2599 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2600 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2604 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2605 M_Print (basex, lanConfig_cursor_table[2], "Search for internet games...");
2606 M_Print (basex, 128, "Join game at:");
2607 M_DrawTextBox (basex+8, lanConfig_cursor_table[3]-8, 22, 1);
2608 M_Print (basex+16, lanConfig_cursor_table[3], lanConfig_joinname);
2612 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2613 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2616 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2618 if (lanConfig_cursor == 0)
2619 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2621 if (lanConfig_cursor == 3)
2622 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [3], 10+((int)(realtime*4)&1));
2624 if (*m_return_reason)
2625 M_PrintWhite (basex, 168, m_return_reason);
2629 void M_LanConfig_Key (int key)
2640 S_LocalSound ("misc/menu1.wav");
2642 if (lanConfig_cursor < 0)
2643 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2647 S_LocalSound ("misc/menu1.wav");
2649 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2650 lanConfig_cursor = 0;
2654 if (lanConfig_cursor == 0)
2657 m_entersound = true;
2659 M_ConfigureNetSubsystem ();
2661 if (lanConfig_cursor == 1 || lanConfig_cursor == 2)
2665 M_Menu_GameOptions_f ();
2668 if (lanConfig_cursor == 1)
2671 M_Menu_InetSearch_f();
2675 if (lanConfig_cursor == 3)
2677 m_return_state = m_state;
2678 m_return_onerror = true;
2679 key_dest = key_game;
2681 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2688 if (lanConfig_cursor == 0)
2690 if (strlen(lanConfig_portname))
2691 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2694 if (lanConfig_cursor == 3)
2696 if (strlen(lanConfig_joinname))
2697 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2702 if (key < 32 || key > 127)
2705 if (lanConfig_cursor == 3)
2707 l = strlen(lanConfig_joinname);
2710 lanConfig_joinname[l+1] = 0;
2711 lanConfig_joinname[l] = key;
2715 if (key < '0' || key > '9')
2717 if (lanConfig_cursor == 0)
2719 l = strlen(lanConfig_portname);
2722 lanConfig_portname[l+1] = 0;
2723 lanConfig_portname[l] = key;
2728 if (StartingGame && lanConfig_cursor == 3)
2730 if (key == K_UPARROW)
2731 lanConfig_cursor = 1;
2733 lanConfig_cursor = 0;
2736 l = atoi(lanConfig_portname);
2741 sprintf(lanConfig_portname, "%u", lanConfig_port);
2744 //=============================================================================
2745 /* GAME OPTIONS MENU */
2764 episode_t *episodes;
2769 level_t quakelevels[] =
2771 {"start", "Entrance"}, // 0
2773 {"e1m1", "Slipgate Complex"}, // 1
2774 {"e1m2", "Castle of the Damned"},
2775 {"e1m3", "The Necropolis"},
2776 {"e1m4", "The Grisly Grotto"},
2777 {"e1m5", "Gloom Keep"},
2778 {"e1m6", "The Door To Chthon"},
2779 {"e1m7", "The House of Chthon"},
2780 {"e1m8", "Ziggurat Vertigo"},
2782 {"e2m1", "The Installation"}, // 9
2783 {"e2m2", "Ogre Citadel"},
2784 {"e2m3", "Crypt of Decay"},
2785 {"e2m4", "The Ebon Fortress"},
2786 {"e2m5", "The Wizard's Manse"},
2787 {"e2m6", "The Dismal Oubliette"},
2788 {"e2m7", "Underearth"},
2790 {"e3m1", "Termination Central"}, // 16
2791 {"e3m2", "The Vaults of Zin"},
2792 {"e3m3", "The Tomb of Terror"},
2793 {"e3m4", "Satan's Dark Delight"},
2794 {"e3m5", "Wind Tunnels"},
2795 {"e3m6", "Chambers of Torment"},
2796 {"e3m7", "The Haunted Halls"},
2798 {"e4m1", "The Sewage System"}, // 23
2799 {"e4m2", "The Tower of Despair"},
2800 {"e4m3", "The Elder God Shrine"},
2801 {"e4m4", "The Palace of Hate"},
2802 {"e4m5", "Hell's Atrium"},
2803 {"e4m6", "The Pain Maze"},
2804 {"e4m7", "Azure Agony"},
2805 {"e4m8", "The Nameless City"},
2807 {"end", "Shub-Niggurath's Pit"}, // 31
2809 {"dm1", "Place of Two Deaths"}, // 32
2810 {"dm2", "Claustrophobopolis"},
2811 {"dm3", "The Abandoned Base"},
2812 {"dm4", "The Bad Place"},
2813 {"dm5", "The Cistern"},
2814 {"dm6", "The Dark Zone"}
2817 episode_t quakeepisodes[] =
2819 {"Welcome to Quake", 0, 1},
2820 {"Doomed Dimension", 1, 8},
2821 {"Realm of Black Magic", 9, 7},
2822 {"Netherworld", 16, 7},
2823 {"The Elder World", 23, 8},
2824 {"Final Level", 31, 1},
2825 {"Deathmatch Arena", 32, 6}
2828 //MED 01/06/97 added hipnotic levels
2829 level_t hipnoticlevels[] =
2831 {"start", "Command HQ"}, // 0
2833 {"hip1m1", "The Pumping Station"}, // 1
2834 {"hip1m2", "Storage Facility"},
2835 {"hip1m3", "The Lost Mine"},
2836 {"hip1m4", "Research Facility"},
2837 {"hip1m5", "Military Complex"},
2839 {"hip2m1", "Ancient Realms"}, // 6
2840 {"hip2m2", "The Black Cathedral"},
2841 {"hip2m3", "The Catacombs"},
2842 {"hip2m4", "The Crypt"},
2843 {"hip2m5", "Mortum's Keep"},
2844 {"hip2m6", "The Gremlin's Domain"},
2846 {"hip3m1", "Tur Torment"}, // 12
2847 {"hip3m2", "Pandemonium"},
2848 {"hip3m3", "Limbo"},
2849 {"hip3m4", "The Gauntlet"},
2851 {"hipend", "Armagon's Lair"}, // 16
2853 {"hipdm1", "The Edge of Oblivion"} // 17
2856 //MED 01/06/97 added hipnotic episodes
2857 episode_t hipnoticepisodes[] =
2859 {"Scourge of Armagon", 0, 1},
2860 {"Fortress of the Dead", 1, 5},
2861 {"Dominion of Darkness", 6, 6},
2862 {"The Rift", 12, 4},
2863 {"Final Level", 16, 1},
2864 {"Deathmatch Arena", 17, 1}
2867 //PGM 01/07/97 added rogue levels
2868 //PGM 03/02/97 added dmatch level
2869 level_t roguelevels[] =
2871 {"start", "Split Decision"},
2872 {"r1m1", "Deviant's Domain"},
2873 {"r1m2", "Dread Portal"},
2874 {"r1m3", "Judgement Call"},
2875 {"r1m4", "Cave of Death"},
2876 {"r1m5", "Towers of Wrath"},
2877 {"r1m6", "Temple of Pain"},
2878 {"r1m7", "Tomb of the Overlord"},
2879 {"r2m1", "Tempus Fugit"},
2880 {"r2m2", "Elemental Fury I"},
2881 {"r2m3", "Elemental Fury II"},
2882 {"r2m4", "Curse of Osiris"},
2883 {"r2m5", "Wizard's Keep"},
2884 {"r2m6", "Blood Sacrifice"},
2885 {"r2m7", "Last Bastion"},
2886 {"r2m8", "Source of Evil"},
2887 {"ctf1", "Division of Change"}
2890 //PGM 01/07/97 added rogue episodes
2891 //PGM 03/02/97 added dmatch episode
2892 episode_t rogueepisodes[] =
2894 {"Introduction", 0, 1},
2895 {"Hell's Fortress", 1, 7},
2896 {"Corridors of Time", 8, 8},
2897 {"Deathmatch Arena", 16, 1}
2900 level_t nehahralevels[] =
2902 {"nehstart", "Welcome to Nehahra"},
2903 {"neh1m1", "Forge City1: Slipgates"},
2904 {"neh1m2", "Forge City2: Boiler"},
2905 {"neh1m3", "Forge City3: Escape"},
2906 {"neh1m4", "Grind Core"},
2907 {"neh1m5", "Industrial Silence"},
2908 {"neh1m6", "Locked-Up Anger"},
2909 {"neh1m7", "Wanderer of the Wastes"},
2910 {"neh1m8", "Artemis System Net"},
2911 {"neh1m9", "To the Death"},
2912 {"neh2m1", "The Gates of Ghoro"},
2913 {"neh2m2", "Sacred Trinity"},
2914 {"neh2m3", "Realm of the Ancients"},
2915 {"neh2m4", "Temple of the Ancients"},
2916 {"neh2m5", "Dreams Made Flesh"},
2917 {"neh2m6", "Your Last Cup of Sorrow"},
2918 {"nehsec", "Ogre's Bane"},
2919 {"nehahra", "Nehahra's Den"},
2920 {"nehend", "Quintessence"}
2923 episode_t nehahraepisodes[] =
2925 {"Welcome to Nehahra", 0, 1},
2926 {"The Fall of Forge", 1, 9},
2927 {"The Outlands", 10, 7},
2928 {"Dimension of the Lost", 17, 2}
2931 // Map list for Transfusion
2932 level_t transfusionlevels[] =
2934 {"bb1", "The Stronghold"},
2935 {"bb2", "Winter Wonderland"},
2937 {"bb4", "The Tower"},
2939 {"bb6", "Twin Fortress"},
2941 {"bb8", "Fun With Heads"},
2943 {"e1m1", "Cradle to Grave"},
2944 {"e1m2", "Wrong Side of the Tracks"},
2945 {"e1m7", "Altar of Stone"},
2946 {"e2m8", "The Lair of Shial"},
2947 {"e3m7", "The Pit of Cerberus"},
2948 {"e4m8", "The Hall of the Epiphany"},
2949 {"e4m9", "Mall of the Dead"},
2951 {"dm1", "Monolith Building 11"},
2954 {"e6m1", "Welcome to Your Life"},
2955 {"e6m8", "Beauty and the Beast"},
2957 {"cpbb01", "Crypt of Despair"},
2958 {"cpbb03", "Unholy Cathedral"},
2960 {"b2a15", "Area 15 (B2)"},
2961 {"barena", "Blood Arena"},
2962 {"bkeep", "Blood Keep"},
2963 {"bstar", "Brown Star"},
2964 {"crypt", "The Crypt"},
2966 {"bb3_2k1", "Bodies Infusion"},
2967 {"dcamp", "DeathCamp"},
2968 {"highnoon", "HighNoon"},
2969 {"qbb1", "The Confluence"},
2970 {"qbb2", "KathartiK"},
2971 {"qbb3", "Caleb's Woodland Retreat"},
2973 {"dranzbb6", "Black Coffee"},
2974 {"fragm", "Frag'M"},
2976 {"qe1m7", "The House of Chthon"},
2977 {"simple", "Dead Simple"}
2980 episode_t transfusionepisodes[] =
2983 {"Blood Single Player", 8, 7},
2984 {"Plasma Pack", 15, 5},
2985 {"Cryptic Passage", 20, 2},
2987 {"Transfusion", 27, 6},
2988 {"Conversions", 33, 5}
2991 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2992 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2993 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2994 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2995 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2996 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
3001 gamelevels_t *notregistered;
3002 gamelevels_t *registered;
3006 gameinfo_t gamelist[] =
3008 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3009 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3010 {GAME_ROGUE, &roguegame, &roguegame},
3011 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3012 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3013 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3016 gamelevels_t *lookupgameinfo(void)
3019 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3020 if (registered.integer)
3021 return gamelist[i].registered;
3023 return gamelist[i].notregistered;
3029 qboolean m_serverInfoMessage = false;
3030 double m_serverInfoMessageTime;
3032 extern cvar_t sv_public;
3034 void M_Menu_GameOptions_f (void)
3036 key_dest = key_menu;
3037 m_state = m_gameoptions;
3038 m_entersound = true;
3039 if (maxplayers == 0)
3040 maxplayers = svs.maxclients;
3042 maxplayers = MAX_SCOREBOARD;
3046 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 120, 128};
3047 #define NUM_GAMEOPTIONS 10
3048 int gameoptions_cursor;
3050 void M_GameOptions_Draw (void)
3056 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3057 p = Draw_CachePic ("gfx/p_multi.lmp");
3058 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3060 M_DrawTextBox (152, 32, 10, 1);
3061 M_Print (160, 40, "begin game");
3063 M_Print (0, 56, " Max players");
3064 M_Print (160, 56, va("%i", maxplayers) );
3066 M_Print (0, 64, " Game Type");
3067 if (gamemode == GAME_TRANSFUSION)
3069 if (!deathmatch.integer)
3070 Cvar_SetValue("deathmatch", 1);
3071 if (deathmatch.integer == 2)
3072 M_Print (160, 64, "Capture the Flag");
3074 M_Print (160, 64, "Blood Bath");
3078 if (!coop.integer && !deathmatch.integer)
3079 Cvar_SetValue("deathmatch", 1);
3081 M_Print (160, 64, "Cooperative");
3083 M_Print (160, 64, "Deathmatch");
3086 M_Print (0, 72, " Teamplay");
3087 if (gamemode == GAME_ROGUE)
3091 switch((int)teamplay.integer)
3093 case 1: msg = "No Friendly Fire"; break;
3094 case 2: msg = "Friendly Fire"; break;
3095 case 3: msg = "Tag"; break;
3096 case 4: msg = "Capture the Flag"; break;
3097 case 5: msg = "One Flag CTF"; break;
3098 case 6: msg = "Three Team CTF"; break;
3099 default: msg = "Off"; break;
3101 M_Print (160, 72, msg);
3103 else if (gamemode == GAME_TRANSFUSION)
3107 switch (teamplay.integer)
3109 case 0: msg = "Off"; break;
3110 case 2: msg = "Friendly Fire"; break;
3111 default: msg = "No Friendly Fire"; break;
3113 M_Print (160, 72, msg);
3119 switch((int)teamplay.integer)
3121 case 1: msg = "No Friendly Fire"; break;
3122 case 2: msg = "Friendly Fire"; break;
3123 default: msg = "Off"; break;
3125 M_Print (160, 72, msg);
3128 M_Print (0, 80, " Skill");
3129 if (skill.integer == 0)
3130 M_Print (160, 80, "Easy difficulty");
3131 else if (skill.integer == 1)
3132 M_Print (160, 80, "Normal difficulty");
3133 else if (skill.integer == 2)
3134 M_Print (160, 80, "Hard difficulty");
3136 M_Print (160, 80, "Nightmare difficulty");
3138 M_Print (0, 88, " Frag Limit");
3139 if (fraglimit.integer == 0)
3140 M_Print (160, 88, "none");
3142 M_Print (160, 88, va("%i frags", fraglimit.integer));
3144 M_Print (0, 96, " Time Limit");
3145 if (timelimit.integer == 0)
3146 M_Print (160, 96, "none");
3148 M_Print (160, 96, va("%i minutes", timelimit.integer));
3150 M_Print (0, 104, " Public server");
3151 M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes");
3153 g = lookupgameinfo();
3155 M_Print (0, 120, " Episode");
3156 M_Print (160, 120, g->episodes[startepisode].description);
3158 M_Print (0, 128, " Level");
3159 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3160 M_Print (160, 136, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3163 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3165 if (m_serverInfoMessage)
3167 if ((realtime - m_serverInfoMessageTime) < 5.0)
3170 M_DrawTextBox (x, 138, 24, 4);
3172 M_Print (x, 146, " More than 64 players?? ");
3173 M_Print (x, 154, " First, question your ");
3174 M_Print (x, 162, " sanity, then email ");
3175 M_Print (x, 170, " havoc@telefragged.com ");
3179 m_serverInfoMessage = false;
3185 void M_NetStart_Change (int dir)
3190 switch (gameoptions_cursor)
3194 if (maxplayers > MAX_SCOREBOARD)
3196 maxplayers = MAX_SCOREBOARD;
3197 m_serverInfoMessage = true;
3198 m_serverInfoMessageTime = realtime;
3205 if (gamemode == GAME_TRANSFUSION)
3207 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3208 Cvar_SetValueQuick (&deathmatch, 0);
3209 else // changing from BloodBath to CTF
3210 Cvar_SetValueQuick (&deathmatch, 2);
3214 if (deathmatch.integer) // changing from deathmatch to coop
3216 Cvar_SetValueQuick (&coop, 1);
3217 Cvar_SetValueQuick (&deathmatch, 0);
3219 else // changing from coop to deathmatch
3221 Cvar_SetValueQuick (&coop, 0);
3222 Cvar_SetValueQuick (&deathmatch, 1);
3228 if (gamemode == GAME_ROGUE)
3233 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3234 if (teamplay.integer > count)
3235 Cvar_SetValueQuick (&teamplay, 0);
3236 else if (teamplay.integer < 0)
3237 Cvar_SetValueQuick (&teamplay, count);
3241 Cvar_SetValueQuick (&skill, skill.integer + dir);
3242 if (skill.integer > 3)
3243 Cvar_SetValueQuick (&skill, 0);
3244 if (skill.integer < 0)
3245 Cvar_SetValueQuick (&skill, 3);
3249 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3250 if (fraglimit.integer > 100)
3251 Cvar_SetValueQuick (&fraglimit, 0);
3252 if (fraglimit.integer < 0)
3253 Cvar_SetValueQuick (&fraglimit, 100);
3257 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3258 if (timelimit.value > 60)
3259 Cvar_SetValueQuick (&timelimit, 0);
3260 if (timelimit.value < 0)
3261 Cvar_SetValueQuick (&timelimit, 60);
3265 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3269 startepisode += dir;
3270 g = lookupgameinfo();
3272 if (startepisode < 0)
3273 startepisode = g->numepisodes - 1;
3275 if (startepisode >= g->numepisodes)
3283 g = lookupgameinfo();
3286 startlevel = g->episodes[startepisode].levels - 1;
3288 if (startlevel >= g->episodes[startepisode].levels)
3294 void M_GameOptions_Key (int key)
3305 S_LocalSound ("misc/menu1.wav");
3306 gameoptions_cursor--;
3307 if (gameoptions_cursor < 0)
3308 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3312 S_LocalSound ("misc/menu1.wav");
3313 gameoptions_cursor++;
3314 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3315 gameoptions_cursor = 0;
3319 if (gameoptions_cursor == 0)
3321 S_LocalSound ("misc/menu3.wav");
3322 M_NetStart_Change (-1);
3326 if (gameoptions_cursor == 0)
3328 S_LocalSound ("misc/menu3.wav");
3329 M_NetStart_Change (1);
3333 S_LocalSound ("misc/menu2.wav");
3334 if (gameoptions_cursor == 0)
3337 Cbuf_AddText ("disconnect\n");
3338 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
3339 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3341 g = lookupgameinfo();
3342 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3346 M_NetStart_Change (1);
3351 //=============================================================================
3354 qboolean searchComplete = false;
3355 double searchCompleteTime;
3357 void M_Menu_Search_f (void)
3359 key_dest = key_menu;
3361 m_entersound = false;
3364 searchComplete = false;
3370 void M_Search_Draw (void)
3375 p = Draw_CachePic ("gfx/p_multi.lmp");
3376 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3377 x = (320/2) - ((12*8)/2) + 4;
3378 M_DrawTextBox (x-8, 32, 12, 1);
3379 M_Print (x, 40, "Searching...");
3387 if (! searchComplete)
3389 searchComplete = true;
3390 searchCompleteTime = realtime;
3395 M_Menu_ServerList_f ();
3399 M_PrintWhite ((320/2) - ((22*8)/2), 64, va("No %s servers found", gamename));
3400 if ((realtime - searchCompleteTime) < 3.0)
3403 M_Menu_LanConfig_f ();
3407 void M_Search_Key (int key)
3411 //=============================================================================
3412 /* INTERNET SEARCH MENU */
3414 void M_Menu_InetSearch_f (void)
3416 key_dest = key_menu;
3418 m_entersound = false;
3421 searchComplete = false;
3427 void M_InetSearch_Draw (void)
3429 M_Search_Draw (); // it's the same one, so why bother?
3433 void M_InetSearch_Key (int key)
3437 //=============================================================================
3441 qboolean slist_sorted;
3443 void M_Menu_ServerList_f (void)
3445 key_dest = key_menu;
3447 m_entersound = true;
3449 m_return_onerror = false;
3450 m_return_reason[0] = 0;
3451 slist_sorted = false;
3455 void M_ServerList_Draw (void)
3463 if (hostCacheCount > 1)
3467 for (i = 0; i < hostCacheCount; i++)
3468 for (j = i+1; j < hostCacheCount; j++)
3469 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3471 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3472 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3473 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3476 slist_sorted = true;
3479 p = Draw_CachePic ("gfx/p_multi.lmp");
3480 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3481 for (n = 0; n < hostCacheCount; n++)
3483 if (hostcache[n].maxusers)
3484 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3486 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3487 M_Print (16, 32 + 8*n, string);
3489 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3491 if (*m_return_reason)
3492 M_PrintWhite (16, 168, m_return_reason);
3496 void M_ServerList_Key (int k)
3501 M_Menu_LanConfig_f ();
3510 S_LocalSound ("misc/menu1.wav");
3512 if (slist_cursor < 0)
3513 slist_cursor = hostCacheCount - 1;
3518 S_LocalSound ("misc/menu1.wav");
3520 if (slist_cursor >= hostCacheCount)
3525 S_LocalSound ("misc/menu2.wav");
3526 m_return_state = m_state;
3527 m_return_onerror = true;
3528 slist_sorted = false;
3529 key_dest = key_game;
3531 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3540 //=============================================================================
3541 /* Menu Subsystem */
3546 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3548 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3549 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3550 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3551 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3552 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3553 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3554 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3555 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3556 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3557 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3558 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3559 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3560 Cmd_AddCommand ("help", M_Menu_Help_f);
3561 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3563 if (gamemode == GAME_TRANSFUSION)
3565 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3566 bindnames = transfusionbindnames;
3570 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3571 bindnames = quakebindnames;
3574 if (gamemode == GAME_NEHAHRA)
3576 if (FS_FileExists("maps/neh1m4.bsp"))
3578 if (FS_FileExists("hearing.dem"))
3580 Con_Printf("Nehahra movie and game detected.\n");
3581 NehGameType = TYPE_BOTH;
3585 Con_Printf("Nehahra game detected.\n");
3586 NehGameType = TYPE_GAME;
3591 if (FS_FileExists("hearing.dem"))
3593 Con_Printf("Nehahra movie detected.\n");
3594 NehGameType = TYPE_DEMO;
3598 Con_Printf("Nehahra not found.\n");
3599 NehGameType = TYPE_GAME; // could just complain, but...
3607 if (m_state == m_none || key_dest != key_menu)
3625 case m_singleplayer:
3626 M_SinglePlayer_Draw ();
3638 M_MultiPlayer_Draw ();
3653 case m_options_effects:
3654 M_Options_Effects_Draw ();
3657 case m_options_colorcontrol:
3658 M_Options_ColorControl_Draw ();
3678 M_LanConfig_Draw ();
3682 M_GameOptions_Draw ();
3690 M_ServerList_Draw ();
3696 S_LocalSound ("misc/menu2.wav");
3697 m_entersound = false;
3704 void M_Keydown (int key)
3719 case m_singleplayer:
3720 M_SinglePlayer_Key (key);
3732 M_MultiPlayer_Key (key);
3744 M_Options_Key (key);
3747 case m_options_effects:
3748 M_Options_Effects_Key (key);
3751 case m_options_colorcontrol:
3752 M_Options_ColorControl_Key (key);
3772 M_LanConfig_Key (key);
3776 M_GameOptions_Key (key);
3784 M_ServerList_Key (key);
3790 void M_ConfigureNetSubsystem(void)
3792 // enable/disable net systems to match desired config
3794 Cbuf_AddText ("stopdemo\n");
3796 if (IPXConfig || TCPIPConfig)
3797 net_hostport = lanConfig_port;