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 //=============================================================================
278 //int m_save_demonum;
285 void M_ToggleMenu_f (void)
289 if (key_dest == key_menu)
291 if (m_state != m_main)
300 //if (key_dest == key_console)
301 // Con_ToggleConsole_f ();
308 void M_Demo_Draw (void)
312 for (i=0; i < NumberOfNehahraDemos; i++)
313 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
316 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
320 void M_Menu_Demos_f (void)
327 void M_Demo_Key (int k)
336 S_LocalSound ("misc/menu2.wav");
339 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
344 S_LocalSound ("misc/menu1.wav");
347 demo_cursor = NumberOfNehahraDemos;
352 S_LocalSound ("misc/menu1.wav");
354 if (demo_cursor > NumberOfNehahraDemos)
360 //=============================================================================
365 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
367 void M_Menu_Main_f (void)
369 if (gamemode == GAME_NEHAHRA)
371 if (NehGameType == TYPE_DEMO)
373 else if (NehGameType == TYPE_GAME)
382 if (key_dest != key_menu)
384 m_save_demonum = cls.demonum;
394 void M_Main_Draw (void)
399 M_DrawPic (16, 4, "gfx/qplaque.lmp");
400 p = Draw_CachePic ("gfx/ttl_main.lmp");
401 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
403 if (gamemode == GAME_NEHAHRA)
405 if (NehGameType == TYPE_BOTH)
406 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
407 else if (NehGameType == TYPE_GAME)
408 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
410 M_DrawPic (72, 32, "gfx/demomenu.lmp");
413 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
415 f = (int)(realtime * 10)%6;
417 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
421 void M_Main_Key (int key)
428 //cls.demonum = m_save_demonum;
429 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
434 S_LocalSound ("misc/menu1.wav");
435 if (++m_main_cursor >= MAIN_ITEMS)
440 S_LocalSound ("misc/menu1.wav");
441 if (--m_main_cursor < 0)
442 m_main_cursor = MAIN_ITEMS - 1;
448 if (gamemode == GAME_NEHAHRA)
453 switch (m_main_cursor)
456 M_Menu_SinglePlayer_f ();
464 M_Menu_MultiPlayer_f ();
474 Cbuf_AddText ("disconnect\n");
475 Cbuf_AddText ("playdemo endcred\n");
484 switch (m_main_cursor)
487 M_Menu_SinglePlayer_f ();
491 M_Menu_MultiPlayer_f ();
501 Cbuf_AddText ("disconnect\n");
502 Cbuf_AddText ("playdemo endcred\n");
511 switch (m_main_cursor)
520 Cbuf_AddText ("disconnect\n");
521 Cbuf_AddText ("playdemo endcred\n");
537 switch (m_main_cursor)
540 M_Menu_SinglePlayer_f ();
544 M_Menu_MultiPlayer_f ();
563 //=============================================================================
564 /* SINGLE PLAYER MENU */
566 int m_singleplayer_cursor;
567 #define SINGLEPLAYER_ITEMS 3
570 void M_Menu_SinglePlayer_f (void)
573 m_state = m_singleplayer;
578 void M_SinglePlayer_Draw (void)
582 M_DrawPic (16, 4, "gfx/qplaque.lmp");
583 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
585 // Transfusion doesn't have a single player mode
586 if (gamemode == GAME_TRANSFUSION)
588 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
590 M_DrawTextBox (60, 8 * 8, 23, 4);
591 M_PrintWhite (95, 10 * 8, "Transfusion is for");
592 M_PrintWhite (83, 11 * 8, "multiplayer play only");
598 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
599 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
601 f = (int)(realtime * 10)%6;
603 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
608 void M_SinglePlayer_Key (int key)
610 if (gamemode == GAME_TRANSFUSION)
612 if (key == K_ESCAPE || key == K_ENTER)
624 S_LocalSound ("misc/menu1.wav");
625 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
626 m_singleplayer_cursor = 0;
630 S_LocalSound ("misc/menu1.wav");
631 if (--m_singleplayer_cursor < 0)
632 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
638 switch (m_singleplayer_cursor)
643 Cbuf_AddText ("disconnect\n");
644 Cbuf_AddText ("maxplayers 1\n");
645 Cbuf_AddText ("deathmatch 0\n");
646 Cbuf_AddText ("coop 0\n");
647 if (gamemode == GAME_NEHAHRA)
648 Cbuf_AddText ("map nehstart\n");
650 Cbuf_AddText ("map start\n");
664 //=============================================================================
667 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
669 #define MAX_SAVEGAMES 12
670 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
671 int loadable[MAX_SAVEGAMES];
673 void M_ScanSaves (void)
676 char name[MAX_OSPATH];
681 for (i=0 ; i<MAX_SAVEGAMES ; i++)
683 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
685 sprintf (name, "%s/s%i.sav", com_gamedir, i);
686 f = Qopen (name, "rz");
690 sscanf (str, "%i\n", &version);
692 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
694 // change _ back to space
695 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
696 if (m_filenames[i][j] == '_')
697 m_filenames[i][j] = ' ';
703 void M_Menu_Load_f (void)
712 void M_Menu_Save_f (void)
718 if (svs.maxclients != 1)
727 void M_Load_Draw (void)
732 p = Draw_CachePic ("gfx/p_load.lmp");
733 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
735 for (i=0 ; i< MAX_SAVEGAMES; i++)
736 M_Print (16, 32 + 8*i, m_filenames[i]);
739 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
743 void M_Save_Draw (void)
748 p = Draw_CachePic ("gfx/p_save.lmp");
749 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
751 for (i=0 ; i<MAX_SAVEGAMES ; i++)
752 M_Print (16, 32 + 8*i, m_filenames[i]);
755 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
759 void M_Load_Key (int k)
764 M_Menu_SinglePlayer_f ();
768 S_LocalSound ("misc/menu2.wav");
769 if (!loadable[load_cursor])
774 // issue the load command
775 Cbuf_AddText (va ("load s%i\n", load_cursor) );
780 S_LocalSound ("misc/menu1.wav");
783 load_cursor = MAX_SAVEGAMES-1;
788 S_LocalSound ("misc/menu1.wav");
790 if (load_cursor >= MAX_SAVEGAMES)
797 void M_Save_Key (int k)
802 M_Menu_SinglePlayer_f ();
808 Cbuf_AddText (va("save s%i\n", load_cursor));
813 S_LocalSound ("misc/menu1.wav");
816 load_cursor = MAX_SAVEGAMES-1;
821 S_LocalSound ("misc/menu1.wav");
823 if (load_cursor >= MAX_SAVEGAMES)
829 //=============================================================================
830 /* MULTIPLAYER MENU */
832 int m_multiplayer_cursor;
833 #define MULTIPLAYER_ITEMS 3
836 void M_Menu_MultiPlayer_f (void)
839 m_state = m_multiplayer;
844 void M_MultiPlayer_Draw (void)
849 M_DrawPic (16, 4, "gfx/qplaque.lmp");
850 p = Draw_CachePic ("gfx/p_multi.lmp");
851 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
852 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
854 f = (int)(realtime * 10)%6;
856 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
858 if (ipxAvailable || tcpipAvailable)
860 M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
864 void M_MultiPlayer_Key (int key)
873 S_LocalSound ("misc/menu1.wav");
874 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
875 m_multiplayer_cursor = 0;
879 S_LocalSound ("misc/menu1.wav");
880 if (--m_multiplayer_cursor < 0)
881 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
886 switch (m_multiplayer_cursor)
889 if (ipxAvailable || tcpipAvailable)
894 if (ipxAvailable || tcpipAvailable)
905 //=============================================================================
908 int setup_cursor = 4;
909 int setup_cursor_table[] = {40, 56, 80, 104, 140};
911 char setup_hostname[16];
912 char setup_myname[16];
918 #define NUM_SETUP_CMDS 5
920 void M_Menu_Setup_f (void)
925 strcpy(setup_myname, cl_name.string);
926 strcpy(setup_hostname, hostname.string);
927 setup_top = setup_oldtop = cl_color.integer >> 4;
928 setup_bottom = setup_oldbottom = cl_color.integer & 15;
931 // LordHavoc: rewrote this code greatly
932 void M_MenuPlayerTranslate (qbyte *translation, int top, int bottom)
935 unsigned int trans[4096];
937 static qbyte pixels[4096];
938 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load = true, menuplyr_failed = false;
942 if (menuplyr_top == top && menuplyr_bottom == bottom)
946 menuplyr_bottom = bottom;
950 menuplyr_load = false;
951 f = COM_LoadFile("gfx/menuplyr.lmp", true);
954 menuplyr_failed = true;
957 data = LoadLMPAs8Bit (f, 0, 0);
959 if (image_width * image_height > 4096)
961 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
963 menuplyr_failed = true;
966 menuplyr_width = image_width;
967 menuplyr_height = image_height;
968 memcpy(pixels, data, menuplyr_width * menuplyr_height);
972 M_BuildTranslationTable (menuplyr_top*16, menuplyr_bottom*16);
974 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
975 trans[i] = d_8to24table[translation[pixels[i]]];
977 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)trans);
980 void M_Setup_Draw (void)
984 M_DrawPic (16, 4, "gfx/qplaque.lmp");
985 p = Draw_CachePic ("gfx/p_multi.lmp");
986 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
988 M_Print (64, 40, "Hostname");
989 M_DrawTextBox (160, 32, 16, 1);
990 M_Print (168, 40, setup_hostname);
992 M_Print (64, 56, "Your name");
993 M_DrawTextBox (160, 48, 16, 1);
994 M_Print (168, 56, setup_myname);
996 M_Print (64, 80, "Shirt color");
997 M_Print (64, 104, "Pants color");
999 M_DrawTextBox (64, 140-8, 14, 1);
1000 M_Print (72, 140, "Accept Changes");
1002 M_DrawPic (160, 64, "gfx/bigbox.lmp");
1004 // LordHavoc: rewrote this code greatly
1005 M_MenuPlayerTranslate (translationTable, setup_top, setup_bottom);
1006 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
1008 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1010 if (setup_cursor == 0)
1011 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1013 if (setup_cursor == 1)
1014 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1018 void M_Setup_Key (int k)
1025 M_Menu_MultiPlayer_f ();
1029 S_LocalSound ("misc/menu1.wav");
1031 if (setup_cursor < 0)
1032 setup_cursor = NUM_SETUP_CMDS-1;
1036 S_LocalSound ("misc/menu1.wav");
1038 if (setup_cursor >= NUM_SETUP_CMDS)
1043 if (setup_cursor < 2)
1045 S_LocalSound ("misc/menu3.wav");
1046 if (setup_cursor == 2)
1047 setup_top = setup_top - 1;
1048 if (setup_cursor == 3)
1049 setup_bottom = setup_bottom - 1;
1052 if (setup_cursor < 2)
1055 S_LocalSound ("misc/menu3.wav");
1056 if (setup_cursor == 2)
1057 setup_top = setup_top + 1;
1058 if (setup_cursor == 3)
1059 setup_bottom = setup_bottom + 1;
1063 if (setup_cursor == 0 || setup_cursor == 1)
1066 if (setup_cursor == 2 || setup_cursor == 3)
1069 // setup_cursor == 4 (OK)
1070 if (strcmp(cl_name.string, setup_myname) != 0)
1071 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1072 if (strcmp(hostname.string, setup_hostname) != 0)
1073 Cvar_Set("hostname", setup_hostname);
1074 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1075 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1076 m_entersound = true;
1077 M_Menu_MultiPlayer_f ();
1081 if (setup_cursor == 0)
1083 if (strlen(setup_hostname))
1084 setup_hostname[strlen(setup_hostname)-1] = 0;
1087 if (setup_cursor == 1)
1089 if (strlen(setup_myname))
1090 setup_myname[strlen(setup_myname)-1] = 0;
1095 if (k < 32 || k > 127)
1097 if (setup_cursor == 0)
1099 l = strlen(setup_hostname);
1102 setup_hostname[l+1] = 0;
1103 setup_hostname[l] = k;
1106 if (setup_cursor == 1)
1108 l = strlen(setup_myname);
1111 setup_myname[l+1] = 0;
1112 setup_myname[l] = k;
1121 if (setup_bottom > 15)
1123 if (setup_bottom < 0)
1127 //=============================================================================
1132 int m_net_saveHeight;
1134 char *net_helpMessage [] =
1136 /* .........1.........2.... */
1137 " Novell network LANs ",
1138 " or Windows 95 DOS-box. ",
1140 "(LAN=Local Area Network)",
1142 " Commonly used to play ",
1143 " over the Internet, but ",
1144 " also used on a Local ",
1148 void M_Menu_Net_f (void)
1150 key_dest = key_menu;
1152 m_entersound = true;
1155 if (m_net_cursor >= m_net_items)
1158 M_Net_Key (K_DOWNARROW);
1162 void M_Net_Draw (void)
1167 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1168 p = Draw_CachePic ("gfx/p_multi.lmp");
1169 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1174 M_DrawPic (72, f, "gfx/netmen3.lmp");
1176 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1180 M_DrawPic (72, f, "gfx/netmen4.lmp");
1182 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1184 if (m_net_items == 5) // JDC, could just be removed
1187 M_DrawPic (72, f, "gfx/netmen5.lmp");
1191 M_DrawTextBox (f, 134, 24, 4);
1193 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1194 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1196 f = (int)(realtime * 10)%6;
1197 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1201 void M_Net_Key (int k)
1207 M_Menu_MultiPlayer_f ();
1211 S_LocalSound ("misc/menu1.wav");
1212 if (++m_net_cursor >= m_net_items)
1217 S_LocalSound ("misc/menu1.wav");
1218 if (--m_net_cursor < 0)
1219 m_net_cursor = m_net_items - 1;
1223 m_entersound = true;
1225 switch (m_net_cursor)
1228 M_Menu_LanConfig_f ();
1232 M_Menu_LanConfig_f ();
1241 if (m_net_cursor == 0 && !ipxAvailable)
1243 if (m_net_cursor == 1 && !tcpipAvailable)
1247 //=============================================================================
1250 #define SLIDER_RANGE 10
1252 void M_DrawSlider (int x, int y, float range)
1260 M_DrawCharacter (x-8, y, 128);
1261 for (i=0 ; i<SLIDER_RANGE ; i++)
1262 M_DrawCharacter (x + i*8, y, 129);
1263 M_DrawCharacter (x+i*8, y, 130);
1264 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1267 void M_DrawCheckbox (int x, int y, int on)
1270 M_Print (x, y, "on");
1272 M_Print (x, y, "off");
1276 #define OPTIONS_ITEMS 28
1280 void M_Menu_Options_f (void)
1282 key_dest = key_menu;
1283 m_state = m_options;
1284 m_entersound = true;
1288 void M_Menu_Options_AdjustSliders (int dir)
1290 S_LocalSound ("misc/menu3.wav");
1292 switch (options_cursor)
1295 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1298 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1301 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1304 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1307 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1310 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1313 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1316 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.25, 5));
1319 Cvar_SetValueQuick (&v_contrast, bound(0.5, v_contrast.value + dir * 0.25, 5));
1322 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1324 case 15: // music volume
1326 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1328 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1331 case 16: // sfx volume
1332 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1335 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1338 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1340 case 19: // static crosshair
1341 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1343 case 20: // show framerate
1344 Cvar_SetValueQuick (&showfps, !showfps.integer);
1346 case 21: // always run
1347 if (cl_forwardspeed.value > 200)
1349 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1350 Cvar_SetValueQuick (&cl_backspeed, 200);
1354 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1355 Cvar_SetValueQuick (&cl_backspeed, 400);
1358 case 22: // lookspring
1359 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1361 case 23: // lookstrafe
1362 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1364 case 24: // mouse speed
1365 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1367 case 25: // mouse look
1368 Cvar_SetValueQuick (&freelook, !freelook.integer);
1370 case 26: // invert mouse
1371 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1373 case 27: // windowed mouse
1374 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1379 void M_Options_Draw (void)
1384 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1385 p = Draw_CachePic("gfx/p_option.lmp");
1386 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1389 M_Print(16, y, " Customize controls");y += 8;
1390 M_Print(16, y, " Go to console");y += 8;
1391 M_Print(16, y, " Reset to defaults");y += 8;
1392 M_ItemPrint(16, y, " Video Options", vid_menudrawfn != NULL);y += 8;
1393 M_Print(16, y, " Effects Options");y += 8;
1394 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8;
1395 M_Print(16, y, " Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8;
1396 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1397 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, (v_overbrightbits.value) / 4);y += 8;
1398 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1399 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1400 M_ItemPrint(16, y, "Hardware Gamma Control", hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1401 M_ItemPrint(16, y, " Gamma", v_hwgamma.integer);M_DrawSlider(220, y, (v_gamma.value - 1) / 4);y += 8;
1402 M_Print(16, y, " Contrast");M_DrawSlider(220, y, (v_contrast.value - 0.5) / (5 - 0.5));y += 8;
1403 M_Print(16, y, " Brightness");M_DrawSlider(220, y, v_brightness.value / 0.8);y += 8;
1404 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value);y += 8;
1405 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value);y += 8;
1406 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
1407 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, (crosshair_size.value - 1) / 4);y += 8;
1408 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1409 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1410 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1411 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1412 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1413 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, (sensitivity.value - 1)/50);y += 8;
1414 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1415 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1416 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1419 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1423 void M_Options_Key (int k)
1432 m_entersound = true;
1433 switch (options_cursor)
1440 Con_ToggleConsole_f ();
1443 Cbuf_AddText ("exec default.cfg\n");
1450 M_Menu_Options_Effects_f ();
1453 M_Menu_Options_AdjustSliders (1);
1459 S_LocalSound ("misc/menu1.wav");
1461 if (options_cursor < 0)
1462 options_cursor = OPTIONS_ITEMS-1;
1466 S_LocalSound ("misc/menu1.wav");
1468 if (options_cursor >= OPTIONS_ITEMS)
1473 M_Menu_Options_AdjustSliders (-1);
1477 M_Menu_Options_AdjustSliders (1);
1482 #define OPTIONS_EFFECTS_ITEMS 16
1484 int options_effects_cursor;
1486 void M_Menu_Options_Effects_f (void)
1488 key_dest = key_menu;
1489 m_state = m_options_effects;
1490 m_entersound = true;
1494 extern cvar_t r_detailtextures;
1495 extern cvar_t cl_particles;
1496 extern cvar_t cl_explosions;
1497 extern cvar_t cl_stainmaps;
1498 extern cvar_t r_explosionclip;
1499 extern cvar_t r_dlightmap;
1500 extern cvar_t r_modellights;
1501 extern cvar_t r_coronas;
1502 extern cvar_t gl_flashblend;
1503 extern cvar_t cl_particles_bulletimpacts;
1504 extern cvar_t cl_particles_smoke;
1505 extern cvar_t cl_particles_sparks;
1506 extern cvar_t cl_particles_bubbles;
1507 extern cvar_t cl_particles_blood;
1508 extern cvar_t cl_particles_blood_size;
1509 extern cvar_t cl_particles_blood_alpha;
1511 void M_Menu_Options_Effects_AdjustSliders (int dir)
1513 S_LocalSound ("misc/menu3.wav");
1515 switch (options_effects_cursor)
1518 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1521 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1524 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1527 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1530 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1533 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1536 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1539 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1542 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1545 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1548 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1551 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1554 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1557 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1560 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1563 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1568 void M_Options_Effects_Draw (void)
1573 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1574 p = Draw_CachePic("gfx/p_option.lmp");
1575 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1578 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value / 8);y += 8;
1579 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1580 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1581 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1582 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1583 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1584 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1585 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1586 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1587 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1588 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1589 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1590 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1591 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1592 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, (cl_particles_blood_size.value - 2) / 18);y += 8;
1593 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, (cl_particles_blood_alpha.value - 0.2) / 0.8);y += 8;
1596 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1600 void M_Options_Effects_Key (int k)
1605 M_Menu_Options_f ();
1609 M_Menu_Options_Effects_AdjustSliders (1);
1613 S_LocalSound ("misc/menu1.wav");
1614 options_effects_cursor--;
1615 if (options_effects_cursor < 0)
1616 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1620 S_LocalSound ("misc/menu1.wav");
1621 options_effects_cursor++;
1622 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1623 options_effects_cursor = 0;
1627 M_Menu_Options_Effects_AdjustSliders (-1);
1631 M_Menu_Options_Effects_AdjustSliders (1);
1636 //=============================================================================
1639 char *quakebindnames[][2] =
1641 {"+attack", "attack"},
1642 {"impulse 10", "next weapon"},
1643 {"impulse 12", "previous weapon"},
1644 {"+jump", "jump / swim up"},
1645 {"+forward", "walk forward"},
1646 {"+back", "backpedal"},
1647 {"+left", "turn left"},
1648 {"+right", "turn right"},
1650 {"+moveleft", "step left"},
1651 {"+moveright", "step right"},
1652 {"+strafe", "sidestep"},
1653 {"+lookup", "look up"},
1654 {"+lookdown", "look down"},
1655 {"centerview", "center view"},
1656 {"+mlook", "mouse look"},
1657 {"+klook", "keyboard look"},
1658 {"+moveup", "swim up"},
1659 {"+movedown", "swim down"}
1662 char *transfusionbindnames[][2] =
1664 {"+forward", "walk forward"},
1665 {"+back", "backpedal"},
1666 {"+moveleft", "step left"},
1667 {"+moveright", "step right"},
1668 {"+jump", "jump / swim up"},
1669 {"+movedown", "swim down"},
1670 {"+attack", "attack"},
1671 {"+button3", "altfire"},
1672 {"impulse 1", "Pitch Fork"},
1673 {"impulse 2", "Flare Gun"},
1674 {"impulse 3", "Shotgun"},
1675 {"impulse 4", "Machine Gun"},
1676 {"impulse 5", "Incinerator"},
1677 {"impulse 6", "Bombs"},
1678 {"impulse 7", "Aerosol Can"},
1679 {"impulse 8", "Tesla Cannon"},
1680 {"impulse 9", "Life Leech"},
1681 {"impulse 17", "Voodoo Doll"},
1682 {"impulse 11", "previous weapon"},
1683 {"impulse 10", "next weapon"},
1684 {"impulse 14", "previous item"},
1685 {"impulse 15", "next item"},
1686 {"impulse 13", "use item"},
1687 {"impulse 100", "add bot (red)"},
1688 {"impulse 101", "add bot (blue)"},
1689 {"impulse 102", "kick a bot"},
1690 {"impulse 50", "voting menu"},
1691 {"impulse 141", "identify player"},
1692 {"impulse 16", "next armor type"},
1693 {"impulse 20", "observer mode"}
1697 char *(*bindnames)[2];
1700 typedef struct binditem_s
1702 char *command, *description;
1703 struct binditem_s *next;
1707 typedef struct bindcategory_s
1711 struct bindcategory_s *next;
1715 bindcategory_t *bindcategories = NULL;
1717 void M_ClearBinds (void)
1719 for (c = bindcategories;c;c = cnext)
1722 for (b = c->binds;b;b = bnext)
1729 bindcategories = NULL;
1732 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1734 for (b = &c->binds;*b;*b = &(*b)->next);
1735 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1736 *b->command = (char *)((*b) + 1);
1737 *b->description = *b->command + strlen(command) + 1;
1738 strcpy(*b->command, command);
1739 strcpy(*b->description, description);
1742 void M_AddBind (char *category, char *command, char *description)
1744 for (c = &bindcategories;*c;c = &(*c)->next)
1746 if (!strcmp(category, (*c)->name))
1748 M_AddBindToCategory(*c, command, description);
1752 *c = Z_Alloc(sizeof(bindcategory_t));
1753 M_AddBindToCategory(*c, command, description);
1756 void M_DefaultBinds (void)
1759 M_AddBind("movement", "+jump", "jump / swim up");
1760 M_AddBind("movement", "+forward", "walk forward");
1761 M_AddBind("movement", "+back", "backpedal");
1762 M_AddBind("movement", "+left", "turn left");
1763 M_AddBind("movement", "+right", "turn right");
1764 M_AddBind("movement", "+speed", "run");
1765 M_AddBind("movement", "+moveleft", "step left");
1766 M_AddBind("movement", "+moveright", "step right");
1767 M_AddBind("movement", "+strafe", "sidestep");
1768 M_AddBind("movement", "+lookup", "look up");
1769 M_AddBind("movement", "+lookdown", "look down");
1770 M_AddBind("movement", "centerview", "center view");
1771 M_AddBind("movement", "+mlook", "mouse look");
1772 M_AddBind("movement", "+klook", "keyboard look");
1773 M_AddBind("movement", "+moveup", "swim up");
1774 M_AddBind("movement", "+movedown", "swim down");
1775 M_AddBind("weapons", "+attack", "attack");
1776 M_AddBind("weapons", "impulse 10", "next weapon");
1777 M_AddBind("weapons", "impulse 12", "previous weapon");
1778 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1779 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1780 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1781 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1782 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1783 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1784 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1785 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1793 void M_Menu_Keys_f (void)
1795 key_dest = key_menu;
1797 m_entersound = true;
1802 void M_FindKeysForCommand (char *command, int *keys)
1808 for (j = 0;j < NUMKEYS;j++)
1813 for (j=0 ; j<256 ; j++)
1818 if (!strcmp (b, command) )
1821 if (count == NUMKEYS)
1827 void M_UnbindCommand (char *command)
1832 for (j=0 ; j<256 ; j++)
1837 if (!strcmp (b, command))
1838 Key_SetBinding (j, "");
1843 void M_Keys_Draw (void)
1849 char keystring[1024];
1851 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1852 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1855 M_Print (12, 32, "Press a key or button for this action");
1857 M_Print (18, 32, "Enter to change, backspace to clear");
1859 // search for known bindings
1860 for (i=0 ; i<numcommands ; i++)
1864 M_Print (16, y, bindnames[i][1]);
1866 M_FindKeysForCommand (bindnames[i][0], keys);
1868 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1870 strcpy(keystring, "???");
1874 for (j = 0;j < NUMKEYS;j++)
1879 strcat(keystring, " or ");
1880 strcat(keystring, Key_KeynumToString (keys[j]));
1884 M_Print (150, y, keystring);
1888 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
1890 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1894 void M_Keys_Key (int k)
1901 S_LocalSound ("misc/menu1.wav");
1906 else //if (k != '`')
1908 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1909 Cbuf_InsertText (cmd);
1919 M_Menu_Options_f ();
1924 S_LocalSound ("misc/menu1.wav");
1926 if (keys_cursor < 0)
1927 keys_cursor = numcommands-1;
1932 S_LocalSound ("misc/menu1.wav");
1934 if (keys_cursor >= numcommands)
1938 case K_ENTER: // go into bind mode
1939 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1940 S_LocalSound ("misc/menu2.wav");
1941 if (keys[NUMKEYS - 1] != -1)
1942 M_UnbindCommand (bindnames[keys_cursor][0]);
1946 case K_BACKSPACE: // delete bindings
1947 case K_DEL: // delete bindings
1948 S_LocalSound ("misc/menu2.wav");
1949 M_UnbindCommand (bindnames[keys_cursor][0]);
1954 //=============================================================================
1957 void M_Menu_Video_f (void)
1959 key_dest = key_menu;
1961 m_entersound = true;
1965 void M_Video_Draw (void)
1967 (*vid_menudrawfn) ();
1971 void M_Video_Key (int key)
1973 (*vid_menukeyfn) (key);
1976 //=============================================================================
1980 #define NUM_HELP_PAGES 6
1983 void M_Menu_Help_f (void)
1985 key_dest = key_menu;
1987 m_entersound = true;
1993 void M_Help_Draw (void)
1995 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
1999 void M_Help_Key (int key)
2009 m_entersound = true;
2010 if (++help_page >= NUM_HELP_PAGES)
2016 m_entersound = true;
2017 if (--help_page < 0)
2018 help_page = NUM_HELP_PAGES-1;
2024 //=============================================================================
2028 int m_quit_prevstate;
2029 qboolean wasInMenus;
2031 char *quitMessage [] =
2033 /* .........1.........2.... */
2035 " Are you gonna quit ",
2036 " this game just like ",
2037 " everything else? ",
2040 " Milord, methinks that ",
2041 " thou art a lowly ",
2042 " quitter. Is this true? ",
2045 " Do I need to bust your ",
2046 " face open for trying ",
2050 " Man, I oughta smack you",
2051 " for trying to quit! ",
2055 " Press Y to quit like a ",
2056 " big loser in life. ",
2057 " Press N to stay proud ",
2058 " and successful! ",
2060 " If you press Y to ",
2061 " quit, I will summon ",
2062 " Satan all over your ",
2065 " Um, Asmodeus dislikes ",
2066 " his children trying to ",
2067 " quit. Press Y to return",
2068 " to your Tinkertoys. ",
2070 " If you quit now, I'll ",
2071 " throw a blanket-party ",
2072 " for you next time! ",
2076 /* .........1.........2.... */
2078 " Tired of fragging ",
2083 " Quit now and forfeit ",
2084 " your bodycount? ",
2088 " Are you sure you ",
2093 " Off to do something ",
2098 void M_Menu_Quit_f (void)
2100 if (m_state == m_quit)
2102 wasInMenus = (key_dest == key_menu);
2103 key_dest = key_menu;
2104 m_quit_prevstate = m_state;
2106 m_entersound = true;
2107 msgNumber = rand()&3; //&7;
2111 void M_Quit_Key (int key)
2120 m_state = m_quit_prevstate;
2121 m_entersound = true;
2125 key_dest = key_game;
2142 void M_Quit_Draw (void)
2144 M_DrawTextBox (56, 76, 24, 4);
2145 M_Print (64, 84, quitMessage[msgNumber*4+0]);
2146 M_Print (64, 92, quitMessage[msgNumber*4+1]);
2147 M_Print (64, 100, quitMessage[msgNumber*4+2]);
2148 M_Print (64, 108, quitMessage[msgNumber*4+3]);
2151 //=============================================================================
2152 /* LAN CONFIG MENU */
2154 int lanConfig_cursor = -1;
2155 int lanConfig_cursor_table [] = {72, 92, 124};
2156 #define NUM_LANCONFIG_CMDS 3
2159 char lanConfig_portname[6];
2160 char lanConfig_joinname[22];
2162 void M_Menu_LanConfig_f (void)
2164 key_dest = key_menu;
2165 m_state = m_lanconfig;
2166 m_entersound = true;
2167 if (lanConfig_cursor == -1)
2169 if (JoiningGame && TCPIPConfig)
2170 lanConfig_cursor = 2;
2172 lanConfig_cursor = 1;
2174 if (StartingGame && lanConfig_cursor == 2)
2175 lanConfig_cursor = 1;
2176 lanConfig_port = DEFAULTnet_hostport;
2177 sprintf(lanConfig_portname, "%u", lanConfig_port);
2179 m_return_onerror = false;
2180 m_return_reason[0] = 0;
2184 void M_LanConfig_Draw (void)
2191 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2192 p = Draw_CachePic ("gfx/p_multi.lmp");
2193 basex = (320-p->width)/2;
2194 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2197 startJoin = "New Game";
2199 startJoin = "Join Game";
2203 protocol = "TCP/IP";
2204 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2207 M_Print (basex, 52, "Address:");
2209 M_Print (basex+9*8, 52, my_ipx_address);
2211 M_Print (basex+9*8, 52, my_tcpip_address);
2213 M_Print (basex, lanConfig_cursor_table[0], "Port");
2214 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2215 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2219 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2220 M_Print (basex, 108, "Join game at:");
2221 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2222 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2226 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2227 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2230 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2232 if (lanConfig_cursor == 0)
2233 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2235 if (lanConfig_cursor == 2)
2236 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2238 if (*m_return_reason)
2239 M_PrintWhite (basex, 148, m_return_reason);
2243 void M_LanConfig_Key (int key)
2254 S_LocalSound ("misc/menu1.wav");
2256 if (lanConfig_cursor < 0)
2257 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2261 S_LocalSound ("misc/menu1.wav");
2263 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2264 lanConfig_cursor = 0;
2268 if (lanConfig_cursor == 0)
2271 m_entersound = true;
2273 M_ConfigureNetSubsystem ();
2275 if (lanConfig_cursor == 1)
2279 M_Menu_GameOptions_f ();
2286 if (lanConfig_cursor == 2)
2288 m_return_state = m_state;
2289 m_return_onerror = true;
2290 key_dest = key_game;
2292 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2299 if (lanConfig_cursor == 0)
2301 if (strlen(lanConfig_portname))
2302 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2305 if (lanConfig_cursor == 2)
2307 if (strlen(lanConfig_joinname))
2308 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2313 if (key < 32 || key > 127)
2316 if (lanConfig_cursor == 2)
2318 l = strlen(lanConfig_joinname);
2321 lanConfig_joinname[l+1] = 0;
2322 lanConfig_joinname[l] = key;
2326 if (key < '0' || key > '9')
2328 if (lanConfig_cursor == 0)
2330 l = strlen(lanConfig_portname);
2333 lanConfig_portname[l+1] = 0;
2334 lanConfig_portname[l] = key;
2339 if (StartingGame && lanConfig_cursor == 2)
2341 if (key == K_UPARROW)
2342 lanConfig_cursor = 1;
2344 lanConfig_cursor = 0;
2347 l = atoi(lanConfig_portname);
2352 sprintf(lanConfig_portname, "%u", lanConfig_port);
2355 //=============================================================================
2356 /* GAME OPTIONS MENU */
2375 episode_t *episodes;
2380 level_t quakelevels[] =
2382 {"start", "Entrance"}, // 0
2384 {"e1m1", "Slipgate Complex"}, // 1
2385 {"e1m2", "Castle of the Damned"},
2386 {"e1m3", "The Necropolis"},
2387 {"e1m4", "The Grisly Grotto"},
2388 {"e1m5", "Gloom Keep"},
2389 {"e1m6", "The Door To Chthon"},
2390 {"e1m7", "The House of Chthon"},
2391 {"e1m8", "Ziggurat Vertigo"},
2393 {"e2m1", "The Installation"}, // 9
2394 {"e2m2", "Ogre Citadel"},
2395 {"e2m3", "Crypt of Decay"},
2396 {"e2m4", "The Ebon Fortress"},
2397 {"e2m5", "The Wizard's Manse"},
2398 {"e2m6", "The Dismal Oubliette"},
2399 {"e2m7", "Underearth"},
2401 {"e3m1", "Termination Central"}, // 16
2402 {"e3m2", "The Vaults of Zin"},
2403 {"e3m3", "The Tomb of Terror"},
2404 {"e3m4", "Satan's Dark Delight"},
2405 {"e3m5", "Wind Tunnels"},
2406 {"e3m6", "Chambers of Torment"},
2407 {"e3m7", "The Haunted Halls"},
2409 {"e4m1", "The Sewage System"}, // 23
2410 {"e4m2", "The Tower of Despair"},
2411 {"e4m3", "The Elder God Shrine"},
2412 {"e4m4", "The Palace of Hate"},
2413 {"e4m5", "Hell's Atrium"},
2414 {"e4m6", "The Pain Maze"},
2415 {"e4m7", "Azure Agony"},
2416 {"e4m8", "The Nameless City"},
2418 {"end", "Shub-Niggurath's Pit"}, // 31
2420 {"dm1", "Place of Two Deaths"}, // 32
2421 {"dm2", "Claustrophobopolis"},
2422 {"dm3", "The Abandoned Base"},
2423 {"dm4", "The Bad Place"},
2424 {"dm5", "The Cistern"},
2425 {"dm6", "The Dark Zone"}
2428 episode_t quakeepisodes[] =
2430 {"Welcome to Quake", 0, 1},
2431 {"Doomed Dimension", 1, 8},
2432 {"Realm of Black Magic", 9, 7},
2433 {"Netherworld", 16, 7},
2434 {"The Elder World", 23, 8},
2435 {"Final Level", 31, 1},
2436 {"Deathmatch Arena", 32, 6}
2439 //MED 01/06/97 added hipnotic levels
2440 level_t hipnoticlevels[] =
2442 {"start", "Command HQ"}, // 0
2444 {"hip1m1", "The Pumping Station"}, // 1
2445 {"hip1m2", "Storage Facility"},
2446 {"hip1m3", "The Lost Mine"},
2447 {"hip1m4", "Research Facility"},
2448 {"hip1m5", "Military Complex"},
2450 {"hip2m1", "Ancient Realms"}, // 6
2451 {"hip2m2", "The Black Cathedral"},
2452 {"hip2m3", "The Catacombs"},
2453 {"hip2m4", "The Crypt"},
2454 {"hip2m5", "Mortum's Keep"},
2455 {"hip2m6", "The Gremlin's Domain"},
2457 {"hip3m1", "Tur Torment"}, // 12
2458 {"hip3m2", "Pandemonium"},
2459 {"hip3m3", "Limbo"},
2460 {"hip3m4", "The Gauntlet"},
2462 {"hipend", "Armagon's Lair"}, // 16
2464 {"hipdm1", "The Edge of Oblivion"} // 17
2467 //MED 01/06/97 added hipnotic episodes
2468 episode_t hipnoticepisodes[] =
2470 {"Scourge of Armagon", 0, 1},
2471 {"Fortress of the Dead", 1, 5},
2472 {"Dominion of Darkness", 6, 6},
2473 {"The Rift", 12, 4},
2474 {"Final Level", 16, 1},
2475 {"Deathmatch Arena", 17, 1}
2478 //PGM 01/07/97 added rogue levels
2479 //PGM 03/02/97 added dmatch level
2480 level_t roguelevels[] =
2482 {"start", "Split Decision"},
2483 {"r1m1", "Deviant's Domain"},
2484 {"r1m2", "Dread Portal"},
2485 {"r1m3", "Judgement Call"},
2486 {"r1m4", "Cave of Death"},
2487 {"r1m5", "Towers of Wrath"},
2488 {"r1m6", "Temple of Pain"},
2489 {"r1m7", "Tomb of the Overlord"},
2490 {"r2m1", "Tempus Fugit"},
2491 {"r2m2", "Elemental Fury I"},
2492 {"r2m3", "Elemental Fury II"},
2493 {"r2m4", "Curse of Osiris"},
2494 {"r2m5", "Wizard's Keep"},
2495 {"r2m6", "Blood Sacrifice"},
2496 {"r2m7", "Last Bastion"},
2497 {"r2m8", "Source of Evil"},
2498 {"ctf1", "Division of Change"}
2501 //PGM 01/07/97 added rogue episodes
2502 //PGM 03/02/97 added dmatch episode
2503 episode_t rogueepisodes[] =
2505 {"Introduction", 0, 1},
2506 {"Hell's Fortress", 1, 7},
2507 {"Corridors of Time", 8, 8},
2508 {"Deathmatch Arena", 16, 1}
2511 level_t nehahralevels[] =
2513 {"nehstart", "Welcome to Nehahra"},
2514 {"neh1m1", "Forge City1: Slipgates"},
2515 {"neh1m2", "Forge City2: Boiler"},
2516 {"neh1m3", "Forge City3: Escape"},
2517 {"neh1m4", "Grind Core"},
2518 {"neh1m5", "Industrial Silence"},
2519 {"neh1m6", "Locked-Up Anger"},
2520 {"neh1m7", "Wanderer of the Wastes"},
2521 {"neh1m8", "Artemis System Net"},
2522 {"neh1m9", "To the Death"},
2523 {"neh2m1", "The Gates of Ghoro"},
2524 {"neh2m2", "Sacred Trinity"},
2525 {"neh2m3", "Realm of the Ancients"},
2526 {"neh2m4", "Temple of the Ancients"},
2527 {"neh2m5", "Dreams Made Flesh"},
2528 {"neh2m6", "Your Last Cup of Sorrow"},
2529 {"nehsec", "Ogre's Bane"},
2530 {"nehahra", "Nehahra's Den"},
2531 {"nehend", "Quintessence"}
2534 episode_t nehahraepisodes[] =
2536 {"Welcome to Nehahra", 0, 1},
2537 {"The Fall of Forge", 1, 9},
2538 {"The Outlands", 10, 7},
2539 {"Dimension of the Lost", 17, 2}
2542 // Map list for Transfusion
2543 level_t transfusionlevels[] =
2545 {"bb1", "The Stronghold"},
2546 {"bb2", "Winter Wonderland"},
2548 {"bb4", "The Tower"},
2550 {"bb6", "Twin Fortress"},
2552 {"bb8", "Fun With Heads"},
2553 {"e1m1", "Cradle to Grave"},
2554 {"e1m7", "Altar of Stone"},
2556 {"dm1", "Monolith Building 11"},
2559 {"e6m8", "Beauty and the Beast"},
2561 {"cpbb01", "Crypt of Despair"},
2562 {"cpbb03", "Unholy Cathedral"},
2564 {"b2a15", "Area 15 (B2)"},
2565 {"barena", "Blood Arena"},
2566 {"bkeep", "Blood Keep"},
2567 {"bstar", "Brown Star"},
2568 {"crypt", "The Crypt"},
2570 {"bb3_2k1", "Bodies Infusion"},
2571 {"dranzbb6", "Black Coffee"},
2572 {"qbb1", "The Confluence"},
2573 {"qbb2", "KathartiK"},
2574 {"qbb3", "Caleb's Woodland Retreat"},
2575 {"qe1m7", "The House of Chthon"},
2576 {"simple", "Dead Simple"}
2579 episode_t transfusionepisodes[] =
2582 {"Plasma Pack", 10, 4},
2583 {"Cryptic Passage", 14, 2},
2588 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2589 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2590 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2591 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2592 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2593 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 5};
2598 gamelevels_t *notregistered;
2599 gamelevels_t *registered;
2603 gameinfo_t gamelist[] =
2605 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2606 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2607 {GAME_ROGUE, &roguegame, &roguegame},
2608 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2609 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2610 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2613 gamelevels_t *lookupgameinfo(void)
2616 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2617 if (registered.integer)
2618 return gamelist[i].registered;
2620 return gamelist[i].notregistered;
2626 qboolean m_serverInfoMessage = false;
2627 double m_serverInfoMessageTime;
2629 void M_Menu_GameOptions_f (void)
2631 key_dest = key_menu;
2632 m_state = m_gameoptions;
2633 m_entersound = true;
2634 if (maxplayers == 0)
2635 maxplayers = svs.maxclients;
2637 maxplayers = svs.maxclientslimit;
2641 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2642 #define NUM_GAMEOPTIONS 9
2643 int gameoptions_cursor;
2645 void M_GameOptions_Draw (void)
2651 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2652 p = Draw_CachePic ("gfx/p_multi.lmp");
2653 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2655 M_DrawTextBox (152, 32, 10, 1);
2656 M_Print (160, 40, "begin game");
2658 M_Print (0, 56, " Max players");
2659 M_Print (160, 56, va("%i", maxplayers) );
2661 M_Print (0, 64, " Game Type");
2662 if (gamemode == GAME_TRANSFUSION)
2664 if (!deathmatch.integer)
2665 Cvar_SetValue("deathmatch", 1);
2666 if (deathmatch.integer == 2)
2667 M_Print (160, 64, "Capture the Flag");
2669 M_Print (160, 64, "Blood Bath");
2673 if (!coop.integer && !deathmatch.integer)
2674 Cvar_SetValue("deathmatch", 1);
2676 M_Print (160, 64, "Cooperative");
2678 M_Print (160, 64, "Deathmatch");
2681 M_Print (0, 72, " Teamplay");
2682 if (gamemode == GAME_ROGUE)
2686 switch((int)teamplay.integer)
2688 case 1: msg = "No Friendly Fire"; break;
2689 case 2: msg = "Friendly Fire"; break;
2690 case 3: msg = "Tag"; break;
2691 case 4: msg = "Capture the Flag"; break;
2692 case 5: msg = "One Flag CTF"; break;
2693 case 6: msg = "Three Team CTF"; break;
2694 default: msg = "Off"; break;
2696 M_Print (160, 72, msg);
2698 else if (gamemode == GAME_TRANSFUSION)
2702 switch (teamplay.integer)
2704 case 0: msg = "Off"; break;
2705 case 2: msg = "Friendly Fire"; break;
2706 default: msg = "No Friendly Fire"; break;
2708 M_Print (160, 72, msg);
2714 switch((int)teamplay.integer)
2716 case 1: msg = "No Friendly Fire"; break;
2717 case 2: msg = "Friendly Fire"; break;
2718 default: msg = "Off"; break;
2720 M_Print (160, 72, msg);
2723 M_Print (0, 80, " Skill");
2724 if (skill.integer == 0)
2725 M_Print (160, 80, "Easy difficulty");
2726 else if (skill.integer == 1)
2727 M_Print (160, 80, "Normal difficulty");
2728 else if (skill.integer == 2)
2729 M_Print (160, 80, "Hard difficulty");
2731 M_Print (160, 80, "Nightmare difficulty");
2733 M_Print (0, 88, " Frag Limit");
2734 if (fraglimit.integer == 0)
2735 M_Print (160, 88, "none");
2737 M_Print (160, 88, va("%i frags", fraglimit.integer));
2739 M_Print (0, 96, " Time Limit");
2740 if (timelimit.integer == 0)
2741 M_Print (160, 96, "none");
2743 M_Print (160, 96, va("%i minutes", timelimit.integer));
2745 g = lookupgameinfo();
2747 M_Print (0, 112, " Episode");
2748 M_Print (160, 112, g->episodes[startepisode].description);
2750 M_Print (0, 120, " Level");
2751 M_Print (160, 120, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
2752 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
2755 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2757 if (m_serverInfoMessage)
2759 if ((realtime - m_serverInfoMessageTime) < 5.0)
2762 M_DrawTextBox (x, 138, 24, 4);
2764 M_Print (x, 146, " More than 64 players?? ");
2765 M_Print (x, 154, " First, question your ");
2766 M_Print (x, 162, " sanity, then email ");
2767 M_Print (x, 170, " havoc@gamevisions.com ");
2771 m_serverInfoMessage = false;
2777 void M_NetStart_Change (int dir)
2782 switch (gameoptions_cursor)
2786 if (maxplayers > svs.maxclientslimit)
2788 maxplayers = svs.maxclientslimit;
2789 m_serverInfoMessage = true;
2790 m_serverInfoMessageTime = realtime;
2797 if (gamemode == GAME_TRANSFUSION)
2799 if (deathmatch.integer == 2) // changing from CTF to BloodBath
2800 Cvar_SetValueQuick (&deathmatch, 0);
2801 else // changing from BloodBath to CTF
2802 Cvar_SetValueQuick (&deathmatch, 2);
2806 if (deathmatch.integer) // changing from deathmatch to coop
2808 Cvar_SetValueQuick (&coop, 1);
2809 Cvar_SetValueQuick (&deathmatch, 0);
2811 else // changing from coop to deathmatch
2813 Cvar_SetValueQuick (&coop, 0);
2814 Cvar_SetValueQuick (&deathmatch, 1);
2820 if (gamemode == GAME_ROGUE)
2825 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
2826 if (teamplay.integer > count)
2827 Cvar_SetValueQuick (&teamplay, 0);
2828 else if (teamplay.integer < 0)
2829 Cvar_SetValueQuick (&teamplay, count);
2833 Cvar_SetValueQuick (&skill, skill.integer + dir);
2834 if (skill.integer > 3)
2835 Cvar_SetValueQuick (&skill, 0);
2836 if (skill.integer < 0)
2837 Cvar_SetValueQuick (&skill, 3);
2841 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
2842 if (fraglimit.integer > 100)
2843 Cvar_SetValueQuick (&fraglimit, 0);
2844 if (fraglimit.integer < 0)
2845 Cvar_SetValueQuick (&fraglimit, 100);
2849 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
2850 if (timelimit.value > 60)
2851 Cvar_SetValueQuick (&timelimit, 0);
2852 if (timelimit.value < 0)
2853 Cvar_SetValueQuick (&timelimit, 60);
2857 startepisode += dir;
2858 g = lookupgameinfo();
2860 if (startepisode < 0)
2861 startepisode = g->numepisodes - 1;
2863 if (startepisode >= g->numepisodes)
2871 g = lookupgameinfo();
2874 startlevel = g->episodes[startepisode].levels - 1;
2876 if (startlevel >= g->episodes[startepisode].levels)
2882 void M_GameOptions_Key (int key)
2893 S_LocalSound ("misc/menu1.wav");
2894 gameoptions_cursor--;
2895 if (gameoptions_cursor < 0)
2896 gameoptions_cursor = NUM_GAMEOPTIONS-1;
2900 S_LocalSound ("misc/menu1.wav");
2901 gameoptions_cursor++;
2902 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
2903 gameoptions_cursor = 0;
2907 if (gameoptions_cursor == 0)
2909 S_LocalSound ("misc/menu3.wav");
2910 M_NetStart_Change (-1);
2914 if (gameoptions_cursor == 0)
2916 S_LocalSound ("misc/menu3.wav");
2917 M_NetStart_Change (1);
2921 S_LocalSound ("misc/menu2.wav");
2922 if (gameoptions_cursor == 0)
2925 Cbuf_AddText ("disconnect\n");
2926 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
2927 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
2929 g = lookupgameinfo();
2930 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
2934 M_NetStart_Change (1);
2939 //=============================================================================
2942 qboolean searchComplete = false;
2943 double searchCompleteTime;
2945 void M_Menu_Search_f (void)
2947 key_dest = key_menu;
2949 m_entersound = false;
2952 searchComplete = false;
2958 void M_Search_Draw (void)
2963 p = Draw_CachePic ("gfx/p_multi.lmp");
2964 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2965 x = (320/2) - ((12*8)/2) + 4;
2966 M_DrawTextBox (x-8, 32, 12, 1);
2967 M_Print (x, 40, "Searching...");
2975 if (! searchComplete)
2977 searchComplete = true;
2978 searchCompleteTime = realtime;
2983 M_Menu_ServerList_f ();
2987 M_PrintWhite ((320/2) - ((22*8)/2), 64, "No Quake servers found");
2988 if ((realtime - searchCompleteTime) < 3.0)
2991 M_Menu_LanConfig_f ();
2995 void M_Search_Key (int key)
2999 //=============================================================================
3003 qboolean slist_sorted;
3005 void M_Menu_ServerList_f (void)
3007 key_dest = key_menu;
3009 m_entersound = true;
3011 m_return_onerror = false;
3012 m_return_reason[0] = 0;
3013 slist_sorted = false;
3017 void M_ServerList_Draw (void)
3025 if (hostCacheCount > 1)
3029 for (i = 0; i < hostCacheCount; i++)
3030 for (j = i+1; j < hostCacheCount; j++)
3031 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3033 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3034 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3035 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3038 slist_sorted = true;
3041 p = Draw_CachePic ("gfx/p_multi.lmp");
3042 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3043 for (n = 0; n < hostCacheCount; n++)
3045 if (hostcache[n].maxusers)
3046 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3048 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3049 M_Print (16, 32 + 8*n, string);
3051 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3053 if (*m_return_reason)
3054 M_PrintWhite (16, 148, m_return_reason);
3058 void M_ServerList_Key (int k)
3063 M_Menu_LanConfig_f ();
3072 S_LocalSound ("misc/menu1.wav");
3074 if (slist_cursor < 0)
3075 slist_cursor = hostCacheCount - 1;
3080 S_LocalSound ("misc/menu1.wav");
3082 if (slist_cursor >= hostCacheCount)
3087 S_LocalSound ("misc/menu2.wav");
3088 m_return_state = m_state;
3089 m_return_onerror = true;
3090 slist_sorted = false;
3091 key_dest = key_game;
3093 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3102 //=============================================================================
3103 /* Menu Subsystem */
3108 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3110 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3111 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3112 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3113 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3114 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3115 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3116 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3117 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3118 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3119 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3120 Cmd_AddCommand ("help", M_Menu_Help_f);
3121 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3123 if (gamemode == GAME_TRANSFUSION)
3125 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3126 bindnames = transfusionbindnames;
3130 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3131 bindnames = quakebindnames;
3134 if (gamemode == GAME_NEHAHRA)
3136 if (COM_FileExists("maps/neh1m4.bsp"))
3138 if (COM_FileExists("hearing.dem"))
3140 Con_Printf("Nehahra movie and game detected.\n");
3141 NehGameType = TYPE_BOTH;
3145 Con_Printf("Nehahra game detected.\n");
3146 NehGameType = TYPE_GAME;
3151 if (COM_FileExists("hearing.dem"))
3153 Con_Printf("Nehahra movie detected.\n");
3154 NehGameType = TYPE_DEMO;
3158 Con_Printf("Nehahra not found.\n");
3159 NehGameType = TYPE_GAME; // could just complain, but...
3167 if (m_state == m_none || key_dest != key_menu)
3185 case m_singleplayer:
3186 M_SinglePlayer_Draw ();
3198 M_MultiPlayer_Draw ();
3213 case m_options_effects:
3214 M_Options_Effects_Draw ();
3234 M_LanConfig_Draw ();
3238 M_GameOptions_Draw ();
3246 M_ServerList_Draw ();
3252 S_LocalSound ("misc/menu2.wav");
3253 m_entersound = false;
3260 void M_Keydown (int key)
3275 case m_singleplayer:
3276 M_SinglePlayer_Key (key);
3288 M_MultiPlayer_Key (key);
3300 M_Options_Key (key);
3303 case m_options_effects:
3304 M_Options_Effects_Key (key);
3324 M_LanConfig_Key (key);
3328 M_GameOptions_Key (key);
3336 M_ServerList_Key (key);
3342 void M_ConfigureNetSubsystem(void)
3344 // enable/disable net systems to match desired config
3346 Cbuf_AddText ("stopdemo\n");
3348 if (IPXConfig || TCPIPConfig)
3349 net_hostport = lanConfig_port;