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_Graphics_f (void);
44 void M_Menu_Options_ColorControl_f (void);
45 void M_Menu_Keys_f (void);
46 void M_Menu_Video_f (void);
47 void M_Menu_Help_f (void);
48 void M_Menu_Quit_f (void);
49 void M_Menu_LanConfig_f (void);
50 void M_Menu_GameOptions_f (void);
51 void M_Menu_ServerList_f (void);
53 void M_Main_Draw (void);
54 void M_SinglePlayer_Draw (void);
55 void M_Load_Draw (void);
56 void M_Save_Draw (void);
57 void M_MultiPlayer_Draw (void);
58 void M_Setup_Draw (void);
59 void M_Options_Draw (void);
60 void M_Options_Effects_Draw (void);
61 void M_Options_Graphics_Draw (void);
62 void M_Options_ColorControl_Draw (void);
63 void M_Keys_Draw (void);
64 void M_Video_Draw (void);
65 void M_Help_Draw (void);
66 void M_Quit_Draw (void);
67 void M_LanConfig_Draw (void);
68 void M_GameOptions_Draw (void);
69 void M_ServerList_Draw (void);
71 void M_Main_Key (int key, char ascii);
72 void M_SinglePlayer_Key (int key, char ascii);
73 void M_Load_Key (int key, char ascii);
74 void M_Save_Key (int key, char ascii);
75 void M_MultiPlayer_Key (int key, char ascii);
76 void M_Setup_Key (int key, char ascii);
77 void M_Options_Key (int key, char ascii);
78 void M_Options_Effects_Key (int key, char ascii);
79 void M_Options_Graphics_Key (int key, char ascii);
80 void M_Options_ColorControl_Key (int key, char ascii);
81 void M_Keys_Key (int key, char ascii);
82 void M_Video_Key (int key, char ascii);
83 void M_Help_Key (int key, char ascii);
84 void M_Quit_Key (int key, char ascii);
85 void M_LanConfig_Key (int key, char ascii);
86 void M_GameOptions_Key (int key, char ascii);
87 void M_ServerList_Key (int key, char ascii);
89 qboolean m_entersound; // play after drawing a frame, so caching
90 // won't disrupt the sound
92 char m_return_reason [32];
94 #define StartingGame (m_multiplayer_cursor == 1)
95 #define JoiningGame (m_multiplayer_cursor == 0)
98 #define NumberOfNehahraDemos 34
103 } nehahrademonames_t;
105 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
107 {"intro", "Prologue"},
108 {"genf", "The Beginning"},
109 {"genlab", "A Doomed Project"},
110 {"nehcre", "The New Recruits"},
111 {"maxneh", "Breakthrough"},
112 {"maxchar", "Renewal and Duty"},
113 {"crisis", "Worlds Collide"},
114 {"postcris", "Darkening Skies"},
115 {"hearing", "The Hearing"},
116 {"getjack", "On a Mexican Radio"},
117 {"prelude", "Honor and Justice"},
118 {"abase", "A Message Sent"},
119 {"effect", "The Other Side"},
120 {"uhoh", "Missing in Action"},
121 {"prepare", "The Response"},
122 {"vision", "Farsighted Eyes"},
123 {"maxturns", "Enter the Immortal"},
124 {"backlot", "Separate Ways"},
125 {"maxside", "The Ancient Runes"},
126 {"counter", "The New Initiative"},
127 {"warprep", "Ghosts to the World"},
128 {"counter1", "A Fate Worse Than Death"},
129 {"counter2", "Friendly Fire"},
130 {"counter3", "Minor Setback"},
131 {"madmax", "Scores to Settle"},
132 {"quake", "One Man"},
133 {"cthmm", "Shattered Masks"},
134 {"shades", "Deal with the Dead"},
135 {"gophil", "An Unlikely Hero"},
136 {"cstrike", "War in Hell"},
137 {"shubset", "The Conspiracy"},
138 {"shubdie", "Even Death May Die"},
139 {"newranks", "An Empty Throne"},
140 {"seal", "The Seal is Broken"}
143 float menu_x, menu_y, menu_width, menu_height;
145 void M_Background(int width, int height)
148 menu_height = height;
149 menu_x = (vid.conwidth - menu_width) * 0.5;
150 menu_y = (vid.conheight - menu_height) * 0.5;
151 //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
152 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
159 Draws one solid graphics character
162 void M_DrawCharacter (float cx, float cy, int num)
167 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
170 void M_Print(float cx, float cy, const char *str)
172 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
175 void M_PrintRed (float cx, float cy, const char *str)
177 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
180 void M_ItemPrint(float cx, float cy, char *str, int unghosted)
183 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
185 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
188 void M_DrawPic (float cx, float cy, char *picname)
190 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
193 qbyte identityTable[256];
194 qbyte translationTable[256];
196 void M_BuildTranslationTable(int top, int bottom)
199 qbyte *dest, *source;
201 for (j = 0; j < 256; j++)
202 identityTable[j] = j;
203 dest = translationTable;
204 source = identityTable;
205 memcpy (dest, source, 256);
207 // LordHavoc: corrected skin color ranges
208 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
209 memcpy (dest + TOP_RANGE, source + top, 16);
211 for (j=0 ; j<16 ; j++)
212 dest[TOP_RANGE+j] = source[top+15-j];
214 // LordHavoc: corrected skin color ranges
215 if (bottom < 128 || (bottom >= 224 && bottom < 240))
216 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
218 for (j=0 ; j<16 ; j++)
219 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
223 void M_DrawTextBox (float x, float y, float width, float height)
231 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
232 for (n = 0; n < height; n++)
235 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
237 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
244 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
245 for (n = 0; n < height; n++)
249 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
251 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
253 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
260 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
261 for (n = 0; n < height; n++)
264 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
266 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
269 //=============================================================================
271 //int m_save_demonum;
278 void M_ToggleMenu_f (void)
282 if (key_dest != key_menu || m_state != m_main)
293 void M_Demo_Draw (void)
297 M_Background(320, 200);
299 for (i = 0;i < NumberOfNehahraDemos;i++)
300 M_Print(16, 16 + 8*i, NehahraDemos[i].desc);
303 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
307 void M_Menu_Demos_f (void)
314 void M_Demo_Key (int k, char ascii)
323 S_LocalSound ("misc/menu2.wav", true);
326 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
331 S_LocalSound ("misc/menu1.wav", true);
334 demo_cursor = NumberOfNehahraDemos-1;
339 S_LocalSound ("misc/menu1.wav", true);
341 if (demo_cursor >= NumberOfNehahraDemos)
347 //=============================================================================
352 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
354 void M_Menu_Main_f (void)
356 if (gamemode == GAME_NEHAHRA)
358 if (NehGameType == TYPE_DEMO)
360 else if (NehGameType == TYPE_GAME)
365 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
371 if (key_dest != key_menu)
373 m_save_demonum = cls.demonum;
383 void M_Main_Draw (void)
388 M_Background(320, 200);
390 M_DrawPic (16, 4, "gfx/qplaque.lmp");
391 p = Draw_CachePic ("gfx/ttl_main.lmp");
392 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
394 if (gamemode == GAME_NEHAHRA)
396 if (NehGameType == TYPE_BOTH)
397 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
398 else if (NehGameType == TYPE_GAME)
399 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
401 M_DrawPic (72, 32, "gfx/demomenu.lmp");
404 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
406 f = (int)(realtime * 10)%6;
408 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
412 void M_Main_Key (int key, char ascii)
419 //cls.demonum = m_save_demonum;
420 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
425 S_LocalSound ("misc/menu1.wav", true);
426 if (++m_main_cursor >= MAIN_ITEMS)
431 S_LocalSound ("misc/menu1.wav", true);
432 if (--m_main_cursor < 0)
433 m_main_cursor = MAIN_ITEMS - 1;
439 if (gamemode == GAME_NEHAHRA)
444 switch (m_main_cursor)
447 M_Menu_SinglePlayer_f ();
455 M_Menu_MultiPlayer_f ();
465 Cbuf_AddText ("disconnect\n");
466 Cbuf_AddText ("playdemo endcred\n");
475 switch (m_main_cursor)
478 M_Menu_SinglePlayer_f ();
482 M_Menu_MultiPlayer_f ();
492 Cbuf_AddText ("disconnect\n");
493 Cbuf_AddText ("playdemo endcred\n");
502 switch (m_main_cursor)
511 Cbuf_AddText ("disconnect\n");
512 Cbuf_AddText ("playdemo endcred\n");
526 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
528 switch (m_main_cursor)
531 M_Menu_SinglePlayer_f ();
535 M_Menu_MultiPlayer_f ();
556 switch (m_main_cursor)
559 M_Menu_SinglePlayer_f ();
563 M_Menu_MultiPlayer_f ();
582 //=============================================================================
583 /* SINGLE PLAYER MENU */
585 int m_singleplayer_cursor;
586 #define SINGLEPLAYER_ITEMS 3
589 void M_Menu_SinglePlayer_f (void)
592 m_state = m_singleplayer;
597 void M_SinglePlayer_Draw (void)
601 M_Background(320, 200);
603 M_DrawPic (16, 4, "gfx/qplaque.lmp");
604 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
606 // Transfusion doesn't have a single player mode
607 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
609 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
611 M_DrawTextBox (60, 8 * 8, 23, 4);
612 if (gamemode == GAME_NEXUIZ)
613 M_Print(95, 10 * 8, "Nexuiz is for");
614 else if (gamemode == GAME_GOODVSBAD2)
615 M_Print(95, 10 * 8, "Good Vs Bad 2 is for");
616 else if (gamemode == GAME_BATTLEMECH)
617 M_Print(95, 10 * 8, "Battlemech is for");
619 M_Print(95, 10 * 8, "Transfusion is for");
620 M_Print(83, 11 * 8, "multiplayer play only");
626 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
627 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
629 f = (int)(realtime * 10)%6;
631 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
636 void M_SinglePlayer_Key (int key, char ascii)
638 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
640 if (key == K_ESCAPE || key == K_ENTER)
652 S_LocalSound ("misc/menu1.wav", true);
653 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
654 m_singleplayer_cursor = 0;
658 S_LocalSound ("misc/menu1.wav", true);
659 if (--m_singleplayer_cursor < 0)
660 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
666 switch (m_singleplayer_cursor)
671 Cbuf_AddText ("disconnect\n");
672 Cbuf_AddText ("maxplayers 1\n");
673 Cbuf_AddText ("deathmatch 0\n");
674 Cbuf_AddText ("coop 0\n");
675 if (gamemode == GAME_NEHAHRA)
676 Cbuf_AddText ("map nehstart\n");
678 Cbuf_AddText ("map start\n");
692 //=============================================================================
695 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
697 #define MAX_SAVEGAMES 12
698 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
699 int loadable[MAX_SAVEGAMES];
701 void M_ScanSaves (void)
704 char name[MAX_OSPATH];
709 for (i=0 ; i<MAX_SAVEGAMES ; i++)
711 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
713 sprintf (name, "s%i.sav", i);
714 f = FS_Open (name, "r", false);
717 str = FS_Getline (f);
718 sscanf (str, "%i\n", &version);
719 str = FS_Getline (f);
720 strlcpy (m_filenames[i], str, sizeof (m_filenames[i]));
722 // change _ back to space
723 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
724 if (m_filenames[i][j] == '_')
725 m_filenames[i][j] = ' ';
731 void M_Menu_Load_f (void)
740 void M_Menu_Save_f (void)
755 void M_Load_Draw (void)
760 M_Background(320, 200);
762 p = Draw_CachePic ("gfx/p_load.lmp");
763 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
765 for (i=0 ; i< MAX_SAVEGAMES; i++)
766 M_Print(16, 32 + 8*i, m_filenames[i]);
769 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
773 void M_Save_Draw (void)
778 M_Background(320, 200);
780 p = Draw_CachePic ("gfx/p_save.lmp");
781 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
783 for (i=0 ; i<MAX_SAVEGAMES ; i++)
784 M_Print(16, 32 + 8*i, m_filenames[i]);
787 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
791 void M_Load_Key (int k, char ascii)
796 M_Menu_SinglePlayer_f ();
800 S_LocalSound ("misc/menu2.wav", true);
801 if (!loadable[load_cursor])
806 // issue the load command
807 Cbuf_AddText (va ("load 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)
829 void M_Save_Key (int k, char ascii)
834 M_Menu_SinglePlayer_f ();
840 Cbuf_AddText (va("save s%i\n", load_cursor));
845 S_LocalSound ("misc/menu1.wav", true);
848 load_cursor = MAX_SAVEGAMES-1;
853 S_LocalSound ("misc/menu1.wav", true);
855 if (load_cursor >= MAX_SAVEGAMES)
861 //=============================================================================
862 /* MULTIPLAYER MENU */
864 int m_multiplayer_cursor;
865 #define MULTIPLAYER_ITEMS 3
868 void M_Menu_MultiPlayer_f (void)
871 m_state = m_multiplayer;
876 void M_MultiPlayer_Draw (void)
881 M_Background(320, 200);
883 M_DrawPic (16, 4, "gfx/qplaque.lmp");
884 p = Draw_CachePic ("gfx/p_multi.lmp");
885 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
886 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
888 f = (int)(realtime * 10)%6;
890 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
894 void M_MultiPlayer_Key (int key, char ascii)
903 S_LocalSound ("misc/menu1.wav", true);
904 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
905 m_multiplayer_cursor = 0;
909 S_LocalSound ("misc/menu1.wav", true);
910 if (--m_multiplayer_cursor < 0)
911 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
916 switch (m_multiplayer_cursor)
920 M_Menu_LanConfig_f ();
930 //=============================================================================
933 int setup_cursor = 4;
934 int setup_cursor_table[] = {40, 64, 88, 124, 140};
936 char setup_myname[32];
944 #define NUM_SETUP_CMDS 5
946 void M_Menu_Setup_f (void)
951 strcpy(setup_myname, cl_name.string);
952 setup_top = setup_oldtop = cl_color.integer >> 4;
953 setup_bottom = setup_oldbottom = cl_color.integer & 15;
954 setup_rate = cl_rate.integer;
957 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
958 static qbyte *menuplyr_pixels;
959 static unsigned int *menuplyr_translated;
961 typedef struct ratetable_s
968 #define RATES ((int)(sizeof(setup_ratetable)/sizeof(setup_ratetable[0])))
969 static ratetable_t setup_ratetable[] =
972 {1500, "28.8 mediocre"},
974 {2500, "33.6 mediocre"},
977 {4000, "56k mediocre"},
978 {4500, "56k adequate"},
981 {15000, "128k ISDN"},
985 static int setup_rateindex(int rate)
988 for (i = 0;i < RATES;i++)
989 if (setup_ratetable[i].rate > setup_rate)
991 return bound(1, i, RATES) - 1;
994 void M_Setup_Draw (void)
999 M_Background(320, 200);
1001 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1002 p = Draw_CachePic ("gfx/p_multi.lmp");
1003 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1005 M_Print(64, 40, "Your name");
1006 M_DrawTextBox (160, 32, 16, 1);
1007 M_Print(168, 40, setup_myname);
1009 if (gamemode != GAME_GOODVSBAD2)
1011 M_Print(64, 64, "Shirt color");
1012 M_Print(64, 88, "Pants color");
1015 M_Print(64, 124-8, "Network speed limit");
1016 M_Print(168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name));
1018 M_DrawTextBox (64, 140-8, 14, 1);
1019 M_Print(72, 140, "Accept Changes");
1021 // LordHavoc: rewrote this code greatly
1025 menuplyr_load = false;
1027 menuplyr_bottom = -1;
1028 if ((f = FS_LoadFile("gfx/menuplyr.lmp", tempmempool, true)))
1030 data = LoadLMPAs8Bit (f, 0, 0);
1031 menuplyr_width = image_width;
1032 menuplyr_height = image_height;
1034 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
1035 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
1036 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
1041 if (menuplyr_pixels)
1043 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
1045 menuplyr_top = setup_top;
1046 menuplyr_bottom = setup_bottom;
1047 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
1048 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
1049 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
1050 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
1052 M_DrawPic(160, 48, "gfx/bigbox.lmp");
1053 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
1056 if (setup_cursor == 0)
1057 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1059 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1063 void M_Setup_Key (int k, char ascii)
1070 M_Menu_MultiPlayer_f ();
1074 S_LocalSound ("misc/menu1.wav", true);
1076 if (setup_cursor < 0)
1077 setup_cursor = NUM_SETUP_CMDS-1;
1081 S_LocalSound ("misc/menu1.wav", true);
1083 if (setup_cursor >= NUM_SETUP_CMDS)
1088 if (setup_cursor < 1)
1090 S_LocalSound ("misc/menu3.wav", true);
1091 if (setup_cursor == 1)
1092 setup_top = setup_top - 1;
1093 if (setup_cursor == 2)
1094 setup_bottom = setup_bottom - 1;
1095 if (setup_cursor == 3)
1097 l = setup_rateindex(setup_rate) - 1;
1100 setup_rate = setup_ratetable[l].rate;
1104 if (setup_cursor < 1)
1107 S_LocalSound ("misc/menu3.wav", true);
1108 if (setup_cursor == 1)
1109 setup_top = setup_top + 1;
1110 if (setup_cursor == 2)
1111 setup_bottom = setup_bottom + 1;
1112 if (setup_cursor == 3)
1114 l = setup_rateindex(setup_rate) + 1;
1117 setup_rate = setup_ratetable[l].rate;
1122 if (setup_cursor == 0)
1125 if (setup_cursor == 1 || setup_cursor == 2 || setup_cursor == 3)
1128 // setup_cursor == 4 (Accept changes)
1129 if (strcmp(cl_name.string, setup_myname) != 0)
1130 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1131 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1132 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1133 if (setup_rate != setup_oldrate)
1134 Cbuf_AddText(va("rate %i\n", setup_rate));
1136 m_entersound = true;
1137 M_Menu_MultiPlayer_f ();
1141 if (setup_cursor == 0)
1143 if (strlen(setup_myname))
1144 setup_myname[strlen(setup_myname)-1] = 0;
1149 if (ascii < 32 || ascii > 126)
1151 if (setup_cursor == 0)
1153 l = strlen(setup_myname);
1156 setup_myname[l+1] = 0;
1157 setup_myname[l] = ascii;
1166 if (setup_bottom > 15)
1168 if (setup_bottom < 0)
1172 //=============================================================================
1175 #define SLIDER_RANGE 10
1177 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1182 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1183 M_DrawCharacter (x-8, y, 128);
1184 for (i = 0;i < SLIDER_RANGE;i++)
1185 M_DrawCharacter (x + i*8, y, 129);
1186 M_DrawCharacter (x+i*8, y, 130);
1187 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1188 if (fabs((int)num - num) < 0.01)
1189 sprintf(text, "%i", (int)num);
1191 sprintf(text, "%.2f", num);
1192 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1195 void M_DrawCheckbox (int x, int y, int on)
1198 M_Print(x, y, "on");
1200 M_Print(x, y, "off");
1204 #define OPTIONS_ITEMS 38
1208 void M_Menu_Options_f (void)
1210 key_dest = key_menu;
1211 m_state = m_options;
1212 m_entersound = true;
1215 extern cvar_t snd_staticvolume;
1216 extern cvar_t slowmo;
1217 extern dllhandle_t jpeg_dll;
1218 extern cvar_t gl_texture_anisotropy;
1219 extern cvar_t r_textshadow;
1221 void M_Menu_Options_AdjustSliders (int dir)
1224 S_LocalSound ("misc/menu3.wav", true);
1227 if (options_cursor == optnum++)
1228 Cvar_SetValueQuick (&vid_conwidth, bound(320, vid_conwidth.value + dir * 64, 2048));
1229 else if (options_cursor == optnum++)
1230 Cvar_SetValueQuick (&vid_conheight, bound(240, vid_conheight.value + dir * 48, 1536));
1231 else if (options_cursor == optnum++)
1232 Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
1233 else if (options_cursor == optnum++)
1234 Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
1235 else if (options_cursor == optnum++)
1236 Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1));
1237 else if (options_cursor == optnum++)
1238 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1239 else if (options_cursor == optnum++)
1240 Cvar_SetValueQuick (&scr_fov, bound(1, scr_fov.integer + dir * 1, 170));
1241 else if (options_cursor == optnum++)
1242 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1243 else if (options_cursor == optnum++)
1244 Cvar_SetValueQuick (&scr_screenshot_jpeg_quality, bound(0, scr_screenshot_jpeg_quality.value + dir * 0.1, 1));
1245 else if (options_cursor == optnum++)
1246 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1247 else if (options_cursor == optnum++)
1248 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1249 else if (options_cursor == optnum++)
1250 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1251 else if (options_cursor == optnum++)
1252 Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy));
1253 else if (options_cursor == optnum++)
1254 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1255 else if (options_cursor == optnum++)
1256 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1257 else if (options_cursor == optnum++)
1258 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1259 else if (options_cursor == optnum++)
1260 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1261 else if (options_cursor == optnum++)
1262 Cvar_SetValueQuick (&r_textshadow, !r_textshadow.integer);
1263 else if (options_cursor == optnum++)
1264 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1265 else if (options_cursor == optnum++)
1266 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1267 else if (options_cursor == optnum++)
1268 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1269 else if (options_cursor == optnum++)
1270 Cvar_SetValueQuick (&showfps, !showfps.integer);
1271 else if (options_cursor == optnum++)
1272 Cvar_SetValueQuick (&showtime, !showtime.integer);
1273 else if (options_cursor == optnum++)
1274 Cvar_SetValueQuick (&showdate, !showdate.integer);
1275 else if (options_cursor == optnum++)
1277 if (cl_forwardspeed.value > 200)
1279 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1280 Cvar_SetValueQuick (&cl_backspeed, 200);
1284 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1285 Cvar_SetValueQuick (&cl_backspeed, 400);
1288 else if (options_cursor == optnum++)
1289 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1290 else if (options_cursor == optnum++)
1291 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1292 else if (options_cursor == optnum++)
1293 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1294 else if (options_cursor == optnum++)
1295 Cvar_SetValueQuick (&freelook, !freelook.integer);
1296 else if (options_cursor == optnum++)
1297 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1298 else if (options_cursor == optnum++)
1299 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1306 void M_Options_PrintCommand(char *s, int enabled)
1310 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);
1311 M_ItemPrint(0, opty, s, enabled);
1317 void M_Options_PrintCheckbox(char *s, int enabled, int yes)
1321 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);
1322 M_ItemPrint(0, opty, s, enabled);
1323 M_DrawCheckbox(0 + strlen(s) * 8 + 8, opty, yes);
1329 void M_Options_PrintSlider(char *s, int enabled, float value, float minvalue, float maxvalue)
1333 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);
1334 M_ItemPrint(0, opty, s, enabled);
1335 M_DrawSlider(0 + strlen(s) * 8 + 8, opty, value, minvalue, maxvalue);
1341 void M_Options_Draw (void)
1346 M_Background(320, 240);
1348 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1349 p = Draw_CachePic("gfx/p_option.lmp");
1350 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1353 optcursor = options_cursor;
1354 visible = (vid.conheight - 32) / 8;
1355 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
1357 M_Options_PrintCommand( "Customize controls", true);
1358 M_Options_PrintCommand( " Go to console", true);
1359 M_Options_PrintCommand( " Reset to defaults", true);
1360 M_Options_PrintCommand( " Video", true);
1361 M_Options_PrintCommand( " Effects", true);
1362 M_Options_PrintCommand( " Graphics", true);
1363 M_Options_PrintCommand( " Color Control", true);
1364 M_Options_PrintSlider( " 2D Screen Width ", true, vid_conwidth.value, 320, 2048);
1365 M_Options_PrintSlider( " 2D Screen Height", true, vid_conheight.value, 240, 1536);
1366 M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000);
1367 M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1);
1368 M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1);
1369 M_Options_PrintSlider( " Screen size", true, scr_viewsize.value, 30, 120);
1370 M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
1371 M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
1372 M_Options_PrintSlider( " JPEG quality", jpeg_dll != NULL, scr_screenshot_jpeg_quality.value, 0, 1);
1373 M_Options_PrintCheckbox(" Sky", true, r_sky.integer);
1374 M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer);
1375 M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer);
1376 M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
1377 M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5);
1378 M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
1379 M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1);
1380 M_Options_PrintSlider(gamemode == GAME_GOODVSBAD2 ? " Music Volume" : " Ambient Volume", snd_initialized.integer, snd_staticvolume.value, 0, 1);
1381 M_Options_PrintCheckbox(" Text Shadow", true, r_textshadow.integer);
1382 M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5);
1383 M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5);
1384 M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer);
1385 M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
1386 M_Options_PrintCheckbox(" Show Time", true, showtime.integer);
1387 M_Options_PrintCheckbox(" Show Date", true, showdate.integer);
1388 M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
1389 M_Options_PrintCheckbox(" Lookspring", true, lookspring.integer);
1390 M_Options_PrintCheckbox(" Lookstrafe", true, lookstrafe.integer);
1391 M_Options_PrintSlider( " Mouse Speed", true, sensitivity.value, 1, 50);
1392 M_Options_PrintCheckbox(" Mouse Look", true, freelook.integer);
1393 M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
1394 M_Options_PrintCheckbox(" Use Mouse", true, vid_mouse.integer);
1398 void M_Options_Key (int k, char ascii)
1407 m_entersound = true;
1408 switch (options_cursor)
1415 key_dest = key_game;
1416 Con_ToggleConsole_f ();
1419 Cbuf_AddText ("exec default.cfg\n");
1425 M_Menu_Options_Effects_f ();
1428 M_Menu_Options_Graphics_f ();
1431 M_Menu_Options_ColorControl_f ();
1434 M_Menu_Options_AdjustSliders (1);
1440 S_LocalSound ("misc/menu1.wav", true);
1442 if (options_cursor < 0)
1443 options_cursor = OPTIONS_ITEMS-1;
1447 S_LocalSound ("misc/menu1.wav", true);
1449 if (options_cursor >= OPTIONS_ITEMS)
1454 M_Menu_Options_AdjustSliders (-1);
1458 M_Menu_Options_AdjustSliders (1);
1463 #define OPTIONS_EFFECTS_ITEMS 33
1465 int options_effects_cursor;
1467 void M_Menu_Options_Effects_f (void)
1469 key_dest = key_menu;
1470 m_state = m_options_effects;
1471 m_entersound = true;
1475 extern cvar_t r_detailtextures;
1476 extern cvar_t cl_particles;
1477 extern cvar_t cl_stainmaps;
1478 extern cvar_t cl_decals;
1479 extern cvar_t r_explosionclip;
1480 extern cvar_t r_modellights;
1481 extern cvar_t r_coronas;
1482 extern cvar_t gl_flashblend;
1483 extern cvar_t cl_particles_quality;
1484 extern cvar_t cl_particles_bulletimpacts;
1485 extern cvar_t cl_particles_smoke;
1486 extern cvar_t cl_particles_sparks;
1487 extern cvar_t cl_particles_bubbles;
1488 extern cvar_t cl_particles_blood;
1489 extern cvar_t cl_particles_blood_alpha;
1490 extern cvar_t cl_particles_blood_bloodhack;
1491 extern cvar_t cl_particles_explosions_shell;
1492 extern cvar_t r_lightningbeam_thickness;
1493 extern cvar_t r_lightningbeam_scroll;
1494 extern cvar_t r_lightningbeam_repeatdistance;
1495 extern cvar_t r_lightningbeam_color_red;
1496 extern cvar_t r_lightningbeam_color_green;
1497 extern cvar_t r_lightningbeam_color_blue;
1498 extern cvar_t r_lightningbeam_qmbtexture;
1500 void M_Menu_Options_Effects_AdjustSliders (int dir)
1503 S_LocalSound ("misc/menu3.wav", true);
1506 if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1507 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_coronas, bound(0, r_coronas.value + dir * 0.125, 4));
1508 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1509 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1510 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4));
1511 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_explosions_shell, !cl_particles_explosions_shell.integer);
1512 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1513 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1514 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer);
1515 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1516 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1517 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1518 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1519 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1520 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1521 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1522 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_bloodhack, !cl_particles_blood_bloodhack.integer);
1523 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_thickness, bound(1, r_lightningbeam_thickness.integer + dir, 10));
1524 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_scroll, bound(0, r_lightningbeam_scroll.integer + dir, 10));
1525 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_repeatdistance, bound(64, r_lightningbeam_repeatdistance.integer + dir * 64, 1024));
1526 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_red, bound(0, r_lightningbeam_color_red.value + dir * 0.1, 1));
1527 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_green, bound(0, r_lightningbeam_color_green.value + dir * 0.1, 1));
1528 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_blue, bound(0, r_lightningbeam_color_blue.value + dir * 0.1, 1));
1529 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_qmbtexture, !r_lightningbeam_qmbtexture.integer);
1530 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer);
1531 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer);
1532 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_polyblend, bound(0, gl_polyblend.value + dir * 0.1, 1));
1533 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll1, bound(-8, r_skyscroll1.value + dir * 0.1, 8));
1534 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll2, bound(-8, r_skyscroll2.value + dir * 0.1, 8));
1535 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterwarp, bound(0, r_waterwarp.value + dir * 0.1, 1));
1536 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_wateralpha, bound(0, r_wateralpha.value + dir * 0.1, 1));
1537 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
1538 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_watershader, bound(0, r_watershader.value + dir * 0.25, 10));
1541 void M_Options_Effects_Draw (void)
1546 M_Background(320, 200);
1548 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1549 p = Draw_CachePic("gfx/p_option.lmp");
1550 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1552 optcursor = options_effects_cursor;
1554 visible = (vid.conheight - 32) / 8;
1555 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
1557 M_Options_PrintSlider( " Lights Per Model", true, r_modellights.value, 0, 8);
1558 M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
1559 M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer);
1560 M_Options_PrintCheckbox(" Particles", true, cl_particles.integer);
1561 M_Options_PrintSlider( " Particles Quality", true, cl_particles_quality.value, 1, 4);
1562 M_Options_PrintCheckbox(" Explosion Shell", true, cl_particles_explosions_shell.integer);
1563 M_Options_PrintCheckbox(" Explosion Shell Clip", true, r_explosionclip.integer);
1564 M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer);
1565 M_Options_PrintCheckbox(" Decals", true, cl_decals.integer);
1566 M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer);
1567 M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer);
1568 M_Options_PrintCheckbox(" Smoke", true, cl_particles_smoke.integer);
1569 M_Options_PrintCheckbox(" Sparks", true, cl_particles_sparks.integer);
1570 M_Options_PrintCheckbox(" Bubbles", true, cl_particles_bubbles.integer);
1571 M_Options_PrintCheckbox(" Blood", true, cl_particles_blood.integer);
1572 M_Options_PrintSlider( " Blood Opacity", true, cl_particles_blood_alpha.value, 0.2, 1);
1573 M_Options_PrintCheckbox("Force New Blood Effect", true, cl_particles_blood_bloodhack.integer);
1574 M_Options_PrintSlider( " Lightning Thickness", true, r_lightningbeam_thickness.integer, 1, 10);
1575 M_Options_PrintSlider( " Lightning Scroll", true, r_lightningbeam_scroll.integer, 0, 10);
1576 M_Options_PrintSlider( " Lightning Repeat Dist", true, r_lightningbeam_repeatdistance.integer, 64, 1024);
1577 M_Options_PrintSlider( " Lightning Color Red", true, r_lightningbeam_color_red.value, 0, 1);
1578 M_Options_PrintSlider( " Lightning Color Green", true, r_lightningbeam_color_green.value, 0, 1);
1579 M_Options_PrintSlider( " Lightning Color Blue", true, r_lightningbeam_color_blue.value, 0, 1);
1580 M_Options_PrintCheckbox(" Lightning QMB Texture", true, r_lightningbeam_qmbtexture.integer);
1581 M_Options_PrintCheckbox(" Model Interpolation", true, r_lerpmodels.integer);
1582 M_Options_PrintCheckbox(" Sprite Interpolation", true, r_lerpsprites.integer);
1583 M_Options_PrintSlider( " View Blend", true, gl_polyblend.value, 0, 1);
1584 M_Options_PrintSlider( "Upper Sky Scroll Speed", true, r_skyscroll1.value, -8, 8);
1585 M_Options_PrintSlider( "Lower Sky Scroll Speed", true, r_skyscroll2.value, -8, 8);
1586 M_Options_PrintSlider( " Underwater View Warp", true, r_waterwarp.value, 0, 1);
1587 M_Options_PrintSlider( " Water Alpha (opacity)", true, r_wateralpha.value, 0, 1);
1588 M_Options_PrintSlider( " Water Movement", true, r_waterscroll.value, 0, 10);
1589 M_Options_PrintSlider( " GeForce3 Water Shader", true, r_watershader.value, 0, 10);
1593 void M_Options_Effects_Key (int k, char ascii)
1598 M_Menu_Options_f ();
1602 M_Menu_Options_Effects_AdjustSliders (1);
1606 S_LocalSound ("misc/menu1.wav", true);
1607 options_effects_cursor--;
1608 if (options_effects_cursor < 0)
1609 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1613 S_LocalSound ("misc/menu1.wav", true);
1614 options_effects_cursor++;
1615 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1616 options_effects_cursor = 0;
1620 M_Menu_Options_Effects_AdjustSliders (-1);
1624 M_Menu_Options_Effects_AdjustSliders (1);
1630 #define OPTIONS_GRAPHICS_ITEMS 7
1632 int options_graphics_cursor;
1634 void M_Menu_Options_Graphics_f (void)
1636 key_dest = key_menu;
1637 m_state = m_options_graphics;
1638 m_entersound = true;
1641 extern cvar_t r_shadow_gloss;
1642 extern cvar_t r_shadow_realtime_dlight;
1643 extern cvar_t r_shadow_realtime_dlight_shadows;
1644 extern cvar_t r_shadow_realtime_world;
1645 extern cvar_t r_shadow_realtime_world_dlightshadows;
1646 extern cvar_t r_shadow_realtime_world_lightmaps;
1647 extern cvar_t r_shadow_realtime_world_shadows;
1649 void M_Menu_Options_Graphics_AdjustSliders (int dir)
1652 S_LocalSound ("misc/menu3.wav", true);
1656 if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_gloss, bound(0, r_shadow_gloss.integer + dir, 2));
1657 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight, !r_shadow_realtime_dlight.integer);
1658 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight_shadows, !r_shadow_realtime_dlight_shadows.integer);
1659 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world, !r_shadow_realtime_world.integer);
1660 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_dlightshadows, !r_shadow_realtime_world_dlightshadows.integer);
1661 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_lightmaps, !r_shadow_realtime_world_lightmaps.integer);
1662 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_shadows, !r_shadow_realtime_world_shadows.integer);
1666 void M_Options_Graphics_Draw (void)
1671 M_Background(320, 200);
1673 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1674 p = Draw_CachePic("gfx/p_option.lmp");
1675 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1677 optcursor = options_graphics_cursor;
1679 visible = (vid.conheight - 32) / 8;
1680 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
1682 M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
1683 M_Options_PrintCheckbox(" RT DLights", true, r_shadow_realtime_dlight.integer);
1684 M_Options_PrintCheckbox(" RT DLight Shadows", true, r_shadow_realtime_dlight_shadows.integer);
1685 M_Options_PrintCheckbox(" RT World", true, r_shadow_realtime_world.integer);
1686 M_Options_PrintCheckbox("RT World DLight Shadows", true, r_shadow_realtime_world_dlightshadows.integer);
1687 M_Options_PrintCheckbox(" RT World Lightmaps", true, r_shadow_realtime_world_lightmaps.integer);
1688 M_Options_PrintCheckbox(" RT World Shadow", true, r_shadow_realtime_world_shadows.integer);
1692 void M_Options_Graphics_Key (int k, char ascii)
1697 M_Menu_Options_f ();
1701 M_Menu_Options_Graphics_AdjustSliders (1);
1705 S_LocalSound ("misc/menu1.wav", true);
1706 options_graphics_cursor--;
1707 if (options_graphics_cursor < 0)
1708 options_graphics_cursor = OPTIONS_GRAPHICS_ITEMS-1;
1712 S_LocalSound ("misc/menu1.wav", true);
1713 options_graphics_cursor++;
1714 if (options_graphics_cursor >= OPTIONS_GRAPHICS_ITEMS)
1715 options_graphics_cursor = 0;
1719 M_Menu_Options_Graphics_AdjustSliders (-1);
1723 M_Menu_Options_Graphics_AdjustSliders (1);
1729 #define OPTIONS_COLORCONTROL_ITEMS 18
1731 int options_colorcontrol_cursor;
1733 // intensity value to match up to 50% dither to 'correct' quake
1734 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1736 void M_Menu_Options_ColorControl_f (void)
1738 key_dest = key_menu;
1739 m_state = m_options_colorcontrol;
1740 m_entersound = true;
1744 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1748 S_LocalSound ("misc/menu3.wav", true);
1751 if (options_colorcontrol_cursor == optnum++)
1752 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1753 else if (options_colorcontrol_cursor == optnum++)
1755 Cvar_SetValueQuick (&v_color_enable, 0);
1756 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1758 else if (options_colorcontrol_cursor == optnum++)
1760 Cvar_SetValueQuick (&v_color_enable, 0);
1761 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1763 else if (options_colorcontrol_cursor == optnum++)
1765 Cvar_SetValueQuick (&v_color_enable, 0);
1766 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1768 else if (options_colorcontrol_cursor == optnum++)
1770 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1772 else if (options_colorcontrol_cursor == optnum++)
1774 Cvar_SetValueQuick (&v_color_enable, 1);
1775 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1777 else if (options_colorcontrol_cursor == optnum++)
1779 Cvar_SetValueQuick (&v_color_enable, 1);
1780 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1782 else if (options_colorcontrol_cursor == optnum++)
1784 Cvar_SetValueQuick (&v_color_enable, 1);
1785 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1787 else if (options_colorcontrol_cursor == optnum++)
1789 Cvar_SetValueQuick (&v_color_enable, 1);
1790 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1791 Cvar_SetValueQuick (&v_color_black_r, f);
1792 Cvar_SetValueQuick (&v_color_black_g, f);
1793 Cvar_SetValueQuick (&v_color_black_b, f);
1795 else if (options_colorcontrol_cursor == optnum++)
1797 Cvar_SetValueQuick (&v_color_enable, 1);
1798 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1800 else if (options_colorcontrol_cursor == optnum++)
1802 Cvar_SetValueQuick (&v_color_enable, 1);
1803 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1805 else if (options_colorcontrol_cursor == optnum++)
1807 Cvar_SetValueQuick (&v_color_enable, 1);
1808 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1810 else if (options_colorcontrol_cursor == optnum++)
1812 Cvar_SetValueQuick (&v_color_enable, 1);
1813 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1814 Cvar_SetValueQuick (&v_color_grey_r, f);
1815 Cvar_SetValueQuick (&v_color_grey_g, f);
1816 Cvar_SetValueQuick (&v_color_grey_b, f);
1818 else if (options_colorcontrol_cursor == optnum++)
1820 Cvar_SetValueQuick (&v_color_enable, 1);
1821 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1823 else if (options_colorcontrol_cursor == optnum++)
1825 Cvar_SetValueQuick (&v_color_enable, 1);
1826 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1828 else if (options_colorcontrol_cursor == optnum++)
1830 Cvar_SetValueQuick (&v_color_enable, 1);
1831 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1833 else if (options_colorcontrol_cursor == optnum++)
1835 Cvar_SetValueQuick (&v_color_enable, 1);
1836 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1837 Cvar_SetValueQuick (&v_color_white_r, f);
1838 Cvar_SetValueQuick (&v_color_white_g, f);
1839 Cvar_SetValueQuick (&v_color_white_b, f);
1843 void M_Options_ColorControl_Draw (void)
1846 float x, c, s, t, u, v;
1849 M_Background(320, 256);
1851 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1852 p = Draw_CachePic("gfx/p_option.lmp");
1853 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1855 optcursor = options_colorcontrol_cursor;
1857 visible = (vid.conheight - 32) / 8;
1858 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
1860 M_Options_PrintCommand( " Reset to defaults", true);
1861 M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer);
1862 M_Options_PrintSlider( " Gamma", !v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_gamma.value, 1, 5);
1863 M_Options_PrintSlider( " Contrast", !v_color_enable.integer, v_contrast.value, 1, 5);
1864 M_Options_PrintSlider( " Brightness", !v_color_enable.integer, v_brightness.value, 0, 0.8);
1865 M_Options_PrintCheckbox(" Color Level Controls", true, v_color_enable.integer);
1866 M_Options_PrintSlider( " Black: Red ", v_color_enable.integer, v_color_black_r.value, 0, 0.8);
1867 M_Options_PrintSlider( " Black: Green", v_color_enable.integer, v_color_black_g.value, 0, 0.8);
1868 M_Options_PrintSlider( " Black: Blue ", v_color_enable.integer, v_color_black_b.value, 0, 0.8);
1869 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);
1870 M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_r.value, 0, 0.95);
1871 M_Options_PrintSlider( " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_g.value, 0, 0.95);
1872 M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_b.value, 0, 0.95);
1873 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);
1874 M_Options_PrintSlider( " White: Red ", v_color_enable.integer, v_color_white_r.value, 1, 5);
1875 M_Options_PrintSlider( " White: Green", v_color_enable.integer, v_color_white_g.value, 1, 5);
1876 M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5);
1877 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);
1880 DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
1881 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1882 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1883 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;
1884 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;
1885 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;
1886 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;
1887 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;
1888 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;
1889 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;
1890 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;
1892 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1893 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1894 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1899 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, 0, 0, 1, 0);
1900 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);
1901 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);
1903 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, c, 0, 1, 0);
1904 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);
1905 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);
1907 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, 0, c, 1, 0);
1908 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);
1909 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);
1911 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, c, c, 1, 0);
1912 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);
1913 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);
1917 void M_Options_ColorControl_Key (int k, char ascii)
1922 M_Menu_Options_f ();
1926 m_entersound = true;
1927 switch (options_colorcontrol_cursor)
1930 Cvar_SetValueQuick(&v_hwgamma, 1);
1931 Cvar_SetValueQuick(&v_gamma, 1);
1932 Cvar_SetValueQuick(&v_contrast, 1);
1933 Cvar_SetValueQuick(&v_brightness, 0);
1934 Cvar_SetValueQuick(&v_color_enable, 0);
1935 Cvar_SetValueQuick(&v_color_black_r, 0);
1936 Cvar_SetValueQuick(&v_color_black_g, 0);
1937 Cvar_SetValueQuick(&v_color_black_b, 0);
1938 Cvar_SetValueQuick(&v_color_grey_r, 0);
1939 Cvar_SetValueQuick(&v_color_grey_g, 0);
1940 Cvar_SetValueQuick(&v_color_grey_b, 0);
1941 Cvar_SetValueQuick(&v_color_white_r, 1);
1942 Cvar_SetValueQuick(&v_color_white_g, 1);
1943 Cvar_SetValueQuick(&v_color_white_b, 1);
1946 M_Menu_Options_ColorControl_AdjustSliders (1);
1952 S_LocalSound ("misc/menu1.wav", true);
1953 options_colorcontrol_cursor--;
1954 if (options_colorcontrol_cursor < 0)
1955 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1959 S_LocalSound ("misc/menu1.wav", true);
1960 options_colorcontrol_cursor++;
1961 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1962 options_colorcontrol_cursor = 0;
1966 M_Menu_Options_ColorControl_AdjustSliders (-1);
1970 M_Menu_Options_ColorControl_AdjustSliders (1);
1976 //=============================================================================
1979 char *quakebindnames[][2] =
1981 {"+attack", "attack"},
1982 {"impulse 10", "next weapon"},
1983 {"impulse 12", "previous weapon"},
1984 {"+jump", "jump / swim up"},
1985 {"+forward", "walk forward"},
1986 {"+back", "backpedal"},
1987 {"+left", "turn left"},
1988 {"+right", "turn right"},
1990 {"+moveleft", "step left"},
1991 {"+moveright", "step right"},
1992 {"+strafe", "sidestep"},
1993 {"+lookup", "look up"},
1994 {"+lookdown", "look down"},
1995 {"centerview", "center view"},
1996 {"+mlook", "mouse look"},
1997 {"+klook", "keyboard look"},
1998 {"+moveup", "swim up"},
1999 {"+movedown", "swim down"}
2002 char *transfusionbindnames[][2] =
2004 {"", "Movement"}, // Movement commands
2005 {"+forward", "walk forward"},
2006 {"+back", "backpedal"},
2007 {"+left", "turn left"},
2008 {"+right", "turn right"},
2009 {"+moveleft", "step left"},
2010 {"+moveright", "step right"},
2011 {"+jump", "jump / swim up"},
2012 {"+movedown", "swim down"},
2013 {"", "Combat"}, // Combat commands
2014 {"impulse 1", "Pitch Fork"},
2015 {"impulse 2", "Flare Gun"},
2016 {"impulse 3", "Shotgun"},
2017 {"impulse 4", "Machine Gun"},
2018 {"impulse 5", "Incinerator"},
2019 {"impulse 6", "Bombs (TNT)"},
2020 {"impulse 35", "Proximity Bomb"},
2021 {"impulse 36", "Remote Detonator"},
2022 {"impulse 7", "Aerosol Can"},
2023 {"impulse 8", "Tesla Cannon"},
2024 {"impulse 9", "Life Leech"},
2025 {"impulse 10", "Voodoo Doll"},
2026 {"impulse 21", "next weapon"},
2027 {"impulse 22", "previous weapon"},
2028 {"+attack", "attack"},
2029 {"+button3", "altfire"},
2030 {"", "Inventory"}, // Inventory commands
2031 {"impulse 40", "Dr.'s Bag"},
2032 {"impulse 41", "Crystal Ball"},
2033 {"impulse 42", "Beast Vision"},
2034 {"impulse 43", "Jump Boots"},
2035 {"impulse 23", "next item"},
2036 {"impulse 24", "previous item"},
2037 {"impulse 25", "use item"},
2038 {"", "Misc"}, // Misc commands
2039 {"+button4", "use"},
2040 {"impulse 50", "add bot (red)"},
2041 {"impulse 51", "add bot (blue)"},
2042 {"impulse 52", "kick a bot"},
2043 {"impulse 26", "next armor type"},
2044 {"impulse 27", "identify player"},
2045 {"impulse 55", "voting menu"},
2046 {"impulse 56", "observer mode"},
2047 {"", "Taunts"}, // Taunts
2048 {"impulse 70", "taunt 0"},
2049 {"impulse 71", "taunt 1"},
2050 {"impulse 72", "taunt 2"},
2051 {"impulse 73", "taunt 3"},
2052 {"impulse 74", "taunt 4"},
2053 {"impulse 75", "taunt 5"},
2054 {"impulse 76", "taunt 6"},
2055 {"impulse 77", "taunt 7"},
2056 {"impulse 78", "taunt 8"},
2057 {"impulse 79", "taunt 9"}
2060 char *goodvsbad2bindnames[][2] =
2062 {"impulse 69", "Power 1"},
2063 {"impulse 70", "Power 2"},
2064 {"impulse 71", "Power 3"},
2065 {"+jump", "jump / swim up"},
2066 {"+forward", "walk forward"},
2067 {"+back", "backpedal"},
2068 {"+left", "turn left"},
2069 {"+right", "turn right"},
2071 {"+moveleft", "step left"},
2072 {"+moveright", "step right"},
2073 {"+strafe", "sidestep"},
2074 {"+lookup", "look up"},
2075 {"+lookdown", "look down"},
2076 {"centerview", "center view"},
2077 {"+mlook", "mouse look"},
2078 {"kill", "kill yourself"},
2079 {"+moveup", "swim up"},
2080 {"+movedown", "swim down"}
2084 char *(*bindnames)[2];
2087 typedef struct binditem_s
2089 char *command, *description;
2090 struct binditem_s *next;
2094 typedef struct bindcategory_s
2098 struct bindcategory_s *next;
2102 bindcategory_t *bindcategories = NULL;
2104 void M_ClearBinds (void)
2106 for (c = bindcategories;c;c = cnext)
2109 for (b = c->binds;b;b = bnext)
2116 bindcategories = NULL;
2119 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
2121 for (b = &c->binds;*b;*b = &(*b)->next);
2122 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
2123 *b->command = (char *)((*b) + 1);
2124 *b->description = *b->command + strlen(command) + 1;
2125 strcpy(*b->command, command);
2126 strcpy(*b->description, description);
2129 void M_AddBind (char *category, char *command, char *description)
2131 for (c = &bindcategories;*c;c = &(*c)->next)
2133 if (!strcmp(category, (*c)->name))
2135 M_AddBindToCategory(*c, command, description);
2139 *c = Z_Alloc(sizeof(bindcategory_t));
2140 M_AddBindToCategory(*c, command, description);
2143 void M_DefaultBinds (void)
2146 M_AddBind("movement", "+jump", "jump / swim up");
2147 M_AddBind("movement", "+forward", "walk forward");
2148 M_AddBind("movement", "+back", "backpedal");
2149 M_AddBind("movement", "+left", "turn left");
2150 M_AddBind("movement", "+right", "turn right");
2151 M_AddBind("movement", "+speed", "run");
2152 M_AddBind("movement", "+moveleft", "step left");
2153 M_AddBind("movement", "+moveright", "step right");
2154 M_AddBind("movement", "+strafe", "sidestep");
2155 M_AddBind("movement", "+lookup", "look up");
2156 M_AddBind("movement", "+lookdown", "look down");
2157 M_AddBind("movement", "centerview", "center view");
2158 M_AddBind("movement", "+mlook", "mouse look");
2159 M_AddBind("movement", "+klook", "keyboard look");
2160 M_AddBind("movement", "+moveup", "swim up");
2161 M_AddBind("movement", "+movedown", "swim down");
2162 M_AddBind("weapons", "+attack", "attack");
2163 M_AddBind("weapons", "impulse 10", "next weapon");
2164 M_AddBind("weapons", "impulse 12", "previous weapon");
2165 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2166 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2167 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2168 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2169 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2170 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2171 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2172 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2180 void M_Menu_Keys_f (void)
2182 key_dest = key_menu;
2184 m_entersound = true;
2189 void M_FindKeysForCommand (char *command, int *keys)
2195 for (j = 0;j < NUMKEYS;j++)
2200 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2202 b = keybindings[0][j];
2205 if (!strcmp (b, command) )
2208 if (count == NUMKEYS)
2214 void M_UnbindCommand (char *command)
2219 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2221 b = keybindings[0][j];
2224 if (!strcmp (b, command))
2225 Key_SetBinding (j, 0, "");
2230 void M_Keys_Draw (void)
2236 char keystring[1024];
2238 M_Background(320, 48 + 8 * numcommands);
2240 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2241 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2244 M_Print(12, 32, "Press a key or button for this action");
2246 M_Print(18, 32, "Enter to change, backspace to clear");
2248 // search for known bindings
2249 for (i=0 ; i<numcommands ; i++)
2253 // If there's no command, it's just a section
2254 if (bindnames[i][0][0] == '\0')
2256 M_PrintRed (4, y, "\x0D"); // #13 is the little arrow pointing to the right
2257 M_PrintRed (16, y, bindnames[i][1]);
2261 M_Print(16, y, bindnames[i][1]);
2263 M_FindKeysForCommand (bindnames[i][0], keys);
2265 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2267 strcpy(keystring, "???");
2271 for (j = 0;j < NUMKEYS;j++)
2276 strcat(keystring, " or ");
2277 strcat(keystring, Key_KeynumToString (keys[j]));
2281 M_Print(150, y, keystring);
2285 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2287 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2291 void M_Keys_Key (int k, char ascii)
2298 S_LocalSound ("misc/menu1.wav", true);
2303 else //if (k != '`')
2305 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2306 Cbuf_InsertText (cmd);
2316 M_Menu_Options_f ();
2321 S_LocalSound ("misc/menu1.wav", true);
2325 if (keys_cursor < 0)
2326 keys_cursor = numcommands-1;
2328 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2333 S_LocalSound ("misc/menu1.wav", true);
2337 if (keys_cursor >= numcommands)
2340 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2343 case K_ENTER: // go into bind mode
2344 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2345 S_LocalSound ("misc/menu2.wav", true);
2346 if (keys[NUMKEYS - 1] != -1)
2347 M_UnbindCommand (bindnames[keys_cursor][0]);
2351 case K_BACKSPACE: // delete bindings
2352 case K_DEL: // delete bindings
2353 S_LocalSound ("misc/menu2.wav", true);
2354 M_UnbindCommand (bindnames[keys_cursor][0]);
2359 //=============================================================================
2362 #define VIDEO_ITEMS 4
2364 int video_cursor = 0;
2365 int video_cursor_table[] = {56, 68, 80, 100};
2366 // note: if modes are added to the beginning of this list, update the
2367 // video_resolution = x; in M_Menu_Video_f below
2368 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}};
2369 // this is the number of the 640x480 mode in the list
2371 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
2372 int video_resolution;
2374 extern int current_vid_fullscreen;
2375 extern int current_vid_width;
2376 extern int current_vid_height;
2377 extern int current_vid_bitsperpixel;
2380 void M_Menu_Video_f (void)
2382 key_dest = key_menu;
2384 m_entersound = true;
2386 // Look for the current resolution
2387 for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
2389 if (video_resolutions[video_resolution][0] == current_vid_width &&
2390 video_resolutions[video_resolution][1] == current_vid_height)
2394 // Default to VID_640 if we didn't find it
2395 if (video_resolution == VID_RES_COUNT)
2397 // may need to update this number if mode list changes
2398 video_resolution = VID_640;
2399 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2400 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2405 void M_Video_Draw (void)
2410 M_Background(320, 200);
2412 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2413 p = Draw_CachePic("gfx/vidmodes.lmp");
2414 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2417 M_Print(16, video_cursor_table[0], " Resolution");
2418 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2419 M_Print(220, video_cursor_table[0], string);
2422 M_Print(16, video_cursor_table[1], " Bits per pixel");
2423 M_Print(220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2426 M_Print(16, video_cursor_table[2], " Fullscreen");
2427 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2430 M_Print(220, video_cursor_table[3], "Apply");
2433 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2437 void M_Menu_Video_AdjustSliders (int dir)
2439 S_LocalSound ("misc/menu3.wav", true);
2441 switch (video_cursor)
2446 int new_resolution = video_resolution + dir;
2447 if (gamemode == GAME_FNIGGIUM ? new_resolution < VID_640 : new_resolution < 0)
2448 video_resolution = VID_RES_COUNT - 1;
2449 else if (new_resolution > VID_RES_COUNT - 1)
2450 video_resolution = gamemode == GAME_FNIGGIUM ? VID_640 : 0;
2452 video_resolution = new_resolution;
2454 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2455 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2461 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2464 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2470 void M_Video_Key (int key, char ascii)
2475 // vid_shared.c has a copy of the current video config. We restore it
2476 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2477 Cvar_SetValueQuick(&vid_width, current_vid_width);
2478 Cvar_SetValueQuick(&vid_height, current_vid_height);
2479 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2481 S_LocalSound ("misc/menu1.wav", true);
2482 M_Menu_Options_f ();
2486 m_entersound = true;
2487 switch (video_cursor)
2490 Cbuf_AddText ("vid_restart\n");
2491 M_Menu_Options_f ();
2494 M_Menu_Video_AdjustSliders (1);
2499 S_LocalSound ("misc/menu1.wav", true);
2501 if (video_cursor < 0)
2502 video_cursor = VIDEO_ITEMS-1;
2506 S_LocalSound ("misc/menu1.wav", true);
2508 if (video_cursor >= VIDEO_ITEMS)
2513 M_Menu_Video_AdjustSliders (-1);
2517 M_Menu_Video_AdjustSliders (1);
2522 //=============================================================================
2526 #define NUM_HELP_PAGES 6
2529 void M_Menu_Help_f (void)
2531 key_dest = key_menu;
2533 m_entersound = true;
2539 void M_Help_Draw (void)
2541 M_Background(320, 200);
2542 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2546 void M_Help_Key (int key, char ascii)
2556 m_entersound = true;
2557 if (++help_page >= NUM_HELP_PAGES)
2563 m_entersound = true;
2564 if (--help_page < 0)
2565 help_page = NUM_HELP_PAGES-1;
2571 //=============================================================================
2574 char *m_quit_message[9];
2575 int m_quit_prevstate;
2576 qboolean wasInMenus;
2579 int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
2581 m_quit_message[0] = line1;
2582 m_quit_message[1] = line2;
2583 m_quit_message[2] = line3;
2584 m_quit_message[3] = line4;
2585 m_quit_message[4] = line5;
2586 m_quit_message[5] = line6;
2587 m_quit_message[6] = line7;
2588 m_quit_message[7] = line8;
2589 m_quit_message[8] = NULL;
2593 int M_ChooseQuitMessage(int request)
2601 if (request-- == 0) return M_QuitMessage("Are you gonna quit","this game just like","everything else?",NULL,NULL,NULL,NULL,NULL);
2602 if (request-- == 0) return M_QuitMessage("Milord, methinks that","thou art a lowly","quitter. Is this true?",NULL,NULL,NULL,NULL,NULL);
2603 if (request-- == 0) return M_QuitMessage("Do I need to bust your","face open for trying","to quit?",NULL,NULL,NULL,NULL,NULL);
2604 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);
2605 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);
2606 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);
2607 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);
2608 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);
2610 case GAME_GOODVSBAD2:
2611 if (request-- == 0) return M_QuitMessage("Press Yes To Quit","...","Yes",NULL,NULL,NULL,NULL,NULL);
2612 if (request-- == 0) return M_QuitMessage("Do you really want to","Quit?","Play Good vs bad 3!",NULL,NULL,NULL,NULL,NULL);
2613 if (request-- == 0) return M_QuitMessage("All your quit are","belong to long duck","dong",NULL,NULL,NULL,NULL,NULL);
2614 if (request-- == 0) return M_QuitMessage("Press Y to quit","","But are you too legit?",NULL,NULL,NULL,NULL,NULL);
2615 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);
2616 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);
2617 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);
2618 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);
2619 if (request-- == 0) return M_QuitMessage("Press Y like you","were waanderers","from Ys'",NULL,NULL,NULL,NULL,NULL);
2620 if (request-- == 0) return M_QuitMessage("This game was made in","Nippon like the SS","announcer's saying ipon",NULL,NULL,NULL,NULL,NULL);
2621 if (request-- == 0) return M_QuitMessage("you","want to quit?",NULL,NULL,NULL,NULL,NULL,NULL);
2622 if (request-- == 0) return M_QuitMessage("Please stop playing","this stupid game",NULL,NULL,NULL,NULL,NULL,NULL);
2624 case GAME_BATTLEMECH:
2625 if (request-- == 0) return M_QuitMessage("? WHY ?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2626 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);
2627 if (request-- == 0) return M_QuitMessage("Accept Defeat?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2628 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);
2629 if (request-- == 0) return M_QuitMessage("Where's your bloodlust?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2630 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);
2631 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);
2633 case GAME_OPENQUARTZ:
2634 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);
2635 if (request-- == 0) return M_QuitMessage("GNU is not Unix!","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2636 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);
2637 if (request-- == 0) return M_QuitMessage("Is OpenQuartz Propaganda?","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2640 if (request-- == 0) return M_QuitMessage("Tired of fragging already?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2641 if (request-- == 0) return M_QuitMessage("Quit now and forfeit your bodycount?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2642 if (request-- == 0) return M_QuitMessage("Are you sure you want to quit?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2643 if (request-- == 0) return M_QuitMessage("Off to do something constructive?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2649 void M_Menu_Quit_f (void)
2652 if (m_state == m_quit)
2654 wasInMenus = (key_dest == key_menu);
2655 key_dest = key_menu;
2656 m_quit_prevstate = m_state;
2658 m_entersound = true;
2659 // count how many there are
2660 for (n = 0;M_ChooseQuitMessage(n);n++);
2662 M_ChooseQuitMessage(rand() % n);
2666 void M_Quit_Key (int key, char ascii)
2675 m_state = m_quit_prevstate;
2676 m_entersound = true;
2680 key_dest = key_game;
2695 void M_Quit_Draw (void)
2697 int i, l, linelength, firstline, lastline, lines;
2698 for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
2700 if ((l = strlen(m_quit_message[i])))
2710 lines = (lastline - firstline) + 1;
2711 M_Background(linelength * 8 + 16, lines * 8 + 16);
2712 M_DrawTextBox(0, 0, linelength, lines);
2713 for (i = 0, l = firstline;i < lines;i++, l++)
2714 M_Print(8 + 4 * (linelength - strlen(m_quit_message[l])), 8 + 8 * i, m_quit_message[l]);
2717 //=============================================================================
2718 /* LAN CONFIG MENU */
2720 int lanConfig_cursor = -1;
2721 int lanConfig_cursor_table [] = {56, 76, 112};
2722 #define NUM_LANCONFIG_CMDS 3
2725 char lanConfig_portname[6];
2726 char lanConfig_joinname[22];
2728 void M_Menu_LanConfig_f (void)
2730 key_dest = key_menu;
2731 m_state = m_lanconfig;
2732 m_entersound = true;
2733 if (lanConfig_cursor == -1)
2736 lanConfig_cursor = 1;
2739 lanConfig_cursor = 1;
2740 lanConfig_port = 26000;
2741 sprintf(lanConfig_portname, "%u", lanConfig_port);
2743 m_return_reason[0] = 0;
2747 void M_LanConfig_Draw (void)
2754 M_Background(320, 200);
2756 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2757 p = Draw_CachePic ("gfx/p_multi.lmp");
2758 basex = (320-p->width)/2;
2759 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2762 startJoin = "New Game";
2764 startJoin = "Join Game";
2765 protocol = "TCP/IP";
2766 M_Print(basex, 32, va ("%s - %s", startJoin, protocol));
2769 M_Print(basex, lanConfig_cursor_table[0], "Port");
2770 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2771 M_Print(basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2775 M_Print(basex, lanConfig_cursor_table[1], "Search for games...");
2776 M_Print(basex, lanConfig_cursor_table[2]-16, "Join game at:");
2777 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2778 M_Print(basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2782 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2783 M_Print(basex+8, lanConfig_cursor_table[1], "OK");
2786 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2788 if (lanConfig_cursor == 0)
2789 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2791 if (lanConfig_cursor == 2)
2792 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2794 if (*m_return_reason)
2795 M_Print(basex, 168, m_return_reason);
2799 void M_LanConfig_Key (int key, char ascii)
2806 M_Menu_MultiPlayer_f ();
2810 S_LocalSound ("misc/menu1.wav", true);
2812 if (lanConfig_cursor < 0)
2813 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2817 S_LocalSound ("misc/menu1.wav", true);
2819 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2820 lanConfig_cursor = 0;
2824 if (lanConfig_cursor == 0)
2827 m_entersound = true;
2829 Cbuf_AddText ("stopdemo\n");
2831 Cvar_SetValue("port", lanConfig_port);
2833 if (lanConfig_cursor == 1)
2837 M_Menu_GameOptions_f ();
2840 M_Menu_ServerList_f();
2844 if (lanConfig_cursor == 2)
2845 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2849 if (lanConfig_cursor == 0)
2851 if (strlen(lanConfig_portname))
2852 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2855 if (lanConfig_cursor == 2)
2857 if (strlen(lanConfig_joinname))
2858 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2863 if (ascii < 32 || ascii > 126)
2866 if (lanConfig_cursor == 2)
2868 l = strlen(lanConfig_joinname);
2871 lanConfig_joinname[l+1] = 0;
2872 lanConfig_joinname[l] = ascii;
2876 if (ascii < '0' || ascii > '9')
2878 if (lanConfig_cursor == 0)
2880 l = strlen(lanConfig_portname);
2883 lanConfig_portname[l+1] = 0;
2884 lanConfig_portname[l] = ascii;
2889 if (StartingGame && lanConfig_cursor == 2)
2891 if (key == K_UPARROW)
2892 lanConfig_cursor = 1;
2894 lanConfig_cursor = 0;
2897 l = atoi(lanConfig_portname);
2900 sprintf(lanConfig_portname, "%u", lanConfig_port);
2903 //=============================================================================
2904 /* GAME OPTIONS MENU */
2923 episode_t *episodes;
2928 level_t quakelevels[] =
2930 {"start", "Entrance"}, // 0
2932 {"e1m1", "Slipgate Complex"}, // 1
2933 {"e1m2", "Castle of the Damned"},
2934 {"e1m3", "The Necropolis"},
2935 {"e1m4", "The Grisly Grotto"},
2936 {"e1m5", "Gloom Keep"},
2937 {"e1m6", "The Door To Chthon"},
2938 {"e1m7", "The House of Chthon"},
2939 {"e1m8", "Ziggurat Vertigo"},
2941 {"e2m1", "The Installation"}, // 9
2942 {"e2m2", "Ogre Citadel"},
2943 {"e2m3", "Crypt of Decay"},
2944 {"e2m4", "The Ebon Fortress"},
2945 {"e2m5", "The Wizard's Manse"},
2946 {"e2m6", "The Dismal Oubliette"},
2947 {"e2m7", "Underearth"},
2949 {"e3m1", "Termination Central"}, // 16
2950 {"e3m2", "The Vaults of Zin"},
2951 {"e3m3", "The Tomb of Terror"},
2952 {"e3m4", "Satan's Dark Delight"},
2953 {"e3m5", "Wind Tunnels"},
2954 {"e3m6", "Chambers of Torment"},
2955 {"e3m7", "The Haunted Halls"},
2957 {"e4m1", "The Sewage System"}, // 23
2958 {"e4m2", "The Tower of Despair"},
2959 {"e4m3", "The Elder God Shrine"},
2960 {"e4m4", "The Palace of Hate"},
2961 {"e4m5", "Hell's Atrium"},
2962 {"e4m6", "The Pain Maze"},
2963 {"e4m7", "Azure Agony"},
2964 {"e4m8", "The Nameless City"},
2966 {"end", "Shub-Niggurath's Pit"}, // 31
2968 {"dm1", "Place of Two Deaths"}, // 32
2969 {"dm2", "Claustrophobopolis"},
2970 {"dm3", "The Abandoned Base"},
2971 {"dm4", "The Bad Place"},
2972 {"dm5", "The Cistern"},
2973 {"dm6", "The Dark Zone"}
2976 episode_t quakeepisodes[] =
2978 {"Welcome to Quake", 0, 1},
2979 {"Doomed Dimension", 1, 8},
2980 {"Realm of Black Magic", 9, 7},
2981 {"Netherworld", 16, 7},
2982 {"The Elder World", 23, 8},
2983 {"Final Level", 31, 1},
2984 {"Deathmatch Arena", 32, 6}
2987 //MED 01/06/97 added hipnotic levels
2988 level_t hipnoticlevels[] =
2990 {"start", "Command HQ"}, // 0
2992 {"hip1m1", "The Pumping Station"}, // 1
2993 {"hip1m2", "Storage Facility"},
2994 {"hip1m3", "The Lost Mine"},
2995 {"hip1m4", "Research Facility"},
2996 {"hip1m5", "Military Complex"},
2998 {"hip2m1", "Ancient Realms"}, // 6
2999 {"hip2m2", "The Black Cathedral"},
3000 {"hip2m3", "The Catacombs"},
3001 {"hip2m4", "The Crypt"},
3002 {"hip2m5", "Mortum's Keep"},
3003 {"hip2m6", "The Gremlin's Domain"},
3005 {"hip3m1", "Tur Torment"}, // 12
3006 {"hip3m2", "Pandemonium"},
3007 {"hip3m3", "Limbo"},
3008 {"hip3m4", "The Gauntlet"},
3010 {"hipend", "Armagon's Lair"}, // 16
3012 {"hipdm1", "The Edge of Oblivion"} // 17
3015 //MED 01/06/97 added hipnotic episodes
3016 episode_t hipnoticepisodes[] =
3018 {"Scourge of Armagon", 0, 1},
3019 {"Fortress of the Dead", 1, 5},
3020 {"Dominion of Darkness", 6, 6},
3021 {"The Rift", 12, 4},
3022 {"Final Level", 16, 1},
3023 {"Deathmatch Arena", 17, 1}
3026 //PGM 01/07/97 added rogue levels
3027 //PGM 03/02/97 added dmatch level
3028 level_t roguelevels[] =
3030 {"start", "Split Decision"},
3031 {"r1m1", "Deviant's Domain"},
3032 {"r1m2", "Dread Portal"},
3033 {"r1m3", "Judgement Call"},
3034 {"r1m4", "Cave of Death"},
3035 {"r1m5", "Towers of Wrath"},
3036 {"r1m6", "Temple of Pain"},
3037 {"r1m7", "Tomb of the Overlord"},
3038 {"r2m1", "Tempus Fugit"},
3039 {"r2m2", "Elemental Fury I"},
3040 {"r2m3", "Elemental Fury II"},
3041 {"r2m4", "Curse of Osiris"},
3042 {"r2m5", "Wizard's Keep"},
3043 {"r2m6", "Blood Sacrifice"},
3044 {"r2m7", "Last Bastion"},
3045 {"r2m8", "Source of Evil"},
3046 {"ctf1", "Division of Change"}
3049 //PGM 01/07/97 added rogue episodes
3050 //PGM 03/02/97 added dmatch episode
3051 episode_t rogueepisodes[] =
3053 {"Introduction", 0, 1},
3054 {"Hell's Fortress", 1, 7},
3055 {"Corridors of Time", 8, 8},
3056 {"Deathmatch Arena", 16, 1}
3059 level_t nehahralevels[] =
3061 {"nehstart", "Welcome to Nehahra"},
3062 {"neh1m1", "Forge City1: Slipgates"},
3063 {"neh1m2", "Forge City2: Boiler"},
3064 {"neh1m3", "Forge City3: Escape"},
3065 {"neh1m4", "Grind Core"},
3066 {"neh1m5", "Industrial Silence"},
3067 {"neh1m6", "Locked-Up Anger"},
3068 {"neh1m7", "Wanderer of the Wastes"},
3069 {"neh1m8", "Artemis System Net"},
3070 {"neh1m9", "To the Death"},
3071 {"neh2m1", "The Gates of Ghoro"},
3072 {"neh2m2", "Sacred Trinity"},
3073 {"neh2m3", "Realm of the Ancients"},
3074 {"neh2m4", "Temple of the Ancients"},
3075 {"neh2m5", "Dreams Made Flesh"},
3076 {"neh2m6", "Your Last Cup of Sorrow"},
3077 {"nehsec", "Ogre's Bane"},
3078 {"nehahra", "Nehahra's Den"},
3079 {"nehend", "Quintessence"}
3082 episode_t nehahraepisodes[] =
3084 {"Welcome to Nehahra", 0, 1},
3085 {"The Fall of Forge", 1, 9},
3086 {"The Outlands", 10, 7},
3087 {"Dimension of the Lost", 17, 2}
3090 // Map list for Transfusion
3091 level_t transfusionlevels[] =
3093 {"bb1", "The Stronghold"},
3094 {"bb2", "Winter Wonderland"},
3096 {"bb4", "The Tower"},
3098 {"bb6", "Twin Fortress"},
3100 {"bb8", "Fun With Heads"},
3102 {"e1m1", "Cradle to Grave"},
3103 {"e1m2", "Wrong Side of the Tracks"},
3104 {"e1m7", "Altar of Stone"},
3105 {"e2m8", "The Lair of Shial"},
3106 {"e3m1", "Ghost Town"},
3107 {"e3m7", "The Pit of Cerberus"},
3108 {"e4m1", "Butchery Loves Company"},
3109 {"e4m7", "In the Flesh"},
3110 {"e4m8", "The Hall of the Epiphany"},
3111 {"e4m9", "Mall of the Dead"},
3113 {"dm1", "Monolith Building 11"},
3116 {"e6m1", "Welcome to Your Life"},
3117 {"e6m8", "Beauty and the Beast"},
3118 {"e6m9", "Forgotten Catacombs"},
3120 {"cpbb01", "Crypt of Despair"},
3121 {"cpbb03", "Unholy Cathedral"},
3123 {"b2a15", "Area 15 (B2)"},
3124 {"barena", "Blood Arena"},
3125 {"bkeep", "Blood Keep"},
3126 {"bstar", "Brown Star"},
3127 {"crypt", "The Crypt"},
3129 {"bb3_2k1", "Bodies Infusion"},
3130 {"captasao", "Captasao"},
3131 {"curandero", "Curandero"},
3132 {"dcamp", "DeathCamp"},
3133 {"highnoon", "HighNoon"},
3134 {"qbb1", "The Confluence"},
3135 {"qbb2", "KathartiK"},
3136 {"qbb3", "Caleb's Woodland Retreat"},
3139 {"dranzbb6", "Black Coffee"},
3140 {"fragm", "Frag'M"},
3142 {"qe1m7", "The House of Chthon"},
3143 {"qmorbias", "Dm-Morbias"},
3144 {"simple", "Dead Simple"}
3147 episode_t transfusionepisodes[] =
3150 {"Blood Single Player", 8, 10},
3151 {"Plasma Pack", 18, 6},
3152 {"Cryptic Passage", 24, 2},
3154 {"Transfusion", 31, 9},
3155 {"Conversions", 40, 6}
3158 level_t goodvsbad2levels[] =
3160 {"rts", "Many Paths"}, // 0
3161 {"chess", "Chess, Scott Hess"}, // 1
3162 {"dot", "Big Wall"},
3163 {"city2", "The Big City"},
3164 {"bwall", "0 G like Psychic TV"},
3165 {"snow", "Wireframed"},
3166 {"telep", "Infinite Falling"},
3167 {"faces", "Facing Bases"},
3168 {"island", "Adventure Islands"},
3171 episode_t goodvsbad2episodes[] =
3173 {"Levels? Bevels!", 0, 8},
3176 level_t battlemechlevels[] =
3178 {"start", "Parking Level"},
3179 {"dm1", "Hot Dump"}, // 1
3180 {"dm2", "The Pits"},
3181 {"dm3", "Dimber Died"},
3182 {"dm4", "Fire in the Hole"},
3183 {"dm5", "Clubhouses"},
3184 {"dm6", "Army go Underground"},
3187 episode_t battlemechepisodes[] =
3189 {"Time for Battle", 0, 7},
3192 level_t openquartzlevels[] =
3194 {"start", "Welcome to Openquartz"},
3196 {"void1", "The center of nowhere"}, // 1
3197 {"void2", "The place with no name"},
3198 {"void3", "The lost supply base"},
3199 {"void4", "Past the outer limits"},
3200 {"void5", "Into the nonexistance"},
3201 {"void6", "Void walk"},
3203 {"vtest", "Warp Central"},
3204 {"box", "The deathmatch box"},
3205 {"bunkers", "Void command"},
3206 {"house", "House of chaos"},
3207 {"office", "Overnight office kill"},
3208 {"am1", "The nameless chambers"},
3211 episode_t openquartzepisodes[] =
3213 {"Single Player", 0, 1},
3214 {"Void Deathmatch", 1, 6},
3218 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
3219 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
3220 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
3221 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
3222 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
3223 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
3224 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
3225 gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
3226 gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
3231 gamelevels_t *notregistered;
3232 gamelevels_t *registered;
3236 gameinfo_t gamelist[] =
3238 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3239 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3240 {GAME_ROGUE, &roguegame, &roguegame},
3241 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3242 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3243 {GAME_GOODVSBAD2, &goodvsbad2game, &goodvsbad2game},
3244 {GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
3245 {GAME_OPENQUARTZ, &openquartzgame, &openquartzgame},
3246 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3249 gamelevels_t *lookupgameinfo(void)
3252 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3253 if (registered.integer)
3254 return gamelist[i].registered;
3256 return gamelist[i].notregistered;
3262 qboolean m_serverInfoMessage = false;
3263 double m_serverInfoMessageTime;
3265 extern cvar_t sv_public;
3266 extern cvar_t sv_maxrate;
3268 void M_Menu_GameOptions_f (void)
3270 key_dest = key_menu;
3271 m_state = m_gameoptions;
3272 m_entersound = true;
3273 if (maxplayers == 0)
3274 maxplayers = svs.maxclients;
3276 maxplayers = min(8, MAX_SCOREBOARD);
3280 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168};
3281 #define NUM_GAMEOPTIONS 12
3282 int gameoptions_cursor;
3284 void M_GameOptions_Draw (void)
3290 M_Background(320, 200);
3292 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3293 p = Draw_CachePic ("gfx/p_multi.lmp");
3294 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3296 M_DrawTextBox (152, 32, 10, 1);
3297 M_Print(160, 40, "begin game");
3299 M_Print(0, 56, " Max players");
3300 M_Print(160, 56, va("%i", maxplayers) );
3302 if (gamemode != GAME_GOODVSBAD2)
3304 M_Print(0, 64, " Game Type");
3305 if (gamemode == GAME_TRANSFUSION)
3307 if (!deathmatch.integer)
3308 Cvar_SetValue("deathmatch", 1);
3309 if (deathmatch.integer == 2)
3310 M_Print(160, 64, "Capture the Flag");
3312 M_Print(160, 64, "Blood Bath");
3314 else if (gamemode == GAME_BATTLEMECH)
3316 if (!deathmatch.integer)
3317 Cvar_SetValue("deathmatch", 1);
3318 if (deathmatch.integer == 2)
3319 M_Print(160, 64, "Rambo Match");
3321 M_Print(160, 64, "Deathmatch");
3325 if (!coop.integer && !deathmatch.integer)
3326 Cvar_SetValue("deathmatch", 1);
3328 M_Print(160, 64, "Cooperative");
3330 M_Print(160, 64, "Deathmatch");
3333 M_Print(0, 72, " Teamplay");
3334 if (gamemode == GAME_ROGUE)
3338 switch((int)teamplay.integer)
3340 case 1: msg = "No Friendly Fire"; break;
3341 case 2: msg = "Friendly Fire"; break;
3342 case 3: msg = "Tag"; break;
3343 case 4: msg = "Capture the Flag"; break;
3344 case 5: msg = "One Flag CTF"; break;
3345 case 6: msg = "Three Team CTF"; break;
3346 default: msg = "Off"; break;
3348 M_Print(160, 72, msg);
3354 switch (teamplay.integer)
3356 case 0: msg = "Off"; break;
3357 case 2: msg = "Friendly Fire"; break;
3358 default: msg = "No Friendly Fire"; break;
3360 M_Print(160, 72, msg);
3363 M_Print(0, 80, " Skill");
3364 if (skill.integer == 0)
3365 M_Print(160, 80, "Easy difficulty");
3366 else if (skill.integer == 1)
3367 M_Print(160, 80, "Normal difficulty");
3368 else if (skill.integer == 2)
3369 M_Print(160, 80, "Hard difficulty");
3371 M_Print(160, 80, "Nightmare difficulty");
3373 M_Print(0, 88, " Frag Limit");
3374 if (fraglimit.integer == 0)
3375 M_Print(160, 88, "none");
3377 M_Print(160, 88, va("%i frags", fraglimit.integer));
3379 M_Print(0, 96, " Time Limit");
3380 if (timelimit.integer == 0)
3381 M_Print(160, 96, "none");
3383 M_Print(160, 96, va("%i minutes", timelimit.integer));
3386 M_Print(0, 104, " Public server");
3387 M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes");
3389 M_Print(0, 112, " Server maxrate");
3390 M_Print(160, 112, va("%i", sv_maxrate.integer));
3392 M_Print(0, 128, " Server name");
3393 M_DrawTextBox (0, 132, 38, 1);
3394 M_Print(8, 140, hostname.string);
3396 g = lookupgameinfo();
3398 if (gamemode != GAME_GOODVSBAD2)
3400 M_Print(0, 160, " Episode");
3401 M_Print(160, 160, g->episodes[startepisode].description);
3404 M_Print(0, 168, " Level");
3405 M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3406 M_Print(160, 176, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3409 if (gameoptions_cursor == 9)
3410 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3412 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3414 if (m_serverInfoMessage)
3416 if ((realtime - m_serverInfoMessageTime) < 5.0)
3419 M_DrawTextBox (x, 138, 24, 4);
3421 M_Print(x, 146, " More than 64 players?? ");
3422 M_Print(x, 154, " First, question your ");
3423 M_Print(x, 162, " sanity, then email ");
3424 M_Print(x, 170, " havoc@telefragged.com ");
3427 m_serverInfoMessage = false;
3432 void M_NetStart_Change (int dir)
3437 switch (gameoptions_cursor)
3441 if (maxplayers > MAX_SCOREBOARD)
3443 maxplayers = MAX_SCOREBOARD;
3444 m_serverInfoMessage = true;
3445 m_serverInfoMessageTime = realtime;
3452 if (gamemode == GAME_GOODVSBAD2)
3454 if (gamemode == GAME_TRANSFUSION)
3456 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3457 Cvar_SetValueQuick (&deathmatch, 0);
3458 else // changing from BloodBath to CTF
3459 Cvar_SetValueQuick (&deathmatch, 2);
3461 else if (gamemode == GAME_BATTLEMECH)
3463 if (deathmatch.integer == 2) // changing from Rambo to Deathmatch
3464 Cvar_SetValueQuick (&deathmatch, 0);
3465 else // changing from Deathmatch to Rambo
3466 Cvar_SetValueQuick (&deathmatch, 2);
3470 if (deathmatch.integer) // changing from deathmatch to coop
3472 Cvar_SetValueQuick (&coop, 1);
3473 Cvar_SetValueQuick (&deathmatch, 0);
3475 else // changing from coop to deathmatch
3477 Cvar_SetValueQuick (&coop, 0);
3478 Cvar_SetValueQuick (&deathmatch, 1);
3484 if (gamemode == GAME_GOODVSBAD2)
3486 if (gamemode == GAME_ROGUE)
3491 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3492 if (teamplay.integer > count)
3493 Cvar_SetValueQuick (&teamplay, 0);
3494 else if (teamplay.integer < 0)
3495 Cvar_SetValueQuick (&teamplay, count);
3499 if (gamemode == GAME_GOODVSBAD2)
3501 Cvar_SetValueQuick (&skill, skill.integer + dir);
3502 if (skill.integer > 3)
3503 Cvar_SetValueQuick (&skill, 0);
3504 if (skill.integer < 0)
3505 Cvar_SetValueQuick (&skill, 3);
3509 if (gamemode == GAME_GOODVSBAD2)
3511 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3512 if (fraglimit.integer > 100)
3513 Cvar_SetValueQuick (&fraglimit, 0);
3514 if (fraglimit.integer < 0)
3515 Cvar_SetValueQuick (&fraglimit, 100);
3519 if (gamemode == GAME_GOODVSBAD2)
3521 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3522 if (timelimit.value > 60)
3523 Cvar_SetValueQuick (&timelimit, 0);
3524 if (timelimit.value < 0)
3525 Cvar_SetValueQuick (&timelimit, 60);
3529 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3533 Cvar_SetValueQuick (&sv_maxrate, sv_maxrate.integer + dir*500);
3534 if (sv_maxrate.integer > NET_MAXRATE)
3535 Cvar_SetValueQuick (&sv_maxrate, NET_MAXRATE);
3536 if (sv_maxrate.integer < NET_MINRATE)
3537 Cvar_SetValueQuick (&sv_maxrate, NET_MINRATE);
3544 if (gamemode == GAME_GOODVSBAD2)
3546 startepisode += dir;
3547 g = lookupgameinfo();
3549 if (startepisode < 0)
3550 startepisode = g->numepisodes - 1;
3552 if (startepisode >= g->numepisodes)
3560 g = lookupgameinfo();
3563 startlevel = g->episodes[startepisode].levels - 1;
3565 if (startlevel >= g->episodes[startepisode].levels)
3571 void M_GameOptions_Key (int key, char ascii)
3575 char hostnamebuf[128];
3580 M_Menu_MultiPlayer_f ();
3584 S_LocalSound ("misc/menu1.wav", true);
3585 gameoptions_cursor--;
3586 if (gameoptions_cursor < 0)
3587 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3591 S_LocalSound ("misc/menu1.wav", true);
3592 gameoptions_cursor++;
3593 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3594 gameoptions_cursor = 0;
3598 if (gameoptions_cursor == 0)
3600 S_LocalSound ("misc/menu3.wav", true);
3601 M_NetStart_Change (-1);
3605 if (gameoptions_cursor == 0)
3607 S_LocalSound ("misc/menu3.wav", true);
3608 M_NetStart_Change (1);
3612 S_LocalSound ("misc/menu2.wav", true);
3613 if (gameoptions_cursor == 0)
3616 Cbuf_AddText ("disconnect\n");
3617 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3619 g = lookupgameinfo();
3620 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3624 M_NetStart_Change (1);
3628 if (gameoptions_cursor == 9)
3630 l = strlen(hostname.string);
3634 memcpy(hostnamebuf, hostname.string, l);
3636 Cvar_Set("hostname", hostnamebuf);
3642 if (ascii < 32 || ascii > 126)
3644 if (gameoptions_cursor == 9)
3646 l = strlen(hostname.string);
3649 memcpy(hostnamebuf, hostname.string, l);
3650 hostnamebuf[l] = ascii;
3651 hostnamebuf[l+1] = 0;
3652 Cvar_Set("hostname", hostnamebuf);
3658 //=============================================================================
3663 void M_Menu_ServerList_f (void)
3665 key_dest = key_menu;
3667 m_entersound = true;
3669 m_return_reason[0] = 0;
3674 void M_ServerList_Draw (void)
3676 int n, y, visible, start, end;
3680 // use as much vertical space as available
3681 M_Background(640, vid.conheight);
3682 // scroll the list as the cursor moves
3683 s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount);
3684 M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
3685 if (*m_return_reason)
3686 M_Print(16, vid.conheight - 8, m_return_reason);
3688 visible = (vid.conheight - 16 - y) / 8;
3689 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3690 end = min(start + visible, hostCacheCount);
3692 p = Draw_CachePic("gfx/p_multi.lmp");
3693 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3696 for (n = start;n < end;n++)
3698 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);
3699 M_Print(0, y, hostcache[n].line1);y += 8;
3700 M_Print(0, y, hostcache[n].line2);y += 8;
3703 else if (realtime - masterquerytime < 3)
3705 if (masterquerycount)
3706 M_Print(0, y, "No servers found");
3708 M_Print(0, y, "No master servers found (network problem?)");
3713 void M_ServerList_Key(int k, char ascii)
3718 M_Menu_LanConfig_f();
3727 S_LocalSound("misc/menu1.wav", true);
3729 if (slist_cursor < 0)
3730 slist_cursor = hostCacheCount - 1;
3735 S_LocalSound("misc/menu1.wav", true);
3737 if (slist_cursor >= hostCacheCount)
3742 S_LocalSound("misc/menu2.wav", true);
3743 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3752 //=============================================================================
3753 /* Menu Subsystem */
3755 void M_Keydown(int key, char ascii);
3757 void M_ToggleMenu_f(void);
3758 void M_Shutdown(void);
3762 menu_mempool = Mem_AllocPool("Menu", 0, NULL);
3763 menuplyr_load = true;
3764 menuplyr_pixels = NULL;
3766 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3767 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3768 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3769 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3770 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3771 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3772 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3773 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3774 Cmd_AddCommand ("menu_options_graphics", M_Menu_Options_Graphics_f);
3775 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3776 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3777 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3778 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3779 Cmd_AddCommand ("help", M_Menu_Help_f);
3780 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3782 if (gamemode == GAME_TRANSFUSION)
3784 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3785 bindnames = transfusionbindnames;
3787 else if (gamemode == GAME_GOODVSBAD2)
3789 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3790 bindnames = goodvsbad2bindnames;
3794 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3795 bindnames = quakebindnames;
3798 // Make sure "keys_cursor" doesn't start on a section in the binding list
3800 while (bindnames[keys_cursor][0][0] == '\0')
3804 // Only sections? There may be a problem somewhere...
3805 if (keys_cursor >= numcommands)
3806 Sys_Error ("M_Init: The key binding list only contains sections");
3810 if (gamemode == GAME_NEHAHRA)
3812 if (FS_FileExists("maps/neh1m4.bsp"))
3814 if (FS_FileExists("hearing.dem"))
3816 Con_Print("Nehahra movie and game detected.\n");
3817 NehGameType = TYPE_BOTH;
3821 Con_Print("Nehahra game detected.\n");
3822 NehGameType = TYPE_GAME;
3827 if (FS_FileExists("hearing.dem"))
3829 Con_Print("Nehahra movie detected.\n");
3830 NehGameType = TYPE_DEMO;
3834 Con_Print("Nehahra not found.\n");
3835 NehGameType = TYPE_GAME; // could just complain, but...
3843 if (key_dest != key_menu)
3846 if (m_state == m_none)
3862 case m_singleplayer:
3863 M_SinglePlayer_Draw ();
3875 M_MultiPlayer_Draw ();
3886 case m_options_effects:
3887 M_Options_Effects_Draw ();
3890 case m_options_graphics:
3891 M_Options_Graphics_Draw ();
3894 case m_options_colorcontrol:
3895 M_Options_ColorControl_Draw ();
3915 M_LanConfig_Draw ();
3919 M_GameOptions_Draw ();
3923 M_ServerList_Draw ();
3929 S_LocalSound ("misc/menu2.wav", true);
3930 m_entersound = false;
3937 void M_Keydown (int key, char ascii)
3945 M_Main_Key (key, ascii);
3949 M_Demo_Key (key, ascii);
3952 case m_singleplayer:
3953 M_SinglePlayer_Key (key, ascii);
3957 M_Load_Key (key, ascii);
3961 M_Save_Key (key, ascii);
3965 M_MultiPlayer_Key (key, ascii);
3969 M_Setup_Key (key, ascii);
3973 M_Options_Key (key, ascii);
3976 case m_options_effects:
3977 M_Options_Effects_Key (key, ascii);
3980 case m_options_graphics:
3981 M_Options_Graphics_Key (key, ascii);
3984 case m_options_colorcontrol:
3985 M_Options_ColorControl_Key (key, ascii);
3989 M_Keys_Key (key, ascii);
3993 M_Video_Key (key, ascii);
3997 M_Help_Key (key, ascii);
4001 M_Quit_Key (key, ascii);
4005 M_LanConfig_Key (key, ascii);
4009 M_GameOptions_Key (key, ascii);
4013 M_ServerList_Key (key, ascii);
4018 void M_Shutdown(void)
4021 key_dest = key_game;
4024 void M_Restart(void)
4028 //============================================================================
4029 // Menu prog handling
4030 mfunction_t *PRVM_ED_FindFunction(const char *);
4032 #define M_F_INIT "m_init"
4033 #define M_F_KEYDOWN "m_keydown"
4034 #define M_F_DRAW "m_draw"
4035 // ng_menu function names
4036 #define M_F_DISPLAY "m_display"
4037 #define M_F_HIDE "m_hide"
4038 // normal menu names (rest)
4039 #define M_F_TOGGLE "m_toggle"
4040 #define M_F_SHUTDOWN "m_shutdown"
4042 static char *m_required_func[] = {
4056 qboolean m_displayed;
4059 static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
4061 static func_t m_draw, m_keydown;
4063 void MR_SetRouting (qboolean forceold);
4067 // fall back to the normal menu
4070 Con_Print("Falling back to normal menu\n");
4072 key_dest = key_game;
4076 // init the normal menu now -> this will also correct the menu router pointers
4077 MR_SetRouting (TRUE);
4080 void MP_Keydown (int key, char ascii)
4083 PRVM_SetProg(PRVM_MENUPROG);
4086 *prog->time = realtime;
4089 prog->globals[OFS_PARM0] = (float) key;
4090 prog->globals[OFS_PARM1] = (float) ascii;
4091 PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
4099 PRVM_SetProg(PRVM_MENUPROG);
4102 *prog->time = realtime;
4104 PRVM_ExecuteProgram(m_draw,"");
4109 void MP_ToggleMenu_f (void)
4112 PRVM_SetProg(PRVM_MENUPROG);
4115 *prog->time = realtime;
4118 m_displayed = !m_displayed;
4120 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_DISPLAY) - prog->functions),"");
4122 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_HIDE) - prog->functions),"");
4124 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_TOGGLE) - prog->functions),"");
4130 void MP_Shutdown (void)
4133 PRVM_SetProg(PRVM_MENUPROG);
4136 *prog->time = realtime;
4138 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_SHUTDOWN) - prog->functions),"");
4141 key_dest = key_game;
4143 // AK not using this cause Im not sure whether this is useful at all instead :
4152 PRVM_InitProg(PRVM_MENUPROG);
4154 prog->crc = M_PROGHEADER_CRC;
4155 prog->edictprivate_size = 0; // no private struct used
4156 prog->name = M_NAME;
4157 prog->limit_edicts = M_MAX_EDICTS;
4158 prog->extensionstring = vm_m_extensions;
4159 prog->builtins = vm_m_builtins;
4160 prog->numbuiltins = vm_m_numbuiltins;
4161 prog->init_cmd = VM_M_Cmd_Init;
4162 prog->reset_cmd = VM_M_Cmd_Reset;
4163 prog->error_cmd = MP_Error;
4165 // allocate the mempools
4166 prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool", 0, NULL);
4167 prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool", 0, NULL);
4168 prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL);
4170 PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func);
4172 // set m_draw and m_keydown
4173 m_draw = (func_t) (PRVM_ED_FindFunction(M_F_DRAW) - prog->functions);
4174 m_keydown = (func_t) (PRVM_ED_FindFunction(M_F_KEYDOWN) - prog->functions);
4177 m_displayed = false;
4181 *prog->time = realtime;
4183 // call the prog init
4184 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_INIT) - prog->functions),"");
4189 void MP_Restart(void)
4195 //============================================================================
4198 static cvar_t forceqmenu = { 0, "forceqmenu", "0" };
4200 void MR_SetRouting(qboolean forceold)
4202 static qboolean m_init = FALSE, mp_init = FALSE;
4204 // if the menu prog isnt available or forceqmenu ist set, use the old menu
4205 if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold)
4207 // set menu router function pointers
4208 MR_Keydown = M_Keydown;
4210 MR_ToggleMenu_f = M_ToggleMenu_f;
4211 MR_Shutdown = M_Shutdown;
4224 // set menu router function pointers
4225 MR_Keydown = MP_Keydown;
4227 MR_ToggleMenu_f = MP_ToggleMenu_f;
4228 MR_Shutdown = MP_Shutdown;
4240 void MR_Restart(void)
4243 MR_SetRouting (FALSE);
4246 void Call_MR_ToggleMenu_f(void)
4254 // set router console commands
4255 Cvar_RegisterVariable (&forceqmenu);
4256 if (gamemode == GAME_NETHERWORLD)
4257 Cmd_AddCommand ("menu_fallback", MP_Error); //Force to old-style menu
4258 Cmd_AddCommand ("menu_restart",MR_Restart);
4259 Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f);
4261 // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
4262 if(COM_CheckParm("-forceqmenu"))
4263 Cvar_SetValueQuick(&forceqmenu,1);
4264 // use -useqmenu for debugging proposes, cause it starts
4265 // the normal quake menu only the first time
4266 if(COM_CheckParm("-useqmenu"))
4267 MR_SetRouting (TRUE);
4269 MR_SetRouting (FALSE);