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.
26 void (*vid_menudrawfn)(void);
27 void (*vid_menukeyfn)(int key);
35 enum m_state_e m_state;
37 void M_Menu_Main_f (void);
38 void M_Menu_SinglePlayer_f (void);
39 void M_Menu_Load_f (void);
40 void M_Menu_Save_f (void);
41 void M_Menu_MultiPlayer_f (void);
42 void M_Menu_Setup_f (void);
43 void M_Menu_Net_f (void);
44 void M_Menu_Options_f (void);
45 void M_Menu_Keys_f (void);
46 void M_Menu_Video_f (void);
47 void M_Menu_Help_f (void);
48 void M_Menu_Quit_f (void);
49 void M_Menu_LanConfig_f (void);
50 void M_Menu_GameOptions_f (void);
51 void M_Menu_Search_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_Net_Draw (void);
61 void M_Options_Draw (void);
62 void M_Keys_Draw (void);
63 void M_Video_Draw (void);
64 void M_Help_Draw (void);
65 void M_Quit_Draw (void);
66 void M_LanConfig_Draw (void);
67 void M_GameOptions_Draw (void);
68 void M_Search_Draw (void);
69 void M_ServerList_Draw (void);
71 void M_Main_Key (int key);
72 void M_SinglePlayer_Key (int key);
73 void M_Load_Key (int key);
74 void M_Save_Key (int key);
75 void M_MultiPlayer_Key (int key);
76 void M_Setup_Key (int key);
77 void M_Net_Key (int key);
78 void M_Options_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_ServerList_Key (int key);
88 qboolean m_entersound; // play after drawing a frame, so caching
89 // won't disrupt the sound
92 qboolean m_return_onerror;
93 char m_return_reason [32];
95 #define StartingGame (m_multiplayer_cursor == 1)
96 #define JoiningGame (m_multiplayer_cursor == 0)
97 #define IPXConfig (m_net_cursor == 0)
98 #define TCPIPConfig (m_net_cursor == 1)
100 void M_ConfigureNetSubsystem(void);
103 #define NumberOfNehahraDemos 34
108 } nehahrademonames_t;
110 nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
112 {"intro", "Prologue"},
113 {"genf", "The Beginning"},
114 {"genlab", "A Doomed Project"},
115 {"nehcre", "The New Recruits"},
116 {"maxneh", "Breakthrough"},
117 {"maxchar", "Renewal and Duty"},
118 {"crisis", "Worlds Collide"},
119 {"postcris", "Darkening Skies"},
120 {"hearing", "The Hearing"},
121 {"getjack", "On a Mexican Radio"},
122 {"prelude", "Honor and Justice"},
123 {"abase", "A Message Sent"},
124 {"effect", "The Other Side"},
125 {"uhoh", "Missing in Action"},
126 {"prepare", "The Response"},
127 {"vision", "Farsighted Eyes"},
128 {"maxturns", "Enter the Immortal"},
129 {"backlot", "Separate Ways"},
130 {"maxside", "The Ancient Runes"},
131 {"counter", "The New Initiative"},
132 {"warprep", "Ghosts to the World"},
133 {"counter1", "A Fate Worse Than Death"},
134 {"counter2", "Friendly Fire"},
135 {"counter3", "Minor Setback"},
136 {"madmax", "Scores to Settle"},
137 {"quake", "One Man"},
138 {"cthmm", "Shattered Masks"},
139 {"shades", "Deal with the Dead"},
140 {"gophil", "An Unlikely Hero"},
141 {"cstrike", "War in Hell"},
142 {"shubset", "The Conspiracy"},
143 {"shubdie", "Even Death May Die"},
144 {"newranks", "An Empty Throne"},
145 {"seal", "The Seal is Broken"}
148 float menu_x, menu_y, menu_width, menu_height;
150 void M_DrawBackground(void)
154 menu_x = (vid.conwidth - menu_width) * 0.5;
155 menu_y = (vid.conheight - menu_height) * 0.5;
156 DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
163 Draws one solid graphics character
166 void M_DrawCharacter (float cx, float cy, int num)
171 DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
174 void M_Print (float cx, float cy, char *str)
176 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
179 void M_PrintWhite (float cx, float cy, char *str)
181 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
184 void M_ItemPrint (float cx, float cy, char *str, int unghosted)
187 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
189 DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
192 void M_DrawPic (float cx, float cy, char *picname)
194 DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
197 qbyte identityTable[256];
198 qbyte translationTable[256];
200 void M_BuildTranslationTable(int top, int bottom)
203 qbyte *dest, *source;
205 for (j = 0; j < 256; j++)
206 identityTable[j] = j;
207 dest = translationTable;
208 source = identityTable;
209 memcpy (dest, source, 256);
211 // LordHavoc: corrected skin color ranges
212 if (top < 128 || (top >= 224 && top < 240)) // the artists made some backwards ranges. sigh.
213 memcpy (dest + TOP_RANGE, source + top, 16);
215 for (j=0 ; j<16 ; j++)
216 dest[TOP_RANGE+j] = source[top+15-j];
218 // LordHavoc: corrected skin color ranges
219 if (bottom < 128 || (bottom >= 224 && bottom < 240))
220 memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
222 for (j=0 ; j<16 ; j++)
223 dest[BOTTOM_RANGE+j] = source[bottom+15-j];
227 void M_DrawTextBox (float x, float y, float width, float height)
235 M_DrawPic (cx, cy, "gfx/box_tl.lmp");
236 for (n = 0; n < height; n++)
239 M_DrawPic (cx, cy, "gfx/box_ml.lmp");
241 M_DrawPic (cx, cy+8, "gfx/box_bl.lmp");
248 M_DrawPic (cx, cy, "gfx/box_tm.lmp");
249 for (n = 0; n < height; n++)
253 M_DrawPic (cx, cy, "gfx/box_mm2.lmp");
255 M_DrawPic (cx, cy, "gfx/box_mm.lmp");
257 M_DrawPic (cx, cy+8, "gfx/box_bm.lmp");
264 M_DrawPic (cx, cy, "gfx/box_tr.lmp");
265 for (n = 0; n < height; n++)
268 M_DrawPic (cx, cy, "gfx/box_mr.lmp");
270 M_DrawPic (cx, cy+8, "gfx/box_br.lmp");
273 //=============================================================================
282 void M_ToggleMenu_f (void)
286 if (key_dest == key_menu)
288 if (m_state != m_main)
297 if (key_dest == key_console)
299 Con_ToggleConsole_f ();
309 void M_Demo_Draw (void)
313 for (i=0; i < NumberOfNehahraDemos; i++)
314 M_Print (16, 16 + 8*i, NehahraDemos[i].desc);
317 M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
321 void M_Menu_Demos_f (void)
328 void M_Demo_Key (int k)
337 S_LocalSound ("misc/menu2.wav");
340 Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
345 S_LocalSound ("misc/menu1.wav");
348 demo_cursor = NumberOfNehahraDemos;
353 S_LocalSound ("misc/menu1.wav");
355 if (demo_cursor > NumberOfNehahraDemos)
361 //=============================================================================
366 int MAIN_ITEMS = 4; // Nehahra: Menu Disable
368 void M_Menu_Main_f (void)
370 if (gamemode == GAME_NEHAHRA)
372 if (NehGameType == TYPE_DEMO)
374 else if (NehGameType == TYPE_GAME)
382 if (key_dest != key_menu)
384 m_save_demonum = cls.demonum;
393 void M_Main_Draw (void)
398 M_DrawPic (16, 4, "gfx/qplaque.lmp");
399 p = Draw_CachePic ("gfx/ttl_main.lmp");
400 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
402 if (gamemode == GAME_NEHAHRA)
404 if (NehGameType == TYPE_BOTH)
405 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
406 else if (NehGameType == TYPE_GAME)
407 M_DrawPic (72, 32, "gfx/gamemenu.lmp");
409 M_DrawPic (72, 32, "gfx/demomenu.lmp");
412 M_DrawPic (72, 32, "gfx/mainmenu.lmp");
414 f = (int)(realtime * 10)%6;
416 M_DrawPic (54, 32 + m_main_cursor * 20, va("gfx/menudot%i.lmp", f+1));
420 void M_Main_Key (int key)
427 cls.demonum = m_save_demonum;
428 if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
433 S_LocalSound ("misc/menu1.wav");
434 if (++m_main_cursor >= MAIN_ITEMS)
439 S_LocalSound ("misc/menu1.wav");
440 if (--m_main_cursor < 0)
441 m_main_cursor = MAIN_ITEMS - 1;
447 if (gamemode == GAME_NEHAHRA)
452 switch (m_main_cursor)
455 M_Menu_SinglePlayer_f ();
463 M_Menu_MultiPlayer_f ();
473 Cbuf_AddText ("disconnect\n");
474 Cbuf_AddText ("playdemo endcred\n");
483 switch (m_main_cursor)
486 M_Menu_SinglePlayer_f ();
490 M_Menu_MultiPlayer_f ();
500 Cbuf_AddText ("disconnect\n");
501 Cbuf_AddText ("playdemo endcred\n");
510 switch (m_main_cursor)
519 Cbuf_AddText ("disconnect\n");
520 Cbuf_AddText ("playdemo endcred\n");
536 switch (m_main_cursor)
539 M_Menu_SinglePlayer_f ();
543 M_Menu_MultiPlayer_f ();
562 //=============================================================================
563 /* SINGLE PLAYER MENU */
565 int m_singleplayer_cursor;
566 #define SINGLEPLAYER_ITEMS 3
569 void M_Menu_SinglePlayer_f (void)
572 m_state = m_singleplayer;
577 void M_SinglePlayer_Draw (void)
581 M_DrawPic (16, 4, "gfx/qplaque.lmp");
582 p = Draw_CachePic ("gfx/ttl_sgl.lmp");
584 // BloodBath doesn't have a single player mode
585 if (gamemode == GAME_BLOODBATH)
587 M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl.lmp");
589 M_DrawTextBox (60, 8 * 8, 23, 4);
590 M_PrintWhite (102, 10 * 8, "BloodBath is for");
591 M_PrintWhite (83, 11 * 8, "multiplayer play only");
597 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl.lmp");
598 M_DrawPic (72, 32, "gfx/sp_menu.lmp");
600 f = (int)(realtime * 10)%6;
602 M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
607 void M_SinglePlayer_Key (int key)
609 if (gamemode == GAME_BLOODBATH)
611 if (key == K_ESCAPE || key == K_ENTER)
623 S_LocalSound ("misc/menu1.wav");
624 if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
625 m_singleplayer_cursor = 0;
629 S_LocalSound ("misc/menu1.wav");
630 if (--m_singleplayer_cursor < 0)
631 m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
637 switch (m_singleplayer_cursor)
642 Cbuf_AddText ("disconnect\n");
643 Cbuf_AddText ("maxplayers 1\n");
644 Cbuf_AddText ("deathmatch 0\n");
645 Cbuf_AddText ("coop 0\n");
646 if (gamemode == GAME_NEHAHRA)
647 Cbuf_AddText ("map nehstart\n");
649 Cbuf_AddText ("map start\n");
663 //=============================================================================
666 int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
668 #define MAX_SAVEGAMES 12
669 char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
670 int loadable[MAX_SAVEGAMES];
672 void M_ScanSaves (void)
675 char name[MAX_OSPATH];
680 for (i=0 ; i<MAX_SAVEGAMES ; i++)
682 strcpy (m_filenames[i], "--- UNUSED SLOT ---");
684 sprintf (name, "%s/s%i.sav", com_gamedir, i);
685 f = Qopen (name, "rz");
689 sscanf (str, "%i\n", &version);
691 strncpy (m_filenames[i], str, sizeof(m_filenames[i])-1);
693 // change _ back to space
694 for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
695 if (m_filenames[i][j] == '_')
696 m_filenames[i][j] = ' ';
702 void M_Menu_Load_f (void)
711 void M_Menu_Save_f (void)
717 if (svs.maxclients != 1)
726 void M_Load_Draw (void)
731 p = Draw_CachePic ("gfx/p_load.lmp");
732 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
734 for (i=0 ; i< MAX_SAVEGAMES; i++)
735 M_Print (16, 32 + 8*i, m_filenames[i]);
738 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
742 void M_Save_Draw (void)
747 p = Draw_CachePic ("gfx/p_save.lmp");
748 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
750 for (i=0 ; i<MAX_SAVEGAMES ; i++)
751 M_Print (16, 32 + 8*i, m_filenames[i]);
754 M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
758 void M_Load_Key (int k)
763 M_Menu_SinglePlayer_f ();
767 S_LocalSound ("misc/menu2.wav");
768 if (!loadable[load_cursor])
773 // issue the load command
774 Cbuf_AddText (va ("load s%i\n", load_cursor) );
779 S_LocalSound ("misc/menu1.wav");
782 load_cursor = MAX_SAVEGAMES-1;
787 S_LocalSound ("misc/menu1.wav");
789 if (load_cursor >= MAX_SAVEGAMES)
796 void M_Save_Key (int k)
801 M_Menu_SinglePlayer_f ();
807 Cbuf_AddText (va("save s%i\n", load_cursor));
812 S_LocalSound ("misc/menu1.wav");
815 load_cursor = MAX_SAVEGAMES-1;
820 S_LocalSound ("misc/menu1.wav");
822 if (load_cursor >= MAX_SAVEGAMES)
828 //=============================================================================
829 /* MULTIPLAYER MENU */
831 int m_multiplayer_cursor;
832 #define MULTIPLAYER_ITEMS 3
835 void M_Menu_MultiPlayer_f (void)
838 m_state = m_multiplayer;
843 void M_MultiPlayer_Draw (void)
848 M_DrawPic (16, 4, "gfx/qplaque.lmp");
849 p = Draw_CachePic ("gfx/p_multi.lmp");
850 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
851 M_DrawPic (72, 32, "gfx/mp_menu.lmp");
853 f = (int)(realtime * 10)%6;
855 M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va("gfx/menudot%i.lmp", f+1));
857 if (ipxAvailable || tcpipAvailable)
859 M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
863 void M_MultiPlayer_Key (int key)
872 S_LocalSound ("misc/menu1.wav");
873 if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
874 m_multiplayer_cursor = 0;
878 S_LocalSound ("misc/menu1.wav");
879 if (--m_multiplayer_cursor < 0)
880 m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
885 switch (m_multiplayer_cursor)
888 if (ipxAvailable || tcpipAvailable)
893 if (ipxAvailable || tcpipAvailable)
904 //=============================================================================
907 int setup_cursor = 4;
908 int setup_cursor_table[] = {40, 56, 80, 104, 140};
910 char setup_hostname[16];
911 char setup_myname[16];
917 #define NUM_SETUP_CMDS 5
919 void M_Menu_Setup_f (void)
924 strcpy(setup_myname, cl_name.string);
925 strcpy(setup_hostname, hostname.string);
926 setup_top = setup_oldtop = cl_color.integer >> 4;
927 setup_bottom = setup_oldbottom = cl_color.integer & 15;
930 // LordHavoc: rewrote this code greatly
931 void M_MenuPlayerTranslate (qbyte *translation)
934 unsigned int trans[4096];
937 p = W_GetLumpName ("gfx/menuplyr.lmp");
940 c = p->width * p->height;
943 Con_Printf("M_MenuPlayerTranslate: image larger than 4096 pixel buffer\n");
947 for (i = 0;i < c;i++)
948 trans[i] = d_8to24table[translation[((qbyte *)p->data)[i]]];
950 Draw_NewPic("gfx/menuplyr.lmp", p->width, p->height, true, (qbyte *)trans);
953 void M_Setup_Draw (void)
957 M_DrawPic (16, 4, "gfx/qplaque.lmp");
958 p = Draw_CachePic ("gfx/p_multi.lmp");
959 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
961 M_Print (64, 40, "Hostname");
962 M_DrawTextBox (160, 32, 16, 1);
963 M_Print (168, 40, setup_hostname);
965 M_Print (64, 56, "Your name");
966 M_DrawTextBox (160, 48, 16, 1);
967 M_Print (168, 56, setup_myname);
969 M_Print (64, 80, "Shirt color");
970 M_Print (64, 104, "Pants color");
972 M_DrawTextBox (64, 140-8, 14, 1);
973 M_Print (72, 140, "Accept Changes");
975 M_DrawPic (160, 64, "gfx/bigbox.lmp");
977 // LordHavoc: rewrote this code greatly
978 M_BuildTranslationTable (setup_top*16, setup_bottom*16);
979 M_MenuPlayerTranslate (translationTable);
980 M_DrawPic (172, 72, "gfx/menuplyr.lmp");
982 M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
984 if (setup_cursor == 0)
985 M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
987 if (setup_cursor == 1)
988 M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
992 void M_Setup_Key (int k)
999 M_Menu_MultiPlayer_f ();
1003 S_LocalSound ("misc/menu1.wav");
1005 if (setup_cursor < 0)
1006 setup_cursor = NUM_SETUP_CMDS-1;
1010 S_LocalSound ("misc/menu1.wav");
1012 if (setup_cursor >= NUM_SETUP_CMDS)
1017 if (setup_cursor < 2)
1019 S_LocalSound ("misc/menu3.wav");
1020 if (setup_cursor == 2)
1021 setup_top = setup_top - 1;
1022 if (setup_cursor == 3)
1023 setup_bottom = setup_bottom - 1;
1026 if (setup_cursor < 2)
1029 S_LocalSound ("misc/menu3.wav");
1030 if (setup_cursor == 2)
1031 setup_top = setup_top + 1;
1032 if (setup_cursor == 3)
1033 setup_bottom = setup_bottom + 1;
1037 if (setup_cursor == 0 || setup_cursor == 1)
1040 if (setup_cursor == 2 || setup_cursor == 3)
1043 // setup_cursor == 4 (OK)
1044 if (strcmp(cl_name.string, setup_myname) != 0)
1045 Cbuf_AddText ( va ("name \"%s\"\n", setup_myname) );
1046 if (strcmp(hostname.string, setup_hostname) != 0)
1047 Cvar_Set("hostname", setup_hostname);
1048 if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
1049 Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
1050 m_entersound = true;
1051 M_Menu_MultiPlayer_f ();
1055 if (setup_cursor == 0)
1057 if (strlen(setup_hostname))
1058 setup_hostname[strlen(setup_hostname)-1] = 0;
1061 if (setup_cursor == 1)
1063 if (strlen(setup_myname))
1064 setup_myname[strlen(setup_myname)-1] = 0;
1069 if (k < 32 || k > 127)
1071 if (setup_cursor == 0)
1073 l = strlen(setup_hostname);
1076 setup_hostname[l+1] = 0;
1077 setup_hostname[l] = k;
1080 if (setup_cursor == 1)
1082 l = strlen(setup_myname);
1085 setup_myname[l+1] = 0;
1086 setup_myname[l] = k;
1095 if (setup_bottom > 13)
1097 if (setup_bottom < 0)
1101 //=============================================================================
1106 int m_net_saveHeight;
1108 char *net_helpMessage [] =
1110 /* .........1.........2.... */
1111 " Novell network LANs ",
1112 " or Windows 95 DOS-box. ",
1114 "(LAN=Local Area Network)",
1116 " Commonly used to play ",
1117 " over the Internet, but ",
1118 " also used on a Local ",
1122 void M_Menu_Net_f (void)
1124 key_dest = key_menu;
1126 m_entersound = true;
1129 if (m_net_cursor >= m_net_items)
1132 M_Net_Key (K_DOWNARROW);
1136 void M_Net_Draw (void)
1141 M_DrawPic (16, 4, "gfx/qplaque.lmp");
1142 p = Draw_CachePic ("gfx/p_multi.lmp");
1143 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
1148 M_DrawPic (72, f, "gfx/netmen3.lmp");
1150 M_DrawPic (72, f, "gfx/dim_ipx.lmp");
1154 M_DrawPic (72, f, "gfx/netmen4.lmp");
1156 M_DrawPic (72, f, "gfx/dim_tcp.lmp");
1158 if (m_net_items == 5) // JDC, could just be removed
1161 M_DrawPic (72, f, "gfx/netmen5.lmp");
1165 M_DrawTextBox (f, 134, 24, 4);
1167 M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
1168 M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
1170 f = (int)(realtime * 10)%6;
1171 M_DrawPic (54, 32 + m_net_cursor * 20, va("gfx/menudot%i.lmp", f+1));
1175 void M_Net_Key (int k)
1181 M_Menu_MultiPlayer_f ();
1185 S_LocalSound ("misc/menu1.wav");
1186 if (++m_net_cursor >= m_net_items)
1191 S_LocalSound ("misc/menu1.wav");
1192 if (--m_net_cursor < 0)
1193 m_net_cursor = m_net_items - 1;
1197 m_entersound = true;
1199 switch (m_net_cursor)
1202 M_Menu_LanConfig_f ();
1206 M_Menu_LanConfig_f ();
1215 if (m_net_cursor == 0 && !ipxAvailable)
1217 if (m_net_cursor == 1 && !tcpipAvailable)
1221 //=============================================================================
1224 #define OPTIONS_ITEMS 27
1226 #define SLIDER_RANGE 10
1230 void M_Menu_Options_f (void)
1232 key_dest = key_menu;
1233 m_state = m_options;
1234 m_entersound = true;
1238 void M_AdjustSliders (int dir)
1240 S_LocalSound ("misc/menu3.wav");
1242 switch (options_cursor)
1245 Cvar_SetValueQuick (&scr_2dresolution, bound(0, scr_2dresolution.value + dir * 0.2, 1));
1248 Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120));
1251 Cvar_SetValueQuick (&r_skyquality, bound(0, r_skyquality.integer + dir, 2));
1254 Cvar_SetValueQuick (&r_ser, !r_ser.integer);
1257 Cvar_SetValueQuick (&v_overbrightbits, bound(0, v_overbrightbits.integer + dir, 4));
1260 Cvar_SetValueQuick (&gl_combine, !gl_combine.integer);
1263 Cvar_SetValueQuick (&gl_dither, !gl_dither.integer);
1266 Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer);
1269 Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.25, 5));
1272 Cvar_SetValueQuick (&v_contrast, bound(0.5, v_contrast.value + dir * 0.25, 5));
1275 Cvar_SetValueQuick (&v_brightness, bound(0, v_brightness.value + dir * 0.05, 0.8));
1277 case 15: // music volume
1279 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
1281 Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
1284 case 16: // sfx volume
1285 Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
1288 Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5));
1291 Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
1293 case 19: // show framerate
1294 Cvar_SetValueQuick (&showfps, !showfps.integer);
1296 case 20: // always run
1297 if (cl_forwardspeed.value > 200)
1299 Cvar_SetValueQuick (&cl_forwardspeed, 200);
1300 Cvar_SetValueQuick (&cl_backspeed, 200);
1304 Cvar_SetValueQuick (&cl_forwardspeed, 400);
1305 Cvar_SetValueQuick (&cl_backspeed, 400);
1308 case 21: // lookspring
1309 Cvar_SetValueQuick (&lookspring, !lookspring.integer);
1311 case 22: // lookstrafe
1312 Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
1314 case 23: // mouse speed
1315 Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
1317 case 24: // mouse look
1318 Cvar_SetValueQuick (&freelook, !freelook.integer);
1320 case 25: // invert mouse
1321 Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
1323 case 26: // windowed mouse
1324 Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
1330 void M_DrawSlider (int x, int y, float range)
1338 M_DrawCharacter (x-8, y, 128);
1339 for (i=0 ; i<SLIDER_RANGE ; i++)
1340 M_DrawCharacter (x + i*8, y, 129);
1341 M_DrawCharacter (x+i*8, y, 130);
1342 M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
1345 void M_DrawCheckbox (int x, int y, int on)
1348 M_Print (x, y, "on");
1350 M_Print (x, y, "off");
1354 void M_Options_Draw (void)
1359 M_DrawPic(16, 4, "gfx/qplaque.lmp");
1360 p = Draw_CachePic("gfx/p_option.lmp");
1361 M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
1364 M_Print(16, y, " Customize controls");y += 8;
1365 M_Print(16, y, " Go to console");y += 8;
1366 M_Print(16, y, " Reset to defaults");y += 8;
1367 M_ItemPrint(16, y, " Video Options", vid_menudrawfn != NULL);y += 8;
1368 M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8;
1369 M_Print(16, y, " Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8;
1370 M_Print(16, y, " Sky Quality");M_DrawSlider(220, y, r_skyquality.value / 2);y += 8;
1371 M_Print(16, y, "Hidden Surface Removal");M_DrawCheckbox(220, y, r_ser.integer);y += 8;
1372 M_Print(16, y, " Overbright Bits");M_DrawSlider(220, y, (v_overbrightbits.value) / 4);y += 8;
1373 M_Print(16, y, " Texture Combine");M_DrawCheckbox(220, y, gl_combine.integer);y += 8;
1374 M_Print(16, y, " Dithering");M_DrawCheckbox(220, y, gl_dither.integer);y += 8;
1375 M_ItemPrint(16, y, "Hardware Gamma Control", hardwaregammasupported);M_DrawCheckbox(220, y, v_hwgamma.integer);y += 8;
1376 M_ItemPrint(16, y, " Gamma", v_hwgamma.integer);M_DrawSlider(220, y, (v_gamma.value - 1) / 4);y += 8;
1377 M_Print(16, y, " Contrast");M_DrawSlider(220, y, (v_contrast.value - 0.5) / (5 - 0.5));y += 8;
1378 M_Print(16, y, " Brightness");M_DrawSlider(220, y, v_brightness.value / 0.8);y += 8;
1379 M_ItemPrint(16, y, " CD Music Volume", cdaudioinitialized);M_DrawSlider(220, y, bgmvolume.value);y += 8;
1380 M_ItemPrint(16, y, " Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value);y += 8;
1381 M_Print(16, y, " Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
1382 M_Print(16, y, " Crosshair Size");M_DrawSlider(220, y, (crosshair_size.value - 1) / 4);y += 8;
1383 M_Print(16, y, " Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
1384 M_Print(16, y, " Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
1385 M_Print(16, y, " Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
1386 M_Print(16, y, " Lookstrafe");M_DrawCheckbox(220, y, lookstrafe.integer);y += 8;
1387 M_Print(16, y, " Mouse Speed");M_DrawSlider(220, y, (sensitivity.value - 1)/50);y += 8;
1388 M_Print(16, y, " Mouse Look");M_DrawCheckbox(220, y, freelook.integer);y += 8;
1389 M_Print(16, y, " Invert Mouse");M_DrawCheckbox(220, y, m_pitch.value < 0);y += 8;
1390 M_Print(16, y, " Use Mouse");M_DrawCheckbox(220, y, vid_mouse.integer);y += 8;
1393 M_DrawCharacter(200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
1397 void M_Options_Key (int k)
1406 m_entersound = true;
1407 switch (options_cursor)
1414 Con_ToggleConsole_f ();
1417 Cbuf_AddText ("exec default.cfg\n");
1424 M_AdjustSliders (1);
1430 S_LocalSound ("misc/menu1.wav");
1432 if (options_cursor < 0)
1433 options_cursor = OPTIONS_ITEMS-1;
1437 S_LocalSound ("misc/menu1.wav");
1439 if (options_cursor >= OPTIONS_ITEMS)
1444 M_AdjustSliders (-1);
1448 M_AdjustSliders (1);
1453 //=============================================================================
1456 char *bindnames[][2] =
1459 {"+forward", "walk forward"},
1460 {"+back", "backpedal"},
1461 {"+moveleft", "step left"},
1462 {"+moveright", "step right"},
1463 {"+jump", "jump / swim up"},
1464 {"+movedown", "swim down"},
1465 {"+attack", "attack"},
1466 {"+button3", "altfire"},
1467 {"impulse 1", "Pitch Fork"},
1468 {"impulse 2", "Flare Gun"},
1469 {"impulse 3", "Shotgun"},
1470 {"impulse 4", "Machine Gun"},
1471 {"impulse 5", "Incinerator"},
1472 {"impulse 6", "Bombs"},
1473 {"impulse 7", "Aerosol Can"},
1474 {"impulse 8", "Tesla Cannon"},
1475 {"impulse 9", "Life Leech"},
1476 {"impulse 17", "Voodoo Doll"},
1477 {"impulse 11", "previous weapon"},
1478 {"impulse 10", "next weapon"},
1479 {"impulse 14", "previous item"},
1480 {"impulse 15", "next item"},
1481 {"impulse 13", "use item"},
1482 {"impulse 100", "add bot (red)"},
1483 {"impulse 101", "add bot (blue)"},
1484 {"impulse 102", "kick a bot"},
1485 {"impulse 50", "voting menu"},
1486 {"impulse 141", "identify player"},
1487 {"impulse 16", "next armor type"},
1488 {"impulse 20", "observer mode"}
1489 #else // not BLOODBATH
1490 {"+attack", "attack"},
1491 {"impulse 10", "next weapon"},
1492 {"impulse 12", "previous weapon"},
1493 {"+jump", "jump / swim up"},
1494 {"+forward", "walk forward"},
1495 {"+back", "backpedal"},
1496 {"+left", "turn left"},
1497 {"+right", "turn right"},
1499 {"+moveleft", "step left"},
1500 {"+moveright", "step right"},
1501 {"+strafe", "sidestep"},
1502 {"+lookup", "look up"},
1503 {"+lookdown", "look down"},
1504 {"centerview", "center view"},
1505 {"+mlook", "mouse look"},
1506 {"+klook", "keyboard look"},
1507 {"+moveup", "swim up"},
1508 {"+movedown", "swim down"}
1509 #endif // not BLOODBATH
1512 #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
1515 typedef struct binditem_s
1517 char *command, *description;
1518 struct binditem_s *next;
1522 typedef struct bindcategory_s
1526 struct bindcategory_s *next;
1530 bindcategory_t *bindcategories = NULL;
1532 void M_ClearBinds (void)
1534 for (c = bindcategories;c;c = cnext)
1537 for (b = c->binds;b;b = bnext)
1544 bindcategories = NULL;
1547 void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
1549 for (b = &c->binds;*b;*b = &(*b)->next);
1550 *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
1551 *b->command = (char *)((*b) + 1);
1552 *b->description = *b->command + strlen(command) + 1;
1553 strcpy(*b->command, command);
1554 strcpy(*b->description, description);
1557 void M_AddBind (char *category, char *command, char *description)
1559 for (c = &bindcategories;*c;c = &(*c)->next)
1561 if (!strcmp(category, (*c)->name))
1563 M_AddBindToCategory(*c, command, description);
1567 *c = Z_Alloc(sizeof(bindcategory_t));
1568 M_AddBindToCategory(*c, command, description);
1571 void M_DefaultBinds (void)
1574 M_AddBind("movement", "+jump", "jump / swim up");
1575 M_AddBind("movement", "+forward", "walk forward");
1576 M_AddBind("movement", "+back", "backpedal");
1577 M_AddBind("movement", "+left", "turn left");
1578 M_AddBind("movement", "+right", "turn right");
1579 M_AddBind("movement", "+speed", "run");
1580 M_AddBind("movement", "+moveleft", "step left");
1581 M_AddBind("movement", "+moveright", "step right");
1582 M_AddBind("movement", "+strafe", "sidestep");
1583 M_AddBind("movement", "+lookup", "look up");
1584 M_AddBind("movement", "+lookdown", "look down");
1585 M_AddBind("movement", "centerview", "center view");
1586 M_AddBind("movement", "+mlook", "mouse look");
1587 M_AddBind("movement", "+klook", "keyboard look");
1588 M_AddBind("movement", "+moveup", "swim up");
1589 M_AddBind("movement", "+movedown", "swim down");
1590 M_AddBind("weapons", "+attack", "attack");
1591 M_AddBind("weapons", "impulse 10", "next weapon");
1592 M_AddBind("weapons", "impulse 12", "previous weapon");
1593 M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
1594 M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
1595 M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
1596 M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
1597 M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
1598 M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
1599 M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
1600 M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
1608 void M_Menu_Keys_f (void)
1610 key_dest = key_menu;
1612 m_entersound = true;
1617 void M_FindKeysForCommand (char *command, int *keys)
1623 for (j = 0;j < NUMKEYS;j++)
1628 for (j=0 ; j<256 ; j++)
1633 if (!strcmp (b, command) )
1636 if (count == NUMKEYS)
1642 void M_UnbindCommand (char *command)
1647 for (j=0 ; j<256 ; j++)
1652 if (!strcmp (b, command))
1653 Key_SetBinding (j, "");
1658 void M_Keys_Draw (void)
1664 char keystring[1024];
1666 p = Draw_CachePic ("gfx/ttl_cstm.lmp");
1667 M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
1670 M_Print (12, 32, "Press a key or button for this action");
1672 M_Print (18, 32, "Enter to change, backspace to clear");
1674 // search for known bindings
1675 for (i=0 ; i<NUMCOMMANDS ; i++)
1679 M_Print (16, y, bindnames[i][1]);
1681 M_FindKeysForCommand (bindnames[i][0], keys);
1683 // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
1685 strcpy(keystring, "???");
1689 for (j = 0;j < NUMKEYS;j++)
1694 strcat(keystring, " or ");
1695 strcat(keystring, Key_KeynumToString (keys[j]));
1699 M_Print (150, y, keystring);
1703 M_DrawCharacter (140, 48 + keys_cursor*8, '=');
1705 M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
1709 void M_Keys_Key (int k)
1716 S_LocalSound ("misc/menu1.wav");
1721 else //if (k != '`')
1723 sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
1724 Cbuf_InsertText (cmd);
1734 M_Menu_Options_f ();
1739 S_LocalSound ("misc/menu1.wav");
1741 if (keys_cursor < 0)
1742 keys_cursor = NUMCOMMANDS-1;
1747 S_LocalSound ("misc/menu1.wav");
1749 if (keys_cursor >= NUMCOMMANDS)
1753 case K_ENTER: // go into bind mode
1754 M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
1755 S_LocalSound ("misc/menu2.wav");
1756 if (keys[NUMKEYS - 1] != -1)
1757 M_UnbindCommand (bindnames[keys_cursor][0]);
1761 case K_BACKSPACE: // delete bindings
1762 case K_DEL: // delete bindings
1763 S_LocalSound ("misc/menu2.wav");
1764 M_UnbindCommand (bindnames[keys_cursor][0]);
1769 //=============================================================================
1772 void M_Menu_Video_f (void)
1774 key_dest = key_menu;
1776 m_entersound = true;
1780 void M_Video_Draw (void)
1782 (*vid_menudrawfn) ();
1786 void M_Video_Key (int key)
1788 (*vid_menukeyfn) (key);
1791 //=============================================================================
1795 #define NUM_HELP_PAGES 6
1798 void M_Menu_Help_f (void)
1800 key_dest = key_menu;
1802 m_entersound = true;
1808 void M_Help_Draw (void)
1810 M_DrawPic (0, 0, va("gfx/help%i.lmp", help_page));
1814 void M_Help_Key (int key)
1824 m_entersound = true;
1825 if (++help_page >= NUM_HELP_PAGES)
1831 m_entersound = true;
1832 if (--help_page < 0)
1833 help_page = NUM_HELP_PAGES-1;
1839 //=============================================================================
1843 int m_quit_prevstate;
1844 qboolean wasInMenus;
1846 char *quitMessage [] =
1848 /* .........1.........2.... */
1850 " Are you gonna quit ",
1851 " this game just like ",
1852 " everything else? ",
1855 " Milord, methinks that ",
1856 " thou art a lowly ",
1857 " quitter. Is this true? ",
1860 " Do I need to bust your ",
1861 " face open for trying ",
1865 " Man, I oughta smack you",
1866 " for trying to quit! ",
1870 " Press Y to quit like a ",
1871 " big loser in life. ",
1872 " Press N to stay proud ",
1873 " and successful! ",
1875 " If you press Y to ",
1876 " quit, I will summon ",
1877 " Satan all over your ",
1880 " Um, Asmodeus dislikes ",
1881 " his children trying to ",
1882 " quit. Press Y to return",
1883 " to your Tinkertoys. ",
1885 " If you quit now, I'll ",
1886 " throw a blanket-party ",
1887 " for you next time! ",
1891 /* .........1.........2.... */
1893 " Tired of fragging ",
1898 " Quit now and forfeit ",
1899 " your bodycount? ",
1903 " Are you sure you ",
1908 " Off to do something ",
1913 void M_Menu_Quit_f (void)
1915 if (m_state == m_quit)
1917 wasInMenus = (key_dest == key_menu);
1918 key_dest = key_menu;
1919 m_quit_prevstate = m_state;
1921 m_entersound = true;
1922 msgNumber = rand()&3; //&7;
1926 void M_Quit_Key (int key)
1935 m_state = m_quit_prevstate;
1936 m_entersound = true;
1940 key_dest = key_game;
1947 key_dest = key_console;
1958 void M_Quit_Draw (void)
1960 M_DrawTextBox (56, 76, 24, 4);
1961 M_Print (64, 84, quitMessage[msgNumber*4+0]);
1962 M_Print (64, 92, quitMessage[msgNumber*4+1]);
1963 M_Print (64, 100, quitMessage[msgNumber*4+2]);
1964 M_Print (64, 108, quitMessage[msgNumber*4+3]);
1967 //=============================================================================
1968 /* LAN CONFIG MENU */
1970 int lanConfig_cursor = -1;
1971 int lanConfig_cursor_table [] = {72, 92, 124};
1972 #define NUM_LANCONFIG_CMDS 3
1975 char lanConfig_portname[6];
1976 char lanConfig_joinname[22];
1978 void M_Menu_LanConfig_f (void)
1980 key_dest = key_menu;
1981 m_state = m_lanconfig;
1982 m_entersound = true;
1983 if (lanConfig_cursor == -1)
1985 if (JoiningGame && TCPIPConfig)
1986 lanConfig_cursor = 2;
1988 lanConfig_cursor = 1;
1990 if (StartingGame && lanConfig_cursor == 2)
1991 lanConfig_cursor = 1;
1992 lanConfig_port = DEFAULTnet_hostport;
1993 sprintf(lanConfig_portname, "%u", lanConfig_port);
1995 m_return_onerror = false;
1996 m_return_reason[0] = 0;
2000 void M_LanConfig_Draw (void)
2007 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2008 p = Draw_CachePic ("gfx/p_multi.lmp");
2009 basex = (320-p->width)/2;
2010 M_DrawPic (basex, 4, "gfx/p_multi.lmp");
2013 startJoin = "New Game";
2015 startJoin = "Join Game";
2019 protocol = "TCP/IP";
2020 M_Print (basex, 32, va ("%s - %s", startJoin, protocol));
2023 M_Print (basex, 52, "Address:");
2025 M_Print (basex+9*8, 52, my_ipx_address);
2027 M_Print (basex+9*8, 52, my_tcpip_address);
2029 M_Print (basex, lanConfig_cursor_table[0], "Port");
2030 M_DrawTextBox (basex+8*8, lanConfig_cursor_table[0]-8, 6, 1);
2031 M_Print (basex+9*8, lanConfig_cursor_table[0], lanConfig_portname);
2035 M_Print (basex, lanConfig_cursor_table[1], "Search for local games...");
2036 M_Print (basex, 108, "Join game at:");
2037 M_DrawTextBox (basex+8, lanConfig_cursor_table[2]-8, 22, 1);
2038 M_Print (basex+16, lanConfig_cursor_table[2], lanConfig_joinname);
2042 M_DrawTextBox (basex, lanConfig_cursor_table[1]-8, 2, 1);
2043 M_Print (basex+8, lanConfig_cursor_table[1], "OK");
2046 M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
2048 if (lanConfig_cursor == 0)
2049 M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
2051 if (lanConfig_cursor == 2)
2052 M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
2054 if (*m_return_reason)
2055 M_PrintWhite (basex, 148, m_return_reason);
2059 void M_LanConfig_Key (int key)
2070 S_LocalSound ("misc/menu1.wav");
2072 if (lanConfig_cursor < 0)
2073 lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
2077 S_LocalSound ("misc/menu1.wav");
2079 if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
2080 lanConfig_cursor = 0;
2084 if (lanConfig_cursor == 0)
2087 m_entersound = true;
2089 M_ConfigureNetSubsystem ();
2091 if (lanConfig_cursor == 1)
2095 M_Menu_GameOptions_f ();
2102 if (lanConfig_cursor == 2)
2104 m_return_state = m_state;
2105 m_return_onerror = true;
2106 key_dest = key_game;
2108 Cbuf_AddText ( va ("connect \"%s\"\n", lanConfig_joinname) );
2115 if (lanConfig_cursor == 0)
2117 if (strlen(lanConfig_portname))
2118 lanConfig_portname[strlen(lanConfig_portname)-1] = 0;
2121 if (lanConfig_cursor == 2)
2123 if (strlen(lanConfig_joinname))
2124 lanConfig_joinname[strlen(lanConfig_joinname)-1] = 0;
2129 if (key < 32 || key > 127)
2132 if (lanConfig_cursor == 2)
2134 l = strlen(lanConfig_joinname);
2137 lanConfig_joinname[l+1] = 0;
2138 lanConfig_joinname[l] = key;
2142 if (key < '0' || key > '9')
2144 if (lanConfig_cursor == 0)
2146 l = strlen(lanConfig_portname);
2149 lanConfig_portname[l+1] = 0;
2150 lanConfig_portname[l] = key;
2155 if (StartingGame && lanConfig_cursor == 2)
2157 if (key == K_UPARROW)
2158 lanConfig_cursor = 1;
2160 lanConfig_cursor = 0;
2163 l = atoi(lanConfig_portname);
2168 sprintf(lanConfig_portname, "%u", lanConfig_port);
2171 //=============================================================================
2172 /* GAME OPTIONS MENU */
2191 episode_t *episodes;
2196 level_t quakelevels[] =
2198 {"start", "Entrance"}, // 0
2200 {"e1m1", "Slipgate Complex"}, // 1
2201 {"e1m2", "Castle of the Damned"},
2202 {"e1m3", "The Necropolis"},
2203 {"e1m4", "The Grisly Grotto"},
2204 {"e1m5", "Gloom Keep"},
2205 {"e1m6", "The Door To Chthon"},
2206 {"e1m7", "The House of Chthon"},
2207 {"e1m8", "Ziggurat Vertigo"},
2209 {"e2m1", "The Installation"}, // 9
2210 {"e2m2", "Ogre Citadel"},
2211 {"e2m3", "Crypt of Decay"},
2212 {"e2m4", "The Ebon Fortress"},
2213 {"e2m5", "The Wizard's Manse"},
2214 {"e2m6", "The Dismal Oubliette"},
2215 {"e2m7", "Underearth"},
2217 {"e3m1", "Termination Central"}, // 16
2218 {"e3m2", "The Vaults of Zin"},
2219 {"e3m3", "The Tomb of Terror"},
2220 {"e3m4", "Satan's Dark Delight"},
2221 {"e3m5", "Wind Tunnels"},
2222 {"e3m6", "Chambers of Torment"},
2223 {"e3m7", "The Haunted Halls"},
2225 {"e4m1", "The Sewage System"}, // 23
2226 {"e4m2", "The Tower of Despair"},
2227 {"e4m3", "The Elder God Shrine"},
2228 {"e4m4", "The Palace of Hate"},
2229 {"e4m5", "Hell's Atrium"},
2230 {"e4m6", "The Pain Maze"},
2231 {"e4m7", "Azure Agony"},
2232 {"e4m8", "The Nameless City"},
2234 {"end", "Shub-Niggurath's Pit"}, // 31
2236 {"dm1", "Place of Two Deaths"}, // 32
2237 {"dm2", "Claustrophobopolis"},
2238 {"dm3", "The Abandoned Base"},
2239 {"dm4", "The Bad Place"},
2240 {"dm5", "The Cistern"},
2241 {"dm6", "The Dark Zone"}
2244 episode_t quakeepisodes[] =
2246 {"Welcome to Quake", 0, 1},
2247 {"Doomed Dimension", 1, 8},
2248 {"Realm of Black Magic", 9, 7},
2249 {"Netherworld", 16, 7},
2250 {"The Elder World", 23, 8},
2251 {"Final Level", 31, 1},
2252 {"Deathmatch Arena", 32, 6}
2255 //MED 01/06/97 added hipnotic levels
2256 level_t hipnoticlevels[] =
2258 {"start", "Command HQ"}, // 0
2260 {"hip1m1", "The Pumping Station"}, // 1
2261 {"hip1m2", "Storage Facility"},
2262 {"hip1m3", "The Lost Mine"},
2263 {"hip1m4", "Research Facility"},
2264 {"hip1m5", "Military Complex"},
2266 {"hip2m1", "Ancient Realms"}, // 6
2267 {"hip2m2", "The Black Cathedral"},
2268 {"hip2m3", "The Catacombs"},
2269 {"hip2m4", "The Crypt"},
2270 {"hip2m5", "Mortum's Keep"},
2271 {"hip2m6", "The Gremlin's Domain"},
2273 {"hip3m1", "Tur Torment"}, // 12
2274 {"hip3m2", "Pandemonium"},
2275 {"hip3m3", "Limbo"},
2276 {"hip3m4", "The Gauntlet"},
2278 {"hipend", "Armagon's Lair"}, // 16
2280 {"hipdm1", "The Edge of Oblivion"} // 17
2283 //MED 01/06/97 added hipnotic episodes
2284 episode_t hipnoticepisodes[] =
2286 {"Scourge of Armagon", 0, 1},
2287 {"Fortress of the Dead", 1, 5},
2288 {"Dominion of Darkness", 6, 6},
2289 {"The Rift", 12, 4},
2290 {"Final Level", 16, 1},
2291 {"Deathmatch Arena", 17, 1}
2294 //PGM 01/07/97 added rogue levels
2295 //PGM 03/02/97 added dmatch level
2296 level_t roguelevels[] =
2298 {"start", "Split Decision"},
2299 {"r1m1", "Deviant's Domain"},
2300 {"r1m2", "Dread Portal"},
2301 {"r1m3", "Judgement Call"},
2302 {"r1m4", "Cave of Death"},
2303 {"r1m5", "Towers of Wrath"},
2304 {"r1m6", "Temple of Pain"},
2305 {"r1m7", "Tomb of the Overlord"},
2306 {"r2m1", "Tempus Fugit"},
2307 {"r2m2", "Elemental Fury I"},
2308 {"r2m3", "Elemental Fury II"},
2309 {"r2m4", "Curse of Osiris"},
2310 {"r2m5", "Wizard's Keep"},
2311 {"r2m6", "Blood Sacrifice"},
2312 {"r2m7", "Last Bastion"},
2313 {"r2m8", "Source of Evil"},
2314 {"ctf1", "Division of Change"}
2317 //PGM 01/07/97 added rogue episodes
2318 //PGM 03/02/97 added dmatch episode
2319 episode_t rogueepisodes[] =
2321 {"Introduction", 0, 1},
2322 {"Hell's Fortress", 1, 7},
2323 {"Corridors of Time", 8, 8},
2324 {"Deathmatch Arena", 16, 1}
2327 level_t nehahralevels[] =
2329 {"nehstart", "Welcome to Nehahra"},
2330 {"neh1m1", "Forge City1: Slipgates"},
2331 {"neh1m2", "Forge City2: Boiler"},
2332 {"neh1m3", "Forge City3: Escape"},
2333 {"neh1m4", "Grind Core"},
2334 {"neh1m5", "Industrial Silence"},
2335 {"neh1m6", "Locked-Up Anger"},
2336 {"neh1m7", "Wanderer of the Wastes"},
2337 {"neh1m8", "Artemis System Net"},
2338 {"neh1m9", "To the Death"},
2339 {"neh2m1", "The Gates of Ghoro"},
2340 {"neh2m2", "Sacred Trinity"},
2341 {"neh2m3", "Realm of the Ancients"},
2342 {"neh2m4", "Temple of the Ancients"},
2343 {"neh2m5", "Dreams Made Flesh"},
2344 {"neh2m6", "Your Last Cup of Sorrow"},
2345 {"nehsec", "Ogre's Bane"},
2346 {"nehahra", "Nehahra's Den"},
2347 {"nehend", "Quintessence"}
2350 episode_t nehahraepisodes[] =
2352 {"Welcome to Nehahra", 0, 1},
2353 {"The Fall of Forge", 1, 9},
2354 {"The Outlands", 10, 7},
2355 {"Dimension of the Lost", 17, 2}
2358 // Map list for BloodBath
2359 level_t bloodbathlevels[] =
2361 {"bb1", "The Stronghold"},
2362 {"bb2", "Winter Wonderland"},
2364 {"bb4", "The Tower"},
2366 {"bb6", "Twin Fortress"},
2368 {"bb8", "Fun With Heads"},
2369 {"e1m1", "Cradle to Grave"},
2370 {"e1m7", "Altar of Stone"},
2372 {"dm1", "Monolith Building 11"},
2375 {"e6m8", "Beauty and the Beast"},
2377 {"cpbb01", "Crypt of Despair"},
2378 {"cpbb02", "Pits of Blood"},
2379 {"cpbb03", "Unholy Cathedral"},
2380 {"cpbb04", "Deadly Inspirations"},
2382 {"b2a15", "Area 15 (B2)"},
2383 {"barena", "Blood Arena"},
2384 {"bkeep", "Blood Keep"},
2385 {"bstar", "Brown Star"},
2386 {"crypt", "The Crypt"},
2388 {"bb3_2k1", "Bodies Infusion"},
2389 {"qbb1", "The Confluence"},
2390 {"qbb2", "KathartiK"},
2391 {"qbb3", "Caleb's Woodland Retreat"},
2392 {"ded_simp", "Dead Simple"},
2393 {"dranzbb6", "Black Coffee"},
2394 {"qe1m7", "The House of Chthon"}
2397 episode_t bloodbathepisodes[] =
2400 {"Plasma Pack", 10, 4},
2401 {"Cryptic Passage", 14, 4},
2403 {"BloodBath", 23, 7}
2406 gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
2407 gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
2408 gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
2409 gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
2410 gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
2411 gamelevels_t bloodbathgame = {"BloodBath", bloodbathlevels, bloodbathepisodes, 5};
2416 gamelevels_t *notregistered;
2417 gamelevels_t *registered;
2421 gameinfo_t gamelist[] =
2423 {GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
2424 {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
2425 {GAME_ROGUE, &roguegame, &roguegame},
2426 {GAME_NEHAHRA, &nehahragame, &nehahragame},
2427 {GAME_FIENDARENA, &sharewarequakegame, ®isteredquakegame},
2428 {GAME_ZYMOTIC, &sharewarequakegame, ®isteredquakegame},
2429 {GAME_BLOODBATH, &bloodbathgame, &bloodbathgame},
2430 {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
2433 gamelevels_t *lookupgameinfo(void)
2436 for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
2437 if (registered.integer)
2438 return gamelist[i].registered;
2440 return gamelist[i].notregistered;
2446 qboolean m_serverInfoMessage = false;
2447 double m_serverInfoMessageTime;
2449 void M_Menu_GameOptions_f (void)
2451 key_dest = key_menu;
2452 m_state = m_gameoptions;
2453 m_entersound = true;
2454 if (maxplayers == 0)
2455 maxplayers = svs.maxclients;
2457 maxplayers = svs.maxclientslimit;
2461 int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
2462 #define NUM_GAMEOPTIONS 9
2463 int gameoptions_cursor;
2465 void M_GameOptions_Draw (void)
2471 M_DrawPic (16, 4, "gfx/qplaque.lmp");
2472 p = Draw_CachePic ("gfx/p_multi.lmp");
2473 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2475 M_DrawTextBox (152, 32, 10, 1);
2476 M_Print (160, 40, "begin game");
2478 M_Print (0, 56, " Max players");
2479 M_Print (160, 56, va("%i", maxplayers) );
2481 M_Print (0, 64, " Game Type");
2482 if (gamemode == GAME_BLOODBATH)
2484 if (!deathmatch.integer)
2485 Cvar_SetValue("deathmatch", 1);
2486 if (deathmatch.integer == 2)
2487 M_Print (160, 64, "Capture the Flag");
2489 M_Print (160, 64, "Blood Bath");
2493 if (!coop.integer && !deathmatch.integer)
2494 Cvar_SetValue("deathmatch", 1);
2496 M_Print (160, 64, "Cooperative");
2498 M_Print (160, 64, "Deathmatch");
2501 M_Print (0, 72, " Teamplay");
2502 if (gamemode == GAME_ROGUE)
2506 switch((int)teamplay.integer)
2508 case 1: msg = "No Friendly Fire"; break;
2509 case 2: msg = "Friendly Fire"; break;
2510 case 3: msg = "Tag"; break;
2511 case 4: msg = "Capture the Flag"; break;
2512 case 5: msg = "One Flag CTF"; break;
2513 case 6: msg = "Three Team CTF"; break;
2514 default: msg = "Off"; break;
2516 M_Print (160, 72, msg);
2518 else if (gamemode == GAME_BLOODBATH)
2522 switch (teamplay.integer)
2524 case 0: msg = "Off"; break;
2525 case 2: msg = "Friendly Fire"; break;
2526 default: msg = "No Friendly Fire"; break;
2528 M_Print (160, 72, msg);
2534 switch((int)teamplay.integer)
2536 case 1: msg = "No Friendly Fire"; break;
2537 case 2: msg = "Friendly Fire"; break;
2538 default: msg = "Off"; break;
2540 M_Print (160, 72, msg);
2543 M_Print (0, 80, " Skill");
2544 if (skill.integer == 0)
2545 M_Print (160, 80, "Easy difficulty");
2546 else if (skill.integer == 1)
2547 M_Print (160, 80, "Normal difficulty");
2548 else if (skill.integer == 2)
2549 M_Print (160, 80, "Hard difficulty");
2551 M_Print (160, 80, "Nightmare difficulty");
2553 M_Print (0, 88, " Frag Limit");
2554 if (fraglimit.integer == 0)
2555 M_Print (160, 88, "none");
2557 M_Print (160, 88, va("%i frags", fraglimit.integer));
2559 M_Print (0, 96, " Time Limit");
2560 if (timelimit.integer == 0)
2561 M_Print (160, 96, "none");
2563 M_Print (160, 96, va("%i minutes", timelimit.integer));
2565 g = lookupgameinfo();
2567 M_Print (0, 112, " Episode");
2568 M_Print (160, 112, g->episodes[startepisode].description);
2570 M_Print (0, 120, " Level");
2571 M_Print (160, 120, g->levels[g->episodes[startepisode].firstLevel + startlevel].description);
2572 M_Print (160, 128, g->levels[g->episodes[startepisode].firstLevel + startlevel].name);
2575 M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
2577 if (m_serverInfoMessage)
2579 if ((realtime - m_serverInfoMessageTime) < 5.0)
2582 M_DrawTextBox (x, 138, 24, 4);
2584 M_Print (x, 146, " More than 64 players?? ");
2585 M_Print (x, 154, " First, question your ");
2586 M_Print (x, 162, " sanity, then email ");
2587 M_Print (x, 170, " havoc@gamevisions.com ");
2591 m_serverInfoMessage = false;
2597 void M_NetStart_Change (int dir)
2602 switch (gameoptions_cursor)
2606 if (maxplayers > svs.maxclientslimit)
2608 maxplayers = svs.maxclientslimit;
2609 m_serverInfoMessage = true;
2610 m_serverInfoMessageTime = realtime;
2617 if (gamemode == GAME_BLOODBATH)
2619 if (deathmatch.integer == 2) // changing from CTF to BloodBath
2620 Cvar_SetValueQuick (&deathmatch, 0);
2621 else // changing from BloodBath to CTF
2622 Cvar_SetValueQuick (&deathmatch, 2);
2626 if (deathmatch.integer) // changing from deathmatch to coop
2628 Cvar_SetValueQuick (&coop, 1);
2629 Cvar_SetValueQuick (&deathmatch, 0);
2631 else // changing from coop to deathmatch
2633 Cvar_SetValueQuick (&coop, 0);
2634 Cvar_SetValueQuick (&deathmatch, 1);
2640 if (gamemode == GAME_ROGUE)
2645 Cvar_SetValueQuick (&teamplay, teamplay.integer + dir);
2646 if (teamplay.integer > count)
2647 Cvar_SetValueQuick (&teamplay, 0);
2648 else if (teamplay.integer < 0)
2649 Cvar_SetValueQuick (&teamplay, count);
2653 Cvar_SetValueQuick (&skill, skill.integer + dir);
2654 if (skill.integer > 3)
2655 Cvar_SetValueQuick (&skill, 0);
2656 if (skill.integer < 0)
2657 Cvar_SetValueQuick (&skill, 3);
2661 Cvar_SetValueQuick (&fraglimit, fraglimit.integer + dir*10);
2662 if (fraglimit.integer > 100)
2663 Cvar_SetValueQuick (&fraglimit, 0);
2664 if (fraglimit.integer < 0)
2665 Cvar_SetValueQuick (&fraglimit, 100);
2669 Cvar_SetValueQuick (&timelimit, timelimit.value + dir*5);
2670 if (timelimit.value > 60)
2671 Cvar_SetValueQuick (&timelimit, 0);
2672 if (timelimit.value < 0)
2673 Cvar_SetValueQuick (&timelimit, 60);
2677 startepisode += dir;
2678 g = lookupgameinfo();
2680 if (startepisode < 0)
2681 startepisode = g->numepisodes - 1;
2683 if (startepisode >= g->numepisodes)
2691 g = lookupgameinfo();
2694 startlevel = g->episodes[startepisode].levels - 1;
2696 if (startlevel >= g->episodes[startepisode].levels)
2702 void M_GameOptions_Key (int key)
2713 S_LocalSound ("misc/menu1.wav");
2714 gameoptions_cursor--;
2715 if (gameoptions_cursor < 0)
2716 gameoptions_cursor = NUM_GAMEOPTIONS-1;
2720 S_LocalSound ("misc/menu1.wav");
2721 gameoptions_cursor++;
2722 if (gameoptions_cursor >= NUM_GAMEOPTIONS)
2723 gameoptions_cursor = 0;
2727 if (gameoptions_cursor == 0)
2729 S_LocalSound ("misc/menu3.wav");
2730 M_NetStart_Change (-1);
2734 if (gameoptions_cursor == 0)
2736 S_LocalSound ("misc/menu3.wav");
2737 M_NetStart_Change (1);
2741 S_LocalSound ("misc/menu2.wav");
2742 if (gameoptions_cursor == 0)
2745 Cbuf_AddText ("disconnect\n");
2746 Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
2747 Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
2749 g = lookupgameinfo();
2750 Cbuf_AddText ( va ("map %s\n", g->levels[g->episodes[startepisode].firstLevel + startlevel].name) );
2754 M_NetStart_Change (1);
2759 //=============================================================================
2762 qboolean searchComplete = false;
2763 double searchCompleteTime;
2765 void M_Menu_Search_f (void)
2767 key_dest = key_menu;
2769 m_entersound = false;
2772 searchComplete = false;
2778 void M_Search_Draw (void)
2783 p = Draw_CachePic ("gfx/p_multi.lmp");
2784 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2785 x = (320/2) - ((12*8)/2) + 4;
2786 M_DrawTextBox (x-8, 32, 12, 1);
2787 M_Print (x, 40, "Searching...");
2795 if (! searchComplete)
2797 searchComplete = true;
2798 searchCompleteTime = realtime;
2803 M_Menu_ServerList_f ();
2807 M_PrintWhite ((320/2) - ((22*8)/2), 64, "No Quake servers found");
2808 if ((realtime - searchCompleteTime) < 3.0)
2811 M_Menu_LanConfig_f ();
2815 void M_Search_Key (int key)
2819 //=============================================================================
2823 qboolean slist_sorted;
2825 void M_Menu_ServerList_f (void)
2827 key_dest = key_menu;
2829 m_entersound = true;
2831 m_return_onerror = false;
2832 m_return_reason[0] = 0;
2833 slist_sorted = false;
2837 void M_ServerList_Draw (void)
2845 if (hostCacheCount > 1)
2849 for (i = 0; i < hostCacheCount; i++)
2850 for (j = i+1; j < hostCacheCount; j++)
2851 if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
2853 memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
2854 memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
2855 memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
2858 slist_sorted = true;
2861 p = Draw_CachePic ("gfx/p_multi.lmp");
2862 M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
2863 for (n = 0; n < hostCacheCount; n++)
2865 if (hostcache[n].maxusers)
2866 sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
2868 sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
2869 M_Print (16, 32 + 8*n, string);
2871 M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
2873 if (*m_return_reason)
2874 M_PrintWhite (16, 148, m_return_reason);
2878 void M_ServerList_Key (int k)
2883 M_Menu_LanConfig_f ();
2892 S_LocalSound ("misc/menu1.wav");
2894 if (slist_cursor < 0)
2895 slist_cursor = hostCacheCount - 1;
2900 S_LocalSound ("misc/menu1.wav");
2902 if (slist_cursor >= hostCacheCount)
2907 S_LocalSound ("misc/menu2.wav");
2908 m_return_state = m_state;
2909 m_return_onerror = true;
2910 slist_sorted = false;
2911 key_dest = key_game;
2913 Cbuf_AddText ( va ("connect \"%s\"\n", hostcache[slist_cursor].cname) );
2922 //=============================================================================
2923 /* Menu Subsystem */
2928 Cmd_AddCommand ("togglemenu", M_ToggleMenu_f);
2930 Cmd_AddCommand ("menu_main", M_Menu_Main_f);
2931 Cmd_AddCommand ("menu_singleplayer", M_Menu_SinglePlayer_f);
2932 Cmd_AddCommand ("menu_load", M_Menu_Load_f);
2933 Cmd_AddCommand ("menu_save", M_Menu_Save_f);
2934 Cmd_AddCommand ("menu_multiplayer", M_Menu_MultiPlayer_f);
2935 Cmd_AddCommand ("menu_setup", M_Menu_Setup_f);
2936 Cmd_AddCommand ("menu_options", M_Menu_Options_f);
2937 Cmd_AddCommand ("menu_keys", M_Menu_Keys_f);
2938 Cmd_AddCommand ("menu_video", M_Menu_Video_f);
2939 Cmd_AddCommand ("help", M_Menu_Help_f);
2940 Cmd_AddCommand ("menu_quit", M_Menu_Quit_f);
2942 if (gamemode == GAME_NEHAHRA)
2944 if (COM_FileExists("maps/neh1m4.bsp"))
2946 if (COM_FileExists("hearing.dem"))
2948 Con_Printf("Nehahra movie and game detected.\n");
2949 NehGameType = TYPE_BOTH;
2953 Con_Printf("Nehahra game detected.\n");
2954 NehGameType = TYPE_GAME;
2959 if (COM_FileExists("hearing.dem"))
2961 Con_Printf("Nehahra movie detected.\n");
2962 NehGameType = TYPE_DEMO;
2966 Con_Printf("Nehahra not found.\n");
2967 NehGameType = TYPE_GAME; // could just complain, but...
2975 if (m_state == m_none || key_dest != key_menu)
2993 case m_singleplayer:
2994 M_SinglePlayer_Draw ();
3006 M_MultiPlayer_Draw ();
3038 M_LanConfig_Draw ();
3042 M_GameOptions_Draw ();
3050 M_ServerList_Draw ();
3056 S_LocalSound ("misc/menu2.wav");
3057 m_entersound = false;
3064 void M_Keydown (int key)
3079 case m_singleplayer:
3080 M_SinglePlayer_Key (key);
3092 M_MultiPlayer_Key (key);
3104 M_Options_Key (key);
3124 M_LanConfig_Key (key);
3128 M_GameOptions_Key (key);
3136 M_ServerList_Key (key);
3142 void M_ConfigureNetSubsystem(void)
3144 // enable/disable net systems to match desired config
3146 Cbuf_AddText ("stopdemo\n");
3148 if (IPXConfig || TCPIPConfig)
3149 net_hostport = lanConfig_port;