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.
30 enum m_state_e m_state;
32 void M_Menu_Main_f (void);
33 void M_Menu_SinglePlayer_f (void);
34 void M_Menu_Load_f (void);
35 void M_Menu_Save_f (void);
36 void M_Menu_MultiPlayer_f (void);
37 void M_Menu_Setup_f (void);
38 void M_Menu_Net_f (void);
39 void M_Menu_Options_f (void);
40 void M_Menu_Options_Effects_f (void);
41 void M_Menu_Keys_f (void);
42 void M_Menu_Video_f (void);
43 void M_Menu_Help_f (void);
44 void M_Menu_Quit_f (void);
45 void M_Menu_LanConfig_f (void);
46 void M_Menu_GameOptions_f (void);
47 void M_Menu_Search_f (void);
48 void M_Menu_InetSearch_f (void);
49 void M_Menu_ServerList_f (void);
51 void M_Main_Draw (void);
52 void M_SinglePlayer_Draw (void);
53 void M_Load_Draw (void);
54 void M_Save_Draw (void);
55 void M_MultiPlayer_Draw (void);
56 void M_Setup_Draw (void);
57 void M_Net_Draw (void);
58 void M_Options_Draw (void);
59 void M_Options_Effects_Draw (void);
60 void M_Keys_Draw (void);
61 void M_Video_Draw (void);
62 void M_Help_Draw (void);
63 void M_Quit_Draw (void);
64 void M_LanConfig_Draw (void);
65 void M_GameOptions_Draw (void);
66 void M_Search_Draw (void);
67 void M_InetSearch_Draw (void);
68 void M_ServerList_Draw (void);
70 void M_Main_Key (int key);
71 void M_SinglePlayer_Key (int key);
72 void M_Load_Key (int key);
73 void M_Save_Key (int key);
74 void M_MultiPlayer_Key (int key);
75 void M_Setup_Key (int key);
76 void M_Net_Key (int key);
77 void M_Options_Key (int key);
78 void M_Options_Effects_Key (int key);
79 void M_Keys_Key (int key);
80 void M_Video_Key (int key);
81 void M_Help_Key (int key);
82 void M_Quit_Key (int key);
83 void M_LanConfig_Key (int key);
84 void M_GameOptions_Key (int key);
85 void M_Search_Key (int key);
86 void M_InetSearch_Key (int key);
87 void M_ServerList_Key (int key);
89 qboolean m_entersound; // play after drawing a frame, so caching
90 // won't disrupt the sound
93 qboolean m_return_onerror;
94 char m_return_reason [32];
96 #define StartingGame (m_multiplayer_cursor == 1)
97 #define JoiningGame (m_multiplayer_cursor == 0)
98 #define IPXConfig (m_net_cursor == 0)
99 #define TCPIPConfig (m_net_cursor == 1)
101 void M_ConfigureNetSubsystem(void);
104 #define NumberOfNehahraDemos 34
109 } nehahrademonames_t;
111 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
113 {"intro", "Prologue"},
114 {"genf", "The Beginning"},
115 {"genlab", "A Doomed Project"},
116 {"nehcre", "The New Recruits"},
117 {"maxneh", "Breakthrough"},
118 {"maxchar", "Renewal and Duty"},
119 {"crisis", "Worlds Collide"},
120 {"postcris", "Darkening Skies"},
121 {"hearing", "The Hearing"},
122 {"getjack", "On a Mexican Radio"},
123 {"prelude", "Honor and Justice"},
124 {"abase", "A Message Sent"},
125 {"effect", "The Other Side"},
126 {"uhoh", "Missing in Action"},
127 {"prepare", "The Response"},
128 {"vision", "Farsighted Eyes"},
129 {"maxturns", "Enter the Immortal"},
130 {"backlot", "Separate Ways"},
131 {"maxside", "The Ancient Runes"},
132 {"counter", "The New Initiative"},
133 {"warprep", "Ghosts to the World"},
134 {"counter1", "A Fate Worse Than Death"},
135 {"counter2", "Friendly Fire"},
136 {"counter3", "Minor Setback"},
137 {"madmax", "Scores to Settle"},
138 {"quake", "One Man"},
139 {"cthmm", "Shattered Masks"},
140 {"shades", "Deal with the Dead"},
141 {"gophil", "An Unlikely Hero"},
142 {"cstrike", "War in Hell"},
143 {"shubset", "The Conspiracy"},
144 {"shubdie", "Even Death May Die"},
145 {"newranks", "An Empty Throne"},
146 {"seal", "The Seal is Broken"}
149 float menu_x, menu_y, menu_width, menu_height;
151 void M_DrawBackground(void)
155 menu_x = (vid.conwidth - menu_width) * 0.5;
156 menu_y = (vid.conheight - menu_height) * 0.5;
157 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
164 Draws one solid graphics character
167 void M_DrawCharacter (float cx, float cy, int num)
172 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
175 void M_Print (float cx, float cy, const char *str)
177 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
180 void M_PrintWhite (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_ItemPrint (float cx, float cy, char *str, int unghosted)
188 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
190 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
193 void M_DrawPic (float cx, float cy, char *picname)
195 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
198 qbyte identityTable[256];
199 qbyte translationTable[256];
201 void M_BuildTranslationTable(int top, int bottom)
204 qbyte *dest, *source;
206 for (j = 0; j < 256; j++)
207 identityTable[j] = j;
208 dest = translationTable;
209 source = identityTable;
210 memcpy (dest, source, 256);
212 // LordHavoc: corrected skin color ranges
213 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
214 memcpy (dest + TOP_RANGE, source + top, 16);
216 for (j=0 ; j<16 ; j++)
217 dest[TOP_RANGE+j] = source[top+15-j];
219 // LordHavoc: corrected skin color ranges
220 if (bottom < 128 || (bottom >= 224 && bottom < 240))
221 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
223 for (j=0 ; j<16 ; j++)
224 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
228 void M_DrawTextBox (float x, float y, float width, float height)
236 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
237 for (n = 0; n < height; n++)
240 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
242 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
249 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
250 for (n = 0; n < height; n++)
254 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
256 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
258 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
265 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
266 for (n = 0; n < height; n++)
269 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
271 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
274 //=============================================================================
276 //int m_save_demonum;
283 void M_ToggleMenu_f (void)
287 if (key_dest == key_menu)
289 if (m_state != m_main)
298 //if (key_dest == key_console)
299 // Con_ToggleConsole_f ();
306 void M_Demo_Draw (void)
310 for (i=0; i < NumberOfNehahraDemos; i++)
311 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
314 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
318 void M_Menu_Demos_f (void)
325 void M_Demo_Key (int k)
334 S_LocalSound ("misc/menu2.wav");
337 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
342 S_LocalSound ("misc/menu1.wav");
345 demo_cursor = NumberOfNehahraDemos;
350 S_LocalSound ("misc/menu1.wav");
352 if (demo_cursor > NumberOfNehahraDemos)
358 //=============================================================================
363 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
365 void M_Menu_Main_f (void)
367 if (gamemode == GAME_NEHAHRA)
369 if (NehGameType == TYPE_DEMO)
371 else if (NehGameType == TYPE_GAME)
380 if (key_dest != key_menu)
382 m_save_demonum = cls.demonum;
392 void M_Main_Draw (void)
397 M_DrawPic (16, 4, "gfx/qplaque.lmp");
398 p = Draw_CachePic ("gfx/ttl_main.lmp");
399 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
401 if (gamemode == GAME_NEHAHRA)
403 if (NehGameType == TYPE_BOTH)
404 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
405 else if (NehGameType == TYPE_GAME)
406 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
408 M_DrawPic (72, 32, "gfx/demomenu.lmp");
411 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
413 f = (int)(realtime * 10)%6;
415 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
419 void M_Main_Key (int key)
426 //cls.demonum = m_save_demonum;
427 //if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
432 S_LocalSound ("misc/menu1.wav");
433 if (++m_main_cursor >= MAIN_ITEMS)
438 S_LocalSound ("misc/menu1.wav");
439 if (--m_main_cursor < 0)
440 m_main_cursor = MAIN_ITEMS - 1;
446 if (gamemode == GAME_NEHAHRA)
451 switch (m_main_cursor)
454 M_Menu_SinglePlayer_f ();
462 M_Menu_MultiPlayer_f ();
472 Cbuf_AddText ("disconnect\n");
473 Cbuf_AddText ("playdemo endcred\n");
482 switch (m_main_cursor)
485 M_Menu_SinglePlayer_f ();
489 M_Menu_MultiPlayer_f ();
499 Cbuf_AddText ("disconnect\n");
500 Cbuf_AddText ("playdemo endcred\n");
509 switch (m_main_cursor)
518 Cbuf_AddText ("disconnect\n");
519 Cbuf_AddText ("playdemo endcred\n");
535 switch (m_main_cursor)
538 M_Menu_SinglePlayer_f ();
542 M_Menu_MultiPlayer_f ();
561 //=============================================================================
562 /* SINGLE PLAYER MENU */
564 int m_singleplayer_cursor;
565 #define SINGLEPLAYER_ITEMS 3
568 void M_Menu_SinglePlayer_f (void)
571 m_state = m_singleplayer;
576 void M_SinglePlayer_Draw (void)
580 M_DrawPic (16, 4, "gfx/qplaque.lmp");
581 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
583 // Transfusion doesn't have a single player mode
584 if (gamemode == GAME_TRANSFUSION)
586 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
588 M_DrawTextBox (60, 8 * 8, 23, 4);
589 M_PrintWhite (95, 10 * 8, "Transfusion is for");
590 M_PrintWhite (83, 11 * 8, "multiplayer play only");
596 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
597 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
599 f = (int)(realtime * 10)%6;
601 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
606 void M_SinglePlayer_Key (int key)
608 if (gamemode == GAME_TRANSFUSION)
610 if (key == K_ESCAPE || key == K_ENTER)
622 S_LocalSound ("misc/menu1.wav");
623 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
624 m_singleplayer_cursor = 0;
628 S_LocalSound ("misc/menu1.wav");
629 if (--m_singleplayer_cursor < 0)
630 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
636 switch (m_singleplayer_cursor)
641 Cbuf_AddText ("disconnect\n");
642 Cbuf_AddText ("maxplayers 1\n");
643 Cbuf_AddText ("deathmatch 0\n");
644 Cbuf_AddText ("coop 0\n");
645 if (gamemode == GAME_NEHAHRA)
646 Cbuf_AddText ("map nehstart\n");
648 Cbuf_AddText ("map start\n");
662 //=============================================================================
665 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
667 #define MAX_SAVEGAMES 12
668 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
669 int loadable[MAX_SAVEGAMES];
671 void M_ScanSaves (void)
674 char name[MAX_OSPATH];
679 for (i=0 ; i<MAX_SAVEGAMES ; i++)
681 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
683 sprintf (name, "%s/s%i.sav", com_gamedir, i);
684 f = Qopen (name, "rz");
688 sscanf (str, "%i\n", &version);
690 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
692 // change _ back to space
693 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
694 if (m_filenames[i][j] == '_')
695 m_filenames[i][j] = ' ';
701 void M_Menu_Load_f (void)
710 void M_Menu_Save_f (void)
716 if (svs.maxclients != 1)
725 void M_Load_Draw (void)
730 p = Draw_CachePic ("gfx/p_load.lmp");
731 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
733 for (i=0 ; i< MAX_SAVEGAMES; i++)
734 M_Print (16, 32 + 8*i, m_filenames[i]);
737 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
741 void M_Save_Draw (void)
746 p = Draw_CachePic ("gfx/p_save.lmp");
747 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
749 for (i=0 ; i<MAX_SAVEGAMES ; i++)
750 M_Print (16, 32 + 8*i, m_filenames[i]);
753 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
757 void M_Load_Key (int k)
762 M_Menu_SinglePlayer_f ();
766 S_LocalSound ("misc/menu2.wav");
767 if (!loadable[load_cursor])
772 // issue the load command
773 Cbuf_AddText (va ("load s%i\n", load_cursor) );
778 S_LocalSound ("misc/menu1.wav");
781 load_cursor = MAX_SAVEGAMES-1;
786 S_LocalSound ("misc/menu1.wav");
788 if (load_cursor >= MAX_SAVEGAMES)
795 void M_Save_Key (int k)
800 M_Menu_SinglePlayer_f ();
806 Cbuf_AddText (va("save s%i\n", load_cursor));
811 S_LocalSound ("misc/menu1.wav");
814 load_cursor = MAX_SAVEGAMES-1;
819 S_LocalSound ("misc/menu1.wav");
821 if (load_cursor >= MAX_SAVEGAMES)
827 //=============================================================================
828 /* MULTIPLAYER MENU */
830 int m_multiplayer_cursor;
831 #define MULTIPLAYER_ITEMS 3
834 void M_Menu_MultiPlayer_f (void)
837 m_state = m_multiplayer;
842 void M_MultiPlayer_Draw (void)
847 M_DrawPic (16, 4, "gfx/qplaque.lmp");
848 p = Draw_CachePic ("gfx/p_multi.lmp");
849 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
850 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
852 f = (int)(realtime * 10)%6;
854 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
856 if (ipxAvailable || tcpipAvailable)
858 M_PrintWhite ((320/2) - ((27*8)/2), 168, "No Communications Available");
862 void M_MultiPlayer_Key (int key)
871 S_LocalSound ("misc/menu1.wav");
872 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
873 m_multiplayer_cursor = 0;
877 S_LocalSound ("misc/menu1.wav");
878 if (--m_multiplayer_cursor < 0)
879 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
884 switch (m_multiplayer_cursor)
887 if (ipxAvailable || tcpipAvailable)
892 if (ipxAvailable || tcpipAvailable)
903 //=============================================================================
906 int setup_cursor = 4;
907 int setup_cursor_table[] = {40, 56, 80, 104, 140};
909 char setup_hostname[16];
910 char setup_myname[16];
916 #define NUM_SETUP_CMDS 5
918 void M_Menu_Setup_f (void)
923 strcpy(setup_myname, cl_name.string);
924 strcpy(setup_hostname, hostname.string);
925 setup_top = setup_oldtop = cl_color.integer >> 4;
926 setup_bottom = setup_oldbottom = cl_color.integer & 15;
929 // LordHavoc: rewrote this code greatly
930 void M_MenuPlayerTranslate (qbyte *translation, int top, int bottom)
933 unsigned int trans[4096];
935 static qbyte pixels[4096];
936 static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load = true, menuplyr_failed = false;
940 if (menuplyr_top == top && menuplyr_bottom == bottom)
944 menuplyr_bottom = bottom;
948 menuplyr_load = false;
949 f = COM_LoadFile("gfx/menuplyr.lmp", true);
952 menuplyr_failed = true;
955 data = LoadLMPAs8Bit (f, 0, 0);
957 if (image_width * image_height > 4096)
959 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
961 menuplyr_failed = true;
964 menuplyr_width = image_width;
965 menuplyr_height = image_height;
966 memcpy(pixels, data, menuplyr_width * menuplyr_height);
970 M_BuildTranslationTable (menuplyr_top*16, menuplyr_bottom*16);
972 for (i = 0;i < menuplyr_width * menuplyr_height;i++)
973 trans[i] = palette_complete[translation[pixels[i]]];
975 Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)trans);
978 void M_Setup_Draw (void)
982 M_DrawPic (16, 4, "gfx/qplaque.lmp");
983 p = Draw_CachePic ("gfx/p_multi.lmp");
984 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
986 M_Print (64, 40, "Hostname");
987 M_DrawTextBox (160, 32, 16, 1);
988 M_Print (168, 40, setup_hostname);
990 M_Print (64, 56, "Your name");
991 M_DrawTextBox (160, 48, 16, 1);
992 M_Print (168, 56, setup_myname);
994 M_Print (64, 80, "Shirt color");
995 M_Print (64, 104, "Pants color");
997 M_DrawTextBox (64, 140-8, 14, 1);
998 M_Print (72, 140, "Accept Changes");
1000 M_DrawPic (160, 64, "gfx/bigbox.lmp");
1002 // LordHavoc: rewrote this code greatly
1003 M_MenuPlayerTranslate (translationTable, setup_top, setup_bottom);
1004 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
1006 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
1008 if (setup_cursor == 0)
1009 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1011 if (setup_cursor == 1)
1012 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
1016 void M_Setup_Key (int k)
1023 M_Menu_MultiPlayer_f ();
1027 S_LocalSound ("misc/menu1.wav");
1029 if (setup_cursor < 0)
1030 setup_cursor = NUM_SETUP_CMDS-1;
1034 S_LocalSound ("misc/menu1.wav");
1036 if (setup_cursor >= NUM_SETUP_CMDS)
1041 if (setup_cursor < 2)
1043 S_LocalSound ("misc/menu3.wav");
1044 if (setup_cursor == 2)
1045 setup_top = setup_top - 1;
1046 if (setup_cursor == 3)
1047 setup_bottom = setup_bottom - 1;
1050 if (setup_cursor < 2)
1053 S_LocalSound ("misc/menu3.wav");
1054 if (setup_cursor == 2)
1055 setup_top = setup_top + 1;
1056 if (setup_cursor == 3)
1057 setup_bottom = setup_bottom + 1;
1061 if (setup_cursor == 0 || setup_cursor == 1)
1064 if (setup_cursor == 2 || setup_cursor == 3)
1067 // setup_cursor == 4 (OK)
1068 if (strcmp(cl_name.string, setup_myname) != 0)
1069 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1070 if (strcmp(hostname.string, setup_hostname) != 0)
1071 Cvar_Set("hostname", setup_hostname);
1072 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1073 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1074 m_entersound = true;
1075 M_Menu_MultiPlayer_f ();
1079 if (setup_cursor == 0)
1081 if (strlen(setup_hostname))
1082 setup_hostname[strlen(setup_hostname)-1] = 0;
1085 if (setup_cursor == 1)
1087 if (strlen(setup_myname))
1088 setup_myname[strlen(setup_myname)-1] = 0;
1093 if (k < 32 || k > 127)
1095 if (setup_cursor == 0)
1097 l = strlen(setup_hostname);
1100 setup_hostname[l+1] = 0;
1101 setup_hostname[l] = k;
1104 if (setup_cursor == 1)
1106 l = strlen(setup_myname);
1109 setup_myname[l+1] = 0;
1110 setup_myname[l] = k;
1119 if (setup_bottom > 15)
1121 if (setup_bottom < 0)
1125 //=============================================================================
1130 int m_net_saveHeight;
1132 char *net_helpMessage [] =
1134 /* .........1.........2.... */
1135 " Novell network LANs ",
1136 " or Windows 95 DOS-box. ",
1138 "(LAN=Local Area Network)",
1140 " Commonly used to play ",
1141 " over the Internet, but ",
1142 " also used on a Local ",
1146 void M_Menu_Net_f (void)
1148 key_dest = key_menu;
1150 m_entersound = true;
1153 if (m_net_cursor >= m_net_items)
1156 M_Net_Key (K_DOWNARROW);
1160 void M_Net_Draw (void)
1165 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1166 p = Draw_CachePic ("gfx/p_multi.lmp");
1167 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1172 M_DrawPic (72, f, "gfx/netmen3.lmp");
1174 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1178 M_DrawPic (72, f, "gfx/netmen4.lmp");
1180 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1182 if (m_net_items == 5) // JDC, could just be removed
1185 M_DrawPic (72, f, "gfx/netmen5.lmp");
1189 M_DrawTextBox (f, 134, 24, 4);
1191 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1192 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1194 f = (int)(realtime * 10)%6;
1195 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1199 void M_Net_Key (int k)
1205 M_Menu_MultiPlayer_f ();
1209 S_LocalSound ("misc/menu1.wav");
1210 if (++m_net_cursor >= m_net_items)
1215 S_LocalSound ("misc/menu1.wav");
1216 if (--m_net_cursor < 0)
1217 m_net_cursor = m_net_items - 1;
1221 m_entersound = true;
1223 switch (m_net_cursor)
1226 M_Menu_LanConfig_f ();
1230 M_Menu_LanConfig_f ();
1239 if (m_net_cursor == 0 && !ipxAvailable)
1241 if (m_net_cursor == 1 && !tcpipAvailable)
1245 //=============================================================================
1248 #define SLIDER_RANGE 10
1250 void M_DrawSlider (int x, int y, float range)
1258 M_DrawCharacter (x-8, y, 128);
1259 for (i=0 ; i<SLIDER_RANGE ; i++)
1260 M_DrawCharacter (x + i*8, y, 129);
1261 M_DrawCharacter (x+i*8, y, 130);
1262 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1265 void M_DrawCheckbox (int x, int y, int on)
1268 M_Print (x, y, "on");
1270 M_Print (x, y, "off");
1274 #define OPTIONS_ITEMS 28
1278 void M_Menu_Options_f (void)
1280 key_dest = key_menu;
1281 m_state = m_options;
1282 m_entersound = true;
1286 void M_Menu_Options_AdjustSliders (int dir)
1288 S_LocalSound ("misc/menu3.wav");
1290 switch (options_cursor)
1293 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1296 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1299 Cvar_SetValueQuick (&r_sky, !r_sky.integer);
1302 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1305 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1308 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1311 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1314 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.25, 5));
1317 Cvar_SetValueQuick (&v_contrast, bound(0.5, v_contrast.value + dir * 0.25, 5));
1320 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1322 case 15: // music volume
1324 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1326 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1329 case 16: // sfx volume
1330 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1333 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1336 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1338 case 19: // static crosshair
1339 Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
1341 case 20: // show framerate
1342 Cvar_SetValueQuick (&showfps, !showfps.integer);
1344 case 21: // always run
1345 if (cl_forwardspeed.value > 200)
1347 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1348 Cvar_SetValueQuick (&cl_backspeed, 200);
1352 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1353 Cvar_SetValueQuick (&cl_backspeed, 400);
1356 case 22: // lookspring
1357 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1359 case 23: // lookstrafe
1360 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1362 case 24: // mouse speed
1363 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1365 case 25: // mouse look
1366 Cvar_SetValueQuick (&freelook, !freelook.integer);
1368 case 26: // invert mouse
1369 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1371 case 27: // windowed mouse
1372 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1377 void M_Options_Draw (void)
1382 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1383 p = Draw_CachePic("gfx/p_option.lmp");
1384 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1387 M_Print(16, y, " Customize controls");y += 8;
1388 M_Print(16, y, " Go to console");y += 8;
1389 M_Print(16, y, " Reset to defaults");y += 8;
1390 M_Print(16, y, " Video Options");y += 8;
1391 M_Print(16, y, " Effects Options");y += 8;
1392 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8;
1393 M_Print(16, y, " Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8;
1394 M_Print(16, y, " Sky");M_DrawCheckbox(220, y, r_sky.integer);y += 8;
1395 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, (v_overbrightbits.value) / 4);y += 8;
1396 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1397 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1398 M_ItemPrint(16, y, "Hardware Gamma Control", hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1399 M_ItemPrint(16, y, " Gamma", v_hwgamma.integer);M_DrawSlider(220, y, (v_gamma.value - 1) / 4);y += 8;
1400 M_Print(16, y, " Contrast");M_DrawSlider(220, y, (v_contrast.value - 0.5) / (5 - 0.5));y += 8;
1401 M_Print(16, y, " Brightness");M_DrawSlider(220, y, v_brightness.value / 0.8);y += 8;
1402 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value);y += 8;
1403 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value);y += 8;
1404 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
1405 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, (crosshair_size.value - 1) / 4);y += 8;
1406 M_Print(16, y, " Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
1407 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1408 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1409 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1410 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1411 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, (sensitivity.value - 1)/50);y += 8;
1412 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1413 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1414 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1417 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1421 void M_Options_Key (int k)
1430 m_entersound = true;
1431 switch (options_cursor)
1438 Con_ToggleConsole_f ();
1441 Cbuf_AddText ("exec default.cfg\n");
1447 M_Menu_Options_Effects_f ();
1450 M_Menu_Options_AdjustSliders (1);
1456 S_LocalSound ("misc/menu1.wav");
1458 if (options_cursor < 0)
1459 options_cursor = OPTIONS_ITEMS-1;
1463 S_LocalSound ("misc/menu1.wav");
1465 if (options_cursor >= OPTIONS_ITEMS)
1470 M_Menu_Options_AdjustSliders (-1);
1474 M_Menu_Options_AdjustSliders (1);
1479 #define OPTIONS_EFFECTS_ITEMS 16
1481 int options_effects_cursor;
1483 void M_Menu_Options_Effects_f (void)
1485 key_dest = key_menu;
1486 m_state = m_options_effects;
1487 m_entersound = true;
1491 extern cvar_t r_detailtextures;
1492 extern cvar_t cl_particles;
1493 extern cvar_t cl_explosions;
1494 extern cvar_t cl_stainmaps;
1495 extern cvar_t r_explosionclip;
1496 extern cvar_t r_dlightmap;
1497 extern cvar_t r_modellights;
1498 extern cvar_t r_coronas;
1499 extern cvar_t gl_flashblend;
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_size;
1506 extern cvar_t cl_particles_blood_alpha;
1508 void M_Menu_Options_Effects_AdjustSliders (int dir)
1510 S_LocalSound ("misc/menu3.wav");
1512 switch (options_effects_cursor)
1515 Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
1518 Cvar_SetValueQuick (&r_dlightmap, !r_dlightmap.integer);
1521 Cvar_SetValueQuick (&r_coronas, !r_coronas.integer);
1524 Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer);
1527 Cvar_SetValueQuick (&cl_particles, !cl_particles.integer);
1530 Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer);
1533 Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer);
1536 Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer);
1539 Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer);
1542 Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer);
1545 Cvar_SetValueQuick (&cl_particles_smoke, !cl_particles_smoke.integer);
1548 Cvar_SetValueQuick (&cl_particles_sparks, !cl_particles_sparks.integer);
1551 Cvar_SetValueQuick (&cl_particles_bubbles, !cl_particles_bubbles.integer);
1554 Cvar_SetValueQuick (&cl_particles_blood, !cl_particles_blood.integer);
1557 Cvar_SetValueQuick (&cl_particles_blood_size, bound(2, cl_particles_blood_size.value + dir * 1, 20));
1560 Cvar_SetValueQuick (&cl_particles_blood_alpha, bound(0.2, cl_particles_blood_alpha.value + dir * 0.1, 1));
1565 void M_Options_Effects_Draw (void)
1570 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1571 p = Draw_CachePic("gfx/p_option.lmp");
1572 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1575 M_Print(16, y, " Lights Per Model");M_DrawSlider(220, y, r_modellights.value / 8);y += 8;
1576 M_Print(16, y, " Fast Dynamic Lighting");M_DrawCheckbox(220, y, !r_dlightmap.integer);y += 8;
1577 M_Print(16, y, " Coronas");M_DrawCheckbox(220, y, r_coronas.integer);y += 8;
1578 M_Print(16, y, " Use Only Coronas");M_DrawCheckbox(220, y, gl_flashblend.integer);y += 8;
1579 M_Print(16, y, " Particles");M_DrawCheckbox(220, y, cl_particles.integer);y += 8;
1580 M_Print(16, y, " Explosions");M_DrawCheckbox(220, y, cl_explosions.integer);y += 8;
1581 M_Print(16, y, " Explosion Clipping");M_DrawCheckbox(220, y, r_explosionclip.integer);y += 8;
1582 M_Print(16, y, " Stainmaps");M_DrawCheckbox(220, y, cl_stainmaps.integer);y += 8;
1583 M_Print(16, y, " Detail Texturing");M_DrawCheckbox(220, y, r_detailtextures.integer);y += 8;
1584 M_Print(16, y, " Bullet Impacts");M_DrawCheckbox(220, y, cl_particles_bulletimpacts.integer);y += 8;
1585 M_Print(16, y, " Smoke");M_DrawCheckbox(220, y, cl_particles_smoke.integer);y += 8;
1586 M_Print(16, y, " Sparks");M_DrawCheckbox(220, y, cl_particles_sparks.integer);y += 8;
1587 M_Print(16, y, " Bubbles");M_DrawCheckbox(220, y, cl_particles_bubbles.integer);y += 8;
1588 M_Print(16, y, " Blood");M_DrawCheckbox(220, y, cl_particles_blood.integer);y += 8;
1589 M_Print(16, y, " Blood Size");M_DrawSlider(220, y, (cl_particles_blood_size.value - 2) / 18);y += 8;
1590 M_Print(16, y, " Blood Opacity");M_DrawSlider(220, y, (cl_particles_blood_alpha.value - 0.2) / 0.8);y += 8;
1593 M_DrawCharacter(200, 32 + options_effects_cursor*8, 12+((int)(realtime*4)&1));
1597 void M_Options_Effects_Key (int k)
1602 M_Menu_Options_f ();
1606 M_Menu_Options_Effects_AdjustSliders (1);
1610 S_LocalSound ("misc/menu1.wav");
1611 options_effects_cursor--;
1612 if (options_effects_cursor < 0)
1613 options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
1617 S_LocalSound ("misc/menu1.wav");
1618 options_effects_cursor++;
1619 if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
1620 options_effects_cursor = 0;
1624 M_Menu_Options_Effects_AdjustSliders (-1);
1628 M_Menu_Options_Effects_AdjustSliders (1);
1633 //=============================================================================
1636 char *quakebindnames[][2] =
1638 {"+attack", "attack"},
1639 {"impulse 10", "next weapon"},
1640 {"impulse 12", "previous weapon"},
1641 {"+jump", "jump / swim up"},
1642 {"+forward", "walk forward"},
1643 {"+back", "backpedal"},
1644 {"+left", "turn left"},
1645 {"+right", "turn right"},
1647 {"+moveleft", "step left"},
1648 {"+moveright", "step right"},
1649 {"+strafe", "sidestep"},
1650 {"+lookup", "look up"},
1651 {"+lookdown", "look down"},
1652 {"centerview", "center view"},
1653 {"+mlook", "mouse look"},
1654 {"+klook", "keyboard look"},
1655 {"+moveup", "swim up"},
1656 {"+movedown", "swim down"}
1659 char *transfusionbindnames[][2] =
1661 {"+forward", "walk forward"},
1662 {"+back", "backpedal"},
1663 {"+left", "turn left"},
1664 {"+right", "turn right"},
1665 {"+moveleft", "step left"},
1666 {"+moveright", "step right"},
1667 {"+jump", "jump / swim up"},
1668 {"+movedown", "swim down"},
1669 {"+attack", "attack"},
1670 {"+button3", "altfire"},
1671 {"impulse 1", "Pitch Fork"},
1672 {"impulse 2", "Flare Gun"},
1673 {"impulse 3", "Shotgun"},
1674 {"impulse 4", "Machine Gun"},
1675 {"impulse 5", "Incinerator"},
1676 {"impulse 6", "Bombs"},
1677 {"impulse 7", "Aerosol Can"},
1678 {"impulse 8", "Tesla Cannon"},
1679 {"impulse 9", "Life Leech"},
1680 {"impulse 17", "Voodoo Doll"},
1681 {"impulse 11", "previous weapon"},
1682 {"impulse 10", "next weapon"},
1683 {"impulse 14", "previous item"},
1684 {"impulse 15", "next item"},
1685 {"impulse 13", "use item"},
1686 {"impulse 100", "add bot (red)"},
1687 {"impulse 101", "add bot (blue)"},
1688 {"impulse 102", "kick a bot"},
1689 {"impulse 50", "voting menu"},
1690 {"impulse 141", "identify player"},
1691 {"impulse 16", "next armor type"},
1692 {"impulse 20", "observer mode"}
1696 char *(*bindnames)[2];
1699 typedef struct binditem_s
1701 char *command, *description;
1702 struct binditem_s *next;
1706 typedef struct bindcategory_s
1710 struct bindcategory_s *next;
1714 bindcategory_t *bindcategories = NULL;
1716 void M_ClearBinds (void)
1718 for (c = bindcategories;c;c = cnext)
1721 for (b = c->binds;b;b = bnext)
1728 bindcategories = NULL;
1731 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1733 for (b = &c->binds;*b;*b = &(*b)->next);
1734 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1735 *b->command = (char *)((*b) + 1);
1736 *b->description = *b->command + strlen(command) + 1;
1737 strcpy(*b->command, command);
1738 strcpy(*b->description, description);
1741 void M_AddBind (char *category, char *command, char *description)
1743 for (c = &bindcategories;*c;c = &(*c)->next)
1745 if (!strcmp(category, (*c)->name))
1747 M_AddBindToCategory(*c, command, description);
1751 *c = Z_Alloc(sizeof(bindcategory_t));
1752 M_AddBindToCategory(*c, command, description);
1755 void M_DefaultBinds (void)
1758 M_AddBind("movement", "+jump", "jump / swim up");
1759 M_AddBind("movement", "+forward", "walk forward");
1760 M_AddBind("movement", "+back", "backpedal");
1761 M_AddBind("movement", "+left", "turn left");
1762 M_AddBind("movement", "+right", "turn right");
1763 M_AddBind("movement", "+speed", "run");
1764 M_AddBind("movement", "+moveleft", "step left");
1765 M_AddBind("movement", "+moveright", "step right");
1766 M_AddBind("movement", "+strafe", "sidestep");
1767 M_AddBind("movement", "+lookup", "look up");
1768 M_AddBind("movement", "+lookdown", "look down");
1769 M_AddBind("movement", "centerview", "center view");
1770 M_AddBind("movement", "+mlook", "mouse look");
1771 M_AddBind("movement", "+klook", "keyboard look");
1772 M_AddBind("movement", "+moveup", "swim up");
1773 M_AddBind("movement", "+movedown", "swim down");
1774 M_AddBind("weapons", "+attack", "attack");
1775 M_AddBind("weapons", "impulse 10", "next weapon");
1776 M_AddBind("weapons", "impulse 12", "previous weapon");
1777 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1778 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1779 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1780 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1781 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1782 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1783 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1784 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1792 void M_Menu_Keys_f (void)
1794 key_dest = key_menu;
1796 m_entersound = true;
1801 void M_FindKeysForCommand (char *command, int *keys)
1807 for (j = 0;j < NUMKEYS;j++)
1812 for (j=0 ; j<256 ; j++)
1817 if (!strcmp (b, command) )
1820 if (count == NUMKEYS)
1826 void M_UnbindCommand (char *command)
1831 for (j=0 ; j<256 ; j++)
1836 if (!strcmp (b, command))
1837 Key_SetBinding (j, "");
1842 void M_Keys_Draw (void)
1848 char keystring[1024];
1850 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1851 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1854 M_Print (12, 32, "Press a key or button for this action");
1856 M_Print (18, 32, "Enter to change, backspace to clear");
1858 // search for known bindings
1859 for (i=0 ; i<numcommands ; i++)
1863 M_Print (16, y, bindnames[i][1]);
1865 M_FindKeysForCommand (bindnames[i][0], keys);
1867 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1869 strcpy(keystring, "???");
1873 for (j = 0;j < NUMKEYS;j++)
1878 strcat(keystring, " or ");
1879 strcat(keystring, Key_KeynumToString (keys[j]));
1883 M_Print (150, y, keystring);
1887 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
1889 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1893 void M_Keys_Key (int k)
1900 S_LocalSound ("misc/menu1.wav");
1905 else //if (k != '`')
1907 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1908 Cbuf_InsertText (cmd);
1918 M_Menu_Options_f ();
1923 S_LocalSound ("misc/menu1.wav");
1925 if (keys_cursor < 0)
1926 keys_cursor = numcommands-1;
1931 S_LocalSound ("misc/menu1.wav");
1933 if (keys_cursor >= numcommands)
1937 case K_ENTER: // go into bind mode
1938 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1939 S_LocalSound ("misc/menu2.wav");
1940 if (keys[NUMKEYS - 1] != -1)
1941 M_UnbindCommand (bindnames[keys_cursor][0]);
1945 case K_BACKSPACE: // delete bindings
1946 case K_DEL: // delete bindings
1947 S_LocalSound ("misc/menu2.wav");
1948 M_UnbindCommand (bindnames[keys_cursor][0]);
1953 //=============================================================================
1956 #define VIDEO_ITEMS 5
1958 int video_cursor = 0;
1959 int video_cursor_table[] = {56, 68, 80, 92, 116};
1960 unsigned short video_resolutions[][2] = {{512,384}, {640,480}, {800,600}, {1024,768}, {1280,960}};
1961 int video_resolution;
1963 extern int current_vid_fullscreen;
1964 extern int current_vid_width;
1965 extern int current_vid_height;
1966 extern int current_vid_bitsperpixel;
1967 extern int current_vid_stencil;
1970 void M_Menu_Video_f (void)
1972 key_dest = key_menu;
1974 m_entersound = true;
1976 // Look for the current resolution
1977 for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
1979 if (video_resolutions[video_resolution][0] == current_vid_width &&
1980 video_resolutions[video_resolution][1] == current_vid_height)
1984 // Default to 800x600 if we didn't find it
1985 if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0]))
1987 video_resolution = 2;
1988 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
1989 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
1994 void M_Video_Draw (void)
1999 M_DrawPic(16, 4, "gfx/qplaque.lmp");
2000 p = Draw_CachePic("gfx/vidmodes.lmp");
2001 M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
2004 M_Print(16, video_cursor_table[0], " Resolution");
2005 string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]);
2006 M_Print (220, video_cursor_table[0], string);
2009 M_Print(16, video_cursor_table[1], " Bits per pixel");
2010 M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16");
2013 M_Print(16, video_cursor_table[2], " Fullscreen");
2014 M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
2017 M_Print(16, video_cursor_table[3], " Stencil");
2018 M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
2021 M_Print(220, video_cursor_table[4], "Apply");
2024 M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
2028 void M_Menu_Video_AdjustSliders (int dir)
2030 S_LocalSound ("misc/menu3.wav");
2032 switch (video_cursor)
2037 int new_resolution = video_resolution + dir;
2038 if (new_resolution < 0)
2039 video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
2040 else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
2041 video_resolution = 0;
2043 video_resolution = new_resolution;
2045 Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]);
2046 Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]);
2052 Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
2055 Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
2058 Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer);
2064 void M_Video_Key (int key)
2069 // vid_shared.c has a copy of the current video config. We restore it
2070 Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
2071 Cvar_SetValueQuick(&vid_width, current_vid_width);
2072 Cvar_SetValueQuick(&vid_height, current_vid_height);
2073 Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
2074 Cvar_SetValueQuick(&vid_stencil, current_vid_stencil);
2076 S_LocalSound ("misc/menu1.wav");
2077 M_Menu_Options_f ();
2081 m_entersound = true;
2082 switch (video_cursor)
2085 Cbuf_AddText ("vid_restart\n");
2086 M_Menu_Options_f ();
2089 M_Menu_Video_AdjustSliders (1);
2094 S_LocalSound ("misc/menu1.wav");
2096 if (video_cursor < 0)
2097 video_cursor = VIDEO_ITEMS-1;
2101 S_LocalSound ("misc/menu1.wav");
2103 if (video_cursor >= VIDEO_ITEMS)
2108 M_Menu_Video_AdjustSliders (-1);
2112 M_Menu_Video_AdjustSliders (1);
2117 //=============================================================================
2121 #define NUM_HELP_PAGES 6
2124 void M_Menu_Help_f (void)
2126 key_dest = key_menu;
2128 m_entersound = true;
2134 void M_Help_Draw (void)
2136 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
2140 void M_Help_Key (int key)
2150 m_entersound = true;
2151 if (++help_page >= NUM_HELP_PAGES)
2157 m_entersound = true;
2158 if (--help_page < 0)
2159 help_page = NUM_HELP_PAGES-1;
2165 //=============================================================================
2169 int m_quit_prevstate;
2170 qboolean wasInMenus;
2172 char *quitMessage [] =
2174 /* .........1.........2.... */
2176 " Are you gonna quit ",
2177 " this game just like ",
2178 " everything else? ",
2181 " Milord, methinks that ",
2182 " thou art a lowly ",
2183 " quitter. Is this true? ",
2186 " Do I need to bust your ",
2187 " face open for trying ",
2191 " Man, I oughta smack you",
2192 " for trying to quit! ",
2196 " Press Y to quit like a ",
2197 " big loser in life. ",
2198 " Press N to stay proud ",
2199 " and successful! ",
2201 " If you press Y to ",
2202 " quit, I will summon ",
2203 " Satan all over your ",
2206 " Um, Asmodeus dislikes ",
2207 " his children trying to ",
2208 " quit. Press Y to return",
2209 " to your Tinkertoys. ",
2211 " If you quit now, I'll ",
2212 " throw a blanket-party ",
2213 " for you next time! ",
2217 /* .........1.........2.... */
2219 " Tired of fragging ",
2224 " Quit now and forfeit ",
2225 " your bodycount? ",
2229 " Are you sure you ",
2234 " Off to do something ",
2239 void M_Menu_Quit_f (void)
2241 if (m_state == m_quit)
2243 wasInMenus = (key_dest == key_menu);
2244 key_dest = key_menu;
2245 m_quit_prevstate = m_state;
2247 m_entersound = true;
2248 msgNumber = rand()&3; //&7;
2252 void M_Quit_Key (int key)
2261 m_state = m_quit_prevstate;
2262 m_entersound = true;
2266 key_dest = key_game;
2283 void M_Quit_Draw (void)
2285 M_DrawTextBox (56, 76, 24, 4);
2286 M_Print (64, 84, quitMessage[msgNumber*4+0]);
2287 M_Print (64, 92, quitMessage[msgNumber*4+1]);
2288 M_Print (64, 100, quitMessage[msgNumber*4+2]);
2289 M_Print (64, 108, quitMessage[msgNumber*4+3]);
2292 //=============================================================================
2293 /* LAN CONFIG MENU */
2295 int lanConfig_cursor = -1;
2296 int lanConfig_cursor_table [] = {72, 92, 112, 144};
2297 #define NUM_LANCONFIG_CMDS 4
2300 char lanConfig_portname[6];
2301 char lanConfig_joinname[22];
2303 void M_Menu_LanConfig_f (void)
2305 key_dest = key_menu;
2306 m_state = m_lanconfig;
2307 m_entersound = true;
2308 if (lanConfig_cursor == -1)
2310 if (JoiningGame && TCPIPConfig)
2311 lanConfig_cursor = 2;
2313 lanConfig_cursor = 1;
2315 if (StartingGame && lanConfig_cursor == 2)
2316 lanConfig_cursor = 1;
2317 lanConfig_port = DEFAULTnet_hostport;
2318 sprintf(lanConfig_portname, "%u", lanConfig_port);
2320 m_return_onerror = false;
2321 m_return_reason[0] = 0;
2325 void M_LanConfig_Draw (void)
2332 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2333 p = Draw_CachePic ("gfx/p_multi.lmp");
2334 basex = (320-p->width)/2;
2335 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2338 startJoin = "New Game";
2340 startJoin = "Join Game";
2344 protocol = "TCP/IP";
2345 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2348 M_Print (basex, 52, "Address:");
2350 M_Print (basex+9*8, 52, my_ipx_address);
2352 M_Print (basex+9*8, 52, my_tcpip_address);
2354 M_Print (basex, lanConfig_cursor_table[0], "Port");
2355 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2356 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2360 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2361 M_Print (basex, lanConfig_cursor_table[2], "Search for internet games...");
2362 M_Print (basex, 128, "Join game at:");
2363 M_DrawTextBox (basex+8, lanConfig_cursor_table[3]-8, 22, 1);
2364 M_Print (basex+16, lanConfig_cursor_table[3], lanConfig_joinname);
2368 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2369 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2372 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2374 if (lanConfig_cursor == 0)
2375 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2377 if (lanConfig_cursor == 3)
2378 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [3], 10+((int)(realtime*4)&1));
2380 if (*m_return_reason)
2381 M_PrintWhite (basex, 168, m_return_reason);
2385 void M_LanConfig_Key (int key)
2396 S_LocalSound ("misc/menu1.wav");
2398 if (lanConfig_cursor < 0)
2399 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2403 S_LocalSound ("misc/menu1.wav");
2405 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2406 lanConfig_cursor = 0;
2410 if (lanConfig_cursor == 0)
2413 m_entersound = true;
2415 M_ConfigureNetSubsystem ();
2417 if (lanConfig_cursor == 1 || lanConfig_cursor == 2)
2421 M_Menu_GameOptions_f ();
2424 if (lanConfig_cursor == 1)
2427 M_Menu_InetSearch_f();
2431 if (lanConfig_cursor == 3)
2433 m_return_state = m_state;
2434 m_return_onerror = true;
2435 key_dest = key_game;
2437 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2444 if (lanConfig_cursor == 0)
2446 if (strlen(lanConfig_portname))
2447 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2450 if (lanConfig_cursor == 3)
2452 if (strlen(lanConfig_joinname))
2453 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2458 if (key < 32 || key > 127)
2461 if (lanConfig_cursor == 3)
2463 l = strlen(lanConfig_joinname);
2466 lanConfig_joinname[l+1] = 0;
2467 lanConfig_joinname[l] = key;
2471 if (key < '0' || key > '9')
2473 if (lanConfig_cursor == 0)
2475 l = strlen(lanConfig_portname);
2478 lanConfig_portname[l+1] = 0;
2479 lanConfig_portname[l] = key;
2484 if (StartingGame && lanConfig_cursor == 3)
2486 if (key == K_UPARROW)
2487 lanConfig_cursor = 1;
2489 lanConfig_cursor = 0;
2492 l = atoi(lanConfig_portname);
2497 sprintf(lanConfig_portname, "%u", lanConfig_port);
2500 //=============================================================================
2501 /* GAME OPTIONS MENU */
2520 episode_t *episodes;
2525 level_t quakelevels[] =
2527 {"start", "Entrance"}, // 0
2529 {"e1m1", "Slipgate Complex"}, // 1
2530 {"e1m2", "Castle of the Damned"},
2531 {"e1m3", "The Necropolis"},
2532 {"e1m4", "The Grisly Grotto"},
2533 {"e1m5", "Gloom Keep"},
2534 {"e1m6", "The Door To Chthon"},
2535 {"e1m7", "The House of Chthon"},
2536 {"e1m8", "Ziggurat Vertigo"},
2538 {"e2m1", "The Installation"}, // 9
2539 {"e2m2", "Ogre Citadel"},
2540 {"e2m3", "Crypt of Decay"},
2541 {"e2m4", "The Ebon Fortress"},
2542 {"e2m5", "The Wizard's Manse"},
2543 {"e2m6", "The Dismal Oubliette"},
2544 {"e2m7", "Underearth"},
2546 {"e3m1", "Termination Central"}, // 16
2547 {"e3m2", "The Vaults of Zin"},
2548 {"e3m3", "The Tomb of Terror"},
2549 {"e3m4", "Satan's Dark Delight"},
2550 {"e3m5", "Wind Tunnels"},
2551 {"e3m6", "Chambers of Torment"},
2552 {"e3m7", "The Haunted Halls"},
2554 {"e4m1", "The Sewage System"}, // 23
2555 {"e4m2", "The Tower of Despair"},
2556 {"e4m3", "The Elder God Shrine"},
2557 {"e4m4", "The Palace of Hate"},
2558 {"e4m5", "Hell's Atrium"},
2559 {"e4m6", "The Pain Maze"},
2560 {"e4m7", "Azure Agony"},
2561 {"e4m8", "The Nameless City"},
2563 {"end", "Shub-Niggurath's Pit"}, // 31
2565 {"dm1", "Place of Two Deaths"}, // 32
2566 {"dm2", "Claustrophobopolis"},
2567 {"dm3", "The Abandoned Base"},
2568 {"dm4", "The Bad Place"},
2569 {"dm5", "The Cistern"},
2570 {"dm6", "The Dark Zone"}
2573 episode_t quakeepisodes[] =
2575 {"Welcome to Quake", 0, 1},
2576 {"Doomed Dimension", 1, 8},
2577 {"Realm of Black Magic", 9, 7},
2578 {"Netherworld", 16, 7},
2579 {"The Elder World", 23, 8},
2580 {"Final Level", 31, 1},
2581 {"Deathmatch Arena", 32, 6}
2584 //MED 01/06/97 added hipnotic levels
2585 level_t hipnoticlevels[] =
2587 {"start", "Command HQ"}, // 0
2589 {"hip1m1", "The Pumping Station"}, // 1
2590 {"hip1m2", "Storage Facility"},
2591 {"hip1m3", "The Lost Mine"},
2592 {"hip1m4", "Research Facility"},
2593 {"hip1m5", "Military Complex"},
2595 {"hip2m1", "Ancient Realms"}, // 6
2596 {"hip2m2", "The Black Cathedral"},
2597 {"hip2m3", "The Catacombs"},
2598 {"hip2m4", "The Crypt"},
2599 {"hip2m5", "Mortum's Keep"},
2600 {"hip2m6", "The Gremlin's Domain"},
2602 {"hip3m1", "Tur Torment"}, // 12
2603 {"hip3m2", "Pandemonium"},
2604 {"hip3m3", "Limbo"},
2605 {"hip3m4", "The Gauntlet"},
2607 {"hipend", "Armagon's Lair"}, // 16
2609 {"hipdm1", "The Edge of Oblivion"} // 17
2612 //MED 01/06/97 added hipnotic episodes
2613 episode_t hipnoticepisodes[] =
2615 {"Scourge of Armagon", 0, 1},
2616 {"Fortress of the Dead", 1, 5},
2617 {"Dominion of Darkness", 6, 6},
2618 {"The Rift", 12, 4},
2619 {"Final Level", 16, 1},
2620 {"Deathmatch Arena", 17, 1}
2623 //PGM 01/07/97 added rogue levels
2624 //PGM 03/02/97 added dmatch level
2625 level_t roguelevels[] =
2627 {"start", "Split Decision"},
2628 {"r1m1", "Deviant's Domain"},
2629 {"r1m2", "Dread Portal"},
2630 {"r1m3", "Judgement Call"},
2631 {"r1m4", "Cave of Death"},
2632 {"r1m5", "Towers of Wrath"},
2633 {"r1m6", "Temple of Pain"},
2634 {"r1m7", "Tomb of the Overlord"},
2635 {"r2m1", "Tempus Fugit"},
2636 {"r2m2", "Elemental Fury I"},
2637 {"r2m3", "Elemental Fury II"},
2638 {"r2m4", "Curse of Osiris"},
2639 {"r2m5", "Wizard's Keep"},
2640 {"r2m6", "Blood Sacrifice"},
2641 {"r2m7", "Last Bastion"},
2642 {"r2m8", "Source of Evil"},
2643 {"ctf1", "Division of Change"}
2646 //PGM 01/07/97 added rogue episodes
2647 //PGM 03/02/97 added dmatch episode
2648 episode_t rogueepisodes[] =
2650 {"Introduction", 0, 1},
2651 {"Hell's Fortress", 1, 7},
2652 {"Corridors of Time", 8, 8},
2653 {"Deathmatch Arena", 16, 1}
2656 level_t nehahralevels[] =
2658 {"nehstart", "Welcome to Nehahra"},
2659 {"neh1m1", "Forge City1: Slipgates"},
2660 {"neh1m2", "Forge City2: Boiler"},
2661 {"neh1m3", "Forge City3: Escape"},
2662 {"neh1m4", "Grind Core"},
2663 {"neh1m5", "Industrial Silence"},
2664 {"neh1m6", "Locked-Up Anger"},
2665 {"neh1m7", "Wanderer of the Wastes"},
2666 {"neh1m8", "Artemis System Net"},
2667 {"neh1m9", "To the Death"},
2668 {"neh2m1", "The Gates of Ghoro"},
2669 {"neh2m2", "Sacred Trinity"},
2670 {"neh2m3", "Realm of the Ancients"},
2671 {"neh2m4", "Temple of the Ancients"},
2672 {"neh2m5", "Dreams Made Flesh"},
2673 {"neh2m6", "Your Last Cup of Sorrow"},
2674 {"nehsec", "Ogre's Bane"},
2675 {"nehahra", "Nehahra's Den"},
2676 {"nehend", "Quintessence"}
2679 episode_t nehahraepisodes[] =
2681 {"Welcome to Nehahra", 0, 1},
2682 {"The Fall of Forge", 1, 9},
2683 {"The Outlands", 10, 7},
2684 {"Dimension of the Lost", 17, 2}
2687 // Map list for Transfusion
2688 level_t transfusionlevels[] =
2690 {"bb1", "The Stronghold"},
2691 {"bb2", "Winter Wonderland"},
2693 {"bb4", "The Tower"},
2695 {"bb6", "Twin Fortress"},
2697 {"bb8", "Fun With Heads"},
2699 {"e1m1", "Cradle to Grave"},
2700 {"e1m2", "Wrong Side of the Tracks"},
2701 {"e1m7", "Altar of Stone"},
2702 {"e2m8", "The Lair of Shial"},
2703 {"e3m7", "The Pit of Cerberus"},
2704 {"e4m8", "The Hall of the Epiphany"},
2705 {"e4m9", "Mall of the Dead"},
2707 {"dm1", "Monolith Building 11"},
2710 {"e6m1", "Welcome to Your Life"},
2711 {"e6m8", "Beauty and the Beast"},
2713 {"cpbb01", "Crypt of Despair"},
2714 {"cpbb03", "Unholy Cathedral"},
2716 {"b2a15", "Area 15 (B2)"},
2717 {"barena", "Blood Arena"},
2718 {"bkeep", "Blood Keep"},
2719 {"bstar", "Brown Star"},
2720 {"crypt", "The Crypt"},
2722 {"bb3_2k1", "Bodies Infusion"},
2723 {"dcamp", "DeathCamp"},
2724 {"highnoon", "HighNoon"},
2725 {"qbb1", "The Confluence"},
2726 {"qbb2", "KathartiK"},
2727 {"qbb3", "Caleb's Woodland Retreat"},
2729 {"dranzbb6", "Black Coffee"},
2730 {"fragm", "Frag'M"},
2732 {"qe1m7", "The House of Chthon"},
2733 {"simple", "Dead Simple"}
2736 episode_t transfusionepisodes[] =
2739 {"Blood Single Player", 8, 7},
2740 {"Plasma Pack", 15, 5},
2741 {"Cryptic Passage", 20, 2},
2743 {"Transfusion", 27, 6},
2744 {"Conversions", 33, 5}
2747 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2748 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2749 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2750 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2751 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2752 gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 7};
2757 gamelevels_t *notregistered;
2758 gamelevels_t *registered;
2762 gameinfo_t gamelist[] =
2764 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2765 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2766 {GAME_ROGUE, &roguegame, &roguegame},
2767 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2768 {GAME_TRANSFUSION, &transfusiongame, &transfusiongame},
2769 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2772 gamelevels_t *lookupgameinfo(void)
2775 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2776 if (registered.integer)
2777 return gamelist[i].registered;
2779 return gamelist[i].notregistered;
2785 qboolean m_serverInfoMessage = false;
2786 double m_serverInfoMessageTime;
2788 void M_Menu_GameOptions_f (void)
2790 key_dest = key_menu;
2791 m_state = m_gameoptions;
2792 m_entersound = true;
2793 if (maxplayers == 0)
2794 maxplayers = svs.maxclients;
2796 maxplayers = MAX_SCOREBOARD;
2800 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2801 #define NUM_GAMEOPTIONS 9
2802 int gameoptions_cursor;
2804 void M_GameOptions_Draw (void)
2810 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2811 p = Draw_CachePic ("gfx/p_multi.lmp");
2812 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2814 M_DrawTextBox (152, 32, 10, 1);
2815 M_Print (160, 40, "begin game");
2817 M_Print (0, 56, " Max players");
2818 M_Print (160, 56, va("%i", maxplayers) );
2820 M_Print (0, 64, " Game Type");
2821 if (gamemode == GAME_TRANSFUSION)
2823 if (!deathmatch.integer)
2824 Cvar_SetValue("deathmatch", 1);
2825 if (deathmatch.integer == 2)
2826 M_Print (160, 64, "Capture the Flag");
2828 M_Print (160, 64, "Blood Bath");
2832 if (!coop.integer && !deathmatch.integer)
2833 Cvar_SetValue("deathmatch", 1);
2835 M_Print (160, 64, "Cooperative");
2837 M_Print (160, 64, "Deathmatch");
2840 M_Print (0, 72, " Teamplay");
2841 if (gamemode == GAME_ROGUE)
2845 switch((int)teamplay.integer)
2847 case 1: msg = "No Friendly Fire"; break;
2848 case 2: msg = "Friendly Fire"; break;
2849 case 3: msg = "Tag"; break;
2850 case 4: msg = "Capture the Flag"; break;
2851 case 5: msg = "One Flag CTF"; break;
2852 case 6: msg = "Three Team CTF"; break;
2853 default: msg = "Off"; break;
2855 M_Print (160, 72, msg);
2857 else if (gamemode == GAME_TRANSFUSION)
2861 switch (teamplay.integer)
2863 case 0: msg = "Off"; break;
2864 case 2: msg = "Friendly Fire"; break;
2865 default: msg = "No Friendly Fire"; break;
2867 M_Print (160, 72, msg);
2873 switch((int)teamplay.integer)
2875 case 1: msg = "No Friendly Fire"; break;
2876 case 2: msg = "Friendly Fire"; break;
2877 default: msg = "Off"; break;
2879 M_Print (160, 72, msg);
2882 M_Print (0, 80, " Skill");
2883 if (skill.integer == 0)
2884 M_Print (160, 80, "Easy difficulty");
2885 else if (skill.integer == 1)
2886 M_Print (160, 80, "Normal difficulty");
2887 else if (skill.integer == 2)
2888 M_Print (160, 80, "Hard difficulty");
2890 M_Print (160, 80, "Nightmare difficulty");
2892 M_Print (0, 88, " Frag Limit");
2893 if (fraglimit.integer == 0)
2894 M_Print (160, 88, "none");
2896 M_Print (160, 88, va("%i frags", fraglimit.integer));
2898 M_Print (0, 96, " Time Limit");
2899 if (timelimit.integer == 0)
2900 M_Print (160, 96, "none");
2902 M_Print (160, 96, va("%i minutes", timelimit.integer));
2904 g = lookupgameinfo();
2906 M_Print (0, 112, " Episode");
2907 M_Print (160, 112, g->episodes[startepisode].description);
2909 M_Print (0, 120, " Level");
2910 M_Print (160, 120, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
2911 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
2914 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2916 if (m_serverInfoMessage)
2918 if ((realtime - m_serverInfoMessageTime) < 5.0)
2921 M_DrawTextBox (x, 138, 24, 4);
2923 M_Print (x, 146, " More than 64 players?? ");
2924 M_Print (x, 154, " First, question your ");
2925 M_Print (x, 162, " sanity, then email ");
2926 M_Print (x, 170, " havoc@telefragged.com ");
2930 m_serverInfoMessage = false;
2936 void M_NetStart_Change (int dir)
2941 switch (gameoptions_cursor)
2945 if (maxplayers > MAX_SCOREBOARD)
2947 maxplayers = MAX_SCOREBOARD;
2948 m_serverInfoMessage = true;
2949 m_serverInfoMessageTime = realtime;
2956 if (gamemode == GAME_TRANSFUSION)
2958 if (deathmatch.integer == 2) // changing from CTF to BloodBath
2959 Cvar_SetValueQuick (&deathmatch, 0);
2960 else // changing from BloodBath to CTF
2961 Cvar_SetValueQuick (&deathmatch, 2);
2965 if (deathmatch.integer) // changing from deathmatch to coop
2967 Cvar_SetValueQuick (&coop, 1);
2968 Cvar_SetValueQuick (&deathmatch, 0);
2970 else // changing from coop to deathmatch
2972 Cvar_SetValueQuick (&coop, 0);
2973 Cvar_SetValueQuick (&deathmatch, 1);
2979 if (gamemode == GAME_ROGUE)
2984 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
2985 if (teamplay.integer > count)
2986 Cvar_SetValueQuick (&teamplay, 0);
2987 else if (teamplay.integer < 0)
2988 Cvar_SetValueQuick (&teamplay, count);
2992 Cvar_SetValueQuick (&skill, skill.integer + dir);
2993 if (skill.integer > 3)
2994 Cvar_SetValueQuick (&skill, 0);
2995 if (skill.integer < 0)
2996 Cvar_SetValueQuick (&skill, 3);
3000 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
3001 if (fraglimit.integer > 100)
3002 Cvar_SetValueQuick (&fraglimit, 0);
3003 if (fraglimit.integer < 0)
3004 Cvar_SetValueQuick (&fraglimit, 100);
3008 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
3009 if (timelimit.value > 60)
3010 Cvar_SetValueQuick (&timelimit, 0);
3011 if (timelimit.value < 0)
3012 Cvar_SetValueQuick (&timelimit, 60);
3016 startepisode += dir;
3017 g = lookupgameinfo();
3019 if (startepisode < 0)
3020 startepisode = g->numepisodes - 1;
3022 if (startepisode >= g->numepisodes)
3030 g = lookupgameinfo();
3033 startlevel = g->episodes[startepisode].levels - 1;
3035 if (startlevel >= g->episodes[startepisode].levels)
3041 void M_GameOptions_Key (int key)
3052 S_LocalSound ("misc/menu1.wav");
3053 gameoptions_cursor--;
3054 if (gameoptions_cursor < 0)
3055 gameoptions_cursor = NUM_GAMEOPTIONS-1;
3059 S_LocalSound ("misc/menu1.wav");
3060 gameoptions_cursor++;
3061 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
3062 gameoptions_cursor = 0;
3066 if (gameoptions_cursor == 0)
3068 S_LocalSound ("misc/menu3.wav");
3069 M_NetStart_Change (-1);
3073 if (gameoptions_cursor == 0)
3075 S_LocalSound ("misc/menu3.wav");
3076 M_NetStart_Change (1);
3080 S_LocalSound ("misc/menu2.wav");
3081 if (gameoptions_cursor == 0)
3084 Cbuf_AddText ("disconnect\n");
3085 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
3086 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
3088 g = lookupgameinfo();
3089 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
3093 M_NetStart_Change (1);
3098 //=============================================================================
3101 qboolean searchComplete = false;
3102 double searchCompleteTime;
3104 void M_Menu_Search_f (void)
3106 key_dest = key_menu;
3108 m_entersound = false;
3111 searchComplete = false;
3117 void M_Search_Draw (void)
3123 p = Draw_CachePic ("gfx/p_multi.lmp");
3124 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3125 x = (320/2) - ((12*8)/2) + 4;
3126 M_DrawTextBox (x-8, 32, 12, 1);
3127 M_Print (x, 40, "Searching...");
3135 if (! searchComplete)
3137 searchComplete = true;
3138 searchCompleteTime = realtime;
3143 M_Menu_ServerList_f ();
3147 if (gamemode == GAME_TRANSFUSION)
3148 string = "No Transfusion servers found";
3150 string = "No Quake servers found";
3151 M_PrintWhite ((320/2) - ((22*8)/2), 64, string);
3152 if ((realtime - searchCompleteTime) < 3.0)
3155 M_Menu_LanConfig_f ();
3159 void M_Search_Key (int key)
3163 //=============================================================================
3164 /* INTERNET SEARCH MENU */
3166 void M_Menu_InetSearch_f (void)
3168 key_dest = key_menu;
3170 m_entersound = false;
3173 searchComplete = false;
3179 void M_InetSearch_Draw (void)
3181 M_Search_Draw (); // it's the same one, so why bother?
3185 void M_InetSearch_Key (int key)
3189 //=============================================================================
3193 qboolean slist_sorted;
3195 void M_Menu_ServerList_f (void)
3197 key_dest = key_menu;
3199 m_entersound = true;
3201 m_return_onerror = false;
3202 m_return_reason[0] = 0;
3203 slist_sorted = false;
3207 void M_ServerList_Draw (void)
3215 if (hostCacheCount > 1)
3219 for (i = 0; i < hostCacheCount; i++)
3220 for (j = i+1; j < hostCacheCount; j++)
3221 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
3223 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
3224 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
3225 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
3228 slist_sorted = true;
3231 p = Draw_CachePic ("gfx/p_multi.lmp");
3232 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
3233 for (n = 0; n < hostCacheCount; n++)
3235 if (hostcache[n].maxusers)
3236 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
3238 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
3239 M_Print (16, 32 + 8*n, string);
3241 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
3243 if (*m_return_reason)
3244 M_PrintWhite (16, 168, m_return_reason);
3248 void M_ServerList_Key (int k)
3253 M_Menu_LanConfig_f ();
3262 S_LocalSound ("misc/menu1.wav");
3264 if (slist_cursor < 0)
3265 slist_cursor = hostCacheCount - 1;
3270 S_LocalSound ("misc/menu1.wav");
3272 if (slist_cursor >= hostCacheCount)
3277 S_LocalSound ("misc/menu2.wav");
3278 m_return_state = m_state;
3279 m_return_onerror = true;
3280 slist_sorted = false;
3281 key_dest = key_game;
3283 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
3292 //=============================================================================
3293 /* Menu Subsystem */
3298 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
3300 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
3301 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
3302 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
3303 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
3304 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
3305 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
3306 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
3307 Cmd_AddCommand ("menu_options_effects", M_Menu_Options_Effects_f);
3308 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
3309 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
3310 Cmd_AddCommand ("help", M_Menu_Help_f);
3311 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
3313 if (gamemode == GAME_TRANSFUSION)
3315 numcommands = sizeof(transfusionbindnames) / sizeof(transfusionbindnames[0]);
3316 bindnames = transfusionbindnames;
3320 numcommands = sizeof(quakebindnames) / sizeof(quakebindnames[0]);
3321 bindnames = quakebindnames;
3324 if (gamemode == GAME_NEHAHRA)
3326 if (COM_FileExists("maps/neh1m4.bsp"))
3328 if (COM_FileExists("hearing.dem"))
3330 Con_Printf("Nehahra movie and game detected.\n");
3331 NehGameType = TYPE_BOTH;
3335 Con_Printf("Nehahra game detected.\n");
3336 NehGameType = TYPE_GAME;
3341 if (COM_FileExists("hearing.dem"))
3343 Con_Printf("Nehahra movie detected.\n");
3344 NehGameType = TYPE_DEMO;
3348 Con_Printf("Nehahra not found.\n");
3349 NehGameType = TYPE_GAME; // could just complain, but...
3357 if (m_state == m_none || key_dest != key_menu)
3375 case m_singleplayer:
3376 M_SinglePlayer_Draw ();
3388 M_MultiPlayer_Draw ();
3403 case m_options_effects:
3404 M_Options_Effects_Draw ();
3424 M_LanConfig_Draw ();
3428 M_GameOptions_Draw ();
3436 M_ServerList_Draw ();
3442 S_LocalSound ("misc/menu2.wav");
3443 m_entersound = false;
3450 void M_Keydown (int key)
3465 case m_singleplayer:
3466 M_SinglePlayer_Key (key);
3478 M_MultiPlayer_Key (key);
3490 M_Options_Key (key);
3493 case m_options_effects:
3494 M_Options_Effects_Key (key);
3514 M_LanConfig_Key (key);
3518 M_GameOptions_Key (key);
3526 M_ServerList_Key (key);
3532 void M_ConfigureNetSubsystem(void)
3534 // enable/disable net systems to match desired config
3536 Cbuf_AddText ("stopdemo\n");
3538 if (IPXConfig || TCPIPConfig)
3539 net_hostport = lanConfig_port;