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.
23 #include "mprogdefs.h"
29 mempool_t *menu_mempool;
33 enum m_state_e m_state;
35 void M_Menu_Main_f (void);
36 void M_Menu_SinglePlayer_f (void);
37 void M_Menu_Load_f (void);
38 void M_Menu_Save_f (void);
39 void M_Menu_MultiPlayer_f (void);
40 void M_Menu_Setup_f (void);
41 void M_Menu_Options_f (void);
42 void M_Menu_Options_Effects_f (void);
43 void M_Menu_Options_ColorControl_f (void);
44 void M_Menu_Keys_f (void);
45 void M_Menu_Video_f (void);
46 void M_Menu_Help_f (void);
47 void M_Menu_Quit_f (void);
48 void M_Menu_LanConfig_f (void);
49 void M_Menu_GameOptions_f (void);
50 void M_Menu_ServerList_f (void);
52 void M_Main_Draw (void);
53 void M_SinglePlayer_Draw (void);
54 void M_Load_Draw (void);
55 void M_Save_Draw (void);
56 void M_MultiPlayer_Draw (void);
57 void M_Setup_Draw (void);
58 void M_Options_Draw (void);
59 void M_Options_Effects_Draw (void);
60 void M_Options_ColorControl_Draw (void);
61 void M_Keys_Draw (void);
62 void M_Video_Draw (void);
63 void M_Help_Draw (void);
64 void M_Quit_Draw (void);
65 void M_LanConfig_Draw (void);
66 void M_GameOptions_Draw (void);
67 void M_ServerList_Draw (void);
69 void M_Main_Key (int key, char ascii);
70 void M_SinglePlayer_Key (int key, char ascii);
71 void M_Load_Key (int key, char ascii);
72 void M_Save_Key (int key, char ascii);
73 void M_MultiPlayer_Key (int key, char ascii);
74 void M_Setup_Key (int key, char ascii);
75 void M_Options_Key (int key, char ascii);
76 void M_Options_Effects_Key (int key, char ascii);
77 void M_Options_ColorControl_Key (int key, char ascii);
78 void M_Keys_Key (int key, char ascii);
79 void M_Video_Key (int key, char ascii);
80 void M_Help_Key (int key, char ascii);
81 void M_Quit_Key (int key, char ascii);
82 void M_LanConfig_Key (int key, char ascii);
83 void M_GameOptions_Key (int key, char ascii);
84 void M_ServerList_Key (int key, char ascii);
86 qboolean m_entersound; // play after drawing a frame, so caching
87 // won't disrupt the sound
89 char m_return_reason [32];
91 #define StartingGame (m_multiplayer_cursor == 1)
92 #define JoiningGame (m_multiplayer_cursor == 0)
95 #define NumberOfNehahraDemos 34
100 } nehahrademonames_t;
102 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
104 {"intro", "Prologue"},
105 {"genf", "The Beginning"},
106 {"genlab", "A Doomed Project"},
107 {"nehcre", "The New Recruits"},
108 {"maxneh", "Breakthrough"},
109 {"maxchar", "Renewal and Duty"},
110 {"crisis", "Worlds Collide"},
111 {"postcris", "Darkening Skies"},
112 {"hearing", "The Hearing"},
113 {"getjack", "On a Mexican Radio"},
114 {"prelude", "Honor and Justice"},
115 {"abase", "A Message Sent"},
116 {"effect", "The Other Side"},
117 {"uhoh", "Missing in Action"},
118 {"prepare", "The Response"},
119 {"vision", "Farsighted Eyes"},
120 {"maxturns", "Enter the Immortal"},
121 {"backlot", "Separate Ways"},
122 {"maxside", "The Ancient Runes"},
123 {"counter", "The New Initiative"},
124 {"warprep", "Ghosts to the World"},
125 {"counter1", "A Fate Worse Than Death"},
126 {"counter2", "Friendly Fire"},
127 {"counter3", "Minor Setback"},
128 {"madmax", "Scores to Settle"},
129 {"quake", "One Man"},
130 {"cthmm", "Shattered Masks"},
131 {"shades", "Deal with the Dead"},
132 {"gophil", "An Unlikely Hero"},
133 {"cstrike", "War in Hell"},
134 {"shubset", "The Conspiracy"},
135 {"shubdie", "Even Death May Die"},
136 {"newranks", "An Empty Throne"},
137 {"seal", "The Seal is Broken"}
140 float menu_x, menu_y, menu_width, menu_height;
142 void M_Background(int width, int height)
145 menu_height = height;
146 menu_x = (vid.conwidth - menu_width) * 0.5;
147 menu_y = (vid.conheight - menu_height) * 0.5;
148 //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
149 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
156 Draws one solid graphics character
159 void M_DrawCharacter (float cx, float cy, int num)
164 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
167 void M_Print(float cx, float cy, const char *str)
169 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
172 void M_PrintRed (float cx, float cy, const char *str)
174 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
177 void M_ItemPrint(float cx, float cy, char *str, int unghosted)
180 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
182 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
185 void M_DrawPic (float cx, float cy, char *picname)
187 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
190 qbyte identityTable[256];
191 qbyte translationTable[256];
193 void M_BuildTranslationTable(int top, int bottom)
196 qbyte *dest, *source;
198 for (j = 0; j < 256; j++)
199 identityTable[j] = j;
200 dest = translationTable;
201 source = identityTable;
202 memcpy (dest, source, 256);
204 // LordHavoc: corrected skin color ranges
205 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
206 memcpy (dest + TOP_RANGE, source + top, 16);
208 for (j=0 ; j<16 ; j++)
209 dest[TOP_RANGE+j] = source[top+15-j];
211 // LordHavoc: corrected skin color ranges
212 if (bottom < 128 || (bottom >= 224 && bottom < 240))
213 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
215 for (j=0 ; j<16 ; j++)
216 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
220 void M_DrawTextBox (float x, float y, float width, float height)
228 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
229 for (n = 0; n < height; n++)
232 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
234 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
241 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
242 for (n = 0; n < height; n++)
246 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
248 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
250 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
257 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
258 for (n = 0; n < height; n++)
261 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
263 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
266 //=============================================================================
268 //int m_save_demonum;
275 void M_ToggleMenu_f (void)
279 if (key_dest != key_menu || m_state != m_main)
290 void M_Demo_Draw (void)
294 M_Background(320, 200);
296 for (i = 0;i < NumberOfNehahraDemos;i++)
297 M_Print(16, 16 + 8*i, NehahraDemos[i].desc);
300 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
304 void M_Menu_Demos_f (void)
311 void M_Demo_Key (int k, char ascii)
320 S_LocalSound ("misc/menu2.wav", true);
323 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
328 S_LocalSound ("misc/menu1.wav", true);
331 demo_cursor = NumberOfNehahraDemos-1;
336 S_LocalSound ("misc/menu1.wav", true);
338 if (demo_cursor >= NumberOfNehahraDemos)
344 //=============================================================================
349 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
351 void M_Menu_Main_f (void)
353 if (gamemode == GAME_NEHAHRA)
355 if (NehGameType == TYPE_DEMO)
357 else if (NehGameType == TYPE_GAME)
366 if (key_dest != key_menu)
368 m_save_demonum = cls.demonum;
378 void M_Main_Draw (void)
383 M_Background(320, 200);
385 M_DrawPic (16, 4, "gfx/qplaque.lmp");
386 p = Draw_CachePic ("gfx/ttl_main.lmp");
387 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
389 if (gamemode == GAME_NEHAHRA)
391 if (NehGameType == TYPE_BOTH)
392 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
393 else if (NehGameType == TYPE_GAME)
394 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
396 M_DrawPic (72, 32, "gfx/demomenu.lmp");
399 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
401 f = (int)(realtime * 10)%6;
403 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
407 void M_Main_Key (int key, char ascii)
414 //cls.demonum = m_save_demonum;
415 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
420 S_LocalSound ("misc/menu1.wav", true);
421 if (++m_main_cursor >= MAIN_ITEMS)
426 S_LocalSound ("misc/menu1.wav", true);
427 if (--m_main_cursor < 0)
428 m_main_cursor = MAIN_ITEMS - 1;
434 if (gamemode == GAME_NEHAHRA)
439 switch (m_main_cursor)
442 M_Menu_SinglePlayer_f ();
450 M_Menu_MultiPlayer_f ();
460 Cbuf_AddText ("disconnect\n");
461 Cbuf_AddText ("playdemo endcred\n");
470 switch (m_main_cursor)
473 M_Menu_SinglePlayer_f ();
477 M_Menu_MultiPlayer_f ();
487 Cbuf_AddText ("disconnect\n");
488 Cbuf_AddText ("playdemo endcred\n");
497 switch (m_main_cursor)
506 Cbuf_AddText ("disconnect\n");
507 Cbuf_AddText ("playdemo endcred\n");
523 switch (m_main_cursor)
526 M_Menu_SinglePlayer_f ();
530 M_Menu_MultiPlayer_f ();
549 //=============================================================================
550 /* SINGLE PLAYER MENU */
552 int m_singleplayer_cursor;
553 #define SINGLEPLAYER_ITEMS 3
556 void M_Menu_SinglePlayer_f (void)
559 m_state = m_singleplayer;
564 void M_SinglePlayer_Draw (void)
568 M_Background(320, 200);
570 M_DrawPic (16, 4, "gfx/qplaque.lmp");
571 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
573 // Transfusion doesn't have a single player mode
574 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
576 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
578 M_DrawTextBox (60, 8 * 8, 23, 4);
579 if (gamemode == GAME_NEXUIZ)
580 M_Print(95, 10 * 8, "Nexuiz is for");
581 else if (gamemode == GAME_GOODVSBAD2)
582 M_Print(95, 10 * 8, "Good Vs Bad 2 is for");
583 else if (gamemode == GAME_BATTLEMECH)
584 M_Print(95, 10 * 8, "Battlemech is for");
586 M_Print(95, 10 * 8, "Transfusion is for");
587 M_Print(83, 11 * 8, "multiplayer play only");
593 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
594 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
596 f = (int)(realtime * 10)%6;
598 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
603 void M_SinglePlayer_Key (int key, char ascii)
605 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
607 if (key == K_ESCAPE || key == K_ENTER)
619 S_LocalSound ("misc/menu1.wav", true);
620 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
621 m_singleplayer_cursor = 0;
625 S_LocalSound ("misc/menu1.wav", true);
626 if (--m_singleplayer_cursor < 0)
627 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
633 switch (m_singleplayer_cursor)
638 Cbuf_AddText ("disconnect\n");
639 Cbuf_AddText ("maxplayers 1\n");
640 Cbuf_AddText ("deathmatch 0\n");
641 Cbuf_AddText ("coop 0\n");
642 if (gamemode == GAME_NEHAHRA)
643 Cbuf_AddText ("map nehstart\n");
645 Cbuf_AddText ("map start\n");
659 //=============================================================================
662 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
664 #define MAX_SAVEGAMES 12
665 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
666 int loadable[MAX_SAVEGAMES];
668 void M_ScanSaves (void)
671 char name[MAX_OSPATH];
676 for (i=0 ; i<MAX_SAVEGAMES ; i++)
678 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
680 sprintf (name, "s%i.sav", i);
681 f = FS_Open (name, "r", false);
684 str = FS_Getline (f);
685 sscanf (str, "%i\n", &version);
686 str = FS_Getline (f);
687 strlcpy (m_filenames[i], str, sizeof (m_filenames[i]));
689 // change _ back to space
690 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
691 if (m_filenames[i][j] == '_')
692 m_filenames[i][j] = ' ';
698 void M_Menu_Load_f (void)
707 void M_Menu_Save_f (void)
722 void M_Load_Draw (void)
727 M_Background(320, 200);
729 p = Draw_CachePic ("gfx/p_load.lmp");
730 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
732 for (i=0 ; i< MAX_SAVEGAMES; i++)
733 M_Print(16, 32 + 8*i, m_filenames[i]);
736 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
740 void M_Save_Draw (void)
745 M_Background(320, 200);
747 p = Draw_CachePic ("gfx/p_save.lmp");
748 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
750 for (i=0 ; i<MAX_SAVEGAMES ; i++)
751 M_Print(16, 32 + 8*i, m_filenames[i]);
754 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
758 void M_Load_Key (int k, char ascii)
763 M_Menu_SinglePlayer_f ();
767 S_LocalSound ("misc/menu2.wav", true);
768 if (!loadable[load_cursor])
773 // issue the load command
774 Cbuf_AddText (va ("load s%i\n", load_cursor) );
779 S_LocalSound ("misc/menu1.wav", true);
782 load_cursor = MAX_SAVEGAMES-1;
787 S_LocalSound ("misc/menu1.wav", true);
789 if (load_cursor >= MAX_SAVEGAMES)
796 void M_Save_Key (int k, char ascii)
801 M_Menu_SinglePlayer_f ();
807 Cbuf_AddText (va("save s%i\n", load_cursor));
812 S_LocalSound ("misc/menu1.wav", true);
815 load_cursor = MAX_SAVEGAMES-1;
820 S_LocalSound ("misc/menu1.wav", true);
822 if (load_cursor >= MAX_SAVEGAMES)
828 //=============================================================================
829 /* MULTIPLAYER MENU */
831 int m_multiplayer_cursor;
832 #define MULTIPLAYER_ITEMS 3
835 void M_Menu_MultiPlayer_f (void)
838 m_state = m_multiplayer;
843 void M_MultiPlayer_Draw (void)
848 M_Background(320, 200);
850 M_DrawPic (16, 4, "gfx/qplaque.lmp");
851 p = Draw_CachePic ("gfx/p_multi.lmp");
852 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
853 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
855 f = (int)(realtime * 10)%6;
857 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
861 void M_MultiPlayer_Key (int key, char ascii)
870 S_LocalSound ("misc/menu1.wav", true);
871 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
872 m_multiplayer_cursor = 0;
876 S_LocalSound ("misc/menu1.wav", true);
877 if (--m_multiplayer_cursor < 0)
878 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
883 switch (m_multiplayer_cursor)
887 M_Menu_LanConfig_f ();
897 //=============================================================================
900 int setup_cursor = 4;
901 int setup_cursor_table[] = {40, 64, 88, 124, 140};
903 char setup_myname[32];
911 #define NUM_SETUP_CMDS 5
913 void M_Menu_Setup_f (void)
918 strcpy(setup_myname, cl_name.string);
919 setup_top = setup_oldtop = cl_color.integer >> 4;
920 setup_bottom = setup_oldbottom = cl_color.integer & 15;
921 setup_rate = cl_rate.integer;
924 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
925 static qbyte *menuplyr_pixels;
926 static unsigned int *menuplyr_translated;
928 typedef struct ratetable_s
935 #define RATES ((int)(sizeof(setup_ratetable)/sizeof(setup_ratetable[0])))
936 static ratetable_t setup_ratetable[] =
939 {1500, "28.8 mediocre"},
941 {2500, "33.6 mediocre"},
944 {4000, "56k mediocre"},
945 {4500, "56k adequate"},
948 {15000, "128k ISDN"},
952 static int setup_rateindex(int rate)
955 for (i = 0;i < RATES;i++)
956 if (setup_ratetable[i].rate > setup_rate)
958 return bound(1, i, RATES) - 1;
961 void M_Setup_Draw (void)
966 M_Background(320, 200);
968 M_DrawPic (16, 4, "gfx/qplaque.lmp");
969 p = Draw_CachePic ("gfx/p_multi.lmp");
970 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
972 M_Print(64, 40, "Your name");
973 M_DrawTextBox (160, 32, 16, 1);
974 M_Print(168, 40, setup_myname);
976 if (gamemode != GAME_GOODVSBAD2)
978 M_Print(64, 64, "Shirt color");
979 M_Print(64, 88, "Pants color");
982 M_Print(64, 124-8, "Network speed limit");
983 M_Print(168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name));
985 M_DrawTextBox (64, 140-8, 14, 1);
986 M_Print(72, 140, "Accept Changes");
988 // LordHavoc: rewrote this code greatly
992 menuplyr_load = false;
994 menuplyr_bottom = -1;
995 if ((f = FS_LoadFile("gfx/menuplyr.lmp", tempmempool, true)))
997 data = LoadLMPAs8Bit (f, 0, 0);
998 menuplyr_width = image_width;
999 menuplyr_height = image_height;
1001 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
1002 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
1003 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
1008 if (menuplyr_pixels)
1010 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
1012 menuplyr_top = setup_top;
1013 menuplyr_bottom = setup_bottom;
1014 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
1015 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
1016 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
1017 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
1019 M_DrawPic(160, 48, "gfx/bigbox.lmp");
1020 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
1023 if (setup_cursor == 0)
1024 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1026 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1030 void M_Setup_Key (int k, char ascii)
1037 M_Menu_MultiPlayer_f ();
1041 S_LocalSound ("misc/menu1.wav", true);
1043 if (setup_cursor < 0)
1044 setup_cursor = NUM_SETUP_CMDS-1;
1048 S_LocalSound ("misc/menu1.wav", true);
1050 if (setup_cursor >= NUM_SETUP_CMDS)
1055 if (setup_cursor < 1)
1057 S_LocalSound ("misc/menu3.wav", true);
1058 if (setup_cursor == 1)
1059 setup_top = setup_top - 1;
1060 if (setup_cursor == 2)
1061 setup_bottom = setup_bottom - 1;
1062 if (setup_cursor == 3)
1064 l = setup_rateindex(setup_rate) - 1;
1067 setup_rate = setup_ratetable[l].rate;
1071 if (setup_cursor < 1)
1074 S_LocalSound ("misc/menu3.wav", true);
1075 if (setup_cursor == 1)
1076 setup_top = setup_top + 1;
1077 if (setup_cursor == 2)
1078 setup_bottom = setup_bottom + 1;
1079 if (setup_cursor == 3)
1081 l = setup_rateindex(setup_rate) + 1;
1084 setup_rate = setup_ratetable[l].rate;
1089 if (setup_cursor == 0)
1092 if (setup_cursor == 1 || setup_cursor == 2 || setup_cursor == 3)
1095 // setup_cursor == 4 (Accept changes)
1096 if (strcmp(cl_name.string, setup_myname) != 0)
1097 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1098 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1099 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1100 if (setup_rate != setup_oldrate)
1101 Cbuf_AddText(va("rate %i\n", setup_rate));
1103 m_entersound = true;
1104 M_Menu_MultiPlayer_f ();
1108 if (setup_cursor == 0)
1110 if (strlen(setup_myname))
1111 setup_myname[strlen(setup_myname)-1] = 0;
1116 if (ascii < 32 || ascii > 126)
1118 if (setup_cursor == 0)
1120 l = strlen(setup_myname);
1123 setup_myname[l+1] = 0;
1124 setup_myname[l] = ascii;
1133 if (setup_bottom > 15)
1135 if (setup_bottom < 0)
1139 //=============================================================================
1142 #define SLIDER_RANGE 10
1144 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1149 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1150 M_DrawCharacter (x-8, y, 128);
1151 for (i = 0;i < SLIDER_RANGE;i++)
1152 M_DrawCharacter (x + i*8, y, 129);
1153 M_DrawCharacter (x+i*8, y, 130);
1154 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1155 if (fabs((int)num - num) < 0.01)
1156 sprintf(text, "%i", (int)num);
1158 sprintf(text, "%.2f", num);
1159 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1162 void M_DrawCheckbox (int x, int y, int on)
1165 M_Print(x, y, "on");
1167 M_Print(x, y, "off");
1171 #define OPTIONS_ITEMS 37
1175 void M_Menu_Options_f (void)
1177 key_dest = key_menu;
1178 m_state = m_options;
1179 m_entersound = true;
1182 extern cvar_t snd_staticvolume;
1183 extern cvar_t gl_delayfinish;
1184 extern cvar_t slowmo;
1185 extern dllhandle_t jpeg_dll;
1186 extern cvar_t gl_texture_anisotropy;
1188 void M_Menu_Options_AdjustSliders (int dir)
1191 S_LocalSound ("misc/menu3.wav", true);
1194 if (options_cursor == optnum++)
1195 Cvar_SetValueQuick (&vid_conwidth, bound(320, vid_conwidth.value + dir * 64, 2048));
1196 else if (options_cursor == optnum++)
1197 Cvar_SetValueQuick (&vid_conheight, bound(240, vid_conheight.value + dir * 48, 1536));
1198 else if (options_cursor == optnum++)
1199 Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
1200 else if (options_cursor == optnum++)
1201 Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
1202 else if (options_cursor == optnum++)
1203 Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1));
1204 else if (options_cursor == optnum++)
1205 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1206 else if (options_cursor == optnum++)
1207 Cvar_SetValueQuick (&scr_fov, bound(1, scr_fov.integer + dir * 1, 170));
1208 else if (options_cursor == optnum++)
1209 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1210 else if (options_cursor == optnum++)
1211 Cvar_SetValueQuick (&scr_screenshot_jpeg_quality, bound(0, scr_screenshot_jpeg_quality.value + dir * 0.1, 1));
1212 else if (options_cursor == optnum++)
1213 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1214 else if (options_cursor == optnum++)
1215 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1216 else if (options_cursor == optnum++)
1217 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1218 else if (options_cursor == optnum++)
1219 Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer);
1220 else if (options_cursor == optnum++)
1221 Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy));
1222 else if (options_cursor == optnum++)
1223 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1224 else if (options_cursor == optnum++)
1225 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1226 else if (options_cursor == optnum++)
1227 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1228 else if (options_cursor == optnum++)
1229 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1230 else if (options_cursor == optnum++)
1231 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1232 else if (options_cursor == optnum++)
1233 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1234 else if (options_cursor == optnum++)
1235 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1236 else if (options_cursor == optnum++)
1237 Cvar_SetValueQuick (&showfps, !showfps.integer);
1238 else if (options_cursor == optnum++)
1239 Cvar_SetValueQuick (&showtime, !showtime.integer);
1240 else if (options_cursor == optnum++)
1241 Cvar_SetValueQuick (&showdate, !showdate.integer);
1242 else if (options_cursor == optnum++)
1244 if (cl_forwardspeed.value > 200)
1246 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1247 Cvar_SetValueQuick (&cl_backspeed, 200);
1251 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1252 Cvar_SetValueQuick (&cl_backspeed, 400);
1255 else if (options_cursor == optnum++)
1256 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1257 else if (options_cursor == optnum++)
1258 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1259 else if (options_cursor == optnum++)
1260 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1261 else if (options_cursor == optnum++)
1262 Cvar_SetValueQuick (&freelook, !freelook.integer);
1263 else if (options_cursor == optnum++)
1264 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1265 else if (options_cursor == optnum++)
1266 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1273 void M_Options_PrintCommand(char *s, int enabled)
1277 DrawQ_Fill(menu_x, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
1278 M_ItemPrint(0, opty, s, enabled);
1284 void M_Options_PrintCheckbox(char *s, int enabled, int yes)
1288 DrawQ_Fill(menu_x, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
1289 M_ItemPrint(0, opty, s, enabled);
1290 M_DrawCheckbox(0 + strlen(s) * 8 + 8, opty, yes);
1296 void M_Options_PrintSlider(char *s, int enabled, float value, float minvalue, float maxvalue)
1300 DrawQ_Fill(menu_x, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
1301 M_ItemPrint(0, opty, s, enabled);
1302 M_DrawSlider(0 + strlen(s) * 8 + 8, opty, value, minvalue, maxvalue);
1308 void M_Options_Draw (void)
1313 M_Background(320, 240);
1315 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1316 p = Draw_CachePic("gfx/p_option.lmp");
1317 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1320 optcursor = options_cursor;
1321 visible = (vid.conheight - 32) / 8;
1322 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
1324 M_Options_PrintCommand( "Customize controls", true);
1325 M_Options_PrintCommand( " Go to console", true);
1326 M_Options_PrintCommand( " Reset to defaults", true);
1327 M_Options_PrintCommand( " Video", true);
1328 M_Options_PrintCommand( " Effects", true);
1329 M_Options_PrintCommand( " Color Control", true);
1330 M_Options_PrintSlider( " 2D Screen Width ", true, vid_conwidth.value, 320, 2048);
1331 M_Options_PrintSlider( " 2D Screen Height", true, vid_conheight.value, 240, 1536);
1332 M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000);
1333 M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1);
1334 M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1);
1335 M_Options_PrintSlider( " Screen size", true, scr_viewsize.value, 30, 120);
1336 M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
1337 M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
1338 M_Options_PrintSlider( " JPEG quality", jpeg_dll != NULL, scr_screenshot_jpeg_quality.value, 0, 1);
1339 M_Options_PrintCheckbox(" Sky", true, r_sky.integer);
1340 M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer);
1341 M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer);
1342 M_Options_PrintCheckbox("Delay gfx (faster)", true, gl_delayfinish.integer);
1343 M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
1344 M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5);
1345 M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
1346 M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1);
1347 M_Options_PrintSlider(gamemode == GAME_GOODVSBAD2 ? " Music Volume" : " Ambient Volume", snd_initialized.integer, snd_staticvolume.value, 0, 1);
1348 M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5);
1349 M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5);
1350 M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer);
1351 M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
1352 M_Options_PrintCheckbox(" Show Time", true, showtime.integer);
1353 M_Options_PrintCheckbox(" Show Date", true, showdate.integer);
1354 M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
1355 M_Options_PrintCheckbox(" Lookspring", true, lookspring.integer);
1356 M_Options_PrintCheckbox(" Lookstrafe", true, lookstrafe.integer);
1357 M_Options_PrintSlider( " Mouse Speed", true, sensitivity.value, 1, 50);
1358 M_Options_PrintCheckbox(" Mouse Look", true, freelook.integer);
1359 M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
1360 M_Options_PrintCheckbox(" Use Mouse", true, vid_mouse.integer);
1364 void M_Options_Key (int k, char ascii)
1373 m_entersound = true;
1374 switch (options_cursor)
1381 key_dest = key_game;
1382 Con_ToggleConsole_f ();
1385 Cbuf_AddText ("exec default.cfg\n");
1391 M_Menu_Options_Effects_f ();
1394 M_Menu_Options_ColorControl_f ();
1397 M_Menu_Options_AdjustSliders (1);
1403 S_LocalSound ("misc/menu1.wav", true);
1405 if (options_cursor < 0)
1406 options_cursor = OPTIONS_ITEMS-1;
1410 S_LocalSound ("misc/menu1.wav", true);
1412 if (options_cursor >= OPTIONS_ITEMS)
1417 M_Menu_Options_AdjustSliders (-1);
1421 M_Menu_Options_AdjustSliders (1);
1426 #define OPTIONS_EFFECTS_ITEMS 33
1428 int options_effects_cursor;
1430 void M_Menu_Options_Effects_f (void)
1432 key_dest = key_menu;
1433 m_state = m_options_effects;
1434 m_entersound = true;
1438 extern cvar_t r_detailtextures;
1439 extern cvar_t cl_particles;
1440 extern cvar_t cl_explosions;
1441 extern cvar_t cl_stainmaps;
1442 extern cvar_t cl_decals;
1443 extern cvar_t r_explosionclip;
1444 extern cvar_t r_modellights;
1445 extern cvar_t r_coronas;
1446 extern cvar_t gl_flashblend;
1447 extern cvar_t cl_particles_quality;
1448 extern cvar_t cl_particles_bulletimpacts;
1449 extern cvar_t cl_particles_smoke;
1450 extern cvar_t cl_particles_sparks;
1451 extern cvar_t cl_particles_bubbles;
1452 extern cvar_t cl_particles_blood;
1453 extern cvar_t cl_particles_blood_alpha;
1454 extern cvar_t cl_particles_blood_bloodhack;
1455 extern cvar_t r_lightningbeam_thickness;
1456 extern cvar_t r_lightningbeam_scroll;
1457 extern cvar_t r_lightningbeam_repeatdistance;
1458 extern cvar_t r_lightningbeam_color_red;
1459 extern cvar_t r_lightningbeam_color_green;
1460 extern cvar_t r_lightningbeam_color_blue;
1461 extern cvar_t r_lightningbeam_qmbtexture;
1463 void M_Menu_Options_Effects_AdjustSliders (int dir)
1466 S_LocalSound ("misc/menu3.wav", true);
1469 if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1470 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_coronas, bound(0, r_coronas.value + dir * 0.125, 4));
1471 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1472 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1473 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4));
1474 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1475 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1476 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1477 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer);
1478 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1479 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1480 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1481 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1482 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1483 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1484 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1485 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_bloodhack, !cl_particles_blood_bloodhack.integer);
1486 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_thickness, bound(1, r_lightningbeam_thickness.integer + dir, 10));
1487 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_scroll, bound(0, r_lightningbeam_scroll.integer + dir, 10));
1488 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_repeatdistance, bound(64, r_lightningbeam_repeatdistance.integer + dir * 64, 1024));
1489 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_red, bound(0, r_lightningbeam_color_red.value + dir * 0.1, 1));
1490 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_green, bound(0, r_lightningbeam_color_green.value + dir * 0.1, 1));
1491 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_blue, bound(0, r_lightningbeam_color_blue.value + dir * 0.1, 1));
1492 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_qmbtexture, !r_lightningbeam_qmbtexture.integer);
1493 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer);
1494 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer);
1495 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_polyblend, bound(0, gl_polyblend.value + dir * 0.1, 1));
1496 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll1, bound(-8, r_skyscroll1.value + dir * 0.1, 8));
1497 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll2, bound(-8, r_skyscroll2.value + dir * 0.1, 8));
1498 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterwarp, bound(0, r_waterwarp.value + dir * 0.1, 1));
1499 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_wateralpha, bound(0, r_wateralpha.value + dir * 0.1, 1));
1500 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
1501 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_watershader, bound(0, r_watershader.value + dir * 0.25, 10));
1504 void M_Options_Effects_Draw (void)
1509 M_Background(320, 200);
1511 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1512 p = Draw_CachePic("gfx/p_option.lmp");
1513 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1515 optcursor = options_effects_cursor;
1517 visible = (vid.conheight - 32) / 8;
1518 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
1520 M_Options_PrintSlider( " Lights Per Model", true, r_modellights.value, 0, 8);
1521 M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
1522 M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer);
1523 M_Options_PrintCheckbox(" Particles", true, cl_particles.integer);
1524 M_Options_PrintSlider( " Particles Quality", true, cl_particles_quality.value, 1, 4);
1525 M_Options_PrintCheckbox(" Explosions", true, cl_explosions.integer);
1526 M_Options_PrintCheckbox(" Explosion Clipping", true, r_explosionclip.integer);
1527 M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer);
1528 M_Options_PrintCheckbox(" Decals", true, cl_decals.integer);
1529 M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer);
1530 M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer);
1531 M_Options_PrintCheckbox(" Smoke", true, cl_particles_smoke.integer);
1532 M_Options_PrintCheckbox(" Sparks", true, cl_particles_sparks.integer);
1533 M_Options_PrintCheckbox(" Bubbles", true, cl_particles_bubbles.integer);
1534 M_Options_PrintCheckbox(" Blood", true, cl_particles_blood.integer);
1535 M_Options_PrintSlider( " Blood Opacity", true, cl_particles_blood_alpha.value, 0.2, 1);
1536 M_Options_PrintCheckbox("Force New Blood Effect", true, cl_particles_blood_bloodhack.integer);
1537 M_Options_PrintSlider( " Lightning Thickness", true, r_lightningbeam_thickness.integer, 1, 10);
1538 M_Options_PrintSlider( " Lightning Scroll", true, r_lightningbeam_scroll.integer, 0, 10);
1539 M_Options_PrintSlider( " Lightning Repeat Dist", true, r_lightningbeam_repeatdistance.integer, 64, 1024);
1540 M_Options_PrintSlider( " Lightning Color Red", true, r_lightningbeam_color_red.value, 0, 1);
1541 M_Options_PrintSlider( " Lightning Color Green", true, r_lightningbeam_color_green.value, 0, 1);
1542 M_Options_PrintSlider( " Lightning Color Blue", true, r_lightningbeam_color_blue.value, 0, 1);
1543 M_Options_PrintCheckbox(" Lightning QMB Texture", true, r_lightningbeam_qmbtexture.integer);
1544 M_Options_PrintCheckbox(" Model Interpolation", true, r_lerpmodels.integer);
1545 M_Options_PrintCheckbox(" Sprite Interpolation", true, r_lerpsprites.integer);
1546 M_Options_PrintSlider( " View Blend", true, gl_polyblend.value, 0, 1);
1547 M_Options_PrintSlider( "Upper Sky Scroll Speed", true, r_skyscroll1.value, -8, 8);
1548 M_Options_PrintSlider( "Lower Sky Scroll Speed", true, r_skyscroll2.value, -8, 8);
1549 M_Options_PrintSlider( " Underwater View Warp", true, r_waterwarp.value, 0, 1);
1550 M_Options_PrintSlider( " Water Alpha (opacity)", true, r_wateralpha.value, 0, 1);
1551 M_Options_PrintSlider( " Water Movement", true, r_waterscroll.value, 0, 10);
1552 M_Options_PrintSlider( " GeForce3 Water Shader", true, r_watershader.value, 0, 10);
1556 void M_Options_Effects_Key (int k, char ascii)
1561 M_Menu_Options_f ();
1565 M_Menu_Options_Effects_AdjustSliders (1);
1569 S_LocalSound ("misc/menu1.wav", true);
1570 options_effects_cursor--;
1571 if (options_effects_cursor < 0)
1572 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1576 S_LocalSound ("misc/menu1.wav", true);
1577 options_effects_cursor++;
1578 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1579 options_effects_cursor = 0;
1583 M_Menu_Options_Effects_AdjustSliders (-1);
1587 M_Menu_Options_Effects_AdjustSliders (1);
1596 #define OPTIONS_COLORCONTROL_ITEMS 18
1598 int options_colorcontrol_cursor;
1600 // intensity value to match up to 50% dither to 'correct' quake
1601 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1603 void M_Menu_Options_ColorControl_f (void)
1605 key_dest = key_menu;
1606 m_state = m_options_colorcontrol;
1607 m_entersound = true;
1611 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1615 S_LocalSound ("misc/menu3.wav", true);
1618 if (options_colorcontrol_cursor == optnum++)
1619 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1620 else if (options_colorcontrol_cursor == optnum++)
1622 Cvar_SetValueQuick (&v_color_enable, 0);
1623 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1625 else if (options_colorcontrol_cursor == optnum++)
1627 Cvar_SetValueQuick (&v_color_enable, 0);
1628 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1630 else if (options_colorcontrol_cursor == optnum++)
1632 Cvar_SetValueQuick (&v_color_enable, 0);
1633 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1635 else if (options_colorcontrol_cursor == optnum++)
1637 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1639 else if (options_colorcontrol_cursor == optnum++)
1641 Cvar_SetValueQuick (&v_color_enable, 1);
1642 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1644 else if (options_colorcontrol_cursor == optnum++)
1646 Cvar_SetValueQuick (&v_color_enable, 1);
1647 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1649 else if (options_colorcontrol_cursor == optnum++)
1651 Cvar_SetValueQuick (&v_color_enable, 1);
1652 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1654 else if (options_colorcontrol_cursor == optnum++)
1656 Cvar_SetValueQuick (&v_color_enable, 1);
1657 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1658 Cvar_SetValueQuick (&v_color_black_r, f);
1659 Cvar_SetValueQuick (&v_color_black_g, f);
1660 Cvar_SetValueQuick (&v_color_black_b, f);
1662 else if (options_colorcontrol_cursor == optnum++)
1664 Cvar_SetValueQuick (&v_color_enable, 1);
1665 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1667 else if (options_colorcontrol_cursor == optnum++)
1669 Cvar_SetValueQuick (&v_color_enable, 1);
1670 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1672 else if (options_colorcontrol_cursor == optnum++)
1674 Cvar_SetValueQuick (&v_color_enable, 1);
1675 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1677 else if (options_colorcontrol_cursor == optnum++)
1679 Cvar_SetValueQuick (&v_color_enable, 1);
1680 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1681 Cvar_SetValueQuick (&v_color_grey_r, f);
1682 Cvar_SetValueQuick (&v_color_grey_g, f);
1683 Cvar_SetValueQuick (&v_color_grey_b, f);
1685 else if (options_colorcontrol_cursor == optnum++)
1687 Cvar_SetValueQuick (&v_color_enable, 1);
1688 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1690 else if (options_colorcontrol_cursor == optnum++)
1692 Cvar_SetValueQuick (&v_color_enable, 1);
1693 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1695 else if (options_colorcontrol_cursor == optnum++)
1697 Cvar_SetValueQuick (&v_color_enable, 1);
1698 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1700 else if (options_colorcontrol_cursor == optnum++)
1702 Cvar_SetValueQuick (&v_color_enable, 1);
1703 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1704 Cvar_SetValueQuick (&v_color_white_r, f);
1705 Cvar_SetValueQuick (&v_color_white_g, f);
1706 Cvar_SetValueQuick (&v_color_white_b, f);
1710 void M_Options_ColorControl_Draw (void)
1713 float x, c, s, t, u, v;
1716 M_Background(320, 256);
1718 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1719 p = Draw_CachePic("gfx/p_option.lmp");
1720 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1722 optcursor = options_colorcontrol_cursor;
1724 visible = (vid.conheight - 32) / 8;
1725 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
1727 M_Options_PrintCommand( " Reset to defaults", true);
1728 M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer);
1729 M_Options_PrintSlider( " Gamma", !v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_gamma.value, 1, 5);
1730 M_Options_PrintSlider( " Contrast", !v_color_enable.integer, v_contrast.value, 1, 5);
1731 M_Options_PrintSlider( " Brightness", !v_color_enable.integer, v_brightness.value, 0, 0.8);
1732 M_Options_PrintCheckbox(" Color Level Controls", true, v_color_enable.integer);
1733 M_Options_PrintSlider( " Black: Red ", v_color_enable.integer, v_color_black_r.value, 0, 0.8);
1734 M_Options_PrintSlider( " Black: Green", v_color_enable.integer, v_color_black_g.value, 0, 0.8);
1735 M_Options_PrintSlider( " Black: Blue ", v_color_enable.integer, v_color_black_b.value, 0, 0.8);
1736 M_Options_PrintSlider( " Black: Grey ", v_color_enable.integer, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3, 0, 0.8);
1737 M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_r.value, 0, 0.95);
1738 M_Options_PrintSlider( " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_g.value, 0, 0.95);
1739 M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_b.value, 0, 0.95);
1740 M_Options_PrintSlider( " Grey: Grey ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3, 0, 0.95);
1741 M_Options_PrintSlider( " White: Red ", v_color_enable.integer, v_color_white_r.value, 1, 5);
1742 M_Options_PrintSlider( " White: Green", v_color_enable.integer, v_color_white_g.value, 1, 5);
1743 M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5);
1744 M_Options_PrintSlider( " White: Grey ", v_color_enable.integer, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3, 1, 5);
1747 DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
1748 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1749 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1750 DrawQ_SuperPic(menu_x + 4, menu_y + opty, "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);opty += 4;
1751 DrawQ_SuperPic(menu_x + 4, menu_y + opty, 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);opty += 4;
1752 DrawQ_SuperPic(menu_x + 4, menu_y + opty, "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);opty += 4;
1753 DrawQ_SuperPic(menu_x + 4, menu_y + opty, 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);opty += 4;
1754 DrawQ_SuperPic(menu_x + 4, menu_y + opty, "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);opty += 4;
1755 DrawQ_SuperPic(menu_x + 4, menu_y + opty, 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);opty += 4;
1756 DrawQ_SuperPic(menu_x + 4, menu_y + opty, "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);opty += 4;
1757 DrawQ_SuperPic(menu_x + 4, menu_y + opty, 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);opty += 4;
1759 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1760 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1761 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1766 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, 0, 0, 1, 0);
1767 DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 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);
1768 DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 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);
1770 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, c, 0, 1, 0);
1771 DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 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);
1772 DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 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);
1774 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, 0, c, 1, 0);
1775 DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 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);
1776 DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 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);
1778 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, c, c, 1, 0);
1779 DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 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);
1780 DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 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);
1784 void M_Options_ColorControl_Key (int k, char ascii)
1789 M_Menu_Options_f ();
1793 m_entersound = true;
1794 switch (options_colorcontrol_cursor)
1797 Cvar_SetValueQuick(&v_hwgamma, 1);
1798 Cvar_SetValueQuick(&v_gamma, 1);
1799 Cvar_SetValueQuick(&v_contrast, 1);
1800 Cvar_SetValueQuick(&v_brightness, 0);
1801 Cvar_SetValueQuick(&v_color_enable, 0);
1802 Cvar_SetValueQuick(&v_color_black_r, 0);
1803 Cvar_SetValueQuick(&v_color_black_g, 0);
1804 Cvar_SetValueQuick(&v_color_black_b, 0);
1805 Cvar_SetValueQuick(&v_color_grey_r, 0);
1806 Cvar_SetValueQuick(&v_color_grey_g, 0);
1807 Cvar_SetValueQuick(&v_color_grey_b, 0);
1808 Cvar_SetValueQuick(&v_color_white_r, 1);
1809 Cvar_SetValueQuick(&v_color_white_g, 1);
1810 Cvar_SetValueQuick(&v_color_white_b, 1);
1813 M_Menu_Options_ColorControl_AdjustSliders (1);
1819 S_LocalSound ("misc/menu1.wav", true);
1820 options_colorcontrol_cursor--;
1821 if (options_colorcontrol_cursor < 0)
1822 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1826 S_LocalSound ("misc/menu1.wav", true);
1827 options_colorcontrol_cursor++;
1828 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1829 options_colorcontrol_cursor = 0;
1833 M_Menu_Options_ColorControl_AdjustSliders (-1);
1837 M_Menu_Options_ColorControl_AdjustSliders (1);
1843 //=============================================================================
1846 char *quakebindnames[][2] =
1848 {"+attack", "attack"},
1849 {"impulse 10", "next weapon"},
1850 {"impulse 12", "previous weapon"},
1851 {"+jump", "jump / swim up"},
1852 {"+forward", "walk forward"},
1853 {"+back", "backpedal"},
1854 {"+left", "turn left"},
1855 {"+right", "turn right"},
1857 {"+moveleft", "step left"},
1858 {"+moveright", "step right"},
1859 {"+strafe", "sidestep"},
1860 {"+lookup", "look up"},
1861 {"+lookdown", "look down"},
1862 {"centerview", "center view"},
1863 {"+mlook", "mouse look"},
1864 {"+klook", "keyboard look"},
1865 {"+moveup", "swim up"},
1866 {"+movedown", "swim down"}
1869 char *transfusionbindnames[][2] =
1871 {"", "Movement"}, // Movement commands
1872 {"+forward", "walk forward"},
1873 {"+back", "backpedal"},
1874 {"+left", "turn left"},
1875 {"+right", "turn right"},
1876 {"+moveleft", "step left"},
1877 {"+moveright", "step right"},
1878 {"+jump", "jump / swim up"},
1879 {"+movedown", "swim down"},
1880 {"", "Combat"}, // Combat commands
1881 {"impulse 1", "Pitch Fork"},
1882 {"impulse 2", "Flare Gun"},
1883 {"impulse 3", "Shotgun"},
1884 {"impulse 4", "Machine Gun"},
1885 {"impulse 5", "Incinerator"},
1886 {"impulse 6", "Bombs (TNT)"},
1887 {"impulse 35", "Proximity Bomb"},
1888 {"impulse 36", "Remote Detonator"},
1889 {"impulse 7", "Aerosol Can"},
1890 {"impulse 8", "Tesla Cannon"},
1891 {"impulse 9", "Life Leech"},
1892 {"impulse 10", "Voodoo Doll"},
1893 {"impulse 21", "next weapon"},
1894 {"impulse 22", "previous weapon"},
1895 {"+attack", "attack"},
1896 {"+button3", "altfire"},
1897 {"", "Inventory"}, // Inventory commands
1898 {"impulse 40", "Dr.'s Bag"},
1899 {"impulse 41", "Crystal Ball"},
1900 {"impulse 42", "Beast Vision"},
1901 {"impulse 43", "Jump Boots"},
1902 {"impulse 23", "next item"},
1903 {"impulse 24", "previous item"},
1904 {"impulse 25", "use item"},
1905 {"", "Misc"}, // Misc commands
1906 {"+button4", "use"},
1907 {"impulse 50", "add bot (red)"},
1908 {"impulse 51", "add bot (blue)"},
1909 {"impulse 52", "kick a bot"},
1910 {"impulse 26", "next armor type"},
1911 {"impulse 27", "identify player"},
1912 {"impulse 55", "voting menu"},
1913 {"impulse 56", "observer mode"},
1914 {"", "Taunts"}, // Taunts
1915 {"impulse 70", "taunt 0"},
1916 {"impulse 71", "taunt 1"},
1917 {"impulse 72", "taunt 2"},
1918 {"impulse 73", "taunt 3"},
1919 {"impulse 74", "taunt 4"},
1920 {"impulse 75", "taunt 5"},
1921 {"impulse 76", "taunt 6"},
1922 {"impulse 77", "taunt 7"},
1923 {"impulse 78", "taunt 8"},
1924 {"impulse 79", "taunt 9"}
1927 char *goodvsbad2bindnames[][2] =
1929 {"impulse 69", "Power 1"},
1930 {"impulse 70", "Power 2"},
1931 {"impulse 71", "Power 3"},
1932 {"+jump", "jump / swim up"},
1933 {"+forward", "walk forward"},
1934 {"+back", "backpedal"},
1935 {"+left", "turn left"},
1936 {"+right", "turn right"},
1938 {"+moveleft", "step left"},
1939 {"+moveright", "step right"},
1940 {"+strafe", "sidestep"},
1941 {"+lookup", "look up"},
1942 {"+lookdown", "look down"},
1943 {"centerview", "center view"},
1944 {"+mlook", "mouse look"},
1945 {"kill", "kill yourself"},
1946 {"+moveup", "swim up"},
1947 {"+movedown", "swim down"}
1951 char *(*bindnames)[2];
1954 typedef struct binditem_s
1956 char *command, *description;
1957 struct binditem_s *next;
1961 typedef struct bindcategory_s
1965 struct bindcategory_s *next;
1969 bindcategory_t *bindcategories = NULL;
1971 void M_ClearBinds (void)
1973 for (c = bindcategories;c;c = cnext)
1976 for (b = c->binds;b;b = bnext)
1983 bindcategories = NULL;
1986 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1988 for (b = &c->binds;*b;*b = &(*b)->next);
1989 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1990 *b->command = (char *)((*b) + 1);
1991 *b->description = *b->command + strlen(command) + 1;
1992 strcpy(*b->command, command);
1993 strcpy(*b->description, description);
1996 void M_AddBind (char *category, char *command, char *description)
1998 for (c = &bindcategories;*c;c = &(*c)->next)
2000 if (!strcmp(category, (*c)->name))
2002 M_AddBindToCategory(*c, command, description);
2006 *c = Z_Alloc(sizeof(bindcategory_t));
2007 M_AddBindToCategory(*c, command, description);
2010 void M_DefaultBinds (void)
2013 M_AddBind("movement", "+jump", "jump / swim up");
2014 M_AddBind("movement", "+forward", "walk forward");
2015 M_AddBind("movement", "+back", "backpedal");
2016 M_AddBind("movement", "+left", "turn left");
2017 M_AddBind("movement", "+right", "turn right");
2018 M_AddBind("movement", "+speed", "run");
2019 M_AddBind("movement", "+moveleft", "step left");
2020 M_AddBind("movement", "+moveright", "step right");
2021 M_AddBind("movement", "+strafe", "sidestep");
2022 M_AddBind("movement", "+lookup", "look up");
2023 M_AddBind("movement", "+lookdown", "look down");
2024 M_AddBind("movement", "centerview", "center view");
2025 M_AddBind("movement", "+mlook", "mouse look");
2026 M_AddBind("movement", "+klook", "keyboard look");
2027 M_AddBind("movement", "+moveup", "swim up");
2028 M_AddBind("movement", "+movedown", "swim down");
2029 M_AddBind("weapons", "+attack", "attack");
2030 M_AddBind("weapons", "impulse 10", "next weapon");
2031 M_AddBind("weapons", "impulse 12", "previous weapon");
2032 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2033 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2034 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2035 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2036 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2037 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2038 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2039 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2047 void M_Menu_Keys_f (void)
2049 key_dest = key_menu;
2051 m_entersound = true;
2056 void M_FindKeysForCommand (char *command, int *keys)
2062 for (j = 0;j < NUMKEYS;j++)
2067 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2069 b = keybindings[0][j];
2072 if (!strcmp (b, command) )
2075 if (count == NUMKEYS)
2081 void M_UnbindCommand (char *command)
2086 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2088 b = keybindings[0][j];
2091 if (!strcmp (b, command))
2092 Key_SetBinding (j, 0, "");
2097 void M_Keys_Draw (void)
2103 char keystring[1024];
2105 M_Background(320, 48 + 8 * numcommands);
2107 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2108 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2111 M_Print(12, 32, "Press a key or button for this action");
2113 M_Print(18, 32, "Enter to change, backspace to clear");
2115 // search for known bindings
2116 for (i=0 ; i<numcommands ; i++)
2120 // If there's no command, it's just a section
2121 if (bindnames[i][0][0] == '\0')
2123 M_PrintRed (4, y, "\x0D"); // #13 is the little arrow pointing to the right
2124 M_PrintRed (16, y, bindnames[i][1]);
2128 M_Print(16, y, bindnames[i][1]);
2130 M_FindKeysForCommand (bindnames[i][0], keys);
2132 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2134 strcpy(keystring, "???");
2138 for (j = 0;j < NUMKEYS;j++)
2143 strcat(keystring, " or ");
2144 strcat(keystring, Key_KeynumToString (keys[j]));
2148 M_Print(150, y, keystring);
2152 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2154 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2158 void M_Keys_Key (int k, char ascii)
2165 S_LocalSound ("misc/menu1.wav", true);
2170 else //if (k != '`')
2172 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2173 Cbuf_InsertText (cmd);
2183 M_Menu_Options_f ();
2188 S_LocalSound ("misc/menu1.wav", true);
2192 if (keys_cursor < 0)
2193 keys_cursor = numcommands-1;
2195 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2200 S_LocalSound ("misc/menu1.wav", true);
2204 if (keys_cursor >= numcommands)
2207 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2210 case K_ENTER: // go into bind mode
2211 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2212 S_LocalSound ("misc/menu2.wav", true);
2213 if (keys[NUMKEYS - 1] != -1)
2214 M_UnbindCommand (bindnames[keys_cursor][0]);
2218 case K_BACKSPACE: // delete bindings
2219 case K_DEL: // delete bindings
2220 S_LocalSound ("misc/menu2.wav", true);
2221 M_UnbindCommand (bindnames[keys_cursor][0]);
2226 //=============================================================================
2229 #define VIDEO_ITEMS 4
2231 int video_cursor = 0;
2232 int video_cursor_table[] = {56, 68, 80, 100};
2233 // note: if modes are added to the beginning of this list, update the
2234 // video_resolution = x; in M_Menu_Video_f below
2235 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}, {0,0}};
2236 // this is the number of the 640x480 mode in the list
2238 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
2239 int video_resolution;
2241 extern int current_vid_fullscreen;
2242 extern int current_vid_width;
2243 extern int current_vid_height;
2244 extern int current_vid_bitsperpixel;
2247 void M_Menu_Video_f (void)
2249 key_dest = key_menu;
2251 m_entersound = true;
2253 // Look for the current resolution
2254 for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
2256 if (video_resolutions[video_resolution][0] == current_vid_width &&
2257 video_resolutions[video_resolution][1] == current_vid_height)
2261 // Default to VID_640 if we didn't find it
2262 if (video_resolution == VID_RES_COUNT)
2264 // may need to update this number if mode list changes
2265 video_resolution = VID_640;
2266 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2267 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2272 void M_Video_Draw (void)
2277 M_Background(320, 200);
2279 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2280 p = Draw_CachePic("gfx/vidmodes.lmp");
2281 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2284 M_Print(16, video_cursor_table[0], " Resolution");
2285 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2286 M_Print(220, video_cursor_table[0], string);
2289 M_Print(16, video_cursor_table[1], " Bits per pixel");
2290 M_Print(220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2293 M_Print(16, video_cursor_table[2], " Fullscreen");
2294 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2297 M_Print(220, video_cursor_table[3], "Apply");
2300 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2304 void M_Menu_Video_AdjustSliders (int dir)
2306 S_LocalSound ("misc/menu3.wav", true);
2308 switch (video_cursor)
2313 int new_resolution = video_resolution + dir;
2314 if (gamemode == GAME_FNIGGIUM ? new_resolution < VID_640 : new_resolution < 0)
2315 video_resolution = VID_RES_COUNT - 1;
2316 else if (new_resolution > VID_RES_COUNT - 1)
2317 video_resolution = gamemode == GAME_FNIGGIUM ? VID_640 : 0;
2319 video_resolution = new_resolution;
2321 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2322 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2328 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2331 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2337 void M_Video_Key (int key, char ascii)
2342 // vid_shared.c has a copy of the current video config. We restore it
2343 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2344 Cvar_SetValueQuick(&vid_width, current_vid_width);
2345 Cvar_SetValueQuick(&vid_height, current_vid_height);
2346 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2348 S_LocalSound ("misc/menu1.wav", true);
2349 M_Menu_Options_f ();
2353 m_entersound = true;
2354 switch (video_cursor)
2357 Cbuf_AddText ("vid_restart\n");
2358 M_Menu_Options_f ();
2361 M_Menu_Video_AdjustSliders (1);
2366 S_LocalSound ("misc/menu1.wav", true);
2368 if (video_cursor < 0)
2369 video_cursor = VIDEO_ITEMS-1;
2373 S_LocalSound ("misc/menu1.wav", true);
2375 if (video_cursor >= VIDEO_ITEMS)
2380 M_Menu_Video_AdjustSliders (-1);
2384 M_Menu_Video_AdjustSliders (1);
2389 //=============================================================================
2393 #define NUM_HELP_PAGES 6
2396 void M_Menu_Help_f (void)
2398 key_dest = key_menu;
2400 m_entersound = true;
2406 void M_Help_Draw (void)
2408 M_Background(320, 200);
2409 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2413 void M_Help_Key (int key, char ascii)
2423 m_entersound = true;
2424 if (++help_page >= NUM_HELP_PAGES)
2430 m_entersound = true;
2431 if (--help_page < 0)
2432 help_page = NUM_HELP_PAGES-1;
2438 //=============================================================================
2441 char *m_quit_message[9];
2442 int m_quit_prevstate;
2443 qboolean wasInMenus;
2446 int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
2448 m_quit_message[0] = line1;
2449 m_quit_message[1] = line2;
2450 m_quit_message[2] = line3;
2451 m_quit_message[3] = line4;
2452 m_quit_message[4] = line5;
2453 m_quit_message[5] = line6;
2454 m_quit_message[6] = line7;
2455 m_quit_message[7] = line8;
2456 m_quit_message[8] = NULL;
2460 int M_ChooseQuitMessage(int request)
2468 if (request-- == 0) return M_QuitMessage("Are you gonna quit","this game just like","everything else?",NULL,NULL,NULL,NULL,NULL);
2469 if (request-- == 0) return M_QuitMessage("Milord, methinks that","thou art a lowly","quitter. Is this true?",NULL,NULL,NULL,NULL,NULL);
2470 if (request-- == 0) return M_QuitMessage("Do I need to bust your","face open for trying","to quit?",NULL,NULL,NULL,NULL,NULL);
2471 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);
2472 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);
2473 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);
2474 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);
2475 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);
2477 case GAME_GOODVSBAD2:
2478 if (request-- == 0) return M_QuitMessage("Press Yes To Quit","...","Yes",NULL,NULL,NULL,NULL,NULL);
2479 if (request-- == 0) return M_QuitMessage("Do you really want to","Quit?","Play Good vs bad 3!",NULL,NULL,NULL,NULL,NULL);
2480 if (request-- == 0) return M_QuitMessage("All your quit are","belong to long duck","dong",NULL,NULL,NULL,NULL,NULL);
2481 if (request-- == 0) return M_QuitMessage("Press Y to quit","","But are you too legit?",NULL,NULL,NULL,NULL,NULL);
2482 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);
2483 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);
2484 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);
2485 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);
2486 if (request-- == 0) return M_QuitMessage("Press Y like you","were waanderers","from Ys'",NULL,NULL,NULL,NULL,NULL);
2487 if (request-- == 0) return M_QuitMessage("This game was made in","Nippon like the SS","announcer's saying ipon",NULL,NULL,NULL,NULL,NULL);
2488 if (request-- == 0) return M_QuitMessage("you","want to quit?",NULL,NULL,NULL,NULL,NULL,NULL);
2489 if (request-- == 0) return M_QuitMessage("Please stop playing","this stupid game",NULL,NULL,NULL,NULL,NULL,NULL);
2491 case GAME_BATTLEMECH:
2492 if (request-- == 0) return M_QuitMessage("? WHY ?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2493 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);
2494 if (request-- == 0) return M_QuitMessage("Accept Defeat?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2495 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);
2496 if (request-- == 0) return M_QuitMessage("Where's your bloodlust?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2497 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);
2498 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);
2500 case GAME_OPENQUARTZ:
2501 if (request-- == 0) return M_QuitMessage("There is nothing like free beer!","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2502 if (request-- == 0) return M_QuitMessage("GNU is not Unix!","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2503 if (request-- == 0) return M_QuitMessage("You prefer free beer over free speech?","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2504 if (request-- == 0) return M_QuitMessage("Is OpenQuartz Propaganda?","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2507 if (request-- == 0) return M_QuitMessage("Tired of fragging already?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2508 if (request-- == 0) return M_QuitMessage("Quit now and forfeit your bodycount?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2509 if (request-- == 0) return M_QuitMessage("Are you sure you want to quit?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2510 if (request-- == 0) return M_QuitMessage("Off to do something constructive?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2516 void M_Menu_Quit_f (void)
2519 if (m_state == m_quit)
2521 wasInMenus = (key_dest == key_menu);
2522 key_dest = key_menu;
2523 m_quit_prevstate = m_state;
2525 m_entersound = true;
2526 // count how many there are
2527 for (n = 0;M_ChooseQuitMessage(n);n++);
2529 M_ChooseQuitMessage(rand() % n);
2533 void M_Quit_Key (int key, char ascii)
2542 m_state = m_quit_prevstate;
2543 m_entersound = true;
2547 key_dest = key_game;
2562 void M_Quit_Draw (void)
2564 int i, l, linelength, firstline, lastline, lines;
2565 for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
2567 if ((l = strlen(m_quit_message[i])))
2577 lines = (lastline - firstline) + 1;
2578 M_Background(linelength * 8 + 16, lines * 8 + 16);
2579 M_DrawTextBox(0, 0, linelength, lines);
2580 for (i = 0, l = firstline;i < lines;i++, l++)
2581 M_Print(8 + 4 * (linelength - strlen(m_quit_message[l])), 8 + 8 * i, m_quit_message[l]);
2584 //=============================================================================
2585 /* LAN CONFIG MENU */
2587 int lanConfig_cursor = -1;
2588 int lanConfig_cursor_table [] = {56, 76, 112};
2589 #define NUM_LANCONFIG_CMDS 3
2592 char lanConfig_portname[6];
2593 char lanConfig_joinname[22];
2595 void M_Menu_LanConfig_f (void)
2597 key_dest = key_menu;
2598 m_state = m_lanconfig;
2599 m_entersound = true;
2600 if (lanConfig_cursor == -1)
2603 lanConfig_cursor = 1;
2606 lanConfig_cursor = 1;
2607 lanConfig_port = 26000;
2608 sprintf(lanConfig_portname, "%u", lanConfig_port);
2610 m_return_reason[0] = 0;
2614 void M_LanConfig_Draw (void)
2621 M_Background(320, 200);
2623 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2624 p = Draw_CachePic ("gfx/p_multi.lmp");
2625 basex = (320-p->width)/2;
2626 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2629 startJoin = "New Game";
2631 startJoin = "Join Game";
2632 protocol = "TCP/IP";
2633 M_Print(basex, 32, va ("%s - %s", startJoin, protocol));
2636 M_Print(basex, lanConfig_cursor_table[0], "Port");
2637 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2638 M_Print(basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2642 M_Print(basex, lanConfig_cursor_table[1], "Search for games...");
2643 M_Print(basex, lanConfig_cursor_table[2]-16, "Join game at:");
2644 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2645 M_Print(basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2649 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2650 M_Print(basex+8, lanConfig_cursor_table[1], "OK");
2653 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2655 if (lanConfig_cursor == 0)
2656 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2658 if (lanConfig_cursor == 2)
2659 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2661 if (*m_return_reason)
2662 M_Print(basex, 168, m_return_reason);
2666 void M_LanConfig_Key (int key, char ascii)
2673 M_Menu_MultiPlayer_f ();
2677 S_LocalSound ("misc/menu1.wav", true);
2679 if (lanConfig_cursor < 0)
2680 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2684 S_LocalSound ("misc/menu1.wav", true);
2686 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2687 lanConfig_cursor = 0;
2691 if (lanConfig_cursor == 0)
2694 m_entersound = true;
2696 Cbuf_AddText ("stopdemo\n");
2698 Cvar_SetValue("port", lanConfig_port);
2700 if (lanConfig_cursor == 1)
2704 M_Menu_GameOptions_f ();
2707 M_Menu_ServerList_f();
2711 if (lanConfig_cursor == 2)
2712 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2716 if (lanConfig_cursor == 0)
2718 if (strlen(lanConfig_portname))
2719 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2722 if (lanConfig_cursor == 2)
2724 if (strlen(lanConfig_joinname))
2725 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2730 if (ascii < 32 || ascii > 126)
2733 if (lanConfig_cursor == 2)
2735 l = strlen(lanConfig_joinname);
2738 lanConfig_joinname[l+1] = 0;
2739 lanConfig_joinname[l] = ascii;
2743 if (ascii < '0' || ascii > '9')
2745 if (lanConfig_cursor == 0)
2747 l = strlen(lanConfig_portname);
2750 lanConfig_portname[l+1] = 0;
2751 lanConfig_portname[l] = ascii;
2756 if (StartingGame && lanConfig_cursor == 2)
2758 if (key == K_UPARROW)
2759 lanConfig_cursor = 1;
2761 lanConfig_cursor = 0;
2764 l = atoi(lanConfig_portname);
2767 sprintf(lanConfig_portname, "%u", lanConfig_port);
2770 //=============================================================================
2771 /* GAME OPTIONS MENU */
2790 episode_t *episodes;
2795 level_t quakelevels[] =
2797 {"start", "Entrance"}, // 0
2799 {"e1m1", "Slipgate Complex"}, // 1
2800 {"e1m2", "Castle of the Damned"},
2801 {"e1m3", "The Necropolis"},
2802 {"e1m4", "The Grisly Grotto"},
2803 {"e1m5", "Gloom Keep"},
2804 {"e1m6", "The Door To Chthon"},
2805 {"e1m7", "The House of Chthon"},
2806 {"e1m8", "Ziggurat Vertigo"},
2808 {"e2m1", "The Installation"}, // 9
2809 {"e2m2", "Ogre Citadel"},
2810 {"e2m3", "Crypt of Decay"},
2811 {"e2m4", "The Ebon Fortress"},
2812 {"e2m5", "The Wizard's Manse"},
2813 {"e2m6", "The Dismal Oubliette"},
2814 {"e2m7", "Underearth"},
2816 {"e3m1", "Termination Central"}, // 16
2817 {"e3m2", "The Vaults of Zin"},
2818 {"e3m3", "The Tomb of Terror"},
2819 {"e3m4", "Satan's Dark Delight"},
2820 {"e3m5", "Wind Tunnels"},
2821 {"e3m6", "Chambers of Torment"},
2822 {"e3m7", "The Haunted Halls"},
2824 {"e4m1", "The Sewage System"}, // 23
2825 {"e4m2", "The Tower of Despair"},
2826 {"e4m3", "The Elder God Shrine"},
2827 {"e4m4", "The Palace of Hate"},
2828 {"e4m5", "Hell's Atrium"},
2829 {"e4m6", "The Pain Maze"},
2830 {"e4m7", "Azure Agony"},
2831 {"e4m8", "The Nameless City"},
2833 {"end", "Shub-Niggurath's Pit"}, // 31
2835 {"dm1", "Place of Two Deaths"}, // 32
2836 {"dm2", "Claustrophobopolis"},
2837 {"dm3", "The Abandoned Base"},
2838 {"dm4", "The Bad Place"},
2839 {"dm5", "The Cistern"},
2840 {"dm6", "The Dark Zone"}
2843 episode_t quakeepisodes[] =
2845 {"Welcome to Quake", 0, 1},
2846 {"Doomed Dimension", 1, 8},
2847 {"Realm of Black Magic", 9, 7},
2848 {"Netherworld", 16, 7},
2849 {"The Elder World", 23, 8},
2850 {"Final Level", 31, 1},
2851 {"Deathmatch Arena", 32, 6}
2854 //MED 01/06/97 added hipnotic levels
2855 level_t hipnoticlevels[] =
2857 {"start", "Command HQ"}, // 0
2859 {"hip1m1", "The Pumping Station"}, // 1
2860 {"hip1m2", "Storage Facility"},
2861 {"hip1m3", "The Lost Mine"},
2862 {"hip1m4", "Research Facility"},
2863 {"hip1m5", "Military Complex"},
2865 {"hip2m1", "Ancient Realms"}, // 6
2866 {"hip2m2", "The Black Cathedral"},
2867 {"hip2m3", "The Catacombs"},
2868 {"hip2m4", "The Crypt"},
2869 {"hip2m5", "Mortum's Keep"},
2870 {"hip2m6", "The Gremlin's Domain"},
2872 {"hip3m1", "Tur Torment"}, // 12
2873 {"hip3m2", "Pandemonium"},
2874 {"hip3m3", "Limbo"},
2875 {"hip3m4", "The Gauntlet"},
2877 {"hipend", "Armagon's Lair"}, // 16
2879 {"hipdm1", "The Edge of Oblivion"} // 17
2882 //MED 01/06/97 added hipnotic episodes
2883 episode_t hipnoticepisodes[] =
2885 {"Scourge of Armagon", 0, 1},
2886 {"Fortress of the Dead", 1, 5},
2887 {"Dominion of Darkness", 6, 6},
2888 {"The Rift", 12, 4},
2889 {"Final Level", 16, 1},
2890 {"Deathmatch Arena", 17, 1}
2893 //PGM 01/07/97 added rogue levels
2894 //PGM 03/02/97 added dmatch level
2895 level_t roguelevels[] =
2897 {"start", "Split Decision"},
2898 {"r1m1", "Deviant's Domain"},
2899 {"r1m2", "Dread Portal"},
2900 {"r1m3", "Judgement Call"},
2901 {"r1m4", "Cave of Death"},
2902 {"r1m5", "Towers of Wrath"},
2903 {"r1m6", "Temple of Pain"},
2904 {"r1m7", "Tomb of the Overlord"},
2905 {"r2m1", "Tempus Fugit"},
2906 {"r2m2", "Elemental Fury I"},
2907 {"r2m3", "Elemental Fury II"},
2908 {"r2m4", "Curse of Osiris"},
2909 {"r2m5", "Wizard's Keep"},
2910 {"r2m6", "Blood Sacrifice"},
2911 {"r2m7", "Last Bastion"},
2912 {"r2m8", "Source of Evil"},
2913 {"ctf1", "Division of Change"}
2916 //PGM 01/07/97 added rogue episodes
2917 //PGM 03/02/97 added dmatch episode
2918 episode_t rogueepisodes[] =
2920 {"Introduction", 0, 1},
2921 {"Hell's Fortress", 1, 7},
2922 {"Corridors of Time", 8, 8},
2923 {"Deathmatch Arena", 16, 1}
2926 level_t nehahralevels[] =
2928 {"nehstart", "Welcome to Nehahra"},
2929 {"neh1m1", "Forge City1: Slipgates"},
2930 {"neh1m2", "Forge City2: Boiler"},
2931 {"neh1m3", "Forge City3: Escape"},
2932 {"neh1m4", "Grind Core"},
2933 {"neh1m5", "Industrial Silence"},
2934 {"neh1m6", "Locked-Up Anger"},
2935 {"neh1m7", "Wanderer of the Wastes"},
2936 {"neh1m8", "Artemis System Net"},
2937 {"neh1m9", "To the Death"},
2938 {"neh2m1", "The Gates of Ghoro"},
2939 {"neh2m2", "Sacred Trinity"},
2940 {"neh2m3", "Realm of the Ancients"},
2941 {"neh2m4", "Temple of the Ancients"},
2942 {"neh2m5", "Dreams Made Flesh"},
2943 {"neh2m6", "Your Last Cup of Sorrow"},
2944 {"nehsec", "Ogre's Bane"},
2945 {"nehahra", "Nehahra's Den"},
2946 {"nehend", "Quintessence"}
2949 episode_t nehahraepisodes[] =
2951 {"Welcome to Nehahra", 0, 1},
2952 {"The Fall of Forge", 1, 9},
2953 {"The Outlands", 10, 7},
2954 {"Dimension of the Lost", 17, 2}
2957 // Map list for Transfusion
2958 level_t transfusionlevels[] =
2960 {"bb1", "The Stronghold"},
2961 {"bb2", "Winter Wonderland"},
2963 {"bb4", "The Tower"},
2965 {"bb6", "Twin Fortress"},
2967 {"bb8", "Fun With Heads"},
2969 {"e1m1", "Cradle to Grave"},
2970 {"e1m2", "Wrong Side of the Tracks"},
2971 {"e1m7", "Altar of Stone"},
2972 {"e2m8", "The Lair of Shial"},
2973 {"e3m7", "The Pit of Cerberus"},
2974 {"e4m1", "Butchery Loves Company"},
2975 {"e4m7", "In the Flesh"},
2976 {"e4m8", "The Hall of the Epiphany"},
2977 {"e4m9", "Mall of the Dead"},
2979 {"dm1", "Monolith Building 11"},
2982 {"e6m1", "Welcome to Your Life"},
2983 {"e6m8", "Beauty and the Beast"},
2984 {"e6m9", "Forgotten Catacombs"},
2986 {"cpbb01", "Crypt of Despair"},
2987 {"cpbb03", "Unholy Cathedral"},
2989 {"b2a15", "Area 15 (B2)"},
2990 {"barena", "Blood Arena"},
2991 {"bkeep", "Blood Keep"},
2992 {"bstar", "Brown Star"},
2993 {"crypt", "The Crypt"},
2995 {"bb3_2k1", "Bodies Infusion"},
2996 {"captasao", "Captasao"},
2997 {"curandero", "Curandero"},
2998 {"dcamp", "DeathCamp"},
2999 {"highnoon", "HighNoon"},
3000 {"qbb1", "The Confluence"},
3001 {"qbb2", "KathartiK"},
3002 {"qbb3", "Caleb's Woodland Retreat"},
3004 {"dranzbb6", "Black Coffee"},
3005 {"fragm", "Frag'M"},
3007 {"qe1m7", "The House of Chthon"},
3008 {"qmorbias", "Dm-Morbias"},
3009 {"simple", "Dead Simple"}
3012 episode_t transfusionepisodes[] =
3015 {"Blood Single Player", 8, 9},
3016 {"Plasma Pack", 17, 6},
3017 {"Cryptic Passage", 23, 2},
3019 {"Transfusion", 30, 8},
3020 {"Conversions", 38, 6}
3023 level_t goodvsbad2levels[] =
3025 {"rts", "Many Paths"}, // 0
3026 {"chess", "Chess, Scott Hess"}, // 1
3027 {"dot", "Big Wall"},
3028 {"city2", "The Big City"},
3029 {"bwall", "0 G like Psychic TV"},
3030 {"snow", "Wireframed"},
3031 {"telep", "Infinite Falling"},
3032 {"faces", "Facing Bases"},
3033 {"island", "Adventure Islands"},
3036 episode_t goodvsbad2episodes[] =
3038 {"Levels? Bevels!", 0, 8},
3041 level_t battlemechlevels[] =
3043 {"start", "Parking Level"},
3044 {"dm1", "Hot Dump"}, // 1
3045 {"dm2", "The Pits"},
3046 {"dm3", "Dimber Died"},
3047 {"dm4", "Fire in the Hole"},
3048 {"dm5", "Clubhouses"},
3049 {"dm6", "Army go Underground"},
3052 episode_t battlemechepisodes[] =
3054 {"Time for Battle", 0, 7},
3057 level_t openquartzlevels[] =
3059 {"start", "Welcome to Openquartz"},
3061 {"void1", "The center of nowhere"}, // 1
3062 {"void2", "The place with no name"},
3063 {"void3", "The lost supply base"},
3064 {"void4", "Past the outer limits"},
3065 {"void5", "Into the nonexistance"},
3066 {"void6", "Void walk"},
3068 {"vtest", "Warp Central"},
3069 {"box", "The deathmatch box"},
3070 {"bunkers", "Void command"},
3071 {"house", "House of chaos"},
3072 {"office", "Overnight office kill"},
3073 {"am1", "The nameless chambers"},
3076 episode_t openquartzepisodes[] =
3078 {"Single Player", 0, 1},
3079 {"Void Deathmatch", 1, 6},
3083 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
3084 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
3085 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
3086 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
3087 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
3088 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
3089 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
3090 gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
3091 gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
3096 gamelevels_t *notregistered;
3097 gamelevels_t *registered;
3101 gameinfo_t gamelist[] =
3103 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3104 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3105 {GAME_ROGUE, &roguegame, &roguegame},
3106 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3107 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3108 {GAME_GOODVSBAD2, &goodvsbad2game, &goodvsbad2game},
3109 {GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
3110 {GAME_OPENQUARTZ, &openquartzgame, &openquartzgame},
3111 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3114 gamelevels_t *lookupgameinfo(void)
3117 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3118 if (registered.integer)
3119 return gamelist[i].registered;
3121 return gamelist[i].notregistered;
3127 qboolean m_serverInfoMessage = false;
3128 double m_serverInfoMessageTime;
3130 extern cvar_t sv_public;
3132 void M_Menu_GameOptions_f (void)
3134 key_dest = key_menu;
3135 m_state = m_gameoptions;
3136 m_entersound = true;
3137 if (maxplayers == 0)
3138 maxplayers = svs.maxclients;
3140 maxplayers = min(8, MAX_SCOREBOARD);
3144 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 132, 152, 160};
3145 #define NUM_GAMEOPTIONS 11
3146 int gameoptions_cursor;
3148 void M_GameOptions_Draw (void)
3154 M_Background(320, 200);
3156 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3157 p = Draw_CachePic ("gfx/p_multi.lmp");
3158 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3160 M_DrawTextBox (152, 32, 10, 1);
3161 M_Print(160, 40, "begin game");
3163 M_Print(0, 56, " Max players");
3164 M_Print(160, 56, va("%i", maxplayers) );
3166 if (gamemode != GAME_GOODVSBAD2)
3168 M_Print(0, 64, " Game Type");
3169 if (gamemode == GAME_TRANSFUSION)
3171 if (!deathmatch.integer)
3172 Cvar_SetValue("deathmatch", 1);
3173 if (deathmatch.integer == 2)
3174 M_Print(160, 64, "Capture the Flag");
3176 M_Print(160, 64, "Blood Bath");
3178 else if (gamemode == GAME_BATTLEMECH)
3180 if (!deathmatch.integer)
3181 Cvar_SetValue("deathmatch", 1);
3182 if (deathmatch.integer == 2)
3183 M_Print(160, 64, "Rambo Match");
3185 M_Print(160, 64, "Deathmatch");
3189 if (!coop.integer && !deathmatch.integer)
3190 Cvar_SetValue("deathmatch", 1);
3192 M_Print(160, 64, "Cooperative");
3194 M_Print(160, 64, "Deathmatch");
3197 M_Print(0, 72, " Teamplay");
3198 if (gamemode == GAME_ROGUE)
3202 switch((int)teamplay.integer)
3204 case 1: msg = "No Friendly Fire"; break;
3205 case 2: msg = "Friendly Fire"; break;
3206 case 3: msg = "Tag"; break;
3207 case 4: msg = "Capture the Flag"; break;
3208 case 5: msg = "One Flag CTF"; break;
3209 case 6: msg = "Three Team CTF"; break;
3210 default: msg = "Off"; break;
3212 M_Print(160, 72, msg);
3218 switch (teamplay.integer)
3220 case 0: msg = "Off"; break;
3221 case 2: msg = "Friendly Fire"; break;
3222 default: msg = "No Friendly Fire"; break;
3224 M_Print(160, 72, msg);
3227 M_Print(0, 80, " Skill");
3228 if (skill.integer == 0)
3229 M_Print(160, 80, "Easy difficulty");
3230 else if (skill.integer == 1)
3231 M_Print(160, 80, "Normal difficulty");
3232 else if (skill.integer == 2)
3233 M_Print(160, 80, "Hard difficulty");
3235 M_Print(160, 80, "Nightmare difficulty");
3237 M_Print(0, 88, " Frag Limit");
3238 if (fraglimit.integer == 0)
3239 M_Print(160, 88, "none");
3241 M_Print(160, 88, va("%i frags", fraglimit.integer));
3243 M_Print(0, 96, " Time Limit");
3244 if (timelimit.integer == 0)
3245 M_Print(160, 96, "none");
3247 M_Print(160, 96, va("%i minutes", timelimit.integer));
3250 M_Print(0, 104, " Public server");
3251 M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes");
3253 M_Print(0, 120, " Server name");
3254 M_DrawTextBox (0, 124, 38, 1);
3255 M_Print(8, 132, hostname.string);
3257 g = lookupgameinfo();
3259 if (gamemode != GAME_GOODVSBAD2)
3261 M_Print(0, 152, " Episode");
3262 M_Print(160, 152, g->episodes[startepisode].description);
3265 M_Print(0, 160, " Level");
3266 M_Print(160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3267 M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3270 if (gameoptions_cursor == 8)
3271 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3273 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3275 if (m_serverInfoMessage)
3277 if ((realtime - m_serverInfoMessageTime) < 5.0)
3280 M_DrawTextBox (x, 138, 24, 4);
3282 M_Print(x, 146, " More than 64 players?? ");
3283 M_Print(x, 154, " First, question your ");
3284 M_Print(x, 162, " sanity, then email ");
3285 M_Print(x, 170, " havoc@telefragged.com ");
3288 m_serverInfoMessage = false;
3293 void M_NetStart_Change (int dir)
3298 switch (gameoptions_cursor)
3302 if (maxplayers > MAX_SCOREBOARD)
3304 maxplayers = MAX_SCOREBOARD;
3305 m_serverInfoMessage = true;
3306 m_serverInfoMessageTime = realtime;
3313 if (gamemode == GAME_GOODVSBAD2)
3315 if (gamemode == GAME_TRANSFUSION)
3317 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3318 Cvar_SetValueQuick (&deathmatch, 0);
3319 else // changing from BloodBath to CTF
3320 Cvar_SetValueQuick (&deathmatch, 2);
3322 else if (gamemode == GAME_BATTLEMECH)
3324 if (deathmatch.integer == 2) // changing from Rambo to Deathmatch
3325 Cvar_SetValueQuick (&deathmatch, 0);
3326 else // changing from Deathmatch to Rambo
3327 Cvar_SetValueQuick (&deathmatch, 2);
3331 if (deathmatch.integer) // changing from deathmatch to coop
3333 Cvar_SetValueQuick (&coop, 1);
3334 Cvar_SetValueQuick (&deathmatch, 0);
3336 else // changing from coop to deathmatch
3338 Cvar_SetValueQuick (&coop, 0);
3339 Cvar_SetValueQuick (&deathmatch, 1);
3345 if (gamemode == GAME_GOODVSBAD2)
3347 if (gamemode == GAME_ROGUE)
3352 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3353 if (teamplay.integer > count)
3354 Cvar_SetValueQuick (&teamplay, 0);
3355 else if (teamplay.integer < 0)
3356 Cvar_SetValueQuick (&teamplay, count);
3360 if (gamemode == GAME_GOODVSBAD2)
3362 Cvar_SetValueQuick (&skill, skill.integer + dir);
3363 if (skill.integer > 3)
3364 Cvar_SetValueQuick (&skill, 0);
3365 if (skill.integer < 0)
3366 Cvar_SetValueQuick (&skill, 3);
3370 if (gamemode == GAME_GOODVSBAD2)
3372 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3373 if (fraglimit.integer > 100)
3374 Cvar_SetValueQuick (&fraglimit, 0);
3375 if (fraglimit.integer < 0)
3376 Cvar_SetValueQuick (&fraglimit, 100);
3380 if (gamemode == GAME_GOODVSBAD2)
3382 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3383 if (timelimit.value > 60)
3384 Cvar_SetValueQuick (&timelimit, 0);
3385 if (timelimit.value < 0)
3386 Cvar_SetValueQuick (&timelimit, 60);
3390 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3397 if (gamemode == GAME_GOODVSBAD2)
3399 startepisode += dir;
3400 g = lookupgameinfo();
3402 if (startepisode < 0)
3403 startepisode = g->numepisodes - 1;
3405 if (startepisode >= g->numepisodes)
3413 g = lookupgameinfo();
3416 startlevel = g->episodes[startepisode].levels - 1;
3418 if (startlevel >= g->episodes[startepisode].levels)
3424 void M_GameOptions_Key (int key, char ascii)
3428 char hostnamebuf[128];
3433 M_Menu_MultiPlayer_f ();
3437 S_LocalSound ("misc/menu1.wav", true);
3438 gameoptions_cursor--;
3439 if (gameoptions_cursor < 0)
3440 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3444 S_LocalSound ("misc/menu1.wav", true);
3445 gameoptions_cursor++;
3446 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3447 gameoptions_cursor = 0;
3451 if (gameoptions_cursor == 0)
3453 S_LocalSound ("misc/menu3.wav", true);
3454 M_NetStart_Change (-1);
3458 if (gameoptions_cursor == 0)
3460 S_LocalSound ("misc/menu3.wav", true);
3461 M_NetStart_Change (1);
3465 S_LocalSound ("misc/menu2.wav", true);
3466 if (gameoptions_cursor == 0)
3469 Cbuf_AddText ("disconnect\n");
3470 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3472 g = lookupgameinfo();
3473 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3477 M_NetStart_Change (1);
3481 if (gameoptions_cursor == 8)
3483 l = strlen(hostname.string);
3487 memcpy(hostnamebuf, hostname.string, l);
3489 Cvar_Set("hostname", hostnamebuf);
3495 if (ascii < 32 || ascii > 126)
3497 if (gameoptions_cursor == 8)
3499 l = strlen(hostname.string);
3502 memcpy(hostnamebuf, hostname.string, l);
3503 hostnamebuf[l] = ascii;
3504 hostnamebuf[l+1] = 0;
3505 Cvar_Set("hostname", hostnamebuf);
3511 //=============================================================================
3516 void M_Menu_ServerList_f (void)
3518 key_dest = key_menu;
3520 m_entersound = true;
3522 m_return_reason[0] = 0;
3527 void M_ServerList_Draw (void)
3529 int n, y, visible, start, end;
3533 // use as much vertical space as available
3534 M_Background(640, vid.conheight);
3535 // scroll the list as the cursor moves
3536 s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount);
3537 M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
3538 if (*m_return_reason)
3539 M_Print(16, vid.conheight - 8, m_return_reason);
3541 visible = (vid.conheight - 16 - y) / 8;
3542 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3543 end = min(start + visible, hostCacheCount);
3545 p = Draw_CachePic("gfx/p_multi.lmp");
3546 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3549 for (n = start;n < end;n++)
3551 DrawQ_Fill(menu_x, menu_y + y, 640, 16, n == slist_cursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
3552 M_Print(0, y, hostcache[n].line1);y += 8;
3553 M_Print(0, y, hostcache[n].line2);y += 8;
3556 else if (realtime - masterquerytime < 3)
3558 if (masterquerycount)
3559 M_Print(0, y, "No servers found");
3561 M_Print(0, y, "No master servers found (network problem?)");
3566 void M_ServerList_Key(int k, char ascii)
3571 M_Menu_LanConfig_f();
3580 S_LocalSound("misc/menu1.wav", true);
3582 if (slist_cursor < 0)
3583 slist_cursor = hostCacheCount - 1;
3588 S_LocalSound("misc/menu1.wav", true);
3590 if (slist_cursor >= hostCacheCount)
3595 S_LocalSound("misc/menu2.wav", true);
3596 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3605 //=============================================================================
3606 /* Menu Subsystem */
3608 void M_Keydown(int key, char ascii);
3610 void M_ToggleMenu_f(void);
3611 void M_Shutdown(void);
3615 menu_mempool = Mem_AllocPool("Menu");
3616 menuplyr_load = true;
3617 menuplyr_pixels = NULL;
3619 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3620 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3621 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3622 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3623 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3624 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3625 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3626 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3627 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3628 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3629 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3630 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3631 Cmd_AddCommand ("help", M_Menu_Help_f);
3632 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3634 if (gamemode == GAME_TRANSFUSION)
3636 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3637 bindnames = transfusionbindnames;
3639 else if (gamemode == GAME_GOODVSBAD2)
3641 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3642 bindnames = goodvsbad2bindnames;
3646 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3647 bindnames = quakebindnames;
3650 // Make sure "keys_cursor" doesn't start on a section in the binding list
3652 while (bindnames[keys_cursor][0][0] == '\0')
3656 // Only sections? There may be a problem somewhere...
3657 if (keys_cursor >= numcommands)
3658 Sys_Error ("M_Init: The key binding list only contains sections");
3662 if (gamemode == GAME_NEHAHRA)
3664 if (FS_FileExists("maps/neh1m4.bsp"))
3666 if (FS_FileExists("hearing.dem"))
3668 Con_Print("Nehahra movie and game detected.\n");
3669 NehGameType = TYPE_BOTH;
3673 Con_Print("Nehahra game detected.\n");
3674 NehGameType = TYPE_GAME;
3679 if (FS_FileExists("hearing.dem"))
3681 Con_Print("Nehahra movie detected.\n");
3682 NehGameType = TYPE_DEMO;
3686 Con_Print("Nehahra not found.\n");
3687 NehGameType = TYPE_GAME; // could just complain, but...
3695 if (key_dest != key_menu)
3698 if (m_state == m_none)
3714 case m_singleplayer:
3715 M_SinglePlayer_Draw ();
3727 M_MultiPlayer_Draw ();
3738 case m_options_effects:
3739 M_Options_Effects_Draw ();
3742 case m_options_colorcontrol:
3743 M_Options_ColorControl_Draw ();
3763 M_LanConfig_Draw ();
3767 M_GameOptions_Draw ();
3771 M_ServerList_Draw ();
3777 S_LocalSound ("misc/menu2.wav", true);
3778 m_entersound = false;
3785 void M_Keydown (int key, char ascii)
3793 M_Main_Key (key, ascii);
3797 M_Demo_Key (key, ascii);
3800 case m_singleplayer:
3801 M_SinglePlayer_Key (key, ascii);
3805 M_Load_Key (key, ascii);
3809 M_Save_Key (key, ascii);
3813 M_MultiPlayer_Key (key, ascii);
3817 M_Setup_Key (key, ascii);
3821 M_Options_Key (key, ascii);
3824 case m_options_effects:
3825 M_Options_Effects_Key (key, ascii);
3828 case m_options_colorcontrol:
3829 M_Options_ColorControl_Key (key, ascii);
3833 M_Keys_Key (key, ascii);
3837 M_Video_Key (key, ascii);
3841 M_Help_Key (key, ascii);
3845 M_Quit_Key (key, ascii);
3849 M_LanConfig_Key (key, ascii);
3853 M_GameOptions_Key (key, ascii);
3857 M_ServerList_Key (key, ascii);
3862 void M_Shutdown(void)
3865 key_dest = key_game;
3868 void M_Restart(void)
3872 //============================================================================
3873 // Menu prog handling
3874 mfunction_t *PRVM_ED_FindFunction(const char *);
3876 #define M_F_INIT "m_init"
3877 #define M_F_KEYDOWN "m_keydown"
3878 #define M_F_DRAW "m_draw"
3879 // ng_menu function names
3880 #define M_F_DISPLAY "m_display"
3881 #define M_F_HIDE "m_hide"
3882 // normal menu names (rest)
3883 #define M_F_TOGGLE "m_toggle"
3884 #define M_F_SHUTDOWN "m_shutdown"
3886 static char *m_required_func[] = {
3900 qboolean m_displayed;
3903 static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
3905 static func_t m_draw, m_keydown;
3907 void MR_SetRouting (qboolean forceold);
3911 // fall back to the normal menu
3914 Con_Print("Falling back to normal menu\n");
3916 key_dest = key_game;
3920 // init the normal menu now -> this will also correct the menu router pointers
3921 MR_SetRouting (TRUE);
3924 void MP_Keydown (int key, char ascii)
3927 PRVM_SetProg(PRVM_MENUPROG);
3930 *prog->time = realtime;
3933 prog->globals[OFS_PARM0] = (float) key;
3934 prog->globals[OFS_PARM1] = (float) ascii;
3935 PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
3943 PRVM_SetProg(PRVM_MENUPROG);
3946 *prog->time = realtime;
3948 PRVM_ExecuteProgram(m_draw,"");
3953 void MP_ToggleMenu_f (void)
3956 PRVM_SetProg(PRVM_MENUPROG);
3959 *prog->time = realtime;
3962 m_displayed = !m_displayed;
3964 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_DISPLAY) - prog->functions),"");
3966 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_HIDE) - prog->functions),"");
3968 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_TOGGLE) - prog->functions),"");
3974 void MP_Shutdown (void)
3977 PRVM_SetProg(PRVM_MENUPROG);
3980 *prog->time = realtime;
3982 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_SHUTDOWN) - prog->functions),"");
3985 key_dest = key_game;
3987 // AK not using this cause Im not sure whether this is useful at all instead :
3996 PRVM_InitProg(PRVM_MENUPROG);
3998 prog->crc = M_PROGHEADER_CRC;
3999 prog->edictprivate_size = 0; // no private struct used
4000 prog->name = M_NAME;
4001 prog->limit_edicts = M_MAX_EDICTS;
4002 prog->extensionstring = vm_m_extensions;
4003 prog->builtins = vm_m_builtins;
4004 prog->numbuiltins = vm_m_numbuiltins;
4005 prog->init_cmd = VM_M_Cmd_Init;
4006 prog->reset_cmd = VM_M_Cmd_Reset;
4007 prog->error_cmd = MP_Error;
4009 // allocate the mempools
4010 prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool");
4011 prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool");
4012 prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME);
4014 PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func);
4016 // set m_draw and m_keydown
4017 m_draw = (func_t) (PRVM_ED_FindFunction(M_F_DRAW) - prog->functions);
4018 m_keydown = (func_t) (PRVM_ED_FindFunction(M_F_KEYDOWN) - prog->functions);
4021 m_displayed = false;
4025 *prog->time = realtime;
4027 // call the prog init
4028 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_INIT) - prog->functions),"");
4033 void MP_Restart(void)
4039 //============================================================================
4042 static cvar_t forceqmenu = { 0, "forceqmenu", "0" };
4044 void MR_SetRouting(qboolean forceold)
4046 static qboolean m_init = FALSE, mp_init = FALSE;
4048 // if the menu prog isnt available or forceqmenu ist set, use the old menu
4049 if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold)
4051 // set menu router function pointers
4052 MR_Keydown = M_Keydown;
4054 MR_ToggleMenu_f = M_ToggleMenu_f;
4055 MR_Shutdown = M_Shutdown;
4068 // set menu router function pointers
4069 MR_Keydown = MP_Keydown;
4071 MR_ToggleMenu_f = MP_ToggleMenu_f;
4072 MR_Shutdown = MP_Shutdown;
4084 void MR_Restart(void)
4087 MR_SetRouting (FALSE);
4090 void Call_MR_ToggleMenu_f(void)
4098 // set router console commands
4099 Cvar_RegisterVariable (&forceqmenu);
4100 Cmd_AddCommand ("menu_restart",MR_Restart);
4101 Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f);
4103 // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
4104 if(COM_CheckParm("-forceqmenu"))
4105 Cvar_SetValueQuick(&forceqmenu,1);
4106 // use -useqmenu for debugging proposes, cause it starts
4107 // the normal quake menu only the first time
4108 else if(COM_CheckParm("-useqmenu"))
4109 MR_SetRouting (TRUE);
4111 MR_SetRouting (FALSE);