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.
26 void (*vid_menudrawfn)(void);
27 void (*vid_menukeyfn)(int key);
35 enum m_state_e m_state;
37 void M_Menu_Main_f (void);
38 void M_Menu_SinglePlayer_f (void);
39 void M_Menu_Load_f (void);
40 void M_Menu_Save_f (void);
41 void M_Menu_MultiPlayer_f (void);
42 void M_Menu_Setup_f (void);
43 void M_Menu_Net_f (void);
44 void M_Menu_Options_f (void);
45 void M_Menu_Options_Effects_f (void);
46 void M_Menu_Keys_f (void);
47 void M_Menu_Video_f (void);
48 void M_Menu_Help_f (void);
49 void M_Menu_Quit_f (void);
50 void M_Menu_LanConfig_f (void);
51 void M_Menu_GameOptions_f (void);
52 void M_Menu_Search_f (void);
53 void M_Menu_ServerList_f (void);
55 void M_Main_Draw (void);
56 void M_SinglePlayer_Draw (void);
57 void M_Load_Draw (void);
58 void M_Save_Draw (void);
59 void M_MultiPlayer_Draw (void);
60 void M_Setup_Draw (void);
61 void M_Net_Draw (void);
62 void M_Options_Draw (void);
63 void M_Options_Effects_Draw (void);
64 void M_Keys_Draw (void);
65 void M_Video_Draw (void);
66 void M_Help_Draw (void);
67 void M_Quit_Draw (void);
68 void M_LanConfig_Draw (void);
69 void M_GameOptions_Draw (void);
70 void M_Search_Draw (void);
71 void M_ServerList_Draw (void);
73 void M_Main_Key (int key);
74 void M_SinglePlayer_Key (int key);
75 void M_Load_Key (int key);
76 void M_Save_Key (int key);
77 void M_MultiPlayer_Key (int key);
78 void M_Setup_Key (int key);
79 void M_Net_Key (int key);
80 void M_Options_Key (int key);
81 void M_Options_Effects_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_ServerList_Key (int key);
91 qboolean m_entersound; // play after drawing a frame, so caching
92 // won't disrupt the sound
95 qboolean m_return_onerror;
96 char m_return_reason [32];
98 #define StartingGame (m_multiplayer_cursor == 1)
99 #define JoiningGame (m_multiplayer_cursor == 0)
100 #define IPXConfig (m_net_cursor == 0)
101 #define TCPIPConfig (m_net_cursor == 1)
103 void M_ConfigureNetSubsystem(void);
106 #define NumberOfNehahraDemos 34
111 } nehahrademonames_t;
113 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
115 {"intro", "Prologue"},
116 {"genf", "The Beginning"},
117 {"genlab", "A Doomed Project"},
118 {"nehcre", "The New Recruits"},
119 {"maxneh", "Breakthrough"},
120 {"maxchar", "Renewal and Duty"},
121 {"crisis", "Worlds Collide"},
122 {"postcris", "Darkening Skies"},
123 {"hearing", "The Hearing"},
124 {"getjack", "On a Mexican Radio"},
125 {"prelude", "Honor and Justice"},
126 {"abase", "A Message Sent"},
127 {"effect", "The Other Side"},
128 {"uhoh", "Missing in Action"},
129 {"prepare", "The Response"},
130 {"vision", "Farsighted Eyes"},
131 {"maxturns", "Enter the Immortal"},
132 {"backlot", "Separate Ways"},
133 {"maxside", "The Ancient Runes"},
134 {"counter", "The New Initiative"},
135 {"warprep", "Ghosts to the World"},
136 {"counter1", "A Fate Worse Than Death"},
137 {"counter2", "Friendly Fire"},
138 {"counter3", "Minor Setback"},
139 {"madmax", "Scores to Settle"},
140 {"quake", "One Man"},
141 {"cthmm", "Shattered Masks"},
142 {"shades", "Deal with the Dead"},
143 {"gophil", "An Unlikely Hero"},
144 {"cstrike", "War in Hell"},
145 {"shubset", "The Conspiracy"},
146 {"shubdie", "Even Death May Die"},
147 {"newranks", "An Empty Throne"},
148 {"seal", "The Seal is Broken"}
151 float menu_x, menu_y, menu_width, menu_height;
153 void M_DrawBackground(void)
157 menu_x = (vid.conwidth - menu_width) * 0.5;
158 menu_y = (vid.conheight - menu_height) * 0.5;
159 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
166 Draws one solid graphics character
169 void M_DrawCharacter (float cx, float cy, int num)
174 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
177 void M_Print (float cx, float cy, char *str)
179 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
182 void M_PrintWhite (float cx, float cy, char *str)
184 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
187 void M_ItemPrint (float cx, float cy, char *str, int unghosted)
190 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
192 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
195 void M_DrawPic (float cx, float cy, char *picname)
197 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
200 qbyte identityTable[256];
201 qbyte translationTable[256];
203 void M_BuildTranslationTable(int top, int bottom)
206 qbyte *dest, *source;
208 for (j = 0; j < 256; j++)
209 identityTable[j] = j;
210 dest = translationTable;
211 source = identityTable;
212 memcpy (dest, source, 256);
214 // LordHavoc: corrected skin color ranges
215 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
216 memcpy (dest + TOP_RANGE, source + top, 16);
218 for (j=0 ; j<16 ; j++)
219 dest[TOP_RANGE+j] = source[top+15-j];
221 // LordHavoc: corrected skin color ranges
222 if (bottom < 128 || (bottom >= 224 && bottom < 240))
223 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
225 for (j=0 ; j<16 ; j++)
226 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
230 void M_DrawTextBox (float x, float y, float width, float height)
238 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
239 for (n = 0; n < height; n++)
242 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
244 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
251 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
252 for (n = 0; n < height; n++)
256 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
258 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
260 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
267 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
268 for (n = 0; n < height; n++)
271 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
273 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
276 //=============================================================================
285 void M_ToggleMenu_f (void)
289 if (key_dest == key_menu)
291 if (m_state != m_main)
300 if (key_dest == key_console)
302 Con_ToggleConsole_f ();
312 void M_Demo_Draw (void)
316 for (i=0; i < NumberOfNehahraDemos; i++)
317 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
320 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
324 void M_Menu_Demos_f (void)
331 void M_Demo_Key (int k)
340 S_LocalSound ("misc/menu2.wav");
343 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
348 S_LocalSound ("misc/menu1.wav");
351 demo_cursor = NumberOfNehahraDemos;
356 S_LocalSound ("misc/menu1.wav");
358 if (demo_cursor > NumberOfNehahraDemos)
364 //=============================================================================
369 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
371 void M_Menu_Main_f (void)
373 if (gamemode == GAME_NEHAHRA)
375 if (NehGameType == TYPE_DEMO)
377 else if (NehGameType == TYPE_GAME)
385 if (key_dest != key_menu)
387 m_save_demonum = cls.demonum;
396 void M_Main_Draw (void)
401 M_DrawPic (16, 4, "gfx/qplaque.lmp");
402 p = Draw_CachePic ("gfx/ttl_main.lmp");
403 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
405 if (gamemode == GAME_NEHAHRA)
407 if (NehGameType == TYPE_BOTH)
408 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
409 else if (NehGameType == TYPE_GAME)
410 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
412 M_DrawPic (72, 32, "gfx/demomenu.lmp");
415 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
417 f = (int)(realtime * 10)%6;
419 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
423 void M_Main_Key (int key)
430 cls.demonum = m_save_demonum;
431 if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
436 S_LocalSound ("misc/menu1.wav");
437 if (++m_main_cursor >= MAIN_ITEMS)
442 S_LocalSound ("misc/menu1.wav");
443 if (--m_main_cursor < 0)
444 m_main_cursor = MAIN_ITEMS - 1;
450 if (gamemode == GAME_NEHAHRA)
455 switch (m_main_cursor)
458 M_Menu_SinglePlayer_f ();
466 M_Menu_MultiPlayer_f ();
476 Cbuf_AddText ("disconnect\n");
477 Cbuf_AddText ("playdemo endcred\n");
486 switch (m_main_cursor)
489 M_Menu_SinglePlayer_f ();
493 M_Menu_MultiPlayer_f ();
503 Cbuf_AddText ("disconnect\n");
504 Cbuf_AddText ("playdemo endcred\n");
513 switch (m_main_cursor)
522 Cbuf_AddText ("disconnect\n");
523 Cbuf_AddText ("playdemo endcred\n");
539 switch (m_main_cursor)
542 M_Menu_SinglePlayer_f ();
546 M_Menu_MultiPlayer_f ();
565 //=============================================================================
566 /* SINGLE PLAYER MENU */
568 int m_singleplayer_cursor;
569 #define SINGLEPLAYER_ITEMS 3
572 void M_Menu_SinglePlayer_f (void)
575 m_state = m_singleplayer;
580 void M_SinglePlayer_Draw (void)
584 M_DrawPic (16, 4, "gfx/qplaque.lmp");
585 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
587 // Transfusion doesn't have a single player mode
588 if (gamemode == GAME_TRANSFUSION)
590 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
592 M_DrawTextBox (60, 8 * 8, 23, 4);
593 M_PrintWhite (95, 10 * 8, "Transfusion is for");
594 M_PrintWhite (83, 11 * 8, "multiplayer play only");
600 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
601 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
603 f = (int)(realtime * 10)%6;
605 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
610 void M_SinglePlayer_Key (int key)
612 if (gamemode == GAME_TRANSFUSION)
614 if (key == K_ESCAPE || key == K_ENTER)
626 S_LocalSound ("misc/menu1.wav");
627 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
628 m_singleplayer_cursor = 0;
632 S_LocalSound ("misc/menu1.wav");
633 if (--m_singleplayer_cursor < 0)
634 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
640 switch (m_singleplayer_cursor)
645 Cbuf_AddText ("disconnect\n");
646 Cbuf_AddText ("maxplayers 1\n");
647 Cbuf_AddText ("deathmatch 0\n");
648 Cbuf_AddText ("coop 0\n");
649 if (gamemode == GAME_NEHAHRA)
650 Cbuf_AddText ("map nehstart\n");
652 Cbuf_AddText ("map start\n");
666 //=============================================================================
669 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
671 #define MAX_SAVEGAMES 12
672 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
673 int loadable[MAX_SAVEGAMES];
675 void M_ScanSaves (void)
678 char name[MAX_OSPATH];
683 for (i=0 ; i<MAX_SAVEGAMES ; i++)
685 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
687 sprintf (name, "%s/s%i.sav", com_gamedir, i);
688 f = Qopen (name, "rz");
692 sscanf (str, "%i\n", &version);
694 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
696 // change _ back to space
697 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
698 if (m_filenames[i][j] == '_')
699 m_filenames[i][j] = ' ';
705 void M_Menu_Load_f (void)
714 void M_Menu_Save_f (void)
720 if (svs.maxclients != 1)
729 void M_Load_Draw (void)
734 p = Draw_CachePic ("gfx/p_load.lmp");
735 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
737 for (i=0 ; i< MAX_SAVEGAMES; i++)
738 M_Print (16, 32 + 8*i, m_filenames[i]);
741 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
745 void M_Save_Draw (void)
750 p = Draw_CachePic ("gfx/p_save.lmp");
751 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
753 for (i=0 ; i<MAX_SAVEGAMES ; i++)
754 M_Print (16, 32 + 8*i, m_filenames[i]);
757 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
761 void M_Load_Key (int k)
766 M_Menu_SinglePlayer_f ();
770 S_LocalSound ("misc/menu2.wav");
771 if (!loadable[load_cursor])
776 // issue the load command
777 Cbuf_AddText (va ("load s%i\n", load_cursor) );
782 S_LocalSound ("misc/menu1.wav");
785 load_cursor = MAX_SAVEGAMES-1;
790 S_LocalSound ("misc/menu1.wav");
792 if (load_cursor >= MAX_SAVEGAMES)
799 void M_Save_Key (int k)
804 M_Menu_SinglePlayer_f ();
810 Cbuf_AddText (va("save s%i\n", load_cursor));
815 S_LocalSound ("misc/menu1.wav");
818 load_cursor = MAX_SAVEGAMES-1;
823 S_LocalSound ("misc/menu1.wav");
825 if (load_cursor >= MAX_SAVEGAMES)
831 //=============================================================================
832 /* MULTIPLAYER MENU */
834 int m_multiplayer_cursor;
835 #define MULTIPLAYER_ITEMS 3
838 void M_Menu_MultiPlayer_f (void)
841 m_state = m_multiplayer;
846 void M_MultiPlayer_Draw (void)
851 M_DrawPic (16, 4, "gfx/qplaque.lmp");
852 p = Draw_CachePic ("gfx/p_multi.lmp");
853 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
854 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
856 f = (int)(realtime * 10)%6;
858 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
860 if (ipxAvailable || tcpipAvailable)
862 M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
866 void M_MultiPlayer_Key (int key)
875 S_LocalSound ("misc/menu1.wav");
876 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
877 m_multiplayer_cursor = 0;
881 S_LocalSound ("misc/menu1.wav");
882 if (--m_multiplayer_cursor < 0)
883 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
888 switch (m_multiplayer_cursor)
891 if (ipxAvailable || tcpipAvailable)
896 if (ipxAvailable || tcpipAvailable)
907 //=============================================================================
910 int setup_cursor = 4;
911 int setup_cursor_table[] = {40, 56, 80, 104, 140};
913 char setup_hostname[16];
914 char setup_myname[16];
920 #define NUM_SETUP_CMDS 5
922 void M_Menu_Setup_f (void)
927 strcpy(setup_myname, cl_name.string);
928 strcpy(setup_hostname, hostname.string);
929 setup_top = setup_oldtop = cl_color.integer >> 4;
930 setup_bottom = setup_oldbottom = cl_color.integer & 15;
933 // LordHavoc: rewrote this code greatly
934 void M_MenuPlayerTranslate (qbyte *translation, int top, int bottom)
937 unsigned int trans[4096];
939 static qbyte pixels[4096];
940 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load = true, menuplyr_failed = false;
944 if (menuplyr_top == top && menuplyr_bottom == bottom)
948 menuplyr_bottom = bottom;
952 menuplyr_load = false;
953 f = COM_LoadFile("gfx/menuplyr.lmp", true);
956 menuplyr_failed = true;
959 data = LoadLMPAs8Bit (f, 0, 0);
961 if (image_width * image_height > 4096)
963 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
965 menuplyr_failed = true;
968 menuplyr_width = image_width;
969 menuplyr_height = image_height;
970 memcpy(pixels, data, menuplyr_width * menuplyr_height);
974 M_BuildTranslationTable (menuplyr_top*16, menuplyr_bottom*16);
976 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
977 trans[i] = d_8to24table[translation[pixels[i]]];
979 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)trans);
982 void M_Setup_Draw (void)
986 M_DrawPic (16, 4, "gfx/qplaque.lmp");
987 p = Draw_CachePic ("gfx/p_multi.lmp");
988 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
990 M_Print (64, 40, "Hostname");
991 M_DrawTextBox (160, 32, 16, 1);
992 M_Print (168, 40, setup_hostname);
994 M_Print (64, 56, "Your name");
995 M_DrawTextBox (160, 48, 16, 1);
996 M_Print (168, 56, setup_myname);
998 M_Print (64, 80, "Shirt color");
999 M_Print (64, 104, "Pants color");
1001 M_DrawTextBox (64, 140-8, 14, 1);
1002 M_Print (72, 140, "Accept Changes");
1004 M_DrawPic (160, 64, "gfx/bigbox.lmp");
1006 // LordHavoc: rewrote this code greatly
1007 M_MenuPlayerTranslate (translationTable, setup_top, setup_bottom);
1008 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
1010 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1012 if (setup_cursor == 0)
1013 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1015 if (setup_cursor == 1)
1016 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1020 void M_Setup_Key (int k)
1027 M_Menu_MultiPlayer_f ();
1031 S_LocalSound ("misc/menu1.wav");
1033 if (setup_cursor < 0)
1034 setup_cursor = NUM_SETUP_CMDS-1;
1038 S_LocalSound ("misc/menu1.wav");
1040 if (setup_cursor >= NUM_SETUP_CMDS)
1045 if (setup_cursor < 2)
1047 S_LocalSound ("misc/menu3.wav");
1048 if (setup_cursor == 2)
1049 setup_top = setup_top - 1;
1050 if (setup_cursor == 3)
1051 setup_bottom = setup_bottom - 1;
1054 if (setup_cursor < 2)
1057 S_LocalSound ("misc/menu3.wav");
1058 if (setup_cursor == 2)
1059 setup_top = setup_top + 1;
1060 if (setup_cursor == 3)
1061 setup_bottom = setup_bottom + 1;
1065 if (setup_cursor == 0 || setup_cursor == 1)
1068 if (setup_cursor == 2 || setup_cursor == 3)
1071 // setup_cursor == 4 (OK)
1072 if (strcmp(cl_name.string, setup_myname) != 0)
1073 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1074 if (strcmp(hostname.string, setup_hostname) != 0)
1075 Cvar_Set("hostname", setup_hostname);
1076 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1077 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1078 m_entersound = true;
1079 M_Menu_MultiPlayer_f ();
1083 if (setup_cursor == 0)
1085 if (strlen(setup_hostname))
1086 setup_hostname[strlen(setup_hostname)-1] = 0;
1089 if (setup_cursor == 1)
1091 if (strlen(setup_myname))
1092 setup_myname[strlen(setup_myname)-1] = 0;
1097 if (k < 32 || k > 127)
1099 if (setup_cursor == 0)
1101 l = strlen(setup_hostname);
1104 setup_hostname[l+1] = 0;
1105 setup_hostname[l] = k;
1108 if (setup_cursor == 1)
1110 l = strlen(setup_myname);
1113 setup_myname[l+1] = 0;
1114 setup_myname[l] = k;
1123 if (setup_bottom > 15)
1125 if (setup_bottom < 0)
1129 //=============================================================================
1134 int m_net_saveHeight;
1136 char *net_helpMessage [] =
1138 /* .........1.........2.... */
1139 " Novell network LANs ",
1140 " or Windows 95 DOS-box. ",
1142 "(LAN=Local Area Network)",
1144 " Commonly used to play ",
1145 " over the Internet, but ",
1146 " also used on a Local ",
1150 void M_Menu_Net_f (void)
1152 key_dest = key_menu;
1154 m_entersound = true;
1157 if (m_net_cursor >= m_net_items)
1160 M_Net_Key (K_DOWNARROW);
1164 void M_Net_Draw (void)
1169 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1170 p = Draw_CachePic ("gfx/p_multi.lmp");
1171 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1176 M_DrawPic (72, f, "gfx/netmen3.lmp");
1178 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1182 M_DrawPic (72, f, "gfx/netmen4.lmp");
1184 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1186 if (m_net_items == 5) // JDC, could just be removed
1189 M_DrawPic (72, f, "gfx/netmen5.lmp");
1193 M_DrawTextBox (f, 134, 24, 4);
1195 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1196 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1198 f = (int)(realtime * 10)%6;
1199 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1203 void M_Net_Key (int k)
1209 M_Menu_MultiPlayer_f ();
1213 S_LocalSound ("misc/menu1.wav");
1214 if (++m_net_cursor >= m_net_items)
1219 S_LocalSound ("misc/menu1.wav");
1220 if (--m_net_cursor < 0)
1221 m_net_cursor = m_net_items - 1;
1225 m_entersound = true;
1227 switch (m_net_cursor)
1230 M_Menu_LanConfig_f ();
1234 M_Menu_LanConfig_f ();
1243 if (m_net_cursor == 0 && !ipxAvailable)
1245 if (m_net_cursor == 1 && !tcpipAvailable)
1249 //=============================================================================
1252 #define SLIDER_RANGE 10
1254 void M_DrawSlider (int x, int y, float range)
1262 M_DrawCharacter (x-8, y, 128);
1263 for (i=0 ; i<SLIDER_RANGE ; i++)
1264 M_DrawCharacter (x + i*8, y, 129);
1265 M_DrawCharacter (x+i*8, y, 130);
1266 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1269 void M_DrawCheckbox (int x, int y, int on)
1272 M_Print (x, y, "on");
1274 M_Print (x, y, "off");
1278 #define OPTIONS_ITEMS 27
1282 void M_Menu_Options_f (void)
1284 key_dest = key_menu;
1285 m_state = m_options;
1286 m_entersound = true;
1290 void M_Menu_Options_AdjustSliders (int dir)
1292 S_LocalSound ("misc/menu3.wav");
1294 switch (options_cursor)
1297 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1300 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1303 Cvar_SetValueQuick (&r_skyquality, bound(0, r_skyquality.integer + dir, 2));
1306 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1309 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1312 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1315 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1318 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.25, 5));
1321 Cvar_SetValueQuick (&v_contrast, bound(0.5, v_contrast.value + dir * 0.25, 5));
1324 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
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: // show framerate
1343 Cvar_SetValueQuick (&showfps, !showfps.integer);
1345 case 20: // always run
1346 if (cl_forwardspeed.value > 200)
1348 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1349 Cvar_SetValueQuick (&cl_backspeed, 200);
1353 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1354 Cvar_SetValueQuick (&cl_backspeed, 400);
1357 case 21: // lookspring
1358 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1360 case 22: // lookstrafe
1361 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1363 case 23: // mouse speed
1364 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1366 case 24: // mouse look
1367 Cvar_SetValueQuick (&freelook, !freelook.integer);
1369 case 25: // invert mouse
1370 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1372 case 26: // windowed mouse
1373 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1378 void M_Options_Draw (void)
1383 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1384 p = Draw_CachePic("gfx/p_option.lmp");
1385 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1388 M_Print(16, y, " Customize controls");y += 8;
1389 M_Print(16, y, " Go to console");y += 8;
1390 M_Print(16, y, " Reset to defaults");y += 8;
1391 M_ItemPrint(16, y, " Video Options", vid_menudrawfn != NULL);y += 8;
1392 M_Print(16, y, " Effects Options");y += 8;
1393 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8;
1394 M_Print(16, y, " Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8;
1395 M_Print(16, y, " Sky Quality");M_DrawSlider(220, y, r_skyquality.value / 2);y += 8;
1396 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, (v_overbrightbits.value) / 4);y += 8;
1397 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1398 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1399 M_ItemPrint(16, y, "Hardware Gamma Control", hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1400 M_ItemPrint(16, y, " Gamma", v_hwgamma.integer);M_DrawSlider(220, y, (v_gamma.value - 1) / 4);y += 8;
1401 M_Print(16, y, " Contrast");M_DrawSlider(220, y, (v_contrast.value - 0.5) / (5 - 0.5));y += 8;
1402 M_Print(16, y, " Brightness");M_DrawSlider(220, y, v_brightness.value / 0.8);y += 8;
1403 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value);y += 8;
1404 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value);y += 8;
1405 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
1406 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, (crosshair_size.value - 1) / 4);y += 8;
1407 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1408 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1409 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1410 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1411 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, (sensitivity.value - 1)/50);y += 8;
1412 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1413 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1414 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1417 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1421 void M_Options_Key (int k)
1430 m_entersound = true;
1431 switch (options_cursor)
1438 Con_ToggleConsole_f ();
1441 Cbuf_AddText ("exec default.cfg\n");
1448 M_Menu_Options_Effects_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 11
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 cl_particles;
1493 extern cvar_t cl_explosions;
1494 extern cvar_t cl_stainmaps;
1495 extern cvar_t r_modellights;
1496 extern cvar_t cl_particles_bulletimpacts;
1497 extern cvar_t cl_particles_smoke;
1498 extern cvar_t cl_particles_sparks;
1499 extern cvar_t cl_particles_bubbles;
1500 extern cvar_t cl_particles_blood;
1501 extern cvar_t cl_particles_blood_size;
1502 extern cvar_t cl_particles_blood_alpha;
1504 void M_Menu_Options_Effects_AdjustSliders (int dir)
1506 S_LocalSound ("misc/menu3.wav");
1508 switch (options_effects_cursor)
1511 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1514 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1517 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1520 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1523 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1526 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1529 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1532 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1535 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1538 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1541 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1546 void M_Options_Effects_Draw (void)
1551 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1552 p = Draw_CachePic("gfx/p_option.lmp");
1553 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1556 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value / 8);y += 8;
1557 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1558 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1559 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1560 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1561 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1562 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1563 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1564 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1565 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, (cl_particles_blood_size.value - 2) / 18);y += 8;
1566 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, (cl_particles_blood_alpha.value - 0.2) / 0.8);y += 8;
1569 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1573 void M_Options_Effects_Key (int k)
1578 M_Menu_Options_f ();
1582 M_Menu_Options_Effects_AdjustSliders (1);
1586 S_LocalSound ("misc/menu1.wav");
1587 options_effects_cursor--;
1588 if (options_effects_cursor < 0)
1589 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1593 S_LocalSound ("misc/menu1.wav");
1594 options_effects_cursor++;
1595 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1596 options_effects_cursor = 0;
1600 M_Menu_Options_Effects_AdjustSliders (-1);
1604 M_Menu_Options_Effects_AdjustSliders (1);
1609 //=============================================================================
1612 char *bindnames[][2] =
1615 {"+forward", "walk forward"},
1616 {"+back", "backpedal"},
1617 {"+moveleft", "step left"},
1618 {"+moveright", "step right"},
1619 {"+jump", "jump / swim up"},
1620 {"+movedown", "swim down"},
1621 {"+attack", "attack"},
1622 {"+button3", "altfire"},
1623 {"impulse 1", "Pitch Fork"},
1624 {"impulse 2", "Flare Gun"},
1625 {"impulse 3", "Shotgun"},
1626 {"impulse 4", "Machine Gun"},
1627 {"impulse 5", "Incinerator"},
1628 {"impulse 6", "Bombs"},
1629 {"impulse 7", "Aerosol Can"},
1630 {"impulse 8", "Tesla Cannon"},
1631 {"impulse 9", "Life Leech"},
1632 {"impulse 17", "Voodoo Doll"},
1633 {"impulse 11", "previous weapon"},
1634 {"impulse 10", "next weapon"},
1635 {"impulse 14", "previous item"},
1636 {"impulse 15", "next item"},
1637 {"impulse 13", "use item"},
1638 {"impulse 100", "add bot (red)"},
1639 {"impulse 101", "add bot (blue)"},
1640 {"impulse 102", "kick a bot"},
1641 {"impulse 50", "voting menu"},
1642 {"impulse 141", "identify player"},
1643 {"impulse 16", "next armor type"},
1644 {"impulse 20", "observer mode"}
1645 #else // not TRANSFUSION
1646 {"+attack", "attack"},
1647 {"impulse 10", "next weapon"},
1648 {"impulse 12", "previous weapon"},
1649 {"+jump", "jump / swim up"},
1650 {"+forward", "walk forward"},
1651 {"+back", "backpedal"},
1652 {"+left", "turn left"},
1653 {"+right", "turn right"},
1655 {"+moveleft", "step left"},
1656 {"+moveright", "step right"},
1657 {"+strafe", "sidestep"},
1658 {"+lookup", "look up"},
1659 {"+lookdown", "look down"},
1660 {"centerview", "center view"},
1661 {"+mlook", "mouse look"},
1662 {"+klook", "keyboard look"},
1663 {"+moveup", "swim up"},
1664 {"+movedown", "swim down"}
1665 #endif // not TRANSFUSION
1668 #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
1671 typedef struct binditem_s
1673 char *command, *description;
1674 struct binditem_s *next;
1678 typedef struct bindcategory_s
1682 struct bindcategory_s *next;
1686 bindcategory_t *bindcategories = NULL;
1688 void M_ClearBinds (void)
1690 for (c = bindcategories;c;c = cnext)
1693 for (b = c->binds;b;b = bnext)
1700 bindcategories = NULL;
1703 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1705 for (b = &c->binds;*b;*b = &(*b)->next);
1706 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1707 *b->command = (char *)((*b) + 1);
1708 *b->description = *b->command + strlen(command) + 1;
1709 strcpy(*b->command, command);
1710 strcpy(*b->description, description);
1713 void M_AddBind (char *category, char *command, char *description)
1715 for (c = &bindcategories;*c;c = &(*c)->next)
1717 if (!strcmp(category, (*c)->name))
1719 M_AddBindToCategory(*c, command, description);
1723 *c = Z_Alloc(sizeof(bindcategory_t));
1724 M_AddBindToCategory(*c, command, description);
1727 void M_DefaultBinds (void)
1730 M_AddBind("movement", "+jump", "jump / swim up");
1731 M_AddBind("movement", "+forward", "walk forward");
1732 M_AddBind("movement", "+back", "backpedal");
1733 M_AddBind("movement", "+left", "turn left");
1734 M_AddBind("movement", "+right", "turn right");
1735 M_AddBind("movement", "+speed", "run");
1736 M_AddBind("movement", "+moveleft", "step left");
1737 M_AddBind("movement", "+moveright", "step right");
1738 M_AddBind("movement", "+strafe", "sidestep");
1739 M_AddBind("movement", "+lookup", "look up");
1740 M_AddBind("movement", "+lookdown", "look down");
1741 M_AddBind("movement", "centerview", "center view");
1742 M_AddBind("movement", "+mlook", "mouse look");
1743 M_AddBind("movement", "+klook", "keyboard look");
1744 M_AddBind("movement", "+moveup", "swim up");
1745 M_AddBind("movement", "+movedown", "swim down");
1746 M_AddBind("weapons", "+attack", "attack");
1747 M_AddBind("weapons", "impulse 10", "next weapon");
1748 M_AddBind("weapons", "impulse 12", "previous weapon");
1749 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1750 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1751 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1752 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1753 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1754 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1755 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1756 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1764 void M_Menu_Keys_f (void)
1766 key_dest = key_menu;
1768 m_entersound = true;
1773 void M_FindKeysForCommand (char *command, int *keys)
1779 for (j = 0;j < NUMKEYS;j++)
1784 for (j=0 ; j<256 ; j++)
1789 if (!strcmp (b, command) )
1792 if (count == NUMKEYS)
1798 void M_UnbindCommand (char *command)
1803 for (j=0 ; j<256 ; j++)
1808 if (!strcmp (b, command))
1809 Key_SetBinding (j, "");
1814 void M_Keys_Draw (void)
1820 char keystring[1024];
1822 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1823 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1826 M_Print (12, 32, "Press a key or button for this action");
1828 M_Print (18, 32, "Enter to change, backspace to clear");
1830 // search for known bindings
1831 for (i=0 ; i<NUMCOMMANDS ; i++)
1835 M_Print (16, y, bindnames[i][1]);
1837 M_FindKeysForCommand (bindnames[i][0], keys);
1839 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1841 strcpy(keystring, "???");
1845 for (j = 0;j < NUMKEYS;j++)
1850 strcat(keystring, " or ");
1851 strcat(keystring, Key_KeynumToString (keys[j]));
1855 M_Print (150, y, keystring);
1859 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
1861 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1865 void M_Keys_Key (int k)
1872 S_LocalSound ("misc/menu1.wav");
1877 else //if (k != '`')
1879 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1880 Cbuf_InsertText (cmd);
1890 M_Menu_Options_f ();
1895 S_LocalSound ("misc/menu1.wav");
1897 if (keys_cursor < 0)
1898 keys_cursor = NUMCOMMANDS-1;
1903 S_LocalSound ("misc/menu1.wav");
1905 if (keys_cursor >= NUMCOMMANDS)
1909 case K_ENTER: // go into bind mode
1910 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1911 S_LocalSound ("misc/menu2.wav");
1912 if (keys[NUMKEYS - 1] != -1)
1913 M_UnbindCommand (bindnames[keys_cursor][0]);
1917 case K_BACKSPACE: // delete bindings
1918 case K_DEL: // delete bindings
1919 S_LocalSound ("misc/menu2.wav");
1920 M_UnbindCommand (bindnames[keys_cursor][0]);
1925 //=============================================================================
1928 void M_Menu_Video_f (void)
1930 key_dest = key_menu;
1932 m_entersound = true;
1936 void M_Video_Draw (void)
1938 (*vid_menudrawfn) ();
1942 void M_Video_Key (int key)
1944 (*vid_menukeyfn) (key);
1947 //=============================================================================
1951 #define NUM_HELP_PAGES 6
1954 void M_Menu_Help_f (void)
1956 key_dest = key_menu;
1958 m_entersound = true;
1964 void M_Help_Draw (void)
1966 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
1970 void M_Help_Key (int key)
1980 m_entersound = true;
1981 if (++help_page >= NUM_HELP_PAGES)
1987 m_entersound = true;
1988 if (--help_page < 0)
1989 help_page = NUM_HELP_PAGES-1;
1995 //=============================================================================
1999 int m_quit_prevstate;
2000 qboolean wasInMenus;
2002 char *quitMessage [] =
2004 /* .........1.........2.... */
2006 " Are you gonna quit ",
2007 " this game just like ",
2008 " everything else? ",
2011 " Milord, methinks that ",
2012 " thou art a lowly ",
2013 " quitter. Is this true? ",
2016 " Do I need to bust your ",
2017 " face open for trying ",
2021 " Man, I oughta smack you",
2022 " for trying to quit! ",
2026 " Press Y to quit like a ",
2027 " big loser in life. ",
2028 " Press N to stay proud ",
2029 " and successful! ",
2031 " If you press Y to ",
2032 " quit, I will summon ",
2033 " Satan all over your ",
2036 " Um, Asmodeus dislikes ",
2037 " his children trying to ",
2038 " quit. Press Y to return",
2039 " to your Tinkertoys. ",
2041 " If you quit now, I'll ",
2042 " throw a blanket-party ",
2043 " for you next time! ",
2047 /* .........1.........2.... */
2049 " Tired of fragging ",
2054 " Quit now and forfeit ",
2055 " your bodycount? ",
2059 " Are you sure you ",
2064 " Off to do something ",
2069 void M_Menu_Quit_f (void)
2071 if (m_state == m_quit)
2073 wasInMenus = (key_dest == key_menu);
2074 key_dest = key_menu;
2075 m_quit_prevstate = m_state;
2077 m_entersound = true;
2078 msgNumber = rand()&3; //&7;
2082 void M_Quit_Key (int key)
2091 m_state = m_quit_prevstate;
2092 m_entersound = true;
2096 key_dest = key_game;
2103 key_dest = key_console;
2114 void M_Quit_Draw (void)
2116 M_DrawTextBox (56, 76, 24, 4);
2117 M_Print (64, 84, quitMessage[msgNumber*4+0]);
2118 M_Print (64, 92, quitMessage[msgNumber*4+1]);
2119 M_Print (64, 100, quitMessage[msgNumber*4+2]);
2120 M_Print (64, 108, quitMessage[msgNumber*4+3]);
2123 //=============================================================================
2124 /* LAN CONFIG MENU */
2126 int lanConfig_cursor = -1;
2127 int lanConfig_cursor_table [] = {72, 92, 124};
2128 #define NUM_LANCONFIG_CMDS 3
2131 char lanConfig_portname[6];
2132 char lanConfig_joinname[22];
2134 void M_Menu_LanConfig_f (void)
2136 key_dest = key_menu;
2137 m_state = m_lanconfig;
2138 m_entersound = true;
2139 if (lanConfig_cursor == -1)
2141 if (JoiningGame && TCPIPConfig)
2142 lanConfig_cursor = 2;
2144 lanConfig_cursor = 1;
2146 if (StartingGame && lanConfig_cursor == 2)
2147 lanConfig_cursor = 1;
2148 lanConfig_port = DEFAULTnet_hostport;
2149 sprintf(lanConfig_portname, "%u", lanConfig_port);
2151 m_return_onerror = false;
2152 m_return_reason[0] = 0;
2156 void M_LanConfig_Draw (void)
2163 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2164 p = Draw_CachePic ("gfx/p_multi.lmp");
2165 basex = (320-p->width)/2;
2166 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2169 startJoin = "New Game";
2171 startJoin = "Join Game";
2175 protocol = "TCP/IP";
2176 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2179 M_Print (basex, 52, "Address:");
2181 M_Print (basex+9*8, 52, my_ipx_address);
2183 M_Print (basex+9*8, 52, my_tcpip_address);
2185 M_Print (basex, lanConfig_cursor_table[0], "Port");
2186 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2187 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2191 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2192 M_Print (basex, 108, "Join game at:");
2193 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2194 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2198 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2199 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2202 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2204 if (lanConfig_cursor == 0)
2205 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2207 if (lanConfig_cursor == 2)
2208 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2210 if (*m_return_reason)
2211 M_PrintWhite (basex, 148, m_return_reason);
2215 void M_LanConfig_Key (int key)
2226 S_LocalSound ("misc/menu1.wav");
2228 if (lanConfig_cursor < 0)
2229 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2233 S_LocalSound ("misc/menu1.wav");
2235 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2236 lanConfig_cursor = 0;
2240 if (lanConfig_cursor == 0)
2243 m_entersound = true;
2245 M_ConfigureNetSubsystem ();
2247 if (lanConfig_cursor == 1)
2251 M_Menu_GameOptions_f ();
2258 if (lanConfig_cursor == 2)
2260 m_return_state = m_state;
2261 m_return_onerror = true;
2262 key_dest = key_game;
2264 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2271 if (lanConfig_cursor == 0)
2273 if (strlen(lanConfig_portname))
2274 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2277 if (lanConfig_cursor == 2)
2279 if (strlen(lanConfig_joinname))
2280 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2285 if (key < 32 || key > 127)
2288 if (lanConfig_cursor == 2)
2290 l = strlen(lanConfig_joinname);
2293 lanConfig_joinname[l+1] = 0;
2294 lanConfig_joinname[l] = key;
2298 if (key < '0' || key > '9')
2300 if (lanConfig_cursor == 0)
2302 l = strlen(lanConfig_portname);
2305 lanConfig_portname[l+1] = 0;
2306 lanConfig_portname[l] = key;
2311 if (StartingGame && lanConfig_cursor == 2)
2313 if (key == K_UPARROW)
2314 lanConfig_cursor = 1;
2316 lanConfig_cursor = 0;
2319 l = atoi(lanConfig_portname);
2324 sprintf(lanConfig_portname, "%u", lanConfig_port);
2327 //=============================================================================
2328 /* GAME OPTIONS MENU */
2347 episode_t *episodes;
2352 level_t quakelevels[] =
2354 {"start", "Entrance"}, // 0
2356 {"e1m1", "Slipgate Complex"}, // 1
2357 {"e1m2", "Castle of the Damned"},
2358 {"e1m3", "The Necropolis"},
2359 {"e1m4", "The Grisly Grotto"},
2360 {"e1m5", "Gloom Keep"},
2361 {"e1m6", "The Door To Chthon"},
2362 {"e1m7", "The House of Chthon"},
2363 {"e1m8", "Ziggurat Vertigo"},
2365 {"e2m1", "The Installation"}, // 9
2366 {"e2m2", "Ogre Citadel"},
2367 {"e2m3", "Crypt of Decay"},
2368 {"e2m4", "The Ebon Fortress"},
2369 {"e2m5", "The Wizard's Manse"},
2370 {"e2m6", "The Dismal Oubliette"},
2371 {"e2m7", "Underearth"},
2373 {"e3m1", "Termination Central"}, // 16
2374 {"e3m2", "The Vaults of Zin"},
2375 {"e3m3", "The Tomb of Terror"},
2376 {"e3m4", "Satan's Dark Delight"},
2377 {"e3m5", "Wind Tunnels"},
2378 {"e3m6", "Chambers of Torment"},
2379 {"e3m7", "The Haunted Halls"},
2381 {"e4m1", "The Sewage System"}, // 23
2382 {"e4m2", "The Tower of Despair"},
2383 {"e4m3", "The Elder God Shrine"},
2384 {"e4m4", "The Palace of Hate"},
2385 {"e4m5", "Hell's Atrium"},
2386 {"e4m6", "The Pain Maze"},
2387 {"e4m7", "Azure Agony"},
2388 {"e4m8", "The Nameless City"},
2390 {"end", "Shub-Niggurath's Pit"}, // 31
2392 {"dm1", "Place of Two Deaths"}, // 32
2393 {"dm2", "Claustrophobopolis"},
2394 {"dm3", "The Abandoned Base"},
2395 {"dm4", "The Bad Place"},
2396 {"dm5", "The Cistern"},
2397 {"dm6", "The Dark Zone"}
2400 episode_t quakeepisodes[] =
2402 {"Welcome to Quake", 0, 1},
2403 {"Doomed Dimension", 1, 8},
2404 {"Realm of Black Magic", 9, 7},
2405 {"Netherworld", 16, 7},
2406 {"The Elder World", 23, 8},
2407 {"Final Level", 31, 1},
2408 {"Deathmatch Arena", 32, 6}
2411 //MED 01/06/97 added hipnotic levels
2412 level_t hipnoticlevels[] =
2414 {"start", "Command HQ"}, // 0
2416 {"hip1m1", "The Pumping Station"}, // 1
2417 {"hip1m2", "Storage Facility"},
2418 {"hip1m3", "The Lost Mine"},
2419 {"hip1m4", "Research Facility"},
2420 {"hip1m5", "Military Complex"},
2422 {"hip2m1", "Ancient Realms"}, // 6
2423 {"hip2m2", "The Black Cathedral"},
2424 {"hip2m3", "The Catacombs"},
2425 {"hip2m4", "The Crypt"},
2426 {"hip2m5", "Mortum's Keep"},
2427 {"hip2m6", "The Gremlin's Domain"},
2429 {"hip3m1", "Tur Torment"}, // 12
2430 {"hip3m2", "Pandemonium"},
2431 {"hip3m3", "Limbo"},
2432 {"hip3m4", "The Gauntlet"},
2434 {"hipend", "Armagon's Lair"}, // 16
2436 {"hipdm1", "The Edge of Oblivion"} // 17
2439 //MED 01/06/97 added hipnotic episodes
2440 episode_t hipnoticepisodes[] =
2442 {"Scourge of Armagon", 0, 1},
2443 {"Fortress of the Dead", 1, 5},
2444 {"Dominion of Darkness", 6, 6},
2445 {"The Rift", 12, 4},
2446 {"Final Level", 16, 1},
2447 {"Deathmatch Arena", 17, 1}
2450 //PGM 01/07/97 added rogue levels
2451 //PGM 03/02/97 added dmatch level
2452 level_t roguelevels[] =
2454 {"start", "Split Decision"},
2455 {"r1m1", "Deviant's Domain"},
2456 {"r1m2", "Dread Portal"},
2457 {"r1m3", "Judgement Call"},
2458 {"r1m4", "Cave of Death"},
2459 {"r1m5", "Towers of Wrath"},
2460 {"r1m6", "Temple of Pain"},
2461 {"r1m7", "Tomb of the Overlord"},
2462 {"r2m1", "Tempus Fugit"},
2463 {"r2m2", "Elemental Fury I"},
2464 {"r2m3", "Elemental Fury II"},
2465 {"r2m4", "Curse of Osiris"},
2466 {"r2m5", "Wizard's Keep"},
2467 {"r2m6", "Blood Sacrifice"},
2468 {"r2m7", "Last Bastion"},
2469 {"r2m8", "Source of Evil"},
2470 {"ctf1", "Division of Change"}
2473 //PGM 01/07/97 added rogue episodes
2474 //PGM 03/02/97 added dmatch episode
2475 episode_t rogueepisodes[] =
2477 {"Introduction", 0, 1},
2478 {"Hell's Fortress", 1, 7},
2479 {"Corridors of Time", 8, 8},
2480 {"Deathmatch Arena", 16, 1}
2483 level_t nehahralevels[] =
2485 {"nehstart", "Welcome to Nehahra"},
2486 {"neh1m1", "Forge City1: Slipgates"},
2487 {"neh1m2", "Forge City2: Boiler"},
2488 {"neh1m3", "Forge City3: Escape"},
2489 {"neh1m4", "Grind Core"},
2490 {"neh1m5", "Industrial Silence"},
2491 {"neh1m6", "Locked-Up Anger"},
2492 {"neh1m7", "Wanderer of the Wastes"},
2493 {"neh1m8", "Artemis System Net"},
2494 {"neh1m9", "To the Death"},
2495 {"neh2m1", "The Gates of Ghoro"},
2496 {"neh2m2", "Sacred Trinity"},
2497 {"neh2m3", "Realm of the Ancients"},
2498 {"neh2m4", "Temple of the Ancients"},
2499 {"neh2m5", "Dreams Made Flesh"},
2500 {"neh2m6", "Your Last Cup of Sorrow"},
2501 {"nehsec", "Ogre's Bane"},
2502 {"nehahra", "Nehahra's Den"},
2503 {"nehend", "Quintessence"}
2506 episode_t nehahraepisodes[] =
2508 {"Welcome to Nehahra", 0, 1},
2509 {"The Fall of Forge", 1, 9},
2510 {"The Outlands", 10, 7},
2511 {"Dimension of the Lost", 17, 2}
2514 // Map list for Transfusion
2515 level_t transfusionlevels[] =
2517 {"bb1", "The Stronghold"},
2518 {"bb2", "Winter Wonderland"},
2520 {"bb4", "The Tower"},
2522 {"bb6", "Twin Fortress"},
2524 {"bb8", "Fun With Heads"},
2525 {"e1m1", "Cradle to Grave"},
2526 {"e1m7", "Altar of Stone"},
2528 {"dm1", "Monolith Building 11"},
2531 {"e6m8", "Beauty and the Beast"},
2533 {"cpbb01", "Crypt of Despair"},
2534 {"cpbb02", "Pits of Blood"},
2535 {"cpbb03", "Unholy Cathedral"},
2536 {"cpbb04", "Deadly Inspirations"},
2538 {"b2a15", "Area 15 (B2)"},
2539 {"barena", "Blood Arena"},
2540 {"bkeep", "Blood Keep"},
2541 {"bstar", "Brown Star"},
2542 {"crypt", "The Crypt"},
2544 {"bb3_2k1", "Bodies Infusion"},
2545 {"qbb1", "The Confluence"},
2546 {"qbb2", "KathartiK"},
2547 {"qbb3", "Caleb's Woodland Retreat"},
2548 {"ded_simp", "Dead Simple"},
2549 {"dranzbb6", "Black Coffee"},
2550 {"qe1m7", "The House of Chthon"}
2553 episode_t transfusionepisodes[] =
2556 {"Plasma Pack", 10, 4},
2557 {"Cryptic Passage", 14, 4},
2562 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2563 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2564 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2565 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2566 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2567 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 5};
2572 gamelevels_t *notregistered;
2573 gamelevels_t *registered;
2577 gameinfo_t gamelist[] =
2579 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2580 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2581 {GAME_ROGUE, &roguegame, &roguegame},
2582 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2583 {GAME_FIENDARENA, &sharewarequakegame, ®isteredquakegame},
2584 {GAME_ZYMOTIC, &sharewarequakegame, ®isteredquakegame},
2585 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2586 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2589 gamelevels_t *lookupgameinfo(void)
2592 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2593 if (registered.integer)
2594 return gamelist[i].registered;
2596 return gamelist[i].notregistered;
2602 qboolean m_serverInfoMessage = false;
2603 double m_serverInfoMessageTime;
2605 void M_Menu_GameOptions_f (void)
2607 key_dest = key_menu;
2608 m_state = m_gameoptions;
2609 m_entersound = true;
2610 if (maxplayers == 0)
2611 maxplayers = svs.maxclients;
2613 maxplayers = svs.maxclientslimit;
2617 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2618 #define NUM_GAMEOPTIONS 9
2619 int gameoptions_cursor;
2621 void M_GameOptions_Draw (void)
2627 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2628 p = Draw_CachePic ("gfx/p_multi.lmp");
2629 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2631 M_DrawTextBox (152, 32, 10, 1);
2632 M_Print (160, 40, "begin game");
2634 M_Print (0, 56, " Max players");
2635 M_Print (160, 56, va("%i", maxplayers) );
2637 M_Print (0, 64, " Game Type");
2638 if (gamemode == GAME_TRANSFUSION)
2640 if (!deathmatch.integer)
2641 Cvar_SetValue("deathmatch", 1);
2642 if (deathmatch.integer == 2)
2643 M_Print (160, 64, "Capture the Flag");
2645 M_Print (160, 64, "Blood Bath");
2649 if (!coop.integer && !deathmatch.integer)
2650 Cvar_SetValue("deathmatch", 1);
2652 M_Print (160, 64, "Cooperative");
2654 M_Print (160, 64, "Deathmatch");
2657 M_Print (0, 72, " Teamplay");
2658 if (gamemode == GAME_ROGUE)
2662 switch((int)teamplay.integer)
2664 case 1: msg = "No Friendly Fire"; break;
2665 case 2: msg = "Friendly Fire"; break;
2666 case 3: msg = "Tag"; break;
2667 case 4: msg = "Capture the Flag"; break;
2668 case 5: msg = "One Flag CTF"; break;
2669 case 6: msg = "Three Team CTF"; break;
2670 default: msg = "Off"; break;
2672 M_Print (160, 72, msg);
2674 else if (gamemode == GAME_TRANSFUSION)
2678 switch (teamplay.integer)
2680 case 0: msg = "Off"; break;
2681 case 2: msg = "Friendly Fire"; break;
2682 default: msg = "No Friendly Fire"; break;
2684 M_Print (160, 72, msg);
2690 switch((int)teamplay.integer)
2692 case 1: msg = "No Friendly Fire"; break;
2693 case 2: msg = "Friendly Fire"; break;
2694 default: msg = "Off"; break;
2696 M_Print (160, 72, msg);
2699 M_Print (0, 80, " Skill");
2700 if (skill.integer == 0)
2701 M_Print (160, 80, "Easy difficulty");
2702 else if (skill.integer == 1)
2703 M_Print (160, 80, "Normal difficulty");
2704 else if (skill.integer == 2)
2705 M_Print (160, 80, "Hard difficulty");
2707 M_Print (160, 80, "Nightmare difficulty");
2709 M_Print (0, 88, " Frag Limit");
2710 if (fraglimit.integer == 0)
2711 M_Print (160, 88, "none");
2713 M_Print (160, 88, va("%i frags", fraglimit.integer));
2715 M_Print (0, 96, " Time Limit");
2716 if (timelimit.integer == 0)
2717 M_Print (160, 96, "none");
2719 M_Print (160, 96, va("%i minutes", timelimit.integer));
2721 g = lookupgameinfo();
2723 M_Print (0, 112, " Episode");
2724 M_Print (160, 112, g->episodes[startepisode].description);
2726 M_Print (0, 120, " Level");
2727 M_Print (160, 120, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
2728 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
2731 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2733 if (m_serverInfoMessage)
2735 if ((realtime - m_serverInfoMessageTime) < 5.0)
2738 M_DrawTextBox (x, 138, 24, 4);
2740 M_Print (x, 146, " More than 64 players?? ");
2741 M_Print (x, 154, " First, question your ");
2742 M_Print (x, 162, " sanity, then email ");
2743 M_Print (x, 170, " havoc@gamevisions.com ");
2747 m_serverInfoMessage = false;
2753 void M_NetStart_Change (int dir)
2758 switch (gameoptions_cursor)
2762 if (maxplayers > svs.maxclientslimit)
2764 maxplayers = svs.maxclientslimit;
2765 m_serverInfoMessage = true;
2766 m_serverInfoMessageTime = realtime;
2773 if (gamemode == GAME_TRANSFUSION)
2775 if (deathmatch.integer == 2) // changing from CTF to BloodBath
2776 Cvar_SetValueQuick (&deathmatch, 0);
2777 else // changing from BloodBath to CTF
2778 Cvar_SetValueQuick (&deathmatch, 2);
2782 if (deathmatch.integer) // changing from deathmatch to coop
2784 Cvar_SetValueQuick (&coop, 1);
2785 Cvar_SetValueQuick (&deathmatch, 0);
2787 else // changing from coop to deathmatch
2789 Cvar_SetValueQuick (&coop, 0);
2790 Cvar_SetValueQuick (&deathmatch, 1);
2796 if (gamemode == GAME_ROGUE)
2801 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
2802 if (teamplay.integer > count)
2803 Cvar_SetValueQuick (&teamplay, 0);
2804 else if (teamplay.integer < 0)
2805 Cvar_SetValueQuick (&teamplay, count);
2809 Cvar_SetValueQuick (&skill, skill.integer + dir);
2810 if (skill.integer > 3)
2811 Cvar_SetValueQuick (&skill, 0);
2812 if (skill.integer < 0)
2813 Cvar_SetValueQuick (&skill, 3);
2817 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
2818 if (fraglimit.integer > 100)
2819 Cvar_SetValueQuick (&fraglimit, 0);
2820 if (fraglimit.integer < 0)
2821 Cvar_SetValueQuick (&fraglimit, 100);
2825 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
2826 if (timelimit.value > 60)
2827 Cvar_SetValueQuick (&timelimit, 0);
2828 if (timelimit.value < 0)
2829 Cvar_SetValueQuick (&timelimit, 60);
2833 startepisode += dir;
2834 g = lookupgameinfo();
2836 if (startepisode < 0)
2837 startepisode = g->numepisodes - 1;
2839 if (startepisode >= g->numepisodes)
2847 g = lookupgameinfo();
2850 startlevel = g->episodes[startepisode].levels - 1;
2852 if (startlevel >= g->episodes[startepisode].levels)
2858 void M_GameOptions_Key (int key)
2869 S_LocalSound ("misc/menu1.wav");
2870 gameoptions_cursor--;
2871 if (gameoptions_cursor < 0)
2872 gameoptions_cursor = NUM_GAMEOPTIONS-1;
2876 S_LocalSound ("misc/menu1.wav");
2877 gameoptions_cursor++;
2878 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
2879 gameoptions_cursor = 0;
2883 if (gameoptions_cursor == 0)
2885 S_LocalSound ("misc/menu3.wav");
2886 M_NetStart_Change (-1);
2890 if (gameoptions_cursor == 0)
2892 S_LocalSound ("misc/menu3.wav");
2893 M_NetStart_Change (1);
2897 S_LocalSound ("misc/menu2.wav");
2898 if (gameoptions_cursor == 0)
2901 Cbuf_AddText ("disconnect\n");
2902 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
2903 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
2905 g = lookupgameinfo();
2906 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
2910 M_NetStart_Change (1);
2915 //=============================================================================
2918 qboolean searchComplete = false;
2919 double searchCompleteTime;
2921 void M_Menu_Search_f (void)
2923 key_dest = key_menu;
2925 m_entersound = false;
2928 searchComplete = false;
2934 void M_Search_Draw (void)
2939 p = Draw_CachePic ("gfx/p_multi.lmp");
2940 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2941 x = (320/2) - ((12*8)/2) + 4;
2942 M_DrawTextBox (x-8, 32, 12, 1);
2943 M_Print (x, 40, "Searching...");
2951 if (! searchComplete)
2953 searchComplete = true;
2954 searchCompleteTime = realtime;
2959 M_Menu_ServerList_f ();
2963 M_PrintWhite ((320/2) - ((22*8)/2), 64, "No Quake servers found");
2964 if ((realtime - searchCompleteTime) < 3.0)
2967 M_Menu_LanConfig_f ();
2971 void M_Search_Key (int key)
2975 //=============================================================================
2979 qboolean slist_sorted;
2981 void M_Menu_ServerList_f (void)
2983 key_dest = key_menu;
2985 m_entersound = true;
2987 m_return_onerror = false;
2988 m_return_reason[0] = 0;
2989 slist_sorted = false;
2993 void M_ServerList_Draw (void)
3001 if (hostCacheCount > 1)
3005 for (i = 0; i < hostCacheCount; i++)
3006 for (j = i+1; j < hostCacheCount; j++)
3007 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3009 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3010 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3011 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3014 slist_sorted = true;
3017 p = Draw_CachePic ("gfx/p_multi.lmp");
3018 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3019 for (n = 0; n < hostCacheCount; n++)
3021 if (hostcache[n].maxusers)
3022 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3024 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3025 M_Print (16, 32 + 8*n, string);
3027 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3029 if (*m_return_reason)
3030 M_PrintWhite (16, 148, m_return_reason);
3034 void M_ServerList_Key (int k)
3039 M_Menu_LanConfig_f ();
3048 S_LocalSound ("misc/menu1.wav");
3050 if (slist_cursor < 0)
3051 slist_cursor = hostCacheCount - 1;
3056 S_LocalSound ("misc/menu1.wav");
3058 if (slist_cursor >= hostCacheCount)
3063 S_LocalSound ("misc/menu2.wav");
3064 m_return_state = m_state;
3065 m_return_onerror = true;
3066 slist_sorted = false;
3067 key_dest = key_game;
3069 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3078 //=============================================================================
3079 /* Menu Subsystem */
3084 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3086 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3087 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3088 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3089 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3090 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3091 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3092 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3093 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3094 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3095 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3096 Cmd_AddCommand ("help", M_Menu_Help_f);
3097 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3099 if (gamemode == GAME_NEHAHRA)
3101 if (COM_FileExists("maps/neh1m4.bsp"))
3103 if (COM_FileExists("hearing.dem"))
3105 Con_Printf("Nehahra movie and game detected.\n");
3106 NehGameType = TYPE_BOTH;
3110 Con_Printf("Nehahra game detected.\n");
3111 NehGameType = TYPE_GAME;
3116 if (COM_FileExists("hearing.dem"))
3118 Con_Printf("Nehahra movie detected.\n");
3119 NehGameType = TYPE_DEMO;
3123 Con_Printf("Nehahra not found.\n");
3124 NehGameType = TYPE_GAME; // could just complain, but...
3132 if (m_state == m_none || key_dest != key_menu)
3150 case m_singleplayer:
3151 M_SinglePlayer_Draw ();
3163 M_MultiPlayer_Draw ();
3178 case m_options_effects:
3179 M_Options_Effects_Draw ();
3199 M_LanConfig_Draw ();
3203 M_GameOptions_Draw ();
3211 M_ServerList_Draw ();
3217 S_LocalSound ("misc/menu2.wav");
3218 m_entersound = false;
3225 void M_Keydown (int key)
3240 case m_singleplayer:
3241 M_SinglePlayer_Key (key);
3253 M_MultiPlayer_Key (key);
3265 M_Options_Key (key);
3268 case m_options_effects:
3269 M_Options_Effects_Key (key);
3289 M_LanConfig_Key (key);
3293 M_GameOptions_Key (key);
3301 M_ServerList_Key (key);
3307 void M_ConfigureNetSubsystem(void)
3309 // enable/disable net systems to match desired config
3311 Cbuf_AddText ("stopdemo\n");
3313 if (IPXConfig || TCPIPConfig)
3314 net_hostport = lanConfig_port;