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 || gamemode == GAME_BATTLEMECH)
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");
582 else if (gamemode == GAME_BATTLEMECH)
583 M_PrintWhite (95, 10 * 8, "Battlemech is for");
585 M_PrintWhite (95, 10 * 8, "Transfusion is for");
586 M_PrintWhite (83, 11 * 8, "multiplayer play only");
592 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
593 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
595 f = (int)(realtime * 10)%6;
597 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
602 void M_SinglePlayer_Key (int key)
604 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
606 if (key == K_ESCAPE || key == K_ENTER)
618 S_LocalSound ("misc/menu1.wav");
619 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
620 m_singleplayer_cursor = 0;
624 S_LocalSound ("misc/menu1.wav");
625 if (--m_singleplayer_cursor < 0)
626 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
632 switch (m_singleplayer_cursor)
637 Cbuf_AddText ("disconnect\n");
638 Cbuf_AddText ("maxplayers 1\n");
639 Cbuf_AddText ("deathmatch 0\n");
640 Cbuf_AddText ("coop 0\n");
641 if (gamemode == GAME_NEHAHRA)
642 Cbuf_AddText ("map nehstart\n");
644 Cbuf_AddText ("map start\n");
658 //=============================================================================
661 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
663 #define MAX_SAVEGAMES 12
664 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
665 int loadable[MAX_SAVEGAMES];
667 void M_ScanSaves (void)
670 char name[MAX_OSPATH];
675 for (i=0 ; i<MAX_SAVEGAMES ; i++)
677 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
679 sprintf (name, "s%i.sav", i);
680 f = FS_Open (name, "r", false);
683 str = FS_Getline (f);
684 sscanf (str, "%i\n", &version);
685 str = FS_Getline (f);
686 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
688 // change _ back to space
689 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
690 if (m_filenames[i][j] == '_')
691 m_filenames[i][j] = ' ';
697 void M_Menu_Load_f (void)
706 void M_Menu_Save_f (void)
721 void M_Load_Draw (void)
726 M_Background(320, 200);
728 p = Draw_CachePic ("gfx/p_load.lmp");
729 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
731 for (i=0 ; i< MAX_SAVEGAMES; i++)
732 M_Print (16, 32 + 8*i, m_filenames[i]);
735 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
739 void M_Save_Draw (void)
744 M_Background(320, 200);
746 p = Draw_CachePic ("gfx/p_save.lmp");
747 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
749 for (i=0 ; i<MAX_SAVEGAMES ; i++)
750 M_Print (16, 32 + 8*i, m_filenames[i]);
753 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
757 void M_Load_Key (int k)
762 M_Menu_SinglePlayer_f ();
766 S_LocalSound ("misc/menu2.wav");
767 if (!loadable[load_cursor])
772 // issue the load command
773 Cbuf_AddText (va ("load s%i\n", load_cursor) );
778 S_LocalSound ("misc/menu1.wav");
781 load_cursor = MAX_SAVEGAMES-1;
786 S_LocalSound ("misc/menu1.wav");
788 if (load_cursor >= MAX_SAVEGAMES)
795 void M_Save_Key (int k)
800 M_Menu_SinglePlayer_f ();
806 Cbuf_AddText (va("save s%i\n", load_cursor));
811 S_LocalSound ("misc/menu1.wav");
814 load_cursor = MAX_SAVEGAMES-1;
819 S_LocalSound ("misc/menu1.wav");
821 if (load_cursor >= MAX_SAVEGAMES)
827 //=============================================================================
828 /* MULTIPLAYER MENU */
830 int m_multiplayer_cursor;
831 #define MULTIPLAYER_ITEMS 3
834 void M_Menu_MultiPlayer_f (void)
837 m_state = m_multiplayer;
842 void M_MultiPlayer_Draw (void)
847 M_Background(320, 200);
849 M_DrawPic (16, 4, "gfx/qplaque.lmp");
850 p = Draw_CachePic ("gfx/p_multi.lmp");
851 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
852 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
854 f = (int)(realtime * 10)%6;
856 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
860 void M_MultiPlayer_Key (int key)
869 S_LocalSound ("misc/menu1.wav");
870 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
871 m_multiplayer_cursor = 0;
875 S_LocalSound ("misc/menu1.wav");
876 if (--m_multiplayer_cursor < 0)
877 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
882 switch (m_multiplayer_cursor)
886 M_Menu_LanConfig_f ();
896 //=============================================================================
899 int setup_cursor = 3;
900 int setup_cursor_table[] = {40, 64, 88, 124};
902 char setup_myname[32];
908 #define NUM_SETUP_CMDS 4
910 void M_Menu_Setup_f (void)
915 strcpy(setup_myname, cl_name.string);
916 setup_top = setup_oldtop = cl_color.integer >> 4;
917 setup_bottom = setup_oldbottom = cl_color.integer & 15;
920 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
921 static qbyte *menuplyr_pixels;
922 static unsigned int *menuplyr_translated;
924 void M_Setup_Draw (void)
929 M_Background(320, 200);
931 M_DrawPic (16, 4, "gfx/qplaque.lmp");
932 p = Draw_CachePic ("gfx/p_multi.lmp");
933 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
935 M_Print (64, 40, "Your name");
936 M_DrawTextBox (160, 32, 16, 1);
937 M_Print (168, 40, setup_myname);
939 if (gamemode != GAME_GOODVSBAD2)
941 M_Print (64, 64, "Shirt color");
942 M_Print (64, 88, "Pants color");
945 M_DrawTextBox (64, 124-8, 14, 1);
946 M_Print (72, 124, "Accept Changes");
948 // LordHavoc: rewrote this code greatly
952 menuplyr_load = false;
954 menuplyr_bottom = -1;
955 if ((f = FS_LoadFile("gfx/menuplyr.lmp", true)))
957 data = LoadLMPAs8Bit (f, 0, 0);
958 menuplyr_width = image_width;
959 menuplyr_height = image_height;
961 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
962 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
963 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
970 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
972 menuplyr_top = setup_top;
973 menuplyr_bottom = setup_bottom;
974 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
975 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
976 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
977 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
979 M_DrawPic(160, 48, "gfx/bigbox.lmp");
980 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
983 if (setup_cursor == 0)
984 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
986 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
990 void M_Setup_Key (int k)
997 M_Menu_MultiPlayer_f ();
1001 S_LocalSound ("misc/menu1.wav");
1003 if (setup_cursor < 0)
1004 setup_cursor = NUM_SETUP_CMDS-1;
1008 S_LocalSound ("misc/menu1.wav");
1010 if (setup_cursor >= NUM_SETUP_CMDS)
1015 if (setup_cursor < 1)
1017 S_LocalSound ("misc/menu3.wav");
1018 if (setup_cursor == 1)
1019 setup_top = setup_top - 1;
1020 if (setup_cursor == 2)
1021 setup_bottom = setup_bottom - 1;
1024 if (setup_cursor < 1)
1027 S_LocalSound ("misc/menu3.wav");
1028 if (setup_cursor == 1)
1029 setup_top = setup_top + 1;
1030 if (setup_cursor == 2)
1031 setup_bottom = setup_bottom + 1;
1035 if (setup_cursor == 0)
1038 if (setup_cursor == 1 || setup_cursor == 2)
1041 // setup_cursor == 3 (Accept changes)
1042 if (strcmp(cl_name.string, setup_myname) != 0)
1043 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1044 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1045 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1046 m_entersound = true;
1047 M_Menu_MultiPlayer_f ();
1051 if (setup_cursor == 0)
1053 if (strlen(setup_myname))
1054 setup_myname[strlen(setup_myname)-1] = 0;
1059 if (k < 32 || k > 127)
1061 if (setup_cursor == 0)
1063 l = strlen(setup_myname);
1066 setup_myname[l+1] = 0;
1067 setup_myname[l] = k;
1076 if (setup_bottom > 15)
1078 if (setup_bottom < 0)
1082 //=============================================================================
1085 #define SLIDER_RANGE 10
1087 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1092 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1093 M_DrawCharacter (x-8, y, 128);
1094 for (i = 0;i < SLIDER_RANGE;i++)
1095 M_DrawCharacter (x + i*8, y, 129);
1096 M_DrawCharacter (x+i*8, y, 130);
1097 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1098 sprintf(text, "%g", num);
1099 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1102 void M_DrawCheckbox (int x, int y, int on)
1105 M_Print (x, y, "on");
1107 M_Print (x, y, "off");
1111 #define OPTIONS_ITEMS 32
1115 void M_Menu_Options_f (void)
1117 key_dest = key_menu;
1118 m_state = m_options;
1119 m_entersound = true;
1122 extern cvar_t snd_staticvolume;
1123 extern cvar_t gl_delayfinish;
1124 extern cvar_t slowmo;
1125 extern dllhandle_t jpeg_dll;
1127 void M_Menu_Options_AdjustSliders (int dir)
1130 S_LocalSound ("misc/menu3.wav");
1133 if (options_cursor == optnum++)
1134 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1135 else if (options_cursor == optnum++)
1136 Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
1137 else if (options_cursor == optnum++)
1138 Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
1139 else if (options_cursor == optnum++)
1140 Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1));
1141 else if (options_cursor == optnum++)
1142 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1143 else if (options_cursor == optnum++)
1144 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1145 else if (options_cursor == optnum++)
1146 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1147 else if (options_cursor == optnum++)
1148 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1149 else if (options_cursor == optnum++)
1150 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1151 else if (options_cursor == optnum++)
1152 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1153 else if (options_cursor == optnum++)
1154 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1155 else if (options_cursor == optnum++)
1156 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1157 else if (options_cursor == optnum++)
1159 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1161 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1163 else if (options_cursor == optnum++)
1164 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1165 else if (options_cursor == optnum++)
1166 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1167 else if (options_cursor == optnum++)
1168 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1169 else if (options_cursor == optnum++)
1170 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1171 else if (options_cursor == optnum++)
1172 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1173 else if (options_cursor == optnum++)
1174 Cvar_SetValueQuick (&showfps, !showfps.integer);
1175 else if (options_cursor == optnum++)
1177 if (cl_forwardspeed.value > 200)
1179 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1180 Cvar_SetValueQuick (&cl_backspeed, 200);
1184 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1185 Cvar_SetValueQuick (&cl_backspeed, 400);
1188 else if (options_cursor == optnum++)
1189 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1190 else if (options_cursor == optnum++)
1191 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1192 else if (options_cursor == optnum++)
1193 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1194 else if (options_cursor == optnum++)
1195 Cvar_SetValueQuick (&freelook, !freelook.integer);
1196 else if (options_cursor == optnum++)
1197 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1198 else if (options_cursor == optnum++)
1199 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1202 void M_Options_Draw (void)
1207 M_Background(320, 240);
1209 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1210 p = Draw_CachePic("gfx/p_option.lmp");
1211 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1214 M_Print(16, y, " Customize controls");y += 8;
1215 M_Print(16, y, " Go to console");y += 8;
1216 M_Print(16, y, " Reset to defaults");y += 8;
1217 M_Print(16, y, " Video Options");y += 8;
1218 M_Print(16, y, " Effects Options");y += 8;
1219 M_Print(16, y, " Color Control Options");y += 8;
1220 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value, 0, 1);y += 8;
1221 M_Print(16, y, " Console Speed");M_DrawSlider(220, y, scr_conspeed.value, 0, 1000);y += 8;
1222 M_Print(16, y, " Console Alpha");M_DrawSlider(220, y, scr_conalpha.value, 0, 1);y += 8;
1223 M_Print(16, y, " Conback Brightness");M_DrawSlider(220, y, scr_conbrightness.value, 0, 1);y += 8;
1224 M_Print(16, y, " Screen size");M_DrawSlider(220, y, scr_viewsize.value, 30, 120);y += 8;
1225 M_ItemPrint(16, y, " JPEG screenshots", jpeg_dll != NULL);M_DrawCheckbox(220, y, scr_screenshot_jpeg.integer);y += 8;
1226 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1227 // LordHavoc: FIXME: overbright needs to be disabled in GAME_GOODVSBAD2 but combine should not be disabled
1228 // LordHavoc: perhaps it's time for Overbright Bits to die, and a r_lightmapintensity option to be added?
1229 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, v_overbrightbits.value, 0, 4);y += 8;
1230 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1231 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1232 M_Print(16, y, "Delay refresh (faster)");M_DrawCheckbox(220, y, gl_delayfinish.integer);y += 8;
1233 M_ItemPrint(16, y, " Game Speed", sv.active);M_DrawSlider(220, y, slowmo.value, 0, 5);y += 8;
1234 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value, 0, 1);y += 8;
1235 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value, 0, 1);y += 8;
1236 if (gamemode == GAME_GOODVSBAD2)
1237 M_ItemPrint(16, y, " Music Volume", snd_initialized);
1239 M_ItemPrint(16, y, " Ambient Sound Volume", snd_initialized);
1240 M_DrawSlider(220, y, snd_staticvolume.value, 0, 1);
1242 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value, 0, 5);y += 8;
1243 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, crosshair_size.value, 1, 5);y += 8;
1244 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1245 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1246 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1247 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1248 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1249 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, sensitivity.value, 1, 50);y += 8;
1250 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1251 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1252 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1255 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1259 void M_Options_Key (int k)
1268 m_entersound = true;
1269 switch (options_cursor)
1276 key_dest = key_game;
1277 Con_ToggleConsole_f ();
1280 Cbuf_AddText ("exec default.cfg\n");
1286 M_Menu_Options_Effects_f ();
1289 M_Menu_Options_ColorControl_f ();
1292 M_Menu_Options_AdjustSliders (1);
1298 S_LocalSound ("misc/menu1.wav");
1300 if (options_cursor < 0)
1301 options_cursor = OPTIONS_ITEMS-1;
1305 S_LocalSound ("misc/menu1.wav");
1307 if (options_cursor >= OPTIONS_ITEMS)
1312 M_Menu_Options_AdjustSliders (-1);
1316 M_Menu_Options_AdjustSliders (1);
1321 #define OPTIONS_EFFECTS_ITEMS 20
1323 int options_effects_cursor;
1325 void M_Menu_Options_Effects_f (void)
1327 key_dest = key_menu;
1328 m_state = m_options_effects;
1329 m_entersound = true;
1333 extern cvar_t r_detailtextures;
1334 extern cvar_t cl_particles;
1335 extern cvar_t cl_explosions;
1336 extern cvar_t cl_stainmaps;
1337 extern cvar_t cl_decals;
1338 extern cvar_t r_explosionclip;
1339 extern cvar_t r_dlightmap;
1340 extern cvar_t r_modellights;
1341 extern cvar_t r_coronas;
1342 extern cvar_t gl_flashblend;
1343 extern cvar_t cl_particles_quality;
1344 extern cvar_t cl_particles_bulletimpacts;
1345 extern cvar_t cl_particles_smoke;
1346 extern cvar_t cl_particles_sparks;
1347 extern cvar_t cl_particles_bubbles;
1348 extern cvar_t cl_particles_blood;
1349 extern cvar_t cl_particles_blood_alpha;
1351 void M_Menu_Options_Effects_AdjustSliders (int dir)
1354 S_LocalSound ("misc/menu3.wav");
1357 if (options_effects_cursor == optnum++)
1358 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1359 else if (options_effects_cursor == optnum++)
1360 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1361 else if (options_effects_cursor == optnum++)
1362 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1363 else if (options_effects_cursor == optnum++)
1364 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1365 else if (options_effects_cursor == optnum++)
1366 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1367 else if (options_effects_cursor == optnum++)
1368 Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4));
1369 else if (options_effects_cursor == optnum++)
1370 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1371 else if (options_effects_cursor == optnum++)
1372 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1373 else if (options_effects_cursor == optnum++)
1374 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1375 else if (options_effects_cursor == optnum++)
1376 Cvar_SetValueQuick (&cl_decals, !cl_decals.integer);
1377 else if (options_effects_cursor == optnum++)
1378 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1379 else if (options_effects_cursor == optnum++)
1380 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1381 else if (options_effects_cursor == optnum++)
1382 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1383 else if (options_effects_cursor == optnum++)
1384 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1385 else if (options_effects_cursor == optnum++)
1386 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1387 else if (options_effects_cursor == optnum++)
1388 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1389 else if (options_effects_cursor == optnum++)
1390 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1391 else if (options_effects_cursor == optnum++)
1392 Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer);
1393 else if (options_effects_cursor == optnum++)
1394 Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer);
1395 else if (options_effects_cursor == optnum++)
1396 Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
1399 void M_Options_Effects_Draw (void)
1404 M_Background(320, 200);
1406 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1407 p = Draw_CachePic("gfx/p_option.lmp");
1408 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1411 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value, 0, 8);y += 8;
1412 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1413 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1414 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1415 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1416 M_Print(16, y, " Particles Quality");M_DrawSlider(220, y, cl_particles_quality.value, 1, 4);y += 8;
1417 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1418 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1419 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1420 M_Print(16, y, " Decals");M_DrawCheckbox(220, y, cl_decals.integer);y += 8;
1421 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1422 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1423 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1424 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1425 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1426 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1427 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, cl_particles_blood_alpha.value, 0.2, 1);y += 8;
1428 M_Print(16, y, " Model Interpolation");M_DrawCheckbox(220, y, r_lerpmodels.integer);y += 8;
1429 M_Print(16, y, " Sprite Interpolation");M_DrawCheckbox(220, y, r_lerpsprites.integer);y += 8;
1430 M_Print(16, y, " Water Movement");M_DrawSlider(220, y, r_waterscroll.value, 0, 10);y += 8;
1433 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1437 void M_Options_Effects_Key (int k)
1442 M_Menu_Options_f ();
1446 M_Menu_Options_Effects_AdjustSliders (1);
1450 S_LocalSound ("misc/menu1.wav");
1451 options_effects_cursor--;
1452 if (options_effects_cursor < 0)
1453 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1457 S_LocalSound ("misc/menu1.wav");
1458 options_effects_cursor++;
1459 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1460 options_effects_cursor = 0;
1464 M_Menu_Options_Effects_AdjustSliders (-1);
1468 M_Menu_Options_Effects_AdjustSliders (1);
1477 #define OPTIONS_COLORCONTROL_ITEMS 18
1479 int options_colorcontrol_cursor;
1481 // intensity value to match up to 50% dither to 'correct' quake
1482 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1484 void M_Menu_Options_ColorControl_f (void)
1486 key_dest = key_menu;
1487 m_state = m_options_colorcontrol;
1488 m_entersound = true;
1492 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1496 S_LocalSound ("misc/menu3.wav");
1499 if (options_colorcontrol_cursor == optnum++)
1500 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1501 else if (options_colorcontrol_cursor == optnum++)
1503 Cvar_SetValueQuick (&v_color_enable, 0);
1504 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1506 else if (options_colorcontrol_cursor == optnum++)
1508 Cvar_SetValueQuick (&v_color_enable, 0);
1509 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1511 else if (options_colorcontrol_cursor == optnum++)
1513 Cvar_SetValueQuick (&v_color_enable, 0);
1514 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1516 else if (options_colorcontrol_cursor == optnum++)
1518 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1520 else if (options_colorcontrol_cursor == optnum++)
1522 Cvar_SetValueQuick (&v_color_enable, 1);
1523 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1525 else if (options_colorcontrol_cursor == optnum++)
1527 Cvar_SetValueQuick (&v_color_enable, 1);
1528 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1530 else if (options_colorcontrol_cursor == optnum++)
1532 Cvar_SetValueQuick (&v_color_enable, 1);
1533 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1535 else if (options_colorcontrol_cursor == optnum++)
1537 Cvar_SetValueQuick (&v_color_enable, 1);
1538 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1539 Cvar_SetValueQuick (&v_color_black_r, f);
1540 Cvar_SetValueQuick (&v_color_black_g, f);
1541 Cvar_SetValueQuick (&v_color_black_b, f);
1543 else if (options_colorcontrol_cursor == optnum++)
1545 Cvar_SetValueQuick (&v_color_enable, 1);
1546 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1548 else if (options_colorcontrol_cursor == optnum++)
1550 Cvar_SetValueQuick (&v_color_enable, 1);
1551 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1553 else if (options_colorcontrol_cursor == optnum++)
1555 Cvar_SetValueQuick (&v_color_enable, 1);
1556 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1558 else if (options_colorcontrol_cursor == optnum++)
1560 Cvar_SetValueQuick (&v_color_enable, 1);
1561 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1562 Cvar_SetValueQuick (&v_color_grey_r, f);
1563 Cvar_SetValueQuick (&v_color_grey_g, f);
1564 Cvar_SetValueQuick (&v_color_grey_b, f);
1566 else if (options_colorcontrol_cursor == optnum++)
1568 Cvar_SetValueQuick (&v_color_enable, 1);
1569 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1571 else if (options_colorcontrol_cursor == optnum++)
1573 Cvar_SetValueQuick (&v_color_enable, 1);
1574 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1576 else if (options_colorcontrol_cursor == optnum++)
1578 Cvar_SetValueQuick (&v_color_enable, 1);
1579 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1581 else if (options_colorcontrol_cursor == optnum++)
1583 Cvar_SetValueQuick (&v_color_enable, 1);
1584 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1585 Cvar_SetValueQuick (&v_color_white_r, f);
1586 Cvar_SetValueQuick (&v_color_white_g, f);
1587 Cvar_SetValueQuick (&v_color_white_b, f);
1591 void M_Options_ColorControl_Draw (void)
1593 float x, y, c, s, t, u, v;
1596 M_Background(320, 256);
1598 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1599 p = Draw_CachePic("gfx/p_option.lmp");
1600 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1603 M_Print(16, y, " Reset to defaults");y += 8;
1604 M_ItemPrint(16, y, "Hardware Gamma Control", vid_hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1605 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;
1606 M_ItemPrint(16, y, " Contrast", !v_color_enable.integer);M_DrawSlider(220, y, v_contrast.value, 1, 5);y += 8;
1607 M_ItemPrint(16, y, " Brightness", !v_color_enable.integer);M_DrawSlider(220, y, v_brightness.value, 0, 0.8);y += 8;
1608 M_Print(16, y, " Color Level Controls");M_DrawCheckbox(220, y, v_color_enable.integer);y += 8;
1609 M_ItemPrint(16, y, " Black: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_r.value, 0, 0.8);y += 8;
1610 M_ItemPrint(16, y, " Black: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_g.value, 0, 0.8);y += 8;
1611 M_ItemPrint(16, y, " Black: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_black_b.value, 0, 0.8);y += 8;
1612 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;
1613 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;
1614 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;
1615 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;
1616 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;
1617 M_ItemPrint(16, y, " White: Red ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_r.value, 1, 5);y += 8;
1618 M_ItemPrint(16, y, " White: Green", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_g.value, 1, 5);y += 8;
1619 M_ItemPrint(16, y, " White: Blue ", v_color_enable.integer);M_DrawSlider(220, y, v_color_white_b.value, 1, 5);y += 8;
1620 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;
1623 DrawQ_Fill(menu_x, menu_y + y, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);y += 4;
1624 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1625 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1626 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;
1627 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;
1628 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;
1629 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;
1630 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;
1631 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;
1632 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;
1633 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;
1635 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1636 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1637 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1642 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, 0, 0, 1, 0);
1643 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);
1644 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);
1646 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, c, 0, 1, 0);
1647 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);
1648 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);
1650 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, 0, 0, c, 1, 0);
1651 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);
1652 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);
1654 DrawQ_Fill(menu_x + x, menu_y + y, 64, 48, c, c, c, 1, 0);
1655 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);
1656 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);
1659 M_DrawCharacter(200, 32 + options_colorcontrol_cursor*8, 12+((int)(realtime*4)&1));
1663 void M_Options_ColorControl_Key (int k)
1672 m_entersound = true;
1673 switch (options_colorcontrol_cursor)
1676 Cvar_SetValueQuick(&v_hwgamma, 1);
1677 Cvar_SetValueQuick(&v_gamma, 1);
1678 Cvar_SetValueQuick(&v_contrast, 1);
1679 Cvar_SetValueQuick(&v_brightness, 0);
1680 Cvar_SetValueQuick(&v_color_enable, 0);
1681 Cvar_SetValueQuick(&v_color_black_r, 0);
1682 Cvar_SetValueQuick(&v_color_black_g, 0);
1683 Cvar_SetValueQuick(&v_color_black_b, 0);
1684 Cvar_SetValueQuick(&v_color_grey_r, 0);
1685 Cvar_SetValueQuick(&v_color_grey_g, 0);
1686 Cvar_SetValueQuick(&v_color_grey_b, 0);
1687 Cvar_SetValueQuick(&v_color_white_r, 1);
1688 Cvar_SetValueQuick(&v_color_white_g, 1);
1689 Cvar_SetValueQuick(&v_color_white_b, 1);
1690 Cbuf_AddText ("exec default.cfg\n");
1693 M_Menu_Options_ColorControl_AdjustSliders (1);
1699 S_LocalSound ("misc/menu1.wav");
1700 options_colorcontrol_cursor--;
1701 if (options_colorcontrol_cursor < 0)
1702 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1706 S_LocalSound ("misc/menu1.wav");
1707 options_colorcontrol_cursor++;
1708 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1709 options_colorcontrol_cursor = 0;
1713 M_Menu_Options_ColorControl_AdjustSliders (-1);
1717 M_Menu_Options_ColorControl_AdjustSliders (1);
1723 //=============================================================================
1726 char *quakebindnames[][2] =
1728 {"+attack", "attack"},
1729 {"impulse 10", "next weapon"},
1730 {"impulse 12", "previous weapon"},
1731 {"+jump", "jump / swim up"},
1732 {"+forward", "walk forward"},
1733 {"+back", "backpedal"},
1734 {"+left", "turn left"},
1735 {"+right", "turn right"},
1737 {"+moveleft", "step left"},
1738 {"+moveright", "step right"},
1739 {"+strafe", "sidestep"},
1740 {"+lookup", "look up"},
1741 {"+lookdown", "look down"},
1742 {"centerview", "center view"},
1743 {"+mlook", "mouse look"},
1744 {"+klook", "keyboard look"},
1745 {"+moveup", "swim up"},
1746 {"+movedown", "swim down"}
1749 char *transfusionbindnames[][2] =
1751 {"+forward", "walk forward"},
1752 {"+back", "backpedal"},
1753 {"+left", "turn left"},
1754 {"+right", "turn right"},
1755 {"+moveleft", "step left"},
1756 {"+moveright", "step right"},
1757 {"+jump", "jump / swim up"},
1758 {"+movedown", "swim down"},
1759 {"+attack", "attack"},
1760 {"+button3", "altfire"},
1761 {"+button4", "use"},
1762 {"impulse 1", "Pitch Fork"},
1763 {"impulse 2", "Flare Gun"},
1764 {"impulse 3", "Shotgun"},
1765 {"impulse 4", "Machine Gun"},
1766 {"impulse 5", "Incinerator"},
1767 {"impulse 6", "Bombs"},
1768 {"impulse 7", "Aerosol Can"},
1769 {"impulse 8", "Tesla Cannon"},
1770 {"impulse 9", "Life Leech"},
1771 {"impulse 17", "Voodoo Doll"},
1772 {"impulse 11", "previous weapon"},
1773 {"impulse 10", "next weapon"},
1774 {"impulse 14", "previous item"},
1775 {"impulse 15", "next item"},
1776 {"impulse 13", "use item"},
1777 {"impulse 100", "add bot (red)"},
1778 {"impulse 101", "add bot (blue)"},
1779 {"impulse 102", "kick a bot"},
1780 {"impulse 50", "voting menu"},
1781 {"impulse 141", "identify player"},
1782 {"impulse 16", "next armor type"},
1783 {"impulse 20", "observer mode"}
1786 char *goodvsbad2bindnames[][2] =
1788 {"impulse 69", "Power 1"},
1789 {"impulse 70", "Power 2"},
1790 {"impulse 71", "Power 3"},
1791 {"+jump", "jump / swim up"},
1792 {"+forward", "walk forward"},
1793 {"+back", "backpedal"},
1794 {"+left", "turn left"},
1795 {"+right", "turn right"},
1797 {"+moveleft", "step left"},
1798 {"+moveright", "step right"},
1799 {"+strafe", "sidestep"},
1800 {"+lookup", "look up"},
1801 {"+lookdown", "look down"},
1802 {"centerview", "center view"},
1803 {"+mlook", "mouse look"},
1804 {"kill", "kill yourself"},
1805 {"+moveup", "swim up"},
1806 {"+movedown", "swim down"}
1810 char *(*bindnames)[2];
1813 typedef struct binditem_s
1815 char *command, *description;
1816 struct binditem_s *next;
1820 typedef struct bindcategory_s
1824 struct bindcategory_s *next;
1828 bindcategory_t *bindcategories = NULL;
1830 void M_ClearBinds (void)
1832 for (c = bindcategories;c;c = cnext)
1835 for (b = c->binds;b;b = bnext)
1842 bindcategories = NULL;
1845 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1847 for (b = &c->binds;*b;*b = &(*b)->next);
1848 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1849 *b->command = (char *)((*b) + 1);
1850 *b->description = *b->command + strlen(command) + 1;
1851 strcpy(*b->command, command);
1852 strcpy(*b->description, description);
1855 void M_AddBind (char *category, char *command, char *description)
1857 for (c = &bindcategories;*c;c = &(*c)->next)
1859 if (!strcmp(category, (*c)->name))
1861 M_AddBindToCategory(*c, command, description);
1865 *c = Z_Alloc(sizeof(bindcategory_t));
1866 M_AddBindToCategory(*c, command, description);
1869 void M_DefaultBinds (void)
1872 M_AddBind("movement", "+jump", "jump / swim up");
1873 M_AddBind("movement", "+forward", "walk forward");
1874 M_AddBind("movement", "+back", "backpedal");
1875 M_AddBind("movement", "+left", "turn left");
1876 M_AddBind("movement", "+right", "turn right");
1877 M_AddBind("movement", "+speed", "run");
1878 M_AddBind("movement", "+moveleft", "step left");
1879 M_AddBind("movement", "+moveright", "step right");
1880 M_AddBind("movement", "+strafe", "sidestep");
1881 M_AddBind("movement", "+lookup", "look up");
1882 M_AddBind("movement", "+lookdown", "look down");
1883 M_AddBind("movement", "centerview", "center view");
1884 M_AddBind("movement", "+mlook", "mouse look");
1885 M_AddBind("movement", "+klook", "keyboard look");
1886 M_AddBind("movement", "+moveup", "swim up");
1887 M_AddBind("movement", "+movedown", "swim down");
1888 M_AddBind("weapons", "+attack", "attack");
1889 M_AddBind("weapons", "impulse 10", "next weapon");
1890 M_AddBind("weapons", "impulse 12", "previous weapon");
1891 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1892 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1893 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1894 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1895 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1896 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1897 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1898 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1906 void M_Menu_Keys_f (void)
1908 key_dest = key_menu;
1910 m_entersound = true;
1915 void M_FindKeysForCommand (char *command, int *keys)
1921 for (j = 0;j < NUMKEYS;j++)
1926 for (j=0 ; j<256 ; j++)
1931 if (!strcmp (b, command) )
1934 if (count == NUMKEYS)
1940 void M_UnbindCommand (char *command)
1945 for (j=0 ; j<256 ; j++)
1950 if (!strcmp (b, command))
1951 Key_SetBinding (j, "");
1956 void M_Keys_Draw (void)
1962 char keystring[1024];
1964 M_Background(320, 200);
1966 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1967 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1970 M_Print (12, 32, "Press a key or button for this action");
1972 M_Print (18, 32, "Enter to change, backspace to clear");
1974 // search for known bindings
1975 for (i=0 ; i<numcommands ; i++)
1979 M_Print (16, y, bindnames[i][1]);
1981 M_FindKeysForCommand (bindnames[i][0], keys);
1983 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1985 strcpy(keystring, "???");
1989 for (j = 0;j < NUMKEYS;j++)
1994 strcat(keystring, " or ");
1995 strcat(keystring, Key_KeynumToString (keys[j]));
1999 M_Print (150, y, keystring);
2003 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2005 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2009 void M_Keys_Key (int k)
2016 S_LocalSound ("misc/menu1.wav");
2021 else //if (k != '`')
2023 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2024 Cbuf_InsertText (cmd);
2034 M_Menu_Options_f ();
2039 S_LocalSound ("misc/menu1.wav");
2041 if (keys_cursor < 0)
2042 keys_cursor = numcommands-1;
2047 S_LocalSound ("misc/menu1.wav");
2049 if (keys_cursor >= numcommands)
2053 case K_ENTER: // go into bind mode
2054 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2055 S_LocalSound ("misc/menu2.wav");
2056 if (keys[NUMKEYS - 1] != -1)
2057 M_UnbindCommand (bindnames[keys_cursor][0]);
2061 case K_BACKSPACE: // delete bindings
2062 case K_DEL: // delete bindings
2063 S_LocalSound ("misc/menu2.wav");
2064 M_UnbindCommand (bindnames[keys_cursor][0]);
2069 //=============================================================================
2072 #define VIDEO_ITEMS 5
2074 int video_cursor = 0;
2075 int video_cursor_table[] = {56, 68, 80, 92, 116};
2076 // note: if modes are added to the beginning of this list, update the
2077 // video_resolution = x; in M_Menu_Video_f below
2078 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}};
2079 int video_resolution;
2081 extern int current_vid_fullscreen;
2082 extern int current_vid_width;
2083 extern int current_vid_height;
2084 extern int current_vid_bitsperpixel;
2085 extern int current_vid_stencil;
2088 void M_Menu_Video_f (void)
2090 key_dest = key_menu;
2092 m_entersound = true;
2094 // Look for the current resolution
2095 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
2097 if (video_resolutions[video_resolution][0] == current_vid_width &&
2098 video_resolutions[video_resolution][1] == current_vid_height)
2102 // Default to 800x600 if we didn't find it
2103 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
2105 // may need to update this number if mode list changes
2106 video_resolution = 4;
2107 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2108 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2113 void M_Video_Draw (void)
2118 M_Background(320, 200);
2120 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2121 p = Draw_CachePic("gfx/vidmodes.lmp");
2122 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2125 M_Print(16, video_cursor_table[0], " Resolution");
2126 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2127 M_Print (220, video_cursor_table[0], string);
2130 M_Print(16, video_cursor_table[1], " Bits per pixel");
2131 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2134 M_Print(16, video_cursor_table[2], " Fullscreen");
2135 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2138 M_Print(16, video_cursor_table[3], " Stencil");
2139 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2142 M_Print(220, video_cursor_table[4], "Apply");
2145 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2149 void M_Menu_Video_AdjustSliders (int dir)
2151 S_LocalSound ("misc/menu3.wav");
2153 switch (video_cursor)
2158 int new_resolution = video_resolution + dir;
2159 if (new_resolution < 0)
2160 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2161 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2162 video_resolution = 0;
2164 video_resolution = new_resolution;
2166 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2167 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2173 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2176 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2179 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2185 void M_Video_Key (int key)
2190 // vid_shared.c has a copy of the current video config. We restore it
2191 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2192 Cvar_SetValueQuick(&vid_width, current_vid_width);
2193 Cvar_SetValueQuick(&vid_height, current_vid_height);
2194 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2195 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2197 S_LocalSound ("misc/menu1.wav");
2198 M_Menu_Options_f ();
2202 m_entersound = true;
2203 switch (video_cursor)
2206 Cbuf_AddText ("vid_restart\n");
2207 M_Menu_Options_f ();
2210 M_Menu_Video_AdjustSliders (1);
2215 S_LocalSound ("misc/menu1.wav");
2217 if (video_cursor < 0)
2218 video_cursor = VIDEO_ITEMS-1;
2222 S_LocalSound ("misc/menu1.wav");
2224 if (video_cursor >= VIDEO_ITEMS)
2229 M_Menu_Video_AdjustSliders (-1);
2233 M_Menu_Video_AdjustSliders (1);
2238 //=============================================================================
2242 #define NUM_HELP_PAGES 6
2245 void M_Menu_Help_f (void)
2247 key_dest = key_menu;
2249 m_entersound = true;
2255 void M_Help_Draw (void)
2257 M_Background(320, 200);
2258 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2262 void M_Help_Key (int key)
2272 m_entersound = true;
2273 if (++help_page >= NUM_HELP_PAGES)
2279 m_entersound = true;
2280 if (--help_page < 0)
2281 help_page = NUM_HELP_PAGES-1;
2287 //=============================================================================
2290 char *m_quit_message[9];
2291 int m_quit_prevstate;
2292 qboolean wasInMenus;
2295 int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
2297 m_quit_message[0] = line1;
2298 m_quit_message[1] = line2;
2299 m_quit_message[2] = line3;
2300 m_quit_message[3] = line4;
2301 m_quit_message[4] = line5;
2302 m_quit_message[5] = line6;
2303 m_quit_message[6] = line7;
2304 m_quit_message[7] = line8;
2305 m_quit_message[8] = NULL;
2309 int M_ChooseQuitMessage(int request)
2317 if (request-- == 0) return M_QuitMessage("Are you gonna quit","this game just like","everything else?",NULL,NULL,NULL,NULL,NULL);
2318 if (request-- == 0) return M_QuitMessage("Milord, methinks that","thou art a lowly","quitter. Is this true?",NULL,NULL,NULL,NULL,NULL);
2319 if (request-- == 0) return M_QuitMessage("Do I need to bust your","face open for trying","to quit?",NULL,NULL,NULL,NULL,NULL);
2320 if (request-- == 0) return M_QuitMessage("Man, I oughta smack you","for trying to quit!","Press Y to get","smacked out.",NULL,NULL,NULL,NULL);
2321 if (request-- == 0) return M_QuitMessage("Press Y to quit like a","big loser in life.","Press N to stay proud","and successful!",NULL,NULL,NULL,NULL);
2322 if (request-- == 0) return M_QuitMessage("If you press Y to","quit, I will summon","Satan all over your","hard drive!",NULL,NULL,NULL,NULL);
2323 if (request-- == 0) return M_QuitMessage("Um, Asmodeus dislikes","his children trying to","quit. Press Y to return","to your Tinkertoys.",NULL,NULL,NULL,NULL);
2324 if (request-- == 0) return M_QuitMessage("If you quit now, I'll","throw a blanket-party","for you next time!",NULL,NULL,NULL,NULL,NULL);
2326 case GAME_GOODVSBAD2:
2327 if (request-- == 0) return M_QuitMessage("Press Yes To Quit","...","Yes",NULL,NULL,NULL,NULL,NULL);
2328 if (request-- == 0) return M_QuitMessage("Do you really want to","Quit?","Play Good vs bad 3!",NULL,NULL,NULL,NULL,NULL);
2329 if (request-- == 0) return M_QuitMessage("All your quit are","belong to long duck","dong",NULL,NULL,NULL,NULL,NULL);
2330 if (request-- == 0) return M_QuitMessage("Press Y to quit","","But are you too legit?",NULL,NULL,NULL,NULL,NULL);
2331 if (request-- == 0) return M_QuitMessage("This game was made by","e@chip-web.com","It is by far the best","game ever made.",NULL,NULL,NULL,NULL);
2332 if (request-- == 0) return M_QuitMessage("Even I really dont","know of a game better","Press Y to quit","like rougue chedder",NULL,NULL,NULL,NULL);
2333 if (request-- == 0) return M_QuitMessage("After you stop playing","tell the guys who made","counterstrike to just","kill themselves now",NULL,NULL,NULL,NULL);
2334 if (request-- == 0) return M_QuitMessage("Press Y to exit to DOS","","SSH login as user Y","to exit to Linux",NULL,NULL,NULL,NULL);
2335 if (request-- == 0) return M_QuitMessage("Press Y like you","were waanderers","from Ys'",NULL,NULL,NULL,NULL,NULL);
2336 if (request-- == 0) return M_QuitMessage("This game was made in","Nippon like the SS","announcer's saying ipon",NULL,NULL,NULL,NULL,NULL);
2337 if (request-- == 0) return M_QuitMessage("you","want to quit?",NULL,NULL,NULL,NULL,NULL,NULL);
2338 if (request-- == 0) return M_QuitMessage("Please stop playing","this stupid game",NULL,NULL,NULL,NULL,NULL,NULL);
2340 case GAME_BATTLEMECH:
2341 if (request-- == 0) return M_QuitMessage("? WHY ?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2342 if (request-- == 0) return M_QuitMessage("Leave now and your mech is scrap!","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2343 if (request-- == 0) return M_QuitMessage("Accept Defeat?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2344 if (request-- == 0) return M_QuitMessage("Wait! There are more mechs to destroy!","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2345 if (request-- == 0) return M_QuitMessage("Where's your bloodlust?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2346 if (request-- == 0) return M_QuitMessage("Your mech here is way more impressive","than your car out there...","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL);
2347 if (request-- == 0) return M_QuitMessage("Quitting won't reduce your debt","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2350 if (request-- == 0) return M_QuitMessage("Tired of fragging already?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2351 if (request-- == 0) return M_QuitMessage("Quit now and forfeit your bodycount?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2352 if (request-- == 0) return M_QuitMessage("Are you sure you want to quit?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2353 if (request-- == 0) return M_QuitMessage("Off to do something constructive?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2359 void M_Menu_Quit_f (void)
2362 if (m_state == m_quit)
2364 wasInMenus = (key_dest == key_menu);
2365 key_dest = key_menu;
2366 m_quit_prevstate = m_state;
2368 m_entersound = true;
2369 // count how many there are
2370 for (n = 0;M_ChooseQuitMessage(n);n++);
2372 M_ChooseQuitMessage(rand() % n);
2376 void M_Quit_Key (int key)
2385 m_state = m_quit_prevstate;
2386 m_entersound = true;
2390 key_dest = key_game;
2405 void M_Quit_Draw (void)
2407 int i, l, linelength, firstline, lastline, lines;
2408 for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
2410 if ((l = strlen(m_quit_message[i])))
2420 lines = (lastline - firstline) + 1;
2421 M_Background(linelength * 8 + 16, lines * 8 + 16);
2422 M_DrawTextBox(0, 0, linelength, lines);
2423 for (i = 0, l = firstline;i < lines;i++, l++)
2424 M_Print(8 + 4 * (linelength - strlen(m_quit_message[l])), 8 + 8 * i, m_quit_message[l]);
2427 //=============================================================================
2428 /* LAN CONFIG MENU */
2430 int lanConfig_cursor = -1;
2431 int lanConfig_cursor_table [] = {56, 76, 112};
2432 #define NUM_LANCONFIG_CMDS 3
2435 char lanConfig_portname[6];
2436 char lanConfig_joinname[22];
2438 void M_Menu_LanConfig_f (void)
2440 key_dest = key_menu;
2441 m_state = m_lanconfig;
2442 m_entersound = true;
2443 if (lanConfig_cursor == -1)
2446 lanConfig_cursor = 1;
2449 lanConfig_cursor = 1;
2450 lanConfig_port = 26000;
2451 sprintf(lanConfig_portname, "%u", lanConfig_port);
2453 m_return_reason[0] = 0;
2457 void M_LanConfig_Draw (void)
2464 M_Background(320, 200);
2466 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2467 p = Draw_CachePic ("gfx/p_multi.lmp");
2468 basex = (320-p->width)/2;
2469 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2472 startJoin = "New Game";
2474 startJoin = "Join Game";
2475 protocol = "TCP/IP";
2476 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2479 M_Print (basex, lanConfig_cursor_table[0], "Port");
2480 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2481 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2485 M_Print (basex, lanConfig_cursor_table[1], "Search for games...");
2486 M_Print (basex, lanConfig_cursor_table[2]-16, "Join game at:");
2487 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2488 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2492 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2493 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2496 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2498 if (lanConfig_cursor == 0)
2499 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2501 if (lanConfig_cursor == 2)
2502 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2504 if (*m_return_reason)
2505 M_PrintWhite (basex, 168, m_return_reason);
2509 void M_LanConfig_Key (int key)
2516 M_Menu_MultiPlayer_f ();
2520 S_LocalSound ("misc/menu1.wav");
2522 if (lanConfig_cursor < 0)
2523 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2527 S_LocalSound ("misc/menu1.wav");
2529 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2530 lanConfig_cursor = 0;
2534 if (lanConfig_cursor == 0)
2537 m_entersound = true;
2539 Cbuf_AddText ("stopdemo\n");
2541 Cvar_SetValue("port", lanConfig_port);
2543 if (lanConfig_cursor == 1)
2547 M_Menu_GameOptions_f ();
2550 M_Menu_ServerList_f();
2554 if (lanConfig_cursor == 2)
2555 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2559 if (lanConfig_cursor == 0)
2561 if (strlen(lanConfig_portname))
2562 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2565 if (lanConfig_cursor == 2)
2567 if (strlen(lanConfig_joinname))
2568 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2573 if (key < 32 || key > 127)
2576 if (lanConfig_cursor == 2)
2578 l = strlen(lanConfig_joinname);
2581 lanConfig_joinname[l+1] = 0;
2582 lanConfig_joinname[l] = key;
2586 if (key < '0' || key > '9')
2588 if (lanConfig_cursor == 0)
2590 l = strlen(lanConfig_portname);
2593 lanConfig_portname[l+1] = 0;
2594 lanConfig_portname[l] = key;
2599 if (StartingGame && lanConfig_cursor == 2)
2601 if (key == K_UPARROW)
2602 lanConfig_cursor = 1;
2604 lanConfig_cursor = 0;
2607 l = atoi(lanConfig_portname);
2610 sprintf(lanConfig_portname, "%u", lanConfig_port);
2613 //=============================================================================
2614 /* GAME OPTIONS MENU */
2633 episode_t *episodes;
2638 level_t quakelevels[] =
2640 {"start", "Entrance"}, // 0
2642 {"e1m1", "Slipgate Complex"}, // 1
2643 {"e1m2", "Castle of the Damned"},
2644 {"e1m3", "The Necropolis"},
2645 {"e1m4", "The Grisly Grotto"},
2646 {"e1m5", "Gloom Keep"},
2647 {"e1m6", "The Door To Chthon"},
2648 {"e1m7", "The House of Chthon"},
2649 {"e1m8", "Ziggurat Vertigo"},
2651 {"e2m1", "The Installation"}, // 9
2652 {"e2m2", "Ogre Citadel"},
2653 {"e2m3", "Crypt of Decay"},
2654 {"e2m4", "The Ebon Fortress"},
2655 {"e2m5", "The Wizard's Manse"},
2656 {"e2m6", "The Dismal Oubliette"},
2657 {"e2m7", "Underearth"},
2659 {"e3m1", "Termination Central"}, // 16
2660 {"e3m2", "The Vaults of Zin"},
2661 {"e3m3", "The Tomb of Terror"},
2662 {"e3m4", "Satan's Dark Delight"},
2663 {"e3m5", "Wind Tunnels"},
2664 {"e3m6", "Chambers of Torment"},
2665 {"e3m7", "The Haunted Halls"},
2667 {"e4m1", "The Sewage System"}, // 23
2668 {"e4m2", "The Tower of Despair"},
2669 {"e4m3", "The Elder God Shrine"},
2670 {"e4m4", "The Palace of Hate"},
2671 {"e4m5", "Hell's Atrium"},
2672 {"e4m6", "The Pain Maze"},
2673 {"e4m7", "Azure Agony"},
2674 {"e4m8", "The Nameless City"},
2676 {"end", "Shub-Niggurath's Pit"}, // 31
2678 {"dm1", "Place of Two Deaths"}, // 32
2679 {"dm2", "Claustrophobopolis"},
2680 {"dm3", "The Abandoned Base"},
2681 {"dm4", "The Bad Place"},
2682 {"dm5", "The Cistern"},
2683 {"dm6", "The Dark Zone"}
2686 episode_t quakeepisodes[] =
2688 {"Welcome to Quake", 0, 1},
2689 {"Doomed Dimension", 1, 8},
2690 {"Realm of Black Magic", 9, 7},
2691 {"Netherworld", 16, 7},
2692 {"The Elder World", 23, 8},
2693 {"Final Level", 31, 1},
2694 {"Deathmatch Arena", 32, 6}
2697 //MED 01/06/97 added hipnotic levels
2698 level_t hipnoticlevels[] =
2700 {"start", "Command HQ"}, // 0
2702 {"hip1m1", "The Pumping Station"}, // 1
2703 {"hip1m2", "Storage Facility"},
2704 {"hip1m3", "The Lost Mine"},
2705 {"hip1m4", "Research Facility"},
2706 {"hip1m5", "Military Complex"},
2708 {"hip2m1", "Ancient Realms"}, // 6
2709 {"hip2m2", "The Black Cathedral"},
2710 {"hip2m3", "The Catacombs"},
2711 {"hip2m4", "The Crypt"},
2712 {"hip2m5", "Mortum's Keep"},
2713 {"hip2m6", "The Gremlin's Domain"},
2715 {"hip3m1", "Tur Torment"}, // 12
2716 {"hip3m2", "Pandemonium"},
2717 {"hip3m3", "Limbo"},
2718 {"hip3m4", "The Gauntlet"},
2720 {"hipend", "Armagon's Lair"}, // 16
2722 {"hipdm1", "The Edge of Oblivion"} // 17
2725 //MED 01/06/97 added hipnotic episodes
2726 episode_t hipnoticepisodes[] =
2728 {"Scourge of Armagon", 0, 1},
2729 {"Fortress of the Dead", 1, 5},
2730 {"Dominion of Darkness", 6, 6},
2731 {"The Rift", 12, 4},
2732 {"Final Level", 16, 1},
2733 {"Deathmatch Arena", 17, 1}
2736 //PGM 01/07/97 added rogue levels
2737 //PGM 03/02/97 added dmatch level
2738 level_t roguelevels[] =
2740 {"start", "Split Decision"},
2741 {"r1m1", "Deviant's Domain"},
2742 {"r1m2", "Dread Portal"},
2743 {"r1m3", "Judgement Call"},
2744 {"r1m4", "Cave of Death"},
2745 {"r1m5", "Towers of Wrath"},
2746 {"r1m6", "Temple of Pain"},
2747 {"r1m7", "Tomb of the Overlord"},
2748 {"r2m1", "Tempus Fugit"},
2749 {"r2m2", "Elemental Fury I"},
2750 {"r2m3", "Elemental Fury II"},
2751 {"r2m4", "Curse of Osiris"},
2752 {"r2m5", "Wizard's Keep"},
2753 {"r2m6", "Blood Sacrifice"},
2754 {"r2m7", "Last Bastion"},
2755 {"r2m8", "Source of Evil"},
2756 {"ctf1", "Division of Change"}
2759 //PGM 01/07/97 added rogue episodes
2760 //PGM 03/02/97 added dmatch episode
2761 episode_t rogueepisodes[] =
2763 {"Introduction", 0, 1},
2764 {"Hell's Fortress", 1, 7},
2765 {"Corridors of Time", 8, 8},
2766 {"Deathmatch Arena", 16, 1}
2769 level_t nehahralevels[] =
2771 {"nehstart", "Welcome to Nehahra"},
2772 {"neh1m1", "Forge City1: Slipgates"},
2773 {"neh1m2", "Forge City2: Boiler"},
2774 {"neh1m3", "Forge City3: Escape"},
2775 {"neh1m4", "Grind Core"},
2776 {"neh1m5", "Industrial Silence"},
2777 {"neh1m6", "Locked-Up Anger"},
2778 {"neh1m7", "Wanderer of the Wastes"},
2779 {"neh1m8", "Artemis System Net"},
2780 {"neh1m9", "To the Death"},
2781 {"neh2m1", "The Gates of Ghoro"},
2782 {"neh2m2", "Sacred Trinity"},
2783 {"neh2m3", "Realm of the Ancients"},
2784 {"neh2m4", "Temple of the Ancients"},
2785 {"neh2m5", "Dreams Made Flesh"},
2786 {"neh2m6", "Your Last Cup of Sorrow"},
2787 {"nehsec", "Ogre's Bane"},
2788 {"nehahra", "Nehahra's Den"},
2789 {"nehend", "Quintessence"}
2792 episode_t nehahraepisodes[] =
2794 {"Welcome to Nehahra", 0, 1},
2795 {"The Fall of Forge", 1, 9},
2796 {"The Outlands", 10, 7},
2797 {"Dimension of the Lost", 17, 2}
2800 // Map list for Transfusion
2801 level_t transfusionlevels[] =
2803 {"bb1", "The Stronghold"},
2804 {"bb2", "Winter Wonderland"},
2806 {"bb4", "The Tower"},
2808 {"bb6", "Twin Fortress"},
2810 {"bb8", "Fun With Heads"},
2812 {"e1m1", "Cradle to Grave"},
2813 {"e1m2", "Wrong Side of the Tracks"},
2814 {"e1m7", "Altar of Stone"},
2815 {"e2m8", "The Lair of Shial"},
2816 {"e3m7", "The Pit of Cerberus"},
2817 {"e4m8", "The Hall of the Epiphany"},
2818 {"e4m9", "Mall of the Dead"},
2820 {"dm1", "Monolith Building 11"},
2823 {"e6m1", "Welcome to Your Life"},
2824 {"e6m8", "Beauty and the Beast"},
2826 {"cpbb01", "Crypt of Despair"},
2827 {"cpbb03", "Unholy Cathedral"},
2829 {"b2a15", "Area 15 (B2)"},
2830 {"barena", "Blood Arena"},
2831 {"bkeep", "Blood Keep"},
2832 {"bstar", "Brown Star"},
2833 {"crypt", "The Crypt"},
2835 {"bb3_2k1", "Bodies Infusion"},
2836 {"dcamp", "DeathCamp"},
2837 {"highnoon", "HighNoon"},
2838 {"qbb1", "The Confluence"},
2839 {"qbb2", "KathartiK"},
2840 {"qbb3", "Caleb's Woodland Retreat"},
2842 {"dranzbb6", "Black Coffee"},
2843 {"fragm", "Frag'M"},
2845 {"qe1m7", "The House of Chthon"},
2846 {"simple", "Dead Simple"}
2849 episode_t transfusionepisodes[] =
2852 {"Blood Single Player", 8, 7},
2853 {"Plasma Pack", 15, 5},
2854 {"Cryptic Passage", 20, 2},
2856 {"Transfusion", 27, 6},
2857 {"Conversions", 33, 5}
2860 level_t goodvsbad2levels[] =
2862 {"rts", "Many Paths"}, // 0
2863 {"chess", "Chess, Scott Hess"}, // 1
2864 {"dot", "Big Wall"},
2865 {"city2", "The Big City"},
2866 {"bwall", "0 G like Psychic TV"},
2867 {"snow", "Wireframed"},
2868 {"telep", "Infinite Falling"},
2869 {"faces", "Facing Bases"},
2870 {"island", "Adventure Islands"},
2873 episode_t goodvsbad2episodes[] =
2875 {"Levels? Bevels!", 0, 8},
2878 level_t battlemechlevels[] =
2880 {"start", "Parking Level"},
2881 {"dm1", "Hot Dump"}, // 1
2882 {"dm2", "The Pits"},
2883 {"dm3", "Dimber Died"},
2884 {"dm4", "Fire in the Hole"},
2885 {"dm5", "Clubhouses"},
2886 {"dm6", "Army go Underground"},
2889 episode_t battlemechepisodes[] =
2891 {"Time for Battle", 0, 7},
2894 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2895 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2896 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2897 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2898 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2899 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
2900 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
2901 gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
2906 gamelevels_t *notregistered;
2907 gamelevels_t *registered;
2911 gameinfo_t gamelist[] =
2913 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2914 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2915 {GAME_ROGUE, &roguegame, &roguegame},
2916 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2917 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2918 {GAME_GOODVSBAD2, &goodvsbad2game, &goodvsbad2game},
2919 {GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
2920 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2923 gamelevels_t *lookupgameinfo(void)
2926 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2927 if (registered.integer)
2928 return gamelist[i].registered;
2930 return gamelist[i].notregistered;
2936 qboolean m_serverInfoMessage = false;
2937 double m_serverInfoMessageTime;
2939 extern cvar_t sv_public;
2941 void M_Menu_GameOptions_f (void)
2943 key_dest = key_menu;
2944 m_state = m_gameoptions;
2945 m_entersound = true;
2946 if (maxplayers == 0)
2947 maxplayers = sv_maxplayers.integer;
2949 maxplayers = min(8, MAX_SCOREBOARD);
2953 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 132, 152, 160};
2954 #define NUM_GAMEOPTIONS 11
2955 int gameoptions_cursor;
2957 void M_GameOptions_Draw (void)
2963 M_Background(320, 200);
2965 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2966 p = Draw_CachePic ("gfx/p_multi.lmp");
2967 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2969 M_DrawTextBox (152, 32, 10, 1);
2970 M_Print (160, 40, "begin game");
2972 M_Print (0, 56, " Max players");
2973 M_Print (160, 56, va("%i", maxplayers) );
2975 if (gamemode != GAME_GOODVSBAD2)
2977 M_Print (0, 64, " Game Type");
2978 if (gamemode == GAME_TRANSFUSION)
2980 if (!deathmatch.integer)
2981 Cvar_SetValue("deathmatch", 1);
2982 if (deathmatch.integer == 2)
2983 M_Print (160, 64, "Capture the Flag");
2985 M_Print (160, 64, "Blood Bath");
2987 else if (gamemode == GAME_BATTLEMECH)
2989 if (!deathmatch.integer)
2990 Cvar_SetValue("deathmatch", 1);
2991 if (deathmatch.integer == 2)
2992 M_Print (160, 64, "Rambo Match");
2994 M_Print (160, 64, "Deathmatch");
2998 if (!coop.integer && !deathmatch.integer)
2999 Cvar_SetValue("deathmatch", 1);
3001 M_Print (160, 64, "Cooperative");
3003 M_Print (160, 64, "Deathmatch");
3006 M_Print (0, 72, " Teamplay");
3007 if (gamemode == GAME_ROGUE)
3011 switch((int)teamplay.integer)
3013 case 1: msg = "No Friendly Fire"; break;
3014 case 2: msg = "Friendly Fire"; break;
3015 case 3: msg = "Tag"; break;
3016 case 4: msg = "Capture the Flag"; break;
3017 case 5: msg = "One Flag CTF"; break;
3018 case 6: msg = "Three Team CTF"; break;
3019 default: msg = "Off"; break;
3021 M_Print (160, 72, msg);
3027 switch (teamplay.integer)
3029 case 0: msg = "Off"; break;
3030 case 2: msg = "Friendly Fire"; break;
3031 default: msg = "No Friendly Fire"; break;
3033 M_Print (160, 72, msg);
3036 M_Print (0, 80, " Skill");
3037 if (skill.integer == 0)
3038 M_Print (160, 80, "Easy difficulty");
3039 else if (skill.integer == 1)
3040 M_Print (160, 80, "Normal difficulty");
3041 else if (skill.integer == 2)
3042 M_Print (160, 80, "Hard difficulty");
3044 M_Print (160, 80, "Nightmare difficulty");
3046 M_Print (0, 88, " Frag Limit");
3047 if (fraglimit.integer == 0)
3048 M_Print (160, 88, "none");
3050 M_Print (160, 88, va("%i frags", fraglimit.integer));
3052 M_Print (0, 96, " Time Limit");
3053 if (timelimit.integer == 0)
3054 M_Print (160, 96, "none");
3056 M_Print (160, 96, va("%i minutes", timelimit.integer));
3059 M_Print (0, 104, " Public server");
3060 M_Print (160, 104, (sv_public.integer == 0) ? "no" : "yes");
3062 M_Print (0, 120, " Server name");
3063 M_DrawTextBox (0, 124, 38, 1);
3064 M_Print (8, 132, hostname.string);
3066 g = lookupgameinfo();
3068 if (gamemode != GAME_GOODVSBAD2)
3070 M_Print (0, 152, " Episode");
3071 M_Print (160, 152, g->episodes[startepisode].description);
3074 M_Print (0, 160, " Level");
3075 M_Print (160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3076 M_Print (160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3079 if (gameoptions_cursor == 8)
3080 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3082 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3084 if (m_serverInfoMessage)
3086 if ((realtime - m_serverInfoMessageTime) < 5.0)
3089 M_DrawTextBox (x, 138, 24, 4);
3091 M_Print (x, 146, " More than 64 players?? ");
3092 M_Print (x, 154, " First, question your ");
3093 M_Print (x, 162, " sanity, then email ");
3094 M_Print (x, 170, " havoc@telefragged.com ");
3097 m_serverInfoMessage = false;
3102 void M_NetStart_Change (int dir)
3107 switch (gameoptions_cursor)
3111 if (maxplayers > MAX_SCOREBOARD)
3113 maxplayers = MAX_SCOREBOARD;
3114 m_serverInfoMessage = true;
3115 m_serverInfoMessageTime = realtime;
3122 if (gamemode == GAME_GOODVSBAD2)
3124 if (gamemode == GAME_TRANSFUSION)
3126 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3127 Cvar_SetValueQuick (&deathmatch, 0);
3128 else // changing from BloodBath to CTF
3129 Cvar_SetValueQuick (&deathmatch, 2);
3131 else if (gamemode == GAME_BATTLEMECH)
3133 if (deathmatch.integer == 2) // changing from Rambo to Deathmatch
3134 Cvar_SetValueQuick (&deathmatch, 0);
3135 else // changing from Deathmatch to Rambo
3136 Cvar_SetValueQuick (&deathmatch, 2);
3140 if (deathmatch.integer) // changing from deathmatch to coop
3142 Cvar_SetValueQuick (&coop, 1);
3143 Cvar_SetValueQuick (&deathmatch, 0);
3145 else // changing from coop to deathmatch
3147 Cvar_SetValueQuick (&coop, 0);
3148 Cvar_SetValueQuick (&deathmatch, 1);
3154 if (gamemode == GAME_GOODVSBAD2)
3156 if (gamemode == GAME_ROGUE)
3161 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3162 if (teamplay.integer > count)
3163 Cvar_SetValueQuick (&teamplay, 0);
3164 else if (teamplay.integer < 0)
3165 Cvar_SetValueQuick (&teamplay, count);
3169 if (gamemode == GAME_GOODVSBAD2)
3171 Cvar_SetValueQuick (&skill, skill.integer + dir);
3172 if (skill.integer > 3)
3173 Cvar_SetValueQuick (&skill, 0);
3174 if (skill.integer < 0)
3175 Cvar_SetValueQuick (&skill, 3);
3179 if (gamemode == GAME_GOODVSBAD2)
3181 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3182 if (fraglimit.integer > 100)
3183 Cvar_SetValueQuick (&fraglimit, 0);
3184 if (fraglimit.integer < 0)
3185 Cvar_SetValueQuick (&fraglimit, 100);
3189 if (gamemode == GAME_GOODVSBAD2)
3191 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3192 if (timelimit.value > 60)
3193 Cvar_SetValueQuick (&timelimit, 0);
3194 if (timelimit.value < 0)
3195 Cvar_SetValueQuick (&timelimit, 60);
3199 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3206 if (gamemode == GAME_GOODVSBAD2)
3208 startepisode += dir;
3209 g = lookupgameinfo();
3211 if (startepisode < 0)
3212 startepisode = g->numepisodes - 1;
3214 if (startepisode >= g->numepisodes)
3222 g = lookupgameinfo();
3225 startlevel = g->episodes[startepisode].levels - 1;
3227 if (startlevel >= g->episodes[startepisode].levels)
3233 void M_GameOptions_Key (int key)
3237 char hostnamebuf[128];
3242 M_Menu_MultiPlayer_f ();
3246 S_LocalSound ("misc/menu1.wav");
3247 gameoptions_cursor--;
3248 if (gameoptions_cursor < 0)
3249 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3253 S_LocalSound ("misc/menu1.wav");
3254 gameoptions_cursor++;
3255 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3256 gameoptions_cursor = 0;
3260 if (gameoptions_cursor == 0)
3262 S_LocalSound ("misc/menu3.wav");
3263 M_NetStart_Change (-1);
3267 if (gameoptions_cursor == 0)
3269 S_LocalSound ("misc/menu3.wav");
3270 M_NetStart_Change (1);
3274 S_LocalSound ("misc/menu2.wav");
3275 if (gameoptions_cursor == 0)
3278 Cbuf_AddText ("disconnect\n");
3279 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3281 g = lookupgameinfo();
3282 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3286 M_NetStart_Change (1);
3290 if (gameoptions_cursor == 8)
3292 l = strlen(hostname.string);
3296 memcpy(hostnamebuf, hostname.string, l);
3298 Cvar_Set("hostname", hostnamebuf);
3304 if (key < 32 || key > 127)
3306 if (gameoptions_cursor == 8)
3308 l = strlen(hostname.string);
3311 memcpy(hostnamebuf, hostname.string, l);
3312 hostnamebuf[l] = key;
3313 hostnamebuf[l+1] = 0;
3314 Cvar_Set("hostname", hostnamebuf);
3320 //=============================================================================
3325 void M_Menu_ServerList_f (void)
3327 key_dest = key_menu;
3329 m_entersound = true;
3331 m_return_reason[0] = 0;
3336 void M_ServerList_Draw (void)
3338 int n, y, visible, start, end;
3341 // use as much vertical space as available
3342 M_Background(640, vid.conheight);
3343 // scroll the list as the cursor moves
3344 visible = (vid.conheight - 16 - 32) / 8;
3345 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3346 end = min(start + visible, hostCacheCount);
3348 p = Draw_CachePic("gfx/p_multi.lmp");
3349 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3351 for (n = start;n < end;n++)
3353 M_Print(0, y, hostcache[n].line1);y += 8;
3354 M_Print(0, y, hostcache[n].line2);y += 8;
3356 M_DrawCharacter(0, 32 + (slist_cursor - start) * 16, 12+((int)(realtime*4)&1));
3358 if (*m_return_reason)
3359 M_PrintWhite(16, vid.conheight - 8, m_return_reason);
3363 void M_ServerList_Key(int k)
3368 M_Menu_LanConfig_f();
3377 S_LocalSound("misc/menu1.wav");
3379 if (slist_cursor < 0)
3380 slist_cursor = hostCacheCount - 1;
3385 S_LocalSound("misc/menu1.wav");
3387 if (slist_cursor >= hostCacheCount)
3392 S_LocalSound("misc/menu2.wav");
3393 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3402 //=============================================================================
3403 /* Menu Subsystem */
3408 menu_mempool = Mem_AllocPool("Menu");
3409 menuplyr_load = true;
3410 menuplyr_pixels = NULL;
3412 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3414 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3415 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3416 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3417 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3418 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3419 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3420 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3421 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3422 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3423 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3424 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3425 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3426 Cmd_AddCommand ("help", M_Menu_Help_f);
3427 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3429 if (gamemode == GAME_TRANSFUSION)
3431 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3432 bindnames = transfusionbindnames;
3434 else if (gamemode == GAME_GOODVSBAD2)
3436 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3437 bindnames = goodvsbad2bindnames;
3441 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3442 bindnames = quakebindnames;
3445 if (gamemode == GAME_NEHAHRA)
3447 if (FS_FileExists("maps/neh1m4.bsp"))
3449 if (FS_FileExists("hearing.dem"))
3451 Con_Printf("Nehahra movie and game detected.\n");
3452 NehGameType = TYPE_BOTH;
3456 Con_Printf("Nehahra game detected.\n");
3457 NehGameType = TYPE_GAME;
3462 if (FS_FileExists("hearing.dem"))
3464 Con_Printf("Nehahra movie detected.\n");
3465 NehGameType = TYPE_DEMO;
3469 Con_Printf("Nehahra not found.\n");
3470 NehGameType = TYPE_GAME; // could just complain, but...
3478 if (key_dest != key_menu)
3480 if (m_state == m_none)
3496 case m_singleplayer:
3497 M_SinglePlayer_Draw ();
3509 M_MultiPlayer_Draw ();
3520 case m_options_effects:
3521 M_Options_Effects_Draw ();
3524 case m_options_colorcontrol:
3525 M_Options_ColorControl_Draw ();
3545 M_LanConfig_Draw ();
3549 M_GameOptions_Draw ();
3553 M_ServerList_Draw ();
3559 S_LocalSound ("misc/menu2.wav");
3560 m_entersound = false;
3567 void M_Keydown (int key)
3582 case m_singleplayer:
3583 M_SinglePlayer_Key (key);
3595 M_MultiPlayer_Key (key);
3603 M_Options_Key (key);
3606 case m_options_effects:
3607 M_Options_Effects_Key (key);
3610 case m_options_colorcontrol:
3611 M_Options_ColorControl_Key (key);
3631 M_LanConfig_Key (key);
3635 M_GameOptions_Key (key);
3639 M_ServerList_Key (key);