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_none, m_main, m_demo, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist} 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_Keys_f (void);
46 void M_Menu_Video_f (void);
47 void M_Menu_Help_f (void);
48 void M_Menu_Quit_f (void);
49 void M_Menu_SerialConfig_f (void);
50 void M_Menu_ModemConfig_f (void);
51 void M_Menu_LanConfig_f (void);
52 void M_Menu_GameOptions_f (void);
53 void M_Menu_Search_f (void);
54 void M_Menu_ServerList_f (void);
56 void M_Main_Draw (void);
57 void M_SinglePlayer_Draw (void);
58 void M_Load_Draw (void);
59 void M_Save_Draw (void);
60 void M_MultiPlayer_Draw (void);
61 void M_Setup_Draw (void);
62 void M_Net_Draw (void);
63 void M_Options_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_SerialConfig_Draw (void);
69 void M_ModemConfig_Draw (void);
70 void M_LanConfig_Draw (void);
71 void M_GameOptions_Draw (void);
72 void M_Search_Draw (void);
73 void M_ServerList_Draw (void);
75 void M_Main_Key (int key);
76 void M_SinglePlayer_Key (int key);
77 void M_Load_Key (int key);
78 void M_Save_Key (int key);
79 void M_MultiPlayer_Key (int key);
80 void M_Setup_Key (int key);
81 void M_Net_Key (int key);
82 void M_Options_Key (int key);
83 void M_Keys_Key (int key);
84 void M_Video_Key (int key);
85 void M_Help_Key (int key);
86 void M_Quit_Key (int key);
87 void M_SerialConfig_Key (int key);
88 void M_ModemConfig_Key (int key);
89 void M_LanConfig_Key (int key);
90 void M_GameOptions_Key (int key);
91 void M_Search_Key (int key);
92 void M_ServerList_Key (int key);
94 qboolean m_entersound; // play after drawing a frame, so caching
95 // won't disrupt the sound
96 qboolean m_recursiveDraw;
99 qboolean m_return_onerror;
100 char m_return_reason [32];
102 #define StartingGame (m_multiplayer_cursor == 1)
103 #define JoiningGame (m_multiplayer_cursor == 0)
104 #define SerialConfig (m_net_cursor == 0)
105 #define DirectConfig (m_net_cursor == 1)
106 #define IPXConfig (m_net_cursor == 2)
107 #define TCPIPConfig (m_net_cursor == 3)
109 void M_ConfigureNetSubsystem(void);
119 demonames_t Demos[35];
125 Draws one solid graphics character
128 void M_DrawCharacter (int cx, int line, int num)
130 Draw_Character ( cx + ((vid.width - 320)>>1), line, num);
133 void M_Print (int cx, int cy, char *str)
137 M_DrawCharacter (cx, cy, (*str)+128);
143 void M_PrintWhite (int cx, int cy, char *str)
147 M_DrawCharacter (cx, cy, *str);
153 void M_DrawTransPic (int x, int y, qpic_t *pic)
155 Draw_TransPic (x + ((vid.width - 320)>>1), y, pic);
158 void M_DrawPic (int x, int y, qpic_t *pic)
160 Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
163 byte identityTable[256];
164 byte translationTable[256];
166 void M_BuildTranslationTable(int top, int bottom)
171 for (j = 0; j < 256; j++)
172 identityTable[j] = j;
173 dest = translationTable;
174 source = identityTable;
175 memcpy (dest, source, 256);
177 // LordHavoc: corrected skin color ranges
178 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
179 memcpy (dest + TOP_RANGE, source + top, 16);
181 for (j=0 ; j<16 ; j++)
182 dest[TOP_RANGE+j] = source[top+15-j];
184 // LordHavoc: corrected skin color ranges
185 if (bottom < 128 || (bottom >= 224 && bottom < 240))
186 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
188 for (j=0 ; j<16 ; j++)
189 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
193 void M_DrawTransPicTranslate (int x, int y, qpic_t *pic)
195 Draw_TransPicTranslate (x + ((vid.width - 320)>>1), y, pic, translationTable);
199 void M_DrawTextBox (int x, int y, int width, int lines)
208 p = Draw_CachePic ("gfx/box_tl.lmp");
209 M_DrawTransPic (cx, cy, p);
210 p = Draw_CachePic ("gfx/box_ml.lmp");
211 for (n = 0; n < lines; n++)
214 M_DrawTransPic (cx, cy, p);
216 p = Draw_CachePic ("gfx/box_bl.lmp");
217 M_DrawTransPic (cx, cy+8, p);
224 p = Draw_CachePic ("gfx/box_tm.lmp");
225 M_DrawTransPic (cx, cy, p);
226 p = Draw_CachePic ("gfx/box_mm.lmp");
227 for (n = 0; n < lines; n++)
231 p = Draw_CachePic ("gfx/box_mm2.lmp");
232 M_DrawTransPic (cx, cy, p);
234 p = Draw_CachePic ("gfx/box_bm.lmp");
235 M_DrawTransPic (cx, cy+8, p);
242 p = Draw_CachePic ("gfx/box_tr.lmp");
243 M_DrawTransPic (cx, cy, p);
244 p = Draw_CachePic ("gfx/box_mr.lmp");
245 for (n = 0; n < lines; n++)
248 M_DrawTransPic (cx, cy, p);
250 p = Draw_CachePic ("gfx/box_br.lmp");
251 M_DrawTransPic (cx, cy+8, p);
254 //=============================================================================
263 void M_ToggleMenu_f (void)
267 if (key_dest == key_menu)
269 if (m_state != m_main)
278 if (key_dest == key_console)
280 Con_ToggleConsole_f ();
289 void M_Demo_Draw (void)
293 for (i=0; i < NumberOfDemos; i++)
294 M_Print (16, 16 + 8*i, Demos[i].desc);
297 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
301 void M_Menu_Demos_f (void)
310 strcpy(Demos[0].name, "intro"); strcpy(Demos[0].desc, "Prologue");
311 strcpy(Demos[1].name, "genf"); strcpy(Demos[1].desc, "The Beginning");
312 strcpy(Demos[2].name, "genlab"); strcpy(Demos[2].desc, "A Doomed Project");
313 strcpy(Demos[3].name, "nehcre"); strcpy(Demos[3].desc, "The New Recruits");
314 strcpy(Demos[4].name, "maxneh"); strcpy(Demos[4].desc, "Breakthrough");
315 strcpy(Demos[5].name, "maxchar"); strcpy(Demos[5].desc, "Renewal and Duty");
316 strcpy(Demos[6].name, "crisis"); strcpy(Demos[6].desc, "Worlds Collide");
317 strcpy(Demos[7].name, "postcris"); strcpy(Demos[7].desc, "Darkening Skies");
318 strcpy(Demos[8].name, "hearing"); strcpy(Demos[8].desc, "The Hearing");
319 strcpy(Demos[9].name, "getjack"); strcpy(Demos[9].desc, "On a Mexican Radio");
320 strcpy(Demos[10].name, "prelude"); strcpy(Demos[10].desc, "Honor and Justice");
321 strcpy(Demos[11].name, "abase"); strcpy(Demos[11].desc, "A Message Sent");
322 strcpy(Demos[12].name, "effect"); strcpy(Demos[12].desc, "The Other Side");
323 strcpy(Demos[13].name, "uhoh"); strcpy(Demos[13].desc, "Missing in Action");
324 strcpy(Demos[14].name, "prepare"); strcpy(Demos[14].desc, "The Response");
325 strcpy(Demos[15].name, "vision"); strcpy(Demos[15].desc, "Farsighted Eyes");
326 strcpy(Demos[16].name, "maxturns"); strcpy(Demos[16].desc, "Enter the Immortal");
327 strcpy(Demos[17].name, "backlot"); strcpy(Demos[17].desc, "Separate Ways");
328 strcpy(Demos[18].name, "maxside"); strcpy(Demos[18].desc, "The Ancient Runes");
329 strcpy(Demos[19].name, "counter"); strcpy(Demos[19].desc, "The New Initiative");
330 strcpy(Demos[20].name, "warprep"); strcpy(Demos[20].desc, "Ghosts to the World");
331 strcpy(Demos[21].name, "counter1"); strcpy(Demos[21].desc, "A Fate Worse Than Death");
332 strcpy(Demos[22].name, "counter2"); strcpy(Demos[22].desc, "Friendly Fire");
333 strcpy(Demos[23].name, "counter3"); strcpy(Demos[23].desc, "Minor Setback");
334 strcpy(Demos[24].name, "madmax"); strcpy(Demos[24].desc, "Scores to Settle");
335 strcpy(Demos[25].name, "quake"); strcpy(Demos[25].desc, "One Man");
336 strcpy(Demos[26].name, "cthmm"); strcpy(Demos[26].desc, "Shattered Masks");
337 strcpy(Demos[27].name, "shades"); strcpy(Demos[27].desc, "Deal with the Dead");
338 strcpy(Demos[28].name, "gophil"); strcpy(Demos[28].desc, "An Unlikely Hero");
339 strcpy(Demos[29].name, "cstrike"); strcpy(Demos[29].desc, "War in Hell");
340 strcpy(Demos[30].name, "shubset"); strcpy(Demos[30].desc, "The Conspiracy");
341 strcpy(Demos[31].name, "shubdie"); strcpy(Demos[31].desc, "Even Death May Die");
342 strcpy(Demos[32].name, "newranks"); strcpy(Demos[32].desc, "An Empty Throne");
343 strcpy(Demos[33].name, "seal"); strcpy(Demos[33].desc, "The Seal is Broken");
346 void M_Demo_Key (int k)
355 S_LocalSound ("misc/menu2.wav");
358 SCR_BeginLoadingPlaque ();
359 Cbuf_AddText (va ("playdemo %s\n", Demos[demo_cursor].name));
364 S_LocalSound ("misc/menu1.wav");
367 demo_cursor = NumberOfDemos;
372 S_LocalSound ("misc/menu1.wav");
374 if (demo_cursor > NumberOfDemos)
380 //=============================================================================
384 //#define MAIN_ITEMS 5
386 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
388 void M_Menu_Main_f (void)
392 if (NehGameType == TYPE_DEMO)
394 else if (NehGameType == TYPE_GAME)
402 if (key_dest != key_menu)
404 m_save_demonum = cls.demonum;
413 void M_Main_Draw (void)
418 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
419 p = Draw_CachePic ("gfx/ttl_main.lmp");
420 M_DrawPic ( (320-p->width)/2, 4, p);
424 if (NehGameType == TYPE_BOTH)
425 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
426 else if (NehGameType == TYPE_GAME)
427 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/gamemenu.lmp"));
429 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/demomenu.lmp"));
432 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp"));
434 f = (int)(host_time * 10)%6;
436 M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
440 void M_Main_Key (int key)
447 cls.demonum = m_save_demonum;
448 if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
453 S_LocalSound ("misc/menu1.wav");
454 if (++m_main_cursor >= MAIN_ITEMS)
459 S_LocalSound ("misc/menu1.wav");
460 if (--m_main_cursor < 0)
461 m_main_cursor = MAIN_ITEMS - 1;
472 switch (m_main_cursor)
475 M_Menu_SinglePlayer_f ();
483 M_Menu_MultiPlayer_f ();
493 Cbuf_AddText ("disconnect\n");
494 Cbuf_AddText ("playdemo endcred\n");
503 switch (m_main_cursor)
506 M_Menu_SinglePlayer_f ();
510 M_Menu_MultiPlayer_f ();
520 Cbuf_AddText ("disconnect\n");
521 Cbuf_AddText ("playdemo endcred\n");
530 switch (m_main_cursor)
539 Cbuf_AddText ("disconnect\n");
540 Cbuf_AddText ("playdemo endcred\n");
556 switch (m_main_cursor)
559 M_Menu_SinglePlayer_f ();
563 M_Menu_MultiPlayer_f ();
582 //=============================================================================
583 /* SINGLE PLAYER MENU */
585 int m_singleplayer_cursor;
586 #define SINGLEPLAYER_ITEMS 3
589 void M_Menu_SinglePlayer_f (void)
592 m_state = m_singleplayer;
597 void M_SinglePlayer_Draw (void)
602 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
603 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
604 M_DrawPic ( (320-p->width)/2, 4, p);
605 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") );
607 f = (int)(host_time * 10)%6;
609 M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
613 void M_SinglePlayer_Key (int key)
622 S_LocalSound ("misc/menu1.wav");
623 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
624 m_singleplayer_cursor = 0;
628 S_LocalSound ("misc/menu1.wav");
629 if (--m_singleplayer_cursor < 0)
630 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
636 switch (m_singleplayer_cursor)
640 if (!SCR_ModalMessage("Are you sure you want to\nstart a new game?\n"))
644 Cbuf_AddText ("disconnect\n");
645 Cbuf_AddText ("maxplayers 1\n");
647 Cbuf_AddText ("map nehstart\n");
649 Cbuf_AddText ("map start\n");
663 //=============================================================================
666 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
668 #define MAX_SAVEGAMES 12
669 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
670 int loadable[MAX_SAVEGAMES];
672 void M_ScanSaves (void)
675 char name[MAX_OSPATH];
679 for (i=0 ; i<MAX_SAVEGAMES ; i++)
681 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
683 sprintf (name, "%s/s%i.sav", com_gamedir, i);
684 f = fopen (name, "r");
687 fscanf (f, "%i\n", &version);
688 fscanf (f, "%79s\n", name);
689 strncpy (m_filenames[i], name, sizeof(m_filenames[i])-1);
691 // change _ back to space
692 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
693 if (m_filenames[i][j] == '_')
694 m_filenames[i][j] = ' ';
700 void M_Menu_Load_f (void)
709 void M_Menu_Save_f (void)
715 if (svs.maxclients != 1)
724 void M_Load_Draw (void)
729 p = Draw_CachePic ("gfx/p_load.lmp");
730 M_DrawPic ( (320-p->width)/2, 4, p);
732 for (i=0 ; i< MAX_SAVEGAMES; i++)
733 M_Print (16, 32 + 8*i, m_filenames[i]);
736 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
740 void M_Save_Draw (void)
745 p = Draw_CachePic ("gfx/p_save.lmp");
746 M_DrawPic ( (320-p->width)/2, 4, p);
748 for (i=0 ; i<MAX_SAVEGAMES ; i++)
749 M_Print (16, 32 + 8*i, m_filenames[i]);
752 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
756 void M_Load_Key (int k)
761 M_Menu_SinglePlayer_f ();
765 S_LocalSound ("misc/menu2.wav");
766 if (!loadable[load_cursor])
771 // Host_Loadgame_f can't bring up the loading plaque because too much
772 // stack space has been used, so do it now
773 SCR_BeginLoadingPlaque ();
775 // issue the load command
776 Cbuf_AddText (va ("load s%i\n", load_cursor) );
781 S_LocalSound ("misc/menu1.wav");
784 load_cursor = MAX_SAVEGAMES-1;
789 S_LocalSound ("misc/menu1.wav");
791 if (load_cursor >= MAX_SAVEGAMES)
798 void M_Save_Key (int k)
803 M_Menu_SinglePlayer_f ();
809 Cbuf_AddText (va("save s%i\n", load_cursor));
814 S_LocalSound ("misc/menu1.wav");
817 load_cursor = MAX_SAVEGAMES-1;
822 S_LocalSound ("misc/menu1.wav");
824 if (load_cursor >= MAX_SAVEGAMES)
830 //=============================================================================
831 /* MULTIPLAYER MENU */
833 int m_multiplayer_cursor;
834 #define MULTIPLAYER_ITEMS 3
837 void M_Menu_MultiPlayer_f (void)
840 m_state = m_multiplayer;
845 void M_MultiPlayer_Draw (void)
850 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
851 p = Draw_CachePic ("gfx/p_multi.lmp");
852 M_DrawPic ( (320-p->width)/2, 4, p);
853 M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") );
855 f = (int)(host_time * 10)%6;
857 M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
859 if (serialAvailable || ipxAvailable || tcpipAvailable)
861 M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
865 void M_MultiPlayer_Key (int key)
874 S_LocalSound ("misc/menu1.wav");
875 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
876 m_multiplayer_cursor = 0;
880 S_LocalSound ("misc/menu1.wav");
881 if (--m_multiplayer_cursor < 0)
882 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
887 switch (m_multiplayer_cursor)
890 if (serialAvailable || ipxAvailable || tcpipAvailable)
895 if (serialAvailable || ipxAvailable || tcpipAvailable)
906 //=============================================================================
909 int setup_cursor = 4;
910 int setup_cursor_table[] = {40, 56, 80, 104, 140};
912 char setup_hostname[16];
913 char setup_myname[16];
919 #define NUM_SETUP_CMDS 5
921 void M_Menu_Setup_f (void)
926 strcpy(setup_myname, cl_name.string);
927 strcpy(setup_hostname, hostname.string);
928 setup_top = setup_oldtop = ((int)cl_color.value) >> 4;
929 setup_bottom = setup_oldbottom = ((int)cl_color.value) & 15;
933 void M_Setup_Draw (void)
937 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
938 p = Draw_CachePic ("gfx/p_multi.lmp");
939 M_DrawPic ( (320-p->width)/2, 4, p);
941 M_Print (64, 40, "Hostname");
942 M_DrawTextBox (160, 32, 16, 1);
943 M_Print (168, 40, setup_hostname);
945 M_Print (64, 56, "Your name");
946 M_DrawTextBox (160, 48, 16, 1);
947 M_Print (168, 56, setup_myname);
949 M_Print (64, 80, "Shirt color");
950 M_Print (64, 104, "Pants color");
952 M_DrawTextBox (64, 140-8, 14, 1);
953 M_Print (72, 140, "Accept Changes");
955 p = Draw_CachePic ("gfx/bigbox.lmp");
956 M_DrawTransPic (160, 64, p);
957 p = Draw_CachePic ("gfx/menuplyr.lmp");
958 M_BuildTranslationTable(setup_top*16, setup_bottom*16);
959 M_DrawTransPicTranslate (172, 72, p);
961 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
963 if (setup_cursor == 0)
964 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
966 if (setup_cursor == 1)
967 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
971 void M_Setup_Key (int k)
978 M_Menu_MultiPlayer_f ();
982 S_LocalSound ("misc/menu1.wav");
984 if (setup_cursor < 0)
985 setup_cursor = NUM_SETUP_CMDS-1;
989 S_LocalSound ("misc/menu1.wav");
991 if (setup_cursor >= NUM_SETUP_CMDS)
996 if (setup_cursor < 2)
998 S_LocalSound ("misc/menu3.wav");
999 if (setup_cursor == 2)
1000 setup_top = setup_top - 1;
1001 if (setup_cursor == 3)
1002 setup_bottom = setup_bottom - 1;
1005 if (setup_cursor < 2)
1008 S_LocalSound ("misc/menu3.wav");
1009 if (setup_cursor == 2)
1010 setup_top = setup_top + 1;
1011 if (setup_cursor == 3)
1012 setup_bottom = setup_bottom + 1;
1016 if (setup_cursor == 0 || setup_cursor == 1)
1019 if (setup_cursor == 2 || setup_cursor == 3)
1022 // setup_cursor == 4 (OK)
1023 if (strcmp(cl_name.string, setup_myname) != 0)
1024 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1025 if (strcmp(hostname.string, setup_hostname) != 0)
1026 Cvar_Set("hostname", setup_hostname);
1027 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1028 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1029 m_entersound = true;
1030 M_Menu_MultiPlayer_f ();
1034 if (setup_cursor == 0)
1036 if (strlen(setup_hostname))
1037 setup_hostname[strlen(setup_hostname)-1] = 0;
1040 if (setup_cursor == 1)
1042 if (strlen(setup_myname))
1043 setup_myname[strlen(setup_myname)-1] = 0;
1048 if (k < 32 || k > 127)
1050 if (setup_cursor == 0)
1052 l = strlen(setup_hostname);
1055 setup_hostname[l+1] = 0;
1056 setup_hostname[l] = k;
1059 if (setup_cursor == 1)
1061 l = strlen(setup_myname);
1064 setup_myname[l+1] = 0;
1065 setup_myname[l] = k;
1074 if (setup_bottom > 13)
1076 if (setup_bottom < 0)
1080 //=============================================================================
1085 int m_net_saveHeight;
1087 char *net_helpMessage [] =
1089 /* .........1.........2.... */
1091 " Two computers connected",
1092 " through two modems. ",
1096 " Two computers connected",
1097 " by a null-modem cable. ",
1100 " Novell network LANs ",
1101 " or Windows 95 DOS-box. ",
1103 "(LAN=Local Area Network)",
1105 " Commonly used to play ",
1106 " over the Internet, but ",
1107 " also used on a Local ",
1111 void M_Menu_Net_f (void)
1113 key_dest = key_menu;
1115 m_entersound = true;
1118 if (m_net_cursor >= m_net_items)
1121 M_Net_Key (K_DOWNARROW);
1125 void M_Net_Draw (void)
1130 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
1131 p = Draw_CachePic ("gfx/p_multi.lmp");
1132 M_DrawPic ( (320-p->width)/2, 4, p);
1136 if (serialAvailable)
1138 p = Draw_CachePic ("gfx/netmen1.lmp");
1145 p = Draw_CachePic ("gfx/dim_modm.lmp");
1150 M_DrawTransPic (72, f, p);
1154 if (serialAvailable)
1156 p = Draw_CachePic ("gfx/netmen2.lmp");
1163 p = Draw_CachePic ("gfx/dim_drct.lmp");
1168 M_DrawTransPic (72, f, p);
1172 p = Draw_CachePic ("gfx/netmen3.lmp");
1174 p = Draw_CachePic ("gfx/dim_ipx.lmp");
1175 M_DrawTransPic (72, f, p);
1179 p = Draw_CachePic ("gfx/netmen4.lmp");
1181 p = Draw_CachePic ("gfx/dim_tcp.lmp");
1182 M_DrawTransPic (72, f, p);
1184 if (m_net_items == 5) // JDC, could just be removed
1187 p = Draw_CachePic ("gfx/netmen5.lmp");
1188 M_DrawTransPic (72, f, p);
1192 M_DrawTextBox (f, 134, 24, 4);
1194 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1195 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1196 M_Print (f, 158, net_helpMessage[m_net_cursor*4+2]);
1197 M_Print (f, 166, net_helpMessage[m_net_cursor*4+3]);
1199 f = (int)(host_time * 10)%6;
1200 M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
1204 void M_Net_Key (int k)
1210 M_Menu_MultiPlayer_f ();
1214 S_LocalSound ("misc/menu1.wav");
1215 if (++m_net_cursor >= m_net_items)
1220 S_LocalSound ("misc/menu1.wav");
1221 if (--m_net_cursor < 0)
1222 m_net_cursor = m_net_items - 1;
1226 m_entersound = true;
1228 switch (m_net_cursor)
1231 M_Menu_SerialConfig_f ();
1235 M_Menu_SerialConfig_f ();
1239 M_Menu_LanConfig_f ();
1243 M_Menu_LanConfig_f ();
1252 if (m_net_cursor == 0 && !serialAvailable)
1254 if (m_net_cursor == 1 && !serialAvailable)
1256 if (m_net_cursor == 2 && !ipxAvailable)
1258 if (m_net_cursor == 3 && !tcpipAvailable)
1262 //=============================================================================
1266 #define OPTIONS_ITEMS 14
1268 #define OPTIONS_ITEMS 13
1271 #define SLIDER_RANGE 10
1275 void M_Menu_Options_f (void)
1277 key_dest = key_menu;
1278 m_state = m_options;
1279 m_entersound = true;
1282 if ((options_cursor == 13) && (modestate != MS_WINDOWED))
1290 void M_AdjustSliders (int dir)
1292 S_LocalSound ("misc/menu3.wav");
1294 switch (options_cursor)
1296 case 3: // screen size
1297 scr_viewsize.value += dir * 10;
1298 if (scr_viewsize.value < 30)
1299 scr_viewsize.value = 30;
1300 if (scr_viewsize.value > 120)
1301 scr_viewsize.value = 120;
1302 Cvar_SetValue ("viewsize", scr_viewsize.value);
1304 case 4: // brightness
1305 brightness.value += dir * 0.25;
1306 if (brightness.value < 1)
1307 brightness.value = 1;
1308 if (brightness.value > 5)
1309 brightness.value = 5;
1310 Cvar_SetValue ("brightness", brightness.value);
1312 case 5: // mouse speed
1313 sensitivity.value += dir * 0.5;
1314 if (sensitivity.value < 1)
1315 sensitivity.value = 1;
1316 if (sensitivity.value > 50)
1317 sensitivity.value = 50;
1318 Cvar_SetValue ("sensitivity", sensitivity.value);
1320 case 6: // music volume
1322 bgmvolume.value += dir * 1.0;
1324 bgmvolume.value += dir * 0.1;
1326 if (bgmvolume.value < 0)
1327 bgmvolume.value = 0;
1328 if (bgmvolume.value > 1)
1329 bgmvolume.value = 1;
1330 Cvar_SetValue ("bgmvolume", bgmvolume.value);
1332 case 7: // sfx volume
1333 volume.value += dir * 0.1;
1334 if (volume.value < 0)
1336 if (volume.value > 1)
1338 Cvar_SetValue ("volume", volume.value);
1341 case 8: // allways run
1342 if (cl_forwardspeed.value > 200)
1344 Cvar_SetValue ("cl_forwardspeed", 200);
1345 Cvar_SetValue ("cl_backspeed", 200);
1349 Cvar_SetValue ("cl_forwardspeed", 400);
1350 Cvar_SetValue ("cl_backspeed", 400);
1354 case 9: // invert mouse
1355 Cvar_SetValue ("m_pitch", -m_pitch.value);
1358 case 10: // lookspring
1359 Cvar_SetValue ("lookspring", !lookspring.value);
1362 case 11: // lookstrafe
1363 Cvar_SetValue ("lookstrafe", !lookstrafe.value);
1367 case 13: // _windowed_mouse
1368 Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
1375 void M_DrawSlider (int x, int y, float range)
1383 M_DrawCharacter (x-8, y, 128);
1384 for (i=0 ; i<SLIDER_RANGE ; i++)
1385 M_DrawCharacter (x + i*8, y, 129);
1386 M_DrawCharacter (x+i*8, y, 130);
1387 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1390 void M_DrawCheckbox (int x, int y, int on)
1394 M_DrawCharacter (x, y, 131);
1396 M_DrawCharacter (x, y, 129);
1399 M_Print (x, y, "on");
1401 M_Print (x, y, "off");
1404 void M_Options_Draw (void)
1409 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
1410 p = Draw_CachePic ("gfx/p_option.lmp");
1411 M_DrawPic ( (320-p->width)/2, 4, p);
1413 M_Print (16, 32, " Customize controls");
1414 M_Print (16, 40, " Go to console");
1415 M_Print (16, 48, " Reset to defaults");
1417 M_Print (16, 56, " Screen size");
1418 r = (scr_viewsize.value - 30) / (120 - 30);
1419 M_DrawSlider (220, 56, r);
1421 M_Print (16, 64, " Brightness");
1422 r = (brightness.value - 1) / 4;
1423 M_DrawSlider (220, 64, r);
1425 M_Print (16, 72, " Mouse Speed");
1426 r = (sensitivity.value - 1)/50;
1427 M_DrawSlider (220, 72, r);
1429 M_Print (16, 80, " CD Music Volume");
1430 r = bgmvolume.value;
1431 M_DrawSlider (220, 80, r);
1433 M_Print (16, 88, " Sound Volume");
1435 M_DrawSlider (220, 88, r);
1437 M_Print (16, 96, " Always Run");
1438 M_DrawCheckbox (220, 96, cl_forwardspeed.value > 200);
1440 M_Print (16, 104, " Invert Mouse");
1441 M_DrawCheckbox (220, 104, m_pitch.value < 0);
1443 M_Print (16, 112, " Lookspring");
1444 M_DrawCheckbox (220, 112, lookspring.value);
1446 M_Print (16, 120, " Lookstrafe");
1447 M_DrawCheckbox (220, 120, lookstrafe.value);
1450 M_Print (16, 128, " Video Options");
1453 if (modestate == MS_WINDOWED)
1455 M_Print (16, 136, " Use Mouse");
1456 M_DrawCheckbox (220, 136, _windowed_mouse.value);
1461 M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1465 void M_Options_Key (int k)
1474 m_entersound = true;
1475 switch (options_cursor)
1482 Con_ToggleConsole_f ();
1485 Cbuf_AddText ("exec default.cfg\n");
1491 M_AdjustSliders (1);
1497 S_LocalSound ("misc/menu1.wav");
1499 if (options_cursor < 0)
1500 options_cursor = OPTIONS_ITEMS-1;
1504 S_LocalSound ("misc/menu1.wav");
1506 if (options_cursor >= OPTIONS_ITEMS)
1511 M_AdjustSliders (-1);
1515 M_AdjustSliders (1);
1519 if (options_cursor == 12 && vid_menudrawfn == NULL)
1522 options_cursor = 11;
1528 if ((options_cursor == 13) && (modestate != MS_WINDOWED))
1531 options_cursor = 12;
1538 //=============================================================================
1541 char *bindnames[][2] =
1543 {"+attack", "attack"},
1544 {"impulse 10", "change weapon"},
1545 {"+jump", "jump / swim up"},
1546 {"+forward", "walk forward"},
1547 {"+back", "backpedal"},
1548 {"+left", "turn left"},
1549 {"+right", "turn right"},
1551 {"+moveleft", "step left"},
1552 {"+moveright", "step right"},
1553 {"+strafe", "sidestep"},
1554 {"+lookup", "look up"},
1555 {"+lookdown", "look down"},
1556 {"centerview", "center view"},
1557 {"+mlook", "mouse look"},
1558 {"+klook", "keyboard look"},
1559 {"+moveup", "swim up"},
1560 {"+movedown", "swim down"}
1563 #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
1568 void M_Menu_Keys_f (void)
1570 key_dest = key_menu;
1572 m_entersound = true;
1576 void M_FindKeysForCommand (char *command, int *twokeys)
1583 twokeys[0] = twokeys[1] = -1;
1584 l = strlen(command);
1587 for (j=0 ; j<256 ; j++)
1592 if (!strncmp (b, command, l) )
1602 void M_UnbindCommand (char *command)
1608 l = strlen(command);
1610 for (j=0 ; j<256 ; j++)
1615 if (!strncmp (b, command, l) )
1616 Key_SetBinding (j, "");
1621 void M_Keys_Draw (void)
1629 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1630 M_DrawPic ( (320-p->width)/2, 4, p);
1633 M_Print (12, 32, "Press a key or button for this action");
1635 M_Print (18, 32, "Enter to change, backspace to clear");
1637 // search for known bindings
1638 for (i=0 ; i<NUMCOMMANDS ; i++)
1642 M_Print (16, y, bindnames[i][1]);
1644 l = strlen (bindnames[i][0]);
1646 M_FindKeysForCommand (bindnames[i][0], keys);
1650 M_Print (140, y, "???");
1654 name = Key_KeynumToString (keys[0]);
1655 M_Print (140, y, name);
1656 x = strlen(name) * 8;
1659 M_Print (140 + x + 8, y, "or");
1660 M_Print (140 + x + 32, y, Key_KeynumToString (keys[1]));
1666 M_DrawCharacter (130, 48 + keys_cursor*8, '=');
1668 M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1672 void M_Keys_Key (int k)
1679 S_LocalSound ("misc/menu1.wav");
1686 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1687 Cbuf_InsertText (cmd);
1697 M_Menu_Options_f ();
1702 S_LocalSound ("misc/menu1.wav");
1704 if (keys_cursor < 0)
1705 keys_cursor = NUMCOMMANDS-1;
1710 S_LocalSound ("misc/menu1.wav");
1712 if (keys_cursor >= NUMCOMMANDS)
1716 case K_ENTER: // go into bind mode
1717 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1718 S_LocalSound ("misc/menu2.wav");
1720 M_UnbindCommand (bindnames[keys_cursor][0]);
1724 case K_BACKSPACE: // delete bindings
1725 case K_DEL: // delete bindings
1726 S_LocalSound ("misc/menu2.wav");
1727 M_UnbindCommand (bindnames[keys_cursor][0]);
1732 //=============================================================================
1735 void M_Menu_Video_f (void)
1737 key_dest = key_menu;
1739 m_entersound = true;
1743 void M_Video_Draw (void)
1745 (*vid_menudrawfn) ();
1749 void M_Video_Key (int key)
1751 (*vid_menukeyfn) (key);
1754 //=============================================================================
1758 #define NUM_HELP_PAGES 6
1761 void M_Menu_Help_f (void)
1763 key_dest = key_menu;
1765 m_entersound = true;
1771 void M_Help_Draw (void)
1773 M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%i.lmp", help_page)) );
1777 void M_Help_Key (int key)
1787 m_entersound = true;
1788 if (++help_page >= NUM_HELP_PAGES)
1794 m_entersound = true;
1795 if (--help_page < 0)
1796 help_page = NUM_HELP_PAGES-1;
1802 //=============================================================================
1806 int m_quit_prevstate;
1807 qboolean wasInMenus;
1810 char *quitMessage [] =
1812 /* .........1.........2.... */
1813 " Are you gonna quit ",
1814 " this game just like ",
1815 " everything else? ",
1818 " Milord, methinks that ",
1819 " thou art a lowly ",
1820 " quitter. Is this true? ",
1823 " Do I need to bust your ",
1824 " face open for trying ",
1828 " Man, I oughta smack you",
1829 " for trying to quit! ",
1833 " Press Y to quit like a ",
1834 " big loser in life. ",
1835 " Press N to stay proud ",
1836 " and successful! ",
1838 " If you press Y to ",
1839 " quit, I will summon ",
1840 " Satan all over your ",
1843 " Um, Asmodeus dislikes ",
1844 " his children trying to ",
1845 " quit. Press Y to return",
1846 " to your Tinkertoys. ",
1848 " If you quit now, I'll ",
1849 " throw a blanket-party ",
1850 " for you next time! ",
1855 void M_Menu_Quit_f (void)
1857 if (m_state == m_quit)
1859 wasInMenus = (key_dest == key_menu);
1860 key_dest = key_menu;
1861 m_quit_prevstate = m_state;
1863 m_entersound = true;
1864 msgNumber = rand()&7;
1868 void M_Quit_Key (int key)
1877 m_state = m_quit_prevstate;
1878 m_entersound = true;
1882 key_dest = key_game;
1889 key_dest = key_console;
1900 void M_Quit_Draw (void)
1904 m_state = m_quit_prevstate;
1905 m_recursiveDraw = true;
1911 M_DrawTextBox (0, 0, 38, 23);
1912 M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n");
1913 M_PrintWhite (16, 28, "Programming Art \n");
1914 M_Print (16, 36, " John Carmack Adrian Carmack\n");
1915 M_Print (16, 44, " Michael Abrash Kevin Cloud\n");
1916 M_Print (16, 52, " John Cash Paul Steed\n");
1917 M_Print (16, 60, " Dave 'Zoid' Kirsch\n");
1918 M_PrintWhite (16, 68, "Design Biz\n");
1919 M_Print (16, 76, " John Romero Jay Wilbur\n");
1920 M_Print (16, 84, " Sandy Petersen Mike Wilson\n");
1921 M_Print (16, 92, " American McGee Donna Jackson\n");
1922 M_Print (16, 100, " Tim Willits Todd Hollenshead\n");
1923 M_PrintWhite (16, 108, "Support Projects\n");
1924 M_Print (16, 116, " Barrett Alexander Shawn Green\n");
1925 M_PrintWhite (16, 124, "Sound Effects\n");
1926 M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n");
1927 M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n");
1928 M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n");
1929 M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n");
1930 M_PrintWhite (16, 164, "registered trademark licensed to\n");
1931 M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n");
1932 M_PrintWhite (16, 180, "reserved. Press y to exit\n");
1934 M_DrawTextBox (56, 76, 24, 4);
1935 M_Print (64, 84, quitMessage[msgNumber*4+0]);
1936 M_Print (64, 92, quitMessage[msgNumber*4+1]);
1937 M_Print (64, 100, quitMessage[msgNumber*4+2]);
1938 M_Print (64, 108, quitMessage[msgNumber*4+3]);
1942 //=============================================================================
1944 /* SERIAL CONFIG MENU */
1946 int serialConfig_cursor;
1947 int serialConfig_cursor_table[] = {48, 64, 80, 96, 112, 132};
1948 #define NUM_SERIALCONFIG_CMDS 6
1950 static int ISA_uarts[] = {0x3f8,0x2f8,0x3e8,0x2e8};
1951 static int ISA_IRQs[] = {4,3,4,3};
1952 int serialConfig_baudrate[] = {9600,14400,19200,28800,38400,57600};
1954 int serialConfig_comport;
1955 int serialConfig_irq ;
1956 int serialConfig_baud;
1957 char serialConfig_phone[16];
1959 void M_Menu_SerialConfig_f (void)
1966 key_dest = key_menu;
1967 m_state = m_serialconfig;
1968 m_entersound = true;
1969 if (JoiningGame && SerialConfig)
1970 serialConfig_cursor = 4;
1972 serialConfig_cursor = 5;
1974 (*GetComPortConfig) (0, &port, &serialConfig_irq, &baudrate, &useModem);
1976 // map uart's port to COMx
1977 for (n = 0; n < 4; n++)
1978 if (ISA_uarts[n] == port)
1983 serialConfig_irq = 4;
1985 serialConfig_comport = n + 1;
1987 // map baudrate to index
1988 for (n = 0; n < 6; n++)
1989 if (serialConfig_baudrate[n] == baudrate)
1993 serialConfig_baud = n;
1995 m_return_onerror = false;
1996 m_return_reason[0] = 0;
2000 void M_SerialConfig_Draw (void)
2007 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
2008 p = Draw_CachePic ("gfx/p_multi.lmp");
2009 basex = (320-p->width)/2;
2010 M_DrawPic (basex, 4, p);
2013 startJoin = "New Game";
2015 startJoin = "Join Game";
2017 directModem = "Modem";
2019 directModem = "Direct Connect";
2020 M_Print (basex, 32, va ("%s - %s", startJoin, directModem));
2023 M_Print (basex, serialConfig_cursor_table[0], "Port");
2024 M_DrawTextBox (160, 40, 4, 1);
2025 M_Print (168, serialConfig_cursor_table[0], va("COM%u", serialConfig_comport));
2027 M_Print (basex, serialConfig_cursor_table[1], "IRQ");
2028 M_DrawTextBox (160, serialConfig_cursor_table[1]-8, 1, 1);
2029 M_Print (168, serialConfig_cursor_table[1], va("%u", serialConfig_irq));
2031 M_Print (basex, serialConfig_cursor_table[2], "Baud");
2032 M_DrawTextBox (160, serialConfig_cursor_table[2]-8, 5, 1);
2033 M_Print (168, serialConfig_cursor_table[2], va("%u", serialConfig_baudrate[serialConfig_baud]));
2037 M_Print (basex, serialConfig_cursor_table[3], "Modem Setup...");
2040 M_Print (basex, serialConfig_cursor_table[4], "Phone number");
2041 M_DrawTextBox (160, serialConfig_cursor_table[4]-8, 16, 1);
2042 M_Print (168, serialConfig_cursor_table[4], serialConfig_phone);
2048 M_DrawTextBox (basex, serialConfig_cursor_table[5]-8, 7, 1);
2049 M_Print (basex+8, serialConfig_cursor_table[5], "Connect");
2053 M_DrawTextBox (basex, serialConfig_cursor_table[5]-8, 2, 1);
2054 M_Print (basex+8, serialConfig_cursor_table[5], "OK");
2057 M_DrawCharacter (basex-8, serialConfig_cursor_table [serialConfig_cursor], 12+((int)(realtime*4)&1));
2059 if (serialConfig_cursor == 4)
2060 M_DrawCharacter (168 + 8*strlen(serialConfig_phone), serialConfig_cursor_table [serialConfig_cursor], 10+((int)(realtime*4)&1));
2062 if (*m_return_reason)
2063 M_PrintWhite (basex, 148, m_return_reason);
2067 void M_SerialConfig_Key (int key)
2078 S_LocalSound ("misc/menu1.wav");
2079 serialConfig_cursor--;
2080 if (serialConfig_cursor < 0)
2081 serialConfig_cursor = NUM_SERIALCONFIG_CMDS-1;
2085 S_LocalSound ("misc/menu1.wav");
2086 serialConfig_cursor++;
2087 if (serialConfig_cursor >= NUM_SERIALCONFIG_CMDS)
2088 serialConfig_cursor = 0;
2092 if (serialConfig_cursor > 2)
2094 S_LocalSound ("misc/menu3.wav");
2096 if (serialConfig_cursor == 0)
2098 serialConfig_comport--;
2099 if (serialConfig_comport == 0)
2100 serialConfig_comport = 4;
2101 serialConfig_irq = ISA_IRQs[serialConfig_comport-1];
2104 if (serialConfig_cursor == 1)
2107 if (serialConfig_irq == 6)
2108 serialConfig_irq = 5;
2109 if (serialConfig_irq == 1)
2110 serialConfig_irq = 7;
2113 if (serialConfig_cursor == 2)
2115 serialConfig_baud--;
2116 if (serialConfig_baud < 0)
2117 serialConfig_baud = 5;
2123 if (serialConfig_cursor > 2)
2126 S_LocalSound ("misc/menu3.wav");
2128 if (serialConfig_cursor == 0)
2130 serialConfig_comport++;
2131 if (serialConfig_comport > 4)
2132 serialConfig_comport = 1;
2133 serialConfig_irq = ISA_IRQs[serialConfig_comport-1];
2136 if (serialConfig_cursor == 1)
2139 if (serialConfig_irq == 6)
2140 serialConfig_irq = 7;
2141 if (serialConfig_irq == 8)
2142 serialConfig_irq = 2;
2145 if (serialConfig_cursor == 2)
2147 serialConfig_baud++;
2148 if (serialConfig_baud > 5)
2149 serialConfig_baud = 0;
2155 if (serialConfig_cursor < 3)
2158 m_entersound = true;
2160 if (serialConfig_cursor == 3)
2162 (*SetComPortConfig) (0, ISA_uarts[serialConfig_comport-1], serialConfig_irq, serialConfig_baudrate[serialConfig_baud], SerialConfig);
2164 M_Menu_ModemConfig_f ();
2168 if (serialConfig_cursor == 4)
2170 serialConfig_cursor = 5;
2174 // serialConfig_cursor == 5 (OK/CONNECT)
2175 (*SetComPortConfig) (0, ISA_uarts[serialConfig_comport-1], serialConfig_irq, serialConfig_baudrate[serialConfig_baud], SerialConfig);
2177 M_ConfigureNetSubsystem ();
2181 M_Menu_GameOptions_f ();
2185 m_return_state = m_state;
2186 m_return_onerror = true;
2187 key_dest = key_game;
2191 Cbuf_AddText (va ("connect \"%s\"\n", serialConfig_phone));
2193 Cbuf_AddText ("connect\n");
2197 if (serialConfig_cursor == 4)
2199 if (strlen(serialConfig_phone))
2200 serialConfig_phone[strlen(serialConfig_phone)-1] = 0;
2205 if (key < 32 || key > 127)
2207 if (serialConfig_cursor == 4)
2209 l = strlen(serialConfig_phone);
2212 serialConfig_phone[l+1] = 0;
2213 serialConfig_phone[l] = key;
2218 if (DirectConfig && (serialConfig_cursor == 3 || serialConfig_cursor == 4))
2220 if (key == K_UPARROW)
2221 serialConfig_cursor = 2;
2223 serialConfig_cursor = 5;
2226 if (SerialConfig && StartingGame && serialConfig_cursor == 4)
2228 if (key == K_UPARROW)
2229 serialConfig_cursor = 3;
2231 serialConfig_cursor = 5;
2235 //=============================================================================
2236 /* MODEM CONFIG MENU */
2238 int modemConfig_cursor;
2239 int modemConfig_cursor_table [] = {40, 56, 88, 120, 156};
2240 #define NUM_MODEMCONFIG_CMDS 5
2242 char modemConfig_dialing;
2243 char modemConfig_clear [16];
2244 char modemConfig_init [32];
2245 char modemConfig_hangup [16];
2247 void M_Menu_ModemConfig_f (void)
2249 key_dest = key_menu;
2250 m_state = m_modemconfig;
2251 m_entersound = true;
2252 (*GetModemConfig) (0, &modemConfig_dialing, modemConfig_clear, modemConfig_init, modemConfig_hangup);
2256 void M_ModemConfig_Draw (void)
2261 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
2262 p = Draw_CachePic ("gfx/p_multi.lmp");
2263 basex = (320-p->width)/2;
2264 M_DrawPic (basex, 4, p);
2267 if (modemConfig_dialing == 'P')
2268 M_Print (basex, modemConfig_cursor_table[0], "Pulse Dialing");
2270 M_Print (basex, modemConfig_cursor_table[0], "Touch Tone Dialing");
2272 M_Print (basex, modemConfig_cursor_table[1], "Clear");
2273 M_DrawTextBox (basex, modemConfig_cursor_table[1]+4, 16, 1);
2274 M_Print (basex+8, modemConfig_cursor_table[1]+12, modemConfig_clear);
2275 if (modemConfig_cursor == 1)
2276 M_DrawCharacter (basex+8 + 8*strlen(modemConfig_clear), modemConfig_cursor_table[1]+12, 10+((int)(realtime*4)&1));
2278 M_Print (basex, modemConfig_cursor_table[2], "Init");
2279 M_DrawTextBox (basex, modemConfig_cursor_table[2]+4, 30, 1);
2280 M_Print (basex+8, modemConfig_cursor_table[2]+12, modemConfig_init);
2281 if (modemConfig_cursor == 2)
2282 M_DrawCharacter (basex+8 + 8*strlen(modemConfig_init), modemConfig_cursor_table[2]+12, 10+((int)(realtime*4)&1));
2284 M_Print (basex, modemConfig_cursor_table[3], "Hangup");
2285 M_DrawTextBox (basex, modemConfig_cursor_table[3]+4, 16, 1);
2286 M_Print (basex+8, modemConfig_cursor_table[3]+12, modemConfig_hangup);
2287 if (modemConfig_cursor == 3)
2288 M_DrawCharacter (basex+8 + 8*strlen(modemConfig_hangup), modemConfig_cursor_table[3]+12, 10+((int)(realtime*4)&1));
2290 M_DrawTextBox (basex, modemConfig_cursor_table[4]-8, 2, 1);
2291 M_Print (basex+8, modemConfig_cursor_table[4], "OK");
2293 M_DrawCharacter (basex-8, modemConfig_cursor_table [modemConfig_cursor], 12+((int)(realtime*4)&1));
2297 void M_ModemConfig_Key (int key)
2304 M_Menu_SerialConfig_f ();
2308 S_LocalSound ("misc/menu1.wav");
2309 modemConfig_cursor--;
2310 if (modemConfig_cursor < 0)
2311 modemConfig_cursor = NUM_MODEMCONFIG_CMDS-1;
2315 S_LocalSound ("misc/menu1.wav");
2316 modemConfig_cursor++;
2317 if (modemConfig_cursor >= NUM_MODEMCONFIG_CMDS)
2318 modemConfig_cursor = 0;
2323 if (modemConfig_cursor == 0)
2325 if (modemConfig_dialing == 'P')
2326 modemConfig_dialing = 'T';
2328 modemConfig_dialing = 'P';
2329 S_LocalSound ("misc/menu1.wav");
2334 if (modemConfig_cursor == 0)
2336 if (modemConfig_dialing == 'P')
2337 modemConfig_dialing = 'T';
2339 modemConfig_dialing = 'P';
2340 m_entersound = true;
2343 if (modemConfig_cursor == 4)
2345 (*SetModemConfig) (0, va ("%c", modemConfig_dialing), modemConfig_clear, modemConfig_init, modemConfig_hangup);
2346 m_entersound = true;
2347 M_Menu_SerialConfig_f ();
2352 if (modemConfig_cursor == 1)
2354 if (strlen(modemConfig_clear))
2355 modemConfig_clear[strlen(modemConfig_clear)-1] = 0;
2358 if (modemConfig_cursor == 2)
2360 if (strlen(modemConfig_init))
2361 modemConfig_init[strlen(modemConfig_init)-1] = 0;
2364 if (modemConfig_cursor == 3)
2366 if (strlen(modemConfig_hangup))
2367 modemConfig_hangup[strlen(modemConfig_hangup)-1] = 0;
2372 if (key < 32 || key > 127)
2375 if (modemConfig_cursor == 1)
2377 l = strlen(modemConfig_clear);
2380 modemConfig_clear[l+1] = 0;
2381 modemConfig_clear[l] = key;
2385 if (modemConfig_cursor == 2)
2387 l = strlen(modemConfig_init);
2390 modemConfig_init[l+1] = 0;
2391 modemConfig_init[l] = key;
2395 if (modemConfig_cursor == 3)
2397 l = strlen(modemConfig_hangup);
2400 modemConfig_hangup[l+1] = 0;
2401 modemConfig_hangup[l] = key;
2407 //=============================================================================
2408 /* LAN CONFIG MENU */
2410 int lanConfig_cursor = -1;
2411 int lanConfig_cursor_table [] = {72, 92, 124};
2412 #define NUM_LANCONFIG_CMDS 3
2415 char lanConfig_portname[6];
2416 char lanConfig_joinname[22];
2418 void M_Menu_LanConfig_f (void)
2420 key_dest = key_menu;
2421 m_state = m_lanconfig;
2422 m_entersound = true;
2423 if (lanConfig_cursor == -1)
2425 if (JoiningGame && TCPIPConfig)
2426 lanConfig_cursor = 2;
2428 lanConfig_cursor = 1;
2430 if (StartingGame && lanConfig_cursor == 2)
2431 lanConfig_cursor = 1;
2432 lanConfig_port = DEFAULTnet_hostport;
2433 sprintf(lanConfig_portname, "%u", lanConfig_port);
2435 m_return_onerror = false;
2436 m_return_reason[0] = 0;
2440 void M_LanConfig_Draw (void)
2447 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
2448 p = Draw_CachePic ("gfx/p_multi.lmp");
2449 basex = (320-p->width)/2;
2450 M_DrawPic (basex, 4, p);
2453 startJoin = "New Game";
2455 startJoin = "Join Game";
2459 protocol = "TCP/IP";
2460 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2463 M_Print (basex, 52, "Address:");
2465 M_Print (basex+9*8, 52, my_ipx_address);
2467 M_Print (basex+9*8, 52, my_tcpip_address);
2469 M_Print (basex, lanConfig_cursor_table[0], "Port");
2470 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2471 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2475 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2476 M_Print (basex, 108, "Join game at:");
2477 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2478 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2482 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2483 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2486 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2488 if (lanConfig_cursor == 0)
2489 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2491 if (lanConfig_cursor == 2)
2492 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2494 if (*m_return_reason)
2495 M_PrintWhite (basex, 148, m_return_reason);
2499 void M_LanConfig_Key (int key)
2510 S_LocalSound ("misc/menu1.wav");
2512 if (lanConfig_cursor < 0)
2513 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2517 S_LocalSound ("misc/menu1.wav");
2519 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2520 lanConfig_cursor = 0;
2524 if (lanConfig_cursor == 0)
2527 m_entersound = true;
2529 M_ConfigureNetSubsystem ();
2531 if (lanConfig_cursor == 1)
2535 M_Menu_GameOptions_f ();
2542 if (lanConfig_cursor == 2)
2544 m_return_state = m_state;
2545 m_return_onerror = true;
2546 key_dest = key_game;
2548 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2555 if (lanConfig_cursor == 0)
2557 if (strlen(lanConfig_portname))
2558 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2561 if (lanConfig_cursor == 2)
2563 if (strlen(lanConfig_joinname))
2564 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2569 if (key < 32 || key > 127)
2572 if (lanConfig_cursor == 2)
2574 l = strlen(lanConfig_joinname);
2577 lanConfig_joinname[l+1] = 0;
2578 lanConfig_joinname[l] = key;
2582 if (key < '0' || key > '9')
2584 if (lanConfig_cursor == 0)
2586 l = strlen(lanConfig_portname);
2589 lanConfig_portname[l+1] = 0;
2590 lanConfig_portname[l] = key;
2595 if (StartingGame && lanConfig_cursor == 2)
2597 if (key == K_UPARROW)
2598 lanConfig_cursor = 1;
2600 lanConfig_cursor = 0;
2603 l = atoi(lanConfig_portname);
2608 sprintf(lanConfig_portname, "%u", lanConfig_port);
2611 //=============================================================================
2612 /* GAME OPTIONS MENU */
2622 {"start", "Entrance"}, // 0
2624 {"e1m1", "Slipgate Complex"}, // 1
2625 {"e1m2", "Castle of the Damned"},
2626 {"e1m3", "The Necropolis"},
2627 {"e1m4", "The Grisly Grotto"},
2628 {"e1m5", "Gloom Keep"},
2629 {"e1m6", "The Door To Chthon"},
2630 {"e1m7", "The House of Chthon"},
2631 {"e1m8", "Ziggurat Vertigo"},
2633 {"e2m1", "The Installation"}, // 9
2634 {"e2m2", "Ogre Citadel"},
2635 {"e2m3", "Crypt of Decay"},
2636 {"e2m4", "The Ebon Fortress"},
2637 {"e2m5", "The Wizard's Manse"},
2638 {"e2m6", "The Dismal Oubliette"},
2639 {"e2m7", "Underearth"},
2641 {"e3m1", "Termination Central"}, // 16
2642 {"e3m2", "The Vaults of Zin"},
2643 {"e3m3", "The Tomb of Terror"},
2644 {"e3m4", "Satan's Dark Delight"},
2645 {"e3m5", "Wind Tunnels"},
2646 {"e3m6", "Chambers of Torment"},
2647 {"e3m7", "The Haunted Halls"},
2649 {"e4m1", "The Sewage System"}, // 23
2650 {"e4m2", "The Tower of Despair"},
2651 {"e4m3", "The Elder God Shrine"},
2652 {"e4m4", "The Palace of Hate"},
2653 {"e4m5", "Hell's Atrium"},
2654 {"e4m6", "The Pain Maze"},
2655 {"e4m7", "Azure Agony"},
2656 {"e4m8", "The Nameless City"},
2658 {"end", "Shub-Niggurath's Pit"}, // 31
2660 {"dm1", "Place of Two Deaths"}, // 32
2661 {"dm2", "Claustrophobopolis"},
2662 {"dm3", "The Abandoned Base"},
2663 {"dm4", "The Bad Place"},
2664 {"dm5", "The Cistern"},
2665 {"dm6", "The Dark Zone"}
2668 //MED 01/06/97 added hipnotic levels
2669 level_t hipnoticlevels[] =
2671 {"start", "Command HQ"}, // 0
2673 {"hip1m1", "The Pumping Station"}, // 1
2674 {"hip1m2", "Storage Facility"},
2675 {"hip1m3", "The Lost Mine"},
2676 {"hip1m4", "Research Facility"},
2677 {"hip1m5", "Military Complex"},
2679 {"hip2m1", "Ancient Realms"}, // 6
2680 {"hip2m2", "The Black Cathedral"},
2681 {"hip2m3", "The Catacombs"},
2682 {"hip2m4", "The Crypt"},
2683 {"hip2m5", "Mortum's Keep"},
2684 {"hip2m6", "The Gremlin's Domain"},
2686 {"hip3m1", "Tur Torment"}, // 12
2687 {"hip3m2", "Pandemonium"},
2688 {"hip3m3", "Limbo"},
2689 {"hip3m4", "The Gauntlet"},
2691 {"hipend", "Armagon's Lair"}, // 16
2693 {"hipdm1", "The Edge of Oblivion"} // 17
2696 //PGM 01/07/97 added rogue levels
2697 //PGM 03/02/97 added dmatch level
2698 level_t roguelevels[] =
2700 {"start", "Split Decision"},
2701 {"r1m1", "Deviant's Domain"},
2702 {"r1m2", "Dread Portal"},
2703 {"r1m3", "Judgement Call"},
2704 {"r1m4", "Cave of Death"},
2705 {"r1m5", "Towers of Wrath"},
2706 {"r1m6", "Temple of Pain"},
2707 {"r1m7", "Tomb of the Overlord"},
2708 {"r2m1", "Tempus Fugit"},
2709 {"r2m2", "Elemental Fury I"},
2710 {"r2m3", "Elemental Fury II"},
2711 {"r2m4", "Curse of Osiris"},
2712 {"r2m5", "Wizard's Keep"},
2713 {"r2m6", "Blood Sacrifice"},
2714 {"r2m7", "Last Bastion"},
2715 {"r2m8", "Source of Evil"},
2716 {"ctf1", "Division of Change"}
2726 episode_t episodes[] =
2728 {"Welcome to Quake", 0, 1},
2729 {"Doomed Dimension", 1, 8},
2730 {"Realm of Black Magic", 9, 7},
2731 {"Netherworld", 16, 7},
2732 {"The Elder World", 23, 8},
2733 {"Final Level", 31, 1},
2734 {"Deathmatch Arena", 32, 6}
2737 //MED 01/06/97 added hipnotic episodes
2738 episode_t hipnoticepisodes[] =
2740 {"Scourge of Armagon", 0, 1},
2741 {"Fortress of the Dead", 1, 5},
2742 {"Dominion of Darkness", 6, 6},
2743 {"The Rift", 12, 4},
2744 {"Final Level", 16, 1},
2745 {"Deathmatch Arena", 17, 1}
2748 //PGM 01/07/97 added rogue episodes
2749 //PGM 03/02/97 added dmatch episode
2750 episode_t rogueepisodes[] =
2752 {"Introduction", 0, 1},
2753 {"Hell's Fortress", 1, 7},
2754 {"Corridors of Time", 8, 8},
2755 {"Deathmatch Arena", 16, 1}
2758 level_t nehahralevels[] =
2760 {"nehstart", "Welcome to Nehahra"},
2761 {"neh1m1", "Forge City1: Slipgates"},
2762 {"neh1m2", "Forge City2: Boiler"},
2763 {"neh1m3", "Forge City3: Escape"},
2764 {"neh1m4", "Grind Core"},
2765 {"neh1m5", "Industrial Silence"},
2766 {"neh1m6", "Locked-Up Anger"},
2767 {"neh1m7", "Wanderer of the Wastes"},
2768 {"neh1m8", "Artemis System Net"},
2769 {"neh1m9", "To the Death"},
2770 {"neh2m1", "The Gates of Ghoro"},
2771 {"neh2m2", "Sacred Trinity"},
2772 {"neh2m3", "Realm of the Ancients"},
2773 {"neh2m4", "Temple of the Ancients"},
2774 {"neh2m5", "Dreams Made Flesh"},
2775 {"neh2m6", "Your Last Cup of Sorrow"},
2776 {"nehsec", "Ogre's Bane"},
2777 {"nehahra", "Nehahra's Den"},
2778 {"nehend", "Quintessence"}
2781 episode_t nehahraepisodes[] =
2783 {"Welcome to Nehahra", 0, 1},
2784 {"The Fall of Forge", 1, 9},
2785 {"The Outlands", 10, 7},
2786 {"Dimension of the Lost", 17, 2}
2792 qboolean m_serverInfoMessage = false;
2793 double m_serverInfoMessageTime;
2795 void M_Menu_GameOptions_f (void)
2797 key_dest = key_menu;
2798 m_state = m_gameoptions;
2799 m_entersound = true;
2800 if (maxplayers == 0)
2801 maxplayers = svs.maxclients;
2803 maxplayers = svs.maxclientslimit;
2807 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2808 #define NUM_GAMEOPTIONS 9
2809 int gameoptions_cursor;
2811 void M_GameOptions_Draw (void)
2816 M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
2817 p = Draw_CachePic ("gfx/p_multi.lmp");
2818 M_DrawPic ( (320-p->width)/2, 4, p);
2820 M_DrawTextBox (152, 32, 10, 1);
2821 M_Print (160, 40, "begin game");
2823 M_Print (0, 56, " Max players");
2824 M_Print (160, 56, va("%i", maxplayers) );
2826 M_Print (0, 64, " Game Type");
2827 if (!coop.value && !deathmatch.value)
2828 Cvar_SetValue("deathmatch", 1);
2830 M_Print (160, 64, "Cooperative");
2832 M_Print (160, 64, "Deathmatch");
2834 M_Print (0, 72, " Teamplay");
2839 switch((int)teamplay.value)
2841 case 1: msg = "No Friendly Fire"; break;
2842 case 2: msg = "Friendly Fire"; break;
2843 case 3: msg = "Tag"; break;
2844 case 4: msg = "Capture the Flag"; break;
2845 case 5: msg = "One Flag CTF"; break;
2846 case 6: msg = "Three Team CTF"; break;
2847 default: msg = "Off"; break;
2849 M_Print (160, 72, msg);
2855 switch((int)teamplay.value)
2857 case 1: msg = "No Friendly Fire"; break;
2858 case 2: msg = "Friendly Fire"; break;
2859 default: msg = "Off"; break;
2861 M_Print (160, 72, msg);
2864 M_Print (0, 80, " Skill");
2865 if (skill.value == 0)
2866 M_Print (160, 80, "Easy difficulty");
2867 else if (skill.value == 1)
2868 M_Print (160, 80, "Normal difficulty");
2869 else if (skill.value == 2)
2870 M_Print (160, 80, "Hard difficulty");
2872 M_Print (160, 80, "Nightmare difficulty");
2874 M_Print (0, 88, " Frag Limit");
2875 if (fraglimit.value == 0)
2876 M_Print (160, 88, "none");
2878 M_Print (160, 88, va("%i frags", (int)fraglimit.value));
2880 M_Print (0, 96, " Time Limit");
2881 if (timelimit.value == 0)
2882 M_Print (160, 96, "none");
2884 M_Print (160, 96, va("%i minutes", (int)timelimit.value));
2886 M_Print (0, 112, " Episode");
2887 //MED 01/06/97 added hipnotic episodes
2889 M_Print (160, 112, hipnoticepisodes[startepisode].description);
2890 //PGM 01/07/97 added rogue episodes
2892 M_Print (160, 112, rogueepisodes[startepisode].description);
2894 M_Print (160, 112, nehahraepisodes[startepisode].description);
2896 M_Print (160, 112, episodes[startepisode].description);
2898 M_Print (0, 120, " Level");
2899 //MED 01/06/97 added hipnotic episodes
2902 M_Print (160, 120, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].description);
2903 M_Print (160, 128, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name);
2905 //PGM 01/07/97 added rogue episodes
2908 M_Print (160, 120, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].description);
2909 M_Print (160, 128, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name);
2913 M_Print (160, 120, nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].description);
2914 M_Print (160, 128, nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].name);
2918 M_Print (160, 120, levels[episodes[startepisode].firstLevel + startlevel].description);
2919 M_Print (160, 128, levels[episodes[startepisode].firstLevel + startlevel].name);
2923 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2925 if (m_serverInfoMessage)
2927 if ((realtime - m_serverInfoMessageTime) < 5.0)
2930 M_DrawTextBox (x, 138, 24, 4);
2932 M_Print (x, 146, " More than 64 players?? ");
2933 M_Print (x, 154, " First, question your ");
2934 M_Print (x, 162, " sanity, then email ");
2935 M_Print (x, 170, " havoc@gamevisions.com ");
2937 M_Print (x, 146, " More than 4 players ");
2938 M_Print (x, 154, " requires using command ");
2939 M_Print (x, 162, "line parameters; please ");
2940 M_Print (x, 170, " see techinfo.txt. ");
2945 m_serverInfoMessage = false;
2951 void M_NetStart_Change (int dir)
2955 switch (gameoptions_cursor)
2959 if (maxplayers > svs.maxclientslimit)
2961 maxplayers = svs.maxclientslimit;
2962 m_serverInfoMessage = true;
2963 m_serverInfoMessageTime = realtime;
2970 if (deathmatch.value) // changing from deathmatch to coop
2972 Cvar_SetValue ("coop", 1);
2973 Cvar_SetValue ("deathmatch", 0);
2975 else // changing from coop to deathmatch
2977 Cvar_SetValue ("coop", 0);
2978 Cvar_SetValue ("deathmatch", 1);
2988 Cvar_SetValue ("teamplay", teamplay.value + dir);
2989 if (teamplay.value > count)
2990 Cvar_SetValue ("teamplay", 0);
2991 else if (teamplay.value < 0)
2992 Cvar_SetValue ("teamplay", count);
2996 Cvar_SetValue ("skill", skill.value + dir);
2997 if (skill.value > 3)
2998 Cvar_SetValue ("skill", 0);
2999 if (skill.value < 0)
3000 Cvar_SetValue ("skill", 3);
3004 Cvar_SetValue ("fraglimit", fraglimit.value + dir*10);
3005 if (fraglimit.value > 100)
3006 Cvar_SetValue ("fraglimit", 0);
3007 if (fraglimit.value < 0)
3008 Cvar_SetValue ("fraglimit", 100);
3012 Cvar_SetValue ("timelimit", timelimit.value + dir*5);
3013 if (timelimit.value > 60)
3014 Cvar_SetValue ("timelimit", 0);
3015 if (timelimit.value < 0)
3016 Cvar_SetValue ("timelimit", 60);
3020 startepisode += dir;
3021 //MED 01/06/97 added hipnotic count
3024 //PGM 01/07/97 added rogue count
3025 //PGM 03/02/97 added 1 for dmatch episode
3030 else if (registered.value)
3035 if (startepisode < 0)
3036 startepisode = count - 1;
3038 if (startepisode >= count)
3046 //MED 01/06/97 added hipnotic episodes
3048 count = hipnoticepisodes[startepisode].levels;
3049 //PGM 01/06/97 added hipnotic episodes
3051 count = rogueepisodes[startepisode].levels;
3053 count = nehahraepisodes[startepisode].levels;
3055 count = episodes[startepisode].levels;
3058 startlevel = count - 1;
3060 if (startlevel >= count)
3066 void M_GameOptions_Key (int key)
3075 S_LocalSound ("misc/menu1.wav");
3076 gameoptions_cursor--;
3077 if (gameoptions_cursor < 0)
3078 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3082 S_LocalSound ("misc/menu1.wav");
3083 gameoptions_cursor++;
3084 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3085 gameoptions_cursor = 0;
3089 if (gameoptions_cursor == 0)
3091 S_LocalSound ("misc/menu3.wav");
3092 M_NetStart_Change (-1);
3096 if (gameoptions_cursor == 0)
3098 S_LocalSound ("misc/menu3.wav");
3099 M_NetStart_Change (1);
3103 S_LocalSound ("misc/menu2.wav");
3104 if (gameoptions_cursor == 0)
3107 Cbuf_AddText ("disconnect\n");
3108 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
3109 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3110 SCR_BeginLoadingPlaque ();
3113 Cbuf_AddText ( va ("map %s\n", hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name) );
3115 Cbuf_AddText ( va ("map %s\n", roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name) );
3117 Cbuf_AddText ( va ("map %s\n", nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].name) );
3119 Cbuf_AddText ( va ("map %s\n", levels[episodes[startepisode].firstLevel + startlevel].name) );
3124 M_NetStart_Change (1);
3129 //=============================================================================
3132 qboolean searchComplete = false;
3133 double searchCompleteTime;
3135 void M_Menu_Search_f (void)
3137 key_dest = key_menu;
3139 m_entersound = false;
3142 searchComplete = false;
3148 void M_Search_Draw (void)
3153 p = Draw_CachePic ("gfx/p_multi.lmp");
3154 M_DrawPic ( (320-p->width)/2, 4, p);
3155 x = (320/2) - ((12*8)/2) + 4;
3156 M_DrawTextBox (x-8, 32, 12, 1);
3157 M_Print (x, 40, "Searching...");
3165 if (! searchComplete)
3167 searchComplete = true;
3168 searchCompleteTime = realtime;
3173 M_Menu_ServerList_f ();
3177 M_PrintWhite ((320/2) - ((22*8)/2), 64, "No Quake servers found");
3178 if ((realtime - searchCompleteTime) < 3.0)
3181 M_Menu_LanConfig_f ();
3185 void M_Search_Key (int key)
3189 //=============================================================================
3193 qboolean slist_sorted;
3195 void M_Menu_ServerList_f (void)
3197 key_dest = key_menu;
3199 m_entersound = true;
3201 m_return_onerror = false;
3202 m_return_reason[0] = 0;
3203 slist_sorted = false;
3207 void M_ServerList_Draw (void)
3215 if (hostCacheCount > 1)
3219 for (i = 0; i < hostCacheCount; i++)
3220 for (j = i+1; j < hostCacheCount; j++)
3221 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3223 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3224 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3225 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3228 slist_sorted = true;
3231 p = Draw_CachePic ("gfx/p_multi.lmp");
3232 M_DrawPic ( (320-p->width)/2, 4, p);
3233 for (n = 0; n < hostCacheCount; n++)
3235 if (hostcache[n].maxusers)
3236 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3238 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3239 M_Print (16, 32 + 8*n, string);
3241 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3243 if (*m_return_reason)
3244 M_PrintWhite (16, 148, m_return_reason);
3248 void M_ServerList_Key (int k)
3253 M_Menu_LanConfig_f ();
3262 S_LocalSound ("misc/menu1.wav");
3264 if (slist_cursor < 0)
3265 slist_cursor = hostCacheCount - 1;
3270 S_LocalSound ("misc/menu1.wav");
3272 if (slist_cursor >= hostCacheCount)
3277 S_LocalSound ("misc/menu2.wav");
3278 m_return_state = m_state;
3279 m_return_onerror = true;
3280 slist_sorted = false;
3281 key_dest = key_game;
3283 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3292 //=============================================================================
3293 /* Menu Subsystem */
3298 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3300 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3301 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3302 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3303 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3304 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3305 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3306 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3307 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3308 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3309 Cmd_AddCommand ("help", M_Menu_Help_f);
3310 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3314 if (COM_FileExists("maps/neh1m4.bsp"))
3316 if (COM_FileExists("hearing.dem"))
3318 Con_Printf("Nehahra movie and game detected.\n");
3319 NehGameType = TYPE_BOTH;
3323 Con_Printf("Nehahra game detected.\n");
3324 NehGameType = TYPE_GAME;
3329 if (COM_FileExists("hearing.dem"))
3331 Con_Printf("Nehahra movie detected.\n");
3332 NehGameType = TYPE_DEMO;
3336 Con_Printf("Nehahra not found.\n");
3337 NehGameType = TYPE_GAME; // could just complain, but...
3346 if (m_state == m_none || key_dest != key_menu)
3349 if (!m_recursiveDraw)
3351 scr_copyeverything = 1;
3353 if (scr_con_current)
3355 Draw_ConsoleBackground (vid.height);
3359 // Draw_FadeScreen ();
3365 m_recursiveDraw = false;
3381 case m_singleplayer:
3382 M_SinglePlayer_Draw ();
3394 M_MultiPlayer_Draw ();
3425 case m_serialconfig:
3426 M_SerialConfig_Draw ();
3430 M_ModemConfig_Draw ();
3434 M_LanConfig_Draw ();
3438 M_GameOptions_Draw ();
3446 M_ServerList_Draw ();
3452 S_LocalSound ("misc/menu2.wav");
3453 m_entersound = false;
3460 void M_Keydown (int key)
3475 case m_singleplayer:
3476 M_SinglePlayer_Key (key);
3488 M_MultiPlayer_Key (key);
3500 M_Options_Key (key);
3519 case m_serialconfig:
3520 M_SerialConfig_Key (key);
3524 M_ModemConfig_Key (key);
3528 M_LanConfig_Key (key);
3532 M_GameOptions_Key (key);
3540 M_ServerList_Key (key);
3546 void M_ConfigureNetSubsystem(void)
3548 // enable/disable net systems to match desired config
3550 Cbuf_AddText ("stopdemo\n");
3551 if (SerialConfig || DirectConfig)
3553 Cbuf_AddText ("com1 enable\n");
3556 if (IPXConfig || TCPIPConfig)
3557 net_hostport = lanConfig_port;