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.
28 mempool_t *menu_mempool;
32 enum m_state_e m_state;
34 void M_Menu_Main_f (void);
35 void M_Menu_SinglePlayer_f (void);
36 void M_Menu_Load_f (void);
37 void M_Menu_Save_f (void);
38 void M_Menu_MultiPlayer_f (void);
39 void M_Menu_Setup_f (void);
40 void M_Menu_Options_f (void);
41 void M_Menu_Options_Effects_f (void);
42 void M_Menu_Options_ColorControl_f (void);
43 void M_Menu_Keys_f (void);
44 void M_Menu_Video_f (void);
45 void M_Menu_Help_f (void);
46 void M_Menu_Quit_f (void);
47 void M_Menu_LanConfig_f (void);
48 void M_Menu_GameOptions_f (void);
49 void M_Menu_ServerList_f (void);
51 void M_Main_Draw (void);
52 void M_SinglePlayer_Draw (void);
53 void M_Load_Draw (void);
54 void M_Save_Draw (void);
55 void M_MultiPlayer_Draw (void);
56 void M_Setup_Draw (void);
57 void M_Options_Draw (void);
58 void M_Options_Effects_Draw (void);
59 void M_Options_ColorControl_Draw (void);
60 void M_Keys_Draw (void);
61 void M_Video_Draw (void);
62 void M_Help_Draw (void);
63 void M_Quit_Draw (void);
64 void M_LanConfig_Draw (void);
65 void M_GameOptions_Draw (void);
66 void M_ServerList_Draw (void);
68 void M_Main_Key (int key);
69 void M_SinglePlayer_Key (int key);
70 void M_Load_Key (int key);
71 void M_Save_Key (int key);
72 void M_MultiPlayer_Key (int key);
73 void M_Setup_Key (int key);
74 void M_Options_Key (int key);
75 void M_Options_Effects_Key (int key);
76 void M_Options_ColorControl_Key (int key);
77 void M_Keys_Key (int key);
78 void M_Video_Key (int key);
79 void M_Help_Key (int key);
80 void M_Quit_Key (int key);
81 void M_LanConfig_Key (int key);
82 void M_GameOptions_Key (int key);
83 void M_ServerList_Key (int key);
85 qboolean m_entersound; // play after drawing a frame, so caching
86 // won't disrupt the sound
88 char m_return_reason [32];
90 #define StartingGame (m_multiplayer_cursor == 1)
91 #define JoiningGame (m_multiplayer_cursor == 0)
94 #define NumberOfNehahraDemos 34
101 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
103 {"intro", "Prologue"},
104 {"genf", "The Beginning"},
105 {"genlab", "A Doomed Project"},
106 {"nehcre", "The New Recruits"},
107 {"maxneh", "Breakthrough"},
108 {"maxchar", "Renewal and Duty"},
109 {"crisis", "Worlds Collide"},
110 {"postcris", "Darkening Skies"},
111 {"hearing", "The Hearing"},
112 {"getjack", "On a Mexican Radio"},
113 {"prelude", "Honor and Justice"},
114 {"abase", "A Message Sent"},
115 {"effect", "The Other Side"},
116 {"uhoh", "Missing in Action"},
117 {"prepare", "The Response"},
118 {"vision", "Farsighted Eyes"},
119 {"maxturns", "Enter the Immortal"},
120 {"backlot", "Separate Ways"},
121 {"maxside", "The Ancient Runes"},
122 {"counter", "The New Initiative"},
123 {"warprep", "Ghosts to the World"},
124 {"counter1", "A Fate Worse Than Death"},
125 {"counter2", "Friendly Fire"},
126 {"counter3", "Minor Setback"},
127 {"madmax", "Scores to Settle"},
128 {"quake", "One Man"},
129 {"cthmm", "Shattered Masks"},
130 {"shades", "Deal with the Dead"},
131 {"gophil", "An Unlikely Hero"},
132 {"cstrike", "War in Hell"},
133 {"shubset", "The Conspiracy"},
134 {"shubdie", "Even Death May Die"},
135 {"newranks", "An Empty Throne"},
136 {"seal", "The Seal is Broken"}
139 float menu_x, menu_y, menu_width, menu_height;
141 void M_Background(int width, int height)
144 menu_height = height;
145 menu_x = (vid.conwidth - menu_width) * 0.5;
146 menu_y = (vid.conheight - menu_height) * 0.5;
147 DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
148 //DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
155 Draws one solid graphics character
158 void M_DrawCharacter (float cx, float cy, int num)
163 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
166 void M_Print (float cx, float cy, const char *str)
168 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
171 void M_PrintWhite (float cx, float cy, const char *str)
173 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
176 void M_ItemPrint (float cx, float cy, char *str, int unghosted)
179 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
181 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
184 void M_DrawPic (float cx, float cy, char *picname)
186 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
189 qbyte identityTable[256];
190 qbyte translationTable[256];
192 void M_BuildTranslationTable(int top, int bottom)
195 qbyte *dest, *source;
197 for (j = 0; j < 256; j++)
198 identityTable[j] = j;
199 dest = translationTable;
200 source = identityTable;
201 memcpy (dest, source, 256);
203 // LordHavoc: corrected skin color ranges
204 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
205 memcpy (dest + TOP_RANGE, source + top, 16);
207 for (j=0 ; j<16 ; j++)
208 dest[TOP_RANGE+j] = source[top+15-j];
210 // LordHavoc: corrected skin color ranges
211 if (bottom < 128 || (bottom >= 224 && bottom < 240))
212 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
214 for (j=0 ; j<16 ; j++)
215 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
219 void M_DrawTextBox (float x, float y, float width, float height)
227 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
228 for (n = 0; n < height; n++)
231 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
233 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
240 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
241 for (n = 0; n < height; n++)
245 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
247 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
249 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
256 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
257 for (n = 0; n < height; n++)
260 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
262 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
265 //=============================================================================
267 //int m_save_demonum;
274 void M_ToggleMenu_f (void)
278 if (key_dest != key_menu || m_state != m_main)
289 void M_Demo_Draw (void)
293 M_Background(320, 200);
295 for (i = 0;i < NumberOfNehahraDemos;i++)
296 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
299 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
303 void M_Menu_Demos_f (void)
310 void M_Demo_Key (int k)
319 S_LocalSound ("misc/menu2.wav");
322 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
327 S_LocalSound ("misc/menu1.wav");
330 demo_cursor = NumberOfNehahraDemos;
335 S_LocalSound ("misc/menu1.wav");
337 if (demo_cursor > NumberOfNehahraDemos)
343 //=============================================================================
348 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
350 void M_Menu_Main_f (void)
352 if (gamemode == GAME_NEHAHRA)
354 if (NehGameType == TYPE_DEMO)
356 else if (NehGameType == TYPE_GAME)
365 if (key_dest != key_menu)
367 m_save_demonum = cls.demonum;
377 void M_Main_Draw (void)
382 M_Background(320, 200);
384 M_DrawPic (16, 4, "gfx/qplaque.lmp");
385 p = Draw_CachePic ("gfx/ttl_main.lmp");
386 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
388 if (gamemode == GAME_NEHAHRA)
390 if (NehGameType == TYPE_BOTH)
391 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
392 else if (NehGameType == TYPE_GAME)
393 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
395 M_DrawPic (72, 32, "gfx/demomenu.lmp");
398 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
400 f = (int)(realtime * 10)%6;
402 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
406 void M_Main_Key (int key)
413 //cls.demonum = m_save_demonum;
414 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
419 S_LocalSound ("misc/menu1.wav");
420 if (++m_main_cursor >= MAIN_ITEMS)
425 S_LocalSound ("misc/menu1.wav");
426 if (--m_main_cursor < 0)
427 m_main_cursor = MAIN_ITEMS - 1;
433 if (gamemode == GAME_NEHAHRA)
438 switch (m_main_cursor)
441 M_Menu_SinglePlayer_f ();
449 M_Menu_MultiPlayer_f ();
459 Cbuf_AddText ("disconnect\n");
460 Cbuf_AddText ("playdemo endcred\n");
469 switch (m_main_cursor)
472 M_Menu_SinglePlayer_f ();
476 M_Menu_MultiPlayer_f ();
486 Cbuf_AddText ("disconnect\n");
487 Cbuf_AddText ("playdemo endcred\n");
496 switch (m_main_cursor)
505 Cbuf_AddText ("disconnect\n");
506 Cbuf_AddText ("playdemo endcred\n");
522 switch (m_main_cursor)
525 M_Menu_SinglePlayer_f ();
529 M_Menu_MultiPlayer_f ();
548 //=============================================================================
549 /* SINGLE PLAYER MENU */
551 int m_singleplayer_cursor;
552 #define SINGLEPLAYER_ITEMS 3
555 void M_Menu_SinglePlayer_f (void)
558 m_state = m_singleplayer;
563 void M_SinglePlayer_Draw (void)
567 M_Background(320, 200);
569 M_DrawPic (16, 4, "gfx/qplaque.lmp");
570 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
572 // Transfusion doesn't have a single player mode
573 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2)
575 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
577 M_DrawTextBox (60, 8 * 8, 23, 4);
578 if (gamemode == GAME_NEXUIZ)
579 M_PrintWhite (95, 10 * 8, "Nexuiz is for");
580 else if (gamemode == GAME_GOODVSBAD2)
581 M_PrintWhite (95, 10 * 8, "Good Vs Bad 2 is for");
583 M_PrintWhite (95, 10 * 8, "Transfusion is for");
584 M_PrintWhite (83, 11 * 8, "multiplayer play only");
590 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
591 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
593 f = (int)(realtime * 10)%6;
595 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
600 void M_SinglePlayer_Key (int key)
602 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2)
604 if (key == K_ESCAPE || key == K_ENTER)
616 S_LocalSound ("misc/menu1.wav");
617 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
618 m_singleplayer_cursor = 0;
622 S_LocalSound ("misc/menu1.wav");
623 if (--m_singleplayer_cursor < 0)
624 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
630 switch (m_singleplayer_cursor)
635 Cbuf_AddText ("disconnect\n");
636 Cbuf_AddText ("maxplayers 1\n");
637 Cbuf_AddText ("deathmatch 0\n");
638 Cbuf_AddText ("coop 0\n");
639 if (gamemode == GAME_NEHAHRA)
640 Cbuf_AddText ("map nehstart\n");
642 Cbuf_AddText ("map start\n");
656 //=============================================================================
659 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
661 #define MAX_SAVEGAMES 12
662 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
663 int loadable[MAX_SAVEGAMES];
665 void M_ScanSaves (void)
668 char name[MAX_OSPATH];
673 for (i=0 ; i<MAX_SAVEGAMES ; i++)
675 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
677 sprintf (name, "s%i.sav", i);
678 f = FS_Open (name, "r", false);
681 str = FS_Getline (f);
682 sscanf (str, "%i\n", &version);
683 str = FS_Getline (f);
684 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
686 // change _ back to space
687 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
688 if (m_filenames[i][j] == '_')
689 m_filenames[i][j] = ' ';
695 void M_Menu_Load_f (void)
704 void M_Menu_Save_f (void)
710 if (svs.maxclients != 1)
719 void M_Load_Draw (void)
724 M_Background(320, 200);
726 p = Draw_CachePic ("gfx/p_load.lmp");
727 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
729 for (i=0 ; i< MAX_SAVEGAMES; i++)
730 M_Print (16, 32 + 8*i, m_filenames[i]);
733 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
737 void M_Save_Draw (void)
742 M_Background(320, 200);
744 p = Draw_CachePic ("gfx/p_save.lmp");
745 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
747 for (i=0 ; i<MAX_SAVEGAMES ; i++)
748 M_Print (16, 32 + 8*i, m_filenames[i]);
751 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
755 void M_Load_Key (int k)
760 M_Menu_SinglePlayer_f ();
764 S_LocalSound ("misc/menu2.wav");
765 if (!loadable[load_cursor])
770 // issue the load command
771 Cbuf_AddText (va ("load s%i\n", load_cursor) );
776 S_LocalSound ("misc/menu1.wav");
779 load_cursor = MAX_SAVEGAMES-1;
784 S_LocalSound ("misc/menu1.wav");
786 if (load_cursor >= MAX_SAVEGAMES)
793 void M_Save_Key (int k)
798 M_Menu_SinglePlayer_f ();
804 Cbuf_AddText (va("save s%i\n", load_cursor));
809 S_LocalSound ("misc/menu1.wav");
812 load_cursor = MAX_SAVEGAMES-1;
817 S_LocalSound ("misc/menu1.wav");
819 if (load_cursor >= MAX_SAVEGAMES)
825 //=============================================================================
826 /* MULTIPLAYER MENU */
828 int m_multiplayer_cursor;
829 #define MULTIPLAYER_ITEMS 3
832 void M_Menu_MultiPlayer_f (void)
835 m_state = m_multiplayer;
840 void M_MultiPlayer_Draw (void)
845 M_Background(320, 200);
847 M_DrawPic (16, 4, "gfx/qplaque.lmp");
848 p = Draw_CachePic ("gfx/p_multi.lmp");
849 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
850 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
852 f = (int)(realtime * 10)%6;
854 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
858 void M_MultiPlayer_Key (int key)
867 S_LocalSound ("misc/menu1.wav");
868 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
869 m_multiplayer_cursor = 0;
873 S_LocalSound ("misc/menu1.wav");
874 if (--m_multiplayer_cursor < 0)
875 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
880 switch (m_multiplayer_cursor)
884 M_Menu_LanConfig_f ();
894 //=============================================================================
897 int setup_cursor = 3;
898 int setup_cursor_table[] = {40, 64, 88, 124};
900 char setup_myname[32];
906 #define NUM_SETUP_CMDS 4
908 void M_Menu_Setup_f (void)
913 strcpy(setup_myname, cl_name.string);
914 setup_top = setup_oldtop = cl_color.integer >> 4;
915 setup_bottom = setup_oldbottom = cl_color.integer & 15;
918 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
919 static qbyte *menuplyr_pixels;
920 static unsigned int *menuplyr_translated;
922 void M_Setup_Draw (void)
927 M_Background(320, 200);
929 M_DrawPic (16, 4, "gfx/qplaque.lmp");
930 p = Draw_CachePic ("gfx/p_multi.lmp");
931 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
933 M_Print (64, 40, "Your name");
934 M_DrawTextBox (160, 32, 16, 1);
935 M_Print (168, 40, setup_myname);
937 if (gamemode != GAME_GOODVSBAD2)
939 M_Print (64, 64, "Shirt color");
940 M_Print (64, 88, "Pants color");
943 M_DrawTextBox (64, 124-8, 14, 1);
944 M_Print (72, 124, "Accept Changes");
946 // LordHavoc: rewrote this code greatly
950 menuplyr_load = false;
952 menuplyr_bottom = -1;
953 if ((f = FS_LoadFile("gfx/menuplyr.lmp", true)))
955 data = LoadLMPAs8Bit (f, 0, 0);
956 menuplyr_width = image_width;
957 menuplyr_height = image_height;
959 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
960 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
961 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
968 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
970 menuplyr_top = setup_top;
971 menuplyr_bottom = setup_bottom;
972 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
973 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
974 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
975 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
977 M_DrawPic(160, 48, "gfx/bigbox.lmp");
978 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
981 if (setup_cursor == 0)
982 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
984 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
988 void M_Setup_Key (int k)
995 M_Menu_MultiPlayer_f ();
999 S_LocalSound ("misc/menu1.wav");
1001 if (setup_cursor < 0)
1002 setup_cursor = NUM_SETUP_CMDS-1;
1006 S_LocalSound ("misc/menu1.wav");
1008 if (setup_cursor >= NUM_SETUP_CMDS)
1013 if (setup_cursor < 1)
1015 S_LocalSound ("misc/menu3.wav");
1016 if (setup_cursor == 1)
1017 setup_top = setup_top - 1;
1018 if (setup_cursor == 2)
1019 setup_bottom = setup_bottom - 1;
1022 if (setup_cursor < 1)
1025 S_LocalSound ("misc/menu3.wav");
1026 if (setup_cursor == 1)
1027 setup_top = setup_top + 1;
1028 if (setup_cursor == 2)
1029 setup_bottom = setup_bottom + 1;
1033 if (setup_cursor == 0)
1036 if (setup_cursor == 1 || setup_cursor == 2)
1039 // setup_cursor == 3 (Accept changes)
1040 if (strcmp(cl_name.string, setup_myname) != 0)
1041 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1042 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1043 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1044 m_entersound = true;
1045 M_Menu_MultiPlayer_f ();
1049 if (setup_cursor == 0)
1051 if (strlen(setup_myname))
1052 setup_myname[strlen(setup_myname)-1] = 0;
1057 if (k < 32 || k > 127)
1059 if (setup_cursor == 0)
1061 l = strlen(setup_myname);
1064 setup_myname[l+1] = 0;
1065 setup_myname[l] = k;
1074 if (setup_bottom > 15)
1076 if (setup_bottom < 0)
1080 //=============================================================================
1083 #define SLIDER_RANGE 10
1085 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1090 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1091 M_DrawCharacter (x-8, y, 128);
1092 for (i = 0;i < SLIDER_RANGE;i++)
1093 M_DrawCharacter (x + i*8, y, 129);
1094 M_DrawCharacter (x+i*8, y, 130);
1095 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1096 sprintf(text, "%g", num);
1097 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1100 void M_DrawCheckbox (int x, int y, int on)
1103 M_Print (x, y, "on");
1105 M_Print (x, y, "off");
1109 #define OPTIONS_ITEMS 29
1113 void M_Menu_Options_f (void)
1115 key_dest = key_menu;
1116 m_state = m_options;
1117 m_entersound = true;
1120 extern cvar_t snd_staticvolume;
1121 extern cvar_t gl_delayfinish;
1122 extern cvar_t slowmo;
1123 extern dllhandle_t jpeg_dll;
1125 void M_Menu_Options_AdjustSliders (int dir)
1127 S_LocalSound ("misc/menu3.wav");
1129 switch (options_cursor)
1132 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1135 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1138 if (jpeg_dll != NULL)
1139 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1142 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1145 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1148 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1151 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1154 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1157 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1159 case 15: // music volume
1161 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1163 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1166 case 16: // sfx volume
1167 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1169 case 17: // static volume
1170 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1173 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1176 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1178 case 20: // static crosshair
1179 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1181 case 21: // show framerate
1182 Cvar_SetValueQuick (&showfps, !showfps.integer);
1184 case 22: // always run
1185 if (cl_forwardspeed.value > 200)
1187 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1188 Cvar_SetValueQuick (&cl_backspeed, 200);
1192 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1193 Cvar_SetValueQuick (&cl_backspeed, 400);
1196 case 23: // lookspring
1197 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1199 case 24: // lookstrafe
1200 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1202 case 25: // mouse speed
1203 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1205 case 26: // mouse look
1206 Cvar_SetValueQuick (&freelook, !freelook.integer);
1208 case 27: // invert mouse
1209 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1211 case 28: // windowed mouse
1212 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1217 void M_Options_Draw (void)
1222 M_Background(320, 240);
1224 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1225 p = Draw_CachePic("gfx/p_option.lmp");
1226 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1229 M_Print(16, y, " Customize controls");y += 8;
1230 M_Print(16, y, " Go to console");y += 8;
1231 M_Print(16, y, " Reset to defaults");y += 8;
1232 M_Print(16, y, " Video Options");y += 8;
1233 M_Print(16, y, " Effects Options");y += 8;
1234 M_Print(16, y, " Color Control Options");y += 8;
1235 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value, 0, 1);y += 8;
1236 M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8;
1237 M_ItemPrint(16, y, " JPEG screenshots", jpeg_dll != NULL);M_DrawCheckbox(220, y, scr_screenshot_jpeg.integer);y += 8;
1238 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1239 // LordHavoc: FIXME: overbright needs to be disabled in GAME_GOODVSBAD2 but combine should not be disabled
1240 // LordHavoc: perhaps it's time for Overbright Bits to die, and a r_lightmapintensity option to be added?
1241 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8;
1242 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1243 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1244 M_Print(16, y, "Delay refresh (faster)");M_DrawCheckbox(220, y, gl_delayfinish.integer);y += 8;
1245 M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8;
1246 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8;
1247 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8;
1248 if (gamemode == GAME_GOODVSBAD2)
1249 M_ItemPrint(16, y, " Music Volume", snd_initialized);
1251 M_ItemPrint(16, y, " Ambient Sound Volume", snd_initialized);
1252 M_DrawSlider(220, y, snd_staticvolume.value, 0, 1);
1254 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8;
1255 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8;
1256 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1257 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1258 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1259 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1260 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1261 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, sensitivity.value, 1, 50);y += 8;
1262 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1263 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1264 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1267 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1271 void M_Options_Key (int k)
1280 m_entersound = true;
1281 switch (options_cursor)
1288 key_dest = key_game;
1289 Con_ToggleConsole_f ();
1292 Cbuf_AddText ("exec default.cfg\n");
1298 M_Menu_Options_Effects_f ();
1301 M_Menu_Options_ColorControl_f ();
1304 M_Menu_Options_AdjustSliders (1);
1310 S_LocalSound ("misc/menu1.wav");
1312 if (options_cursor < 0)
1313 options_cursor = OPTIONS_ITEMS-1;
1317 S_LocalSound ("misc/menu1.wav");
1319 if (options_cursor >= OPTIONS_ITEMS)
1324 M_Menu_Options_AdjustSliders (-1);
1328 M_Menu_Options_AdjustSliders (1);
1333 #define OPTIONS_EFFECTS_ITEMS 17
1335 int options_effects_cursor;
1337 void M_Menu_Options_Effects_f (void)
1339 key_dest = key_menu;
1340 m_state = m_options_effects;
1341 m_entersound = true;
1345 extern cvar_t r_detailtextures;
1346 extern cvar_t cl_particles;
1347 extern cvar_t cl_explosions;
1348 extern cvar_t cl_stainmaps;
1349 extern cvar_t cl_decals;
1350 extern cvar_t r_explosionclip;
1351 extern cvar_t r_dlightmap;
1352 extern cvar_t r_modellights;
1353 extern cvar_t r_coronas;
1354 extern cvar_t gl_flashblend;
1355 extern cvar_t cl_particles_bulletimpacts;
1356 extern cvar_t cl_particles_smoke;
1357 extern cvar_t cl_particles_sparks;
1358 extern cvar_t cl_particles_bubbles;
1359 extern cvar_t cl_particles_blood;
1360 extern cvar_t cl_particles_blood_size;
1361 extern cvar_t cl_particles_blood_alpha;
1363 void M_Menu_Options_Effects_AdjustSliders (int dir)
1365 S_LocalSound ("misc/menu3.wav");
1367 switch (options_effects_cursor)
1370 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1373 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1376 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1379 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1382 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1385 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1388 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1391 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1394 Cvar_SetValueQuick (&cl_stainmaps, !cl_decals.integer);
1397 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1400 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1403 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1406 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1409 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1412 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1415 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1418 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1423 void M_Options_Effects_Draw (void)
1428 M_Background(320, 200);
1430 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1431 p = Draw_CachePic("gfx/p_option.lmp");
1432 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1435 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value, 0, 8);y += 8;
1436 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1437 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1438 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1439 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1440 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1441 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1442 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1443 M_Print(16, y, " Decals");M_DrawCheckbox(220, y, cl_decals.integer);y += 8;
1444 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1445 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1446 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1447 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1448 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1449 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1450 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, cl_particles_blood_size.value, 2, 20);y += 8;
1451 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, cl_particles_blood_alpha.value, 0.2, 1);y += 8;
1454 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1458 void M_Options_Effects_Key (int k)
1463 M_Menu_Options_f ();
1467 M_Menu_Options_Effects_AdjustSliders (1);
1471 S_LocalSound ("misc/menu1.wav");
1472 options_effects_cursor--;
1473 if (options_effects_cursor < 0)
1474 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1478 S_LocalSound ("misc/menu1.wav");
1479 options_effects_cursor++;
1480 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1481 options_effects_cursor = 0;
1485 M_Menu_Options_Effects_AdjustSliders (-1);
1489 M_Menu_Options_Effects_AdjustSliders (1);
1498 #define OPTIONS_COLORCONTROL_ITEMS 18
1500 int options_colorcontrol_cursor;
1502 // intensity value to match up to 50% dither to 'correct' quake
1503 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1505 void M_Menu_Options_ColorControl_f (void)
1507 key_dest = key_menu;
1508 m_state = m_options_colorcontrol;
1509 m_entersound = true;
1513 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1516 S_LocalSound ("misc/menu3.wav");
1518 switch (options_colorcontrol_cursor)
1521 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1524 Cvar_SetValueQuick (&v_color_enable, 0);
1525 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1528 Cvar_SetValueQuick (&v_color_enable, 0);
1529 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1532 Cvar_SetValueQuick (&v_color_enable, 0);
1533 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1536 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1539 Cvar_SetValueQuick (&v_color_enable, 1);
1540 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1543 Cvar_SetValueQuick (&v_color_enable, 1);
1544 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1547 Cvar_SetValueQuick (&v_color_enable, 1);
1548 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1551 Cvar_SetValueQuick (&v_color_enable, 1);
1552 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1553 Cvar_SetValueQuick (&v_color_black_r, f);
1554 Cvar_SetValueQuick (&v_color_black_g, f);
1555 Cvar_SetValueQuick (&v_color_black_b, f);
1558 Cvar_SetValueQuick (&v_color_enable, 1);
1559 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1562 Cvar_SetValueQuick (&v_color_enable, 1);
1563 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1566 Cvar_SetValueQuick (&v_color_enable, 1);
1567 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1570 Cvar_SetValueQuick (&v_color_enable, 1);
1571 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1572 Cvar_SetValueQuick (&v_color_grey_r, f);
1573 Cvar_SetValueQuick (&v_color_grey_g, f);
1574 Cvar_SetValueQuick (&v_color_grey_b, f);
1577 Cvar_SetValueQuick (&v_color_enable, 1);
1578 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1581 Cvar_SetValueQuick (&v_color_enable, 1);
1582 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1585 Cvar_SetValueQuick (&v_color_enable, 1);
1586 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1589 Cvar_SetValueQuick (&v_color_enable, 1);
1590 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1591 Cvar_SetValueQuick (&v_color_white_r, f);
1592 Cvar_SetValueQuick (&v_color_white_g, f);
1593 Cvar_SetValueQuick (&v_color_white_b, f);
1598 void M_Options_ColorControl_Draw (void)
1600 float x, y, c, s, t, u, v;
1603 M_Background(320, 256);
1605 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1606 p = Draw_CachePic("gfx/p_option.lmp");
1607 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1610 M_Print(16, y, " Reset to defaults");y += 8;
1611 M_ItemPrint(16, y, "Hardware Gamma Control", vid_hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1612 M_ItemPrint(16, y, " Gamma", !v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_gamma.value, 1, 5);y += 8;
1613 M_ItemPrint(16, y, " Contrast", !v_color_enable.integer);M_DrawSlider(220, y, v_contrast.value, 1, 5);y += 8;
1614 M_ItemPrint(16, y, " Brightness", !v_color_enable.integer);M_DrawSlider(220, y, v_brightness.value, 0, 0.8);y += 8;
1615 M_Print(16, y, " Color Level Controls");M_DrawCheckbox(220, y, v_color_enable.integer);y += 8;
1616 M_ItemPrint(16, y, " Black: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_r.value, 0, 0.8);y += 8;
1617 M_ItemPrint(16, y, " Black: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_g.value, 0, 0.8);y += 8;
1618 M_ItemPrint(16, y, " Black: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_b.value, 0, 0.8);y += 8;
1619 M_ItemPrint(16, y, " Black: Grey ", v_color_enable.integer);M_DrawSlider(220, y, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3, 0, 0.8);y += 8;
1620 M_ItemPrint(16, y, " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_r.value, 0, 0.95);y += 8;
1621 M_ItemPrint(16, y, " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_g.value, 0, 0.95);y += 8;
1622 M_ItemPrint(16, y, " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, v_color_grey_b.value, 0, 0.95);y += 8;
1623 M_ItemPrint(16, y, " Grey: Grey ", v_color_enable.integer && vid_hardwaregammasupported && v_hwgamma.integer);M_DrawSlider(220, y, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3, 0, 0.95);y += 8;
1624 M_ItemPrint(16, y, " White: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_r.value, 1, 5);y += 8;
1625 M_ItemPrint(16, y, " White: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_g.value, 1, 5);y += 8;
1626 M_ItemPrint(16, y, " White: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_b.value, 1, 5);y += 8;
1627 M_ItemPrint(16, y, " White: Grey ", v_color_enable.integer);M_DrawSlider(220, y, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3, 1, 5);y += 8;
1630 DrawQ_Fill(menu_x, menu_y + y, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);y += 4;
1631 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1632 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1633 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);y += 4;
1634 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,0,0,1, 0,1, 0,0,0,1, 1,1, 1,0,0,1, 0);y += 4;
1635 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);y += 4;
1636 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,1,0,1, 0,1, 0,0,0,1, 1,1, 0,1,0,1, 0);y += 4;
1637 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);y += 4;
1638 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,0,1,1, 0,1, 0,0,0,1, 1,1, 0,0,1,1, 0);y += 4;
1639 DrawQ_SuperPic(menu_x + 4, menu_y + y, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);y += 4;
1640 DrawQ_SuperPic(menu_x + 4, menu_y + y, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);y += 4;
1642 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1643 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1644 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1649 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, 0, 0, 1, 0);
1650 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);
1651 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,0,0,1, u,0, 1,0,0,1, 0,v, 1,0,0,1, u,v, 1,0,0,1, 0);
1653 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, c, 0, 1, 0);
1654 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);
1655 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,1,0,1, u,0, 0,1,0,1, 0,v, 0,1,0,1, u,v, 0,1,0,1, 0);
1657 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, 0, c, 1, 0);
1658 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);
1659 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 0,0,1,1, u,0, 0,0,1,1, 0,v, 0,0,1,1, u,v, 0,0,1,1, 0);
1661 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, c, c, 1, 0);
1662 DrawQ_SuperPic(menu_x + x + 16, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);
1663 DrawQ_SuperPic(menu_x + x + 32, menu_y + y + 16, "gfx/colorcontrol/ditherpattern.tga", 16, 16, 0,0, 1,1,1,1, u,0, 1,1,1,1, 0,v, 1,1,1,1, u,v, 1,1,1,1, 0);
1666 M_DrawCharacter(200, 32 + options_colorcontrol_cursor*8, 12+((int)(realtime*4)&1));
1670 void M_Options_ColorControl_Key (int k)
1679 m_entersound = true;
1680 switch (options_colorcontrol_cursor)
1683 Cvar_SetValueQuick(&v_hwgamma, 1);
1684 Cvar_SetValueQuick(&v_gamma, 1);
1685 Cvar_SetValueQuick(&v_contrast, 1);
1686 Cvar_SetValueQuick(&v_brightness, 0);
1687 Cvar_SetValueQuick(&v_color_enable, 0);
1688 Cvar_SetValueQuick(&v_color_black_r, 0);
1689 Cvar_SetValueQuick(&v_color_black_g, 0);
1690 Cvar_SetValueQuick(&v_color_black_b, 0);
1691 Cvar_SetValueQuick(&v_color_grey_r, 0);
1692 Cvar_SetValueQuick(&v_color_grey_g, 0);
1693 Cvar_SetValueQuick(&v_color_grey_b, 0);
1694 Cvar_SetValueQuick(&v_color_white_r, 1);
1695 Cvar_SetValueQuick(&v_color_white_g, 1);
1696 Cvar_SetValueQuick(&v_color_white_b, 1);
1697 Cbuf_AddText ("exec default.cfg\n");
1700 M_Menu_Options_ColorControl_AdjustSliders (1);
1706 S_LocalSound ("misc/menu1.wav");
1707 options_colorcontrol_cursor--;
1708 if (options_colorcontrol_cursor < 0)
1709 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1713 S_LocalSound ("misc/menu1.wav");
1714 options_colorcontrol_cursor++;
1715 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1716 options_colorcontrol_cursor = 0;
1720 M_Menu_Options_ColorControl_AdjustSliders (-1);
1724 M_Menu_Options_ColorControl_AdjustSliders (1);
1730 //=============================================================================
1733 char *quakebindnames[][2] =
1735 {"+attack", "attack"},
1736 {"impulse 10", "next weapon"},
1737 {"impulse 12", "previous weapon"},
1738 {"+jump", "jump / swim up"},
1739 {"+forward", "walk forward"},
1740 {"+back", "backpedal"},
1741 {"+left", "turn left"},
1742 {"+right", "turn right"},
1744 {"+moveleft", "step left"},
1745 {"+moveright", "step right"},
1746 {"+strafe", "sidestep"},
1747 {"+lookup", "look up"},
1748 {"+lookdown", "look down"},
1749 {"centerview", "center view"},
1750 {"+mlook", "mouse look"},
1751 {"+klook", "keyboard look"},
1752 {"+moveup", "swim up"},
1753 {"+movedown", "swim down"}
1756 char *transfusionbindnames[][2] =
1758 {"+forward", "walk forward"},
1759 {"+back", "backpedal"},
1760 {"+left", "turn left"},
1761 {"+right", "turn right"},
1762 {"+moveleft", "step left"},
1763 {"+moveright", "step right"},
1764 {"+jump", "jump / swim up"},
1765 {"+movedown", "swim down"},
1766 {"+attack", "attack"},
1767 {"+button3", "altfire"},
1768 {"impulse 1", "Pitch Fork"},
1769 {"impulse 2", "Flare Gun"},
1770 {"impulse 3", "Shotgun"},
1771 {"impulse 4", "Machine Gun"},
1772 {"impulse 5", "Incinerator"},
1773 {"impulse 6", "Bombs"},
1774 {"impulse 7", "Aerosol Can"},
1775 {"impulse 8", "Tesla Cannon"},
1776 {"impulse 9", "Life Leech"},
1777 {"impulse 17", "Voodoo Doll"},
1778 {"impulse 11", "previous weapon"},
1779 {"impulse 10", "next weapon"},
1780 {"impulse 14", "previous item"},
1781 {"impulse 15", "next item"},
1782 {"impulse 13", "use item"},
1783 {"impulse 100", "add bot (red)"},
1784 {"impulse 101", "add bot (blue)"},
1785 {"impulse 102", "kick a bot"},
1786 {"impulse 50", "voting menu"},
1787 {"impulse 141", "identify player"},
1788 {"impulse 16", "next armor type"},
1789 {"impulse 20", "observer mode"}
1792 char *goodvsbad2bindnames[][2] =
1794 {"impulse 69", "Power 1"},
1795 {"impulse 70", "Power 2"},
1796 {"impulse 71", "Power 3"},
1797 {"+jump", "jump / swim up"},
1798 {"+forward", "walk forward"},
1799 {"+back", "backpedal"},
1800 {"+left", "turn left"},
1801 {"+right", "turn right"},
1803 {"+moveleft", "step left"},
1804 {"+moveright", "step right"},
1805 {"+strafe", "sidestep"},
1806 {"+lookup", "look up"},
1807 {"+lookdown", "look down"},
1808 {"centerview", "center view"},
1809 {"+mlook", "mouse look"},
1810 {"kill", "kill yourself"},
1811 {"+moveup", "swim up"},
1812 {"+movedown", "swim down"}
1816 char *(*bindnames)[2];
1819 typedef struct binditem_s
1821 char *command, *description;
1822 struct binditem_s *next;
1826 typedef struct bindcategory_s
1830 struct bindcategory_s *next;
1834 bindcategory_t *bindcategories = NULL;
1836 void M_ClearBinds (void)
1838 for (c = bindcategories;c;c = cnext)
1841 for (b = c->binds;b;b = bnext)
1848 bindcategories = NULL;
1851 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1853 for (b = &c->binds;*b;*b = &(*b)->next);
1854 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1855 *b->command = (char *)((*b) + 1);
1856 *b->description = *b->command + strlen(command) + 1;
1857 strcpy(*b->command, command);
1858 strcpy(*b->description, description);
1861 void M_AddBind (char *category, char *command, char *description)
1863 for (c = &bindcategories;*c;c = &(*c)->next)
1865 if (!strcmp(category, (*c)->name))
1867 M_AddBindToCategory(*c, command, description);
1871 *c = Z_Alloc(sizeof(bindcategory_t));
1872 M_AddBindToCategory(*c, command, description);
1875 void M_DefaultBinds (void)
1878 M_AddBind("movement", "+jump", "jump / swim up");
1879 M_AddBind("movement", "+forward", "walk forward");
1880 M_AddBind("movement", "+back", "backpedal");
1881 M_AddBind("movement", "+left", "turn left");
1882 M_AddBind("movement", "+right", "turn right");
1883 M_AddBind("movement", "+speed", "run");
1884 M_AddBind("movement", "+moveleft", "step left");
1885 M_AddBind("movement", "+moveright", "step right");
1886 M_AddBind("movement", "+strafe", "sidestep");
1887 M_AddBind("movement", "+lookup", "look up");
1888 M_AddBind("movement", "+lookdown", "look down");
1889 M_AddBind("movement", "centerview", "center view");
1890 M_AddBind("movement", "+mlook", "mouse look");
1891 M_AddBind("movement", "+klook", "keyboard look");
1892 M_AddBind("movement", "+moveup", "swim up");
1893 M_AddBind("movement", "+movedown", "swim down");
1894 M_AddBind("weapons", "+attack", "attack");
1895 M_AddBind("weapons", "impulse 10", "next weapon");
1896 M_AddBind("weapons", "impulse 12", "previous weapon");
1897 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1898 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1899 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1900 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1901 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1902 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1903 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1904 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1912 void M_Menu_Keys_f (void)
1914 key_dest = key_menu;
1916 m_entersound = true;
1921 void M_FindKeysForCommand (char *command, int *keys)
1927 for (j = 0;j < NUMKEYS;j++)
1932 for (j=0 ; j<256 ; j++)
1937 if (!strcmp (b, command) )
1940 if (count == NUMKEYS)
1946 void M_UnbindCommand (char *command)
1951 for (j=0 ; j<256 ; j++)
1956 if (!strcmp (b, command))
1957 Key_SetBinding (j, "");
1962 void M_Keys_Draw (void)
1968 char keystring[1024];
1970 M_Background(320, 200);
1972 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1973 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1976 M_Print (12, 32, "Press a key or button for this action");
1978 M_Print (18, 32, "Enter to change, backspace to clear");
1980 // search for known bindings
1981 for (i=0 ; i<numcommands ; i++)
1985 M_Print (16, y, bindnames[i][1]);
1987 M_FindKeysForCommand (bindnames[i][0], keys);
1989 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1991 strcpy(keystring, "???");
1995 for (j = 0;j < NUMKEYS;j++)
2000 strcat(keystring, " or ");
2001 strcat(keystring, Key_KeynumToString (keys[j]));
2005 M_Print (150, y, keystring);
2009 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2011 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2015 void M_Keys_Key (int k)
2022 S_LocalSound ("misc/menu1.wav");
2027 else //if (k != '`')
2029 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2030 Cbuf_InsertText (cmd);
2040 M_Menu_Options_f ();
2045 S_LocalSound ("misc/menu1.wav");
2047 if (keys_cursor < 0)
2048 keys_cursor = numcommands-1;
2053 S_LocalSound ("misc/menu1.wav");
2055 if (keys_cursor >= numcommands)
2059 case K_ENTER: // go into bind mode
2060 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2061 S_LocalSound ("misc/menu2.wav");
2062 if (keys[NUMKEYS - 1] != -1)
2063 M_UnbindCommand (bindnames[keys_cursor][0]);
2067 case K_BACKSPACE: // delete bindings
2068 case K_DEL: // delete bindings
2069 S_LocalSound ("misc/menu2.wav");
2070 M_UnbindCommand (bindnames[keys_cursor][0]);
2075 //=============================================================================
2078 #define VIDEO_ITEMS 5
2080 int video_cursor = 0;
2081 int video_cursor_table[] = {56, 68, 80, 92, 116};
2082 // note: if modes are added to the beginning of this list, update the
2083 // video_resolution = x; in M_Menu_Video_f below
2084 unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,480}, {800,600}, {1024,768}, {1152,864}, {1280,960}, {1280,1024}, {1600,1200}, {1792,1344}, {1920,1440}, {2048,1536}};
2085 int video_resolution;
2087 extern int current_vid_fullscreen;
2088 extern int current_vid_width;
2089 extern int current_vid_height;
2090 extern int current_vid_bitsperpixel;
2091 extern int current_vid_stencil;
2094 void M_Menu_Video_f (void)
2096 key_dest = key_menu;
2098 m_entersound = true;
2100 // Look for the current resolution
2101 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
2103 if (video_resolutions[video_resolution][0] == current_vid_width &&
2104 video_resolutions[video_resolution][1] == current_vid_height)
2108 // Default to 800x600 if we didn't find it
2109 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
2111 // may need to update this number if mode list changes
2112 video_resolution = 4;
2113 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2114 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2119 void M_Video_Draw (void)
2124 M_Background(320, 200);
2126 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2127 p = Draw_CachePic("gfx/vidmodes.lmp");
2128 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2131 M_Print(16, video_cursor_table[0], " Resolution");
2132 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2133 M_Print (220, video_cursor_table[0], string);
2136 M_Print(16, video_cursor_table[1], " Bits per pixel");
2137 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2140 M_Print(16, video_cursor_table[2], " Fullscreen");
2141 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2144 M_Print(16, video_cursor_table[3], " Stencil");
2145 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2148 M_Print(220, video_cursor_table[4], "Apply");
2151 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2155 void M_Menu_Video_AdjustSliders (int dir)
2157 S_LocalSound ("misc/menu3.wav");
2159 switch (video_cursor)
2164 int new_resolution = video_resolution + dir;
2165 if (new_resolution < 0)
2166 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2167 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2168 video_resolution = 0;
2170 video_resolution = new_resolution;
2172 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2173 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2179 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2182 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2185 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2191 void M_Video_Key (int key)
2196 // vid_shared.c has a copy of the current video config. We restore it
2197 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2198 Cvar_SetValueQuick(&vid_width, current_vid_width);
2199 Cvar_SetValueQuick(&vid_height, current_vid_height);
2200 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2201 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2203 S_LocalSound ("misc/menu1.wav");
2204 M_Menu_Options_f ();
2208 m_entersound = true;
2209 switch (video_cursor)
2212 Cbuf_AddText ("vid_restart\n");
2213 M_Menu_Options_f ();
2216 M_Menu_Video_AdjustSliders (1);
2221 S_LocalSound ("misc/menu1.wav");
2223 if (video_cursor < 0)
2224 video_cursor = VIDEO_ITEMS-1;
2228 S_LocalSound ("misc/menu1.wav");
2230 if (video_cursor >= VIDEO_ITEMS)
2235 M_Menu_Video_AdjustSliders (-1);
2239 M_Menu_Video_AdjustSliders (1);
2244 //=============================================================================
2248 #define NUM_HELP_PAGES 6
2251 void M_Menu_Help_f (void)
2253 key_dest = key_menu;
2255 m_entersound = true;
2261 void M_Help_Draw (void)
2263 M_Background(320, 200);
2264 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2268 void M_Help_Key (int key)
2278 m_entersound = true;
2279 if (++help_page >= NUM_HELP_PAGES)
2285 m_entersound = true;
2286 if (--help_page < 0)
2287 help_page = NUM_HELP_PAGES-1;
2293 //=============================================================================
2297 int m_quit_prevstate;
2298 qboolean wasInMenus;
2300 char *quitMessage [] =
2302 /* .........1.........2.... */
2304 " Are you gonna quit ",
2305 " this game just like ",
2306 " everything else? ",
2309 " Milord, methinks that ",
2310 " thou art a lowly ",
2311 " quitter. Is this true? ",
2314 " Do I need to bust your ",
2315 " face open for trying ",
2319 " Man, I oughta smack you",
2320 " for trying to quit! ",
2324 " Press Y to quit like a ",
2325 " big loser in life. ",
2326 " Press N to stay proud ",
2327 " and successful! ",
2329 " If you press Y to ",
2330 " quit, I will summon ",
2331 " Satan all over your ",
2334 " Um, Asmodeus dislikes ",
2335 " his children trying to ",
2336 " quit. Press Y to return",
2337 " to your Tinkertoys. ",
2339 " If you quit now, I'll ",
2340 " throw a blanket-party ",
2341 " for you next time! ",
2345 /* .........1.........2.... */
2347 " Tired of fragging ",
2352 " Quit now and forfeit ",
2353 " your bodycount? ",
2357 " Are you sure you ",
2362 " Off to do something ",
2367 char *goodvsbad2quitMessage [] =
2369 /* .........1.........2.... */
2370 " Press Yes To Quit ",
2375 " Do you really want to ",
2377 " Play Good vs bad 3! ",
2380 " All your quit are ",
2381 " belong to long duck ",
2385 " Press Y to quit ",
2387 " But are you too legit?",
2390 " This game was made by ",
2392 " It is by far the best ",
2393 " game ever made. ",
2395 " Even I really dont ",
2396 " know of a game better ",
2397 " Press Y to quit ",
2398 " like rougue chedder ",
2400 " After you stop playing",
2401 " tell the guys who made ",
2402 " counterstrike to just ",
2403 " kill themselves now ",
2405 " Press Y to exit to DOS",
2407 " SSH login as user Y ",
2408 " to exit to Linux "
2411 " Press Y like you ",
2412 " were waanderers ",
2416 " This game was made in ",
2417 " Nippon like the SS ",
2418 " announcer's saying ipon",
2426 " Please stop playing ",
2427 " this stupid game ",
2431 void M_Menu_Quit_f (void)
2433 if (m_state == m_quit)
2435 wasInMenus = (key_dest == key_menu);
2436 key_dest = key_menu;
2437 m_quit_prevstate = m_state;
2439 m_entersound = true;
2440 msgNumber = rand()&3; //&7;
2444 void M_Quit_Key (int key)
2453 m_state = m_quit_prevstate;
2454 m_entersound = true;
2458 key_dest = key_game;
2475 void M_Quit_Draw (void)
2477 M_Background(208, 48);
2478 M_DrawTextBox(0, 0, 24, 4);
2479 M_Print(8, 8, quitMessage[msgNumber*4+0]);
2480 M_Print(8, 16, quitMessage[msgNumber*4+1]);
2481 M_Print(8, 24, quitMessage[msgNumber*4+2]);
2482 M_Print(8, 32, quitMessage[msgNumber*4+3]);
2485 //=============================================================================
2486 /* LAN CONFIG MENU */
2488 int lanConfig_cursor = -1;
2489 int lanConfig_cursor_table [] = {56, 76, 112};
2490 #define NUM_LANCONFIG_CMDS 3
2493 char lanConfig_portname[6];
2494 char lanConfig_joinname[22];
2496 void M_Menu_LanConfig_f (void)
2498 key_dest = key_menu;
2499 m_state = m_lanconfig;
2500 m_entersound = true;
2501 if (lanConfig_cursor == -1)
2504 lanConfig_cursor = 1;
2507 lanConfig_cursor = 1;
2508 lanConfig_port = 26000;
2509 sprintf(lanConfig_portname, "%u", lanConfig_port);
2511 m_return_reason[0] = 0;
2515 void M_LanConfig_Draw (void)
2522 M_Background(320, 200);
2524 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2525 p = Draw_CachePic ("gfx/p_multi.lmp");
2526 basex = (320-p->width)/2;
2527 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2530 startJoin = "New Game";
2532 startJoin = "Join Game";
2533 protocol = "TCP/IP";
2534 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2537 M_Print (basex, lanConfig_cursor_table[0], "Port");
2538 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2539 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2543 M_Print (basex, lanConfig_cursor_table[1], "Search for games...");
2544 M_Print (basex, lanConfig_cursor_table[2]-16, "Join game at:");
2545 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2546 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2550 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2551 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2554 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2556 if (lanConfig_cursor == 0)
2557 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2559 if (lanConfig_cursor == 2)
2560 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2562 if (*m_return_reason)
2563 M_PrintWhite (basex, 168, m_return_reason);
2567 void M_LanConfig_Key (int key)
2574 M_Menu_MultiPlayer_f ();
2578 S_LocalSound ("misc/menu1.wav");
2580 if (lanConfig_cursor < 0)
2581 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2585 S_LocalSound ("misc/menu1.wav");
2587 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2588 lanConfig_cursor = 0;
2592 if (lanConfig_cursor == 0)
2595 m_entersound = true;
2597 Cbuf_AddText ("stopdemo\n");
2599 Cvar_SetValue("port", lanConfig_port);
2601 if (lanConfig_cursor == 1)
2605 M_Menu_GameOptions_f ();
2608 M_Menu_ServerList_f();
2612 if (lanConfig_cursor == 2)
2613 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2617 if (lanConfig_cursor == 0)
2619 if (strlen(lanConfig_portname))
2620 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2623 if (lanConfig_cursor == 2)
2625 if (strlen(lanConfig_joinname))
2626 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2631 if (key < 32 || key > 127)
2634 if (lanConfig_cursor == 2)
2636 l = strlen(lanConfig_joinname);
2639 lanConfig_joinname[l+1] = 0;
2640 lanConfig_joinname[l] = key;
2644 if (key < '0' || key > '9')
2646 if (lanConfig_cursor == 0)
2648 l = strlen(lanConfig_portname);
2651 lanConfig_portname[l+1] = 0;
2652 lanConfig_portname[l] = key;
2657 if (StartingGame && lanConfig_cursor == 2)
2659 if (key == K_UPARROW)
2660 lanConfig_cursor = 1;
2662 lanConfig_cursor = 0;
2665 l = atoi(lanConfig_portname);
2668 sprintf(lanConfig_portname, "%u", lanConfig_port);
2671 //=============================================================================
2672 /* GAME OPTIONS MENU */
2691 episode_t *episodes;
2696 level_t quakelevels[] =
2698 {"start", "Entrance"}, // 0
2700 {"e1m1", "Slipgate Complex"}, // 1
2701 {"e1m2", "Castle of the Damned"},
2702 {"e1m3", "The Necropolis"},
2703 {"e1m4", "The Grisly Grotto"},
2704 {"e1m5", "Gloom Keep"},
2705 {"e1m6", "The Door To Chthon"},
2706 {"e1m7", "The House of Chthon"},
2707 {"e1m8", "Ziggurat Vertigo"},
2709 {"e2m1", "The Installation"}, // 9
2710 {"e2m2", "Ogre Citadel"},
2711 {"e2m3", "Crypt of Decay"},
2712 {"e2m4", "The Ebon Fortress"},
2713 {"e2m5", "The Wizard's Manse"},
2714 {"e2m6", "The Dismal Oubliette"},
2715 {"e2m7", "Underearth"},
2717 {"e3m1", "Termination Central"}, // 16
2718 {"e3m2", "The Vaults of Zin"},
2719 {"e3m3", "The Tomb of Terror"},
2720 {"e3m4", "Satan's Dark Delight"},
2721 {"e3m5", "Wind Tunnels"},
2722 {"e3m6", "Chambers of Torment"},
2723 {"e3m7", "The Haunted Halls"},
2725 {"e4m1", "The Sewage System"}, // 23
2726 {"e4m2", "The Tower of Despair"},
2727 {"e4m3", "The Elder God Shrine"},
2728 {"e4m4", "The Palace of Hate"},
2729 {"e4m5", "Hell's Atrium"},
2730 {"e4m6", "The Pain Maze"},
2731 {"e4m7", "Azure Agony"},
2732 {"e4m8", "The Nameless City"},
2734 {"end", "Shub-Niggurath's Pit"}, // 31
2736 {"dm1", "Place of Two Deaths"}, // 32
2737 {"dm2", "Claustrophobopolis"},
2738 {"dm3", "The Abandoned Base"},
2739 {"dm4", "The Bad Place"},
2740 {"dm5", "The Cistern"},
2741 {"dm6", "The Dark Zone"}
2744 episode_t quakeepisodes[] =
2746 {"Welcome to Quake", 0, 1},
2747 {"Doomed Dimension", 1, 8},
2748 {"Realm of Black Magic", 9, 7},
2749 {"Netherworld", 16, 7},
2750 {"The Elder World", 23, 8},
2751 {"Final Level", 31, 1},
2752 {"Deathmatch Arena", 32, 6}
2755 //MED 01/06/97 added hipnotic levels
2756 level_t hipnoticlevels[] =
2758 {"start", "Command HQ"}, // 0
2760 {"hip1m1", "The Pumping Station"}, // 1
2761 {"hip1m2", "Storage Facility"},
2762 {"hip1m3", "The Lost Mine"},
2763 {"hip1m4", "Research Facility"},
2764 {"hip1m5", "Military Complex"},
2766 {"hip2m1", "Ancient Realms"}, // 6
2767 {"hip2m2", "The Black Cathedral"},
2768 {"hip2m3", "The Catacombs"},
2769 {"hip2m4", "The Crypt"},
2770 {"hip2m5", "Mortum's Keep"},
2771 {"hip2m6", "The Gremlin's Domain"},
2773 {"hip3m1", "Tur Torment"}, // 12
2774 {"hip3m2", "Pandemonium"},
2775 {"hip3m3", "Limbo"},
2776 {"hip3m4", "The Gauntlet"},
2778 {"hipend", "Armagon's Lair"}, // 16
2780 {"hipdm1", "The Edge of Oblivion"} // 17
2783 //MED 01/06/97 added hipnotic episodes
2784 episode_t hipnoticepisodes[] =
2786 {"Scourge of Armagon", 0, 1},
2787 {"Fortress of the Dead", 1, 5},
2788 {"Dominion of Darkness", 6, 6},
2789 {"The Rift", 12, 4},
2790 {"Final Level", 16, 1},
2791 {"Deathmatch Arena", 17, 1}
2794 //PGM 01/07/97 added rogue levels
2795 //PGM 03/02/97 added dmatch level
2796 level_t roguelevels[] =
2798 {"start", "Split Decision"},
2799 {"r1m1", "Deviant's Domain"},
2800 {"r1m2", "Dread Portal"},
2801 {"r1m3", "Judgement Call"},
2802 {"r1m4", "Cave of Death"},
2803 {"r1m5", "Towers of Wrath"},
2804 {"r1m6", "Temple of Pain"},
2805 {"r1m7", "Tomb of the Overlord"},
2806 {"r2m1", "Tempus Fugit"},
2807 {"r2m2", "Elemental Fury I"},
2808 {"r2m3", "Elemental Fury II"},
2809 {"r2m4", "Curse of Osiris"},
2810 {"r2m5", "Wizard's Keep"},
2811 {"r2m6", "Blood Sacrifice"},
2812 {"r2m7", "Last Bastion"},
2813 {"r2m8", "Source of Evil"},
2814 {"ctf1", "Division of Change"}
2817 //PGM 01/07/97 added rogue episodes
2818 //PGM 03/02/97 added dmatch episode
2819 episode_t rogueepisodes[] =
2821 {"Introduction", 0, 1},
2822 {"Hell's Fortress", 1, 7},
2823 {"Corridors of Time", 8, 8},
2824 {"Deathmatch Arena", 16, 1}
2827 level_t nehahralevels[] =
2829 {"nehstart", "Welcome to Nehahra"},
2830 {"neh1m1", "Forge City1: Slipgates"},
2831 {"neh1m2", "Forge City2: Boiler"},
2832 {"neh1m3", "Forge City3: Escape"},
2833 {"neh1m4", "Grind Core"},
2834 {"neh1m5", "Industrial Silence"},
2835 {"neh1m6", "Locked-Up Anger"},
2836 {"neh1m7", "Wanderer of the Wastes"},
2837 {"neh1m8", "Artemis System Net"},
2838 {"neh1m9", "To the Death"},
2839 {"neh2m1", "The Gates of Ghoro"},
2840 {"neh2m2", "Sacred Trinity"},
2841 {"neh2m3", "Realm of the Ancients"},
2842 {"neh2m4", "Temple of the Ancients"},
2843 {"neh2m5", "Dreams Made Flesh"},
2844 {"neh2m6", "Your Last Cup of Sorrow"},
2845 {"nehsec", "Ogre's Bane"},
2846 {"nehahra", "Nehahra's Den"},
2847 {"nehend", "Quintessence"}
2850 episode_t nehahraepisodes[] =
2852 {"Welcome to Nehahra", 0, 1},
2853 {"The Fall of Forge", 1, 9},
2854 {"The Outlands", 10, 7},
2855 {"Dimension of the Lost", 17, 2}
2858 // Map list for Transfusion
2859 level_t transfusionlevels[] =
2861 {"bb1", "The Stronghold"},
2862 {"bb2", "Winter Wonderland"},
2864 {"bb4", "The Tower"},
2866 {"bb6", "Twin Fortress"},
2868 {"bb8", "Fun With Heads"},
2870 {"e1m1", "Cradle to Grave"},
2871 {"e1m2", "Wrong Side of the Tracks"},
2872 {"e1m7", "Altar of Stone"},
2873 {"e2m8", "The Lair of Shial"},
2874 {"e3m7", "The Pit of Cerberus"},
2875 {"e4m8", "The Hall of the Epiphany"},
2876 {"e4m9", "Mall of the Dead"},
2878 {"dm1", "Monolith Building 11"},
2881 {"e6m1", "Welcome to Your Life"},
2882 {"e6m8", "Beauty and the Beast"},
2884 {"cpbb01", "Crypt of Despair"},
2885 {"cpbb03", "Unholy Cathedral"},
2887 {"b2a15", "Area 15 (B2)"},
2888 {"barena", "Blood Arena"},
2889 {"bkeep", "Blood Keep"},
2890 {"bstar", "Brown Star"},
2891 {"crypt", "The Crypt"},
2893 {"bb3_2k1", "Bodies Infusion"},
2894 {"dcamp", "DeathCamp"},
2895 {"highnoon", "HighNoon"},
2896 {"qbb1", "The Confluence"},
2897 {"qbb2", "KathartiK"},
2898 {"qbb3", "Caleb's Woodland Retreat"},
2900 {"dranzbb6", "Black Coffee"},
2901 {"fragm", "Frag'M"},
2903 {"qe1m7", "The House of Chthon"},
2904 {"simple", "Dead Simple"}
2907 episode_t transfusionepisodes[] =
2910 {"Blood Single Player", 8, 7},
2911 {"Plasma Pack", 15, 5},
2912 {"Cryptic Passage", 20, 2},
2914 {"Transfusion", 27, 6},
2915 {"Conversions", 33, 5}
2918 level_t goodvsbad2levels[] =
2920 {"rts", "Many Paths"}, // 0
2921 {"chess", "Chess, Scott Hess"}, // 1
2922 {"dot", "Big Wall"},
2923 {"city2", "The Big City"},
2924 {"bwall", "0 G like Psychic TV"},
2925 {"snow", "Wireframed"},
2926 {"telep", "Infinite Falling"},
2927 {"faces", "Facing Bases"},
2928 {"island", "Adventure Islands"},
2931 episode_t goodvsbad2episodes[] =
2933 {"Levels? Bevels!", 0, 8},
2936 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2937 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2938 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2939 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2940 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2941 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
2942 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
2947 gamelevels_t *notregistered;
2948 gamelevels_t *registered;
2952 gameinfo_t gamelist[] =
2954 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2955 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2956 {GAME_ROGUE, &roguegame, &roguegame},
2957 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2958 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2959 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2962 gamelevels_t *lookupgameinfo(void)
2965 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2966 if (registered.integer)
2967 return gamelist[i].registered;
2969 return gamelist[i].notregistered;
2975 qboolean m_serverInfoMessage = false;
2976 double m_serverInfoMessageTime;
2978 extern cvar_t sv_public;
2980 void M_Menu_GameOptions_f (void)
2982 key_dest = key_menu;
2983 m_state = m_gameoptions;
2984 m_entersound = true;
2985 if (maxplayers == 0)
2986 maxplayers = svs.maxclients;
2988 maxplayers = MAX_SCOREBOARD;
2992 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 132, 152, 160};
2993 #define NUM_GAMEOPTIONS 11
2994 int gameoptions_cursor;
2996 void M_GameOptions_Draw (void)
3002 M_Background(320, 200);
3004 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3005 p = Draw_CachePic ("gfx/p_multi.lmp");
3006 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3008 M_DrawTextBox (152, 32, 10, 1);
3009 M_Print (160, 40, "begin game");
3011 M_Print (0, 56, " Max players");
3012 M_Print (160, 56, va("%i", maxplayers) );
3014 if (gamemode != GAME_GOODVSBAD2)
3016 M_Print (0, 64, " Game Type");
3017 if (gamemode == GAME_TRANSFUSION)
3019 if (!deathmatch.integer)
3020 Cvar_SetValue("deathmatch", 1);
3021 if (deathmatch.integer == 2)
3022 M_Print (160, 64, "Capture the Flag");
3024 M_Print (160, 64, "Blood Bath");
3028 if (!coop.integer && !deathmatch.integer)
3029 Cvar_SetValue("deathmatch", 1);
3031 M_Print (160, 64, "Cooperative");
3033 M_Print (160, 64, "Deathmatch");
3036 M_Print (0, 72, " Teamplay");
3037 if (gamemode == GAME_ROGUE)
3041 switch((int)teamplay.integer)
3043 case 1: msg = "No Friendly Fire"; break;
3044 case 2: msg = "Friendly Fire"; break;
3045 case 3: msg = "Tag"; break;
3046 case 4: msg = "Capture the Flag"; break;
3047 case 5: msg = "One Flag CTF"; break;
3048 case 6: msg = "Three Team CTF"; break;
3049 default: msg = "Off"; break;
3051 M_Print (160, 72, msg);
3057 switch (teamplay.integer)
3059 case 0: msg = "Off"; break;
3060 case 2: msg = "Friendly Fire"; break;
3061 default: msg = "No Friendly Fire"; break;
3063 M_Print (160, 72, msg);
3066 M_Print (0, 80, " Skill");
3067 if (skill.integer == 0)
3068 M_Print (160, 80, "Easy difficulty");
3069 else if (skill.integer == 1)
3070 M_Print (160, 80, "Normal difficulty");
3071 else if (skill.integer == 2)
3072 M_Print (160, 80, "Hard difficulty");
3074 M_Print (160, 80, "Nightmare difficulty");
3076 M_Print (0, 88, " Frag Limit");
3077 if (fraglimit.integer == 0)
3078 M_Print (160, 88, "none");
3080 M_Print (160, 88, va("%i frags", fraglimit.integer));
3082 M_Print (0, 96, " Time Limit");
3083 if (timelimit.integer == 0)
3084 M_Print (160, 96, "none");
3086 M_Print (160, 96, va("%i minutes", timelimit.integer));
3089 M_Print (0, 104, " Public server");
3090 M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes");
3092 M_Print (0, 120, " Server name");
3093 M_DrawTextBox (0, 124, 38, 1);
3094 M_Print (8, 132, hostname.string);
3096 g = lookupgameinfo();
3098 if (gamemode != GAME_GOODVSBAD2)
3100 M_Print (0, 152, " Episode");
3101 M_Print (160, 152, g->episodes[startepisode].description);
3104 M_Print (0, 160, " Level");
3105 M_Print (160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3106 M_Print (160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3109 if (gameoptions_cursor == 8)
3110 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3112 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3114 if (m_serverInfoMessage)
3116 if ((realtime - m_serverInfoMessageTime) < 5.0)
3119 M_DrawTextBox (x, 138, 24, 4);
3121 M_Print (x, 146, " More than 64 players?? ");
3122 M_Print (x, 154, " First, question your ");
3123 M_Print (x, 162, " sanity, then email ");
3124 M_Print (x, 170, " havoc@telefragged.com ");
3127 m_serverInfoMessage = false;
3132 void M_NetStart_Change (int dir)
3137 switch (gameoptions_cursor)
3141 if (maxplayers > MAX_SCOREBOARD)
3143 maxplayers = MAX_SCOREBOARD;
3144 m_serverInfoMessage = true;
3145 m_serverInfoMessageTime = realtime;
3152 if (gamemode == GAME_GOODVSBAD2)
3154 if (gamemode == GAME_TRANSFUSION)
3156 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3157 Cvar_SetValueQuick (&deathmatch, 0);
3158 else // changing from BloodBath to CTF
3159 Cvar_SetValueQuick (&deathmatch, 2);
3163 if (deathmatch.integer) // changing from deathmatch to coop
3165 Cvar_SetValueQuick (&coop, 1);
3166 Cvar_SetValueQuick (&deathmatch, 0);
3168 else // changing from coop to deathmatch
3170 Cvar_SetValueQuick (&coop, 0);
3171 Cvar_SetValueQuick (&deathmatch, 1);
3177 if (gamemode == GAME_GOODVSBAD2)
3179 if (gamemode == GAME_ROGUE)
3184 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3185 if (teamplay.integer > count)
3186 Cvar_SetValueQuick (&teamplay, 0);
3187 else if (teamplay.integer < 0)
3188 Cvar_SetValueQuick (&teamplay, count);
3192 if (gamemode == GAME_GOODVSBAD2)
3194 Cvar_SetValueQuick (&skill, skill.integer + dir);
3195 if (skill.integer > 3)
3196 Cvar_SetValueQuick (&skill, 0);
3197 if (skill.integer < 0)
3198 Cvar_SetValueQuick (&skill, 3);
3202 if (gamemode == GAME_GOODVSBAD2)
3204 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3205 if (fraglimit.integer > 100)
3206 Cvar_SetValueQuick (&fraglimit, 0);
3207 if (fraglimit.integer < 0)
3208 Cvar_SetValueQuick (&fraglimit, 100);
3212 if (gamemode == GAME_GOODVSBAD2)
3214 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3215 if (timelimit.value > 60)
3216 Cvar_SetValueQuick (&timelimit, 0);
3217 if (timelimit.value < 0)
3218 Cvar_SetValueQuick (&timelimit, 60);
3222 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3229 if (gamemode == GAME_GOODVSBAD2)
3231 startepisode += dir;
3232 g = lookupgameinfo();
3234 if (startepisode < 0)
3235 startepisode = g->numepisodes - 1;
3237 if (startepisode >= g->numepisodes)
3245 g = lookupgameinfo();
3248 startlevel = g->episodes[startepisode].levels - 1;
3250 if (startlevel >= g->episodes[startepisode].levels)
3256 void M_GameOptions_Key (int key)
3260 char hostnamebuf[128];
3265 M_Menu_MultiPlayer_f ();
3269 S_LocalSound ("misc/menu1.wav");
3270 gameoptions_cursor--;
3271 if (gameoptions_cursor < 0)
3272 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3276 S_LocalSound ("misc/menu1.wav");
3277 gameoptions_cursor++;
3278 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3279 gameoptions_cursor = 0;
3283 if (gameoptions_cursor == 0)
3285 S_LocalSound ("misc/menu3.wav");
3286 M_NetStart_Change (-1);
3290 if (gameoptions_cursor == 0)
3292 S_LocalSound ("misc/menu3.wav");
3293 M_NetStart_Change (1);
3297 S_LocalSound ("misc/menu2.wav");
3298 if (gameoptions_cursor == 0)
3301 Cbuf_AddText ("disconnect\n");
3302 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3304 g = lookupgameinfo();
3305 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3309 M_NetStart_Change (1);
3313 if (gameoptions_cursor == 8)
3315 l = strlen(hostname.string);
3319 memcpy(hostnamebuf, hostname.string, l);
3321 Cvar_Set("hostname", hostnamebuf);
3327 if (key < 32 || key > 127)
3329 if (gameoptions_cursor == 8)
3331 l = strlen(hostname.string);
3334 memcpy(hostnamebuf, hostname.string, l);
3335 hostnamebuf[l] = key;
3336 hostnamebuf[l+1] = 0;
3337 Cvar_Set("hostname", hostnamebuf);
3343 //=============================================================================
3348 void M_Menu_ServerList_f (void)
3350 key_dest = key_menu;
3352 m_entersound = true;
3354 m_return_reason[0] = 0;
3359 void M_ServerList_Draw (void)
3361 int n, y, visible, start, end;
3364 // use as much vertical space as available
3365 M_Background(640, vid.conheight);
3366 // scroll the list as the cursor moves
3367 visible = (vid.conheight - 16 - 32) / 8;
3368 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3369 end = min(start + visible, hostCacheCount);
3371 p = Draw_CachePic("gfx/p_multi.lmp");
3372 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3374 for (n = start;n < end;n++)
3376 M_Print(0, y, hostcache[n].line1);y += 8;
3377 M_Print(0, y, hostcache[n].line2);y += 8;
3379 M_DrawCharacter(0, 32 + (slist_cursor - start) * 16, 12+((int)(realtime*4)&1));
3381 if (*m_return_reason)
3382 M_PrintWhite(16, vid.conheight - 8, m_return_reason);
3386 void M_ServerList_Key(int k)
3391 M_Menu_LanConfig_f();
3400 S_LocalSound("misc/menu1.wav");
3402 if (slist_cursor < 0)
3403 slist_cursor = hostCacheCount - 1;
3408 S_LocalSound("misc/menu1.wav");
3410 if (slist_cursor >= hostCacheCount)
3415 S_LocalSound("misc/menu2.wav");
3416 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3425 //=============================================================================
3426 /* Menu Subsystem */
3431 menu_mempool = Mem_AllocPool("Menu");
3432 menuplyr_load = true;
3433 menuplyr_pixels = NULL;
3435 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3437 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3438 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3439 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3440 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3441 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3442 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3443 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3444 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3445 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3446 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3447 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3448 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3449 Cmd_AddCommand ("help", M_Menu_Help_f);
3450 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3452 if (gamemode == GAME_TRANSFUSION)
3454 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3455 bindnames = transfusionbindnames;
3457 else if (gamemode == GAME_GOODVSBAD2)
3459 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3460 bindnames = goodvsbad2bindnames;
3464 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3465 bindnames = quakebindnames;
3468 if (gamemode == GAME_NEHAHRA)
3470 if (FS_FileExists("maps/neh1m4.bsp"))
3472 if (FS_FileExists("hearing.dem"))
3474 Con_Printf("Nehahra movie and game detected.\n");
3475 NehGameType = TYPE_BOTH;
3479 Con_Printf("Nehahra game detected.\n");
3480 NehGameType = TYPE_GAME;
3485 if (FS_FileExists("hearing.dem"))
3487 Con_Printf("Nehahra movie detected.\n");
3488 NehGameType = TYPE_DEMO;
3492 Con_Printf("Nehahra not found.\n");
3493 NehGameType = TYPE_GAME; // could just complain, but...
3501 if (key_dest != key_menu)
3503 if (m_state == m_none)
3519 case m_singleplayer:
3520 M_SinglePlayer_Draw ();
3532 M_MultiPlayer_Draw ();
3543 case m_options_effects:
3544 M_Options_Effects_Draw ();
3547 case m_options_colorcontrol:
3548 M_Options_ColorControl_Draw ();
3568 M_LanConfig_Draw ();
3572 M_GameOptions_Draw ();
3576 M_ServerList_Draw ();
3582 S_LocalSound ("misc/menu2.wav");
3583 m_entersound = false;
3590 void M_Keydown (int key)
3605 case m_singleplayer:
3606 M_SinglePlayer_Key (key);
3618 M_MultiPlayer_Key (key);
3626 M_Options_Key (key);
3629 case m_options_effects:
3630 M_Options_Effects_Key (key);
3633 case m_options_colorcontrol:
3634 M_Options_ColorControl_Key (key);
3654 M_LanConfig_Key (key);
3658 M_GameOptions_Key (key);
3662 M_ServerList_Key (key);