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_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_LanConfig_f (void);
50 void M_Menu_GameOptions_f (void);
51 void M_Menu_Search_f (void);
52 void M_Menu_ServerList_f (void);
54 void M_Main_Draw (void);
55 void M_SinglePlayer_Draw (void);
56 void M_Load_Draw (void);
57 void M_Save_Draw (void);
58 void M_MultiPlayer_Draw (void);
59 void M_Setup_Draw (void);
60 void M_Net_Draw (void);
61 void M_Options_Draw (void);
62 void M_Keys_Draw (void);
63 void M_Video_Draw (void);
64 void M_Help_Draw (void);
65 void M_Quit_Draw (void);
66 void M_LanConfig_Draw (void);
67 void M_GameOptions_Draw (void);
68 void M_Search_Draw (void);
69 void M_ServerList_Draw (void);
71 void M_Main_Key (int key);
72 void M_SinglePlayer_Key (int key);
73 void M_Load_Key (int key);
74 void M_Save_Key (int key);
75 void M_MultiPlayer_Key (int key);
76 void M_Setup_Key (int key);
77 void M_Net_Key (int key);
78 void M_Options_Key (int key);
79 void M_Keys_Key (int key);
80 void M_Video_Key (int key);
81 void M_Help_Key (int key);
82 void M_Quit_Key (int key);
83 void M_LanConfig_Key (int key);
84 void M_GameOptions_Key (int key);
85 void M_Search_Key (int key);
86 void M_ServerList_Key (int key);
88 qboolean m_entersound; // play after drawing a frame, so caching
89 // won't disrupt the sound
92 qboolean m_return_onerror;
93 char m_return_reason [32];
95 #define StartingGame (m_multiplayer_cursor == 1)
96 #define JoiningGame (m_multiplayer_cursor == 0)
97 #define IPXConfig (m_net_cursor == 0)
98 #define TCPIPConfig (m_net_cursor == 1)
100 void M_ConfigureNetSubsystem(void);
110 demonames_t Demos[35];
112 float menu_x, menu_y, menu_width, menu_height;
114 void M_DrawBackground(void)
118 menu_x = (vid.conwidth - menu_width) * 0.5;
119 menu_y = (vid.conheight - menu_height) * 0.5;
120 DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
127 Draws one solid graphics character
130 void M_DrawCharacter (float cx, float cy, int num)
135 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
138 void M_Print (float cx, float cy, char *str)
143 M_DrawCharacter (cx, cy, (*str++)+128);
147 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
150 void M_PrintWhite (float cx, float cy, char *str)
152 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
155 void M_DrawPic (float cx, float cy, char *picname)
157 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
160 byte identityTable[256];
161 byte translationTable[256];
163 void M_BuildTranslationTable(int top, int bottom)
168 for (j = 0; j < 256; j++)
169 identityTable[j] = j;
170 dest = translationTable;
171 source = identityTable;
172 memcpy (dest, source, 256);
174 // LordHavoc: corrected skin color ranges
175 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
176 memcpy (dest + TOP_RANGE, source + top, 16);
178 for (j=0 ; j<16 ; j++)
179 dest[TOP_RANGE+j] = source[top+15-j];
181 // LordHavoc: corrected skin color ranges
182 if (bottom < 128 || (bottom >= 224 && bottom < 240))
183 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
185 for (j=0 ; j<16 ; j++)
186 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
190 void M_DrawPicTranslate (float cx, float cy, char *picname)
192 DrawQ_PicTranslate (menu_x + cx, menu_y + cy, picname, translationTable);
196 void M_DrawTextBox (float x, float y, float width, float height)
204 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
205 for (n = 0; n < height; n++)
208 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
210 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
217 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
218 for (n = 0; n < height; n++)
222 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
224 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
226 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
233 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
234 for (n = 0; n < height; n++)
237 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
239 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
242 //=============================================================================
251 void M_ToggleMenu_f (void)
255 if (key_dest == key_menu)
257 if (m_state != m_main)
266 if (key_dest == key_console)
268 Con_ToggleConsole_f ();
276 // LordHavoc: FIXME: finish this menu stuff
278 #define MAXMENUITEMS 128
280 typedef struct menuitem_s
282 char *string; // may be text, or an image to use, or a cvar name, depending on the functions used
284 char *command; // used by command items mainly (when used, this command is executed)
285 cvar_t *cvar; // used for cvar items (sliders, number boxes), value is retrieved from the cvar itself
286 int selectable; // purely decorative if this is false
287 int selected; // true if this menu item is currently selected, used by funcs so they don't need to know anything but fields in the menuitem
288 float selecttime; // the time that this menu item was activated (copied from realtime), used for animating selection flashs and such
289 float color[4]; // current color for the item (may be different than base color, due to selection flash effects)
290 float basecolor[4]; // the base color
291 float x, y, width, height; // width and height are used for mouse selection
292 void(*drawfunc)(struct menuitem_s *item);
293 void(*activefunc)(struct menuitem_s *item);
294 // void(*selectfunc)(struct menuitem_s *item);
295 // void(*deselectfunc)(struct menuitem_s *item);
296 void(*usefunc)(struct menuitem_s *item);
300 menuitem_t menuitem[MAXMENUITEMS];
303 void menuitem_text_drawfunc(struct menuitem_s *item)
305 // FIXME: handle color flashs and such when selected
306 M_Print (item->x, item->y, item->string);
309 void menuitem_image_drawfunc(struct menuitem_s *item)
311 // FIXME: handle color flashs and such when selected
312 M_DrawPic (item->x, item->y, item->string);
315 void menuitem_command_usefunc(struct menuitem_s *item)
317 Cbuf_AddText (item->command);
322 void M_Demo_Draw (void)
326 for (i=0; i < NumberOfDemos; i++)
327 M_Print (16, 16 + 8*i, Demos[i].desc);
330 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
334 void M_Menu_Demos_f (void)
343 strcpy(Demos[0].name, "intro"); strcpy(Demos[0].desc, "Prologue");
344 strcpy(Demos[1].name, "genf"); strcpy(Demos[1].desc, "The Beginning");
345 strcpy(Demos[2].name, "genlab"); strcpy(Demos[2].desc, "A Doomed Project");
346 strcpy(Demos[3].name, "nehcre"); strcpy(Demos[3].desc, "The New Recruits");
347 strcpy(Demos[4].name, "maxneh"); strcpy(Demos[4].desc, "Breakthrough");
348 strcpy(Demos[5].name, "maxchar"); strcpy(Demos[5].desc, "Renewal and Duty");
349 strcpy(Demos[6].name, "crisis"); strcpy(Demos[6].desc, "Worlds Collide");
350 strcpy(Demos[7].name, "postcris"); strcpy(Demos[7].desc, "Darkening Skies");
351 strcpy(Demos[8].name, "hearing"); strcpy(Demos[8].desc, "The Hearing");
352 strcpy(Demos[9].name, "getjack"); strcpy(Demos[9].desc, "On a Mexican Radio");
353 strcpy(Demos[10].name, "prelude"); strcpy(Demos[10].desc, "Honor and Justice");
354 strcpy(Demos[11].name, "abase"); strcpy(Demos[11].desc, "A Message Sent");
355 strcpy(Demos[12].name, "effect"); strcpy(Demos[12].desc, "The Other Side");
356 strcpy(Demos[13].name, "uhoh"); strcpy(Demos[13].desc, "Missing in Action");
357 strcpy(Demos[14].name, "prepare"); strcpy(Demos[14].desc, "The Response");
358 strcpy(Demos[15].name, "vision"); strcpy(Demos[15].desc, "Farsighted Eyes");
359 strcpy(Demos[16].name, "maxturns"); strcpy(Demos[16].desc, "Enter the Immortal");
360 strcpy(Demos[17].name, "backlot"); strcpy(Demos[17].desc, "Separate Ways");
361 strcpy(Demos[18].name, "maxside"); strcpy(Demos[18].desc, "The Ancient Runes");
362 strcpy(Demos[19].name, "counter"); strcpy(Demos[19].desc, "The New Initiative");
363 strcpy(Demos[20].name, "warprep"); strcpy(Demos[20].desc, "Ghosts to the World");
364 strcpy(Demos[21].name, "counter1"); strcpy(Demos[21].desc, "A Fate Worse Than Death");
365 strcpy(Demos[22].name, "counter2"); strcpy(Demos[22].desc, "Friendly Fire");
366 strcpy(Demos[23].name, "counter3"); strcpy(Demos[23].desc, "Minor Setback");
367 strcpy(Demos[24].name, "madmax"); strcpy(Demos[24].desc, "Scores to Settle");
368 strcpy(Demos[25].name, "quake"); strcpy(Demos[25].desc, "One Man");
369 strcpy(Demos[26].name, "cthmm"); strcpy(Demos[26].desc, "Shattered Masks");
370 strcpy(Demos[27].name, "shades"); strcpy(Demos[27].desc, "Deal with the Dead");
371 strcpy(Demos[28].name, "gophil"); strcpy(Demos[28].desc, "An Unlikely Hero");
372 strcpy(Demos[29].name, "cstrike"); strcpy(Demos[29].desc, "War in Hell");
373 strcpy(Demos[30].name, "shubset"); strcpy(Demos[30].desc, "The Conspiracy");
374 strcpy(Demos[31].name, "shubdie"); strcpy(Demos[31].desc, "Even Death May Die");
375 strcpy(Demos[32].name, "newranks"); strcpy(Demos[32].desc, "An Empty Throne");
376 strcpy(Demos[33].name, "seal"); strcpy(Demos[33].desc, "The Seal is Broken");
379 void M_Demo_Key (int k)
388 S_LocalSound ("misc/menu2.wav");
391 // SCR_BeginLoadingPlaque ();
392 Cbuf_AddText (va ("playdemo %s\n", Demos[demo_cursor].name));
397 S_LocalSound ("misc/menu1.wav");
400 demo_cursor = NumberOfDemos;
405 S_LocalSound ("misc/menu1.wav");
407 if (demo_cursor > NumberOfDemos)
413 //=============================================================================
417 //#define MAIN_ITEMS 5
419 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
421 void M_Menu_Main_f (void)
423 if (gamemode == GAME_NEHAHRA)
425 if (NehGameType == TYPE_DEMO)
427 else if (NehGameType == TYPE_GAME)
435 if (key_dest != key_menu)
437 m_save_demonum = cls.demonum;
446 void M_Main_Draw (void)
451 M_DrawPic (16, 4, "gfx/qplaque.lmp");
452 p = Draw_CachePic ("gfx/ttl_main.lmp");
453 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
455 if (gamemode == GAME_NEHAHRA)
457 if (NehGameType == TYPE_BOTH)
458 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
459 else if (NehGameType == TYPE_GAME)
460 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
462 M_DrawPic (72, 32, "gfx/demomenu.lmp");
465 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
467 f = (int)(realtime * 10)%6;
469 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
473 void M_Main_Key (int key)
480 cls.demonum = m_save_demonum;
481 if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
486 S_LocalSound ("misc/menu1.wav");
487 if (++m_main_cursor >= MAIN_ITEMS)
492 S_LocalSound ("misc/menu1.wav");
493 if (--m_main_cursor < 0)
494 m_main_cursor = MAIN_ITEMS - 1;
500 if (gamemode == GAME_NEHAHRA)
505 switch (m_main_cursor)
508 M_Menu_SinglePlayer_f ();
516 M_Menu_MultiPlayer_f ();
526 Cbuf_AddText ("disconnect\n");
527 Cbuf_AddText ("playdemo endcred\n");
536 switch (m_main_cursor)
539 M_Menu_SinglePlayer_f ();
543 M_Menu_MultiPlayer_f ();
553 Cbuf_AddText ("disconnect\n");
554 Cbuf_AddText ("playdemo endcred\n");
563 switch (m_main_cursor)
572 Cbuf_AddText ("disconnect\n");
573 Cbuf_AddText ("playdemo endcred\n");
589 switch (m_main_cursor)
592 M_Menu_SinglePlayer_f ();
596 M_Menu_MultiPlayer_f ();
615 //=============================================================================
616 /* SINGLE PLAYER MENU */
618 int m_singleplayer_cursor;
619 #define SINGLEPLAYER_ITEMS 3
622 void M_Menu_SinglePlayer_f (void)
625 m_state = m_singleplayer;
630 void M_SinglePlayer_Draw (void)
635 M_DrawPic (16, 4, "gfx/qplaque.lmp");
636 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
637 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
638 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
640 f = (int)(realtime * 10)%6;
642 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
646 void M_SinglePlayer_Key (int key)
655 S_LocalSound ("misc/menu1.wav");
656 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
657 m_singleplayer_cursor = 0;
661 S_LocalSound ("misc/menu1.wav");
662 if (--m_singleplayer_cursor < 0)
663 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
669 switch (m_singleplayer_cursor)
674 Cbuf_AddText ("disconnect\n");
675 Cbuf_AddText ("maxplayers 1\n");
676 if (gamemode == GAME_NEHAHRA)
677 Cbuf_AddText ("map nehstart\n");
679 Cbuf_AddText ("map start\n");
693 //=============================================================================
696 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
698 #define MAX_SAVEGAMES 12
699 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
700 int loadable[MAX_SAVEGAMES];
702 void M_ScanSaves (void)
705 char name[MAX_OSPATH];
710 for (i=0 ; i<MAX_SAVEGAMES ; i++)
712 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
714 sprintf (name, "%s/s%i.sav", com_gamedir, i);
715 f = Qopen (name, "rz");
719 sscanf (str, "%i\n", &version);
721 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
723 // change _ back to space
724 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
725 if (m_filenames[i][j] == '_')
726 m_filenames[i][j] = ' ';
732 void M_Menu_Load_f (void)
741 void M_Menu_Save_f (void)
747 if (svs.maxclients != 1)
756 void M_Load_Draw (void)
761 p = Draw_CachePic ("gfx/p_load.lmp");
762 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
764 for (i=0 ; i< MAX_SAVEGAMES; i++)
765 M_Print (16, 32 + 8*i, m_filenames[i]);
768 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
772 void M_Save_Draw (void)
777 p = Draw_CachePic ("gfx/p_save.lmp");
778 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
780 for (i=0 ; i<MAX_SAVEGAMES ; i++)
781 M_Print (16, 32 + 8*i, m_filenames[i]);
784 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
788 void M_Load_Key (int k)
793 M_Menu_SinglePlayer_f ();
797 S_LocalSound ("misc/menu2.wav");
798 if (!loadable[load_cursor])
803 // LordHavoc: made SCR_UpdateScreen use a great deal less stack space, no longer an issue
804 //// Host_Loadgame_f can't bring up the loading plaque because too much
805 //// stack space has been used, so do it now
806 //// SCR_BeginLoadingPlaque ();
808 // issue the load command
809 Cbuf_AddText (va ("load 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)
831 void M_Save_Key (int k)
836 M_Menu_SinglePlayer_f ();
842 Cbuf_AddText (va("save s%i\n", load_cursor));
847 S_LocalSound ("misc/menu1.wav");
850 load_cursor = MAX_SAVEGAMES-1;
855 S_LocalSound ("misc/menu1.wav");
857 if (load_cursor >= MAX_SAVEGAMES)
863 //=============================================================================
864 /* MULTIPLAYER MENU */
866 int m_multiplayer_cursor;
867 #define MULTIPLAYER_ITEMS 3
870 void M_Menu_MultiPlayer_f (void)
873 m_state = m_multiplayer;
878 void M_MultiPlayer_Draw (void)
883 M_DrawPic (16, 4, "gfx/qplaque.lmp");
884 p = Draw_CachePic ("gfx/p_multi.lmp");
885 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
886 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
888 f = (int)(realtime * 10)%6;
890 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
892 if (ipxAvailable || tcpipAvailable)
894 M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
898 void M_MultiPlayer_Key (int key)
907 S_LocalSound ("misc/menu1.wav");
908 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
909 m_multiplayer_cursor = 0;
913 S_LocalSound ("misc/menu1.wav");
914 if (--m_multiplayer_cursor < 0)
915 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
920 switch (m_multiplayer_cursor)
923 if (ipxAvailable || tcpipAvailable)
928 if (ipxAvailable || tcpipAvailable)
939 //=============================================================================
942 int setup_cursor = 4;
943 int setup_cursor_table[] = {40, 56, 80, 104, 140};
945 char setup_hostname[16];
946 char setup_myname[16];
952 #define NUM_SETUP_CMDS 5
954 void M_Menu_Setup_f (void)
959 strcpy(setup_myname, cl_name.string);
960 strcpy(setup_hostname, hostname.string);
961 setup_top = setup_oldtop = cl_color.integer >> 4;
962 setup_bottom = setup_oldbottom = cl_color.integer & 15;
966 void M_Setup_Draw (void)
970 M_DrawPic (16, 4, "gfx/qplaque.lmp");
971 p = Draw_CachePic ("gfx/p_multi.lmp");
972 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
974 M_Print (64, 40, "Hostname");
975 M_DrawTextBox (160, 32, 16, 1);
976 M_Print (168, 40, setup_hostname);
978 M_Print (64, 56, "Your name");
979 M_DrawTextBox (160, 48, 16, 1);
980 M_Print (168, 56, setup_myname);
982 M_Print (64, 80, "Shirt color");
983 M_Print (64, 104, "Pants color");
985 M_DrawTextBox (64, 140-8, 14, 1);
986 M_Print (72, 140, "Accept Changes");
988 M_DrawPic (160, 64, "gfx/bigbox.lmp");
989 M_BuildTranslationTable(setup_top*16, setup_bottom*16);
990 M_DrawPicTranslate (172, 72, "gfx/menuplyr.lmp");
992 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
994 if (setup_cursor == 0)
995 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
997 if (setup_cursor == 1)
998 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1002 void M_Setup_Key (int k)
1009 M_Menu_MultiPlayer_f ();
1013 S_LocalSound ("misc/menu1.wav");
1015 if (setup_cursor < 0)
1016 setup_cursor = NUM_SETUP_CMDS-1;
1020 S_LocalSound ("misc/menu1.wav");
1022 if (setup_cursor >= NUM_SETUP_CMDS)
1027 if (setup_cursor < 2)
1029 S_LocalSound ("misc/menu3.wav");
1030 if (setup_cursor == 2)
1031 setup_top = setup_top - 1;
1032 if (setup_cursor == 3)
1033 setup_bottom = setup_bottom - 1;
1036 if (setup_cursor < 2)
1039 S_LocalSound ("misc/menu3.wav");
1040 if (setup_cursor == 2)
1041 setup_top = setup_top + 1;
1042 if (setup_cursor == 3)
1043 setup_bottom = setup_bottom + 1;
1047 if (setup_cursor == 0 || setup_cursor == 1)
1050 if (setup_cursor == 2 || setup_cursor == 3)
1053 // setup_cursor == 4 (OK)
1054 if (strcmp(cl_name.string, setup_myname) != 0)
1055 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1056 if (strcmp(hostname.string, setup_hostname) != 0)
1057 Cvar_Set("hostname", setup_hostname);
1058 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1059 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1060 m_entersound = true;
1061 M_Menu_MultiPlayer_f ();
1065 if (setup_cursor == 0)
1067 if (strlen(setup_hostname))
1068 setup_hostname[strlen(setup_hostname)-1] = 0;
1071 if (setup_cursor == 1)
1073 if (strlen(setup_myname))
1074 setup_myname[strlen(setup_myname)-1] = 0;
1079 if (k < 32 || k > 127)
1081 if (setup_cursor == 0)
1083 l = strlen(setup_hostname);
1086 setup_hostname[l+1] = 0;
1087 setup_hostname[l] = k;
1090 if (setup_cursor == 1)
1092 l = strlen(setup_myname);
1095 setup_myname[l+1] = 0;
1096 setup_myname[l] = k;
1105 if (setup_bottom > 13)
1107 if (setup_bottom < 0)
1111 //=============================================================================
1116 int m_net_saveHeight;
1118 char *net_helpMessage [] =
1120 /* .........1.........2.... */
1121 " Novell network LANs ",
1122 " or Windows 95 DOS-box. ",
1124 "(LAN=Local Area Network)",
1126 " Commonly used to play ",
1127 " over the Internet, but ",
1128 " also used on a Local ",
1132 void M_Menu_Net_f (void)
1134 key_dest = key_menu;
1136 m_entersound = true;
1139 if (m_net_cursor >= m_net_items)
1142 M_Net_Key (K_DOWNARROW);
1146 void M_Net_Draw (void)
1151 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1152 p = Draw_CachePic ("gfx/p_multi.lmp");
1153 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1158 M_DrawPic (72, f, "gfx/netmen3.lmp");
1160 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1164 M_DrawPic (72, f, "gfx/netmen4.lmp");
1166 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1168 if (m_net_items == 5) // JDC, could just be removed
1171 M_DrawPic (72, f, "gfx/netmen5.lmp");
1175 M_DrawTextBox (f, 134, 24, 4);
1177 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1178 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1180 f = (int)(realtime * 10)%6;
1181 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1185 void M_Net_Key (int k)
1191 M_Menu_MultiPlayer_f ();
1195 S_LocalSound ("misc/menu1.wav");
1196 if (++m_net_cursor >= m_net_items)
1201 S_LocalSound ("misc/menu1.wav");
1202 if (--m_net_cursor < 0)
1203 m_net_cursor = m_net_items - 1;
1207 m_entersound = true;
1209 switch (m_net_cursor)
1212 M_Menu_LanConfig_f ();
1216 M_Menu_LanConfig_f ();
1225 if (m_net_cursor == 0 && !ipxAvailable)
1227 if (m_net_cursor == 1 && !tcpipAvailable)
1231 //=============================================================================
1234 #define OPTIONS_ITEMS (vid_menudrawfn ? 25 : 24)
1236 #define SLIDER_RANGE 10
1240 void M_Menu_Options_f (void)
1242 key_dest = key_menu;
1243 m_state = m_options;
1244 m_entersound = true;
1248 void M_AdjustSliders (int dir)
1250 S_LocalSound ("misc/menu3.wav");
1252 switch (options_cursor)
1254 case 3: // screen size
1255 Cvar_SetValue ("viewsize", bound(30, scr_viewsize.value + dir * 10, 120));
1258 Cvar_SetValue ("r_ser", !r_ser.integer);
1261 case 5: // overbright rendering
1262 Cvar_SetValue ("gl_lightmode", !gl_lightmode.integer);
1265 case 6: // dithering
1266 Cvar_SetValue ("gl_dither", !gl_dither.integer);
1269 case 7: // sky quality
1270 Cvar_SetValue ("r_skyquality", bound(0, r_skyquality.integer + dir, 2));
1273 case 8: // hardware gamma
1274 Cvar_SetValue ("vid_gamma", bound(1, vid_gamma.value + dir * 0.25, 5));
1277 case 9: // hardware brightness
1278 Cvar_SetValue ("vid_brightness", bound(1, vid_brightness.value + dir * 0.25, 5));
1281 case 10: // hardware contrast
1282 Cvar_SetValue ("vid_contrast", bound(0.2, vid_contrast.value + dir * 0.08, 1));
1285 case 11: // software brightness
1286 Cvar_SetValue ("r_brightness", bound(1, r_brightness.value + dir * 0.25, 5));
1289 case 12: // software base brightness
1290 Cvar_SetValue ("r_contrast", bound(0.2, r_contrast.value + dir * 0.08, 1));
1293 case 13: // music volume
1295 Cvar_SetValue ("bgmvolume", bound(0, bgmvolume.value + dir * 1.0, 1));
1297 Cvar_SetValue ("bgmvolume", bound(0, bgmvolume.value + dir * 0.1, 1));
1301 case 14: // sfx volume
1302 Cvar_SetValue ("volume", bound(0, volume.value + dir * 0.1, 1));
1305 case 15: // always run
1306 if (cl_forwardspeed.value > 200)
1308 Cvar_SetValue ("cl_forwardspeed", 200);
1309 Cvar_SetValue ("cl_backspeed", 200);
1313 Cvar_SetValue ("cl_forwardspeed", 400);
1314 Cvar_SetValue ("cl_backspeed", 400);
1318 case 16: // lookspring
1319 Cvar_SetValue ("lookspring", !lookspring.integer);
1322 case 17: // lookstrafe
1323 Cvar_SetValue ("lookstrafe", !lookstrafe.integer);
1326 case 18: // mouse speed
1327 Cvar_SetValue ("sensitivity", bound(1, sensitivity.value + dir * 0.5, 50));
1330 case 19: // mouse look
1331 Cvar_SetValue ("freelook", !freelook.integer);
1334 case 20: // invert mouse
1335 Cvar_SetValue ("m_pitch", -m_pitch.value);
1338 case 21: // windowed mouse
1339 Cvar_SetValue ("vid_mouse", !vid_mouse.integer);
1343 Cvar_SetValue ("crosshair", bound(0, crosshair.integer + dir, 5));
1346 case 23: // show framerate
1347 Cvar_SetValue ("showfps", !showfps.integer);
1353 void M_DrawSlider (int x, int y, float range)
1361 M_DrawCharacter (x-8, y, 128);
1362 for (i=0 ; i<SLIDER_RANGE ; i++)
1363 M_DrawCharacter (x + i*8, y, 129);
1364 M_DrawCharacter (x+i*8, y, 130);
1365 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1368 void M_DrawCheckbox (int x, int y, int on)
1372 M_DrawCharacter (x, y, 131);
1374 M_DrawCharacter (x, y, 129);
1377 M_Print (x, y, "on");
1379 M_Print (x, y, "off");
1382 void M_Options_Draw (void)
1387 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1388 p = Draw_CachePic("gfx/p_option.lmp");
1389 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1392 M_Print(16, y, " Customize controls");y += 8;
1393 M_Print(16, y, " Go to console");y += 8;
1394 M_Print(16, y, " Reset to defaults");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, "Hidden Surface Removal");M_DrawCheckbox(220, y, r_ser.integer);y += 8;
1397 M_Print(16, y, " Overbright Rendering");M_DrawCheckbox(220, y, gl_lightmode.integer);y += 8;
1398 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1399 M_Print(16, y, " Sky Quality");M_DrawSlider(220, y, r_skyquality.value / 2);y += 8;
1400 M_Print(16, y, " Hardware Gamma");M_DrawSlider(220, y, (vid_gamma.value - 1) / 4);y += 8;
1401 M_Print(16, y, " Hardware Brightness");M_DrawSlider(220, y, (vid_brightness.value - 1) / 4);y += 8;
1402 M_Print(16, y, " Hardware Contrast");M_DrawSlider(220, y, (vid_contrast.value - 0.2) / 0.8);y += 8;
1403 M_Print(16, y, " Software Brightness");M_DrawSlider(220, y, (r_brightness.value - 1) / 4);y += 8;
1404 M_Print(16, y, " Software Contrast");M_DrawSlider(220, y, (r_contrast.value - 0.2) / 0.8);y += 8;
1405 M_Print(16, y, " CD Music Volume");M_DrawSlider(220, y, bgmvolume.value);y += 8;
1406 M_Print(16, y, " Sound Volume");M_DrawSlider(220, y, volume.value);y += 8;
1407 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1408 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1409 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1410 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, (sensitivity.value - 1)/50);y += 8;
1411 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1412 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1413 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1414 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
1415 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1417 M_Print(16, y, " Video Options");
1421 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1425 void M_Options_Key (int k)
1434 m_entersound = true;
1435 switch (options_cursor)
1442 Con_ToggleConsole_f ();
1445 Cbuf_AddText ("exec default.cfg\n");
1448 // this is really just another case, but since it is calculated...
1449 if (vid_menudrawfn && options_cursor == (OPTIONS_ITEMS - 1))
1452 M_AdjustSliders (1);
1458 S_LocalSound ("misc/menu1.wav");
1460 if (options_cursor < 0)
1461 options_cursor = OPTIONS_ITEMS-1;
1465 S_LocalSound ("misc/menu1.wav");
1467 if (options_cursor >= OPTIONS_ITEMS)
1472 M_AdjustSliders (-1);
1476 M_AdjustSliders (1);
1481 //=============================================================================
1484 char *bindnames[][2] =
1486 {"+attack", "attack"},
1487 {"impulse 10", "change weapon"},
1488 {"+jump", "jump / swim up"},
1489 {"+forward", "walk forward"},
1490 {"+back", "backpedal"},
1491 {"+left", "turn left"},
1492 {"+right", "turn right"},
1494 {"+moveleft", "step left"},
1495 {"+moveright", "step right"},
1496 {"+strafe", "sidestep"},
1497 {"+lookup", "look up"},
1498 {"+lookdown", "look down"},
1499 {"centerview", "center view"},
1500 {"+mlook", "mouse look"},
1501 {"+klook", "keyboard look"},
1502 {"+moveup", "swim up"},
1503 {"+movedown", "swim down"}
1506 #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
1511 void M_Menu_Keys_f (void)
1513 key_dest = key_menu;
1515 m_entersound = true;
1519 void M_FindKeysForCommand (char *command, int *twokeys)
1526 twokeys[0] = twokeys[1] = -1;
1527 l = strlen(command);
1530 for (j=0 ; j<256 ; j++)
1535 if (!strncmp (b, command, l) )
1545 void M_UnbindCommand (char *command)
1551 l = strlen(command);
1553 for (j=0 ; j<256 ; j++)
1558 if (!strncmp (b, command, l) )
1559 Key_SetBinding (j, "");
1564 void M_Keys_Draw (void)
1572 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1573 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1576 M_Print (12, 32, "Press a key or button for this action");
1578 M_Print (18, 32, "Enter to change, backspace to clear");
1580 // search for known bindings
1581 for (i=0 ; i<NUMCOMMANDS ; i++)
1585 M_Print (16, y, bindnames[i][1]);
1587 l = strlen (bindnames[i][0]);
1589 M_FindKeysForCommand (bindnames[i][0], keys);
1593 M_Print (140, y, "???");
1597 name = Key_KeynumToString (keys[0]);
1598 M_Print (140, y, name);
1599 x = strlen(name) * 8;
1602 M_Print (140 + x + 8, y, "or");
1603 M_Print (140 + x + 32, y, Key_KeynumToString (keys[1]));
1609 M_DrawCharacter (130, 48 + keys_cursor*8, '=');
1611 M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1615 void M_Keys_Key (int k)
1622 S_LocalSound ("misc/menu1.wav");
1629 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1630 Cbuf_InsertText (cmd);
1640 M_Menu_Options_f ();
1645 S_LocalSound ("misc/menu1.wav");
1647 if (keys_cursor < 0)
1648 keys_cursor = NUMCOMMANDS-1;
1653 S_LocalSound ("misc/menu1.wav");
1655 if (keys_cursor >= NUMCOMMANDS)
1659 case K_ENTER: // go into bind mode
1660 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1661 S_LocalSound ("misc/menu2.wav");
1663 M_UnbindCommand (bindnames[keys_cursor][0]);
1667 case K_BACKSPACE: // delete bindings
1668 case K_DEL: // delete bindings
1669 S_LocalSound ("misc/menu2.wav");
1670 M_UnbindCommand (bindnames[keys_cursor][0]);
1675 //=============================================================================
1678 void M_Menu_Video_f (void)
1680 key_dest = key_menu;
1682 m_entersound = true;
1686 void M_Video_Draw (void)
1688 (*vid_menudrawfn) ();
1692 void M_Video_Key (int key)
1694 (*vid_menukeyfn) (key);
1697 //=============================================================================
1701 #define NUM_HELP_PAGES 6
1704 void M_Menu_Help_f (void)
1706 key_dest = key_menu;
1708 m_entersound = true;
1714 void M_Help_Draw (void)
1716 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
1720 void M_Help_Key (int key)
1730 m_entersound = true;
1731 if (++help_page >= NUM_HELP_PAGES)
1737 m_entersound = true;
1738 if (--help_page < 0)
1739 help_page = NUM_HELP_PAGES-1;
1745 //=============================================================================
1749 int m_quit_prevstate;
1750 qboolean wasInMenus;
1753 char *quitMessage [] =
1755 /* .........1.........2.... */
1757 " Are you gonna quit ",
1758 " this game just like ",
1759 " everything else? ",
1762 " Milord, methinks that ",
1763 " thou art a lowly ",
1764 " quitter. Is this true? ",
1767 " Do I need to bust your ",
1768 " face open for trying ",
1772 " Man, I oughta smack you",
1773 " for trying to quit! ",
1777 " Press Y to quit like a ",
1778 " big loser in life. ",
1779 " Press N to stay proud ",
1780 " and successful! ",
1782 " If you press Y to ",
1783 " quit, I will summon ",
1784 " Satan all over your ",
1787 " Um, Asmodeus dislikes ",
1788 " his children trying to ",
1789 " quit. Press Y to return",
1790 " to your Tinkertoys. ",
1792 " If you quit now, I'll ",
1793 " throw a blanket-party ",
1794 " for you next time! ",
1798 /* .........1.........2.... */
1800 " Tired of fragging ",
1805 " Quit now and forfeit ",
1806 " your bodycount? ",
1810 " Are you sure you ",
1815 " Off to do something ",
1821 void M_Menu_Quit_f (void)
1823 if (m_state == m_quit)
1825 wasInMenus = (key_dest == key_menu);
1826 key_dest = key_menu;
1827 m_quit_prevstate = m_state;
1829 m_entersound = true;
1830 msgNumber = rand()&3; //&7;
1834 void M_Quit_Key (int key)
1843 m_state = m_quit_prevstate;
1844 m_entersound = true;
1848 key_dest = key_game;
1855 key_dest = key_console;
1866 void M_Quit_Draw (void)
1870 M_DrawTextBox (0, 0, 38, 23);
1871 M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n");
1872 M_PrintWhite (16, 28, "Programming Art \n");
1873 M_Print (16, 36, " John Carmack Adrian Carmack\n");
1874 M_Print (16, 44, " Michael Abrash Kevin Cloud\n");
1875 M_Print (16, 52, " John Cash Paul Steed\n");
1876 M_Print (16, 60, " Dave 'Zoid' Kirsch\n");
1877 M_PrintWhite (16, 68, "Design Biz\n");
1878 M_Print (16, 76, " John Romero Jay Wilbur\n");
1879 M_Print (16, 84, " Sandy Petersen Mike Wilson\n");
1880 M_Print (16, 92, " American McGee Donna Jackson\n");
1881 M_Print (16, 100, " Tim Willits Todd Hollenshead\n");
1882 M_PrintWhite (16, 108, "Support Projects\n");
1883 M_Print (16, 116, " Barrett Alexander Shawn Green\n");
1884 M_PrintWhite (16, 124, "Sound Effects\n");
1885 M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n");
1886 M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n");
1887 M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n");
1888 M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n");
1889 M_PrintWhite (16, 164, "registered trademark licensed to\n");
1890 M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n");
1891 M_PrintWhite (16, 180, "reserved. Press y to exit\n");
1894 M_DrawTextBox (56, 76, 24, 4);
1895 M_Print (64, 84, quitMessage[msgNumber*4+0]);
1896 M_Print (64, 92, quitMessage[msgNumber*4+1]);
1897 M_Print (64, 100, quitMessage[msgNumber*4+2]);
1898 M_Print (64, 108, quitMessage[msgNumber*4+3]);
1902 //=============================================================================
1903 /* LAN CONFIG MENU */
1905 int lanConfig_cursor = -1;
1906 int lanConfig_cursor_table [] = {72, 92, 124};
1907 #define NUM_LANCONFIG_CMDS 3
1910 char lanConfig_portname[6];
1911 char lanConfig_joinname[22];
1913 void M_Menu_LanConfig_f (void)
1915 key_dest = key_menu;
1916 m_state = m_lanconfig;
1917 m_entersound = true;
1918 if (lanConfig_cursor == -1)
1920 if (JoiningGame && TCPIPConfig)
1921 lanConfig_cursor = 2;
1923 lanConfig_cursor = 1;
1925 if (StartingGame && lanConfig_cursor == 2)
1926 lanConfig_cursor = 1;
1927 lanConfig_port = DEFAULTnet_hostport;
1928 sprintf(lanConfig_portname, "%u", lanConfig_port);
1930 m_return_onerror = false;
1931 m_return_reason[0] = 0;
1935 void M_LanConfig_Draw (void)
1942 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1943 p = Draw_CachePic ("gfx/p_multi.lmp");
1944 basex = (320-p->width)/2;
1945 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
1948 startJoin = "New Game";
1950 startJoin = "Join Game";
1954 protocol = "TCP/IP";
1955 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
1958 M_Print (basex, 52, "Address:");
1960 M_Print (basex+9*8, 52, my_ipx_address);
1962 M_Print (basex+9*8, 52, my_tcpip_address);
1964 M_Print (basex, lanConfig_cursor_table[0], "Port");
1965 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
1966 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
1970 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
1971 M_Print (basex, 108, "Join game at:");
1972 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
1973 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
1977 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
1978 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
1981 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
1983 if (lanConfig_cursor == 0)
1984 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
1986 if (lanConfig_cursor == 2)
1987 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
1989 if (*m_return_reason)
1990 M_PrintWhite (basex, 148, m_return_reason);
1994 void M_LanConfig_Key (int key)
2005 S_LocalSound ("misc/menu1.wav");
2007 if (lanConfig_cursor < 0)
2008 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2012 S_LocalSound ("misc/menu1.wav");
2014 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2015 lanConfig_cursor = 0;
2019 if (lanConfig_cursor == 0)
2022 m_entersound = true;
2024 M_ConfigureNetSubsystem ();
2026 if (lanConfig_cursor == 1)
2030 M_Menu_GameOptions_f ();
2037 if (lanConfig_cursor == 2)
2039 m_return_state = m_state;
2040 m_return_onerror = true;
2041 key_dest = key_game;
2043 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2050 if (lanConfig_cursor == 0)
2052 if (strlen(lanConfig_portname))
2053 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2056 if (lanConfig_cursor == 2)
2058 if (strlen(lanConfig_joinname))
2059 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2064 if (key < 32 || key > 127)
2067 if (lanConfig_cursor == 2)
2069 l = strlen(lanConfig_joinname);
2072 lanConfig_joinname[l+1] = 0;
2073 lanConfig_joinname[l] = key;
2077 if (key < '0' || key > '9')
2079 if (lanConfig_cursor == 0)
2081 l = strlen(lanConfig_portname);
2084 lanConfig_portname[l+1] = 0;
2085 lanConfig_portname[l] = key;
2090 if (StartingGame && lanConfig_cursor == 2)
2092 if (key == K_UPARROW)
2093 lanConfig_cursor = 1;
2095 lanConfig_cursor = 0;
2098 l = atoi(lanConfig_portname);
2103 sprintf(lanConfig_portname, "%u", lanConfig_port);
2106 //=============================================================================
2107 /* GAME OPTIONS MENU */
2117 {"start", "Entrance"}, // 0
2119 {"e1m1", "Slipgate Complex"}, // 1
2120 {"e1m2", "Castle of the Damned"},
2121 {"e1m3", "The Necropolis"},
2122 {"e1m4", "The Grisly Grotto"},
2123 {"e1m5", "Gloom Keep"},
2124 {"e1m6", "The Door To Chthon"},
2125 {"e1m7", "The House of Chthon"},
2126 {"e1m8", "Ziggurat Vertigo"},
2128 {"e2m1", "The Installation"}, // 9
2129 {"e2m2", "Ogre Citadel"},
2130 {"e2m3", "Crypt of Decay"},
2131 {"e2m4", "The Ebon Fortress"},
2132 {"e2m5", "The Wizard's Manse"},
2133 {"e2m6", "The Dismal Oubliette"},
2134 {"e2m7", "Underearth"},
2136 {"e3m1", "Termination Central"}, // 16
2137 {"e3m2", "The Vaults of Zin"},
2138 {"e3m3", "The Tomb of Terror"},
2139 {"e3m4", "Satan's Dark Delight"},
2140 {"e3m5", "Wind Tunnels"},
2141 {"e3m6", "Chambers of Torment"},
2142 {"e3m7", "The Haunted Halls"},
2144 {"e4m1", "The Sewage System"}, // 23
2145 {"e4m2", "The Tower of Despair"},
2146 {"e4m3", "The Elder God Shrine"},
2147 {"e4m4", "The Palace of Hate"},
2148 {"e4m5", "Hell's Atrium"},
2149 {"e4m6", "The Pain Maze"},
2150 {"e4m7", "Azure Agony"},
2151 {"e4m8", "The Nameless City"},
2153 {"end", "Shub-Niggurath's Pit"}, // 31
2155 {"dm1", "Place of Two Deaths"}, // 32
2156 {"dm2", "Claustrophobopolis"},
2157 {"dm3", "The Abandoned Base"},
2158 {"dm4", "The Bad Place"},
2159 {"dm5", "The Cistern"},
2160 {"dm6", "The Dark Zone"}
2163 //MED 01/06/97 added hipnotic levels
2164 level_t hipnoticlevels[] =
2166 {"start", "Command HQ"}, // 0
2168 {"hip1m1", "The Pumping Station"}, // 1
2169 {"hip1m2", "Storage Facility"},
2170 {"hip1m3", "The Lost Mine"},
2171 {"hip1m4", "Research Facility"},
2172 {"hip1m5", "Military Complex"},
2174 {"hip2m1", "Ancient Realms"}, // 6
2175 {"hip2m2", "The Black Cathedral"},
2176 {"hip2m3", "The Catacombs"},
2177 {"hip2m4", "The Crypt"},
2178 {"hip2m5", "Mortum's Keep"},
2179 {"hip2m6", "The Gremlin's Domain"},
2181 {"hip3m1", "Tur Torment"}, // 12
2182 {"hip3m2", "Pandemonium"},
2183 {"hip3m3", "Limbo"},
2184 {"hip3m4", "The Gauntlet"},
2186 {"hipend", "Armagon's Lair"}, // 16
2188 {"hipdm1", "The Edge of Oblivion"} // 17
2191 //PGM 01/07/97 added rogue levels
2192 //PGM 03/02/97 added dmatch level
2193 level_t roguelevels[] =
2195 {"start", "Split Decision"},
2196 {"r1m1", "Deviant's Domain"},
2197 {"r1m2", "Dread Portal"},
2198 {"r1m3", "Judgement Call"},
2199 {"r1m4", "Cave of Death"},
2200 {"r1m5", "Towers of Wrath"},
2201 {"r1m6", "Temple of Pain"},
2202 {"r1m7", "Tomb of the Overlord"},
2203 {"r2m1", "Tempus Fugit"},
2204 {"r2m2", "Elemental Fury I"},
2205 {"r2m3", "Elemental Fury II"},
2206 {"r2m4", "Curse of Osiris"},
2207 {"r2m5", "Wizard's Keep"},
2208 {"r2m6", "Blood Sacrifice"},
2209 {"r2m7", "Last Bastion"},
2210 {"r2m8", "Source of Evil"},
2211 {"ctf1", "Division of Change"}
2221 episode_t episodes[] =
2223 {"Welcome to Quake", 0, 1},
2224 {"Doomed Dimension", 1, 8},
2225 {"Realm of Black Magic", 9, 7},
2226 {"Netherworld", 16, 7},
2227 {"The Elder World", 23, 8},
2228 {"Final Level", 31, 1},
2229 {"Deathmatch Arena", 32, 6}
2232 //MED 01/06/97 added hipnotic episodes
2233 episode_t hipnoticepisodes[] =
2235 {"Scourge of Armagon", 0, 1},
2236 {"Fortress of the Dead", 1, 5},
2237 {"Dominion of Darkness", 6, 6},
2238 {"The Rift", 12, 4},
2239 {"Final Level", 16, 1},
2240 {"Deathmatch Arena", 17, 1}
2243 //PGM 01/07/97 added rogue episodes
2244 //PGM 03/02/97 added dmatch episode
2245 episode_t rogueepisodes[] =
2247 {"Introduction", 0, 1},
2248 {"Hell's Fortress", 1, 7},
2249 {"Corridors of Time", 8, 8},
2250 {"Deathmatch Arena", 16, 1}
2253 level_t nehahralevels[] =
2255 {"nehstart", "Welcome to Nehahra"},
2256 {"neh1m1", "Forge City1: Slipgates"},
2257 {"neh1m2", "Forge City2: Boiler"},
2258 {"neh1m3", "Forge City3: Escape"},
2259 {"neh1m4", "Grind Core"},
2260 {"neh1m5", "Industrial Silence"},
2261 {"neh1m6", "Locked-Up Anger"},
2262 {"neh1m7", "Wanderer of the Wastes"},
2263 {"neh1m8", "Artemis System Net"},
2264 {"neh1m9", "To the Death"},
2265 {"neh2m1", "The Gates of Ghoro"},
2266 {"neh2m2", "Sacred Trinity"},
2267 {"neh2m3", "Realm of the Ancients"},
2268 {"neh2m4", "Temple of the Ancients"},
2269 {"neh2m5", "Dreams Made Flesh"},
2270 {"neh2m6", "Your Last Cup of Sorrow"},
2271 {"nehsec", "Ogre's Bane"},
2272 {"nehahra", "Nehahra's Den"},
2273 {"nehend", "Quintessence"}
2276 episode_t nehahraepisodes[] =
2278 {"Welcome to Nehahra", 0, 1},
2279 {"The Fall of Forge", 1, 9},
2280 {"The Outlands", 10, 7},
2281 {"Dimension of the Lost", 17, 2}
2287 qboolean m_serverInfoMessage = false;
2288 double m_serverInfoMessageTime;
2290 void M_Menu_GameOptions_f (void)
2292 key_dest = key_menu;
2293 m_state = m_gameoptions;
2294 m_entersound = true;
2295 if (maxplayers == 0)
2296 maxplayers = svs.maxclients;
2298 maxplayers = svs.maxclientslimit;
2302 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2303 #define NUM_GAMEOPTIONS 9
2304 int gameoptions_cursor;
2306 void M_GameOptions_Draw (void)
2311 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2312 p = Draw_CachePic ("gfx/p_multi.lmp");
2313 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2315 M_DrawTextBox (152, 32, 10, 1);
2316 M_Print (160, 40, "begin game");
2318 M_Print (0, 56, " Max players");
2319 M_Print (160, 56, va("%i", maxplayers) );
2321 M_Print (0, 64, " Game Type");
2322 if (!coop.integer && !deathmatch.integer)
2323 Cvar_SetValue("deathmatch", 1);
2325 M_Print (160, 64, "Cooperative");
2327 M_Print (160, 64, "Deathmatch");
2329 M_Print (0, 72, " Teamplay");
2330 if (gamemode == GAME_ROGUE)
2334 switch((int)teamplay.integer)
2336 case 1: msg = "No Friendly Fire"; break;
2337 case 2: msg = "Friendly Fire"; break;
2338 case 3: msg = "Tag"; break;
2339 case 4: msg = "Capture the Flag"; break;
2340 case 5: msg = "One Flag CTF"; break;
2341 case 6: msg = "Three Team CTF"; break;
2342 default: msg = "Off"; break;
2344 M_Print (160, 72, msg);
2350 switch((int)teamplay.integer)
2352 case 1: msg = "No Friendly Fire"; break;
2353 case 2: msg = "Friendly Fire"; break;
2354 default: msg = "Off"; break;
2356 M_Print (160, 72, msg);
2359 M_Print (0, 80, " Skill");
2360 if (skill.integer == 0)
2361 M_Print (160, 80, "Easy difficulty");
2362 else if (skill.integer == 1)
2363 M_Print (160, 80, "Normal difficulty");
2364 else if (skill.integer == 2)
2365 M_Print (160, 80, "Hard difficulty");
2367 M_Print (160, 80, "Nightmare difficulty");
2369 M_Print (0, 88, " Frag Limit");
2370 if (fraglimit.integer == 0)
2371 M_Print (160, 88, "none");
2373 M_Print (160, 88, va("%i frags", fraglimit.integer));
2375 M_Print (0, 96, " Time Limit");
2376 if (timelimit.integer == 0)
2377 M_Print (160, 96, "none");
2379 M_Print (160, 96, va("%i minutes", timelimit.integer));
2381 M_Print (0, 112, " Episode");
2382 //MED 01/06/97 added hipnotic episodes
2383 if (gamemode == GAME_HIPNOTIC)
2384 M_Print (160, 112, hipnoticepisodes[startepisode].description);
2385 //PGM 01/07/97 added rogue episodes
2386 else if (gamemode == GAME_ROGUE)
2387 M_Print (160, 112, rogueepisodes[startepisode].description);
2388 else if (gamemode == GAME_NEHAHRA)
2389 M_Print (160, 112, nehahraepisodes[startepisode].description);
2391 M_Print (160, 112, episodes[startepisode].description);
2393 M_Print (0, 120, " Level");
2394 //MED 01/06/97 added hipnotic episodes
2395 if (gamemode == GAME_HIPNOTIC)
2397 M_Print (160, 120, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].description);
2398 M_Print (160, 128, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name);
2400 //PGM 01/07/97 added rogue episodes
2401 else if (gamemode == GAME_ROGUE)
2403 M_Print (160, 120, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].description);
2404 M_Print (160, 128, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name);
2406 else if (gamemode == GAME_NEHAHRA)
2408 M_Print (160, 120, nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].description);
2409 M_Print (160, 128, nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].name);
2413 M_Print (160, 120, levels[episodes[startepisode].firstLevel + startlevel].description);
2414 M_Print (160, 128, levels[episodes[startepisode].firstLevel + startlevel].name);
2418 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2420 if (m_serverInfoMessage)
2422 if ((realtime - m_serverInfoMessageTime) < 5.0)
2425 M_DrawTextBox (x, 138, 24, 4);
2427 M_Print (x, 146, " More than 64 players?? ");
2428 M_Print (x, 154, " First, question your ");
2429 M_Print (x, 162, " sanity, then email ");
2430 M_Print (x, 170, " havoc@gamevisions.com ");
2432 M_Print (x, 146, " More than 4 players ");
2433 M_Print (x, 154, " requires using command ");
2434 M_Print (x, 162, "line parameters; please ");
2435 M_Print (x, 170, " see techinfo.txt. ");
2440 m_serverInfoMessage = false;
2446 void M_NetStart_Change (int dir)
2450 switch (gameoptions_cursor)
2454 if (maxplayers > svs.maxclientslimit)
2456 maxplayers = svs.maxclientslimit;
2457 m_serverInfoMessage = true;
2458 m_serverInfoMessageTime = realtime;
2465 if (deathmatch.integer) // changing from deathmatch to coop
2467 Cvar_SetValue ("coop", 1);
2468 Cvar_SetValue ("deathmatch", 0);
2470 else // changing from coop to deathmatch
2472 Cvar_SetValue ("coop", 0);
2473 Cvar_SetValue ("deathmatch", 1);
2478 if (gamemode == GAME_ROGUE)
2483 Cvar_SetValue ("teamplay", teamplay.integer + dir);
2484 if (teamplay.integer > count)
2485 Cvar_SetValue ("teamplay", 0);
2486 else if (teamplay.integer < 0)
2487 Cvar_SetValue ("teamplay", count);
2491 Cvar_SetValue ("skill", skill.integer + dir);
2492 if (skill.integer > 3)
2493 Cvar_SetValue ("skill", 0);
2494 if (skill.integer < 0)
2495 Cvar_SetValue ("skill", 3);
2499 Cvar_SetValue ("fraglimit", fraglimit.integer + dir*10);
2500 if (fraglimit.integer > 100)
2501 Cvar_SetValue ("fraglimit", 0);
2502 if (fraglimit.integer < 0)
2503 Cvar_SetValue ("fraglimit", 100);
2507 Cvar_SetValue ("timelimit", timelimit.value + dir*5);
2508 if (timelimit.value > 60)
2509 Cvar_SetValue ("timelimit", 0);
2510 if (timelimit.value < 0)
2511 Cvar_SetValue ("timelimit", 60);
2515 startepisode += dir;
2516 //MED 01/06/97 added hipnotic count
2517 if (gamemode == GAME_HIPNOTIC)
2519 //PGM 01/07/97 added rogue count
2520 //PGM 03/02/97 added 1 for dmatch episode
2521 else if (gamemode == GAME_ROGUE)
2523 else if (gamemode == GAME_NEHAHRA)
2525 else if (registered.integer)
2530 if (startepisode < 0)
2531 startepisode = count - 1;
2533 if (startepisode >= count)
2541 //MED 01/06/97 added hipnotic episodes
2542 if (gamemode == GAME_HIPNOTIC)
2543 count = hipnoticepisodes[startepisode].levels;
2544 //PGM 01/06/97 added hipnotic episodes
2545 else if (gamemode == GAME_ROGUE)
2546 count = rogueepisodes[startepisode].levels;
2547 else if (gamemode == GAME_NEHAHRA)
2548 count = nehahraepisodes[startepisode].levels;
2550 count = episodes[startepisode].levels;
2553 startlevel = count - 1;
2555 if (startlevel >= count)
2561 void M_GameOptions_Key (int key)
2570 S_LocalSound ("misc/menu1.wav");
2571 gameoptions_cursor--;
2572 if (gameoptions_cursor < 0)
2573 gameoptions_cursor = NUM_GAMEOPTIONS-1;
2577 S_LocalSound ("misc/menu1.wav");
2578 gameoptions_cursor++;
2579 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
2580 gameoptions_cursor = 0;
2584 if (gameoptions_cursor == 0)
2586 S_LocalSound ("misc/menu3.wav");
2587 M_NetStart_Change (-1);
2591 if (gameoptions_cursor == 0)
2593 S_LocalSound ("misc/menu3.wav");
2594 M_NetStart_Change (1);
2598 S_LocalSound ("misc/menu2.wav");
2599 if (gameoptions_cursor == 0)
2602 Cbuf_AddText ("disconnect\n");
2603 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
2604 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
2605 // SCR_BeginLoadingPlaque ();
2607 if (gamemode == GAME_HIPNOTIC)
2608 Cbuf_AddText ( va ("map %s\n", hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name) );
2609 else if (gamemode == GAME_ROGUE)
2610 Cbuf_AddText ( va ("map %s\n", roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name) );
2611 else if (gamemode == GAME_NEHAHRA)
2612 Cbuf_AddText ( va ("map %s\n", nehahralevels[nehahraepisodes[startepisode].firstLevel + startlevel].name) );
2614 Cbuf_AddText ( va ("map %s\n", levels[episodes[startepisode].firstLevel + startlevel].name) );
2619 M_NetStart_Change (1);
2624 //=============================================================================
2627 qboolean searchComplete = false;
2628 double searchCompleteTime;
2630 void M_Menu_Search_f (void)
2632 key_dest = key_menu;
2634 m_entersound = false;
2637 searchComplete = false;
2643 void M_Search_Draw (void)
2648 p = Draw_CachePic ("gfx/p_multi.lmp");
2649 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2650 x = (320/2) - ((12*8)/2) + 4;
2651 M_DrawTextBox (x-8, 32, 12, 1);
2652 M_Print (x, 40, "Searching...");
2660 if (! searchComplete)
2662 searchComplete = true;
2663 searchCompleteTime = realtime;
2668 M_Menu_ServerList_f ();
2672 M_PrintWhite ((320/2) - ((22*8)/2), 64, "No Quake servers found");
2673 if ((realtime - searchCompleteTime) < 3.0)
2676 M_Menu_LanConfig_f ();
2680 void M_Search_Key (int key)
2684 //=============================================================================
2688 qboolean slist_sorted;
2690 void M_Menu_ServerList_f (void)
2692 key_dest = key_menu;
2694 m_entersound = true;
2696 m_return_onerror = false;
2697 m_return_reason[0] = 0;
2698 slist_sorted = false;
2702 void M_ServerList_Draw (void)
2710 if (hostCacheCount > 1)
2714 for (i = 0; i < hostCacheCount; i++)
2715 for (j = i+1; j < hostCacheCount; j++)
2716 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
2718 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
2719 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
2720 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
2723 slist_sorted = true;
2726 p = Draw_CachePic ("gfx/p_multi.lmp");
2727 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2728 for (n = 0; n < hostCacheCount; n++)
2730 if (hostcache[n].maxusers)
2731 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
2733 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
2734 M_Print (16, 32 + 8*n, string);
2736 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
2738 if (*m_return_reason)
2739 M_PrintWhite (16, 148, m_return_reason);
2743 void M_ServerList_Key (int k)
2748 M_Menu_LanConfig_f ();
2757 S_LocalSound ("misc/menu1.wav");
2759 if (slist_cursor < 0)
2760 slist_cursor = hostCacheCount - 1;
2765 S_LocalSound ("misc/menu1.wav");
2767 if (slist_cursor >= hostCacheCount)
2772 S_LocalSound ("misc/menu2.wav");
2773 m_return_state = m_state;
2774 m_return_onerror = true;
2775 slist_sorted = false;
2776 key_dest = key_game;
2778 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
2787 //=============================================================================
2788 /* Menu Subsystem */
2793 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
2795 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
2796 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
2797 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
2798 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
2799 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
2800 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
2801 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
2802 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
2803 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
2804 Cmd_AddCommand ("help", M_Menu_Help_f);
2805 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
2807 if (gamemode == GAME_NEHAHRA)
2809 if (COM_FileExists("maps/neh1m4.bsp"))
2811 if (COM_FileExists("hearing.dem"))
2813 Con_Printf("Nehahra movie and game detected.\n");
2814 NehGameType = TYPE_BOTH;
2818 Con_Printf("Nehahra game detected.\n");
2819 NehGameType = TYPE_GAME;
2824 if (COM_FileExists("hearing.dem"))
2826 Con_Printf("Nehahra movie detected.\n");
2827 NehGameType = TYPE_DEMO;
2831 Con_Printf("Nehahra not found.\n");
2832 NehGameType = TYPE_GAME; // could just complain, but...
2840 if (m_state == m_none || key_dest != key_menu)
2858 case m_singleplayer:
2859 M_SinglePlayer_Draw ();
2871 M_MultiPlayer_Draw ();
2903 M_LanConfig_Draw ();
2907 M_GameOptions_Draw ();
2915 M_ServerList_Draw ();
2921 S_LocalSound ("misc/menu2.wav");
2922 m_entersound = false;
2929 void M_Keydown (int key)
2944 case m_singleplayer:
2945 M_SinglePlayer_Key (key);
2957 M_MultiPlayer_Key (key);
2969 M_Options_Key (key);
2989 M_LanConfig_Key (key);
2993 M_GameOptions_Key (key);
3001 M_ServerList_Key (key);
3007 void M_ConfigureNetSubsystem(void)
3009 // enable/disable net systems to match desired config
3011 Cbuf_AddText ("stopdemo\n");
3013 if (IPXConfig || TCPIPConfig)
3014 net_hostport = lanConfig_port;