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/s%i.sav", fs_gamedir, 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 27
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;
1291 void M_Menu_Options_AdjustSliders (int dir)
1293 S_LocalSound ("misc/menu3.wav");
1295 switch (options_cursor)
1298 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1301 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1304 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1307 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1310 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1313 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1316 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1319 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1321 case 14: // music volume
1323 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1325 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1328 case 15: // sfx volume
1329 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1332 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1335 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1337 case 18: // static crosshair
1338 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1340 case 19: // show framerate
1341 Cvar_SetValueQuick (&showfps, !showfps.integer);
1343 case 20: // always run
1344 if (cl_forwardspeed.value > 200)
1346 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1347 Cvar_SetValueQuick (&cl_backspeed, 200);
1351 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1352 Cvar_SetValueQuick (&cl_backspeed, 400);
1355 case 21: // lookspring
1356 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1358 case 22: // lookstrafe
1359 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1361 case 23: // mouse speed
1362 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1364 case 24: // mouse look
1365 Cvar_SetValueQuick (&freelook, !freelook.integer);
1367 case 25: // invert mouse
1368 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1370 case 26: // windowed mouse
1371 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1376 void M_Options_Draw (void)
1381 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1382 p = Draw_CachePic("gfx/p_option.lmp");
1383 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1386 M_Print(16, y, " Customize controls");y += 8;
1387 M_Print(16, y, " Go to console");y += 8;
1388 M_Print(16, y, " Reset to defaults");y += 8;
1389 M_Print(16, y, " Video Options");y += 8;
1390 M_Print(16, y, " Effects Options");y += 8;
1391 M_Print(16, y, " Color Control Options");y += 8;
1392 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value, 0, 1);y += 8;
1393 M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8;
1394 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1395 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8;
1396 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1397 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1398 M_Print(16, y, "Delay refresh (faster)");M_DrawCheckbox(220, y, gl_delayfinish.integer);y += 8;
1399 M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8;
1400 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8;
1401 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8;
1402 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8;
1403 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8;
1404 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1405 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1406 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1407 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1408 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1409 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, sensitivity.value, 1, 50);y += 8;
1410 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1411 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1412 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1415 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1419 void M_Options_Key (int k)
1428 m_entersound = true;
1429 switch (options_cursor)
1436 Con_ToggleConsole_f ();
1439 Cbuf_AddText ("exec default.cfg\n");
1445 M_Menu_Options_Effects_f ();
1448 M_Menu_Options_ColorControl_f ();
1451 M_Menu_Options_AdjustSliders (1);
1457 S_LocalSound ("misc/menu1.wav");
1459 if (options_cursor < 0)
1460 options_cursor = OPTIONS_ITEMS-1;
1464 S_LocalSound ("misc/menu1.wav");
1466 if (options_cursor >= OPTIONS_ITEMS)
1471 M_Menu_Options_AdjustSliders (-1);
1475 M_Menu_Options_AdjustSliders (1);
1480 #define OPTIONS_EFFECTS_ITEMS 16
1482 int options_effects_cursor;
1484 void M_Menu_Options_Effects_f (void)
1486 key_dest = key_menu;
1487 m_state = m_options_effects;
1488 m_entersound = true;
1492 extern cvar_t r_detailtextures;
1493 extern cvar_t cl_particles;
1494 extern cvar_t cl_explosions;
1495 extern cvar_t cl_stainmaps;
1496 extern cvar_t r_explosionclip;
1497 extern cvar_t r_dlightmap;
1498 extern cvar_t r_modellights;
1499 extern cvar_t r_coronas;
1500 extern cvar_t gl_flashblend;
1501 extern cvar_t cl_particles_bulletimpacts;
1502 extern cvar_t cl_particles_smoke;
1503 extern cvar_t cl_particles_sparks;
1504 extern cvar_t cl_particles_bubbles;
1505 extern cvar_t cl_particles_blood;
1506 extern cvar_t cl_particles_blood_size;
1507 extern cvar_t cl_particles_blood_alpha;
1509 void M_Menu_Options_Effects_AdjustSliders (int dir)
1511 S_LocalSound ("misc/menu3.wav");
1513 switch (options_effects_cursor)
1516 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1519 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1522 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1525 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1528 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1531 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1534 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1537 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1540 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1543 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1546 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1549 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1552 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1555 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1558 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1561 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1566 void M_Options_Effects_Draw (void)
1571 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1572 p = Draw_CachePic("gfx/p_option.lmp");
1573 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1576 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value, 0, 8);y += 8;
1577 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1578 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1579 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1580 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1581 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1582 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1583 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1584 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1585 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1586 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1587 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1588 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1589 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1590 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, cl_particles_blood_size.value, 2, 20);y += 8;
1591 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, cl_particles_blood_alpha.value, 0.2, 1);y += 8;
1594 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1598 void M_Options_Effects_Key (int k)
1603 M_Menu_Options_f ();
1607 M_Menu_Options_Effects_AdjustSliders (1);
1611 S_LocalSound ("misc/menu1.wav");
1612 options_effects_cursor--;
1613 if (options_effects_cursor < 0)
1614 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1618 S_LocalSound ("misc/menu1.wav");
1619 options_effects_cursor++;
1620 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1621 options_effects_cursor = 0;
1625 M_Menu_Options_Effects_AdjustSliders (-1);
1629 M_Menu_Options_Effects_AdjustSliders (1);
1638 #define OPTIONS_COLORCONTROL_ITEMS 18
1640 int options_colorcontrol_cursor;
1642 // intensity value to match up to 50% dither to 'correct' quake
1643 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1645 void M_Menu_Options_ColorControl_f (void)
1647 key_dest = key_menu;
1648 m_state = m_options_colorcontrol;
1649 m_entersound = true;
1653 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1656 S_LocalSound ("misc/menu3.wav");
1658 switch (options_colorcontrol_cursor)
1661 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1664 Cvar_SetValueQuick (&v_color_enable, 0);
1665 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1668 Cvar_SetValueQuick (&v_color_enable, 0);
1669 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1672 Cvar_SetValueQuick (&v_color_enable, 0);
1673 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1676 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1679 Cvar_SetValueQuick (&v_color_enable, 1);
1680 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1683 Cvar_SetValueQuick (&v_color_enable, 1);
1684 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1687 Cvar_SetValueQuick (&v_color_enable, 1);
1688 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1691 Cvar_SetValueQuick (&v_color_enable, 1);
1692 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1693 Cvar_SetValueQuick (&v_color_black_r, f);
1694 Cvar_SetValueQuick (&v_color_black_g, f);
1695 Cvar_SetValueQuick (&v_color_black_b, f);
1698 Cvar_SetValueQuick (&v_color_enable, 1);
1699 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1702 Cvar_SetValueQuick (&v_color_enable, 1);
1703 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1706 Cvar_SetValueQuick (&v_color_enable, 1);
1707 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1710 Cvar_SetValueQuick (&v_color_enable, 1);
1711 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1712 Cvar_SetValueQuick (&v_color_grey_r, f);
1713 Cvar_SetValueQuick (&v_color_grey_g, f);
1714 Cvar_SetValueQuick (&v_color_grey_b, f);
1717 Cvar_SetValueQuick (&v_color_enable, 1);
1718 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1721 Cvar_SetValueQuick (&v_color_enable, 1);
1722 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1725 Cvar_SetValueQuick (&v_color_enable, 1);
1726 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1729 Cvar_SetValueQuick (&v_color_enable, 1);
1730 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1731 Cvar_SetValueQuick (&v_color_white_r, f);
1732 Cvar_SetValueQuick (&v_color_white_g, f);
1733 Cvar_SetValueQuick (&v_color_white_b, f);
1738 void M_Options_ColorControl_Draw (void)
1740 float x, y, c, s, t, u, v;
1743 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1744 p = Draw_CachePic("gfx/p_option.lmp");
1745 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1748 M_Print(16, y, " Reset to defaults");y += 8;
1749 M_ItemPrint(16, y, "Hardware Gamma Control", vid_hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1750 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;
1751 M_ItemPrint(16, y, " Contrast", !v_color_enable.integer);M_DrawSlider(220, y, v_contrast.value, 1, 5);y += 8;
1752 M_ItemPrint(16, y, " Brightness", !v_color_enable.integer);M_DrawSlider(220, y, v_brightness.value, 0, 0.8);y += 8;
1753 M_Print(16, y, " Color Level Controls");M_DrawCheckbox(220, y, v_color_enable.integer);y += 8;
1754 M_ItemPrint(16, y, " Black: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_r.value, 0, 0.8);y += 8;
1755 M_ItemPrint(16, y, " Black: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_g.value, 0, 0.8);y += 8;
1756 M_ItemPrint(16, y, " Black: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_b.value, 0, 0.8);y += 8;
1757 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;
1758 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;
1759 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;
1760 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;
1761 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;
1762 M_ItemPrint(16, y, " White: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_r.value, 1, 5);y += 8;
1763 M_ItemPrint(16, y, " White: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_g.value, 1, 5);y += 8;
1764 M_ItemPrint(16, y, " White: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_b.value, 1, 5);y += 8;
1765 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;
1768 DrawQ_Fill(menu_x, menu_y + y, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);y += 4;
1769 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1770 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1771 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;
1772 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;
1773 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;
1774 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;
1775 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;
1776 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;
1777 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;
1778 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;
1780 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1781 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1782 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1787 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, 0, 0, 1, 0);
1788 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);
1789 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);
1791 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, c, 0, 1, 0);
1792 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);
1793 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);
1795 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, 0, c, 1, 0);
1796 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);
1797 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);
1799 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, c, c, 1, 0);
1800 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);
1801 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);
1804 M_DrawCharacter(200, 32 + options_colorcontrol_cursor*8, 12+((int)(realtime*4)&1));
1808 void M_Options_ColorControl_Key (int k)
1817 m_entersound = true;
1818 switch (options_colorcontrol_cursor)
1821 Cvar_SetValueQuick(&v_hwgamma, 1);
1822 Cvar_SetValueQuick(&v_gamma, 1);
1823 Cvar_SetValueQuick(&v_contrast, 1);
1824 Cvar_SetValueQuick(&v_brightness, 0);
1825 Cvar_SetValueQuick(&v_color_enable, 0);
1826 Cvar_SetValueQuick(&v_color_black_r, 0);
1827 Cvar_SetValueQuick(&v_color_black_g, 0);
1828 Cvar_SetValueQuick(&v_color_black_b, 0);
1829 Cvar_SetValueQuick(&v_color_grey_r, 0);
1830 Cvar_SetValueQuick(&v_color_grey_g, 0);
1831 Cvar_SetValueQuick(&v_color_grey_b, 0);
1832 Cvar_SetValueQuick(&v_color_white_r, 1);
1833 Cvar_SetValueQuick(&v_color_white_g, 1);
1834 Cvar_SetValueQuick(&v_color_white_b, 1);
1835 Cbuf_AddText ("exec default.cfg\n");
1838 M_Menu_Options_ColorControl_AdjustSliders (1);
1844 S_LocalSound ("misc/menu1.wav");
1845 options_colorcontrol_cursor--;
1846 if (options_colorcontrol_cursor < 0)
1847 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1851 S_LocalSound ("misc/menu1.wav");
1852 options_colorcontrol_cursor++;
1853 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1854 options_colorcontrol_cursor = 0;
1858 M_Menu_Options_ColorControl_AdjustSliders (-1);
1862 M_Menu_Options_ColorControl_AdjustSliders (1);
1868 //=============================================================================
1871 char *quakebindnames[][2] =
1873 {"+attack", "attack"},
1874 {"impulse 10", "next weapon"},
1875 {"impulse 12", "previous weapon"},
1876 {"+jump", "jump / swim up"},
1877 {"+forward", "walk forward"},
1878 {"+back", "backpedal"},
1879 {"+left", "turn left"},
1880 {"+right", "turn right"},
1882 {"+moveleft", "step left"},
1883 {"+moveright", "step right"},
1884 {"+strafe", "sidestep"},
1885 {"+lookup", "look up"},
1886 {"+lookdown", "look down"},
1887 {"centerview", "center view"},
1888 {"+mlook", "mouse look"},
1889 {"+klook", "keyboard look"},
1890 {"+moveup", "swim up"},
1891 {"+movedown", "swim down"}
1894 char *transfusionbindnames[][2] =
1896 {"+forward", "walk forward"},
1897 {"+back", "backpedal"},
1898 {"+left", "turn left"},
1899 {"+right", "turn right"},
1900 {"+moveleft", "step left"},
1901 {"+moveright", "step right"},
1902 {"+jump", "jump / swim up"},
1903 {"+movedown", "swim down"},
1904 {"+attack", "attack"},
1905 {"+button3", "altfire"},
1906 {"impulse 1", "Pitch Fork"},
1907 {"impulse 2", "Flare Gun"},
1908 {"impulse 3", "Shotgun"},
1909 {"impulse 4", "Machine Gun"},
1910 {"impulse 5", "Incinerator"},
1911 {"impulse 6", "Bombs"},
1912 {"impulse 7", "Aerosol Can"},
1913 {"impulse 8", "Tesla Cannon"},
1914 {"impulse 9", "Life Leech"},
1915 {"impulse 17", "Voodoo Doll"},
1916 {"impulse 11", "previous weapon"},
1917 {"impulse 10", "next weapon"},
1918 {"impulse 14", "previous item"},
1919 {"impulse 15", "next item"},
1920 {"impulse 13", "use item"},
1921 {"impulse 100", "add bot (red)"},
1922 {"impulse 101", "add bot (blue)"},
1923 {"impulse 102", "kick a bot"},
1924 {"impulse 50", "voting menu"},
1925 {"impulse 141", "identify player"},
1926 {"impulse 16", "next armor type"},
1927 {"impulse 20", "observer mode"}
1931 char *(*bindnames)[2];
1934 typedef struct binditem_s
1936 char *command, *description;
1937 struct binditem_s *next;
1941 typedef struct bindcategory_s
1945 struct bindcategory_s *next;
1949 bindcategory_t *bindcategories = NULL;
1951 void M_ClearBinds (void)
1953 for (c = bindcategories;c;c = cnext)
1956 for (b = c->binds;b;b = bnext)
1963 bindcategories = NULL;
1966 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1968 for (b = &c->binds;*b;*b = &(*b)->next);
1969 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1970 *b->command = (char *)((*b) + 1);
1971 *b->description = *b->command + strlen(command) + 1;
1972 strcpy(*b->command, command);
1973 strcpy(*b->description, description);
1976 void M_AddBind (char *category, char *command, char *description)
1978 for (c = &bindcategories;*c;c = &(*c)->next)
1980 if (!strcmp(category, (*c)->name))
1982 M_AddBindToCategory(*c, command, description);
1986 *c = Z_Alloc(sizeof(bindcategory_t));
1987 M_AddBindToCategory(*c, command, description);
1990 void M_DefaultBinds (void)
1993 M_AddBind("movement", "+jump", "jump / swim up");
1994 M_AddBind("movement", "+forward", "walk forward");
1995 M_AddBind("movement", "+back", "backpedal");
1996 M_AddBind("movement", "+left", "turn left");
1997 M_AddBind("movement", "+right", "turn right");
1998 M_AddBind("movement", "+speed", "run");
1999 M_AddBind("movement", "+moveleft", "step left");
2000 M_AddBind("movement", "+moveright", "step right");
2001 M_AddBind("movement", "+strafe", "sidestep");
2002 M_AddBind("movement", "+lookup", "look up");
2003 M_AddBind("movement", "+lookdown", "look down");
2004 M_AddBind("movement", "centerview", "center view");
2005 M_AddBind("movement", "+mlook", "mouse look");
2006 M_AddBind("movement", "+klook", "keyboard look");
2007 M_AddBind("movement", "+moveup", "swim up");
2008 M_AddBind("movement", "+movedown", "swim down");
2009 M_AddBind("weapons", "+attack", "attack");
2010 M_AddBind("weapons", "impulse 10", "next weapon");
2011 M_AddBind("weapons", "impulse 12", "previous weapon");
2012 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2013 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2014 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2015 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2016 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2017 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2018 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2019 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2027 void M_Menu_Keys_f (void)
2029 key_dest = key_menu;
2031 m_entersound = true;
2036 void M_FindKeysForCommand (char *command, int *keys)
2042 for (j = 0;j < NUMKEYS;j++)
2047 for (j=0 ; j<256 ; j++)
2052 if (!strcmp (b, command) )
2055 if (count == NUMKEYS)
2061 void M_UnbindCommand (char *command)
2066 for (j=0 ; j<256 ; j++)
2071 if (!strcmp (b, command))
2072 Key_SetBinding (j, "");
2077 void M_Keys_Draw (void)
2083 char keystring[1024];
2085 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2086 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2089 M_Print (12, 32, "Press a key or button for this action");
2091 M_Print (18, 32, "Enter to change, backspace to clear");
2093 // search for known bindings
2094 for (i=0 ; i<numcommands ; i++)
2098 M_Print (16, y, bindnames[i][1]);
2100 M_FindKeysForCommand (bindnames[i][0], keys);
2102 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2104 strcpy(keystring, "???");
2108 for (j = 0;j < NUMKEYS;j++)
2113 strcat(keystring, " or ");
2114 strcat(keystring, Key_KeynumToString (keys[j]));
2118 M_Print (150, y, keystring);
2122 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2124 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2128 void M_Keys_Key (int k)
2135 S_LocalSound ("misc/menu1.wav");
2140 else //if (k != '`')
2142 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2143 Cbuf_InsertText (cmd);
2153 M_Menu_Options_f ();
2158 S_LocalSound ("misc/menu1.wav");
2160 if (keys_cursor < 0)
2161 keys_cursor = numcommands-1;
2166 S_LocalSound ("misc/menu1.wav");
2168 if (keys_cursor >= numcommands)
2172 case K_ENTER: // go into bind mode
2173 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2174 S_LocalSound ("misc/menu2.wav");
2175 if (keys[NUMKEYS - 1] != -1)
2176 M_UnbindCommand (bindnames[keys_cursor][0]);
2180 case K_BACKSPACE: // delete bindings
2181 case K_DEL: // delete bindings
2182 S_LocalSound ("misc/menu2.wav");
2183 M_UnbindCommand (bindnames[keys_cursor][0]);
2188 //=============================================================================
2191 #define VIDEO_ITEMS 5
2193 int video_cursor = 0;
2194 int video_cursor_table[] = {56, 68, 80, 92, 116};
2195 // note: if modes are added to the beginning of this list, update the
2196 // video_resolution = x; in M_Menu_Video_f below
2197 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}};
2198 int video_resolution;
2200 extern int current_vid_fullscreen;
2201 extern int current_vid_width;
2202 extern int current_vid_height;
2203 extern int current_vid_bitsperpixel;
2204 extern int current_vid_stencil;
2207 void M_Menu_Video_f (void)
2209 key_dest = key_menu;
2211 m_entersound = true;
2213 // Look for the current resolution
2214 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
2216 if (video_resolutions[video_resolution][0] == current_vid_width &&
2217 video_resolutions[video_resolution][1] == current_vid_height)
2221 // Default to 800x600 if we didn't find it
2222 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
2224 // may need to update this number if mode list changes
2225 video_resolution = 4;
2226 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2227 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2232 void M_Video_Draw (void)
2237 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2238 p = Draw_CachePic("gfx/vidmodes.lmp");
2239 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2242 M_Print(16, video_cursor_table[0], " Resolution");
2243 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2244 M_Print (220, video_cursor_table[0], string);
2247 M_Print(16, video_cursor_table[1], " Bits per pixel");
2248 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2251 M_Print(16, video_cursor_table[2], " Fullscreen");
2252 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2255 M_Print(16, video_cursor_table[3], " Stencil");
2256 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2259 M_Print(220, video_cursor_table[4], "Apply");
2262 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2266 void M_Menu_Video_AdjustSliders (int dir)
2268 S_LocalSound ("misc/menu3.wav");
2270 switch (video_cursor)
2275 int new_resolution = video_resolution + dir;
2276 if (new_resolution < 0)
2277 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2278 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2279 video_resolution = 0;
2281 video_resolution = new_resolution;
2283 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2284 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2290 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2293 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2296 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2302 void M_Video_Key (int key)
2307 // vid_shared.c has a copy of the current video config. We restore it
2308 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2309 Cvar_SetValueQuick(&vid_width, current_vid_width);
2310 Cvar_SetValueQuick(&vid_height, current_vid_height);
2311 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2312 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2314 S_LocalSound ("misc/menu1.wav");
2315 M_Menu_Options_f ();
2319 m_entersound = true;
2320 switch (video_cursor)
2323 Cbuf_AddText ("vid_restart\n");
2324 M_Menu_Options_f ();
2327 M_Menu_Video_AdjustSliders (1);
2332 S_LocalSound ("misc/menu1.wav");
2334 if (video_cursor < 0)
2335 video_cursor = VIDEO_ITEMS-1;
2339 S_LocalSound ("misc/menu1.wav");
2341 if (video_cursor >= VIDEO_ITEMS)
2346 M_Menu_Video_AdjustSliders (-1);
2350 M_Menu_Video_AdjustSliders (1);
2355 //=============================================================================
2359 #define NUM_HELP_PAGES 6
2362 void M_Menu_Help_f (void)
2364 key_dest = key_menu;
2366 m_entersound = true;
2372 void M_Help_Draw (void)
2374 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2378 void M_Help_Key (int key)
2388 m_entersound = true;
2389 if (++help_page >= NUM_HELP_PAGES)
2395 m_entersound = true;
2396 if (--help_page < 0)
2397 help_page = NUM_HELP_PAGES-1;
2403 //=============================================================================
2407 int m_quit_prevstate;
2408 qboolean wasInMenus;
2410 char *quitMessage [] =
2412 /* .........1.........2.... */
2414 " Are you gonna quit ",
2415 " this game just like ",
2416 " everything else? ",
2419 " Milord, methinks that ",
2420 " thou art a lowly ",
2421 " quitter. Is this true? ",
2424 " Do I need to bust your ",
2425 " face open for trying ",
2429 " Man, I oughta smack you",
2430 " for trying to quit! ",
2434 " Press Y to quit like a ",
2435 " big loser in life. ",
2436 " Press N to stay proud ",
2437 " and successful! ",
2439 " If you press Y to ",
2440 " quit, I will summon ",
2441 " Satan all over your ",
2444 " Um, Asmodeus dislikes ",
2445 " his children trying to ",
2446 " quit. Press Y to return",
2447 " to your Tinkertoys. ",
2449 " If you quit now, I'll ",
2450 " throw a blanket-party ",
2451 " for you next time! ",
2455 /* .........1.........2.... */
2457 " Tired of fragging ",
2462 " Quit now and forfeit ",
2463 " your bodycount? ",
2467 " Are you sure you ",
2472 " Off to do something ",
2477 void M_Menu_Quit_f (void)
2479 if (m_state == m_quit)
2481 wasInMenus = (key_dest == key_menu);
2482 key_dest = key_menu;
2483 m_quit_prevstate = m_state;
2485 m_entersound = true;
2486 msgNumber = rand()&3; //&7;
2490 void M_Quit_Key (int key)
2499 m_state = m_quit_prevstate;
2500 m_entersound = true;
2504 key_dest = key_game;
2521 void M_Quit_Draw (void)
2523 M_DrawTextBox (56, 76, 24, 4);
2524 M_Print (64, 84, quitMessage[msgNumber*4+0]);
2525 M_Print (64, 92, quitMessage[msgNumber*4+1]);
2526 M_Print (64, 100, quitMessage[msgNumber*4+2]);
2527 M_Print (64, 108, quitMessage[msgNumber*4+3]);
2530 //=============================================================================
2531 /* LAN CONFIG MENU */
2533 int lanConfig_cursor = -1;
2534 int lanConfig_cursor_table [] = {72, 92, 112, 144};
2535 #define NUM_LANCONFIG_CMDS 4
2538 char lanConfig_portname[6];
2539 char lanConfig_joinname[22];
2541 void M_Menu_LanConfig_f (void)
2543 key_dest = key_menu;
2544 m_state = m_lanconfig;
2545 m_entersound = true;
2546 if (lanConfig_cursor == -1)
2548 if (JoiningGame && TCPIPConfig)
2549 lanConfig_cursor = 2;
2551 lanConfig_cursor = 1;
2553 if (StartingGame && lanConfig_cursor == 2)
2554 lanConfig_cursor = 1;
2555 lanConfig_port = DEFAULTnet_hostport;
2556 sprintf(lanConfig_portname, "%u", lanConfig_port);
2558 m_return_onerror = false;
2559 m_return_reason[0] = 0;
2563 void M_LanConfig_Draw (void)
2570 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2571 p = Draw_CachePic ("gfx/p_multi.lmp");
2572 basex = (320-p->width)/2;
2573 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2576 startJoin = "New Game";
2578 startJoin = "Join Game";
2582 protocol = "TCP/IP";
2583 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2586 M_Print (basex, 52, "Address:");
2588 M_Print (basex+9*8, 52, my_ipx_address);
2590 M_Print (basex+9*8, 52, my_tcpip_address);
2592 M_Print (basex, lanConfig_cursor_table[0], "Port");
2593 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2594 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2598 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2599 M_Print (basex, lanConfig_cursor_table[2], "Search for internet games...");
2600 M_Print (basex, 128, "Join game at:");
2601 M_DrawTextBox (basex+8, lanConfig_cursor_table[3]-8, 22, 1);
2602 M_Print (basex+16, lanConfig_cursor_table[3], lanConfig_joinname);
2606 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2607 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2610 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2612 if (lanConfig_cursor == 0)
2613 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2615 if (lanConfig_cursor == 3)
2616 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [3], 10+((int)(realtime*4)&1));
2618 if (*m_return_reason)
2619 M_PrintWhite (basex, 168, m_return_reason);
2623 void M_LanConfig_Key (int key)
2634 S_LocalSound ("misc/menu1.wav");
2636 if (lanConfig_cursor < 0)
2637 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2641 S_LocalSound ("misc/menu1.wav");
2643 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2644 lanConfig_cursor = 0;
2648 if (lanConfig_cursor == 0)
2651 m_entersound = true;
2653 M_ConfigureNetSubsystem ();
2655 if (lanConfig_cursor == 1 || lanConfig_cursor == 2)
2659 M_Menu_GameOptions_f ();
2662 if (lanConfig_cursor == 1)
2665 M_Menu_InetSearch_f();
2669 if (lanConfig_cursor == 3)
2671 m_return_state = m_state;
2672 m_return_onerror = true;
2673 key_dest = key_game;
2675 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2682 if (lanConfig_cursor == 0)
2684 if (strlen(lanConfig_portname))
2685 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2688 if (lanConfig_cursor == 3)
2690 if (strlen(lanConfig_joinname))
2691 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2696 if (key < 32 || key > 127)
2699 if (lanConfig_cursor == 3)
2701 l = strlen(lanConfig_joinname);
2704 lanConfig_joinname[l+1] = 0;
2705 lanConfig_joinname[l] = key;
2709 if (key < '0' || key > '9')
2711 if (lanConfig_cursor == 0)
2713 l = strlen(lanConfig_portname);
2716 lanConfig_portname[l+1] = 0;
2717 lanConfig_portname[l] = key;
2722 if (StartingGame && lanConfig_cursor == 3)
2724 if (key == K_UPARROW)
2725 lanConfig_cursor = 1;
2727 lanConfig_cursor = 0;
2730 l = atoi(lanConfig_portname);
2735 sprintf(lanConfig_portname, "%u", lanConfig_port);
2738 //=============================================================================
2739 /* GAME OPTIONS MENU */
2758 episode_t *episodes;
2763 level_t quakelevels[] =
2765 {"start", "Entrance"}, // 0
2767 {"e1m1", "Slipgate Complex"}, // 1
2768 {"e1m2", "Castle of the Damned"},
2769 {"e1m3", "The Necropolis"},
2770 {"e1m4", "The Grisly Grotto"},
2771 {"e1m5", "Gloom Keep"},
2772 {"e1m6", "The Door To Chthon"},
2773 {"e1m7", "The House of Chthon"},
2774 {"e1m8", "Ziggurat Vertigo"},
2776 {"e2m1", "The Installation"}, // 9
2777 {"e2m2", "Ogre Citadel"},
2778 {"e2m3", "Crypt of Decay"},
2779 {"e2m4", "The Ebon Fortress"},
2780 {"e2m5", "The Wizard's Manse"},
2781 {"e2m6", "The Dismal Oubliette"},
2782 {"e2m7", "Underearth"},
2784 {"e3m1", "Termination Central"}, // 16
2785 {"e3m2", "The Vaults of Zin"},
2786 {"e3m3", "The Tomb of Terror"},
2787 {"e3m4", "Satan's Dark Delight"},
2788 {"e3m5", "Wind Tunnels"},
2789 {"e3m6", "Chambers of Torment"},
2790 {"e3m7", "The Haunted Halls"},
2792 {"e4m1", "The Sewage System"}, // 23
2793 {"e4m2", "The Tower of Despair"},
2794 {"e4m3", "The Elder God Shrine"},
2795 {"e4m4", "The Palace of Hate"},
2796 {"e4m5", "Hell's Atrium"},
2797 {"e4m6", "The Pain Maze"},
2798 {"e4m7", "Azure Agony"},
2799 {"e4m8", "The Nameless City"},
2801 {"end", "Shub-Niggurath's Pit"}, // 31
2803 {"dm1", "Place of Two Deaths"}, // 32
2804 {"dm2", "Claustrophobopolis"},
2805 {"dm3", "The Abandoned Base"},
2806 {"dm4", "The Bad Place"},
2807 {"dm5", "The Cistern"},
2808 {"dm6", "The Dark Zone"}
2811 episode_t quakeepisodes[] =
2813 {"Welcome to Quake", 0, 1},
2814 {"Doomed Dimension", 1, 8},
2815 {"Realm of Black Magic", 9, 7},
2816 {"Netherworld", 16, 7},
2817 {"The Elder World", 23, 8},
2818 {"Final Level", 31, 1},
2819 {"Deathmatch Arena", 32, 6}
2822 //MED 01/06/97 added hipnotic levels
2823 level_t hipnoticlevels[] =
2825 {"start", "Command HQ"}, // 0
2827 {"hip1m1", "The Pumping Station"}, // 1
2828 {"hip1m2", "Storage Facility"},
2829 {"hip1m3", "The Lost Mine"},
2830 {"hip1m4", "Research Facility"},
2831 {"hip1m5", "Military Complex"},
2833 {"hip2m1", "Ancient Realms"}, // 6
2834 {"hip2m2", "The Black Cathedral"},
2835 {"hip2m3", "The Catacombs"},
2836 {"hip2m4", "The Crypt"},
2837 {"hip2m5", "Mortum's Keep"},
2838 {"hip2m6", "The Gremlin's Domain"},
2840 {"hip3m1", "Tur Torment"}, // 12
2841 {"hip3m2", "Pandemonium"},
2842 {"hip3m3", "Limbo"},
2843 {"hip3m4", "The Gauntlet"},
2845 {"hipend", "Armagon's Lair"}, // 16
2847 {"hipdm1", "The Edge of Oblivion"} // 17
2850 //MED 01/06/97 added hipnotic episodes
2851 episode_t hipnoticepisodes[] =
2853 {"Scourge of Armagon", 0, 1},
2854 {"Fortress of the Dead", 1, 5},
2855 {"Dominion of Darkness", 6, 6},
2856 {"The Rift", 12, 4},
2857 {"Final Level", 16, 1},
2858 {"Deathmatch Arena", 17, 1}
2861 //PGM 01/07/97 added rogue levels
2862 //PGM 03/02/97 added dmatch level
2863 level_t roguelevels[] =
2865 {"start", "Split Decision"},
2866 {"r1m1", "Deviant's Domain"},
2867 {"r1m2", "Dread Portal"},
2868 {"r1m3", "Judgement Call"},
2869 {"r1m4", "Cave of Death"},
2870 {"r1m5", "Towers of Wrath"},
2871 {"r1m6", "Temple of Pain"},
2872 {"r1m7", "Tomb of the Overlord"},
2873 {"r2m1", "Tempus Fugit"},
2874 {"r2m2", "Elemental Fury I"},
2875 {"r2m3", "Elemental Fury II"},
2876 {"r2m4", "Curse of Osiris"},
2877 {"r2m5", "Wizard's Keep"},
2878 {"r2m6", "Blood Sacrifice"},
2879 {"r2m7", "Last Bastion"},
2880 {"r2m8", "Source of Evil"},
2881 {"ctf1", "Division of Change"}
2884 //PGM 01/07/97 added rogue episodes
2885 //PGM 03/02/97 added dmatch episode
2886 episode_t rogueepisodes[] =
2888 {"Introduction", 0, 1},
2889 {"Hell's Fortress", 1, 7},
2890 {"Corridors of Time", 8, 8},
2891 {"Deathmatch Arena", 16, 1}
2894 level_t nehahralevels[] =
2896 {"nehstart", "Welcome to Nehahra"},
2897 {"neh1m1", "Forge City1: Slipgates"},
2898 {"neh1m2", "Forge City2: Boiler"},
2899 {"neh1m3", "Forge City3: Escape"},
2900 {"neh1m4", "Grind Core"},
2901 {"neh1m5", "Industrial Silence"},
2902 {"neh1m6", "Locked-Up Anger"},
2903 {"neh1m7", "Wanderer of the Wastes"},
2904 {"neh1m8", "Artemis System Net"},
2905 {"neh1m9", "To the Death"},
2906 {"neh2m1", "The Gates of Ghoro"},
2907 {"neh2m2", "Sacred Trinity"},
2908 {"neh2m3", "Realm of the Ancients"},
2909 {"neh2m4", "Temple of the Ancients"},
2910 {"neh2m5", "Dreams Made Flesh"},
2911 {"neh2m6", "Your Last Cup of Sorrow"},
2912 {"nehsec", "Ogre's Bane"},
2913 {"nehahra", "Nehahra's Den"},
2914 {"nehend", "Quintessence"}
2917 episode_t nehahraepisodes[] =
2919 {"Welcome to Nehahra", 0, 1},
2920 {"The Fall of Forge", 1, 9},
2921 {"The Outlands", 10, 7},
2922 {"Dimension of the Lost", 17, 2}
2925 // Map list for Transfusion
2926 level_t transfusionlevels[] =
2928 {"bb1", "The Stronghold"},
2929 {"bb2", "Winter Wonderland"},
2931 {"bb4", "The Tower"},
2933 {"bb6", "Twin Fortress"},
2935 {"bb8", "Fun With Heads"},
2937 {"e1m1", "Cradle to Grave"},
2938 {"e1m2", "Wrong Side of the Tracks"},
2939 {"e1m7", "Altar of Stone"},
2940 {"e2m8", "The Lair of Shial"},
2941 {"e3m7", "The Pit of Cerberus"},
2942 {"e4m8", "The Hall of the Epiphany"},
2943 {"e4m9", "Mall of the Dead"},
2945 {"dm1", "Monolith Building 11"},
2948 {"e6m1", "Welcome to Your Life"},
2949 {"e6m8", "Beauty and the Beast"},
2951 {"cpbb01", "Crypt of Despair"},
2952 {"cpbb03", "Unholy Cathedral"},
2954 {"b2a15", "Area 15 (B2)"},
2955 {"barena", "Blood Arena"},
2956 {"bkeep", "Blood Keep"},
2957 {"bstar", "Brown Star"},
2958 {"crypt", "The Crypt"},
2960 {"bb3_2k1", "Bodies Infusion"},
2961 {"dcamp", "DeathCamp"},
2962 {"highnoon", "HighNoon"},
2963 {"qbb1", "The Confluence"},
2964 {"qbb2", "KathartiK"},
2965 {"qbb3", "Caleb's Woodland Retreat"},
2967 {"dranzbb6", "Black Coffee"},
2968 {"fragm", "Frag'M"},
2970 {"qe1m7", "The House of Chthon"},
2971 {"simple", "Dead Simple"}
2974 episode_t transfusionepisodes[] =
2977 {"Blood Single Player", 8, 7},
2978 {"Plasma Pack", 15, 5},
2979 {"Cryptic Passage", 20, 2},
2981 {"Transfusion", 27, 6},
2982 {"Conversions", 33, 5}
2985 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2986 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2987 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2988 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2989 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2990 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
2995 gamelevels_t *notregistered;
2996 gamelevels_t *registered;
3000 gameinfo_t gamelist[] =
3002 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3003 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3004 {GAME_ROGUE, &roguegame, &roguegame},
3005 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3006 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3007 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3010 gamelevels_t *lookupgameinfo(void)
3013 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3014 if (registered.integer)
3015 return gamelist[i].registered;
3017 return gamelist[i].notregistered;
3023 qboolean m_serverInfoMessage = false;
3024 double m_serverInfoMessageTime;
3026 extern cvar_t sv_public;
3028 void M_Menu_GameOptions_f (void)
3030 key_dest = key_menu;
3031 m_state = m_gameoptions;
3032 m_entersound = true;
3033 if (maxplayers == 0)
3034 maxplayers = svs.maxclients;
3036 maxplayers = MAX_SCOREBOARD;
3040 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 120, 128};
3041 #define NUM_GAMEOPTIONS 10
3042 int gameoptions_cursor;
3044 void M_GameOptions_Draw (void)
3050 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3051 p = Draw_CachePic ("gfx/p_multi.lmp");
3052 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3054 M_DrawTextBox (152, 32, 10, 1);
3055 M_Print (160, 40, "begin game");
3057 M_Print (0, 56, " Max players");
3058 M_Print (160, 56, va("%i", maxplayers) );
3060 M_Print (0, 64, " Game Type");
3061 if (gamemode == GAME_TRANSFUSION)
3063 if (!deathmatch.integer)
3064 Cvar_SetValue("deathmatch", 1);
3065 if (deathmatch.integer == 2)
3066 M_Print (160, 64, "Capture the Flag");
3068 M_Print (160, 64, "Blood Bath");
3072 if (!coop.integer && !deathmatch.integer)
3073 Cvar_SetValue("deathmatch", 1);
3075 M_Print (160, 64, "Cooperative");
3077 M_Print (160, 64, "Deathmatch");
3080 M_Print (0, 72, " Teamplay");
3081 if (gamemode == GAME_ROGUE)
3085 switch((int)teamplay.integer)
3087 case 1: msg = "No Friendly Fire"; break;
3088 case 2: msg = "Friendly Fire"; break;
3089 case 3: msg = "Tag"; break;
3090 case 4: msg = "Capture the Flag"; break;
3091 case 5: msg = "One Flag CTF"; break;
3092 case 6: msg = "Three Team CTF"; break;
3093 default: msg = "Off"; break;
3095 M_Print (160, 72, msg);
3097 else if (gamemode == GAME_TRANSFUSION)
3101 switch (teamplay.integer)
3103 case 0: msg = "Off"; break;
3104 case 2: msg = "Friendly Fire"; break;
3105 default: msg = "No Friendly Fire"; break;
3107 M_Print (160, 72, msg);
3113 switch((int)teamplay.integer)
3115 case 1: msg = "No Friendly Fire"; break;
3116 case 2: msg = "Friendly Fire"; break;
3117 default: msg = "Off"; break;
3119 M_Print (160, 72, msg);
3122 M_Print (0, 80, " Skill");
3123 if (skill.integer == 0)
3124 M_Print (160, 80, "Easy difficulty");
3125 else if (skill.integer == 1)
3126 M_Print (160, 80, "Normal difficulty");
3127 else if (skill.integer == 2)
3128 M_Print (160, 80, "Hard difficulty");
3130 M_Print (160, 80, "Nightmare difficulty");
3132 M_Print (0, 88, " Frag Limit");
3133 if (fraglimit.integer == 0)
3134 M_Print (160, 88, "none");
3136 M_Print (160, 88, va("%i frags", fraglimit.integer));
3138 M_Print (0, 96, " Time Limit");
3139 if (timelimit.integer == 0)
3140 M_Print (160, 96, "none");
3142 M_Print (160, 96, va("%i minutes", timelimit.integer));
3144 M_Print (0, 104, " Public server");
3145 M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes");
3147 g = lookupgameinfo();
3149 M_Print (0, 120, " Episode");
3150 M_Print (160, 120, g->episodes[startepisode].description);
3152 M_Print (0, 128, " Level");
3153 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3154 M_Print (160, 136, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3157 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3159 if (m_serverInfoMessage)
3161 if ((realtime - m_serverInfoMessageTime) < 5.0)
3164 M_DrawTextBox (x, 138, 24, 4);
3166 M_Print (x, 146, " More than 64 players?? ");
3167 M_Print (x, 154, " First, question your ");
3168 M_Print (x, 162, " sanity, then email ");
3169 M_Print (x, 170, " havoc@telefragged.com ");
3173 m_serverInfoMessage = false;
3179 void M_NetStart_Change (int dir)
3184 switch (gameoptions_cursor)
3188 if (maxplayers > MAX_SCOREBOARD)
3190 maxplayers = MAX_SCOREBOARD;
3191 m_serverInfoMessage = true;
3192 m_serverInfoMessageTime = realtime;
3199 if (gamemode == GAME_TRANSFUSION)
3201 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3202 Cvar_SetValueQuick (&deathmatch, 0);
3203 else // changing from BloodBath to CTF
3204 Cvar_SetValueQuick (&deathmatch, 2);
3208 if (deathmatch.integer) // changing from deathmatch to coop
3210 Cvar_SetValueQuick (&coop, 1);
3211 Cvar_SetValueQuick (&deathmatch, 0);
3213 else // changing from coop to deathmatch
3215 Cvar_SetValueQuick (&coop, 0);
3216 Cvar_SetValueQuick (&deathmatch, 1);
3222 if (gamemode == GAME_ROGUE)
3227 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3228 if (teamplay.integer > count)
3229 Cvar_SetValueQuick (&teamplay, 0);
3230 else if (teamplay.integer < 0)
3231 Cvar_SetValueQuick (&teamplay, count);
3235 Cvar_SetValueQuick (&skill, skill.integer + dir);
3236 if (skill.integer > 3)
3237 Cvar_SetValueQuick (&skill, 0);
3238 if (skill.integer < 0)
3239 Cvar_SetValueQuick (&skill, 3);
3243 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3244 if (fraglimit.integer > 100)
3245 Cvar_SetValueQuick (&fraglimit, 0);
3246 if (fraglimit.integer < 0)
3247 Cvar_SetValueQuick (&fraglimit, 100);
3251 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3252 if (timelimit.value > 60)
3253 Cvar_SetValueQuick (&timelimit, 0);
3254 if (timelimit.value < 0)
3255 Cvar_SetValueQuick (&timelimit, 60);
3259 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3263 startepisode += dir;
3264 g = lookupgameinfo();
3266 if (startepisode < 0)
3267 startepisode = g->numepisodes - 1;
3269 if (startepisode >= g->numepisodes)
3277 g = lookupgameinfo();
3280 startlevel = g->episodes[startepisode].levels - 1;
3282 if (startlevel >= g->episodes[startepisode].levels)
3288 void M_GameOptions_Key (int key)
3299 S_LocalSound ("misc/menu1.wav");
3300 gameoptions_cursor--;
3301 if (gameoptions_cursor < 0)
3302 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3306 S_LocalSound ("misc/menu1.wav");
3307 gameoptions_cursor++;
3308 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3309 gameoptions_cursor = 0;
3313 if (gameoptions_cursor == 0)
3315 S_LocalSound ("misc/menu3.wav");
3316 M_NetStart_Change (-1);
3320 if (gameoptions_cursor == 0)
3322 S_LocalSound ("misc/menu3.wav");
3323 M_NetStart_Change (1);
3327 S_LocalSound ("misc/menu2.wav");
3328 if (gameoptions_cursor == 0)
3331 Cbuf_AddText ("disconnect\n");
3332 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
3333 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3335 g = lookupgameinfo();
3336 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3340 M_NetStart_Change (1);
3345 //=============================================================================
3348 qboolean searchComplete = false;
3349 double searchCompleteTime;
3351 void M_Menu_Search_f (void)
3353 key_dest = key_menu;
3355 m_entersound = false;
3358 searchComplete = false;
3364 void M_Search_Draw (void)
3370 p = Draw_CachePic ("gfx/p_multi.lmp");
3371 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3372 x = (320/2) - ((12*8)/2) + 4;
3373 M_DrawTextBox (x-8, 32, 12, 1);
3374 M_Print (x, 40, "Searching...");
3382 if (! searchComplete)
3384 searchComplete = true;
3385 searchCompleteTime = realtime;
3390 M_Menu_ServerList_f ();
3394 if (gamemode == GAME_TRANSFUSION)
3395 string = "No Transfusion servers found";
3397 string = "No Quake servers found";
3398 M_PrintWhite ((320/2) - ((22*8)/2), 64, string);
3399 if ((realtime - searchCompleteTime) < 3.0)
3402 M_Menu_LanConfig_f ();
3406 void M_Search_Key (int key)
3410 //=============================================================================
3411 /* INTERNET SEARCH MENU */
3413 void M_Menu_InetSearch_f (void)
3415 key_dest = key_menu;
3417 m_entersound = false;
3420 searchComplete = false;
3426 void M_InetSearch_Draw (void)
3428 M_Search_Draw (); // it's the same one, so why bother?
3432 void M_InetSearch_Key (int key)
3436 //=============================================================================
3440 qboolean slist_sorted;
3442 void M_Menu_ServerList_f (void)
3444 key_dest = key_menu;
3446 m_entersound = true;
3448 m_return_onerror = false;
3449 m_return_reason[0] = 0;
3450 slist_sorted = false;
3454 void M_ServerList_Draw (void)
3462 if (hostCacheCount > 1)
3466 for (i = 0; i < hostCacheCount; i++)
3467 for (j = i+1; j < hostCacheCount; j++)
3468 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3470 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3471 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3472 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3475 slist_sorted = true;
3478 p = Draw_CachePic ("gfx/p_multi.lmp");
3479 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3480 for (n = 0; n < hostCacheCount; n++)
3482 if (hostcache[n].maxusers)
3483 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3485 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3486 M_Print (16, 32 + 8*n, string);
3488 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3490 if (*m_return_reason)
3491 M_PrintWhite (16, 168, m_return_reason);
3495 void M_ServerList_Key (int k)
3500 M_Menu_LanConfig_f ();
3509 S_LocalSound ("misc/menu1.wav");
3511 if (slist_cursor < 0)
3512 slist_cursor = hostCacheCount - 1;
3517 S_LocalSound ("misc/menu1.wav");
3519 if (slist_cursor >= hostCacheCount)
3524 S_LocalSound ("misc/menu2.wav");
3525 m_return_state = m_state;
3526 m_return_onerror = true;
3527 slist_sorted = false;
3528 key_dest = key_game;
3530 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3539 //=============================================================================
3540 /* Menu Subsystem */
3545 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3547 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3548 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3549 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3550 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3551 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3552 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3553 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3554 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3555 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3556 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3557 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3558 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3559 Cmd_AddCommand ("help", M_Menu_Help_f);
3560 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3562 if (gamemode == GAME_TRANSFUSION)
3564 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3565 bindnames = transfusionbindnames;
3569 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3570 bindnames = quakebindnames;
3573 if (gamemode == GAME_NEHAHRA)
3575 if (FS_FileExists("maps/neh1m4.bsp"))
3577 if (FS_FileExists("hearing.dem"))
3579 Con_Printf("Nehahra movie and game detected.\n");
3580 NehGameType = TYPE_BOTH;
3584 Con_Printf("Nehahra game detected.\n");
3585 NehGameType = TYPE_GAME;
3590 if (FS_FileExists("hearing.dem"))
3592 Con_Printf("Nehahra movie detected.\n");
3593 NehGameType = TYPE_DEMO;
3597 Con_Printf("Nehahra not found.\n");
3598 NehGameType = TYPE_GAME; // could just complain, but...
3606 if (m_state == m_none || key_dest != key_menu)
3624 case m_singleplayer:
3625 M_SinglePlayer_Draw ();
3637 M_MultiPlayer_Draw ();
3652 case m_options_effects:
3653 M_Options_Effects_Draw ();
3656 case m_options_colorcontrol:
3657 M_Options_ColorControl_Draw ();
3677 M_LanConfig_Draw ();
3681 M_GameOptions_Draw ();
3689 M_ServerList_Draw ();
3695 S_LocalSound ("misc/menu2.wav");
3696 m_entersound = false;
3703 void M_Keydown (int key)
3718 case m_singleplayer:
3719 M_SinglePlayer_Key (key);
3731 M_MultiPlayer_Key (key);
3743 M_Options_Key (key);
3746 case m_options_effects:
3747 M_Options_Effects_Key (key);
3750 case m_options_colorcontrol:
3751 M_Options_ColorControl_Key (key);
3771 M_LanConfig_Key (key);
3775 M_GameOptions_Key (key);
3783 M_ServerList_Key (key);
3789 void M_ConfigureNetSubsystem(void)
3791 // enable/disable net systems to match desired config
3793 Cbuf_AddText ("stopdemo\n");
3795 if (IPXConfig || TCPIPConfig)
3796 net_hostport = lanConfig_port;