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 void M_Update_Return_Reason(char *s)
99 strlcpy(m_return_reason, s, sizeof(m_return_reason));
101 Con_Printf("%s\n", s);
104 #define StartingGame (m_multiplayer_cursor == 1)
105 #define JoiningGame (m_multiplayer_cursor == 0)
108 #define NumberOfNehahraDemos 34
113 } nehahrademonames_t;
115 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
117 {"intro", "Prologue"},
118 {"genf", "The Beginning"},
119 {"genlab", "A Doomed Project"},
120 {"nehcre", "The New Recruits"},
121 {"maxneh", "Breakthrough"},
122 {"maxchar", "Renewal and Duty"},
123 {"crisis", "Worlds Collide"},
124 {"postcris", "Darkening Skies"},
125 {"hearing", "The Hearing"},
126 {"getjack", "On a Mexican Radio"},
127 {"prelude", "Honor and Justice"},
128 {"abase", "A Message Sent"},
129 {"effect", "The Other Side"},
130 {"uhoh", "Missing in Action"},
131 {"prepare", "The Response"},
132 {"vision", "Farsighted Eyes"},
133 {"maxturns", "Enter the Immortal"},
134 {"backlot", "Separate Ways"},
135 {"maxside", "The Ancient Runes"},
136 {"counter", "The New Initiative"},
137 {"warprep", "Ghosts to the World"},
138 {"counter1", "A Fate Worse Than Death"},
139 {"counter2", "Friendly Fire"},
140 {"counter3", "Minor Setback"},
141 {"madmax", "Scores to Settle"},
142 {"quake", "One Man"},
143 {"cthmm", "Shattered Masks"},
144 {"shades", "Deal with the Dead"},
145 {"gophil", "An Unlikely Hero"},
146 {"cstrike", "War in Hell"},
147 {"shubset", "The Conspiracy"},
148 {"shubdie", "Even Death May Die"},
149 {"newranks", "An Empty Throne"},
150 {"seal", "The Seal is Broken"}
153 float menu_x, menu_y, menu_width, menu_height;
155 void M_Background(int width, int height)
158 menu_height = height;
159 menu_x = (vid.conwidth - menu_width) * 0.5;
160 menu_y = (vid.conheight - menu_height) * 0.5;
161 //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
162 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
169 Draws one solid graphics character
172 void M_DrawCharacter (float cx, float cy, int num)
177 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
180 void M_Print(float cx, float cy, const char *str)
182 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
185 void M_PrintRed (float cx, float cy, const char *str)
187 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
190 void M_ItemPrint(float cx, float cy, char *str, int unghosted)
193 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
195 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
198 void M_DrawPic (float cx, float cy, char *picname)
200 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
203 qbyte identityTable[256];
204 qbyte translationTable[256];
206 void M_BuildTranslationTable(int top, int bottom)
209 qbyte *dest, *source;
211 for (j = 0; j < 256; j++)
212 identityTable[j] = j;
213 dest = translationTable;
214 source = identityTable;
215 memcpy (dest, source, 256);
217 // LordHavoc: corrected skin color ranges
218 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
219 memcpy (dest + TOP_RANGE, source + top, 16);
221 for (j=0 ; j<16 ; j++)
222 dest[TOP_RANGE+j] = source[top+15-j];
224 // LordHavoc: corrected skin color ranges
225 if (bottom < 128 || (bottom >= 224 && bottom < 240))
226 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
228 for (j=0 ; j<16 ; j++)
229 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
233 void M_DrawTextBox (float x, float y, float width, float height)
241 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
242 for (n = 0; n < height; n++)
245 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
247 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
254 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
255 for (n = 0; n < height; n++)
259 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
261 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
263 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
270 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
271 for (n = 0; n < height; n++)
274 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
276 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
279 //=============================================================================
281 //int m_save_demonum;
288 void M_ToggleMenu_f (void)
292 if (key_dest != key_menu || m_state != m_main)
303 void M_Demo_Draw (void)
307 M_Background(320, 200);
309 for (i = 0;i < NumberOfNehahraDemos;i++)
310 M_Print(16, 16 + 8*i, NehahraDemos[i].desc);
313 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
317 void M_Menu_Demos_f (void)
324 void M_Demo_Key (int k, char ascii)
333 S_LocalSound ("misc/menu2.wav", true);
336 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
341 S_LocalSound ("misc/menu1.wav", true);
344 demo_cursor = NumberOfNehahraDemos-1;
349 S_LocalSound ("misc/menu1.wav", true);
351 if (demo_cursor >= NumberOfNehahraDemos)
357 //=============================================================================
362 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
364 void M_Menu_Main_f (void)
366 if (gamemode == GAME_NEHAHRA)
368 if (NehGameType == TYPE_DEMO)
370 else if (NehGameType == TYPE_GAME)
375 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
381 if (key_dest != key_menu)
383 m_save_demonum = cls.demonum;
393 void M_Main_Draw (void)
398 M_Background(320, 200);
400 M_DrawPic (16, 4, "gfx/qplaque.lmp");
401 p = Draw_CachePic ("gfx/ttl_main.lmp");
402 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
404 if (gamemode == GAME_NEHAHRA)
406 if (NehGameType == TYPE_BOTH)
407 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
408 else if (NehGameType == TYPE_GAME)
409 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
411 M_DrawPic (72, 32, "gfx/demomenu.lmp");
414 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
416 f = (int)(realtime * 10)%6;
418 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
422 void M_Main_Key (int key, char ascii)
429 //cls.demonum = m_save_demonum;
430 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
435 S_LocalSound ("misc/menu1.wav", true);
436 if (++m_main_cursor >= MAIN_ITEMS)
441 S_LocalSound ("misc/menu1.wav", true);
442 if (--m_main_cursor < 0)
443 m_main_cursor = MAIN_ITEMS - 1;
449 if (gamemode == GAME_NEHAHRA)
454 switch (m_main_cursor)
457 M_Menu_SinglePlayer_f ();
465 M_Menu_MultiPlayer_f ();
475 Cbuf_AddText ("disconnect\n");
476 Cbuf_AddText ("playdemo endcred\n");
485 switch (m_main_cursor)
488 M_Menu_SinglePlayer_f ();
492 M_Menu_MultiPlayer_f ();
502 Cbuf_AddText ("disconnect\n");
503 Cbuf_AddText ("playdemo endcred\n");
512 switch (m_main_cursor)
521 Cbuf_AddText ("disconnect\n");
522 Cbuf_AddText ("playdemo endcred\n");
536 else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item
538 switch (m_main_cursor)
541 M_Menu_SinglePlayer_f ();
545 M_Menu_MultiPlayer_f ();
566 switch (m_main_cursor)
569 M_Menu_SinglePlayer_f ();
573 M_Menu_MultiPlayer_f ();
592 //=============================================================================
593 /* SINGLE PLAYER MENU */
595 int m_singleplayer_cursor;
596 #define SINGLEPLAYER_ITEMS 3
599 void M_Menu_SinglePlayer_f (void)
602 m_state = m_singleplayer;
607 void M_SinglePlayer_Draw (void)
611 M_Background(320, 200);
613 M_DrawPic (16, 4, "gfx/qplaque.lmp");
614 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
616 // Transfusion doesn't have a single player mode
617 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
619 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
621 M_DrawTextBox (60, 8 * 8, 23, 4);
622 if (gamemode == GAME_NEXUIZ)
623 M_Print(95, 10 * 8, "Nexuiz is for");
624 else if (gamemode == GAME_GOODVSBAD2)
625 M_Print(95, 10 * 8, "Good Vs Bad 2 is for");
626 else if (gamemode == GAME_BATTLEMECH)
627 M_Print(95, 10 * 8, "Battlemech is for");
629 M_Print(95, 10 * 8, "Transfusion is for");
630 M_Print(83, 11 * 8, "multiplayer play only");
636 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
637 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
639 f = (int)(realtime * 10)%6;
641 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
646 void M_SinglePlayer_Key (int key, char ascii)
648 if (gamemode == GAME_TRANSFUSION || gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
650 if (key == K_ESCAPE || key == K_ENTER)
662 S_LocalSound ("misc/menu1.wav", true);
663 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
664 m_singleplayer_cursor = 0;
668 S_LocalSound ("misc/menu1.wav", true);
669 if (--m_singleplayer_cursor < 0)
670 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
676 switch (m_singleplayer_cursor)
681 Cbuf_AddText ("disconnect\n");
682 Cbuf_AddText ("maxplayers 1\n");
683 Cbuf_AddText ("deathmatch 0\n");
684 Cbuf_AddText ("coop 0\n");
685 if (gamemode == GAME_NEHAHRA)
686 Cbuf_AddText ("map nehstart\n");
688 Cbuf_AddText ("map start\n");
702 //=============================================================================
705 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
707 #define MAX_SAVEGAMES 12
708 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
709 int loadable[MAX_SAVEGAMES];
711 void M_ScanSaves (void)
714 char name[MAX_OSPATH];
719 for (i=0 ; i<MAX_SAVEGAMES ; i++)
721 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
723 sprintf (name, "s%i.sav", i);
724 f = FS_Open (name, "r", false);
727 str = FS_Getline (f);
728 sscanf (str, "%i\n", &version);
729 str = FS_Getline (f);
730 strlcpy (m_filenames[i], str, sizeof (m_filenames[i]));
732 // change _ back to space
733 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
734 if (m_filenames[i][j] == '_')
735 m_filenames[i][j] = ' ';
741 void M_Menu_Load_f (void)
750 void M_Menu_Save_f (void)
765 void M_Load_Draw (void)
770 M_Background(320, 200);
772 p = Draw_CachePic ("gfx/p_load.lmp");
773 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
775 for (i=0 ; i< MAX_SAVEGAMES; i++)
776 M_Print(16, 32 + 8*i, m_filenames[i]);
779 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
783 void M_Save_Draw (void)
788 M_Background(320, 200);
790 p = Draw_CachePic ("gfx/p_save.lmp");
791 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
793 for (i=0 ; i<MAX_SAVEGAMES ; i++)
794 M_Print(16, 32 + 8*i, m_filenames[i]);
797 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
801 void M_Load_Key (int k, char ascii)
806 M_Menu_SinglePlayer_f ();
810 S_LocalSound ("misc/menu2.wav", true);
811 if (!loadable[load_cursor])
816 // issue the load command
817 Cbuf_AddText (va ("load s%i\n", load_cursor) );
822 S_LocalSound ("misc/menu1.wav", true);
825 load_cursor = MAX_SAVEGAMES-1;
830 S_LocalSound ("misc/menu1.wav", true);
832 if (load_cursor >= MAX_SAVEGAMES)
839 void M_Save_Key (int k, char ascii)
844 M_Menu_SinglePlayer_f ();
850 Cbuf_AddText (va("save s%i\n", load_cursor));
855 S_LocalSound ("misc/menu1.wav", true);
858 load_cursor = MAX_SAVEGAMES-1;
863 S_LocalSound ("misc/menu1.wav", true);
865 if (load_cursor >= MAX_SAVEGAMES)
871 //=============================================================================
872 /* MULTIPLAYER MENU */
874 int m_multiplayer_cursor;
875 #define MULTIPLAYER_ITEMS 3
878 void M_Menu_MultiPlayer_f (void)
881 m_state = m_multiplayer;
886 void M_MultiPlayer_Draw (void)
891 M_Background(320, 200);
893 M_DrawPic (16, 4, "gfx/qplaque.lmp");
894 p = Draw_CachePic ("gfx/p_multi.lmp");
895 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
896 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
898 f = (int)(realtime * 10)%6;
900 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
904 void M_MultiPlayer_Key (int key, char ascii)
913 S_LocalSound ("misc/menu1.wav", true);
914 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
915 m_multiplayer_cursor = 0;
919 S_LocalSound ("misc/menu1.wav", true);
920 if (--m_multiplayer_cursor < 0)
921 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
926 switch (m_multiplayer_cursor)
930 M_Menu_LanConfig_f ();
940 //=============================================================================
943 int setup_cursor = 4;
944 int setup_cursor_table[] = {40, 64, 88, 124, 140};
946 char setup_myname[32];
954 #define NUM_SETUP_CMDS 5
956 void M_Menu_Setup_f (void)
961 strcpy(setup_myname, cl_name.string);
962 setup_top = setup_oldtop = cl_color.integer >> 4;
963 setup_bottom = setup_oldbottom = cl_color.integer & 15;
964 setup_rate = cl_rate.integer;
967 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
968 static qbyte *menuplyr_pixels;
969 static unsigned int *menuplyr_translated;
971 typedef struct ratetable_s
978 #define RATES ((int)(sizeof(setup_ratetable)/sizeof(setup_ratetable[0])))
979 static ratetable_t setup_ratetable[] =
982 {1500, "28.8 mediocre"},
984 {2500, "33.6 mediocre"},
987 {4000, "56k mediocre"},
988 {4500, "56k adequate"},
991 {15000, "128k ISDN"},
995 static int setup_rateindex(int rate)
998 for (i = 0;i < RATES;i++)
999 if (setup_ratetable[i].rate > setup_rate)
1001 return bound(1, i, RATES) - 1;
1004 void M_Setup_Draw (void)
1009 M_Background(320, 200);
1011 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1012 p = Draw_CachePic ("gfx/p_multi.lmp");
1013 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1015 M_Print(64, 40, "Your name");
1016 M_DrawTextBox (160, 32, 16, 1);
1017 M_Print(168, 40, setup_myname);
1019 if (gamemode != GAME_GOODVSBAD2)
1021 M_Print(64, 64, "Shirt color");
1022 M_Print(64, 88, "Pants color");
1025 M_Print(64, 124-8, "Network speed limit");
1026 M_Print(168, 124, va("%i (%s)", setup_rate, setup_ratetable[setup_rateindex(setup_rate)].name));
1028 M_DrawTextBox (64, 140-8, 14, 1);
1029 M_Print(72, 140, "Accept Changes");
1031 // LordHavoc: rewrote this code greatly
1035 menuplyr_load = false;
1037 menuplyr_bottom = -1;
1038 if ((f = FS_LoadFile("gfx/menuplyr.lmp", tempmempool, true)))
1040 data = LoadLMPAs8Bit (f, 0, 0);
1041 menuplyr_width = image_width;
1042 menuplyr_height = image_height;
1044 menuplyr_pixels = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height);
1045 menuplyr_translated = Mem_Alloc(menu_mempool, menuplyr_width * menuplyr_height * 4);
1046 memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
1051 if (menuplyr_pixels)
1053 if (menuplyr_top != setup_top || menuplyr_bottom != setup_bottom)
1055 menuplyr_top = setup_top;
1056 menuplyr_bottom = setup_bottom;
1057 M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16);
1058 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
1059 menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]];
1060 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated);
1062 M_DrawPic(160, 48, "gfx/bigbox.lmp");
1063 M_DrawPic(172, 56, "gfx/menuplyr.lmp");
1066 if (setup_cursor == 0)
1067 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1069 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1073 void M_Setup_Key (int k, char ascii)
1080 M_Menu_MultiPlayer_f ();
1084 S_LocalSound ("misc/menu1.wav", true);
1086 if (setup_cursor < 0)
1087 setup_cursor = NUM_SETUP_CMDS-1;
1091 S_LocalSound ("misc/menu1.wav", true);
1093 if (setup_cursor >= NUM_SETUP_CMDS)
1098 if (setup_cursor < 1)
1100 S_LocalSound ("misc/menu3.wav", true);
1101 if (setup_cursor == 1)
1102 setup_top = setup_top - 1;
1103 if (setup_cursor == 2)
1104 setup_bottom = setup_bottom - 1;
1105 if (setup_cursor == 3)
1107 l = setup_rateindex(setup_rate) - 1;
1110 setup_rate = setup_ratetable[l].rate;
1114 if (setup_cursor < 1)
1117 S_LocalSound ("misc/menu3.wav", true);
1118 if (setup_cursor == 1)
1119 setup_top = setup_top + 1;
1120 if (setup_cursor == 2)
1121 setup_bottom = setup_bottom + 1;
1122 if (setup_cursor == 3)
1124 l = setup_rateindex(setup_rate) + 1;
1127 setup_rate = setup_ratetable[l].rate;
1132 if (setup_cursor == 0)
1135 if (setup_cursor == 1 || setup_cursor == 2 || setup_cursor == 3)
1138 // setup_cursor == 4 (Accept changes)
1139 if (strcmp(cl_name.string, setup_myname) != 0)
1140 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1141 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1142 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1143 if (setup_rate != setup_oldrate)
1144 Cbuf_AddText(va("rate %i\n", setup_rate));
1146 m_entersound = true;
1147 M_Menu_MultiPlayer_f ();
1151 if (setup_cursor == 0)
1153 if (strlen(setup_myname))
1154 setup_myname[strlen(setup_myname)-1] = 0;
1159 if (ascii < 32 || ascii > 126)
1161 if (setup_cursor == 0)
1163 l = strlen(setup_myname);
1166 setup_myname[l+1] = 0;
1167 setup_myname[l] = ascii;
1176 if (setup_bottom > 15)
1178 if (setup_bottom < 0)
1182 //=============================================================================
1185 #define SLIDER_RANGE 10
1187 void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
1192 range = bound(0, (num - rangemin) / (rangemax - rangemin), 1);
1193 M_DrawCharacter (x-8, y, 128);
1194 for (i = 0;i < SLIDER_RANGE;i++)
1195 M_DrawCharacter (x + i*8, y, 129);
1196 M_DrawCharacter (x+i*8, y, 130);
1197 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1198 if (fabs((int)num - num) < 0.01)
1199 sprintf(text, "%i", (int)num);
1201 sprintf(text, "%.2f", num);
1202 M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
1205 void M_DrawCheckbox (int x, int y, int on)
1208 M_Print(x, y, "on");
1210 M_Print(x, y, "off");
1214 #define OPTIONS_ITEMS 40
1218 void M_Menu_Options_f (void)
1220 key_dest = key_menu;
1221 m_state = m_options;
1222 m_entersound = true;
1225 extern cvar_t slowmo;
1226 extern dllhandle_t jpeg_dll;
1227 extern cvar_t gl_texture_anisotropy;
1228 extern cvar_t r_textshadow;
1230 void M_Menu_Options_AdjustSliders (int dir)
1233 S_LocalSound ("misc/menu3.wav", true);
1236 if (options_cursor == optnum++)
1237 Cvar_SetValueQuick (&vid_conwidth, bound(320, vid_conwidth.value + dir * 64, 2048));
1238 else if (options_cursor == optnum++)
1239 Cvar_SetValueQuick (&vid_conheight, bound(240, vid_conheight.value + dir * 48, 1536));
1240 else if (options_cursor == optnum++)
1241 Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
1242 else if (options_cursor == optnum++)
1243 Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
1244 else if (options_cursor == optnum++)
1245 Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1));
1246 else if (options_cursor == optnum++)
1247 Cvar_SetValueQuick (&sbar_alpha_bg, bound(0, sbar_alpha_bg.value + dir * 0.1, 1));
1248 else if (options_cursor == optnum++)
1249 Cvar_SetValueQuick (&sbar_alpha_fg, bound(0, sbar_alpha_fg.value + dir * 0.1, 1));
1250 else if (options_cursor == optnum++)
1251 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1252 else if (options_cursor == optnum++)
1253 Cvar_SetValueQuick (&scr_fov, bound(1, scr_fov.integer + dir * 1, 170));
1254 else if (options_cursor == optnum++)
1255 Cvar_SetValueQuick (&scr_screenshot_jpeg, !scr_screenshot_jpeg.integer);
1256 else if (options_cursor == optnum++)
1257 Cvar_SetValueQuick (&scr_screenshot_jpeg_quality, bound(0, scr_screenshot_jpeg_quality.value + dir * 0.1, 1));
1258 else if (options_cursor == optnum++)
1259 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1260 else if (options_cursor == optnum++)
1261 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1262 else if (options_cursor == optnum++)
1263 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1264 else if (options_cursor == optnum++)
1265 Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy));
1266 else if (options_cursor == optnum++)
1267 Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
1268 else if (options_cursor == optnum++)
1269 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1270 else if (options_cursor == optnum++)
1271 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1272 else if (options_cursor == optnum++)
1273 Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1));
1274 else if (options_cursor == optnum++)
1275 Cvar_SetValueQuick (&r_textshadow, !r_textshadow.integer);
1276 else if (options_cursor == optnum++)
1277 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1278 else if (options_cursor == optnum++)
1279 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1280 else if (options_cursor == optnum++)
1281 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1282 else if (options_cursor == optnum++)
1283 Cvar_SetValueQuick (&showfps, !showfps.integer);
1284 else if (options_cursor == optnum++)
1285 Cvar_SetValueQuick (&showtime, !showtime.integer);
1286 else if (options_cursor == optnum++)
1287 Cvar_SetValueQuick (&showdate, !showdate.integer);
1288 else if (options_cursor == optnum++)
1290 if (cl_forwardspeed.value > 200)
1292 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1293 Cvar_SetValueQuick (&cl_backspeed, 200);
1297 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1298 Cvar_SetValueQuick (&cl_backspeed, 400);
1301 else if (options_cursor == optnum++)
1302 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1303 else if (options_cursor == optnum++)
1304 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1305 else if (options_cursor == optnum++)
1306 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1307 else if (options_cursor == optnum++)
1308 Cvar_SetValueQuick (&freelook, !freelook.integer);
1309 else if (options_cursor == optnum++)
1310 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1311 else if (options_cursor == optnum++)
1312 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1319 void M_Options_PrintCommand(char *s, int enabled)
1323 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);
1324 M_ItemPrint(0, opty, s, enabled);
1330 void M_Options_PrintCheckbox(char *s, int enabled, int yes)
1334 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);
1335 M_ItemPrint(0, opty, s, enabled);
1336 M_DrawCheckbox(0 + strlen(s) * 8 + 8, opty, yes);
1342 void M_Options_PrintSlider(char *s, int enabled, float value, float minvalue, float maxvalue)
1346 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);
1347 M_ItemPrint(0, opty, s, enabled);
1348 M_DrawSlider(0 + strlen(s) * 8 + 8, opty, value, minvalue, maxvalue);
1354 void M_Options_Draw (void)
1359 M_Background(320, 240);
1361 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1362 p = Draw_CachePic("gfx/p_option.lmp");
1363 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1366 optcursor = options_cursor;
1367 visible = (vid.conheight - 32) / 8;
1368 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
1370 M_Options_PrintCommand( "Customize controls", true);
1371 M_Options_PrintCommand( " Go to console", true);
1372 M_Options_PrintCommand( " Reset to defaults", true);
1373 M_Options_PrintCommand( " Video", true);
1374 M_Options_PrintCommand( " Effects", true);
1375 M_Options_PrintCommand( " Graphics", true);
1376 M_Options_PrintCommand( " Color Control", true);
1377 M_Options_PrintSlider( " 2D Screen Width ", true, vid_conwidth.value, 320, 2048);
1378 M_Options_PrintSlider( " 2D Screen Height", true, vid_conheight.value, 240, 1536);
1379 M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000);
1380 M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1);
1381 M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1);
1382 M_Options_PrintSlider( " Sbar Alpha BG", true, sbar_alpha_bg.value, 0, 1);
1383 M_Options_PrintSlider( " Sbar Alpha FG", true, sbar_alpha_fg.value, 0, 1);
1384 M_Options_PrintSlider( " Screen size", true, scr_viewsize.value, 30, 120);
1385 M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
1386 M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
1387 M_Options_PrintSlider( " JPEG quality", jpeg_dll != NULL, scr_screenshot_jpeg_quality.value, 0, 1);
1388 M_Options_PrintCheckbox(" Sky", true, r_sky.integer);
1389 M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer);
1390 M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer);
1391 M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
1392 M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5);
1393 M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
1394 M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1);
1395 M_Options_PrintSlider(gamemode == GAME_GOODVSBAD2 ? " Music Volume" : " Ambient Volume", snd_initialized.integer, snd_staticvolume.value, 0, 1);
1396 M_Options_PrintCheckbox(" Text Shadow", true, r_textshadow.integer);
1397 M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5);
1398 M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5);
1399 M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer);
1400 M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
1401 M_Options_PrintCheckbox(" Show Time", true, showtime.integer);
1402 M_Options_PrintCheckbox(" Show Date", true, showdate.integer);
1403 M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
1404 M_Options_PrintCheckbox(" Lookspring", true, lookspring.integer);
1405 M_Options_PrintCheckbox(" Lookstrafe", true, lookstrafe.integer);
1406 M_Options_PrintSlider( " Mouse Speed", true, sensitivity.value, 1, 50);
1407 M_Options_PrintCheckbox(" Mouse Look", true, freelook.integer);
1408 M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
1409 M_Options_PrintCheckbox(" Use Mouse", true, vid_mouse.integer);
1413 void M_Options_Key (int k, char ascii)
1422 m_entersound = true;
1423 switch (options_cursor)
1430 key_dest = key_game;
1431 Con_ToggleConsole_f ();
1440 M_Menu_Options_Effects_f ();
1443 M_Menu_Options_Graphics_f ();
1446 M_Menu_Options_ColorControl_f ();
1449 M_Menu_Options_AdjustSliders (1);
1455 S_LocalSound ("misc/menu1.wav", true);
1457 if (options_cursor < 0)
1458 options_cursor = OPTIONS_ITEMS-1;
1462 S_LocalSound ("misc/menu1.wav", true);
1464 if (options_cursor >= OPTIONS_ITEMS)
1469 M_Menu_Options_AdjustSliders (-1);
1473 M_Menu_Options_AdjustSliders (1);
1478 #define OPTIONS_EFFECTS_ITEMS 37
1480 int options_effects_cursor;
1482 void M_Menu_Options_Effects_f (void)
1484 key_dest = key_menu;
1485 m_state = m_options_effects;
1486 m_entersound = true;
1490 extern cvar_t r_detailtextures;
1491 extern cvar_t cl_particles;
1492 extern cvar_t cl_stainmaps;
1493 extern cvar_t cl_stainmapsclearonload;
1494 extern cvar_t cl_decals;
1495 extern cvar_t r_explosionclip;
1496 extern cvar_t r_modellights;
1497 extern cvar_t r_coronas;
1498 extern cvar_t gl_flashblend;
1499 extern cvar_t cl_particles_quality;
1500 extern cvar_t cl_particles_bulletimpacts;
1501 extern cvar_t cl_particles_smoke;
1502 extern cvar_t cl_particles_sparks;
1503 extern cvar_t cl_particles_bubbles;
1504 extern cvar_t cl_particles_blood;
1505 extern cvar_t cl_particles_blood_alpha;
1506 extern cvar_t cl_particles_blood_bloodhack;
1507 extern cvar_t cl_particles_explosions_shell;
1508 extern cvar_t cl_beams_polygon;
1509 extern cvar_t cl_beams_relative;
1510 extern cvar_t cl_beams_lightatend;
1511 extern cvar_t r_lightningbeam_thickness;
1512 extern cvar_t r_lightningbeam_scroll;
1513 extern cvar_t r_lightningbeam_repeatdistance;
1514 extern cvar_t r_lightningbeam_color_red;
1515 extern cvar_t r_lightningbeam_color_green;
1516 extern cvar_t r_lightningbeam_color_blue;
1517 extern cvar_t r_lightningbeam_qmbtexture;
1519 void M_Menu_Options_Effects_AdjustSliders (int dir)
1522 S_LocalSound ("misc/menu3.wav", true);
1525 if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1526 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_coronas, bound(0, r_coronas.value + dir * 0.125, 4));
1527 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1528 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1529 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4));
1530 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_explosions_shell, !cl_particles_explosions_shell.integer);
1531 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1532 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1533 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmapsclearonload, !cl_stainmapsclearonload.integer);
1534 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer);
1535 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1536 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1537 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1538 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1539 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1540 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1541 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1542 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_blood_bloodhack, !cl_particles_blood_bloodhack.integer);
1543 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_polygons, !cl_beams_polygons.integer);
1544 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_relative, !cl_beams_relative.integer);
1545 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_beams_lightatend, !cl_beams_lightatend.integer);
1546 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_thickness, bound(1, r_lightningbeam_thickness.integer + dir, 10));
1547 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_scroll, bound(0, r_lightningbeam_scroll.integer + dir, 10));
1548 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_repeatdistance, bound(64, r_lightningbeam_repeatdistance.integer + dir * 64, 1024));
1549 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_red, bound(0, r_lightningbeam_color_red.value + dir * 0.1, 1));
1550 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_green, bound(0, r_lightningbeam_color_green.value + dir * 0.1, 1));
1551 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_color_blue, bound(0, r_lightningbeam_color_blue.value + dir * 0.1, 1));
1552 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lightningbeam_qmbtexture, !r_lightningbeam_qmbtexture.integer);
1553 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpmodels, !r_lerpmodels.integer);
1554 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_lerpsprites, !r_lerpsprites.integer);
1555 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_polyblend, bound(0, gl_polyblend.value + dir * 0.1, 1));
1556 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll1, bound(-8, r_skyscroll1.value + dir * 0.1, 8));
1557 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_skyscroll2, bound(-8, r_skyscroll2.value + dir * 0.1, 8));
1558 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterwarp, bound(0, r_waterwarp.value + dir * 0.1, 1));
1559 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_wateralpha, bound(0, r_wateralpha.value + dir * 0.1, 1));
1560 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
1561 else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_watershader, bound(0, r_watershader.value + dir * 0.25, 10));
1564 void M_Options_Effects_Draw (void)
1569 M_Background(320, 200);
1571 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1572 p = Draw_CachePic("gfx/p_option.lmp");
1573 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1575 optcursor = options_effects_cursor;
1577 visible = (vid.conheight - 32) / 8;
1578 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
1580 M_Options_PrintSlider( " Lights Per Model", true, r_modellights.value, 0, 8);
1581 M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
1582 M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer);
1583 M_Options_PrintCheckbox(" Particles", true, cl_particles.integer);
1584 M_Options_PrintSlider( " Particles Quality", true, cl_particles_quality.value, 1, 4);
1585 M_Options_PrintCheckbox(" Explosion Shell", true, cl_particles_explosions_shell.integer);
1586 M_Options_PrintCheckbox(" Explosion Shell Clip", true, r_explosionclip.integer);
1587 M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer);
1588 M_Options_PrintCheckbox("Onload Clear Stainmaps", true, cl_stainmapsclearonload.integer);
1589 M_Options_PrintCheckbox(" Decals", true, cl_decals.integer);
1590 M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer);
1591 M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer);
1592 M_Options_PrintCheckbox(" Smoke", true, cl_particles_smoke.integer);
1593 M_Options_PrintCheckbox(" Sparks", true, cl_particles_sparks.integer);
1594 M_Options_PrintCheckbox(" Bubbles", true, cl_particles_bubbles.integer);
1595 M_Options_PrintCheckbox(" Blood", true, cl_particles_blood.integer);
1596 M_Options_PrintSlider( " Blood Opacity", true, cl_particles_blood_alpha.value, 0.2, 1);
1597 M_Options_PrintCheckbox("Force New Blood Effect", true, cl_particles_blood_bloodhack.integer);
1598 M_Options_PrintCheckbox(" Lightning Polygons", true, cl_beams_polygons.integer);
1599 M_Options_PrintCheckbox("Lightning Smooth Sweep", true, cl_beams_relative.integer);
1600 M_Options_PrintCheckbox(" Lightning End Light", true, cl_beams_lightatend.integer);
1601 M_Options_PrintSlider( " Lightning Thickness", cl_beams_polygons.integer, r_lightningbeam_thickness.integer, 1, 10);
1602 M_Options_PrintSlider( " Lightning Scroll", cl_beams_polygons.integer, r_lightningbeam_scroll.integer, 0, 10);
1603 M_Options_PrintSlider( " Lightning Repeat Dist", cl_beams_polygons.integer, r_lightningbeam_repeatdistance.integer, 64, 1024);
1604 M_Options_PrintSlider( " Lightning Color Red", cl_beams_polygons.integer, r_lightningbeam_color_red.value, 0, 1);
1605 M_Options_PrintSlider( " Lightning Color Green", cl_beams_polygons.integer, r_lightningbeam_color_green.value, 0, 1);
1606 M_Options_PrintSlider( " Lightning Color Blue", cl_beams_polygons.integer, r_lightningbeam_color_blue.value, 0, 1);
1607 M_Options_PrintCheckbox(" Lightning QMB Texture", cl_beams_polygons.integer, r_lightningbeam_qmbtexture.integer);
1608 M_Options_PrintCheckbox(" Model Interpolation", true, r_lerpmodels.integer);
1609 M_Options_PrintCheckbox(" Sprite Interpolation", true, r_lerpsprites.integer);
1610 M_Options_PrintSlider( " View Blend", true, gl_polyblend.value, 0, 1);
1611 M_Options_PrintSlider( "Upper Sky Scroll Speed", true, r_skyscroll1.value, -8, 8);
1612 M_Options_PrintSlider( "Lower Sky Scroll Speed", true, r_skyscroll2.value, -8, 8);
1613 M_Options_PrintSlider( " Underwater View Warp", true, r_waterwarp.value, 0, 1);
1614 M_Options_PrintSlider( " Water Alpha (opacity)", true, r_wateralpha.value, 0, 1);
1615 M_Options_PrintSlider( " Water Movement", true, r_waterscroll.value, 0, 10);
1616 M_Options_PrintSlider( " GeForce3 Water Shader", true, r_watershader.value, 0, 10);
1620 void M_Options_Effects_Key (int k, char ascii)
1625 M_Menu_Options_f ();
1629 M_Menu_Options_Effects_AdjustSliders (1);
1633 S_LocalSound ("misc/menu1.wav", true);
1634 options_effects_cursor--;
1635 if (options_effects_cursor < 0)
1636 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1640 S_LocalSound ("misc/menu1.wav", true);
1641 options_effects_cursor++;
1642 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1643 options_effects_cursor = 0;
1647 M_Menu_Options_Effects_AdjustSliders (-1);
1651 M_Menu_Options_Effects_AdjustSliders (1);
1657 #define OPTIONS_GRAPHICS_ITEMS 7
1659 int options_graphics_cursor;
1661 void M_Menu_Options_Graphics_f (void)
1663 key_dest = key_menu;
1664 m_state = m_options_graphics;
1665 m_entersound = true;
1668 extern cvar_t r_shadow_gloss;
1669 extern cvar_t r_shadow_realtime_dlight;
1670 extern cvar_t r_shadow_realtime_dlight_shadows;
1671 extern cvar_t r_shadow_realtime_world;
1672 extern cvar_t r_shadow_realtime_world_dlightshadows;
1673 extern cvar_t r_shadow_realtime_world_lightmaps;
1674 extern cvar_t r_shadow_realtime_world_shadows;
1676 void M_Menu_Options_Graphics_AdjustSliders (int dir)
1679 S_LocalSound ("misc/menu3.wav", true);
1683 if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_gloss, bound(0, r_shadow_gloss.integer + dir, 2));
1684 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight, !r_shadow_realtime_dlight.integer);
1685 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight_shadows, !r_shadow_realtime_dlight_shadows.integer);
1686 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world, !r_shadow_realtime_world.integer);
1687 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_dlightshadows, !r_shadow_realtime_world_dlightshadows.integer);
1688 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));
1689 else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_shadows, !r_shadow_realtime_world_shadows.integer);
1693 void M_Options_Graphics_Draw (void)
1698 M_Background(320, 200);
1700 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1701 p = Draw_CachePic("gfx/p_option.lmp");
1702 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1704 optcursor = options_graphics_cursor;
1706 visible = (vid.conheight - 32) / 8;
1707 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
1709 M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
1710 M_Options_PrintCheckbox(" RT DLights", true, r_shadow_realtime_dlight.integer);
1711 M_Options_PrintCheckbox(" RT DLight Shadows", true, r_shadow_realtime_dlight_shadows.integer);
1712 M_Options_PrintCheckbox(" RT World", true, r_shadow_realtime_world.integer);
1713 M_Options_PrintCheckbox("RT World DLight Shadows", true, r_shadow_realtime_world_dlightshadows.integer);
1714 M_Options_PrintSlider( " RT World Lightmaps", true, r_shadow_realtime_world_lightmaps.value, 0, 1);
1715 M_Options_PrintCheckbox(" RT World Shadow", true, r_shadow_realtime_world_shadows.integer);
1719 void M_Options_Graphics_Key (int k, char ascii)
1724 M_Menu_Options_f ();
1728 M_Menu_Options_Graphics_AdjustSliders (1);
1732 S_LocalSound ("misc/menu1.wav", true);
1733 options_graphics_cursor--;
1734 if (options_graphics_cursor < 0)
1735 options_graphics_cursor = OPTIONS_GRAPHICS_ITEMS-1;
1739 S_LocalSound ("misc/menu1.wav", true);
1740 options_graphics_cursor++;
1741 if (options_graphics_cursor >= OPTIONS_GRAPHICS_ITEMS)
1742 options_graphics_cursor = 0;
1746 M_Menu_Options_Graphics_AdjustSliders (-1);
1750 M_Menu_Options_Graphics_AdjustSliders (1);
1756 #define OPTIONS_COLORCONTROL_ITEMS 18
1758 int options_colorcontrol_cursor;
1760 // intensity value to match up to 50% dither to 'correct' quake
1761 cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25"};
1763 void M_Menu_Options_ColorControl_f (void)
1765 key_dest = key_menu;
1766 m_state = m_options_colorcontrol;
1767 m_entersound = true;
1771 void M_Menu_Options_ColorControl_AdjustSliders (int dir)
1775 S_LocalSound ("misc/menu3.wav", true);
1778 if (options_colorcontrol_cursor == optnum++)
1779 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1780 else if (options_colorcontrol_cursor == optnum++)
1782 Cvar_SetValueQuick (&v_color_enable, 0);
1783 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5));
1785 else if (options_colorcontrol_cursor == optnum++)
1787 Cvar_SetValueQuick (&v_color_enable, 0);
1788 Cvar_SetValueQuick (&v_contrast, bound(1, v_contrast.value + dir * 0.125, 5));
1790 else if (options_colorcontrol_cursor == optnum++)
1792 Cvar_SetValueQuick (&v_color_enable, 0);
1793 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1795 else if (options_colorcontrol_cursor == optnum++)
1797 Cvar_SetValueQuick (&v_color_enable, !v_color_enable.integer);
1799 else if (options_colorcontrol_cursor == optnum++)
1801 Cvar_SetValueQuick (&v_color_enable, 1);
1802 Cvar_SetValueQuick (&v_color_black_r, bound(0, v_color_black_r.value + dir * 0.0125, 0.8));
1804 else if (options_colorcontrol_cursor == optnum++)
1806 Cvar_SetValueQuick (&v_color_enable, 1);
1807 Cvar_SetValueQuick (&v_color_black_g, bound(0, v_color_black_g.value + dir * 0.0125, 0.8));
1809 else if (options_colorcontrol_cursor == optnum++)
1811 Cvar_SetValueQuick (&v_color_enable, 1);
1812 Cvar_SetValueQuick (&v_color_black_b, bound(0, v_color_black_b.value + dir * 0.0125, 0.8));
1814 else if (options_colorcontrol_cursor == optnum++)
1816 Cvar_SetValueQuick (&v_color_enable, 1);
1817 f = bound(0, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3 + dir * 0.0125, 0.8);
1818 Cvar_SetValueQuick (&v_color_black_r, f);
1819 Cvar_SetValueQuick (&v_color_black_g, f);
1820 Cvar_SetValueQuick (&v_color_black_b, f);
1822 else if (options_colorcontrol_cursor == optnum++)
1824 Cvar_SetValueQuick (&v_color_enable, 1);
1825 Cvar_SetValueQuick (&v_color_grey_r, bound(0, v_color_grey_r.value + dir * 0.0125, 0.95));
1827 else if (options_colorcontrol_cursor == optnum++)
1829 Cvar_SetValueQuick (&v_color_enable, 1);
1830 Cvar_SetValueQuick (&v_color_grey_g, bound(0, v_color_grey_g.value + dir * 0.0125, 0.95));
1832 else if (options_colorcontrol_cursor == optnum++)
1834 Cvar_SetValueQuick (&v_color_enable, 1);
1835 Cvar_SetValueQuick (&v_color_grey_b, bound(0, v_color_grey_b.value + dir * 0.0125, 0.95));
1837 else if (options_colorcontrol_cursor == optnum++)
1839 Cvar_SetValueQuick (&v_color_enable, 1);
1840 f = bound(0, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3 + dir * 0.0125, 0.95);
1841 Cvar_SetValueQuick (&v_color_grey_r, f);
1842 Cvar_SetValueQuick (&v_color_grey_g, f);
1843 Cvar_SetValueQuick (&v_color_grey_b, f);
1845 else if (options_colorcontrol_cursor == optnum++)
1847 Cvar_SetValueQuick (&v_color_enable, 1);
1848 Cvar_SetValueQuick (&v_color_white_r, bound(1, v_color_white_r.value + dir * 0.125, 5));
1850 else if (options_colorcontrol_cursor == optnum++)
1852 Cvar_SetValueQuick (&v_color_enable, 1);
1853 Cvar_SetValueQuick (&v_color_white_g, bound(1, v_color_white_g.value + dir * 0.125, 5));
1855 else if (options_colorcontrol_cursor == optnum++)
1857 Cvar_SetValueQuick (&v_color_enable, 1);
1858 Cvar_SetValueQuick (&v_color_white_b, bound(1, v_color_white_b.value + dir * 0.125, 5));
1860 else if (options_colorcontrol_cursor == optnum++)
1862 Cvar_SetValueQuick (&v_color_enable, 1);
1863 f = bound(1, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3 + dir * 0.125, 5);
1864 Cvar_SetValueQuick (&v_color_white_r, f);
1865 Cvar_SetValueQuick (&v_color_white_g, f);
1866 Cvar_SetValueQuick (&v_color_white_b, f);
1870 void M_Options_ColorControl_Draw (void)
1873 float x, c, s, t, u, v;
1876 M_Background(320, 256);
1878 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1879 p = Draw_CachePic("gfx/p_option.lmp");
1880 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1882 optcursor = options_colorcontrol_cursor;
1884 visible = (vid.conheight - 32) / 8;
1885 opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
1887 M_Options_PrintCommand( " Reset to defaults", true);
1888 M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer);
1889 M_Options_PrintSlider( " Gamma", !v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_gamma.value, 1, 5);
1890 M_Options_PrintSlider( " Contrast", !v_color_enable.integer, v_contrast.value, 1, 5);
1891 M_Options_PrintSlider( " Brightness", !v_color_enable.integer, v_brightness.value, 0, 0.8);
1892 M_Options_PrintCheckbox(" Color Level Controls", true, v_color_enable.integer);
1893 M_Options_PrintSlider( " Black: Red ", v_color_enable.integer, v_color_black_r.value, 0, 0.8);
1894 M_Options_PrintSlider( " Black: Green", v_color_enable.integer, v_color_black_g.value, 0, 0.8);
1895 M_Options_PrintSlider( " Black: Blue ", v_color_enable.integer, v_color_black_b.value, 0, 0.8);
1896 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);
1897 M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_r.value, 0, 0.95);
1898 M_Options_PrintSlider( " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_g.value, 0, 0.95);
1899 M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_b.value, 0, 0.95);
1900 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);
1901 M_Options_PrintSlider( " White: Red ", v_color_enable.integer, v_color_white_r.value, 1, 5);
1902 M_Options_PrintSlider( " White: Green", v_color_enable.integer, v_color_white_g.value, 1, 5);
1903 M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5);
1904 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);
1907 DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
1908 s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
1909 t = (float) 4 / 2 * vid.realheight / vid.conheight;
1910 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;
1911 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;
1912 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;
1913 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;
1914 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;
1915 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;
1916 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;
1917 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;
1919 c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
1920 s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
1921 t = (float) 48 / 2 * vid.realheight / vid.conheight;
1926 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, 0, 0, 1, 0);
1927 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);
1928 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);
1930 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, c, 0, 1, 0);
1931 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);
1932 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);
1934 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, 0, c, 1, 0);
1935 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);
1936 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);
1938 DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, c, c, 1, 0);
1939 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);
1940 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);
1944 void M_Options_ColorControl_Key (int k, char ascii)
1949 M_Menu_Options_f ();
1953 m_entersound = true;
1954 switch (options_colorcontrol_cursor)
1957 Cvar_SetValueQuick(&v_hwgamma, 1);
1958 Cvar_SetValueQuick(&v_gamma, 1);
1959 Cvar_SetValueQuick(&v_contrast, 1);
1960 Cvar_SetValueQuick(&v_brightness, 0);
1961 Cvar_SetValueQuick(&v_color_enable, 0);
1962 Cvar_SetValueQuick(&v_color_black_r, 0);
1963 Cvar_SetValueQuick(&v_color_black_g, 0);
1964 Cvar_SetValueQuick(&v_color_black_b, 0);
1965 Cvar_SetValueQuick(&v_color_grey_r, 0);
1966 Cvar_SetValueQuick(&v_color_grey_g, 0);
1967 Cvar_SetValueQuick(&v_color_grey_b, 0);
1968 Cvar_SetValueQuick(&v_color_white_r, 1);
1969 Cvar_SetValueQuick(&v_color_white_g, 1);
1970 Cvar_SetValueQuick(&v_color_white_b, 1);
1973 M_Menu_Options_ColorControl_AdjustSliders (1);
1979 S_LocalSound ("misc/menu1.wav", true);
1980 options_colorcontrol_cursor--;
1981 if (options_colorcontrol_cursor < 0)
1982 options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
1986 S_LocalSound ("misc/menu1.wav", true);
1987 options_colorcontrol_cursor++;
1988 if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
1989 options_colorcontrol_cursor = 0;
1993 M_Menu_Options_ColorControl_AdjustSliders (-1);
1997 M_Menu_Options_ColorControl_AdjustSliders (1);
2003 //=============================================================================
2006 char *quakebindnames[][2] =
2008 {"+attack", "attack"},
2009 {"impulse 10", "next weapon"},
2010 {"impulse 12", "previous weapon"},
2011 {"+jump", "jump / swim up"},
2012 {"+forward", "walk forward"},
2013 {"+back", "backpedal"},
2014 {"+left", "turn left"},
2015 {"+right", "turn right"},
2017 {"+moveleft", "step left"},
2018 {"+moveright", "step right"},
2019 {"+strafe", "sidestep"},
2020 {"+lookup", "look up"},
2021 {"+lookdown", "look down"},
2022 {"centerview", "center view"},
2023 {"+mlook", "mouse look"},
2024 {"+klook", "keyboard look"},
2025 {"+moveup", "swim up"},
2026 {"+movedown", "swim down"}
2029 char *transfusionbindnames[][2] =
2031 {"", "Movement"}, // Movement commands
2032 {"+forward", "walk forward"},
2033 {"+back", "backpedal"},
2034 {"+left", "turn left"},
2035 {"+right", "turn right"},
2036 {"+moveleft", "step left"},
2037 {"+moveright", "step right"},
2038 {"+jump", "jump / swim up"},
2039 {"+movedown", "swim down"},
2040 {"", "Combat"}, // Combat commands
2041 {"impulse 1", "Pitch Fork"},
2042 {"impulse 2", "Flare Gun"},
2043 {"impulse 3", "Shotgun"},
2044 {"impulse 4", "Machine Gun"},
2045 {"impulse 5", "Incinerator"},
2046 {"impulse 6", "Bombs (TNT)"},
2047 {"impulse 35", "Proximity Bomb"},
2048 {"impulse 36", "Remote Detonator"},
2049 {"impulse 7", "Aerosol Can"},
2050 {"impulse 8", "Tesla Cannon"},
2051 {"impulse 9", "Life Leech"},
2052 {"impulse 10", "Voodoo Doll"},
2053 {"impulse 21", "next weapon"},
2054 {"impulse 22", "previous weapon"},
2055 {"+attack", "attack"},
2056 {"+button3", "altfire"},
2057 {"", "Inventory"}, // Inventory commands
2058 {"impulse 40", "Dr.'s Bag"},
2059 {"impulse 41", "Crystal Ball"},
2060 {"impulse 42", "Beast Vision"},
2061 {"impulse 43", "Jump Boots"},
2062 {"impulse 23", "next item"},
2063 {"impulse 24", "previous item"},
2064 {"impulse 25", "use item"},
2065 {"", "Misc"}, // Misc commands
2066 {"+button4", "use"},
2067 {"impulse 50", "add bot (red)"},
2068 {"impulse 51", "add bot (blue)"},
2069 {"impulse 52", "kick a bot"},
2070 {"impulse 26", "next armor type"},
2071 {"impulse 27", "identify player"},
2072 {"impulse 55", "voting menu"},
2073 {"impulse 56", "observer mode"},
2074 {"", "Taunts"}, // Taunts
2075 {"impulse 70", "taunt 0"},
2076 {"impulse 71", "taunt 1"},
2077 {"impulse 72", "taunt 2"},
2078 {"impulse 73", "taunt 3"},
2079 {"impulse 74", "taunt 4"},
2080 {"impulse 75", "taunt 5"},
2081 {"impulse 76", "taunt 6"},
2082 {"impulse 77", "taunt 7"},
2083 {"impulse 78", "taunt 8"},
2084 {"impulse 79", "taunt 9"}
2087 char *goodvsbad2bindnames[][2] =
2089 {"impulse 69", "Power 1"},
2090 {"impulse 70", "Power 2"},
2091 {"impulse 71", "Power 3"},
2092 {"+jump", "jump / swim up"},
2093 {"+forward", "walk forward"},
2094 {"+back", "backpedal"},
2095 {"+left", "turn left"},
2096 {"+right", "turn right"},
2098 {"+moveleft", "step left"},
2099 {"+moveright", "step right"},
2100 {"+strafe", "sidestep"},
2101 {"+lookup", "look up"},
2102 {"+lookdown", "look down"},
2103 {"centerview", "center view"},
2104 {"+mlook", "mouse look"},
2105 {"kill", "kill yourself"},
2106 {"+moveup", "swim up"},
2107 {"+movedown", "swim down"}
2111 char *(*bindnames)[2];
2114 typedef struct binditem_s
2116 char *command, *description;
2117 struct binditem_s *next;
2121 typedef struct bindcategory_s
2125 struct bindcategory_s *next;
2129 bindcategory_t *bindcategories = NULL;
2131 void M_ClearBinds (void)
2133 for (c = bindcategories;c;c = cnext)
2136 for (b = c->binds;b;b = bnext)
2143 bindcategories = NULL;
2146 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
2148 for (b = &c->binds;*b;*b = &(*b)->next);
2149 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
2150 *b->command = (char *)((*b) + 1);
2151 *b->description = *b->command + strlen(command) + 1;
2152 strcpy(*b->command, command);
2153 strcpy(*b->description, description);
2156 void M_AddBind (char *category, char *command, char *description)
2158 for (c = &bindcategories;*c;c = &(*c)->next)
2160 if (!strcmp(category, (*c)->name))
2162 M_AddBindToCategory(*c, command, description);
2166 *c = Z_Alloc(sizeof(bindcategory_t));
2167 M_AddBindToCategory(*c, command, description);
2170 void M_DefaultBinds (void)
2173 M_AddBind("movement", "+jump", "jump / swim up");
2174 M_AddBind("movement", "+forward", "walk forward");
2175 M_AddBind("movement", "+back", "backpedal");
2176 M_AddBind("movement", "+left", "turn left");
2177 M_AddBind("movement", "+right", "turn right");
2178 M_AddBind("movement", "+speed", "run");
2179 M_AddBind("movement", "+moveleft", "step left");
2180 M_AddBind("movement", "+moveright", "step right");
2181 M_AddBind("movement", "+strafe", "sidestep");
2182 M_AddBind("movement", "+lookup", "look up");
2183 M_AddBind("movement", "+lookdown", "look down");
2184 M_AddBind("movement", "centerview", "center view");
2185 M_AddBind("movement", "+mlook", "mouse look");
2186 M_AddBind("movement", "+klook", "keyboard look");
2187 M_AddBind("movement", "+moveup", "swim up");
2188 M_AddBind("movement", "+movedown", "swim down");
2189 M_AddBind("weapons", "+attack", "attack");
2190 M_AddBind("weapons", "impulse 10", "next weapon");
2191 M_AddBind("weapons", "impulse 12", "previous weapon");
2192 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
2193 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
2194 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
2195 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
2196 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
2197 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
2198 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
2199 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
2207 void M_Menu_Keys_f (void)
2209 key_dest = key_menu;
2211 m_entersound = true;
2216 void M_FindKeysForCommand (char *command, int *keys)
2222 for (j = 0;j < NUMKEYS;j++)
2227 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2229 b = keybindings[0][j];
2232 if (!strcmp (b, command) )
2235 if (count == NUMKEYS)
2241 void M_UnbindCommand (char *command)
2246 for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
2248 b = keybindings[0][j];
2251 if (!strcmp (b, command))
2252 Key_SetBinding (j, 0, "");
2257 void M_Keys_Draw (void)
2263 char keystring[1024];
2265 M_Background(320, 48 + 8 * numcommands);
2267 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
2268 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
2271 M_Print(12, 32, "Press a key or button for this action");
2273 M_Print(18, 32, "Enter to change, backspace to clear");
2275 // search for known bindings
2276 for (i=0 ; i<numcommands ; i++)
2280 // If there's no command, it's just a section
2281 if (bindnames[i][0][0] == '\0')
2283 M_PrintRed (4, y, "\x0D"); // #13 is the little arrow pointing to the right
2284 M_PrintRed (16, y, bindnames[i][1]);
2288 M_Print(16, y, bindnames[i][1]);
2290 M_FindKeysForCommand (bindnames[i][0], keys);
2292 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
2294 strcpy(keystring, "???");
2298 for (j = 0;j < NUMKEYS;j++)
2303 strcat(keystring, " or ");
2304 strcat(keystring, Key_KeynumToString (keys[j]));
2308 M_Print(150, y, keystring);
2312 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
2314 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
2318 void M_Keys_Key (int k, char ascii)
2325 S_LocalSound ("misc/menu1.wav", true);
2330 else //if (k != '`')
2332 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
2333 Cbuf_InsertText (cmd);
2343 M_Menu_Options_f ();
2348 S_LocalSound ("misc/menu1.wav", true);
2352 if (keys_cursor < 0)
2353 keys_cursor = numcommands-1;
2355 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2360 S_LocalSound ("misc/menu1.wav", true);
2364 if (keys_cursor >= numcommands)
2367 while (bindnames[keys_cursor][0][0] == '\0'); // skip sections
2370 case K_ENTER: // go into bind mode
2371 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
2372 S_LocalSound ("misc/menu2.wav", true);
2373 if (keys[NUMKEYS - 1] != -1)
2374 M_UnbindCommand (bindnames[keys_cursor][0]);
2378 case K_BACKSPACE: // delete bindings
2379 case K_DEL: // delete bindings
2380 S_LocalSound ("misc/menu2.wav", true);
2381 M_UnbindCommand (bindnames[keys_cursor][0]);
2386 void M_Menu_Reset_f (void)
2388 key_dest = key_menu;
2390 m_entersound = true;
2394 void M_Reset_Key (int key, char ascii)
2401 m_state = m_options;
2402 m_entersound = true;
2407 Cbuf_AddText ("exec default.cfg\n");
2415 void M_Reset_Draw (void)
2417 int lines = 2, linelength = 20;
2418 M_Background(linelength * 8 + 16, lines * 8 + 16);
2419 M_DrawTextBox(0, 0, linelength, lines);
2420 M_Print(8 + 4 * (linelength - 19), 8, "Really wanna reset?");
2421 M_Print(8 + 4 * (linelength - 11), 16, "Press y / n");
2424 //=============================================================================
2427 #define VIDEO_ITEMS 5
2429 int video_cursor = 0;
2430 int video_cursor_table[] = {56, 68, 80, 100, 120};
2431 // note: if modes are added to the beginning of this list, update the
2432 // video_resolution = x; in M_Menu_Video_f below
2433 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}};
2434 // this is the number of the 640x480 mode in the list
2436 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
2437 int video_resolution;
2439 extern int current_vid_fullscreen;
2440 extern int current_vid_width;
2441 extern int current_vid_height;
2442 extern int current_vid_bitsperpixel;
2445 void M_Menu_Video_f (void)
2447 key_dest = key_menu;
2449 m_entersound = true;
2451 // Look for the current resolution
2452 for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
2454 if (video_resolutions[video_resolution][0] == current_vid_width &&
2455 video_resolutions[video_resolution][1] == current_vid_height)
2459 // Default to VID_640 if we didn't find it
2460 if (video_resolution == VID_RES_COUNT)
2462 // may need to update this number if mode list changes
2463 video_resolution = VID_640;
2464 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2465 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2470 void M_Video_Draw (void)
2475 M_Background(320, 200);
2477 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2478 p = Draw_CachePic("gfx/vidmodes.lmp");
2479 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2482 M_Print(16, video_cursor_table[0], " Resolution");
2483 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2484 M_Print(220, video_cursor_table[0], string);
2487 M_Print(16, video_cursor_table[1], " Bits per pixel");
2488 M_Print(220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2491 M_Print(16, video_cursor_table[2], " Fullscreen");
2492 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2495 M_Print(220, video_cursor_table[3], "Apply");
2498 M_ItemPrint (0, video_cursor_table[4], " Vertical Sync", gl_videosyncavailable);
2499 M_DrawCheckbox(220, video_cursor_table[4], vid_vsync.integer);
2502 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2506 void M_Menu_Video_AdjustSliders (int dir)
2508 S_LocalSound ("misc/menu3.wav", true);
2510 switch (video_cursor)
2515 int new_resolution = video_resolution + dir;
2516 if (gamemode == GAME_FNIGGIUM ? new_resolution < VID_640 : new_resolution < 0)
2517 video_resolution = VID_RES_COUNT - 1;
2518 else if (new_resolution > VID_RES_COUNT - 1)
2519 video_resolution = gamemode == GAME_FNIGGIUM ? VID_640 : 0;
2521 video_resolution = new_resolution;
2523 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2524 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2530 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2533 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2537 Cvar_SetValueQuick (&vid_vsync, !vid_vsync.integer);
2543 void M_Video_Key (int key, char ascii)
2548 // vid_shared.c has a copy of the current video config. We restore it
2549 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2550 Cvar_SetValueQuick(&vid_width, current_vid_width);
2551 Cvar_SetValueQuick(&vid_height, current_vid_height);
2552 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2554 S_LocalSound ("misc/menu1.wav", true);
2555 M_Menu_Options_f ();
2559 m_entersound = true;
2560 switch (video_cursor)
2563 Cbuf_AddText ("vid_restart\n");
2564 M_Menu_Options_f ();
2567 M_Menu_Video_AdjustSliders (1);
2572 S_LocalSound ("misc/menu1.wav", true);
2574 if (video_cursor < 0)
2575 video_cursor = VIDEO_ITEMS-1;
2579 S_LocalSound ("misc/menu1.wav", true);
2581 if (video_cursor >= VIDEO_ITEMS)
2586 M_Menu_Video_AdjustSliders (-1);
2590 M_Menu_Video_AdjustSliders (1);
2595 //=============================================================================
2599 #define NUM_HELP_PAGES 6
2602 void M_Menu_Help_f (void)
2604 key_dest = key_menu;
2606 m_entersound = true;
2612 void M_Help_Draw (void)
2614 M_Background(320, 200);
2615 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2619 void M_Help_Key (int key, char ascii)
2629 m_entersound = true;
2630 if (++help_page >= NUM_HELP_PAGES)
2636 m_entersound = true;
2637 if (--help_page < 0)
2638 help_page = NUM_HELP_PAGES-1;
2644 //=============================================================================
2647 char *m_quit_message[9];
2648 int m_quit_prevstate;
2649 qboolean wasInMenus;
2652 int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
2654 m_quit_message[0] = line1;
2655 m_quit_message[1] = line2;
2656 m_quit_message[2] = line3;
2657 m_quit_message[3] = line4;
2658 m_quit_message[4] = line5;
2659 m_quit_message[5] = line6;
2660 m_quit_message[6] = line7;
2661 m_quit_message[7] = line8;
2662 m_quit_message[8] = NULL;
2666 int M_ChooseQuitMessage(int request)
2674 if (request-- == 0) return M_QuitMessage("Are you gonna quit","this game just like","everything else?",NULL,NULL,NULL,NULL,NULL);
2675 if (request-- == 0) return M_QuitMessage("Milord, methinks that","thou art a lowly","quitter. Is this true?",NULL,NULL,NULL,NULL,NULL);
2676 if (request-- == 0) return M_QuitMessage("Do I need to bust your","face open for trying","to quit?",NULL,NULL,NULL,NULL,NULL);
2677 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);
2678 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);
2679 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);
2680 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);
2681 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);
2683 case GAME_GOODVSBAD2:
2684 if (request-- == 0) return M_QuitMessage("Press Yes To Quit","...","Yes",NULL,NULL,NULL,NULL,NULL);
2685 if (request-- == 0) return M_QuitMessage("Do you really want to","Quit?","Play Good vs bad 3!",NULL,NULL,NULL,NULL,NULL);
2686 if (request-- == 0) return M_QuitMessage("All your quit are","belong to long duck","dong",NULL,NULL,NULL,NULL,NULL);
2687 if (request-- == 0) return M_QuitMessage("Press Y to quit","","But are you too legit?",NULL,NULL,NULL,NULL,NULL);
2688 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);
2689 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);
2690 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);
2691 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);
2692 if (request-- == 0) return M_QuitMessage("Press Y like you","were waanderers","from Ys'",NULL,NULL,NULL,NULL,NULL);
2693 if (request-- == 0) return M_QuitMessage("This game was made in","Nippon like the SS","announcer's saying ipon",NULL,NULL,NULL,NULL,NULL);
2694 if (request-- == 0) return M_QuitMessage("you","want to quit?",NULL,NULL,NULL,NULL,NULL,NULL);
2695 if (request-- == 0) return M_QuitMessage("Please stop playing","this stupid game",NULL,NULL,NULL,NULL,NULL,NULL);
2697 case GAME_BATTLEMECH:
2698 if (request-- == 0) return M_QuitMessage("? WHY ?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2699 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);
2700 if (request-- == 0) return M_QuitMessage("Accept Defeat?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2701 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);
2702 if (request-- == 0) return M_QuitMessage("Where's your bloodlust?","Press Y to quit, N to keep fraggin'",NULL,NULL,NULL,NULL,NULL,NULL);
2703 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);
2704 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);
2706 case GAME_OPENQUARTZ:
2707 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);
2708 if (request-- == 0) return M_QuitMessage("GNU is not Unix!","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2709 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);
2710 if (request-- == 0) return M_QuitMessage("Is OpenQuartz Propaganda?","Press Y to quit, N to stay",NULL,NULL,NULL,NULL,NULL,NULL);
2713 if (request-- == 0) return M_QuitMessage("Tired of fragging already?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2714 if (request-- == 0) return M_QuitMessage("Quit now and forfeit your bodycount?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2715 if (request-- == 0) return M_QuitMessage("Are you sure you want to quit?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2716 if (request-- == 0) return M_QuitMessage("Off to do something constructive?",NULL,NULL,NULL,NULL,NULL,NULL,NULL);
2722 void M_Menu_Quit_f (void)
2725 if (m_state == m_quit)
2727 wasInMenus = (key_dest == key_menu);
2728 key_dest = key_menu;
2729 m_quit_prevstate = m_state;
2731 m_entersound = true;
2732 // count how many there are
2733 for (n = 0;M_ChooseQuitMessage(n);n++);
2735 M_ChooseQuitMessage(rand() % n);
2739 void M_Quit_Key (int key, char ascii)
2748 m_state = m_quit_prevstate;
2749 m_entersound = true;
2753 key_dest = key_game;
2768 void M_Quit_Draw (void)
2770 int i, l, linelength, firstline, lastline, lines;
2771 for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
2773 if ((l = strlen(m_quit_message[i])))
2783 lines = (lastline - firstline) + 1;
2784 M_Background(linelength * 8 + 16, lines * 8 + 16);
2785 M_DrawTextBox(0, 0, linelength, lines);
2786 for (i = 0, l = firstline;i < lines;i++, l++)
2787 M_Print(8 + 4 * (linelength - strlen(m_quit_message[l])), 8 + 8 * i, m_quit_message[l]);
2790 //=============================================================================
2791 /* LAN CONFIG MENU */
2793 int lanConfig_cursor = -1;
2794 int lanConfig_cursor_table [] = {56, 76, 112};
2795 #define NUM_LANCONFIG_CMDS 3
2798 char lanConfig_portname[6];
2799 char lanConfig_joinname[22];
2801 void M_Menu_LanConfig_f (void)
2803 key_dest = key_menu;
2804 m_state = m_lanconfig;
2805 m_entersound = true;
2806 if (lanConfig_cursor == -1)
2809 lanConfig_cursor = 1;
2812 lanConfig_cursor = 1;
2813 lanConfig_port = 26000;
2814 sprintf(lanConfig_portname, "%u", lanConfig_port);
2816 M_Update_Return_Reason("");
2820 void M_LanConfig_Draw (void)
2827 M_Background(320, 200);
2829 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2830 p = Draw_CachePic ("gfx/p_multi.lmp");
2831 basex = (320-p->width)/2;
2832 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2835 startJoin = "New Game";
2837 startJoin = "Join Game";
2838 protocol = "TCP/IP";
2839 M_Print(basex, 32, va ("%s - %s", startJoin, protocol));
2842 M_Print(basex, lanConfig_cursor_table[0], "Port");
2843 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2844 M_Print(basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2848 M_Print(basex, lanConfig_cursor_table[1], "Search for games...");
2849 M_Print(basex, lanConfig_cursor_table[2]-16, "Join game at:");
2850 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2851 M_Print(basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2855 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2856 M_Print(basex+8, lanConfig_cursor_table[1], "OK");
2859 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2861 if (lanConfig_cursor == 0)
2862 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2864 if (lanConfig_cursor == 2)
2865 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2867 if (*m_return_reason)
2868 M_Print(basex, 168, m_return_reason);
2872 void M_LanConfig_Key (int key, char ascii)
2879 M_Menu_MultiPlayer_f ();
2883 S_LocalSound ("misc/menu1.wav", true);
2885 if (lanConfig_cursor < 0)
2886 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2890 S_LocalSound ("misc/menu1.wav", true);
2892 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2893 lanConfig_cursor = 0;
2897 if (lanConfig_cursor == 0)
2900 m_entersound = true;
2902 Cbuf_AddText ("stopdemo\n");
2904 Cvar_SetValue("port", lanConfig_port);
2906 if (lanConfig_cursor == 1)
2910 M_Menu_GameOptions_f ();
2913 M_Menu_ServerList_f();
2917 if (lanConfig_cursor == 2)
2918 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2922 if (lanConfig_cursor == 0)
2924 if (strlen(lanConfig_portname))
2925 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2928 if (lanConfig_cursor == 2)
2930 if (strlen(lanConfig_joinname))
2931 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2936 if (ascii < 32 || ascii > 126)
2939 if (lanConfig_cursor == 2)
2941 l = strlen(lanConfig_joinname);
2944 lanConfig_joinname[l+1] = 0;
2945 lanConfig_joinname[l] = ascii;
2949 if (ascii < '0' || ascii > '9')
2951 if (lanConfig_cursor == 0)
2953 l = strlen(lanConfig_portname);
2956 lanConfig_portname[l+1] = 0;
2957 lanConfig_portname[l] = ascii;
2962 if (StartingGame && lanConfig_cursor == 2)
2964 if (key == K_UPARROW)
2965 lanConfig_cursor = 1;
2967 lanConfig_cursor = 0;
2970 l = atoi(lanConfig_portname);
2973 sprintf(lanConfig_portname, "%u", lanConfig_port);
2976 //=============================================================================
2977 /* GAME OPTIONS MENU */
2996 episode_t *episodes;
3001 level_t quakelevels[] =
3003 {"start", "Entrance"}, // 0
3005 {"e1m1", "Slipgate Complex"}, // 1
3006 {"e1m2", "Castle of the Damned"},
3007 {"e1m3", "The Necropolis"},
3008 {"e1m4", "The Grisly Grotto"},
3009 {"e1m5", "Gloom Keep"},
3010 {"e1m6", "The Door To Chthon"},
3011 {"e1m7", "The House of Chthon"},
3012 {"e1m8", "Ziggurat Vertigo"},
3014 {"e2m1", "The Installation"}, // 9
3015 {"e2m2", "Ogre Citadel"},
3016 {"e2m3", "Crypt of Decay"},
3017 {"e2m4", "The Ebon Fortress"},
3018 {"e2m5", "The Wizard's Manse"},
3019 {"e2m6", "The Dismal Oubliette"},
3020 {"e2m7", "Underearth"},
3022 {"e3m1", "Termination Central"}, // 16
3023 {"e3m2", "The Vaults of Zin"},
3024 {"e3m3", "The Tomb of Terror"},
3025 {"e3m4", "Satan's Dark Delight"},
3026 {"e3m5", "Wind Tunnels"},
3027 {"e3m6", "Chambers of Torment"},
3028 {"e3m7", "The Haunted Halls"},
3030 {"e4m1", "The Sewage System"}, // 23
3031 {"e4m2", "The Tower of Despair"},
3032 {"e4m3", "The Elder God Shrine"},
3033 {"e4m4", "The Palace of Hate"},
3034 {"e4m5", "Hell's Atrium"},
3035 {"e4m6", "The Pain Maze"},
3036 {"e4m7", "Azure Agony"},
3037 {"e4m8", "The Nameless City"},
3039 {"end", "Shub-Niggurath's Pit"}, // 31
3041 {"dm1", "Place of Two Deaths"}, // 32
3042 {"dm2", "Claustrophobopolis"},
3043 {"dm3", "The Abandoned Base"},
3044 {"dm4", "The Bad Place"},
3045 {"dm5", "The Cistern"},
3046 {"dm6", "The Dark Zone"}
3049 episode_t quakeepisodes[] =
3051 {"Welcome to Quake", 0, 1},
3052 {"Doomed Dimension", 1, 8},
3053 {"Realm of Black Magic", 9, 7},
3054 {"Netherworld", 16, 7},
3055 {"The Elder World", 23, 8},
3056 {"Final Level", 31, 1},
3057 {"Deathmatch Arena", 32, 6}
3060 //MED 01/06/97 added hipnotic levels
3061 level_t hipnoticlevels[] =
3063 {"start", "Command HQ"}, // 0
3065 {"hip1m1", "The Pumping Station"}, // 1
3066 {"hip1m2", "Storage Facility"},
3067 {"hip1m3", "The Lost Mine"},
3068 {"hip1m4", "Research Facility"},
3069 {"hip1m5", "Military Complex"},
3071 {"hip2m1", "Ancient Realms"}, // 6
3072 {"hip2m2", "The Black Cathedral"},
3073 {"hip2m3", "The Catacombs"},
3074 {"hip2m4", "The Crypt"},
3075 {"hip2m5", "Mortum's Keep"},
3076 {"hip2m6", "The Gremlin's Domain"},
3078 {"hip3m1", "Tur Torment"}, // 12
3079 {"hip3m2", "Pandemonium"},
3080 {"hip3m3", "Limbo"},
3081 {"hip3m4", "The Gauntlet"},
3083 {"hipend", "Armagon's Lair"}, // 16
3085 {"hipdm1", "The Edge of Oblivion"} // 17
3088 //MED 01/06/97 added hipnotic episodes
3089 episode_t hipnoticepisodes[] =
3091 {"Scourge of Armagon", 0, 1},
3092 {"Fortress of the Dead", 1, 5},
3093 {"Dominion of Darkness", 6, 6},
3094 {"The Rift", 12, 4},
3095 {"Final Level", 16, 1},
3096 {"Deathmatch Arena", 17, 1}
3099 //PGM 01/07/97 added rogue levels
3100 //PGM 03/02/97 added dmatch level
3101 level_t roguelevels[] =
3103 {"start", "Split Decision"},
3104 {"r1m1", "Deviant's Domain"},
3105 {"r1m2", "Dread Portal"},
3106 {"r1m3", "Judgement Call"},
3107 {"r1m4", "Cave of Death"},
3108 {"r1m5", "Towers of Wrath"},
3109 {"r1m6", "Temple of Pain"},
3110 {"r1m7", "Tomb of the Overlord"},
3111 {"r2m1", "Tempus Fugit"},
3112 {"r2m2", "Elemental Fury I"},
3113 {"r2m3", "Elemental Fury II"},
3114 {"r2m4", "Curse of Osiris"},
3115 {"r2m5", "Wizard's Keep"},
3116 {"r2m6", "Blood Sacrifice"},
3117 {"r2m7", "Last Bastion"},
3118 {"r2m8", "Source of Evil"},
3119 {"ctf1", "Division of Change"}
3122 //PGM 01/07/97 added rogue episodes
3123 //PGM 03/02/97 added dmatch episode
3124 episode_t rogueepisodes[] =
3126 {"Introduction", 0, 1},
3127 {"Hell's Fortress", 1, 7},
3128 {"Corridors of Time", 8, 8},
3129 {"Deathmatch Arena", 16, 1}
3132 level_t nehahralevels[] =
3134 {"nehstart", "Welcome to Nehahra"},
3135 {"neh1m1", "Forge City1: Slipgates"},
3136 {"neh1m2", "Forge City2: Boiler"},
3137 {"neh1m3", "Forge City3: Escape"},
3138 {"neh1m4", "Grind Core"},
3139 {"neh1m5", "Industrial Silence"},
3140 {"neh1m6", "Locked-Up Anger"},
3141 {"neh1m7", "Wanderer of the Wastes"},
3142 {"neh1m8", "Artemis System Net"},
3143 {"neh1m9", "To the Death"},
3144 {"neh2m1", "The Gates of Ghoro"},
3145 {"neh2m2", "Sacred Trinity"},
3146 {"neh2m3", "Realm of the Ancients"},
3147 {"neh2m4", "Temple of the Ancients"},
3148 {"neh2m5", "Dreams Made Flesh"},
3149 {"neh2m6", "Your Last Cup of Sorrow"},
3150 {"nehsec", "Ogre's Bane"},
3151 {"nehahra", "Nehahra's Den"},
3152 {"nehend", "Quintessence"}
3155 episode_t nehahraepisodes[] =
3157 {"Welcome to Nehahra", 0, 1},
3158 {"The Fall of Forge", 1, 9},
3159 {"The Outlands", 10, 7},
3160 {"Dimension of the Lost", 17, 2}
3163 // Map list for Transfusion
3164 level_t transfusionlevels[] =
3166 {"bb1", "The Stronghold"},
3167 {"bb2", "Winter Wonderland"},
3169 {"bb4", "The Tower"},
3171 {"bb6", "Twin Fortress"},
3173 {"bb8", "Fun With Heads"},
3175 {"e1m1", "Cradle to Grave"},
3176 {"e1m2", "Wrong Side of the Tracks"},
3177 {"e1m7", "Altar of Stone"},
3178 {"e2m8", "The Lair of Shial"},
3179 {"e3m1", "Ghost Town"},
3180 {"e3m7", "The Pit of Cerberus"},
3181 {"e4m1", "Butchery Loves Company"},
3182 {"e4m7", "In the Flesh"},
3183 {"e4m8", "The Hall of the Epiphany"},
3184 {"e4m9", "Mall of the Dead"},
3186 {"dm1", "Monolith Building 11"},
3189 {"e6m1", "Welcome to Your Life"},
3190 {"e6m8", "Beauty and the Beast"},
3191 {"e6m9", "Forgotten Catacombs"},
3193 {"cpbb01", "Crypt of Despair"},
3194 {"cpbb03", "Unholy Cathedral"},
3196 {"b2a15", "Area 15 (B2)"},
3197 {"barena", "Blood Arena"},
3198 {"bkeep", "Blood Keep"},
3199 {"bstar", "Brown Star"},
3200 {"crypt", "The Crypt"},
3202 {"bb3_2k1", "Bodies Infusion"},
3203 {"captasao", "Captasao"},
3204 {"curandero", "Curandero"},
3205 {"dcamp", "DeathCamp"},
3206 {"highnoon", "HighNoon"},
3207 {"qbb1", "The Confluence"},
3208 {"qbb2", "KathartiK"},
3209 {"qbb3", "Caleb's Woodland Retreat"},
3212 {"dranzbb6", "Black Coffee"},
3213 {"fragm", "Frag'M"},
3215 {"qe1m7", "The House of Chthon"},
3216 {"qmorbias", "Dm-Morbias"},
3217 {"simple", "Dead Simple"}
3220 episode_t transfusionepisodes[] =
3223 {"Blood Single Player", 8, 10},
3224 {"Plasma Pack", 18, 6},
3225 {"Cryptic Passage", 24, 2},
3227 {"Transfusion", 31, 9},
3228 {"Conversions", 40, 6}
3231 level_t goodvsbad2levels[] =
3233 {"rts", "Many Paths"}, // 0
3234 {"chess", "Chess, Scott Hess"}, // 1
3235 {"dot", "Big Wall"},
3236 {"city2", "The Big City"},
3237 {"bwall", "0 G like Psychic TV"},
3238 {"snow", "Wireframed"},
3239 {"telep", "Infinite Falling"},
3240 {"faces", "Facing Bases"},
3241 {"island", "Adventure Islands"},
3244 episode_t goodvsbad2episodes[] =
3246 {"Levels? Bevels!", 0, 8},
3249 level_t battlemechlevels[] =
3251 {"start", "Parking Level"},
3252 {"dm1", "Hot Dump"}, // 1
3253 {"dm2", "The Pits"},
3254 {"dm3", "Dimber Died"},
3255 {"dm4", "Fire in the Hole"},
3256 {"dm5", "Clubhouses"},
3257 {"dm6", "Army go Underground"},
3260 episode_t battlemechepisodes[] =
3262 {"Time for Battle", 0, 7},
3265 level_t openquartzlevels[] =
3267 {"start", "Welcome to Openquartz"},
3269 {"void1", "The center of nowhere"}, // 1
3270 {"void2", "The place with no name"},
3271 {"void3", "The lost supply base"},
3272 {"void4", "Past the outer limits"},
3273 {"void5", "Into the nonexistance"},
3274 {"void6", "Void walk"},
3276 {"vtest", "Warp Central"},
3277 {"box", "The deathmatch box"},
3278 {"bunkers", "Void command"},
3279 {"house", "House of chaos"},
3280 {"office", "Overnight office kill"},
3281 {"am1", "The nameless chambers"},
3284 episode_t openquartzepisodes[] =
3286 {"Single Player", 0, 1},
3287 {"Void Deathmatch", 1, 6},
3291 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
3292 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
3293 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
3294 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
3295 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
3296 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
3297 gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
3298 gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
3299 gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
3304 gamelevels_t *notregistered;
3305 gamelevels_t *registered;
3309 gameinfo_t gamelist[] =
3311 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
3312 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
3313 {GAME_ROGUE, &roguegame, &roguegame},
3314 {GAME_NEHAHRA, &nehahragame, &nehahragame},
3315 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
3316 {GAME_GOODVSBAD2, &goodvsbad2game, &goodvsbad2game},
3317 {GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
3318 {GAME_OPENQUARTZ, &openquartzgame, &openquartzgame},
3319 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
3322 gamelevels_t *lookupgameinfo(void)
3325 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
3326 if (registered.integer)
3327 return gamelist[i].registered;
3329 return gamelist[i].notregistered;
3335 qboolean m_serverInfoMessage = false;
3336 double m_serverInfoMessageTime;
3338 void M_Menu_GameOptions_f (void)
3340 key_dest = key_menu;
3341 m_state = m_gameoptions;
3342 m_entersound = true;
3343 if (maxplayers == 0)
3344 maxplayers = svs.maxclients;
3346 maxplayers = min(8, MAX_SCOREBOARD);
3350 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168};
3351 #define NUM_GAMEOPTIONS 12
3352 int gameoptions_cursor;
3354 void M_GameOptions_Draw (void)
3360 M_Background(320, 200);
3362 M_DrawPic (16, 4, "gfx/qplaque.lmp");
3363 p = Draw_CachePic ("gfx/p_multi.lmp");
3364 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3366 M_DrawTextBox (152, 32, 10, 1);
3367 M_Print(160, 40, "begin game");
3369 M_Print(0, 56, " Max players");
3370 M_Print(160, 56, va("%i", maxplayers) );
3372 if (gamemode != GAME_GOODVSBAD2)
3374 M_Print(0, 64, " Game Type");
3375 if (gamemode == GAME_TRANSFUSION)
3377 if (!deathmatch.integer)
3378 Cvar_SetValue("deathmatch", 1);
3379 if (deathmatch.integer == 2)
3380 M_Print(160, 64, "Capture the Flag");
3382 M_Print(160, 64, "Blood Bath");
3384 else if (gamemode == GAME_BATTLEMECH)
3386 if (!deathmatch.integer)
3387 Cvar_SetValue("deathmatch", 1);
3388 if (deathmatch.integer == 2)
3389 M_Print(160, 64, "Rambo Match");
3391 M_Print(160, 64, "Deathmatch");
3395 if (!coop.integer && !deathmatch.integer)
3396 Cvar_SetValue("deathmatch", 1);
3398 M_Print(160, 64, "Cooperative");
3400 M_Print(160, 64, "Deathmatch");
3403 M_Print(0, 72, " Teamplay");
3404 if (gamemode == GAME_ROGUE)
3408 switch((int)teamplay.integer)
3410 case 1: msg = "No Friendly Fire"; break;
3411 case 2: msg = "Friendly Fire"; break;
3412 case 3: msg = "Tag"; break;
3413 case 4: msg = "Capture the Flag"; break;
3414 case 5: msg = "One Flag CTF"; break;
3415 case 6: msg = "Three Team CTF"; break;
3416 default: msg = "Off"; break;
3418 M_Print(160, 72, msg);
3424 switch (teamplay.integer)
3426 case 0: msg = "Off"; break;
3427 case 2: msg = "Friendly Fire"; break;
3428 default: msg = "No Friendly Fire"; break;
3430 M_Print(160, 72, msg);
3433 M_Print(0, 80, " Skill");
3434 if (skill.integer == 0)
3435 M_Print(160, 80, "Easy difficulty");
3436 else if (skill.integer == 1)
3437 M_Print(160, 80, "Normal difficulty");
3438 else if (skill.integer == 2)
3439 M_Print(160, 80, "Hard difficulty");
3441 M_Print(160, 80, "Nightmare difficulty");
3443 M_Print(0, 88, " Frag Limit");
3444 if (fraglimit.integer == 0)
3445 M_Print(160, 88, "none");
3447 M_Print(160, 88, va("%i frags", fraglimit.integer));
3449 M_Print(0, 96, " Time Limit");
3450 if (timelimit.integer == 0)
3451 M_Print(160, 96, "none");
3453 M_Print(160, 96, va("%i minutes", timelimit.integer));
3456 M_Print(0, 104, " Public server");
3457 M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes");
3459 M_Print(0, 112, " Server maxrate");
3460 M_Print(160, 112, va("%i", sv_maxrate.integer));
3462 M_Print(0, 128, " Server name");
3463 M_DrawTextBox (0, 132, 38, 1);
3464 M_Print(8, 140, hostname.string);
3466 g = lookupgameinfo();
3468 if (gamemode != GAME_GOODVSBAD2)
3470 M_Print(0, 160, " Episode");
3471 M_Print(160, 160, g->episodes[startepisode].description);
3474 M_Print(0, 168, " Level");
3475 M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
3476 M_Print(160, 176, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
3479 if (gameoptions_cursor == 9)
3480 M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
3482 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
3484 if (m_serverInfoMessage)
3486 if ((realtime - m_serverInfoMessageTime) < 5.0)
3489 M_DrawTextBox (x, 138, 24, 4);
3491 M_Print(x, 146, " More than 64 players?? ");
3492 M_Print(x, 154, " First, question your ");
3493 M_Print(x, 162, " sanity, then email ");
3494 M_Print(x, 170, " havoc@telefragged.com ");
3497 m_serverInfoMessage = false;
3502 void M_NetStart_Change (int dir)
3507 switch (gameoptions_cursor)
3511 if (maxplayers > MAX_SCOREBOARD)
3513 maxplayers = MAX_SCOREBOARD;
3514 m_serverInfoMessage = true;
3515 m_serverInfoMessageTime = realtime;
3522 if (gamemode == GAME_GOODVSBAD2)
3524 if (gamemode == GAME_TRANSFUSION)
3526 if (deathmatch.integer == 2) // changing from CTF to BloodBath
3527 Cvar_SetValueQuick (&deathmatch, 0);
3528 else // changing from BloodBath to CTF
3529 Cvar_SetValueQuick (&deathmatch, 2);
3531 else if (gamemode == GAME_BATTLEMECH)
3533 if (deathmatch.integer == 2) // changing from Rambo to Deathmatch
3534 Cvar_SetValueQuick (&deathmatch, 0);
3535 else // changing from Deathmatch to Rambo
3536 Cvar_SetValueQuick (&deathmatch, 2);
3540 if (deathmatch.integer) // changing from deathmatch to coop
3542 Cvar_SetValueQuick (&coop, 1);
3543 Cvar_SetValueQuick (&deathmatch, 0);
3545 else // changing from coop to deathmatch
3547 Cvar_SetValueQuick (&coop, 0);
3548 Cvar_SetValueQuick (&deathmatch, 1);
3554 if (gamemode == GAME_GOODVSBAD2)
3556 if (gamemode == GAME_ROGUE)
3561 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
3562 if (teamplay.integer > count)
3563 Cvar_SetValueQuick (&teamplay, 0);
3564 else if (teamplay.integer < 0)
3565 Cvar_SetValueQuick (&teamplay, count);
3569 if (gamemode == GAME_GOODVSBAD2)
3571 Cvar_SetValueQuick (&skill, skill.integer + dir);
3572 if (skill.integer > 3)
3573 Cvar_SetValueQuick (&skill, 0);
3574 if (skill.integer < 0)
3575 Cvar_SetValueQuick (&skill, 3);
3579 if (gamemode == GAME_GOODVSBAD2)
3581 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3582 if (fraglimit.integer > 100)
3583 Cvar_SetValueQuick (&fraglimit, 0);
3584 if (fraglimit.integer < 0)
3585 Cvar_SetValueQuick (&fraglimit, 100);
3589 if (gamemode == GAME_GOODVSBAD2)
3591 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3592 if (timelimit.value > 60)
3593 Cvar_SetValueQuick (&timelimit, 0);
3594 if (timelimit.value < 0)
3595 Cvar_SetValueQuick (&timelimit, 60);
3599 Cvar_SetValueQuick (&sv_public, !sv_public.integer);
3603 Cvar_SetValueQuick (&sv_maxrate, sv_maxrate.integer + dir*500);
3604 if (sv_maxrate.integer > NET_MAXRATE)
3605 Cvar_SetValueQuick (&sv_maxrate, NET_MAXRATE);
3606 if (sv_maxrate.integer < NET_MINRATE)
3607 Cvar_SetValueQuick (&sv_maxrate, NET_MINRATE);
3614 if (gamemode == GAME_GOODVSBAD2)
3616 startepisode += dir;
3617 g = lookupgameinfo();
3619 if (startepisode < 0)
3620 startepisode = g->numepisodes - 1;
3622 if (startepisode >= g->numepisodes)
3630 g = lookupgameinfo();
3633 startlevel = g->episodes[startepisode].levels - 1;
3635 if (startlevel >= g->episodes[startepisode].levels)
3641 void M_GameOptions_Key (int key, char ascii)
3645 char hostnamebuf[128];
3650 M_Menu_MultiPlayer_f ();
3654 S_LocalSound ("misc/menu1.wav", true);
3655 gameoptions_cursor--;
3656 if (gameoptions_cursor < 0)
3657 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3661 S_LocalSound ("misc/menu1.wav", true);
3662 gameoptions_cursor++;
3663 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3664 gameoptions_cursor = 0;
3668 if (gameoptions_cursor == 0)
3670 S_LocalSound ("misc/menu3.wav", true);
3671 M_NetStart_Change (-1);
3675 if (gameoptions_cursor == 0)
3677 S_LocalSound ("misc/menu3.wav", true);
3678 M_NetStart_Change (1);
3682 S_LocalSound ("misc/menu2.wav", true);
3683 if (gameoptions_cursor == 0)
3686 Cbuf_AddText ("disconnect\n");
3687 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3689 g = lookupgameinfo();
3690 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3694 M_NetStart_Change (1);
3698 if (gameoptions_cursor == 9)
3700 l = strlen(hostname.string);
3704 memcpy(hostnamebuf, hostname.string, l);
3706 Cvar_Set("hostname", hostnamebuf);
3712 if (ascii < 32 || ascii > 126)
3714 if (gameoptions_cursor == 9)
3716 l = strlen(hostname.string);
3719 memcpy(hostnamebuf, hostname.string, l);
3720 hostnamebuf[l] = ascii;
3721 hostnamebuf[l+1] = 0;
3722 Cvar_Set("hostname", hostnamebuf);
3728 //=============================================================================
3733 void M_Menu_ServerList_f (void)
3735 key_dest = key_menu;
3737 m_entersound = true;
3739 M_Update_Return_Reason("");
3744 void M_ServerList_Draw (void)
3746 int n, y, visible, start, end;
3750 // use as much vertical space as available
3751 M_Background(640, vid.conheight);
3752 // scroll the list as the cursor moves
3753 s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount);
3754 M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
3755 if (*m_return_reason)
3756 M_Print(16, vid.conheight - 8, m_return_reason);
3758 visible = (vid.conheight - 16 - y) / 8;
3759 start = bound(0, slist_cursor - (visible >> 1), hostCacheCount - visible);
3760 end = min(start + visible, hostCacheCount);
3762 p = Draw_CachePic("gfx/p_multi.lmp");
3763 M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
3766 for (n = start;n < end;n++)
3768 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);
3769 M_Print(0, y, hostcache[n].line1);y += 8;
3770 M_Print(0, y, hostcache[n].line2);y += 8;
3773 else if (realtime - masterquerytime < 3)
3775 if (masterquerycount)
3776 M_Print(0, y, "No servers found");
3778 M_Print(0, y, "No master servers found (network problem?)");
3783 void M_ServerList_Key(int k, char ascii)
3788 M_Menu_LanConfig_f();
3797 S_LocalSound("misc/menu1.wav", true);
3799 if (slist_cursor < 0)
3800 slist_cursor = hostCacheCount - 1;
3805 S_LocalSound("misc/menu1.wav", true);
3807 if (slist_cursor >= hostCacheCount)
3812 S_LocalSound("misc/menu2.wav", true);
3813 Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
3822 //=============================================================================
3823 /* Menu Subsystem */
3825 void M_Keydown(int key, char ascii);
3827 void M_ToggleMenu_f(void);
3828 void M_Shutdown(void);
3832 menu_mempool = Mem_AllocPool("Menu", 0, NULL);
3833 menuplyr_load = true;
3834 menuplyr_pixels = NULL;
3836 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3837 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3838 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3839 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3840 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3841 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3842 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3843 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3844 Cmd_AddCommand ("menu_options_graphics", M_Menu_Options_Graphics_f);
3845 Cmd_AddCommand ("menu_options_colorcontrol", M_Menu_Options_ColorControl_f);
3846 Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
3847 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3848 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3849 Cmd_AddCommand ("menu_reset", M_Menu_Reset_f);
3850 Cmd_AddCommand ("help", M_Menu_Help_f);
3851 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3853 if (gamemode == GAME_TRANSFUSION)
3855 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3856 bindnames = transfusionbindnames;
3858 else if (gamemode == GAME_GOODVSBAD2)
3860 numcommands = sizeof(goodvsbad2bindnames) / sizeof(goodvsbad2bindnames[0]);
3861 bindnames = goodvsbad2bindnames;
3865 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3866 bindnames = quakebindnames;
3869 // Make sure "keys_cursor" doesn't start on a section in the binding list
3871 while (bindnames[keys_cursor][0][0] == '\0')
3875 // Only sections? There may be a problem somewhere...
3876 if (keys_cursor >= numcommands)
3877 Sys_Error ("M_Init: The key binding list only contains sections");
3881 if (gamemode == GAME_NEHAHRA)
3883 if (FS_FileExists("maps/neh1m4.bsp"))
3885 if (FS_FileExists("hearing.dem"))
3887 Con_Print("Nehahra movie and game detected.\n");
3888 NehGameType = TYPE_BOTH;
3892 Con_Print("Nehahra game detected.\n");
3893 NehGameType = TYPE_GAME;
3898 if (FS_FileExists("hearing.dem"))
3900 Con_Print("Nehahra movie detected.\n");
3901 NehGameType = TYPE_DEMO;
3905 Con_Print("Nehahra not found.\n");
3906 NehGameType = TYPE_GAME; // could just complain, but...
3914 if (key_dest != key_menu)
3917 if (m_state == m_none)
3933 case m_singleplayer:
3934 M_SinglePlayer_Draw ();
3946 M_MultiPlayer_Draw ();
3957 case m_options_effects:
3958 M_Options_Effects_Draw ();
3961 case m_options_graphics:
3962 M_Options_Graphics_Draw ();
3965 case m_options_colorcontrol:
3966 M_Options_ColorControl_Draw ();
3990 M_LanConfig_Draw ();
3994 M_GameOptions_Draw ();
3998 M_ServerList_Draw ();
4004 S_LocalSound ("misc/menu2.wav", true);
4005 m_entersound = false;
4012 void M_Keydown (int key, char ascii)
4020 M_Main_Key (key, ascii);
4024 M_Demo_Key (key, ascii);
4027 case m_singleplayer:
4028 M_SinglePlayer_Key (key, ascii);
4032 M_Load_Key (key, ascii);
4036 M_Save_Key (key, ascii);
4040 M_MultiPlayer_Key (key, ascii);
4044 M_Setup_Key (key, ascii);
4048 M_Options_Key (key, ascii);
4051 case m_options_effects:
4052 M_Options_Effects_Key (key, ascii);
4055 case m_options_graphics:
4056 M_Options_Graphics_Key (key, ascii);
4059 case m_options_colorcontrol:
4060 M_Options_ColorControl_Key (key, ascii);
4064 M_Keys_Key (key, ascii);
4068 M_Reset_Key (key, ascii);
4073 M_Video_Key (key, ascii);
4077 M_Help_Key (key, ascii);
4081 M_Quit_Key (key, ascii);
4085 M_LanConfig_Key (key, ascii);
4089 M_GameOptions_Key (key, ascii);
4093 M_ServerList_Key (key, ascii);
4098 void M_Shutdown(void)
4101 key_dest = key_game;
4104 void M_Restart(void)
4108 //============================================================================
4109 // Menu prog handling
4110 mfunction_t *PRVM_ED_FindFunction(const char *);
4112 #define M_F_INIT "m_init"
4113 #define M_F_KEYDOWN "m_keydown"
4114 #define M_F_DRAW "m_draw"
4115 // ng_menu function names
4116 #define M_F_DISPLAY "m_display"
4117 #define M_F_HIDE "m_hide"
4118 // normal menu names (rest)
4119 #define M_F_TOGGLE "m_toggle"
4120 #define M_F_SHUTDOWN "m_shutdown"
4122 static char *m_required_func[] = {
4136 qboolean m_displayed;
4139 static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
4141 static func_t m_draw, m_keydown;
4143 void MR_SetRouting (qboolean forceold);
4147 // fall back to the normal menu
4150 Con_Print("Falling back to normal menu\n");
4152 key_dest = key_game;
4156 // init the normal menu now -> this will also correct the menu router pointers
4157 MR_SetRouting (TRUE);
4160 void MP_Keydown (int key, char ascii)
4163 PRVM_SetProg(PRVM_MENUPROG);
4166 *prog->time = realtime;
4169 prog->globals[OFS_PARM0] = (float) key;
4170 prog->globals[OFS_PARM1] = (float) ascii;
4171 PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
4179 PRVM_SetProg(PRVM_MENUPROG);
4182 *prog->time = realtime;
4184 PRVM_ExecuteProgram(m_draw,"");
4189 void MP_ToggleMenu_f (void)
4192 PRVM_SetProg(PRVM_MENUPROG);
4195 *prog->time = realtime;
4198 m_displayed = !m_displayed;
4200 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_DISPLAY) - prog->functions),"");
4202 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_HIDE) - prog->functions),"");
4204 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_TOGGLE) - prog->functions),"");
4210 void MP_Shutdown (void)
4213 PRVM_SetProg(PRVM_MENUPROG);
4216 *prog->time = realtime;
4218 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_SHUTDOWN) - prog->functions),"");
4221 key_dest = key_game;
4223 // AK not using this cause Im not sure whether this is useful at all instead :
4232 PRVM_InitProg(PRVM_MENUPROG);
4234 prog->crc = M_PROGHEADER_CRC;
4235 prog->edictprivate_size = 0; // no private struct used
4236 prog->name = M_NAME;
4237 prog->limit_edicts = M_MAX_EDICTS;
4238 prog->extensionstring = vm_m_extensions;
4239 prog->builtins = vm_m_builtins;
4240 prog->numbuiltins = vm_m_numbuiltins;
4241 prog->init_cmd = VM_M_Cmd_Init;
4242 prog->reset_cmd = VM_M_Cmd_Reset;
4243 prog->error_cmd = MP_Error;
4245 // allocate the mempools
4246 prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool", 0, NULL);
4247 prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool", 0, NULL);
4248 prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL);
4250 PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func);
4252 // set m_draw and m_keydown
4253 m_draw = (func_t) (PRVM_ED_FindFunction(M_F_DRAW) - prog->functions);
4254 m_keydown = (func_t) (PRVM_ED_FindFunction(M_F_KEYDOWN) - prog->functions);
4257 m_displayed = false;
4261 *prog->time = realtime;
4263 // call the prog init
4264 PRVM_ExecuteProgram((func_t) (PRVM_ED_FindFunction(M_F_INIT) - prog->functions),"");
4269 void MP_Restart(void)
4275 //============================================================================
4278 static cvar_t forceqmenu = { 0, "forceqmenu", "0" };
4280 void MR_SetRouting(qboolean forceold)
4282 static qboolean m_init = FALSE, mp_init = FALSE;
4284 // if the menu prog isnt available or forceqmenu ist set, use the old menu
4285 if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold)
4287 // set menu router function pointers
4288 MR_Keydown = M_Keydown;
4290 MR_ToggleMenu_f = M_ToggleMenu_f;
4291 MR_Shutdown = M_Shutdown;
4304 // set menu router function pointers
4305 MR_Keydown = MP_Keydown;
4307 MR_ToggleMenu_f = MP_ToggleMenu_f;
4308 MR_Shutdown = MP_Shutdown;
4320 void MR_Restart(void)
4323 MR_SetRouting (FALSE);
4326 void Call_MR_ToggleMenu_f(void)
4332 void MR_Init_Commands(void)
4334 // set router console commands
4335 Cvar_RegisterVariable (&forceqmenu);
4336 if (gamemode == GAME_NETHERWORLD)
4337 Cmd_AddCommand ("menu_fallback", MP_Error); //Force to old-style menu
4338 Cmd_AddCommand ("menu_restart",MR_Restart);
4339 Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f);
4344 // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
4345 // COMMANDLINEOPTION: Client: -forceqmenu disables menu.dat (same as +forceqmenu 1)
4346 if(COM_CheckParm("-forceqmenu"))
4347 Cvar_SetValueQuick(&forceqmenu,1);
4348 // use -useqmenu for debugging proposes, cause it starts
4349 // the normal quake menu only the first time
4350 // 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)
4351 if(COM_CheckParm("-useqmenu"))
4352 MR_SetRouting (TRUE);
4354 MR_SetRouting (FALSE);