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_Reset_f (void);
47 void M_Menu_Video_f (void);
48 void M_Menu_Help_f (void);
49 void M_Menu_Quit_f (void);
50 void M_Menu_LanConfig_f (void);
51 void M_Menu_GameOptions_f (void);
52 void M_Menu_ServerList_f (void);
54 void M_Main_Draw (void);
55 void M_SinglePlayer_Draw (void);
56 void M_Load_Draw (void);
57 void M_Save_Draw (void);
58 void M_MultiPlayer_Draw (void);
59 void M_Setup_Draw (void);
60 void M_Options_Draw (void);
61 void M_Options_Effects_Draw (void);
62 void M_Options_Graphics_Draw (void);
63 void M_Options_ColorControl_Draw (void);
64 void M_Keys_Draw (void);
65 void M_Reset_Draw (void);
66 void M_Video_Draw (void);
67 void M_Help_Draw (void);
68 void M_Quit_Draw (void);
69 void M_LanConfig_Draw (void);
70 void M_GameOptions_Draw (void);
71 void M_ServerList_Draw (void);
73 void M_Main_Key (int key, char ascii);
74 void M_SinglePlayer_Key (int key, char ascii);
75 void M_Load_Key (int key, char ascii);
76 void M_Save_Key (int key, char ascii);
77 void M_MultiPlayer_Key (int key, char ascii);
78 void M_Setup_Key (int key, char ascii);
79 void M_Options_Key (int key, char ascii);
80 void M_Options_Effects_Key (int key, char ascii);
81 void M_Options_Graphics_Key (int key, char ascii);
82 void M_Options_ColorControl_Key (int key, char ascii);
83 void M_Keys_Key (int key, char ascii);
84 void M_Reset_Key (int key, char ascii);
85 void M_Video_Key (int key, char ascii);
86 void M_Help_Key (int key, char ascii);
87 void M_Quit_Key (int key, char ascii);
88 void M_LanConfig_Key (int key, char ascii);
89 void M_GameOptions_Key (int key, char ascii);
90 void M_ServerList_Key (int key, char ascii);
92 qboolean m_entersound; // play after drawing a frame, so caching
93 // won't disrupt the sound
95 char m_return_reason [32];
97 #define StartingGame (m_multiplayer_cursor == 1)
98 #define JoiningGame (m_multiplayer_cursor == 0)
101 #define NumberOfNehahraDemos 34
106 } nehahrademonames_t;
108 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
110 {"intro", "Prologue"},
111 {"genf", "The Beginning"},
112 {"genlab", "A Doomed Project"},
113 {"nehcre", "The New Recruits"},
114 {"maxneh", "Breakthrough"},
115 {"maxchar", "Renewal and Duty"},
116 {"crisis", "Worlds Collide"},
117 {"postcris", "Darkening Skies"},
118 {"hearing", "The Hearing"},
119 {"getjack", "On a Mexican Radio"},
120 {"prelude", "Honor and Justice"},
121 {"abase", "A Message Sent"},
122 {"effect", "The Other Side"},
123 {"uhoh", "Missing in Action"},
124 {"prepare", "The Response"},
125 {"vision", "Farsighted Eyes"},
126 {"maxturns", "Enter the Immortal"},
127 {"backlot", "Separate Ways"},
128 {"maxside", "The Ancient Runes"},
129 {"counter", "The New Initiative"},
130 {"warprep", "Ghosts to the World"},
131 {"counter1", "A Fate Worse Than Death"},
132 {"counter2", "Friendly Fire"},
133 {"counter3", "Minor Setback"},
134 {"madmax", "Scores to Settle"},
135 {"quake", "One Man"},
136 {"cthmm", "Shattered Masks"},
137 {"shades", "Deal with the Dead"},
138 {"gophil", "An Unlikely Hero"},
139 {"cstrike", "War in Hell"},
140 {"shubset", "The Conspiracy"},
141 {"shubdie", "Even Death May Die"},
142 {"newranks", "An Empty Throne"},
143 {"seal", "The Seal is Broken"}
146 float menu_x, menu_y, menu_width, menu_height;
148 void M_Background(int width, int height)
151 menu_height = height;
152 menu_x = (vid.conwidth - menu_width) * 0.5;
153 menu_y = (vid.conheight - menu_height) * 0.5;
154 //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
155 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
162 Draws one solid graphics character
165 void M_DrawCharacter (float cx, float cy, int num)
170 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
173 void M_Print(float cx, float cy, const char *str)
175 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
178 void M_PrintRed (float cx, float cy, const char *str)
180 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
183 void M_ItemPrint(float cx, float cy, char *str, int unghosted)
186 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
188 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
191 void M_DrawPic (float cx, float cy, char *picname)
193 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
196 qbyte identityTable[256];
197 qbyte translationTable[256];
199 void M_BuildTranslationTable(int top, int bottom)
202 qbyte *dest, *source;
204 for (j = 0; j < 256; j++)
205 identityTable[j] = j;
206 dest = translationTable;
207 source = identityTable;
208 memcpy (dest, source, 256);
210 // LordHavoc: corrected skin color ranges
211 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
212 memcpy (dest + TOP_RANGE, source + top, 16);
214 for (j=0 ; j<16 ; j++)
215 dest[TOP_RANGE+j] = source[top+15-j];
217 // LordHavoc: corrected skin color ranges
218 if (bottom < 128 || (bottom >= 224 && bottom < 240))
219 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
221 for (j=0 ; j<16 ; j++)
222 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
226 void M_DrawTextBox (float x, float y, float width, float height)
234 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
235 for (n = 0; n < height; n++)
238 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
240 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
247 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
248 for (n = 0; n < height; n++)
252 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
254 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
256 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
263 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
264 for (n = 0; n < height; n++)
267 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
269 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
272 //=============================================================================
274 //int m_save_demonum;
281 void M_ToggleMenu_f (void)
285 if (key_dest != key_menu || m_state != m_main)
296 void M_Demo_Draw (void)
300 M_Background(320, 200);
302 for (i = 0;i < NumberOfNehahraDemos;i++)
303 M_Print(16, 16 + 8*i, NehahraDemos[i].desc);
306 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
310 void M_Menu_Demos_f (void)
317 void M_Demo_Key (int k, char ascii)
326 S_LocalSound ("misc/menu2.wav", true);
329 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
334 S_LocalSound ("misc/menu1.wav", true);
337 demo_cursor = NumberOfNehahraDemos-1;
342 S_LocalSound ("misc/menu1.wav", true);
344 if (demo_cursor >= NumberOfNehahraDemos)
350 //=============================================================================
355 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
357 void M_Menu_Main_f (void)
359 if (gamemode == GAME_NEHAHRA)
361 if (NehGameType == TYPE_DEMO)
363 else if (NehGameType == TYPE_GAME)
368 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
374 if (key_dest != key_menu)
376 m_save_demonum = cls.demonum;
386 void M_Main_Draw (void)
391 M_Background(320, 200);
393 M_DrawPic (16, 4, "gfx/qplaque.lmp");
394 p = Draw_CachePic ("gfx/ttl_main.lmp");
395 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
397 if (gamemode == GAME_NEHAHRA)
399 if (NehGameType == TYPE_BOTH)
400 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
401 else if (NehGameType == TYPE_GAME)
402 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
404 M_DrawPic (72, 32, "gfx/demomenu.lmp");
407 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
409 f = (int)(realtime * 10)%6;
411 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
415 void M_Main_Key (int key, char ascii)
422 //cls.demonum = m_save_demonum;
423 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
428 S_LocalSound ("misc/menu1.wav", true);
429 if (++m_main_cursor >= MAIN_ITEMS)
434 S_LocalSound ("misc/menu1.wav", true);
435 if (--m_main_cursor < 0)
436 m_main_cursor = MAIN_ITEMS - 1;
442 if (gamemode == GAME_NEHAHRA)
447 switch (m_main_cursor)
450 M_Menu_SinglePlayer_f ();
458 M_Menu_MultiPlayer_f ();
468 Cbuf_AddText ("disconnect\n");
469 Cbuf_AddText ("playdemo endcred\n");
478 switch (m_main_cursor)
481 M_Menu_SinglePlayer_f ();
485 M_Menu_MultiPlayer_f ();
495 Cbuf_AddText ("disconnect\n");
496 Cbuf_AddText ("playdemo endcred\n");
505 switch (m_main_cursor)
514 Cbuf_AddText ("disconnect\n");
515 Cbuf_AddText ("playdemo endcred\n");
529 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
531 switch (m_main_cursor)
534 M_Menu_SinglePlayer_f ();
538 M_Menu_MultiPlayer_f ();
559 switch (m_main_cursor)
562 M_Menu_SinglePlayer_f ();
566 M_Menu_MultiPlayer_f ();
585 //=============================================================================
586 /* SINGLE PLAYER MENU */
588 int m_singleplayer_cursor;
589 #define SINGLEPLAYER_ITEMS 3
592 void M_Menu_SinglePlayer_f (void)
595 m_state = m_singleplayer;
600 void M_SinglePlayer_Draw (void)
604 M_Background(320, 200);
606 M_DrawPic (16, 4, "gfx/qplaque.lmp");
607 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
609 // Transfusion doesn't have a single player mode
610 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
612 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
614 M_DrawTextBox (60, 8 * 8, 23, 4);
615 if (gamemode == GAME_NEXUIZ)
616 M_Print(95, 10 * 8, "Nexuiz is for");
617 else if (gamemode == GAME_GOODVSBAD2)
618 M_Print(95, 10 * 8, "Good Vs Bad 2 is for");
619 else if (gamemode == GAME_BATTLEMECH)
620 M_Print(95, 10 * 8, "Battlemech is for");
622 M_Print(95, 10 * 8, "Transfusion is for");
623 M_Print(83, 11 * 8, "multiplayer play only");
629 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
630 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
632 f = (int)(realtime * 10)%6;
634 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
639 void M_SinglePlayer_Key (int key, char ascii)
641 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
643 if (key == K_ESCAPE || key == K_ENTER)
655 S_LocalSound ("misc/menu1.wav", true);
656 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
657 m_singleplayer_cursor = 0;
661 S_LocalSound ("misc/menu1.wav", true);
662 if (--m_singleplayer_cursor < 0)
663 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
669 switch (m_singleplayer_cursor)
674 Cbuf_AddText ("disconnect\n");
675 Cbuf_AddText ("maxplayers 1\n");
676 Cbuf_AddText ("deathmatch 0\n");
677 Cbuf_AddText ("coop 0\n");
678 if (gamemode == GAME_NEHAHRA)
679 Cbuf_AddText ("map nehstart\n");
681 Cbuf_AddText ("map start\n");
695 //=============================================================================
698 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
700 #define MAX_SAVEGAMES 12
701 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
702 int loadable[MAX_SAVEGAMES];
704 void M_ScanSaves (void)
707 char name[MAX_OSPATH];
712 for (i=0 ; i<MAX_SAVEGAMES ; i++)
714 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
716 sprintf (name, "s%i.sav", i);
717 f = FS_Open (name, "r", false);
720 str = FS_Getline (f);
721 sscanf (str, "%i\n", &version);
722 str = FS_Getline (f);
723 strlcpy (m_filenames[i], str, sizeof (m_filenames[i]));
725 // change _ back to space
726 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
727 if (m_filenames[i][j] == '_')
728 m_filenames[i][j] = ' ';
734 void M_Menu_Load_f (void)
743 void M_Menu_Save_f (void)
758 void M_Load_Draw (void)
763 M_Background(320, 200);
765 p = Draw_CachePic ("gfx/p_load.lmp");
766 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
768 for (i=0 ; i< MAX_SAVEGAMES; i++)
769 M_Print(16, 32 + 8*i, m_filenames[i]);
772 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
776 void M_Save_Draw (void)
781 M_Background(320, 200);
783 p = Draw_CachePic ("gfx/p_save.lmp");
784 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
786 for (i=0 ; i<MAX_SAVEGAMES ; i++)
787 M_Print(16, 32 + 8*i, m_filenames[i]);
790 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
794 void M_Load_Key (int k, char ascii)
799 M_Menu_SinglePlayer_f ();
803 S_LocalSound ("misc/menu2.wav", true);
804 if (!loadable[load_cursor])
809 // issue the load command
810 Cbuf_AddText (va ("load s%i\n", load_cursor) );
815 S_LocalSound ("misc/menu1.wav", true);
818 load_cursor = MAX_SAVEGAMES-1;
823 S_LocalSound ("misc/menu1.wav", true);
825 if (load_cursor >= MAX_SAVEGAMES)
832 void M_Save_Key (int k, char ascii)
837 M_Menu_SinglePlayer_f ();
843 Cbuf_AddText (va("save s%i\n", load_cursor));
848 S_LocalSound ("misc/menu1.wav", true);
851 load_cursor = MAX_SAVEGAMES-1;
856 S_LocalSound ("misc/menu1.wav", true);
858 if (load_cursor >= MAX_SAVEGAMES)
864 //=============================================================================
865 /* MULTIPLAYER MENU */
867 int m_multiplayer_cursor;
868 #define MULTIPLAYER_ITEMS 3
871 void M_Menu_MultiPlayer_f (void)
874 m_state = m_multiplayer;
879 void M_MultiPlayer_Draw (void)
884 M_Background(320, 200);
886 M_DrawPic (16, 4, "gfx/qplaque.lmp");
887 p = Draw_CachePic ("gfx/p_multi.lmp");
888 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
889 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
891 f = (int)(realtime * 10)%6;
893 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
897 void M_MultiPlayer_Key (int key, char ascii)
906 S_LocalSound ("misc/menu1.wav", true);
907 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
908 m_multiplayer_cursor = 0;
912 S_LocalSound ("misc/menu1.wav", true);
913 if (--m_multiplayer_cursor < 0)
914 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
919 switch (m_multiplayer_cursor)
923 M_Menu_LanConfig_f ();
933 //=============================================================================
936 int setup_cursor = 4;
937 int setup_cursor_table[] = {40, 64, 88, 124, 140};
939 char setup_myname[32];
947 #define NUM_SETUP_CMDS 5
949 void M_Menu_Setup_f (void)
954 strcpy(setup_myname, cl_name.string);
955 setup_top = setup_oldtop = cl_color.integer >> 4;
956 setup_bottom = setup_oldbottom = cl_color.integer & 15;
957 setup_rate = cl_rate.integer;
960 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
961 static qbyte *menuplyr_pixels;
962 static unsigned int *menuplyr_translated;
964 typedef struct ratetable_s
971 #define RATES ((int)(sizeof(setup_ratetable)/sizeof(setup_ratetable[0])))
972 static ratetable_t setup_ratetable[] =
975 {1500, "28.8 mediocre"},
977 {2500, "33.6 mediocre"},
980 {4000, "56k mediocre"},
981 {4500, "56k adequate"},
984 {15000, "128k ISDN"},
988 static int setup_rateindex(int rate)
991 for (i = 0;i < RATES;i++)
992 if (setup_ratetable[i].rate > setup_rate)
994 return bound(1, i, RATES) - 1;
997 void M_Setup_Draw (void)
1002 M_Background(320, 200);
1004 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1005 p = Draw_CachePic ("gfx/p_multi.lmp");
1006 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1008 M_Print(64, 40, "Your name");
1009 M_DrawTextBox (160, 32, 16, 1);
1010 M_Print(168, 40, setup_myname);
1012 if (gamemode != GAME_GOODVSBAD2)
1014 M_Print(64, 64, "Shirt color");
1015 M_Print(64, 88, "Pants color");
1018 M_Print(64, 124-8, "Network speed limit");
1019 M_Print(168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name));
1021 M_DrawTextBox (64, 140-8, 14, 1);
1022 M_Print(72, 140, "Accept Changes");
1024 // LordHavoc: rewrote this code greatly
1028 menuplyr_load = false;
1030 menuplyr_bottom = -1;
1031 if ((f = FS_LoadFile("gfx/menuplyr.lmp", tempmempool, true)))
1033 data = LoadLMPAs8Bit (f, 0, 0);
1034 menuplyr_width = image_width;
1035 menuplyr_height = image_height;
1037 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
1038 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
1039 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
1044 if (menuplyr_pixels)
1046 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
1048 menuplyr_top = setup_top;
1049 menuplyr_bottom = setup_bottom;
1050 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
1051 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
1052 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
1053 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
1055 M_DrawPic(160, 48, "gfx/bigbox.lmp");
1056 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
1059 if (setup_cursor == 0)
1060 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1062 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1066 void M_Setup_Key (int k, char ascii)
1073 M_Menu_MultiPlayer_f ();
1077 S_LocalSound ("misc/menu1.wav", true);
1079 if (setup_cursor < 0)
1080 setup_cursor = NUM_SETUP_CMDS-1;
1084 S_LocalSound ("misc/menu1.wav", true);
1086 if (setup_cursor >= NUM_SETUP_CMDS)
1091 if (setup_cursor < 1)
1093 S_LocalSound ("misc/menu3.wav", true);
1094 if (setup_cursor == 1)
1095 setup_top = setup_top - 1;
1096 if (setup_cursor == 2)
1097 setup_bottom = setup_bottom - 1;
1098 if (setup_cursor == 3)
1100 l = setup_rateindex(setup_rate) - 1;
1103 setup_rate = setup_ratetable[l].rate;
1107 if (setup_cursor < 1)
1110 S_LocalSound ("misc/menu3.wav", true);
1111 if (setup_cursor == 1)
1112 setup_top = setup_top + 1;
1113 if (setup_cursor == 2)
1114 setup_bottom = setup_bottom + 1;
1115 if (setup_cursor == 3)
1117 l = setup_rateindex(setup_rate) + 1;
1120 setup_rate = setup_ratetable[l].rate;
1125 if (setup_cursor == 0)
1128 if (setup_cursor == 1 || setup_cursor == 2 || setup_cursor == 3)
1131 // setup_cursor == 4 (Accept changes)
1132 if (strcmp(cl_name.string, setup_myname) != 0)
1133 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1134 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1135 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1136 if (setup_rate != setup_oldrate)
1137 Cbuf_AddText(va("rate %i\n", setup_rate));
1139 m_entersound = true;
1140 M_Menu_MultiPlayer_f ();
1144 if (setup_cursor == 0)
1146 if (strlen(setup_myname))
1147 setup_myname[strlen(setup_myname)-1] = 0;
1152 if (ascii < 32 || ascii > 126)
1154 if (setup_cursor == 0)
1156 l = strlen(setup_myname);
1159 setup_myname[l+1] = 0;
1160 setup_myname[l] = ascii;
1169 if (setup_bottom > 15)
1171 if (setup_bottom < 0)
1175 //=============================================================================
1178 #define SLIDER_RANGE 10
1180 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1185 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1186 M_DrawCharacter (x-8, y, 128);
1187 for (i = 0;i < SLIDER_RANGE;i++)
1188 M_DrawCharacter (x + i*8, y, 129);
1189 M_DrawCharacter (x+i*8, y, 130);
1190 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1191 if (fabs((int)num - num) < 0.01)
1192 sprintf(text, "%i", (int)num);
1194 sprintf(text, "%.2f", num);
1195 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1198 void M_DrawCheckbox (int x, int y, int on)
1201 M_Print(x, y, "on");
1203 M_Print(x, y, "off");
1207 #define OPTIONS_ITEMS 40
1211 void M_Menu_Options_f (void)
1213 key_dest = key_menu;
1214 m_state = m_options;
1215 m_entersound = true;
1218 extern cvar_t slowmo;
1219 extern dllhandle_t jpeg_dll;
1220 extern cvar_t gl_texture_anisotropy;
1221 extern cvar_t r_textshadow;
1223 void M_Menu_Options_AdjustSliders (int dir)
1226 S_LocalSound ("misc/menu3.wav", true);
1229 if (options_cursor == optnum++)
1230 Cvar_SetValueQuick (&vid_conwidth, bound(320, vid_conwidth.value + dir * 64, 2048));
1231 else if (options_cursor == optnum++)
1232 Cvar_SetValueQuick (&vid_conheight, bound(240, vid_conheight.value + dir * 48, 1536));
1233 else if (options_cursor == optnum++)
1234 Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
1235 else if (options_cursor == optnum++)
1236 Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
1237 else if (options_cursor == optnum++)
1238 Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1));
1239 else if (options_cursor == optnum++)
1240 Cvar_SetValueQuick (&sbar_alpha_bg, bound(0, sbar_alpha_bg.value + dir * 0.1, 1));
1241 else if (options_cursor == optnum++)
1242 Cvar_SetValueQuick (&sbar_alpha_fg, bound(0, sbar_alpha_fg.value + dir * 0.1, 1));
1243 else if (options_cursor == optnum++)
1244 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1245 else if (options_cursor == optnum++)
1246 Cvar_SetValueQuick (&scr_fov, bound(1, scr_fov.integer + dir * 1, 170));
1247 else if (options_cursor == optnum++)
1248 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1249 else if (options_cursor == optnum++)
1250 Cvar_SetValueQuick (&scr_screenshot_jpeg_quality, bound(0, scr_screenshot_jpeg_quality.value + dir * 0.1, 1));
1251 else if (options_cursor == optnum++)
1252 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1253 else if (options_cursor == optnum++)
1254 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1255 else if (options_cursor == optnum++)
1256 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1257 else if (options_cursor == optnum++)
1258 Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy));
1259 else if (options_cursor == optnum++)
1260 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1261 else if (options_cursor == optnum++)
1262 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1263 else if (options_cursor == optnum++)
1264 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1265 else if (options_cursor == optnum++)
1266 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1267 else if (options_cursor == optnum++)
1268 Cvar_SetValueQuick (&r_textshadow, !r_textshadow.integer);
1269 else if (options_cursor == optnum++)
1270 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1271 else if (options_cursor == optnum++)
1272 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1273 else if (options_cursor == optnum++)
1274 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1275 else if (options_cursor == optnum++)
1276 Cvar_SetValueQuick (&showfps, !showfps.integer);
1277 else if (options_cursor == optnum++)
1278 Cvar_SetValueQuick (&showtime, !showtime.integer);
1279 else if (options_cursor == optnum++)
1280 Cvar_SetValueQuick (&showdate, !showdate.integer);
1281 else if (options_cursor == optnum++)
1283 if (cl_forwardspeed.value > 200)
1285 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1286 Cvar_SetValueQuick (&cl_backspeed, 200);
1290 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1291 Cvar_SetValueQuick (&cl_backspeed, 400);
1294 else if (options_cursor == optnum++)
1295 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1296 else if (options_cursor == optnum++)
1297 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1298 else if (options_cursor == optnum++)
1299 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1300 else if (options_cursor == optnum++)
1301 Cvar_SetValueQuick (&freelook, !freelook.integer);
1302 else if (options_cursor == optnum++)
1303 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1304 else if (options_cursor == optnum++)
1305 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1312 void M_Options_PrintCommand(char *s, int enabled)
1316 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);
1317 M_ItemPrint(0, opty, s, enabled);
1323 void M_Options_PrintCheckbox(char *s, int enabled, int yes)
1327 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);
1328 M_ItemPrint(0, opty, s, enabled);
1329 M_DrawCheckbox(0 + strlen(s) * 8 + 8, opty, yes);
1335 void M_Options_PrintSlider(char *s, int enabled, float value, float minvalue, float maxvalue)
1339 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);
1340 M_ItemPrint(0, opty, s, enabled);
1341 M_DrawSlider(0 + strlen(s) * 8 + 8, opty, value, minvalue, maxvalue);
1347 void M_Options_Draw (void)
1352 M_Background(320, 240);
1354 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1355 p = Draw_CachePic("gfx/p_option.lmp");
1356 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1359 optcursor = options_cursor;
1360 visible = (vid.conheight - 32) / 8;
1361 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
1363 M_Options_PrintCommand( "Customize controls", true);
1364 M_Options_PrintCommand( " Go to console", true);
1365 M_Options_PrintCommand( " Reset to defaults", true);
1366 M_Options_PrintCommand( " Video", true);
1367 M_Options_PrintCommand( " Effects", true);
1368 M_Options_PrintCommand( " Graphics", true);
1369 M_Options_PrintCommand( " Color Control", true);
1370 M_Options_PrintSlider( " 2D Screen Width ", true, vid_conwidth.value, 320, 2048);
1371 M_Options_PrintSlider( " 2D Screen Height", true, vid_conheight.value, 240, 1536);
1372 M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000);
1373 M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1);
1374 M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1);
1375 M_Options_PrintSlider( " Sbar Alpha BG", true, sbar_alpha_bg.value, 0, 1);
1376 M_Options_PrintSlider( " Sbar Alpha FG", true, sbar_alpha_fg.value, 0, 1);
1377 M_Options_PrintSlider( " Screen size", true, scr_viewsize.value, 30, 120);
1378 M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
1379 M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
1380 M_Options_PrintSlider( " JPEG quality", jpeg_dll != NULL, scr_screenshot_jpeg_quality.value, 0, 1);
1381 M_Options_PrintCheckbox(" Sky", true, r_sky.integer);
1382 M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer);
1383 M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer);
1384 M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
1385 M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5);
1386 M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
1387 M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1);
1388 M_Options_PrintSlider(gamemode == GAME_GOODVSBAD2 ? " Music Volume" : " Ambient Volume", snd_initialized.integer, snd_staticvolume.value, 0, 1);
1389 M_Options_PrintCheckbox(" Text Shadow", true, r_textshadow.integer);
1390 M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5);
1391 M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5);
1392 M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer);
1393 M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
1394 M_Options_PrintCheckbox(" Show Time", true, showtime.integer);
1395 M_Options_PrintCheckbox(" Show Date", true, showdate.integer);
1396 M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
1397 M_Options_PrintCheckbox(" Lookspring", true, lookspring.integer);
1398 M_Options_PrintCheckbox(" Lookstrafe", true, lookstrafe.integer);
1399 M_Options_PrintSlider( " Mouse Speed", true, sensitivity.value, 1, 50);
1400 M_Options_PrintCheckbox(" Mouse Look", true, freelook.integer);
1401 M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
1402 M_Options_PrintCheckbox(" Use Mouse", true, vid_mouse.integer);
1406 void M_Options_Key (int k, char ascii)
1415 m_entersound = true;
1416 switch (options_cursor)
1423 key_dest = key_game;
1424 Con_ToggleConsole_f ();
1433 M_Menu_Options_Effects_f ();
1436 M_Menu_Options_Graphics_f ();
1439 M_Menu_Options_ColorControl_f ();
1442 M_Menu_Options_AdjustSliders (1);
1448 S_LocalSound ("misc/menu1.wav", true);
1450 if (options_cursor < 0)
1451 options_cursor = OPTIONS_ITEMS-1;
1455 S_LocalSound ("misc/menu1.wav", true);
1457 if (options_cursor >= OPTIONS_ITEMS)
1462 M_Menu_Options_AdjustSliders (-1);
1466 M_Menu_Options_AdjustSliders (1);
1471 #define OPTIONS_EFFECTS_ITEMS 37
1473 int options_effects_cursor;
1475 void M_Menu_Options_Effects_f (void)
1477 key_dest = key_menu;
1478 m_state = m_options_effects;
1479 m_entersound = true;
1483 extern cvar_t r_detailtextures;
1484 extern cvar_t cl_particles;
1485 extern cvar_t cl_stainmaps;
1486 extern cvar_t cl_stainmapsclearonload;
1487 extern cvar_t cl_decals;
1488 extern cvar_t r_explosionclip;
1489 extern cvar_t r_modellights;
1490 extern cvar_t r_coronas;
1491 extern cvar_t gl_flashblend;
1492 extern cvar_t cl_particles_quality;
1493 extern cvar_t cl_particles_bulletimpacts;
1494 extern cvar_t cl_particles_smoke;
1495 extern cvar_t cl_particles_sparks;
1496 extern cvar_t cl_particles_bubbles;
1497 extern cvar_t cl_particles_blood;
1498 extern cvar_t cl_particles_blood_alpha;
1499 extern cvar_t cl_particles_blood_bloodhack;
1500 extern cvar_t cl_particles_explosions_shell;
1501 extern cvar_t cl_beams_polygon;
1502 extern cvar_t cl_beams_relative;
1503 extern cvar_t cl_beams_lightatend;
1504 extern cvar_t r_lightningbeam_thickness;
1505 extern cvar_t r_lightningbeam_scroll;
1506 extern cvar_t r_lightningbeam_repeatdistance;
1507 extern cvar_t r_lightningbeam_color_red;
1508 extern cvar_t r_lightningbeam_color_green;
1509 extern cvar_t r_lightningbeam_color_blue;
1510 extern cvar_t r_lightningbeam_qmbtexture;
1512 void M_Menu_Options_Effects_AdjustSliders (int dir)
1515 S_LocalSound ("misc/menu3.wav", true);
1518 if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1519 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_coronas, bound(0, r_coronas.value + dir * 0.125, 4));
1520 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1521 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1522 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4));
1523 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_explosions_shell, !cl_particles_explosions_shell.integer);
1524 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1525 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1526 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmapsclearonload, !cl_stainmapsclearonload.integer);
1527 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer);
1528 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1529 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1530 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1531 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1532 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1533 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1534 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1535 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_bloodhack, !cl_particles_blood_bloodhack.integer);
1536 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_polygons, !cl_beams_polygons.integer);
1537 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_relative, !cl_beams_relative.integer);
1538 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_lightatend, !cl_beams_lightatend.integer);
1539 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_thickness, bound(1, r_lightningbeam_thickness.integer + dir, 10));
1540 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_scroll, bound(0, r_lightningbeam_scroll.integer + dir, 10));
1541 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_repeatdistance, bound(64, r_lightningbeam_repeatdistance.integer + dir * 64, 1024));
1542 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_red, bound(0, r_lightningbeam_color_red.value + dir * 0.1, 1));
1543 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_green, bound(0, r_lightningbeam_color_green.value + dir * 0.1, 1));
1544 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_blue, bound(0, r_lightningbeam_color_blue.value + dir * 0.1, 1));
1545 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_qmbtexture, !r_lightningbeam_qmbtexture.integer);
1546 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer);
1547 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer);
1548 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_polyblend, bound(0, gl_polyblend.value + dir * 0.1, 1));
1549 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll1, bound(-8, r_skyscroll1.value + dir * 0.1, 8));
1550 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll2, bound(-8, r_skyscroll2.value + dir * 0.1, 8));
1551 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterwarp, bound(0, r_waterwarp.value + dir * 0.1, 1));
1552 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_wateralpha, bound(0, r_wateralpha.value + dir * 0.1, 1));
1553 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
1554 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_watershader, bound(0, r_watershader.value + dir * 0.25, 10));
1557 void M_Options_Effects_Draw (void)
1562 M_Background(320, 200);
1564 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1565 p = Draw_CachePic("gfx/p_option.lmp");
1566 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1568 optcursor = options_effects_cursor;
1570 visible = (vid.conheight - 32) / 8;
1571 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
1573 M_Options_PrintSlider( " Lights Per Model", true, r_modellights.value, 0, 8);
1574 M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
1575 M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer);
1576 M_Options_PrintCheckbox(" Particles", true, cl_particles.integer);
1577 M_Options_PrintSlider( " Particles Quality", true, cl_particles_quality.value, 1, 4);
1578 M_Options_PrintCheckbox(" Explosion Shell", true, cl_particles_explosions_shell.integer);
1579 M_Options_PrintCheckbox(" Explosion Shell Clip", true, r_explosionclip.integer);
1580 M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer);
1581 M_Options_PrintCheckbox("Onload Clear Stainmaps", true, cl_stainmapsclearonload.integer);
1582 M_Options_PrintCheckbox(" Decals", true, cl_decals.integer);
1583 M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer);
1584 M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer);
1585 M_Options_PrintCheckbox(" Smoke", true, cl_particles_smoke.integer);
1586 M_Options_PrintCheckbox(" Sparks", true, cl_particles_sparks.integer);
1587 M_Options_PrintCheckbox(" Bubbles", true, cl_particles_bubbles.integer);
1588 M_Options_PrintCheckbox(" Blood", true, cl_particles_blood.integer);
1589 M_Options_PrintSlider( " Blood Opacity", true, cl_particles_blood_alpha.value, 0.2, 1);
1590 M_Options_PrintCheckbox("Force New Blood Effect", true, cl_particles_blood_bloodhack.integer);
1591 M_Options_PrintCheckbox(" Lightning Polygons", true, cl_beams_polygons.integer);
1592 M_Options_PrintCheckbox("Lightning Smooth Sweep", true, cl_beams_relative.integer);
1593 M_Options_PrintCheckbox(" Lightning End Light", true, cl_beams_lightatend.integer);
1594 M_Options_PrintSlider( " Lightning Thickness", cl_beams_polygons.integer, r_lightningbeam_thickness.integer, 1, 10);
1595 M_Options_PrintSlider( " Lightning Scroll", cl_beams_polygons.integer, r_lightningbeam_scroll.integer, 0, 10);
1596 M_Options_PrintSlider( " Lightning Repeat Dist", cl_beams_polygons.integer, r_lightningbeam_repeatdistance.integer, 64, 1024);
1597 M_Options_PrintSlider( " Lightning Color Red", cl_beams_polygons.integer, r_lightningbeam_color_red.value, 0, 1);
1598 M_Options_PrintSlider( " Lightning Color Green", cl_beams_polygons.integer, r_lightningbeam_color_green.value, 0, 1);
1599 M_Options_PrintSlider( " Lightning Color Blue", cl_beams_polygons.integer, r_lightningbeam_color_blue.value, 0, 1);
1600 M_Options_PrintCheckbox(" Lightning QMB Texture", cl_beams_polygons.integer, r_lightningbeam_qmbtexture.integer);
1601 M_Options_PrintCheckbox(" Model Interpolation", true, r_lerpmodels.integer);
1602 M_Options_PrintCheckbox(" Sprite Interpolation", true, r_lerpsprites.integer);
1603 M_Options_PrintSlider( " View Blend", true, gl_polyblend.value, 0, 1);
1604 M_Options_PrintSlider( "Upper Sky Scroll Speed", true, r_skyscroll1.value, -8, 8);
1605 M_Options_PrintSlider( "Lower Sky Scroll Speed", true, r_skyscroll2.value, -8, 8);
1606 M_Options_PrintSlider( " Underwater View Warp", true, r_waterwarp.value, 0, 1);
1607 M_Options_PrintSlider( " Water Alpha (opacity)", true, r_wateralpha.value, 0, 1);
1608 M_Options_PrintSlider( " Water Movement", true, r_waterscroll.value, 0, 10);
1609 M_Options_PrintSlider( " GeForce3 Water Shader", true, r_watershader.value, 0, 10);
1613 void M_Options_Effects_Key (int k, char ascii)
1618 M_Menu_Options_f ();
1622 M_Menu_Options_Effects_AdjustSliders (1);
1626 S_LocalSound ("misc/menu1.wav", true);
1627 options_effects_cursor--;
1628 if (options_effects_cursor < 0)
1629 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1633 S_LocalSound ("misc/menu1.wav", true);
1634 options_effects_cursor++;
1635 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1636 options_effects_cursor = 0;
1640 M_Menu_Options_Effects_AdjustSliders (-1);
1644 M_Menu_Options_Effects_AdjustSliders (1);
1650 #define OPTIONS_GRAPHICS_ITEMS 7
1652 int options_graphics_cursor;
1654 void M_Menu_Options_Graphics_f (void)
1656 key_dest = key_menu;
1657 m_state = m_options_graphics;
1658 m_entersound = true;
1661 extern cvar_t r_shadow_gloss;
1662 extern cvar_t r_shadow_realtime_dlight;
1663 extern cvar_t r_shadow_realtime_dlight_shadows;
1664 extern cvar_t r_shadow_realtime_world;
1665 extern cvar_t r_shadow_realtime_world_dlightshadows;
1666 extern cvar_t r_shadow_realtime_world_lightmaps;
1667 extern cvar_t r_shadow_realtime_world_shadows;
1669 void M_Menu_Options_Graphics_AdjustSliders (int dir)
1672 S_LocalSound ("misc/menu3.wav", true);
1676 if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_gloss, bound(0, r_shadow_gloss.integer + dir, 2));
1677 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight, !r_shadow_realtime_dlight.integer);
1678 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight_shadows, !r_shadow_realtime_dlight_shadows.integer);
1679 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world, !r_shadow_realtime_world.integer);
1680 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_dlightshadows, !r_shadow_realtime_world_dlightshadows.integer);
1681 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_lightmaps, bound(0, r_shadow_realtime_world_lightmaps.value + dir * 0.1, 1));
1682 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_shadows, !r_shadow_realtime_world_shadows.integer);
1686 void M_Options_Graphics_Draw (void)
1691 M_Background(320, 200);
1693 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1694 p = Draw_CachePic("gfx/p_option.lmp");
1695 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1697 optcursor = options_graphics_cursor;
1699 visible = (vid.conheight - 32) / 8;
1700 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
1702 M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
1703 M_Options_PrintCheckbox(" RT DLights", true, r_shadow_realtime_dlight.integer);
1704 M_Options_PrintCheckbox(" RT DLight Shadows", true, r_shadow_realtime_dlight_shadows.integer);
1705 M_Options_PrintCheckbox(" RT World", true, r_shadow_realtime_world.integer);
1706 M_Options_PrintCheckbox("RT World DLight Shadows", true, r_shadow_realtime_world_dlightshadows.integer);
1707 M_Options_PrintSlider( " RT World Lightmaps", true, r_shadow_realtime_world_lightmaps.value, 0, 1);
1708 M_Options_PrintCheckbox(" RT World Shadow", true, r_shadow_realtime_world_shadows.integer);
1712 void M_Options_Graphics_Key (int k, char ascii)
1717 M_Menu_Options_f ();
1721 M_Menu_Options_Graphics_AdjustSliders (1);
1725 S_LocalSound ("misc/menu1.wav", true);
1726 options_graphics_cursor--;
1727 if (options_graphics_cursor < 0)
1728 options_graphics_cursor = OPTIONS_GRAPHICS_ITEMS-1;
1732 S_LocalSound ("misc/menu1.wav", true);
1733 options_graphics_cursor++;
1734 if (options_graphics_cursor >= OPTIONS_GRAPHICS_ITEMS)
1735 options_graphics_cursor = 0;
1739 M_Menu_Options_Graphics_AdjustSliders (-1);
1743 M_Menu_Options_Graphics_AdjustSliders (1);
1749 #define OPTIONS_COLORCONTROL_ITEMS 18
1751 int options_colorcontrol_cursor;
1753 // intensity value to match up to 50% dither to 'correct' quake
1754 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1756 void M_Menu_Options_ColorControl_f (void)
1758 key_dest = key_menu;
1759 m_state = m_options_colorcontrol;
1760 m_entersound = true;
1764 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1768 S_LocalSound ("misc/menu3.wav", true);
1771 if (options_colorcontrol_cursor == optnum++)
1772 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1773 else if (options_colorcontrol_cursor == optnum++)
1775 Cvar_SetValueQuick (&v_color_enable, 0);
1776 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1778 else if (options_colorcontrol_cursor == optnum++)
1780 Cvar_SetValueQuick (&v_color_enable, 0);
1781 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1783 else if (options_colorcontrol_cursor == optnum++)
1785 Cvar_SetValueQuick (&v_color_enable, 0);
1786 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1788 else if (options_colorcontrol_cursor == optnum++)
1790 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1792 else if (options_colorcontrol_cursor == optnum++)
1794 Cvar_SetValueQuick (&v_color_enable, 1);
1795 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1797 else if (options_colorcontrol_cursor == optnum++)
1799 Cvar_SetValueQuick (&v_color_enable, 1);
1800 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1802 else if (options_colorcontrol_cursor == optnum++)
1804 Cvar_SetValueQuick (&v_color_enable, 1);
1805 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1807 else if (options_colorcontrol_cursor == optnum++)
1809 Cvar_SetValueQuick (&v_color_enable, 1);
1810 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1811 Cvar_SetValueQuick (&v_color_black_r, f);
1812 Cvar_SetValueQuick (&v_color_black_g, f);
1813 Cvar_SetValueQuick (&v_color_black_b, f);
1815 else if (options_colorcontrol_cursor == optnum++)
1817 Cvar_SetValueQuick (&v_color_enable, 1);
1818 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1820 else if (options_colorcontrol_cursor == optnum++)
1822 Cvar_SetValueQuick (&v_color_enable, 1);
1823 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1825 else if (options_colorcontrol_cursor == optnum++)
1827 Cvar_SetValueQuick (&v_color_enable, 1);
1828 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1830 else if (options_colorcontrol_cursor == optnum++)
1832 Cvar_SetValueQuick (&v_color_enable, 1);
1833 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1834 Cvar_SetValueQuick (&v_color_grey_r, f);
1835 Cvar_SetValueQuick (&v_color_grey_g, f);
1836 Cvar_SetValueQuick (&v_color_grey_b, f);
1838 else if (options_colorcontrol_cursor == optnum++)
1840 Cvar_SetValueQuick (&v_color_enable, 1);
1841 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1843 else if (options_colorcontrol_cursor == optnum++)
1845 Cvar_SetValueQuick (&v_color_enable, 1);
1846 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1848 else if (options_colorcontrol_cursor == optnum++)
1850 Cvar_SetValueQuick (&v_color_enable, 1);
1851 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1853 else if (options_colorcontrol_cursor == optnum++)
1855 Cvar_SetValueQuick (&v_color_enable, 1);
1856 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1857 Cvar_SetValueQuick (&v_color_white_r, f);
1858 Cvar_SetValueQuick (&v_color_white_g, f);
1859 Cvar_SetValueQuick (&v_color_white_b, f);
1863 void M_Options_ColorControl_Draw (void)
1866 float x, c, s, t, u, v;
1869 M_Background(320, 256);
1871 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1872 p = Draw_CachePic("gfx/p_option.lmp");
1873 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1875 optcursor = options_colorcontrol_cursor;
1877 visible = (vid.conheight - 32) / 8;
1878 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
1880 M_Options_PrintCommand( " Reset to defaults", true);
1881 M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer);
1882 M_Options_PrintSlider( " Gamma", !v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_gamma.value, 1, 5);
1883 M_Options_PrintSlider( " Contrast", !v_color_enable.integer, v_contrast.value, 1, 5);
1884 M_Options_PrintSlider( " Brightness", !v_color_enable.integer, v_brightness.value, 0, 0.8);
1885 M_Options_PrintCheckbox(" Color Level Controls", true, v_color_enable.integer);
1886 M_Options_PrintSlider( " Black: Red ", v_color_enable.integer, v_color_black_r.value, 0, 0.8);
1887 M_Options_PrintSlider( " Black: Green", v_color_enable.integer, v_color_black_g.value, 0, 0.8);
1888 M_Options_PrintSlider( " Black: Blue ", v_color_enable.integer, v_color_black_b.value, 0, 0.8);
1889 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);
1890 M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_r.value, 0, 0.95);
1891 M_Options_PrintSlider( " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_g.value, 0, 0.95);
1892 M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_b.value, 0, 0.95);
1893 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);
1894 M_Options_PrintSlider( " White: Red ", v_color_enable.integer, v_color_white_r.value, 1, 5);
1895 M_Options_PrintSlider( " White: Green", v_color_enable.integer, v_color_white_g.value, 1, 5);
1896 M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5);
1897 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);
1900 DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
1901 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1902 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1903 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;
1904 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;
1905 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;
1906 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;
1907 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;
1908 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;
1909 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;
1910 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;
1912 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1913 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1914 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1919 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, 0, 0, 1, 0);
1920 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);
1921 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);
1923 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, c, 0, 1, 0);
1924 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);
1925 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);
1927 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, 0, c, 1, 0);
1928 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);
1929 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);
1931 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, c, c, 1, 0);
1932 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);
1933 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);
1937 void M_Options_ColorControl_Key (int k, char ascii)
1942 M_Menu_Options_f ();
1946 m_entersound = true;
1947 switch (options_colorcontrol_cursor)
1950 Cvar_SetValueQuick(&v_hwgamma, 1);
1951 Cvar_SetValueQuick(&v_gamma, 1);
1952 Cvar_SetValueQuick(&v_contrast, 1);
1953 Cvar_SetValueQuick(&v_brightness, 0);
1954 Cvar_SetValueQuick(&v_color_enable, 0);
1955 Cvar_SetValueQuick(&v_color_black_r, 0);
1956 Cvar_SetValueQuick(&v_color_black_g, 0);
1957 Cvar_SetValueQuick(&v_color_black_b, 0);
1958 Cvar_SetValueQuick(&v_color_grey_r, 0);
1959 Cvar_SetValueQuick(&v_color_grey_g, 0);
1960 Cvar_SetValueQuick(&v_color_grey_b, 0);
1961 Cvar_SetValueQuick(&v_color_white_r, 1);
1962 Cvar_SetValueQuick(&v_color_white_g, 1);
1963 Cvar_SetValueQuick(&v_color_white_b, 1);
1966 M_Menu_Options_ColorControl_AdjustSliders (1);
1972 S_LocalSound ("misc/menu1.wav", true);
1973 options_colorcontrol_cursor--;
1974 if (options_colorcontrol_cursor < 0)
1975 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1979 S_LocalSound ("misc/menu1.wav", true);
1980 options_colorcontrol_cursor++;
1981 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1982 options_colorcontrol_cursor = 0;
1986 M_Menu_Options_ColorControl_AdjustSliders (-1);
1990 M_Menu_Options_ColorControl_AdjustSliders (1);
1996 //=============================================================================
1999 char *quakebindnames[][2] =
2001 {"+attack", "attack"},
2002 {"impulse 10", "next weapon"},
2003 {"impulse 12", "previous weapon"},
2004 {"+jump", "jump / swim up"},
2005 {"+forward", "walk forward"},
2006 {"+back", "backpedal"},
2007 {"+left", "turn left"},
2008 {"+right", "turn right"},
2010 {"+moveleft", "step left"},
2011 {"+moveright", "step right"},
2012 {"+strafe", "sidestep"},
2013 {"+lookup", "look up"},
2014 {"+lookdown", "look down"},
2015 {"centerview", "center view"},
2016 {"+mlook", "mouse look"},
2017 {"+klook", "keyboard look"},
2018 {"+moveup", "swim up"},
2019 {"+movedown", "swim down"}
2022 char *transfusionbindnames[][2] =
2024 {"", "Movement"}, // Movement commands
2025 {"+forward", "walk forward"},
2026 {"+back", "backpedal"},
2027 {"+left", "turn left"},
2028 {"+right", "turn right"},
2029 {"+moveleft", "step left"},
2030 {"+moveright", "step right"},
2031 {"+jump", "jump / swim up"},
2032 {"+movedown", "swim down"},
2033 {"", "Combat"}, // Combat commands
2034 {"impulse 1", "Pitch Fork"},
2035 {"impulse 2", "Flare Gun"},
2036 {"impulse 3", "Shotgun"},
2037 {"impulse 4", "Machine Gun"},
2038 {"impulse 5", "Incinerator"},
2039 {"impulse 6", "Bombs (TNT)"},
2040 {"impulse 35", "Proximity Bomb"},
2041 {"impulse 36", "Remote Detonator"},
2042 {"impulse 7", "Aerosol Can"},
2043 {"impulse 8", "Tesla Cannon"},
2044 {"impulse 9", "Life Leech"},
2045 {"impulse 10", "Voodoo Doll"},
2046 {"impulse 21", "next weapon"},
2047 {"impulse 22", "previous weapon"},
2048 {"+attack", "attack"},
2049 {"+button3", "altfire"},
2050 {"", "Inventory"}, // Inventory commands
2051 {"impulse 40", "Dr.'s Bag"},
2052 {"impulse 41", "Crystal Ball"},
2053 {"impulse 42", "Beast Vision"},
2054 {"impulse 43", "Jump Boots"},
2055 {"impulse 23", "next item"},
2056 {"impulse 24", "previous item"},
2057 {"impulse 25", "use item"},
2058 {"", "Misc"}, // Misc commands
2059 {"+button4", "use"},
2060 {"impulse 50", "add bot (red)"},
2061 {"impulse 51", "add bot (blue)"},
2062 {"impulse 52", "kick a bot"},
2063 {"impulse 26", "next armor type"},
2064 {"impulse 27", "identify player"},
2065 {"impulse 55", "voting menu"},
2066 {"impulse 56", "observer mode"},
2067 {"", "Taunts"}, // Taunts
2068 {"impulse 70", "taunt 0"},
2069 {"impulse 71", "taunt 1"},
2070 {"impulse 72", "taunt 2"},
2071 {"impulse 73", "taunt 3"},
2072 {"impulse 74", "taunt 4"},
2073 {"impulse 75", "taunt 5"},
2074 {"impulse 76", "taunt 6"},
2075 {"impulse 77", "taunt 7"},
2076 {"impulse 78", "taunt 8"},
2077 {"impulse 79", "taunt 9"}
2080 char *goodvsbad2bindnames[][2] =
2082 {"impulse 69", "Power 1"},
2083 {"impulse 70", "Power 2"},
2084 {"impulse 71", "Power 3"},
2085 {"+jump", "jump / swim up"},
2086 {"+forward", "walk forward"},
2087 {"+back", "backpedal"},
2088 {"+left", "turn left"},
2089 {"+right", "turn right"},
2091 {"+moveleft", "step left"},
2092 {"+moveright", "step right"},
2093 {"+strafe", "sidestep"},
2094 {"+lookup", "look up"},
2095 {"+lookdown", "look down"},
2096 {"centerview", "center view"},
2097 {"+mlook", "mouse look"},
2098 {"kill", "kill yourself"},
2099 {"+moveup", "swim up"},
2100 {"+movedown", "swim down"}
2104 char *(*bindnames)[2];
2107 typedef struct binditem_s
2109 char *command, *description;
2110 struct binditem_s *next;
2114 typedef struct bindcategory_s
2118 struct bindcategory_s *next;
2122 bindcategory_t *bindcategories = NULL;
2124 void M_ClearBinds (void)
2126 for (c = bindcategories;c;c = cnext)
2129 for (b = c->binds;b;b = bnext)
2136 bindcategories = NULL;
2139 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
2141 for (b = &c->binds;*b;*b = &(*b)->next);
2142 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
2143 *b->command = (char *)((*b) + 1);
2144 *b->description = *b->command + strlen(command) + 1;
2145 strcpy(*b->command, command);
2146 strcpy(*b->description, description);
2149 void M_AddBind (char *category, char *command, char *description)
2151 for (c = &bindcategories;*c;c = &(*c)->next)
2153 if (!strcmp(category, (*c)->name))
2155 M_AddBindToCategory(*c, command, description);
2159 *c = Z_Alloc(sizeof(bindcategory_t));
2160 M_AddBindToCategory(*c, command, description);
2163 void M_DefaultBinds (void)
2166 M_AddBind("movement", "+jump", "jump / swim up");
2167 M_AddBind("movement", "+forward", "walk forward");
2168 M_AddBind("movement", "+back", "backpedal");
2169 M_AddBind("movement", "+left", "turn left");
2170 M_AddBind("movement", "+right", "turn right");
2171 M_AddBind("movement", "+speed", "run");
2172 M_AddBind("movement", "+moveleft", "step left");
2173 M_AddBind("movement", "+moveright", "step right");
2174 M_AddBind("movement", "+strafe", "sidestep");
2175 M_AddBind("movement", "+lookup", "look up");
2176 M_AddBind("movement", "+lookdown", "look down");
2177 M_AddBind("movement", "centerview", "center view");
2178 M_AddBind("movement", "+mlook", "mouse look");
2179 M_AddBind("movement", "+klook", "keyboard look");
2180 M_AddBind("movement", "+moveup", "swim up");
2181 M_AddBind("movement", "+movedown", "swim down");
2182 M_AddBind("weapons", "+attack", "attack");
2183 M_AddBind("weapons", "impulse 10", "next weapon");
2184 M_AddBind("weapons", "impulse 12", "previous weapon");
2185 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2186 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2187 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2188 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2189 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2190 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2191 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2192 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2200 void M_Menu_Keys_f (void)
2202 key_dest = key_menu;
2204 m_entersound = true;
2209 void M_FindKeysForCommand (char *command, int *keys)
2215 for (j = 0;j < NUMKEYS;j++)
2220 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2222 b = keybindings[0][j];
2225 if (!strcmp (b, command) )
2228 if (count == NUMKEYS)
2234 void M_UnbindCommand (char *command)
2239 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2241 b = keybindings[0][j];
2244 if (!strcmp (b, command))
2245 Key_SetBinding (j, 0, "");
2250 void M_Keys_Draw (void)
2256 char keystring[1024];
2258 M_Background(320, 48 + 8 * numcommands);
2260 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2261 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2264 M_Print(12, 32, "Press a key or button for this action");
2266 M_Print(18, 32, "Enter to change, backspace to clear");
2268 // search for known bindings
2269 for (i=0 ; i<numcommands ; i++)
2273 // If there's no command, it's just a section
2274 if (bindnames[i][0][0] == '\0')
2276 M_PrintRed (4, y, "\x0D"); // #13 is the little arrow pointing to the right
2277 M_PrintRed (16, y, bindnames[i][1]);
2281 M_Print(16, y, bindnames[i][1]);
2283 M_FindKeysForCommand (bindnames[i][0], keys);
2285 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2287 strcpy(keystring, "???");
2291 for (j = 0;j < NUMKEYS;j++)
2296 strcat(keystring, " or ");
2297 strcat(keystring, Key_KeynumToString (keys[j]));
2301 M_Print(150, y, keystring);
2305 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2307 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2311 void M_Keys_Key (int k, char ascii)
2318 S_LocalSound ("misc/menu1.wav", true);
2323 else //if (k != '`')
2325 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2326 Cbuf_InsertText (cmd);
2336 M_Menu_Options_f ();
2341 S_LocalSound ("misc/menu1.wav", true);
2345 if (keys_cursor < 0)
2346 keys_cursor = numcommands-1;
2348 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2353 S_LocalSound ("misc/menu1.wav", true);
2357 if (keys_cursor >= numcommands)
2360 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2363 case K_ENTER: // go into bind mode
2364 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2365 S_LocalSound ("misc/menu2.wav", true);
2366 if (keys[NUMKEYS - 1] != -1)
2367 M_UnbindCommand (bindnames[keys_cursor][0]);
2371 case K_BACKSPACE: // delete bindings
2372 case K_DEL: // delete bindings
2373 S_LocalSound ("misc/menu2.wav", true);
2374 M_UnbindCommand (bindnames[keys_cursor][0]);
2379 void M_Menu_Reset_f (void)
2381 key_dest = key_menu;
2383 m_entersound = true;
2387 void M_Reset_Key (int key, char ascii)
2394 m_state = m_options;
2395 m_entersound = true;
2400 Cbuf_AddText ("exec default.cfg\n");
2408 void M_Reset_Draw (void)
2410 int lines = 2, linelength = 20;
2411 M_Background(linelength * 8 + 16, lines * 8 + 16);
2412 M_DrawTextBox(0, 0, linelength, lines);
2413 M_Print(8 + 4 * (linelength - 19), 8, "Really wanna reset?");
2414 M_Print(8 + 4 * (linelength - 11), 16, "Press y / n");
2417 //=============================================================================
2420 #define VIDEO_ITEMS 5
2422 int video_cursor = 0;
2423 int video_cursor_table[] = {56, 68, 80, 100, 120};
2424 // note: if modes are added to the beginning of this list, update the
2425 // video_resolution = x; in M_Menu_Video_f below
2426 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}};
2427 // this is the number of the 640x480 mode in the list
2429 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
2430 int video_resolution;
2432 extern int current_vid_fullscreen;
2433 extern int current_vid_width;
2434 extern int current_vid_height;
2435 extern int current_vid_bitsperpixel;
2438 void M_Menu_Video_f (void)
2440 key_dest = key_menu;
2442 m_entersound = true;
2444 // Look for the current resolution
2445 for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
2447 if (video_resolutions[video_resolution][0] == current_vid_width &&
2448 video_resolutions[video_resolution][1] == current_vid_height)
2452 // Default to VID_640 if we didn't find it
2453 if (video_resolution == VID_RES_COUNT)
2455 // may need to update this number if mode list changes
2456 video_resolution = VID_640;
2457 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2458 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2463 void M_Video_Draw (void)
2468 M_Background(320, 200);
2470 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2471 p = Draw_CachePic("gfx/vidmodes.lmp");
2472 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2475 M_Print(16, video_cursor_table[0], " Resolution");
2476 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2477 M_Print(220, video_cursor_table[0], string);
2480 M_Print(16, video_cursor_table[1], " Bits per pixel");
2481 M_Print(220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2484 M_Print(16, video_cursor_table[2], " Fullscreen");
2485 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2488 M_Print(220, video_cursor_table[3], "Apply");
2491 M_ItemPrint (0, video_cursor_table[4], " Vertical Sync", gl_videosyncavailable);
2492 M_DrawCheckbox(220, video_cursor_table[4], vid_vsync.integer);
2495 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2499 void M_Menu_Video_AdjustSliders (int dir)
2501 S_LocalSound ("misc/menu3.wav", true);
2503 switch (video_cursor)
2508 int new_resolution = video_resolution + dir;
2509 if (gamemode == GAME_FNIGGIUM ? new_resolution < VID_640 : new_resolution < 0)
2510 video_resolution = VID_RES_COUNT - 1;
2511 else if (new_resolution > VID_RES_COUNT - 1)
2512 video_resolution = gamemode == GAME_FNIGGIUM ? VID_640 : 0;
2514 video_resolution = new_resolution;
2516 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2517 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2523 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2526 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2530 Cvar_SetValueQuick (&vid_vsync, !vid_vsync.integer);
2536 void M_Video_Key (int key, char ascii)
2541 // vid_shared.c has a copy of the current video config. We restore it
2542 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2543 Cvar_SetValueQuick(&vid_width, current_vid_width);
2544 Cvar_SetValueQuick(&vid_height, current_vid_height);
2545 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2547 S_LocalSound ("misc/menu1.wav", true);
2548 M_Menu_Options_f ();
2552 m_entersound = true;
2553 switch (video_cursor)
2556 Cbuf_AddText ("vid_restart\n");
2557 M_Menu_Options_f ();
2560 M_Menu_Video_AdjustSliders (1);
2565 S_LocalSound ("misc/menu1.wav", true);
2567 if (video_cursor < 0)
2568 video_cursor = VIDEO_ITEMS-1;
2572 S_LocalSound ("misc/menu1.wav", true);
2574 if (video_cursor >= VIDEO_ITEMS)
2579 M_Menu_Video_AdjustSliders (-1);
2583 M_Menu_Video_AdjustSliders (1);
2588 //=============================================================================
2592 #define NUM_HELP_PAGES 6
2595 void M_Menu_Help_f (void)
2597 key_dest = key_menu;
2599 m_entersound = true;
2605 void M_Help_Draw (void)
2607 M_Background(320, 200);
2608 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2612 void M_Help_Key (int key, char ascii)
2622 m_entersound = true;
2623 if (++help_page >= NUM_HELP_PAGES)
2629 m_entersound = true;
2630 if (--help_page < 0)
2631 help_page = NUM_HELP_PAGES-1;
2637 //=============================================================================
2640 char *m_quit_message[9];
2641 int m_quit_prevstate;
2642 qboolean wasInMenus;
2645 int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
2647 m_quit_message[0] = line1;
2648 m_quit_message[1] = line2;
2649 m_quit_message[2] = line3;
2650 m_quit_message[3] = line4;
2651 m_quit_message[4] = line5;
2652 m_quit_message[5] = line6;
2653 m_quit_message[6] = line7;
2654 m_quit_message[7] = line8;
2655 m_quit_message[8] = NULL;
2659 int M_ChooseQuitMessage(int request)
2667 if (request-- == 0) return M_QuitMessage("Are you gonna quit","this game just like","everything else?",NULL,NULL,NULL,NULL,NULL);
2668 if (request-- == 0) return M_QuitMessage("Milord, methinks that","thou art a lowly","quitter. Is this true?",NULL,NULL,NULL,NULL,NULL);
2669 if (request-- == 0) return M_QuitMessage("Do I need to bust your","face open for trying","to quit?",NULL,NULL,NULL,NULL,NULL);
2670 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);
2671 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);
2672 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);
2673 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);
2674 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);
2676 case GAME_GOODVSBAD2:
2677 if (request-- == 0) return M_QuitMessage("Press Yes To Quit","...","Yes",NULL,NULL,NULL,NULL,NULL);
2678 if (request-- == 0) return M_QuitMessage("Do you really want to","Quit?","Play Good vs bad 3!",NULL,NULL,NULL,NULL,NULL);
2679 if (request-- == 0) return M_QuitMessage("All your quit are","belong to long duck","dong",NULL,NULL,NULL,NULL,NULL);
2680 if (request-- == 0) return M_QuitMessage("Press Y to quit","","But are you too legit?",NULL,NULL,NULL,NULL,NULL);
2681 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);
2682 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);
2683 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);
2684 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);
2685 if (request-- == 0) return M_QuitMessage("Press Y like you","were waanderers","from Ys'",NULL,NULL,NULL,NULL,NULL);
2686 if (request-- == 0) return M_QuitMessage("This game was made in","Nippon like the SS","announcer's saying ipon",NULL,NULL,NULL,NULL,NULL);
2687 if (request-- == 0) return M_QuitMessage("you","want to quit?",NULL,NULL,NULL,NULL,NULL,NULL);
2688 if (request-- == 0) return M_QuitMessage("Please stop playing","this stupid game",NULL,NULL,NULL,NULL,NULL,NULL);
2690 case GAME_BATTLEMECH:
2691 if (request-- == 0) return M_QuitMessage("? WHY ?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2692 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);
2693 if (request-- == 0) return M_QuitMessage("Accept Defeat?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2694 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);
2695 if (request-- == 0) return M_QuitMessage("Where's your bloodlust?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2696 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);
2697 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);
2699 case GAME_OPENQUARTZ:
2700 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);
2701 if (request-- == 0) return M_QuitMessage("GNU is not Unix!","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2702 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);
2703 if (request-- == 0) return M_QuitMessage("Is OpenQuartz Propaganda?","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2706 if (request-- == 0) return M_QuitMessage("Tired of fragging already?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2707 if (request-- == 0) return M_QuitMessage("Quit now and forfeit your bodycount?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2708 if (request-- == 0) return M_QuitMessage("Are you sure you want to quit?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2709 if (request-- == 0) return M_QuitMessage("Off to do something constructive?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2715 void M_Menu_Quit_f (void)
2718 if (m_state == m_quit)
2720 wasInMenus = (key_dest == key_menu);
2721 key_dest = key_menu;
2722 m_quit_prevstate = m_state;
2724 m_entersound = true;
2725 // count how many there are
2726 for (n = 0;M_ChooseQuitMessage(n);n++);
2728 M_ChooseQuitMessage(rand() % n);
2732 void M_Quit_Key (int key, char ascii)
2741 m_state = m_quit_prevstate;
2742 m_entersound = true;
2746 key_dest = key_game;
2761 void M_Quit_Draw (void)
2763 int i, l, linelength, firstline, lastline, lines;
2764 for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
2766 if ((l = strlen(m_quit_message[i])))
2776 lines = (lastline - firstline) + 1;
2777 M_Background(linelength * 8 + 16, lines * 8 + 16);
2778 M_DrawTextBox(0, 0, linelength, lines);
2779 for (i = 0, l = firstline;i < lines;i++, l++)
2780 M_Print(8 + 4 * (linelength - strlen(m_quit_message[l])), 8 + 8 * i, m_quit_message[l]);
2783 //=============================================================================
2784 /* LAN CONFIG MENU */
2786 int lanConfig_cursor = -1;
2787 int lanConfig_cursor_table [] = {56, 76, 112};
2788 #define NUM_LANCONFIG_CMDS 3
2791 char lanConfig_portname[6];
2792 char lanConfig_joinname[22];
2794 void M_Menu_LanConfig_f (void)
2796 key_dest = key_menu;
2797 m_state = m_lanconfig;
2798 m_entersound = true;
2799 if (lanConfig_cursor == -1)
2802 lanConfig_cursor = 1;
2805 lanConfig_cursor = 1;
2806 lanConfig_port = 26000;
2807 sprintf(lanConfig_portname, "%u", lanConfig_port);
2809 m_return_reason[0] = 0;
2813 void M_LanConfig_Draw (void)
2820 M_Background(320, 200);
2822 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2823 p = Draw_CachePic ("gfx/p_multi.lmp");
2824 basex = (320-p->width)/2;
2825 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2828 startJoin = "New Game";
2830 startJoin = "Join Game";
2831 protocol = "TCP/IP";
2832 M_Print(basex, 32, va ("%s - %s", startJoin, protocol));
2835 M_Print(basex, lanConfig_cursor_table[0], "Port");
2836 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2837 M_Print(basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2841 M_Print(basex, lanConfig_cursor_table[1], "Search for games...");
2842 M_Print(basex, lanConfig_cursor_table[2]-16, "Join game at:");
2843 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2844 M_Print(basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2848 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2849 M_Print(basex+8, lanConfig_cursor_table[1], "OK");
2852 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2854 if (lanConfig_cursor == 0)
2855 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2857 if (lanConfig_cursor == 2)
2858 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2860 if (*m_return_reason)
2861 M_Print(basex, 168, m_return_reason);
2865 void M_LanConfig_Key (int key, char ascii)
2872 M_Menu_MultiPlayer_f ();
2876 S_LocalSound ("misc/menu1.wav", true);
2878 if (lanConfig_cursor < 0)
2879 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2883 S_LocalSound ("misc/menu1.wav", true);
2885 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2886 lanConfig_cursor = 0;
2890 if (lanConfig_cursor == 0)
2893 m_entersound = true;
2895 Cbuf_AddText ("stopdemo\n");
2897 Cvar_SetValue("port", lanConfig_port);
2899 if (lanConfig_cursor == 1)
2903 M_Menu_GameOptions_f ();
2906 M_Menu_ServerList_f();
2910 if (lanConfig_cursor == 2)
2911 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2915 if (lanConfig_cursor == 0)
2917 if (strlen(lanConfig_portname))
2918 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2921 if (lanConfig_cursor == 2)
2923 if (strlen(lanConfig_joinname))
2924 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2929 if (ascii < 32 || ascii > 126)
2932 if (lanConfig_cursor == 2)
2934 l = strlen(lanConfig_joinname);
2937 lanConfig_joinname[l+1] = 0;
2938 lanConfig_joinname[l] = ascii;
2942 if (ascii < '0' || ascii > '9')
2944 if (lanConfig_cursor == 0)
2946 l = strlen(lanConfig_portname);
2949 lanConfig_portname[l+1] = 0;
2950 lanConfig_portname[l] = ascii;
2955 if (StartingGame && lanConfig_cursor == 2)
2957 if (key == K_UPARROW)
2958 lanConfig_cursor = 1;
2960 lanConfig_cursor = 0;
2963 l = atoi(lanConfig_portname);
2966 sprintf(lanConfig_portname, "%u", lanConfig_port);
2969 //=============================================================================
2970 /* GAME OPTIONS MENU */
2989 episode_t *episodes;
2994 level_t quakelevels[] =
2996 {"start", "Entrance"}, // 0
2998 {"e1m1", "Slipgate Complex"}, // 1
2999 {"e1m2", "Castle of the Damned"},
3000 {"e1m3", "The Necropolis"},
3001 {"e1m4", "The Grisly Grotto"},
3002 {"e1m5", "Gloom Keep"},
3003 {"e1m6", "The Door To Chthon"},
3004 {"e1m7", "The House of Chthon"},
3005 {"e1m8", "Ziggurat Vertigo"},
3007 {"e2m1", "The Installation"}, // 9
3008 {"e2m2", "Ogre Citadel"},
3009 {"e2m3", "Crypt of Decay"},
3010 {"e2m4", "The Ebon Fortress"},
3011 {"e2m5", "The Wizard's Manse"},
3012 {"e2m6", "The Dismal Oubliette"},
3013 {"e2m7", "Underearth"},
3015 {"e3m1", "Termination Central"}, // 16
3016 {"e3m2", "The Vaults of Zin"},
3017 {"e3m3", "The Tomb of Terror"},
3018 {"e3m4", "Satan's Dark Delight"},
3019 {"e3m5", "Wind Tunnels"},
3020 {"e3m6", "Chambers of Torment"},
3021 {"e3m7", "The Haunted Halls"},
3023 {"e4m1", "The Sewage System"}, // 23
3024 {"e4m2", "The Tower of Despair"},
3025 {"e4m3", "The Elder God Shrine"},
3026 {"e4m4", "The Palace of Hate"},
3027 {"e4m5", "Hell's Atrium"},
3028 {"e4m6", "The Pain Maze"},
3029 {"e4m7", "Azure Agony"},
3030 {"e4m8", "The Nameless City"},
3032 {"end", "Shub-Niggurath's Pit"}, // 31
3034 {"dm1", "Place of Two Deaths"}, // 32
3035 {"dm2", "Claustrophobopolis"},
3036 {"dm3", "The Abandoned Base"},
3037 {"dm4", "The Bad Place"},
3038 {"dm5", "The Cistern"},
3039 {"dm6", "The Dark Zone"}
3042 episode_t quakeepisodes[] =
3044 {"Welcome to Quake", 0, 1},
3045 {"Doomed Dimension", 1, 8},
3046 {"Realm of Black Magic", 9, 7},
3047 {"Netherworld", 16, 7},
3048 {"The Elder World", 23, 8},
3049 {"Final Level", 31, 1},
3050 {"Deathmatch Arena", 32, 6}
3053 //MED 01/06/97 added hipnotic levels
3054 level_t hipnoticlevels[] =
3056 {"start", "Command HQ"}, // 0
3058 {"hip1m1", "The Pumping Station"}, // 1
3059 {"hip1m2", "Storage Facility"},
3060 {"hip1m3", "The Lost Mine"},
3061 {"hip1m4", "Research Facility"},
3062 {"hip1m5", "Military Complex"},
3064 {"hip2m1", "Ancient Realms"}, // 6
3065 {"hip2m2", "The Black Cathedral"},
3066 {"hip2m3", "The Catacombs"},
3067 {"hip2m4", "The Crypt"},
3068 {"hip2m5", "Mortum's Keep"},
3069 {"hip2m6", "The Gremlin's Domain"},
3071 {"hip3m1", "Tur Torment"}, // 12
3072 {"hip3m2", "Pandemonium"},
3073 {"hip3m3", "Limbo"},
3074 {"hip3m4", "The Gauntlet"},
3076 {"hipend", "Armagon's Lair"}, // 16
3078 {"hipdm1", "The Edge of Oblivion"} // 17
3081 //MED 01/06/97 added hipnotic episodes
3082 episode_t hipnoticepisodes[] =
3084 {"Scourge of Armagon", 0, 1},
3085 {"Fortress of the Dead", 1, 5},
3086 {"Dominion of Darkness", 6, 6},
3087 {"The Rift", 12, 4},
3088 {"Final Level", 16, 1},
3089 {"Deathmatch Arena", 17, 1}
3092 //PGM 01/07/97 added rogue levels
3093 //PGM 03/02/97 added dmatch level
3094 level_t roguelevels[] =
3096 {"start", "Split Decision"},
3097 {"r1m1", "Deviant's Domain"},
3098 {"r1m2", "Dread Portal"},
3099 {"r1m3", "Judgement Call"},
3100 {"r1m4", "Cave of Death"},
3101 {"r1m5", "Towers of Wrath"},
3102 {"r1m6", "Temple of Pain"},
3103 {"r1m7", "Tomb of the Overlord"},
3104 {"r2m1", "Tempus Fugit"},
3105 {"r2m2", "Elemental Fury I"},
3106 {"r2m3", "Elemental Fury II"},
3107 {"r2m4", "Curse of Osiris"},
3108 {"r2m5", "Wizard's Keep"},
3109 {"r2m6", "Blood Sacrifice"},
3110 {"r2m7", "Last Bastion"},
3111 {"r2m8", "Source of Evil"},
3112 {"ctf1", "Division of Change"}
3115 //PGM 01/07/97 added rogue episodes
3116 //PGM 03/02/97 added dmatch episode
3117 episode_t rogueepisodes[] =
3119 {"Introduction", 0, 1},
3120 {"Hell's Fortress", 1, 7},
3121 {"Corridors of Time", 8, 8},
3122 {"Deathmatch Arena", 16, 1}
3125 level_t nehahralevels[] =
3127 {"nehstart", "Welcome to Nehahra"},
3128 {"neh1m1", "Forge City1: Slipgates"},
3129 {"neh1m2", "Forge City2: Boiler"},
3130 {"neh1m3", "Forge City3: Escape"},
3131 {"neh1m4", "Grind Core"},
3132 {"neh1m5", "Industrial Silence"},
3133 {"neh1m6", "Locked-Up Anger"},
3134 {"neh1m7", "Wanderer of the Wastes"},
3135 {"neh1m8", "Artemis System Net"},
3136 {"neh1m9", "To the Death"},
3137 {"neh2m1", "The Gates of Ghoro"},
3138 {"neh2m2", "Sacred Trinity"},
3139 {"neh2m3", "Realm of the Ancients"},
3140 {"neh2m4", "Temple of the Ancients"},
3141 {"neh2m5", "Dreams Made Flesh"},
3142 {"neh2m6", "Your Last Cup of Sorrow"},
3143 {"nehsec", "Ogre's Bane"},
3144 {"nehahra", "Nehahra's Den"},
3145 {"nehend", "Quintessence"}
3148 episode_t nehahraepisodes[] =
3150 {"Welcome to Nehahra", 0, 1},
3151 {"The Fall of Forge", 1, 9},
3152 {"The Outlands", 10, 7},
3153 {"Dimension of the Lost", 17, 2}
3156 // Map list for Transfusion
3157 level_t transfusionlevels[] =
3159 {"bb1", "The Stronghold"},
3160 {"bb2", "Winter Wonderland"},
3162 {"bb4", "The Tower"},
3164 {"bb6", "Twin Fortress"},
3166 {"bb8", "Fun With Heads"},
3168 {"e1m1", "Cradle to Grave"},
3169 {"e1m2", "Wrong Side of the Tracks"},
3170 {"e1m7", "Altar of Stone"},
3171 {"e2m8", "The Lair of Shial"},
3172 {"e3m1", "Ghost Town"},
3173 {"e3m7", "The Pit of Cerberus"},
3174 {"e4m1", "Butchery Loves Company"},
3175 {"e4m7", "In the Flesh"},
3176 {"e4m8", "The Hall of the Epiphany"},
3177 {"e4m9", "Mall of the Dead"},
3179 {"dm1", "Monolith Building 11"},
3182 {"e6m1", "Welcome to Your Life"},
3183 {"e6m8", "Beauty and the Beast"},
3184 {"e6m9", "Forgotten Catacombs"},
3186 {"cpbb01", "Crypt of Despair"},
3187 {"cpbb03", "Unholy Cathedral"},
3189 {"b2a15", "Area 15 (B2)"},
3190 {"barena", "Blood Arena"},
3191 {"bkeep", "Blood Keep"},
3192 {"bstar", "Brown Star"},
3193 {"crypt", "The Crypt"},
3195 {"bb3_2k1", "Bodies Infusion"},
3196 {"captasao", "Captasao"},
3197 {"curandero", "Curandero"},
3198 {"dcamp", "DeathCamp"},
3199 {"highnoon", "HighNoon"},
3200 {"qbb1", "The Confluence"},
3201 {"qbb2", "KathartiK"},
3202 {"qbb3", "Caleb's Woodland Retreat"},
3205 {"dranzbb6", "Black Coffee"},
3206 {"fragm", "Frag'M"},
3208 {"qe1m7", "The House of Chthon"},
3209 {"qmorbias", "Dm-Morbias"},
3210 {"simple", "Dead Simple"}
3213 episode_t transfusionepisodes[] =
3216 {"Blood Single Player", 8, 10},
3217 {"Plasma Pack", 18, 6},
3218 {"Cryptic Passage", 24, 2},
3220 {"Transfusion", 31, 9},
3221 {"Conversions", 40, 6}
3224 level_t goodvsbad2levels[] =
3226 {"rts", "Many Paths"}, // 0
3227 {"chess", "Chess, Scott Hess"}, // 1
3228 {"dot", "Big Wall"},
3229 {"city2", "The Big City"},
3230 {"bwall", "0 G like Psychic TV"},
3231 {"snow", "Wireframed"},
3232 {"telep", "Infinite Falling"},
3233 {"faces", "Facing Bases"},
3234 {"island", "Adventure Islands"},
3237 episode_t goodvsbad2episodes[] =
3239 {"Levels? Bevels!", 0, 8},
3242 level_t battlemechlevels[] =
3244 {"start", "Parking Level"},
3245 {"dm1", "Hot Dump"}, // 1
3246 {"dm2", "The Pits"},
3247 {"dm3", "Dimber Died"},
3248 {"dm4", "Fire in the Hole"},
3249 {"dm5", "Clubhouses"},
3250 {"dm6", "Army go Underground"},
3253 episode_t battlemechepisodes[] =
3255 {"Time for Battle", 0, 7},
3258 level_t openquartzlevels[] =
3260 {"start", "Welcome to Openquartz"},
3262 {"void1", "The center of nowhere"}, // 1
3263 {"void2", "The place with no name"},
3264 {"void3", "The lost supply base"},
3265 {"void4", "Past the outer limits"},
3266 {"void5", "Into the nonexistance"},
3267 {"void6", "Void walk"},
3269 {"vtest", "Warp Central"},
3270 {"box", "The deathmatch box"},
3271 {"bunkers", "Void command"},
3272 {"house", "House of chaos"},
3273 {"office", "Overnight office kill"},
3274 {"am1", "The nameless chambers"},
3277 episode_t openquartzepisodes[] =
3279 {"Single Player", 0, 1},
3280 {"Void Deathmatch", 1, 6},
3284 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
3285 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
3286 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
3287 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
3288 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
3289 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
3290 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
3291 gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
3292 gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
3297 gamelevels_t *notregistered;
3298 gamelevels_t *registered;
3302 gameinfo_t gamelist[] =
3304 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3305 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3306 {GAME_ROGUE, &roguegame, &roguegame},
3307 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3308 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3309 {GAME_GOODVSBAD2, &goodvsbad2game, &goodvsbad2game},
3310 {GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
3311 {GAME_OPENQUARTZ, &openquartzgame, &openquartzgame},
3312 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3315 gamelevels_t *lookupgameinfo(void)
3318 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3319 if (registered.integer)
3320 return gamelist[i].registered;
3322 return gamelist[i].notregistered;
3328 qboolean m_serverInfoMessage = false;
3329 double m_serverInfoMessageTime;
3331 void M_Menu_GameOptions_f (void)
3333 key_dest = key_menu;
3334 m_state = m_gameoptions;
3335 m_entersound = true;
3336 if (maxplayers == 0)
3337 maxplayers = svs.maxclients;
3339 maxplayers = min(8, MAX_SCOREBOARD);
3343 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168};
3344 #define NUM_GAMEOPTIONS 12
3345 int gameoptions_cursor;
3347 void M_GameOptions_Draw (void)
3353 M_Background(320, 200);
3355 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3356 p = Draw_CachePic ("gfx/p_multi.lmp");
3357 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3359 M_DrawTextBox (152, 32, 10, 1);
3360 M_Print(160, 40, "begin game");
3362 M_Print(0, 56, " Max players");
3363 M_Print(160, 56, va("%i", maxplayers) );
3365 if (gamemode != GAME_GOODVSBAD2)
3367 M_Print(0, 64, " Game Type");
3368 if (gamemode == GAME_TRANSFUSION)
3370 if (!deathmatch.integer)
3371 Cvar_SetValue("deathmatch", 1);
3372 if (deathmatch.integer == 2)
3373 M_Print(160, 64, "Capture the Flag");
3375 M_Print(160, 64, "Blood Bath");
3377 else if (gamemode == GAME_BATTLEMECH)
3379 if (!deathmatch.integer)
3380 Cvar_SetValue("deathmatch", 1);
3381 if (deathmatch.integer == 2)
3382 M_Print(160, 64, "Rambo Match");
3384 M_Print(160, 64, "Deathmatch");
3388 if (!coop.integer && !deathmatch.integer)
3389 Cvar_SetValue("deathmatch", 1);
3391 M_Print(160, 64, "Cooperative");
3393 M_Print(160, 64, "Deathmatch");
3396 M_Print(0, 72, " Teamplay");
3397 if (gamemode == GAME_ROGUE)
3401 switch((int)teamplay.integer)
3403 case 1: msg = "No Friendly Fire"; break;
3404 case 2: msg = "Friendly Fire"; break;
3405 case 3: msg = "Tag"; break;
3406 case 4: msg = "Capture the Flag"; break;
3407 case 5: msg = "One Flag CTF"; break;
3408 case 6: msg = "Three Team CTF"; break;
3409 default: msg = "Off"; break;
3411 M_Print(160, 72, msg);
3417 switch (teamplay.integer)
3419 case 0: msg = "Off"; break;
3420 case 2: msg = "Friendly Fire"; break;
3421 default: msg = "No Friendly Fire"; break;
3423 M_Print(160, 72, msg);
3426 M_Print(0, 80, " Skill");
3427 if (skill.integer == 0)
3428 M_Print(160, 80, "Easy difficulty");
3429 else if (skill.integer == 1)
3430 M_Print(160, 80, "Normal difficulty");
3431 else if (skill.integer == 2)
3432 M_Print(160, 80, "Hard difficulty");
3434 M_Print(160, 80, "Nightmare difficulty");
3436 M_Print(0, 88, " Frag Limit");
3437 if (fraglimit.integer == 0)
3438 M_Print(160, 88, "none");
3440 M_Print(160, 88, va("%i frags", fraglimit.integer));
3442 M_Print(0, 96, " Time Limit");
3443 if (timelimit.integer == 0)
3444 M_Print(160, 96, "none");
3446 M_Print(160, 96, va("%i minutes", timelimit.integer));
3449 M_Print(0, 104, " Public server");
3450 M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes");
3452 M_Print(0, 112, " Server maxrate");
3453 M_Print(160, 112, va("%i", sv_maxrate.integer));
3455 M_Print(0, 128, " Server name");
3456 M_DrawTextBox (0, 132, 38, 1);
3457 M_Print(8, 140, hostname.string);
3459 g = lookupgameinfo();
3461 if (gamemode != GAME_GOODVSBAD2)
3463 M_Print(0, 160, " Episode");
3464 M_Print(160, 160, g->episodes[startepisode].description);
3467 M_Print(0, 168, " Level");
3468 M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3469 M_Print(160, 176, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3472 if (gameoptions_cursor == 9)
3473 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3475 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3477 if (m_serverInfoMessage)
3479 if ((realtime - m_serverInfoMessageTime) < 5.0)
3482 M_DrawTextBox (x, 138, 24, 4);
3484 M_Print(x, 146, " More than 64 players?? ");
3485 M_Print(x, 154, " First, question your ");
3486 M_Print(x, 162, " sanity, then email ");
3487 M_Print(x, 170, " havoc@telefragged.com ");
3490 m_serverInfoMessage = false;
3495 void M_NetStart_Change (int dir)
3500 switch (gameoptions_cursor)
3504 if (maxplayers > MAX_SCOREBOARD)
3506 maxplayers = MAX_SCOREBOARD;
3507 m_serverInfoMessage = true;
3508 m_serverInfoMessageTime = realtime;
3515 if (gamemode == GAME_GOODVSBAD2)
3517 if (gamemode == GAME_TRANSFUSION)
3519 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3520 Cvar_SetValueQuick (&deathmatch, 0);
3521 else // changing from BloodBath to CTF
3522 Cvar_SetValueQuick (&deathmatch, 2);
3524 else if (gamemode == GAME_BATTLEMECH)
3526 if (deathmatch.integer == 2) // changing from Rambo to Deathmatch
3527 Cvar_SetValueQuick (&deathmatch, 0);
3528 else // changing from Deathmatch to Rambo
3529 Cvar_SetValueQuick (&deathmatch, 2);
3533 if (deathmatch.integer) // changing from deathmatch to coop
3535 Cvar_SetValueQuick (&coop, 1);
3536 Cvar_SetValueQuick (&deathmatch, 0);
3538 else // changing from coop to deathmatch
3540 Cvar_SetValueQuick (&coop, 0);
3541 Cvar_SetValueQuick (&deathmatch, 1);
3547 if (gamemode == GAME_GOODVSBAD2)
3549 if (gamemode == GAME_ROGUE)
3554 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3555 if (teamplay.integer > count)
3556 Cvar_SetValueQuick (&teamplay, 0);
3557 else if (teamplay.integer < 0)
3558 Cvar_SetValueQuick (&teamplay, count);
3562 if (gamemode == GAME_GOODVSBAD2)
3564 Cvar_SetValueQuick (&skill, skill.integer + dir);
3565 if (skill.integer > 3)
3566 Cvar_SetValueQuick (&skill, 0);
3567 if (skill.integer < 0)
3568 Cvar_SetValueQuick (&skill, 3);
3572 if (gamemode == GAME_GOODVSBAD2)
3574 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3575 if (fraglimit.integer > 100)
3576 Cvar_SetValueQuick (&fraglimit, 0);
3577 if (fraglimit.integer < 0)
3578 Cvar_SetValueQuick (&fraglimit, 100);
3582 if (gamemode == GAME_GOODVSBAD2)
3584 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3585 if (timelimit.value > 60)
3586 Cvar_SetValueQuick (&timelimit, 0);
3587 if (timelimit.value < 0)
3588 Cvar_SetValueQuick (&timelimit, 60);
3592 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3596 Cvar_SetValueQuick (&sv_maxrate, sv_maxrate.integer + dir*500);
3597 if (sv_maxrate.integer > NET_MAXRATE)
3598 Cvar_SetValueQuick (&sv_maxrate, NET_MAXRATE);
3599 if (sv_maxrate.integer < NET_MINRATE)
3600 Cvar_SetValueQuick (&sv_maxrate, NET_MINRATE);
3607 if (gamemode == GAME_GOODVSBAD2)
3609 startepisode += dir;
3610 g = lookupgameinfo();
3612 if (startepisode < 0)
3613 startepisode = g->numepisodes - 1;
3615 if (startepisode >= g->numepisodes)
3623 g = lookupgameinfo();
3626 startlevel = g->episodes[startepisode].levels - 1;
3628 if (startlevel >= g->episodes[startepisode].levels)
3634 void M_GameOptions_Key (int key, char ascii)
3638 char hostnamebuf[128];
3643 M_Menu_MultiPlayer_f ();
3647 S_LocalSound ("misc/menu1.wav", true);
3648 gameoptions_cursor--;
3649 if (gameoptions_cursor < 0)
3650 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3654 S_LocalSound ("misc/menu1.wav", true);
3655 gameoptions_cursor++;
3656 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3657 gameoptions_cursor = 0;
3661 if (gameoptions_cursor == 0)
3663 S_LocalSound ("misc/menu3.wav", true);
3664 M_NetStart_Change (-1);
3668 if (gameoptions_cursor == 0)
3670 S_LocalSound ("misc/menu3.wav", true);
3671 M_NetStart_Change (1);
3675 S_LocalSound ("misc/menu2.wav", true);
3676 if (gameoptions_cursor == 0)
3679 Cbuf_AddText ("disconnect\n");
3680 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3682 g = lookupgameinfo();
3683 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3687 M_NetStart_Change (1);
3691 if (gameoptions_cursor == 9)
3693 l = strlen(hostname.string);
3697 memcpy(hostnamebuf, hostname.string, l);
3699 Cvar_Set("hostname", hostnamebuf);
3705 if (ascii < 32 || ascii > 126)
3707 if (gameoptions_cursor == 9)
3709 l = strlen(hostname.string);
3712 memcpy(hostnamebuf, hostname.string, l);
3713 hostnamebuf[l] = ascii;
3714 hostnamebuf[l+1] = 0;
3715 Cvar_Set("hostname", hostnamebuf);
3721 //=============================================================================
3726 void M_Menu_ServerList_f (void)
3728 key_dest = key_menu;
3730 m_entersound = true;
3732 m_return_reason[0] = 0;
3737 void M_ServerList_Draw (void)
3739 int n, y, visible, start, end;
3743 // use as much vertical space as available
3744 M_Background(640, vid.conheight);
3745 // scroll the list as the cursor moves
3746 s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount);
3747 M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
3748 if (*m_return_reason)
3749 M_Print(16, vid.conheight - 8, m_return_reason);
3751 visible = (vid.conheight - 16 - y) / 8;
3752 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3753 end = min(start + visible, hostCacheCount);
3755 p = Draw_CachePic("gfx/p_multi.lmp");
3756 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3759 for (n = start;n < end;n++)
3761 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);
3762 M_Print(0, y, hostcache[n].line1);y += 8;
3763 M_Print(0, y, hostcache[n].line2);y += 8;
3766 else if (realtime - masterquerytime < 3)
3768 if (masterquerycount)
3769 M_Print(0, y, "No servers found");
3771 M_Print(0, y, "No master servers found (network problem?)");
3776 void M_ServerList_Key(int k, char ascii)
3781 M_Menu_LanConfig_f();
3790 S_LocalSound("misc/menu1.wav", true);
3792 if (slist_cursor < 0)
3793 slist_cursor = hostCacheCount - 1;
3798 S_LocalSound("misc/menu1.wav", true);
3800 if (slist_cursor >= hostCacheCount)
3805 S_LocalSound("misc/menu2.wav", true);
3806 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3815 //=============================================================================
3816 /* Menu Subsystem */
3818 void M_Keydown(int key, char ascii);
3820 void M_ToggleMenu_f(void);
3821 void M_Shutdown(void);
3825 menu_mempool = Mem_AllocPool("Menu", 0, NULL);
3826 menuplyr_load = true;
3827 menuplyr_pixels = NULL;
3829 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3830 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3831 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3832 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3833 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3834 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3835 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3836 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3837 Cmd_AddCommand ("menu_options_graphics", M_Menu_Options_Graphics_f);
3838 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3839 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3840 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3841 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3842 Cmd_AddCommand ("menu_reset", M_Menu_Reset_f);
3843 Cmd_AddCommand ("help", M_Menu_Help_f);
3844 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3846 if (gamemode == GAME_TRANSFUSION)
3848 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3849 bindnames = transfusionbindnames;
3851 else if (gamemode == GAME_GOODVSBAD2)
3853 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3854 bindnames = goodvsbad2bindnames;
3858 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3859 bindnames = quakebindnames;
3862 // Make sure "keys_cursor" doesn't start on a section in the binding list
3864 while (bindnames[keys_cursor][0][0] == '\0')
3868 // Only sections? There may be a problem somewhere...
3869 if (keys_cursor >= numcommands)
3870 Sys_Error ("M_Init: The key binding list only contains sections");
3874 if (gamemode == GAME_NEHAHRA)
3876 if (FS_FileExists("maps/neh1m4.bsp"))
3878 if (FS_FileExists("hearing.dem"))
3880 Con_Print("Nehahra movie and game detected.\n");
3881 NehGameType = TYPE_BOTH;
3885 Con_Print("Nehahra game detected.\n");
3886 NehGameType = TYPE_GAME;
3891 if (FS_FileExists("hearing.dem"))
3893 Con_Print("Nehahra movie detected.\n");
3894 NehGameType = TYPE_DEMO;
3898 Con_Print("Nehahra not found.\n");
3899 NehGameType = TYPE_GAME; // could just complain, but...
3907 if (key_dest != key_menu)
3910 if (m_state == m_none)
3926 case m_singleplayer:
3927 M_SinglePlayer_Draw ();
3939 M_MultiPlayer_Draw ();
3950 case m_options_effects:
3951 M_Options_Effects_Draw ();
3954 case m_options_graphics:
3955 M_Options_Graphics_Draw ();
3958 case m_options_colorcontrol:
3959 M_Options_ColorControl_Draw ();
3983 M_LanConfig_Draw ();
3987 M_GameOptions_Draw ();
3991 M_ServerList_Draw ();
3997 S_LocalSound ("misc/menu2.wav", true);
3998 m_entersound = false;
4005 void M_Keydown (int key, char ascii)
4013 M_Main_Key (key, ascii);
4017 M_Demo_Key (key, ascii);
4020 case m_singleplayer:
4021 M_SinglePlayer_Key (key, ascii);
4025 M_Load_Key (key, ascii);
4029 M_Save_Key (key, ascii);
4033 M_MultiPlayer_Key (key, ascii);
4037 M_Setup_Key (key, ascii);
4041 M_Options_Key (key, ascii);
4044 case m_options_effects:
4045 M_Options_Effects_Key (key, ascii);
4048 case m_options_graphics:
4049 M_Options_Graphics_Key (key, ascii);
4052 case m_options_colorcontrol:
4053 M_Options_ColorControl_Key (key, ascii);
4057 M_Keys_Key (key, ascii);
4061 M_Reset_Key (key, ascii);
4066 M_Video_Key (key, ascii);
4070 M_Help_Key (key, ascii);
4074 M_Quit_Key (key, ascii);
4078 M_LanConfig_Key (key, ascii);
4082 M_GameOptions_Key (key, ascii);
4086 M_ServerList_Key (key, ascii);
4091 void M_Shutdown(void)
4094 key_dest = key_game;
4097 void M_Restart(void)
4101 //============================================================================
4102 // Menu prog handling
4103 mfunction_t *PRVM_ED_FindFunction(const char *);
4105 #define M_F_INIT "m_init"
4106 #define M_F_KEYDOWN "m_keydown"
4107 #define M_F_DRAW "m_draw"
4108 // ng_menu function names
4109 #define M_F_DISPLAY "m_display"
4110 #define M_F_HIDE "m_hide"
4111 // normal menu names (rest)
4112 #define M_F_TOGGLE "m_toggle"
4113 #define M_F_SHUTDOWN "m_shutdown"
4115 static char *m_required_func[] = {
4129 qboolean m_displayed;
4132 static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
4134 static func_t m_draw, m_keydown;
4136 void MR_SetRouting (qboolean forceold);
4140 // fall back to the normal menu
4143 Con_Print("Falling back to normal menu\n");
4145 key_dest = key_game;
4149 // init the normal menu now -> this will also correct the menu router pointers
4150 MR_SetRouting (TRUE);
4153 void MP_Keydown (int key, char ascii)
4156 PRVM_SetProg(PRVM_MENUPROG);
4159 *prog->time = realtime;
4162 prog->globals[OFS_PARM0] = (float) key;
4163 prog->globals[OFS_PARM1] = (float) ascii;
4164 PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
4172 PRVM_SetProg(PRVM_MENUPROG);
4175 *prog->time = realtime;
4177 PRVM_ExecuteProgram(m_draw,"");
4182 void MP_ToggleMenu_f (void)
4185 PRVM_SetProg(PRVM_MENUPROG);
4188 *prog->time = realtime;
4191 m_displayed = !m_displayed;
4193 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_DISPLAY) - prog->functions),"");
4195 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_HIDE) - prog->functions),"");
4197 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_TOGGLE) - prog->functions),"");
4203 void MP_Shutdown (void)
4206 PRVM_SetProg(PRVM_MENUPROG);
4209 *prog->time = realtime;
4211 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_SHUTDOWN) - prog->functions),"");
4214 key_dest = key_game;
4216 // AK not using this cause Im not sure whether this is useful at all instead :
4225 PRVM_InitProg(PRVM_MENUPROG);
4227 prog->crc = M_PROGHEADER_CRC;
4228 prog->edictprivate_size = 0; // no private struct used
4229 prog->name = M_NAME;
4230 prog->limit_edicts = M_MAX_EDICTS;
4231 prog->extensionstring = vm_m_extensions;
4232 prog->builtins = vm_m_builtins;
4233 prog->numbuiltins = vm_m_numbuiltins;
4234 prog->init_cmd = VM_M_Cmd_Init;
4235 prog->reset_cmd = VM_M_Cmd_Reset;
4236 prog->error_cmd = MP_Error;
4238 // allocate the mempools
4239 prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool", 0, NULL);
4240 prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool", 0, NULL);
4241 prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL);
4243 PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func);
4245 // set m_draw and m_keydown
4246 m_draw = (func_t) (PRVM_ED_FindFunction(M_F_DRAW) - prog->functions);
4247 m_keydown = (func_t) (PRVM_ED_FindFunction(M_F_KEYDOWN) - prog->functions);
4250 m_displayed = false;
4254 *prog->time = realtime;
4256 // call the prog init
4257 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_INIT) - prog->functions),"");
4262 void MP_Restart(void)
4268 //============================================================================
4271 static cvar_t forceqmenu = { 0, "forceqmenu", "0" };
4273 void MR_SetRouting(qboolean forceold)
4275 static qboolean m_init = FALSE, mp_init = FALSE;
4277 // if the menu prog isnt available or forceqmenu ist set, use the old menu
4278 if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold)
4280 // set menu router function pointers
4281 MR_Keydown = M_Keydown;
4283 MR_ToggleMenu_f = M_ToggleMenu_f;
4284 MR_Shutdown = M_Shutdown;
4297 // set menu router function pointers
4298 MR_Keydown = MP_Keydown;
4300 MR_ToggleMenu_f = MP_ToggleMenu_f;
4301 MR_Shutdown = MP_Shutdown;
4313 void MR_Restart(void)
4316 MR_SetRouting (FALSE);
4319 void Call_MR_ToggleMenu_f(void)
4325 void MR_Init_Commands(void)
4327 // set router console commands
4328 Cvar_RegisterVariable (&forceqmenu);
4329 if (gamemode == GAME_NETHERWORLD)
4330 Cmd_AddCommand ("menu_fallback", MP_Error); //Force to old-style menu
4331 Cmd_AddCommand ("menu_restart",MR_Restart);
4332 Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f);
4337 // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
4338 // COMMANDLINEOPTION: Client: -forceqmenu disables menu.dat (same as +forceqmenu 1)
4339 if(COM_CheckParm("-forceqmenu"))
4340 Cvar_SetValueQuick(&forceqmenu,1);
4341 // use -useqmenu for debugging proposes, cause it starts
4342 // the normal quake menu only the first time
4343 // COMMANDLINEOPTION: Client: -useqmenu causes the first time you open the menu to use the quake menu, then reverts to menu.dat (if forceqmenu is 0)
4344 if(COM_CheckParm("-useqmenu"))
4345 MR_SetRouting (TRUE);
4347 MR_SetRouting (FALSE);