add IPv4 multicasting support
[btb/d2x.git] / main / menu.c
1 /* $Id: menu.c,v 1.32 2003-10-12 09:17:47 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Inferno main menu.
18  *
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #include <conf.h>
23 #endif
24
25 #ifdef WINDOWS
26 #include "desw.h"
27 #endif
28
29 #include <stdio.h>
30 #include <string.h>
31
32 #include "pa_enabl.h"                   //$$POLY_ACC
33
34 #include "menu.h"
35 #include "inferno.h"
36 #include "game.h"
37 #include "gr.h"
38 #include "key.h"
39 #include "iff.h"
40 #include "u_mem.h"
41 #include "error.h"
42 #include "bm.h"
43 #include "screens.h"
44 #include "mono.h"
45 #include "joy.h"
46 #include "vecmat.h"
47 #include "effects.h"
48 #include "slew.h"
49 #include "gamemine.h"
50 #include "gamesave.h"
51 #include "palette.h"
52 #include "args.h"
53 #include "newdemo.h"
54 #include "timer.h"
55 #include "sounds.h"
56 #include "gameseq.h"
57 #include "text.h"
58 #include "gamefont.h"
59 #include "newmenu.h"
60 #ifdef NETWORK
61 #  include "network.h"
62 #  include "ipx.h"
63 #  include "multi.h"
64 #endif
65 #include "scores.h"
66 #include "joydefs.h"
67 #ifdef NETWORK
68 #include "modem.h"
69 #endif
70 #include "playsave.h"
71 #include "kconfig.h"
72 #include "titles.h"
73 #include "credits.h"
74 #include "texmap.h"
75 #include "polyobj.h"
76 #include "state.h"
77 #include "mission.h"
78 #include "songs.h"
79 #include "config.h"
80 #include "movie.h"
81 #include "gamepal.h"
82 #include "gauges.h"
83 #include "powerup.h"
84 #include "strutil.h"
85 #include "reorder.h"
86
87 #ifdef MACINTOSH
88         #include "resource.h"
89         #include "isp.h"
90         #include <Dialogs.h>
91 #endif
92
93 #ifdef EDITOR
94 #include "editor/editor.h"
95 #endif
96
97 #if defined(POLY_ACC)
98 #include "poly_acc.h"
99 #endif
100
101 //char *menu_difficulty_text[] = { "Trainee", "Rookie", "Fighter", "Hotshot", "Insane" };
102 //char *menu_detail_text[] = { "Lowest", "Low", "Medium", "High", "Highest", "", "Custom..." };
103
104 #define MENU_NEW_GAME                   0
105 #define MENU_GAME                       1 
106 #define MENU_EDITOR                     2
107 #define MENU_VIEW_SCORES                3
108 #define MENU_QUIT                       4
109 #define MENU_LOAD_GAME                  5
110 #define MENU_SAVE_GAME                  6
111 #define MENU_DEMO_PLAY                  8
112 #define MENU_LOAD_LEVEL                 9
113 #define MENU_START_IPX_NETGAME          10
114 #define MENU_JOIN_IPX_NETGAME           11
115 #define MENU_CONFIG                     13
116 #define MENU_REJOIN_NETGAME             14
117 #define MENU_DIFFICULTY                 15
118 #define MENU_START_SERIAL               18
119 #define MENU_HELP                       19
120 #define MENU_NEW_PLAYER                 20
121 #define MENU_MULTIPLAYER                21
122 #define MENU_STOP_MODEM                 22
123 #define MENU_SHOW_CREDITS               23
124 #define MENU_ORDER_INFO                 24
125 #define MENU_PLAY_SONG                  25
126 //#define MENU_START_TCP_NETGAME          26 // TCP/IP support was planned in Descent II,
127 //#define MENU_JOIN_TCP_NETGAME           27 // but never realized.
128 #define MENU_START_APPLETALK_NETGAME    28
129 #define MENU_JOIN_APPLETALK_NETGAME     29
130 #define MENU_START_UDP_NETGAME          30 // UDP/IP support copied from d1x
131 #define MENU_JOIN_UDP_NETGAME           31
132 #define MENU_START_KALI_NETGAME         32 // Kali support copied from d1x
133 #define MENU_JOIN_KALI_NETGAME          33
134 #define MENU_START_MCAST4_NETGAME       34 // UDP/IP over multicast networks
135 #define MENU_JOIN_MCAST4_NETGAME        35
136
137 //ADD_ITEM("Start netgame...", MENU_START_NETGAME, -1 );
138 //ADD_ITEM("Send net message...", MENU_SEND_NET_MESSAGE, -1 );
139
140 #define ADD_ITEM(t,value,key)  do { m[num_options].type=NM_TYPE_MENU; m[num_options].text=t; menu_choice[num_options]=value;num_options++; } while (0)
141
142 //unused - extern int last_joy_time;               //last time the joystick was used
143 #ifndef NDEBUG
144 extern int Speedtest_on;
145 #else
146 #define Speedtest_on 0
147 #endif
148
149 void do_sound_menu();
150 void do_toggles_menu();
151
152 ubyte do_auto_demo = 1;                 // Flag used to enable auto demo starting in main menu.
153 int Player_default_difficulty; // Last difficulty level chosen by the player
154 int Auto_leveling_on = 1;
155 int Guided_in_big_window = 0;
156 int Menu_draw_copyright = 0;
157 int EscortHotKeys=1;
158
159 // Function Prototypes added after LINTING
160 void do_option(int select);
161 void do_detail_level_menu_custom(void);
162 void do_new_game_menu(void);
163 #ifdef NETWORK
164 void do_multi_player_menu(void);
165 void ipx_set_driver(int ipx_driver);
166 #endif //NETWORK
167
168 //returns the number of demo files on the disk
169 int newdemo_count_demos();
170 extern ubyte Version_major,Version_minor;
171
172 // ------------------------------------------------------------------------
173 void autodemo_menu_check(int nitems, newmenu_item * items, int *last_key, int citem )
174 {
175         int curtime;
176
177         nitems = nitems;
178         items=items;
179         citem = citem;
180
181         //draw copyright message
182         if ( Menu_draw_copyright )              {
183                 int w,h,aw;
184
185                 Menu_draw_copyright = 0;
186                 WINDOS( dd_gr_set_current_canvas(NULL),
187                                         gr_set_current_canvas(NULL));
188                 gr_set_curfont(GAME_FONT);
189                 gr_set_fontcolor(BM_XRGB(6,6,6),-1);
190
191                 gr_get_string_size("V2.2", &w, &h, &aw );
192         
193                 WIN(DDGRLOCK(dd_grd_curcanv));
194                         gr_printf(0x8000,grd_curcanv->cv_bitmap.bm_h-GAME_FONT->ft_h-2,TXT_COPYRIGHT);
195                         #ifdef MACINTOSH        // print out fix level as well if it exists
196                                 if (Version_fix != 0)
197                                 {
198                                         gr_get_string_size("V2.2.2", &w, &h, &aw );
199                                         gr_printf(grd_curcanv->cv_bitmap.bm_w-w-2,
200                                                           grd_curcanv->cv_bitmap.bm_h-GAME_FONT->ft_h-2,
201                                                           "V%d.%d.%d",
202                                                           Version_major,Version_minor,Version_fix);
203                                 }
204                                 else
205                                 {
206                                         gr_printf(grd_curcanv->cv_bitmap.bm_w-w-2,
207                                                           grd_curcanv->cv_bitmap.bm_h-GAME_FONT->ft_h-2,
208                                                           "V%d.%d",
209                                                           Version_major,Version_minor);
210                                 }
211                         #else
212                                 gr_printf(grd_curcanv->cv_bitmap.bm_w-w-2,grd_curcanv->cv_bitmap.bm_h-GAME_FONT->ft_h-2,"V%d.%d",Version_major,Version_minor);
213                         #endif
214
215                 //say this is vertigo version
216                 if (cfexist(MISSION_DIR "d2x.hog")) {
217                         gr_set_curfont(MEDIUM2_FONT);
218                         gr_printf(MenuHires?495:248, MenuHires?88:37, "Vertigo");
219                 }
220
221                 WIN(DDGRUNLOCK(dd_grd_curcanv));
222         }
223         
224         // Don't allow them to hit ESC in the main menu.
225         if (*last_key==KEY_ESC) *last_key = 0;
226
227         if ( do_auto_demo )     {
228                 curtime = timer_get_approx_seconds();
229                 //if ( ((keyd_time_when_last_pressed+i2f(20)) < curtime) && ((last_joy_time+i2f(20)) < curtime) && (!Speedtest_on)  ) {
230                 #ifndef MACINTOSH               // for now only!!!!
231                 if ( ((keyd_time_when_last_pressed+i2f(25)) < curtime) && (!Speedtest_on)  ) {
232                 #else
233                 if ( (keyd_time_when_last_pressed+i2f(40)) < curtime ) {
234                 #endif
235                         int n_demos;
236
237                         n_demos = newdemo_count_demos();
238
239 try_again:;
240
241                         if ((d_rand() % (n_demos+1)) == 0)
242                         {
243                                 #ifndef SHAREWARE
244                                         #ifdef WINDOWS
245                                         mouse_set_mode(1);                              //re-enable centering mode
246                                         HideCursorW();
247                                         #endif
248 #ifdef OGL
249                                         Screen_mode = -1;
250 #endif
251                                         PlayMovie("intro.mve",0);
252                                         songs_play_song(SONG_TITLE,1);
253                                         *last_key = -3; //exit menu to force redraw even if not going to game mode. -3 tells menu system not to restore
254                                         set_screen_mode(SCREEN_MENU);
255                                         #ifdef WINDOWS
256                                         mouse_set_mode(0);                              //disenable centering mode
257                                         ShowCursorW();
258                                         #endif
259                                 #endif // end of ifndef shareware
260                         }
261                         else {
262                                 WIN(HideCursorW());
263                                 keyd_time_when_last_pressed = curtime;                  // Reset timer so that disk won't thrash if no demos.
264                                 newdemo_start_playback(NULL);           // Randomly pick a file
265                                 if (Newdemo_state == ND_STATE_PLAYBACK) {
266                                         Function_mode = FMODE_GAME;
267                                         *last_key = -3; //exit menu to get into game mode. -3 tells menu system not to restore
268                                 }
269                                 else
270                                         goto try_again; //keep trying until we get a demo that works
271                         }
272                 }
273         }
274 }
275
276 //static int First_time = 1;
277 static int main_menu_choice = 0;
278
279 //      -----------------------------------------------------------------------------
280 //      Create the main menu.
281 void create_main_menu(newmenu_item *m, int *menu_choice, int *callers_num_options)
282 {
283         int     num_options;
284
285         #ifndef DEMO_ONLY
286         num_options = 0;
287
288         set_screen_mode (SCREEN_MENU);
289
290         ADD_ITEM(TXT_NEW_GAME,MENU_NEW_GAME,KEY_N);
291
292         ADD_ITEM(TXT_LOAD_GAME,MENU_LOAD_GAME,KEY_L);
293
294 #ifdef NETWORK
295         ADD_ITEM(TXT_MULTIPLAYER_,MENU_MULTIPLAYER,-1);
296 #endif
297
298         ADD_ITEM(TXT_OPTIONS_, MENU_CONFIG, -1 );
299         ADD_ITEM(TXT_CHANGE_PILOTS,MENU_NEW_PLAYER,unused);
300         ADD_ITEM(TXT_VIEW_DEMO,MENU_DEMO_PLAY,0);
301         ADD_ITEM(TXT_VIEW_SCORES,MENU_VIEW_SCORES,KEY_V);
302         if (cfexist("orderd2.pcx")) /* SHAREWARE */
303                 ADD_ITEM(TXT_ORDERING_INFO,MENU_ORDER_INFO,-1);
304         ADD_ITEM(TXT_CREDITS,MENU_SHOW_CREDITS,-1);
305         #endif
306         ADD_ITEM(TXT_QUIT,MENU_QUIT,KEY_Q);
307
308         #ifndef RELEASE
309         if (!(Game_mode & GM_MULTI ))   {
310                 //m[num_options].type=NM_TYPE_TEXT;
311                 //m[num_options++].text=" Debug options:";
312
313                 ADD_ITEM("  Load level...",MENU_LOAD_LEVEL ,KEY_N);
314                 #ifdef EDITOR
315                 ADD_ITEM("  Editor", MENU_EDITOR, KEY_E);
316                 #endif
317         }
318
319         //ADD_ITEM( "  Play song", MENU_PLAY_SONG, -1 );
320         #endif
321
322         *callers_num_options = num_options;
323 }
324
325 //returns number of item chosen
326 int DoMenu() 
327 {
328         int menu_choice[25];
329         newmenu_item m[25];
330         int num_options = 0;
331
332         load_palette(MENU_PALETTE,0,1);         //get correct palette
333
334         if ( Players[Player_num].callsign[0]==0 )       {
335                 RegisterPlayer();
336                 return 0;
337         }
338         
339         if ((Game_mode & GM_SERIAL) || (Game_mode & GM_MODEM)) {
340                 do_option(MENU_START_SERIAL);
341                 return 0;
342         }
343
344         create_main_menu(m, menu_choice, &num_options);
345
346         do {
347                 keyd_time_when_last_pressed = timer_get_fixed_seconds();                // .. 20 seconds from now!
348                 if (main_menu_choice < 0 )
349                         main_menu_choice = 0;
350                 Menu_draw_copyright = 1;
351                 main_menu_choice = newmenu_do2( "", NULL, num_options, m, autodemo_menu_check, main_menu_choice, Menu_pcx_name);
352                 if ( main_menu_choice > -1 ) do_option(menu_choice[main_menu_choice]);
353                 create_main_menu(m, menu_choice, &num_options); //      may have to change, eg, maybe selected pilot and no save games.
354         } while( Function_mode==FMODE_MENU );
355
356 //      if (main_menu_choice != -2)
357 //              do_auto_demo = 0;               // No more auto demos
358         if ( Function_mode==FMODE_GAME )
359                 gr_palette_fade_out( gr_palette, 32, 0 );
360
361         return main_menu_choice;
362 }
363
364 extern void show_order_form(void);      // John didn't want this in inferno.h so I just externed it.
365
366 #ifdef WINDOWS
367 #undef TXT_SELECT_DEMO
368 #define TXT_SELECT_DEMO "Select Demo\n<Ctrl-D> or Right-click\nto delete"
369 #endif
370
371 //returns flag, true means quit menu
372 void do_option ( int select) 
373 {
374         switch (select) {
375                 case MENU_NEW_GAME:
376                         do_new_game_menu();
377                         break;
378                 case MENU_GAME:
379                         break;
380                 case MENU_DEMO_PLAY:
381                 {
382                         char demo_file[16];
383                         if (newmenu_get_filename( TXT_SELECT_DEMO, DEMO_DIR "*.dem", demo_file, 1 ))
384                                 newdemo_start_playback(demo_file);
385                         break;
386                 }
387                 case MENU_LOAD_GAME:
388                         state_restore_all(0, 0, NULL);
389                         break;
390                 #ifdef EDITOR
391                 case MENU_EDITOR:
392                         Function_mode = FMODE_EDITOR;
393                         init_cockpit();
394                         break;
395                 #endif
396                 case MENU_VIEW_SCORES:
397                         gr_palette_fade_out( gr_palette,32,0 );
398                         scores_view(-1);
399                         break;
400 #if 1 //def SHAREWARE
401                 case MENU_ORDER_INFO:
402                         show_order_form();
403                         break;
404 #endif
405                 case MENU_QUIT:
406                         #ifdef EDITOR
407                         if (! SafetyCheck()) break;
408                         #endif
409                         gr_palette_fade_out( gr_palette,32,0);
410                         Function_mode = FMODE_EXIT;
411                         break;
412                 case MENU_NEW_PLAYER:
413                         RegisterPlayer();               //1 == allow escape out of menu
414                         break;
415
416                 case MENU_HELP:
417                         do_show_help();
418                         break;
419
420 #ifndef RELEASE
421
422                 case MENU_PLAY_SONG:    {
423                                 int i;
424                                 char * m[MAX_NUM_SONGS];
425
426                                 for (i=0;i<Num_songs;i++) {
427                                         m[i] = Songs[i].filename;
428                                 }
429                                 i = newmenu_listbox( "Select Song", Num_songs, m, 1, NULL );
430
431                                 if ( i > -1 )   {
432                                         songs_play_song( i, 0 );
433                                 }
434                         }
435                         break;
436                 case MENU_LOAD_LEVEL: {
437                         newmenu_item m;
438                         char text[10]="";
439                         int new_level_num;
440
441                         m.type=NM_TYPE_INPUT; m.text_len = 10; m.text = text;
442
443                         newmenu_do( NULL, "Enter level to load", 1, &m, NULL );
444
445                         new_level_num = atoi(m.text);
446
447                         if (new_level_num!=0 && new_level_num>=Last_secret_level && new_level_num<=Last_level)  {
448                                 gr_palette_fade_out( gr_palette, 32, 0 );
449                                 StartNewGame(new_level_num);
450                         }
451
452                         break;
453                 }
454 #endif //ifndef RELEASE
455
456
457 #ifdef NETWORK
458                 //case MENU_START_TCP_NETGAME:
459                 //case MENU_JOIN_TCP_NETGAME:
460                 case MENU_START_IPX_NETGAME:
461                 case MENU_JOIN_IPX_NETGAME:
462                 case MENU_START_UDP_NETGAME:
463                 case MENU_JOIN_UDP_NETGAME:
464                 case MENU_START_KALI_NETGAME:
465                 case MENU_JOIN_KALI_NETGAME:
466                 case MENU_START_MCAST4_NETGAME:
467                 case MENU_JOIN_MCAST4_NETGAME:
468                         load_mission(Builtin_mission_num);
469 #ifdef MACINTOSH
470                         Network_game_type = IPX_GAME;
471 #endif
472 //                      WIN(ipx_create_read_thread());
473                         switch (select & ~0x1) {
474                         case MENU_START_IPX_NETGAME: ipx_set_driver(IPX_DRIVER_IPX); break;
475                         case MENU_START_UDP_NETGAME: ipx_set_driver(IPX_DRIVER_UDP); break;
476                         case MENU_START_KALI_NETGAME: ipx_set_driver(IPX_DRIVER_KALI); break;
477                         case MENU_START_MCAST4_NETGAME: ipx_set_driver(IPX_DRIVER_MCAST4); break;
478                         default: Int3();
479                         }
480
481                         if ((select & 0x1) == 0) // MENU_START_*_NETGAME
482                                 network_start_game();
483                         else // MENU_JOIN_*_NETGAME
484                                 network_join_game();
485                         break;
486
487 #ifdef MACINTOSH
488                 case MENU_START_APPLETALK_NETGAME:
489                         load_mission(Builtin_mission_num);
490                         #ifdef MACINTOSH
491                         Network_game_type = APPLETALK_GAME;
492                         #endif
493                         network_start_game();
494                         break;
495
496                 case MENU_JOIN_APPLETALK_NETGAME:
497                         load_mission(Builtin_mission_num);
498                         #ifdef MACINTOSH
499                         Network_game_type = APPLETALK_GAME;
500                         #endif
501                         network_join_game();
502                         break;
503 #endif
504 #if 0
505                 case MENU_START_TCP_NETGAME:
506                 case MENU_JOIN_TCP_NETGAME:
507                         nm_messagebox (TXT_SORRY,1,TXT_OK,"Not available in shareware version!");
508                         // DoNewIPAddress();
509                         break;
510 #endif
511                 case MENU_START_SERIAL:
512                         com_main_menu();
513                         break;
514                 case MENU_MULTIPLAYER:
515                         do_multi_player_menu();
516                         break;
517 #endif //NETWORK
518                 case MENU_CONFIG:
519                         do_options_menu();
520                         break;
521                 case MENU_SHOW_CREDITS:
522                         gr_palette_fade_out( gr_palette,32,0);
523                         songs_stop_all();
524                         credits_show(NULL); 
525                         break;
526                 default:
527                         Error("Unknown option %d in do_option",select);
528                         break;
529         }
530
531 }
532
533 int do_difficulty_menu()
534 {
535         int s;
536         newmenu_item m[5];
537
538         m[0].type=NM_TYPE_MENU; m[0].text=MENU_DIFFICULTY_TEXT(0);
539         m[1].type=NM_TYPE_MENU; m[1].text=MENU_DIFFICULTY_TEXT(1);
540         m[2].type=NM_TYPE_MENU; m[2].text=MENU_DIFFICULTY_TEXT(2);
541         m[3].type=NM_TYPE_MENU; m[3].text=MENU_DIFFICULTY_TEXT(3);
542         m[4].type=NM_TYPE_MENU; m[4].text=MENU_DIFFICULTY_TEXT(4);
543
544         s = newmenu_do1( NULL, TXT_DIFFICULTY_LEVEL, NDL, m, NULL, Difficulty_level);
545
546         if (s > -1 )    {
547                 if (s != Difficulty_level)
548                 {       
549                         Player_default_difficulty = s;
550                         write_player_file();
551                 }
552                 Difficulty_level = s;
553                 mprintf((0, "%s %s %i\n", TXT_DIFFICULTY_LEVEL, TXT_SET_TO, Difficulty_level));
554                 return 1;
555         }
556         return 0;
557 }
558
559 int     Max_debris_objects, Max_objects_onscreen_detailed;
560 int     Max_linear_depth_objects;
561
562 sbyte   Object_complexity=2, Object_detail=2;
563 sbyte   Wall_detail=2, Wall_render_depth=2, Debris_amount=2, SoundChannels = 2;
564
565 sbyte   Render_depths[NUM_DETAIL_LEVELS-1] =                        { 6,  9, 12, 15, 50};
566 sbyte   Max_perspective_depths[NUM_DETAIL_LEVELS-1] =               { 1,  2,  3,  5,  8};
567 sbyte   Max_linear_depths[NUM_DETAIL_LEVELS-1] =                    { 3,  5,  7, 10, 50};
568 sbyte   Max_linear_depths_objects[NUM_DETAIL_LEVELS-1] =            { 1,  2,  3,  7, 20};
569 sbyte   Max_debris_objects_list[NUM_DETAIL_LEVELS-1] =              { 2,  4,  7, 10, 15};
570 sbyte   Max_objects_onscreen_detailed_list[NUM_DETAIL_LEVELS-1] =   { 2,  4,  7, 10, 15};
571 sbyte   Smts_list[NUM_DETAIL_LEVELS-1] =                            { 2,  4,  8, 16, 50};   //      threshold for models to go to lower detail model, gets multiplied by obj->size
572 sbyte   Max_sound_channels[NUM_DETAIL_LEVELS-1] =                   { 2,  4,  8, 12, 16};
573
574 //      -----------------------------------------------------------------------------
575 //      Set detail level based stuff.
576 //      Note: Highest detail level (detail_level == NUM_DETAIL_LEVELS-1) is custom detail level.
577 void set_detail_level_parameters(int detail_level)
578 {
579         Assert((detail_level >= 0) && (detail_level < NUM_DETAIL_LEVELS));
580
581         if (detail_level < NUM_DETAIL_LEVELS-1) {
582                 Render_depth = Render_depths[detail_level];
583                 Max_perspective_depth = Max_perspective_depths[detail_level];
584                 Max_linear_depth = Max_linear_depths[detail_level];
585                 Max_linear_depth_objects = Max_linear_depths_objects[detail_level];
586
587                 Max_debris_objects = Max_debris_objects_list[detail_level];
588                 Max_objects_onscreen_detailed = Max_objects_onscreen_detailed_list[detail_level];
589
590                 Simple_model_threshhold_scale = Smts_list[detail_level];
591
592                 digi_set_max_channels( Max_sound_channels[ detail_level ] );
593
594                 //      Set custom menu defaults.
595                 Object_complexity = detail_level;
596                 Wall_render_depth = detail_level;
597                 Object_detail = detail_level;
598                 Wall_detail = detail_level;
599                 Debris_amount = detail_level;
600                 SoundChannels = detail_level;
601
602 #if defined(POLY_ACC)
603
604                 #ifdef MACINTOSH
605                         if (detail_level < 2)
606                         {
607                                 pa_set_filtering(0);
608                         }
609                         else if (detail_level < 4)
610                         {
611                                 pa_set_filtering(1);
612                         }
613                         else if (detail_level == 4)
614                         {
615                                 pa_set_filtering(2);
616                         }
617                 #else
618                         pa_filter_mode = detail_level;
619                 #endif
620 #endif
621
622         }
623 }
624
625 //      -----------------------------------------------------------------------------
626 void do_detail_level_menu(void)
627 {
628         int s;
629         newmenu_item m[8];
630
631         m[0].type=NM_TYPE_MENU; m[0].text=MENU_DETAIL_TEXT(0);
632         m[1].type=NM_TYPE_MENU; m[1].text=MENU_DETAIL_TEXT(1);
633         m[2].type=NM_TYPE_MENU; m[2].text=MENU_DETAIL_TEXT(2);
634         m[3].type=NM_TYPE_MENU; m[3].text=MENU_DETAIL_TEXT(3);
635         m[4].type=NM_TYPE_MENU; m[4].text=MENU_DETAIL_TEXT(4);
636         m[5].type=NM_TYPE_TEXT; m[5].text="";
637         m[6].type=NM_TYPE_MENU; m[6].text=MENU_DETAIL_TEXT(5);
638         m[7].type=NM_TYPE_CHECK; m[7].text="Show High Res movies"; m[7].value=MovieHires;
639
640         s = newmenu_do1( NULL, TXT_DETAIL_LEVEL , NDL+3, m, NULL, Detail_level);
641
642         if (s > -1 )    {
643                 switch (s)      {
644                         case 0:
645                         case 1:
646                         case 2:
647                         case 3:
648                         case 4:
649                                 Detail_level = s;
650                                 mprintf((0, "Detail level set to %i\n", Detail_level));
651                                 set_detail_level_parameters(Detail_level);
652                                 break;
653                         case 6:
654                                 Detail_level = 5;
655                                 do_detail_level_menu_custom();
656                                 break;
657                 }
658         }
659         MovieHires = m[7].value;
660 }
661
662 //      -----------------------------------------------------------------------------
663 void do_detail_level_menu_custom_menuset(int nitems, newmenu_item * items, int *last_key, int citem )
664 {
665         nitems = nitems;
666         *last_key = *last_key;
667         citem = citem;
668
669         Object_complexity = items[0].value;
670         Object_detail = items[1].value;
671         Wall_detail = items[2].value;
672         Wall_render_depth = items[3].value;
673         Debris_amount = items[4].value;
674         SoundChannels = items[5].value;
675 #if defined(POLY_ACC)
676         pa_filter_mode = items[6].value;
677 #endif
678
679 }
680
681 void set_custom_detail_vars(void)
682 {
683         Render_depth = Render_depths[Wall_render_depth];
684
685         Max_perspective_depth = Max_perspective_depths[Wall_detail];
686         Max_linear_depth = Max_linear_depths[Wall_detail];
687
688         Max_debris_objects = Max_debris_objects_list[Debris_amount];
689
690         Max_objects_onscreen_detailed = Max_objects_onscreen_detailed_list[Object_complexity];
691         Simple_model_threshhold_scale = Smts_list[Object_complexity];
692         Max_linear_depth_objects = Max_linear_depths_objects[Object_detail];
693
694         digi_set_max_channels( Max_sound_channels[ SoundChannels ] );
695         
696 }
697
698 #define DL_MAX  10
699
700 //      -----------------------------------------------------------------------------
701
702 void do_detail_level_menu_custom(void)
703 {
704         int     count;
705         int     s=0;
706         newmenu_item m[DL_MAX];
707         #if defined(POLY_ACC)
708         int filtering_id;
709         #endif
710
711         do {
712                 count = 0;
713                 m[count].type = NM_TYPE_SLIDER;
714                 m[count].text = TXT_OBJ_COMPLEXITY;
715                 m[count].value = Object_complexity;
716                 m[count].min_value = 0;
717                 m[count++].max_value = NDL-1;
718
719                 m[count].type = NM_TYPE_SLIDER;
720                 m[count].text = TXT_OBJ_DETAIL;
721                 m[count].value = Object_detail;
722                 m[count].min_value = 0;
723                 m[count++].max_value = NDL-1;
724
725                 m[count].type = NM_TYPE_SLIDER;
726                 m[count].text = TXT_WALL_DETAIL;
727                 m[count].value = Wall_detail;
728                 m[count].min_value = 0;
729                 m[count++].max_value = NDL-1;
730
731                 m[count].type = NM_TYPE_SLIDER;
732                 m[count].text = TXT_WALL_RENDER_DEPTH;
733                 m[count].value = Wall_render_depth;
734                 m[count].min_value = 0;
735                 m[count++].max_value = NDL-1;
736
737                 m[count].type = NM_TYPE_SLIDER;
738                 m[count].text= TXT_DEBRIS_AMOUNT;
739                 m[count].value = Debris_amount;
740                 m[count].min_value = 0;
741                 m[count++].max_value = NDL-1;
742
743                 m[count].type = NM_TYPE_SLIDER;
744                 m[count].text= TXT_SOUND_CHANNELS;
745                 m[count].value = SoundChannels;
746                 m[count].min_value = 0;
747                 m[count++].max_value = NDL-1;
748
749                 #if defined(POLY_ACC)
750                 MAC( if(PAEnabled){ )
751                         filtering_id = count;
752                         m[count].type = NM_TYPE_SLIDER;
753                         m[count].text= "FILTERING";
754                         m[count].value = pa_filter_mode;
755                         m[count].min_value = 0;
756                         #ifdef MACINTOSH
757                         m[count++].max_value = 2;
758                         #else
759                         m[count++].max_value = NDL-1;
760                         #endif
761                 MAC(})
762                 #endif
763
764                 m[count].type = NM_TYPE_TEXT;
765                 m[count++].text= TXT_LO_HI;
766
767                 Assert(count < DL_MAX);
768
769                 s = newmenu_do1( NULL, TXT_DETAIL_CUSTOM, count, m, do_detail_level_menu_custom_menuset, s);
770         } while (s > -1);
771
772         set_custom_detail_vars();
773
774         #if defined(MACINTOSH) && defined(POLY_ACC)
775         if ( PAEnabled )
776                 pa_set_filtering( m[filtering_id].value );
777         #endif
778 }
779
780 #ifndef MACINTOSH
781 int Default_display_mode=0;
782 int Current_display_mode=0;
783 #else
784 int Default_display_mode=1;
785 int Current_display_mode=1;
786 #endif
787
788 extern int MenuHiresAvailable;
789
790 typedef struct {
791         int     VGA_mode;
792         short   w,h;
793         short   render_method;
794         short   flags;
795 } dmi;
796
797 dmi display_mode_info[7] = {
798                 #ifdef WINDOWS
799                         {SM95_320x200x8X, 320, 200, VR_NONE, VRF_ALLOW_COCKPIT},
800                         {SM95_640x480x8, 640, 480, VR_NONE, VRF_COMPATIBLE_MENUS+VRF_ALLOW_COCKPIT},
801                         {SM95_640x400x8, 640, 400, VR_NONE, VRF_COMPATIBLE_MENUS }, 
802                         {SM95_800x600x8, 800, 600, VR_NONE, VRF_COMPATIBLE_MENUS },
803                         {SM95_1024x768x8, 1024, 768, VR_NONE, VRF_COMPATIBLE_MENUS }, 
804                 #else
805                         {SM(320,200),    320,   200, VR_NONE, VRF_ALLOW_COCKPIT+VRF_COMPATIBLE_MENUS}, 
806                         {SM(640,480),    640, 480, VR_NONE, VRF_COMPATIBLE_MENUS+VRF_ALLOW_COCKPIT},
807                         {SM(320,400),    320, 400, VR_NONE, VRF_USE_PAGING},
808                         {SM(640,400),    640, 400, VR_NONE, VRF_COMPATIBLE_MENUS}, 
809                         {SM(800,600),    800, 600, VR_NONE, VRF_COMPATIBLE_MENUS}, 
810                         {SM(1024,768),  1024,   768, VR_NONE, VRF_COMPATIBLE_MENUS},    
811                         {SM(1280,1024),1280,1024, VR_NONE, VRF_COMPATIBLE_MENUS}, 
812                 #endif
813 };
814  
815 WIN(extern int DD_Emulation);
816
817
818 void set_display_mode(int mode)
819 {
820         dmi *dmi;
821
822         if ((Current_display_mode == -1)||(VR_render_mode != VR_NONE))  //special VR mode
823                 return;                                                         //...don't change
824
825         #if !defined(MACINTOSH) && !defined(WINDOWS)
826         if (0) // (mode >= 5 && !FindArg("-superhires"))
827                 mode = 4;
828         #endif
829
830         if (!MenuHiresAvailable && (mode != 2))
831                 mode = 0;
832
833 #ifndef WINDOWS
834
835         if (gr_check_mode(display_mode_info[mode].VGA_mode) != 0)               //can't do mode
836                 #ifndef MACINTOSH
837                 mode = 0;
838                 #else
839                 mode = 1;
840                 #endif
841
842         Current_display_mode = mode;
843 #else
844         if (mode == 2) mode = 3;                                        // 320x400 -> 640x400.
845         Current_display_mode = mode;
846         if (mode >= 3) mode--;                                          // Match to Windows dmi.
847         if (DDCheckMode(display_mode_info[mode].VGA_mode)) {
848                 if (Platform_system == WINNT_PLATFORM || DD_Emulation) mode = 1;
849                 else mode = 0;
850                 Current_display_mode = mode;
851         }
852 #endif
853
854         dmi = &display_mode_info[mode];
855
856         if (Current_display_mode != -1) {
857
858                 game_init_render_buffers(dmi->VGA_mode,dmi->w,dmi->h,dmi->render_method,dmi->flags);
859                 Default_display_mode = Current_display_mode;
860         }
861
862         Screen_mode = -1;               //force screen reset
863 }
864
865 #ifdef MACINTOSH        // use Mac version of do_screen_res_menu
866
867 void do_screen_res_menu()
868 {
869         #define N_SCREENRES_ITEMS 6
870         
871         newmenu_item m[N_SCREENRES_ITEMS];
872         int citem, i, n_items, odisplay_mode, result;
873
874         if ((Current_display_mode == -1)||(VR_render_mode != VR_NONE))          //special VR mode
875         {                               
876                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
877                                 "You may not change screen\n"
878                                 "resolution when VR modes enabled.");
879                 return;
880         }
881
882         m[0].type=NM_TYPE_TEXT;  m[0].value=0; m[0].text="Modes w/ Cockpit:";
883         m[1].type=NM_TYPE_RADIO; m[1].value=0; m[1].group=0; m[1].text=" 640x480";
884         m[2].type=NM_TYPE_TEXT;  m[2].value=0; m[2].text="Modes w/o Cockpit:";
885         m[3].type=NM_TYPE_RADIO; m[3].value=0; m[3].group=0; m[3].text=" 800x600";
886 //      m[4].type=NM_TYPE_RADIO; m[4].value=0; m[4].group=0; m[4].text=" 1024x768";
887 //      m[5].type=NM_TYPE_RADIO; m[5].value=0; m[5].group=0; m[5].text=" 1280x1024";
888         n_items = 4;
889
890         odisplay_mode = VGA_current_mode;
891         citem = Current_display_mode;
892         if (Current_display_mode >= 2)
893                 citem--;
894
895         if (citem >= n_items)
896                 citem = n_items-1;
897
898         m[citem].value = 1;
899
900         newmenu_do1( NULL, "Select screen mode", n_items, m, NULL, citem);
901
902         for (i=0;i<n_items;i++)
903                 if (m[i].value)
904                         break;
905         if (i >= 3)
906                 i++;
907
908 #if 0 //def SHAREWARE
909         if (i > 1)
910                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
911                         "High resolution modes are\n"
912                         "only available in the\n"
913                         "Commercial version of Descent 2.");
914         return;
915 #else
916         result = vga_check_mode(display_mode_info[i].VGA_mode);
917         
918         if (result) {
919                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
920                                 "Cannot set requested\n"
921                                 "mode on this video card.");
922                 return;
923         }
924         
925         set_display_mode(i);
926         reset_cockpit();
927 #endif
928
929 }
930
931 #else   // PC version of do_screen_res_menu is below
932
933 void do_screen_res_menu()
934 {
935 #ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
936 #define N_SCREENRES_ITEMS 10
937         int fullscreenc;
938 #else
939         #define N_SCREENRES_ITEMS 9
940 #endif
941         newmenu_item m[N_SCREENRES_ITEMS];
942         int citem;
943         int i;
944         int n_items;
945
946         if ((Current_display_mode == -1)||(VR_render_mode != VR_NONE)) {                                //special VR mode
947                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
948                                 "You may not change screen\n"
949                                 "resolution when VR modes enabled.");
950                 return;
951         }
952
953         m[0].type=NM_TYPE_TEXT;  m[0].value=0;                            m[0].text="Modes w/ Cockpit:";
954         
955 #ifdef WINDOWS
956         if (Platform_system == WINNT_PLATFORM || DD_Emulation) {
957                 m[1].type=NM_TYPE_TEXT; m[1].value=0; m[1].text=" 320x200 N/A";
958         } else
959 #endif
960                 //NOTE LINK TO ABOVE IF
961                 m[1].type=NM_TYPE_RADIO; m[1].value=0; m[1].group=0; m[1].text=" 320x200";
962
963         m[2].type=NM_TYPE_RADIO; m[2].value=0; m[2].group=0; m[2].text=" 640x480";
964         m[3].type=NM_TYPE_TEXT;  m[3].value=0;                                    m[3].text="Modes w/o Cockpit:";
965 #ifdef WINDOWS
966         m[4].type=NM_TYPE_RADIO; m[4].value=0; m[4].group=0; m[4].text=" 640x400";
967         m[5].type=NM_TYPE_RADIO; m[5].value=0; m[5].group=0; m[5].text=" 800x600";
968 //      m[6].type=NM_TYPE_RADIO; m[6].value=0; m[6].group=0; m[6].text=" 1024x768";
969         n_items = 6;
970 #else
971         m[4].type=NM_TYPE_RADIO; m[4].value=0; m[4].group=0; m[4].text=" 320x400";
972         m[5].type=NM_TYPE_RADIO; m[5].value=0; m[5].group=0; m[5].text=" 640x400";
973         m[6].type=NM_TYPE_RADIO; m[6].value=0; m[6].group=0; m[6].text=" 800x600";
974         n_items = 7;
975         if (1) { //(FindArg("-superhires")) {
976                 m[7].type=NM_TYPE_RADIO; m[7].value=0; m[7].group=0; m[7].text=" 1024x768";
977                 m[8].type=NM_TYPE_RADIO; m[8].value=0; m[8].group=0; m[8].text=" 1280x1024";
978                 n_items += 2;
979         }
980 #endif
981
982 #ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
983         m[n_items].type = NM_TYPE_CHECK; m[n_items].text = "Fullscreen";
984         m[n_items].value = gr_check_fullscreen();
985         fullscreenc=n_items++;
986 #endif
987
988         citem = Current_display_mode+1;
989         
990 #ifdef WINDOWS
991         if (citem == 3) citem++;                                // if 320x400 in DOS, make it look like 640x400
992 #else
993         if (Current_display_mode >= 2)
994                 citem++;
995 #endif
996
997         if (citem >= n_items)
998                 citem = n_items-1;
999
1000         m[citem].value = 1;
1001
1002         newmenu_do1( NULL, "Select screen mode", n_items, m, NULL, citem);
1003
1004 #ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
1005         if (m[fullscreenc].value != gr_check_fullscreen()){
1006             gr_toggle_fullscreen();
1007         }
1008 #endif
1009
1010         for (i=0;i<n_items;i++)
1011                 if (m[i].value)
1012                         break;
1013
1014 #ifndef WINDOWS                                                                 // if i >= 4 keep it that way since we skip 320x400
1015         if (i >= 4)
1016                 i--;
1017 #endif
1018
1019         i--;
1020
1021 #ifndef WINDOWS
1022         if (((i != 0) && (i != 2) && !MenuHiresAvailable) || gr_check_mode(display_mode_info[i].VGA_mode)) {
1023                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
1024                                 "Cannot set requested\n"
1025                                 "mode on this video card.");
1026                 return;
1027         }
1028 #else
1029         if (i >= 3) 
1030                 result = DDCheckMode(display_mode_info[i-1].VGA_mode);
1031         else 
1032                 result = DDCheckMode(display_mode_info[i].VGA_mode);
1033
1034         if (result) {
1035                 nm_messagebox(TXT_SORRY, 1, TXT_OK, 
1036                                 "Mode not supported by your\n"
1037                                 "DirectDraw driver.\n", 
1038                                 "Using default mode for gameplay.\n");
1039                 return;
1040         }
1041
1042 #endif
1043 #ifdef SHAREWARE
1044                 if (i != 0)
1045                         nm_messagebox(TXT_SORRY, 1, TXT_OK, 
1046                                 "High resolution modes are\n"
1047                                 "only available in the\n"
1048                                 "Commercial version of Descent 2.");
1049                 return;
1050 #else
1051                 if (i != Current_display_mode)
1052                         set_display_mode(i);
1053 #endif
1054
1055 }
1056 #endif  // end of PC version of do_screen_res_menu()
1057
1058
1059
1060 void do_new_game_menu()
1061 {
1062         int new_level_num,player_highest_level;
1063         int n_missions;
1064
1065         n_missions = build_mission_list(0);
1066
1067         if (n_missions <= 1) {
1068                 load_mission(0);
1069         } else {
1070                 int new_mission_num,i, default_mission;
1071                 char * m[MAX_MISSIONS];
1072
1073                 default_mission = 0;
1074                 for (i=0;i<n_missions;i++) {
1075                         m[i] = Mission_list[i].mission_name;
1076                         if ( !stricmp( m[i], config_last_mission ) )
1077                                 default_mission = i;
1078                 }
1079
1080                 new_mission_num = newmenu_listbox1( "New Game\n\nSelect mission", n_missions, m, 1, default_mission, NULL );
1081
1082                 if (new_mission_num == -1)
1083                         return;         //abort!
1084
1085                 strcpy(config_last_mission, m[new_mission_num]  );
1086
1087                 if (!load_mission(new_mission_num)) {
1088                         nm_messagebox( NULL, 1, TXT_OK, "Error in Mission file"); 
1089                         return;
1090                 }
1091         }
1092
1093         new_level_num = 1;
1094
1095         player_highest_level = get_highest_level();
1096
1097         if (player_highest_level > Last_level)
1098                 player_highest_level = Last_level;
1099
1100         if (player_highest_level > 1) {
1101                 newmenu_item m[4];
1102                 char info_text[80];
1103                 char num_text[10];
1104                 int choice;
1105                 int n_items;
1106
1107 try_again:
1108                 sprintf(info_text,"%s %d",TXT_START_ANY_LEVEL, player_highest_level);
1109
1110                 m[0].type=NM_TYPE_TEXT; m[0].text = info_text;
1111                 m[1].type=NM_TYPE_INPUT; m[1].text_len = 10; m[1].text = num_text;
1112                 n_items = 2;
1113
1114                 #ifdef WINDOWS
1115                 m[2].type = NM_TYPE_TEXT; m[2].text = "";
1116                 m[3].type = NM_TYPE_MENU; m[3].text = "          Ok";
1117                 n_items = 4;
1118                 #endif
1119
1120                 strcpy(num_text,"1");
1121
1122                 choice = newmenu_do( NULL, TXT_SELECT_START_LEV, n_items, m, NULL );
1123
1124                 if (choice==-1 || m[1].text[0]==0)
1125                         return;
1126
1127                 new_level_num = atoi(m[1].text);
1128
1129                 if (!(new_level_num>0 && new_level_num<=player_highest_level)) {
1130                         m[0].text = TXT_ENTER_TO_CONT;
1131                         nm_messagebox( NULL, 1, TXT_OK, TXT_INVALID_LEVEL); 
1132                         goto try_again;
1133                 }
1134         }
1135
1136         Difficulty_level = Player_default_difficulty;
1137
1138         if (!do_difficulty_menu())
1139                 return;
1140
1141         gr_palette_fade_out( gr_palette, 32, 0 );
1142         StartNewGame(new_level_num);
1143
1144 }
1145
1146 extern void GameLoop(int, int );
1147
1148 extern int Redbook_enabled;
1149
1150 void options_menuset(int nitems, newmenu_item * items, int *last_key, int citem )
1151 {
1152         if ( citem==5)
1153         {
1154                 gr_palette_set_gamma(items[5].value);
1155         }
1156
1157         nitems++;               //kill warning
1158         last_key++;             //kill warning
1159 }
1160
1161
1162 //added on 8/18/98 by Victor Rachels to add d1x options menu, maxfps setting
1163 //added/edited on 8/18/98 by Victor Rachels to set maxfps always on, max=80
1164 //added/edited on 9/7/98 by Victor Rachels to attempt dir browsing.  failed.
1165
1166 void d2x_options_menu_poll(int nitems, newmenu_item * menus, int * key, int citem)
1167 {
1168 }
1169
1170
1171 void d2x_options_menu()
1172 {
1173         newmenu_item m[14];
1174         int i=0;
1175         int opt = 0;
1176         int inputs, commands;
1177 #if 0
1178         int checks;
1179 #endif
1180
1181         char smaxfps[4];
1182 #if 0
1183         char shudmaxnumdisp[4];
1184         char thogdir[64];
1185         extern int gr_message_color_level;
1186
1187         sprintf(thogdir,AltHogDir);
1188 #endif
1189         sprintf(smaxfps,"%d",maxfps);
1190 #if 0
1191         sprintf(shudmaxnumdisp,"%d",HUD_max_num_disp);
1192
1193         m[opt].type = NM_TYPE_MENU;  m[opt].text = "Primary autoselect ordering...";   opt++;
1194         m[opt].type = NM_TYPE_MENU;  m[opt].text = "Secondary autoselect ordering..."; opt++;
1195 #endif
1196
1197 #ifdef D2X_KEYS
1198         //added on 2/4/99 by Victor Rachels for new key menu
1199         m[opt].type = NM_TYPE_MENU;  m[opt].text = "D2X Keys"; opt++;
1200         //end this section addition - VR
1201 #endif
1202
1203 #if 0
1204         //enabled 3/24/99 - Owen Evans
1205         m[opt].type = NM_TYPE_MENU;  m[opt].text = "Change Screen Resolution";         opt++;
1206         //end enabled stuff - OE
1207 #endif
1208
1209         commands=opt;
1210 #if 0
1211         //added on 2/2/99 by Victor Rachels for bans
1212 #ifdef NETWORK
1213         m[opt].type = NM_TYPE_MENU; m[opt].text = "Save bans now"; opt++;
1214 #endif
1215         //end this section addition - VR
1216 #endif // 0
1217
1218         m[opt].type = NM_TYPE_TEXT;  m[opt].text = "Maximum Framerate (1-80):";       opt++;
1219
1220
1221         inputs=opt;
1222         m[opt].type = NM_TYPE_INPUT; m[opt].text = smaxfps; m[opt].text_len=3;         opt++;
1223 #if 0
1224         m[opt].type = NM_TYPE_TEXT;  m[opt].text = "Mission Directory";                opt++;
1225         m[opt].type = NM_TYPE_INPUT; m[opt].text = thogdir; m[opt].text_len=64;        opt++;
1226         m[opt].type = NM_TYPE_TEXT;  m[opt].text = "Hud Messages lines (1-80):";       opt++;
1227         m[opt].type = NM_TYPE_INPUT; m[opt].text = shudmaxnumdisp; m[opt].text_len=3;  opt++;
1228         m[opt].type = NM_TYPE_SLIDER; m[opt].text = "Message colorization level"; m[opt].value=gr_message_color_level;m[opt].min_value=0;m[opt].max_value=3;  opt++;
1229         checks=opt;
1230 #ifdef __MSDOS__
1231         m[opt].type = NM_TYPE_CHECK; m[opt].text = "Joy is sidewinder"; m[opt].value=Joy_is_Sidewinder;  opt++;
1232 #endif
1233 #ifdef SUPPORTS_NICEFPS
1234         m[opt].type = NM_TYPE_CHECK; m[opt].text = "Nice FPS (free cpu cycles)"; m[opt].value = use_nice_fps; opt++;
1235 #endif
1236 #endif // 0
1237
1238         for(;;)
1239         {
1240                 i=newmenu_do1( NULL, "D2X options", opt, m, &d2x_options_menu_poll, i);
1241
1242                 if(i>-1)
1243                 {
1244             if(i<commands)
1245                         {
1246                                 switch(i)
1247                                 {
1248 #if 0
1249                                 case 0: reorder_primary(); break;
1250                                 case 1: reorder_secondary(); break;
1251 #endif
1252 #ifdef D2X_KEYS
1253                                         //added on 2/4/99 by Victor Rachels for new key menu
1254                                 case 0: kconfig(4, "D2X Keys"); break;
1255                                         //end this section addition - VR
1256 #endif
1257 #if 0
1258                                         //enabled 3/24/99 - Owen Evans
1259                                 case 3: change_res(); break;
1260                                         //end enabled stuff - OE
1261 #endif
1262                                 }
1263                         }
1264
1265 #if 0
1266             //added on 2/4/99 by Victor Rachels for bans
1267 #ifdef NETWORK
1268             if(i==commands+0)
1269                         {              
1270
1271                                 nm_messagebox(NULL,1,TXT_OK, "%i Bans saved",writebans());
1272
1273                         }
1274 #endif
1275             //end this section addition - VR
1276 #endif // 0
1277
1278             if(i == inputs+0)
1279                         {
1280                                 maxfps = atoi(smaxfps);
1281                 if(maxfps < 1 || maxfps>80)
1282                                 {
1283                                         nm_messagebox(TXT_ERROR, 1, TXT_OK, "Invalid value for maximum framerate");
1284                                         maxfps = 80;
1285                                         i = (inputs+0);
1286                                 }
1287                         }
1288 #if 0
1289             else if(i==inputs+2)
1290                                 cfile_use_alternate_hogdir(thogdir);
1291                         else if(i==inputs+4)
1292                         {
1293                                 HUD_max_num_disp = atoi(shudmaxnumdisp);
1294                 if(HUD_max_num_disp < 1||HUD_max_num_disp>HUD_MAX_NUM)
1295                                 {
1296                                         nm_messagebox(TXT_ERROR, 1, TXT_OK, "Invalid value for hud lines");
1297                                         HUD_max_num_disp=4;
1298                                         //                   i=(inputs+4);//???
1299                                 }
1300                         }
1301                         gr_message_color_level=m[inputs+5].value;
1302
1303                         sprintf(shudmaxnumdisp,"%d",HUD_max_num_disp);
1304 #endif // 0
1305                         sprintf(smaxfps,"%d",maxfps);
1306                         //           m[inputs+0].text=smaxfps;//redundant.. its not going anywhere
1307 #if 0
1308                         sprintf(thogdir,AltHogDir);
1309                         //           m[inputs+2].text=thogdir;//redundant
1310 #endif
1311                 }
1312                 else
1313                         break;
1314         }
1315
1316 #if 0
1317         write_player_file();
1318
1319 #ifdef __MSDOS__
1320         Joy_is_Sidewinder=m[(checks+0)].value;
1321 #endif
1322 #ifdef __LINUX__
1323         Joy_is_Sidewinder=0;
1324 #endif
1325 #ifdef SUPPORTS_NICEFPS
1326         use_nice_fps=m[(checks+0)].value;
1327 #else
1328         use_nice_fps=0;
1329 #endif
1330 #endif // 0
1331 }
1332
1333 //end edit - Victor Rachels
1334 //end addition - Victor Rachels
1335
1336
1337 void do_options_menu()
1338 {
1339         newmenu_item m[13];
1340         int i = 0;
1341
1342         do {
1343                 m[ 0].type = NM_TYPE_MENU;   m[ 0].text="Sound effects & music...";
1344                 m[ 1].type = NM_TYPE_TEXT;   m[ 1].text="";
1345                 #if defined(MACINTOSH) && defined(APPLE_DEMO)
1346                 m [2].type = NM_TYPE_TEXT;   m[ 2].text="";
1347                 #else
1348                 m[ 2].type = NM_TYPE_MENU;   m[ 2].text=TXT_CONTROLS_;
1349                 #endif
1350         #ifdef WINDOWS
1351                 m[ 3].type = NM_TYPE_MENU;   m[ 3].text="INVOKE JOYSTICK CONTROL PANEL";
1352         #else
1353                 m[ 3].type = NM_TYPE_MENU;   m[ 3].text=TXT_CAL_JOYSTICK;
1354         #endif
1355                 m[ 4].type = NM_TYPE_TEXT;   m[ 4].text="";
1356
1357 #if defined(POLY_ACC)
1358         #ifdef MACINTOSH
1359
1360                 if ( !PAEnabled )
1361                 {
1362                         m[5].type               = NM_TYPE_SLIDER;
1363                         m[5].text               = TXT_BRIGHTNESS;
1364                         m[5].value              = gr_palette_get_gamma();
1365                         m[5].min_value  = 0;
1366                         m[5].max_value  = 8; 
1367                 }
1368                 else
1369                 {
1370                         m[ 5].type = NM_TYPE_TEXT;   m[ 5].text="";
1371                 }
1372         
1373         #else
1374                 m[ 5].type = NM_TYPE_TEXT;   m[ 5].text="";
1375         #endif
1376 #else
1377                 m[5].type = NM_TYPE_SLIDER;
1378                 m[5].text = TXT_BRIGHTNESS;
1379                 m[5].value = gr_palette_get_gamma();
1380                 m[5].min_value = 0;
1381                 m[5].max_value = 16; // CCA too dim, was 8;
1382 #endif
1383
1384
1385 #ifdef PA_3DFX_VOODOO
1386                 m[ 6].type = NM_TYPE_TEXT;   m[ 6].text="";
1387 #else
1388                 m[ 6].type = NM_TYPE_MENU;   m[ 6].text=TXT_DETAIL_LEVELS;
1389 #endif
1390
1391 #if defined(POLY_ACC)
1392                 m[ 7].type = NM_TYPE_TEXT;   m[ 7].text="";
1393 #else
1394                 #ifdef MACINTOSH
1395                         if ( gConfigInfo.mChangeResolution && !PAEnabled )
1396                         {
1397                                 m[ 7].type = NM_TYPE_MENU;   m[ 7].text="Screen resolution...";
1398                         }
1399                         else    // for when we are on a mac and no resolution switching allowed
1400                         {
1401                                 m[ 7].type = NM_TYPE_TEXT;   m[ 7].text="";
1402                         }
1403                 #else   // for PC's
1404                         m[ 7].type = NM_TYPE_MENU;   m[ 7].text="Screen resolution...";
1405                 #endif  // end of #ifdef macintosh
1406
1407 #endif
1408
1409                 m[ 8].type = NM_TYPE_TEXT;   m[ 8].text="";
1410                 m[ 9].type = NM_TYPE_MENU;   m[ 9].text="Primary autoselect ordering...";
1411                 m[10].type = NM_TYPE_MENU;   m[10].text="Secondary autoselect ordering...";
1412                 m[11].type = NM_TYPE_MENU;   m[11].text="Toggles...";
1413
1414                 m[12].type = NM_TYPE_MENU;   m[12].text="D2X options...";
1415
1416                 i = newmenu_do1( NULL, TXT_OPTIONS, sizeof(m)/sizeof(*m), m, options_menuset, i );
1417                         
1418                 switch(i)       {
1419                         case  0: do_sound_menu();                       break;
1420                         case  2: joydefs_config();                      break;
1421                         case  3: joydefs_calibrate();           break;
1422                         case  6: do_detail_level_menu();        break;
1423                         case  7: do_screen_res_menu();          break;
1424                         case  9: ReorderPrimary();                      break;
1425                         case 10: ReorderSecondary();            break;
1426                         case 11: do_toggles_menu();                     break;
1427                         case 12: d2x_options_menu();        break;
1428                 }
1429
1430         } while( i>-1 );
1431
1432         write_player_file();
1433 }
1434
1435 extern int Redbook_playing;
1436 void set_redbook_volume(int volume);
1437
1438 WIN(extern int RBCDROM_State);
1439 WIN(static BOOL windigi_driver_off=FALSE);
1440
1441 void sound_menuset(int nitems, newmenu_item * items, int *last_key, int citem )
1442 {
1443         nitems=nitems;          
1444         *last_key = *last_key;
1445
1446         if ( Config_digi_volume != items[0].value )     {
1447                 Config_digi_volume = items[0].value;
1448
1449                 #ifdef WINDOWS
1450                         if (windigi_driver_off) {
1451                                 digi_midi_wait();
1452                                 digi_init_digi();
1453                                 Sleep(500);
1454                                 windigi_driver_off = FALSE;
1455                         }
1456                 #endif                  
1457                 
1458                 #ifndef MACINTOSH
1459                         digi_set_digi_volume( (Config_digi_volume*32768)/8 );
1460                 #else
1461                         digi_set_digi_volume( (Config_digi_volume*256)/8 );
1462                 #endif
1463                 digi_play_sample_once( SOUND_DROP_BOMB, F1_0 );
1464         }
1465
1466 #ifdef WINDOWS
1467         if (!wmidi_support_volchange()) {
1468                 if (!items[1].value && Config_midi_volume) {
1469                         Config_midi_volume = 0;
1470                         digi_set_midi_volume(0);
1471                         digi_play_midi_song( NULL, NULL, NULL, 0 );
1472                 }
1473                 else if (Config_midi_volume == 0 && items[1].value) {
1474                         digi_set_midi_volume(64);
1475                         Config_midi_volume = 4;
1476                 }
1477         }
1478         else     // LINK TO BELOW IF
1479 #endif
1480         if (Config_midi_volume != items[1].value )   {
1481                 Config_midi_volume = items[1].value;
1482                 #ifdef WINDOWS
1483                         if (!windigi_driver_off) {
1484                                 Sleep(200);
1485                                 digi_close_digi();
1486                                 Sleep(100);
1487                                 windigi_driver_off = TRUE;
1488                         }
1489                 #endif
1490                 #ifndef MACINTOSH
1491                         digi_set_midi_volume( (Config_midi_volume*128)/8 );
1492                 #else
1493                         digi_set_midi_volume( (Config_midi_volume*256)/8 );
1494                 #endif
1495         }
1496 #ifdef MACINTOSH
1497         if (Config_master_volume != items[3].value ) {
1498                 Config_master_volume = items[3].value;
1499                 digi_set_master_volume( Config_master_volume );
1500                 digi_play_sample_once( SOUND_DROP_BOMB, F1_0 );
1501         }
1502 #endif
1503
1504         // don't enable redbook for a non-apple demo version of the shareware demo
1505         #if !defined(SHAREWARE) || ( defined(SHAREWARE) && defined(APPLE_DEMO) )
1506
1507         if (Config_redbook_volume != items[2].value )   {
1508                 Config_redbook_volume = items[2].value;
1509                 set_redbook_volume(Config_redbook_volume);
1510         }
1511
1512         if (items[4].value != (Redbook_playing!=0)) {
1513
1514                 if (items[4].value && FindArg("-noredbook")) {
1515                         nm_messagebox (TXT_SORRY,1,TXT_OK,"Redbook audio has been disabled\non the command line");
1516                         items[4].value = 0;
1517                         items[4].redraw = 1;
1518                 }
1519                 else {
1520                         Redbook_enabled = items[4].value;
1521
1522                         mprintf((1, "Redbook_enabled = %d\n", Redbook_enabled));
1523
1524                         if (Function_mode == FMODE_MENU)
1525                                 songs_play_song(SONG_TITLE,1);
1526                         else if (Function_mode == FMODE_GAME)
1527                                 songs_play_level_song( Current_level_num );
1528                         else
1529                                 Int3();
1530
1531                         if (items[4].value && !Redbook_playing) {
1532                         #ifdef WINDOWS
1533                                 if (RBCDROM_State == -1) 
1534                                         nm_messagebox (TXT_SORRY,1,TXT_OK,"Cannot start CD Music.\nAnother application is\nusing the CD player.\n");
1535                                 else // link to next code line!
1536                         #endif
1537                                 nm_messagebox (TXT_SORRY,1,TXT_OK,"Cannot start CD Music.  Insert\nyour Descent II CD and try again");
1538                                 items[4].value = 0;
1539                                 items[4].redraw = 1;
1540                         }
1541
1542                         items[1].type = (Redbook_playing?NM_TYPE_TEXT:NM_TYPE_SLIDER);
1543                         items[1].redraw = 1;
1544                         items[2].type = (Redbook_playing?NM_TYPE_SLIDER:NM_TYPE_TEXT);
1545                         items[2].redraw = 1;
1546
1547                 }
1548         }
1549
1550         #endif
1551
1552         citem++;                //kill warning
1553 }
1554
1555 void do_sound_menu()
1556 {
1557    newmenu_item m[6];
1558         int i = 0;
1559
1560  #ifdef WINDOWS
1561         extern BOOL DIGIDriverInit;
1562         if (!DIGIDriverInit) windigi_driver_off = TRUE;
1563         else windigi_driver_off = FALSE;
1564  #endif
1565
1566         do {
1567                 m[ 0].type = NM_TYPE_SLIDER; m[ 0].text=TXT_FX_VOLUME; m[0].value=Config_digi_volume;m[0].min_value=0; m[0].max_value=8; 
1568                 m[ 1].type = (Redbook_playing?NM_TYPE_TEXT:NM_TYPE_SLIDER); m[ 1].text="MIDI music volume"; m[1].value=Config_midi_volume;m[1].min_value=0; m[1].max_value=8;
1569
1570         #ifdef WINDOWS
1571                 if (!wmidi_support_volchange() && !Redbook_playing) {
1572                         m[1].type = NM_TYPE_CHECK;
1573                         m[1].text = "MIDI MUSIC";
1574                         if (Config_midi_volume) m[1].value = 1;
1575                 }
1576         #endif
1577
1578                 #ifdef SHAREWARE
1579                         m[ 2].type = NM_TYPE_TEXT; m[ 2].text="";
1580                         m[ 3].type = NM_TYPE_TEXT; m[ 3].text="";
1581                         m[ 4].type = NM_TYPE_TEXT; m[ 4].text="";
1582                         #ifdef MACINTOSH
1583                                 m[ 3].type = NM_TYPE_SLIDER; m[ 3].text="Sound Manager Volume"; m[3].value=Config_master_volume;m[3].min_value=0; m[3].max_value=8;
1584
1585                                 #ifdef APPLE_DEMO
1586                                         m[ 2].type = (Redbook_playing?NM_TYPE_SLIDER:NM_TYPE_TEXT); m[ 2].text="CD music volume"; m[2].value=Config_redbook_volume;m[2].min_value=0; m[2].max_value=8;
1587                                         m[ 4].type = NM_TYPE_CHECK;  m[ 4].text="CD Music (Redbook) enabled"; m[4].value=(Redbook_playing!=0);
1588                                 #endif
1589
1590                         #endif
1591
1592                 #else           // ifdef SHAREWARE
1593                         m[ 2].type = (Redbook_playing?NM_TYPE_SLIDER:NM_TYPE_TEXT); m[ 2].text="CD music volume"; m[2].value=Config_redbook_volume;m[2].min_value=0; m[2].max_value=8;
1594
1595                         #ifndef MACINTOSH
1596                                 m[ 3].type = NM_TYPE_TEXT; m[ 3].text="";
1597                         #else
1598                                 m[ 3].type = NM_TYPE_SLIDER; m[ 3].text="Sound Manager Volume"; m[3].value=Config_master_volume;m[3].min_value=0; m[3].max_value=8; 
1599                         #endif
1600                 
1601                         m[ 4].type = NM_TYPE_CHECK;  m[ 4].text="CD Music (Redbook) enabled"; m[4].value=(Redbook_playing!=0);
1602                 #endif
1603         
1604                 m[ 5].type = NM_TYPE_CHECK;  m[ 5].text=TXT_REVERSE_STEREO; m[5].value=Config_channels_reversed; 
1605                                 
1606                 i = newmenu_do1( NULL, "Sound Effects & Music", sizeof(m)/sizeof(*m), m, sound_menuset, i );
1607
1608                 Redbook_enabled = m[4].value;
1609                 Config_channels_reversed = m[5].value;
1610
1611         } while( i>-1 );
1612
1613 #ifdef WINDOWS
1614         if (windigi_driver_off) {
1615                 digi_midi_wait();
1616                 Sleep(500);
1617                 digi_init_digi();
1618                 windigi_driver_off=FALSE;
1619         }
1620 #endif
1621
1622
1623         if ( Config_midi_volume < 1 )   {
1624                 #ifndef MACINTOSH
1625                         digi_play_midi_song( NULL, NULL, NULL, 0 );
1626                 #else
1627                         digi_play_midi_song(-1, 0);
1628                 #endif
1629         }
1630
1631 }
1632
1633
1634 extern int Automap_always_hires;
1635
1636 #define ADD_CHECK(n,txt,v)  do { m[n].type=NM_TYPE_CHECK; m[n].text=txt; m[n].value=v;} while (0)
1637
1638 void do_toggles_menu()
1639 {
1640 #ifndef MACINTOSH
1641 #if defined(POLY_ACC)
1642         #define N_TOGGLE_ITEMS 6        // get rid of automap hi-res.
1643 #else
1644         #define N_TOGGLE_ITEMS 7
1645 #endif
1646 #else
1647         #define N_TOGGLE_ITEMS 7
1648 #endif
1649         newmenu_item m[N_TOGGLE_ITEMS];
1650         int i = 0;
1651
1652         do {
1653                 #if defined(MACINTOSH) && defined(USE_ISP)
1654                         if (ISpEnabled())
1655                         {
1656                                 m[0].type = NM_TYPE_TEXT; m[0].text = "";
1657                         }
1658                         else
1659                         {
1660                                 ADD_CHECK(0, "Ship auto-leveling", Auto_leveling_on);
1661                         }
1662                 #else 
1663                         ADD_CHECK(0, "Ship auto-leveling", Auto_leveling_on);
1664                 #endif
1665                 ADD_CHECK(1, "Show reticle", Reticle_on);
1666                 ADD_CHECK(2, "Missile view", Missile_view_enabled);
1667                 ADD_CHECK(3, "Headlight on when picked up", Headlight_active_default );
1668                 ADD_CHECK(4, "Show guided missile in main display", Guided_in_big_window );
1669                 ADD_CHECK(5, "Escort robot hot keys",EscortHotKeys);
1670                 #ifdef MACINTOSH
1671                         if ( !PAEnabled ) {
1672                                 ADD_CHECK(6, "Pixel Double", Scanline_double);
1673                         }
1674                 #else
1675 #if !defined(POLY_ACC)
1676                         ADD_CHECK(6, "Always show HighRes Automap", min(MenuHiresAvailable,Automap_always_hires));
1677 #endif
1678                 #endif
1679                 //when adding more options, change N_TOGGLE_ITEMS above
1680
1681                 #ifdef MACINTOSH
1682                 if ( PAEnabled )                // when doing RAVE, no pixel doubling
1683                         i = newmenu_do1( NULL, "Toggles", N_TOGGLE_ITEMS-1, m, NULL, i );
1684                 else
1685                 #endif          // note link to if
1686                         i = newmenu_do1( NULL, "Toggles", N_TOGGLE_ITEMS, m, NULL, i );
1687                         
1688                 Auto_leveling_on                        = m[0].value;
1689                 Reticle_on                                      = m[1].value;
1690                 Missile_view_enabled            = m[2].value;
1691                 Headlight_active_default        = m[3].value;
1692                 Guided_in_big_window            = m[4].value;
1693                 EscortHotKeys                           = m[5].value;
1694
1695
1696                 #ifdef MACINTOSH
1697                         if ( !PAEnabled )
1698                                 Scanline_double = m[6].value;
1699                 #else
1700 #if !defined(POLY_ACC)
1701                         if (MenuHiresAvailable)
1702                                 Automap_always_hires = m[6].value;
1703                         else if (m[6].value)
1704                                 nm_messagebox(TXT_SORRY,1,"OK","High Resolution modes are\nnot available on this video card");
1705 #endif
1706                 #endif
1707
1708         } while( i>-1 );
1709
1710 }
1711
1712 #ifdef NETWORK
1713 void do_multi_player_menu()
1714 {
1715         int menu_choice[9];
1716         newmenu_item m[9];
1717         int choice = 0, num_options = 0;
1718         int old_game_mode;
1719
1720         do {
1721 //              WIN(ipx_destroy_read_thread());
1722
1723                 old_game_mode = Game_mode;
1724                 num_options = 0;
1725
1726 #ifdef NATIVE_IPX
1727                 ADD_ITEM(TXT_START_IPX_NET_GAME, MENU_START_IPX_NETGAME, -1);
1728                 ADD_ITEM(TXT_JOIN_IPX_NET_GAME, MENU_JOIN_IPX_NETGAME, -1);
1729 #endif //NATIVE_IPX
1730                 //ADD_ITEM(TXT_START_TCP_NET_GAME, MENU_START_TCP_NETGAME, -1);
1731                 //ADD_ITEM(TXT_JOIN_TCP_NET_GAME, MENU_JOIN_TCP_NETGAME, -1);
1732                 ADD_ITEM("Start UDP/IP Netgame", MENU_START_UDP_NETGAME, -1);
1733                 ADD_ITEM("Join UDP/IP Netgame\n", MENU_JOIN_UDP_NETGAME, -1);
1734                 ADD_ITEM("Start Multicast UDP/IP Netgame", MENU_START_MCAST4_NETGAME, -1);
1735                 ADD_ITEM("Join Multicast UDP/IP Netgame\n", MENU_JOIN_MCAST4_NETGAME, -1);
1736 #ifdef __unix__
1737                 ADD_ITEM("Start Kali Netgame", MENU_START_KALI_NETGAME, -1);
1738                 ADD_ITEM("Join Kali Netgame\n", MENU_JOIN_KALI_NETGAME, -1);
1739 #endif //__unix__
1740
1741 #ifdef MACINTOSH
1742                 ADD_ITEM("Start Appletalk Netgame", MENU_START_APPLETALK_NETGAME, -1 );
1743                 ADD_ITEM("Join Appletalk Netgame\n", MENU_JOIN_APPLETALK_NETGAME, -1 );
1744 #endif
1745
1746                 ADD_ITEM(TXT_MODEM_GAME, MENU_START_SERIAL, -1);
1747
1748                 choice = newmenu_do1( NULL, TXT_MULTIPLAYER, num_options, m, NULL, choice );
1749                 
1750                 if ( choice > -1 )      
1751                         do_option(menu_choice[choice]);
1752         
1753                 if (old_game_mode != Game_mode)
1754                         break;          // leave menu
1755
1756         } while( choice > -1 );
1757
1758 }
1759
1760 /*
1761  * ipx_set_driver was called do_network_init and located in main/inferno
1762  * before the change which allows the user to choose the network driver
1763  * from the game menu instead of having to supply command line args.
1764  */
1765 void ipx_set_driver(int ipx_driver)
1766 {
1767         ipx_close();
1768
1769         if (!FindArg("-nonetwork")) {
1770                 int ipx_error;
1771                 int socket = 0, t;
1772
1773                 con_printf(CON_VERBOSE, "\n%s ", TXT_INITIALIZING_NETWORK);
1774
1775                 if ((t = FindArg("-socket")))
1776                         socket = atoi(Args[t + 1]);
1777
1778                 arch_ipx_set_driver(ipx_driver);
1779
1780                 if ((ipx_error = ipx_init(IPX_DEFAULT_SOCKET + socket)) == IPX_INIT_OK) {
1781                         con_printf(CON_VERBOSE, "%s %d.\n", TXT_IPX_CHANNEL, socket );
1782                         Network_active = 1;
1783                 } else {
1784                         switch(ipx_error) {
1785                         case IPX_NOT_INSTALLED: con_printf(CON_VERBOSE, "%s\n", TXT_NO_NETWORK); break;
1786                         case IPX_SOCKET_TABLE_FULL: con_printf(CON_VERBOSE, "%s 0x%x.\n", TXT_SOCKET_ERROR, IPX_DEFAULT_SOCKET+socket); break;
1787                         case IPX_NO_LOW_DOS_MEM: con_printf(CON_VERBOSE, "%s\n", TXT_MEMORY_IPX ); break;
1788                         default: con_printf(CON_VERBOSE, "%s %d", TXT_ERROR_IPX, ipx_error );
1789                         }
1790                         con_printf(CON_VERBOSE, "%s\n",TXT_NETWORK_DISABLED);
1791                         Network_active = 0;             // Assume no network
1792                 }
1793                 ipx_read_user_file("descent.usr");
1794                 ipx_read_network_file("descent.net");
1795                 //@@if (FindArg("-dynamicsockets"))
1796                 //@@    Network_allow_socket_changes = 1;
1797                 //@@else
1798                 //@@    Network_allow_socket_changes = 0;
1799         } else {
1800                 con_printf(CON_VERBOSE, "%s\n", TXT_NETWORK_DISABLED);
1801                 Network_active = 0;             // Assume no network
1802         }
1803 }
1804
1805 void DoNewIPAddress ()
1806  {
1807   newmenu_item m[4];
1808   char IPText[30];
1809   int choice;
1810
1811   m[0].type=NM_TYPE_TEXT; m[0].text = "Enter an address or hostname:";
1812   m[1].type=NM_TYPE_INPUT; m[1].text_len = 50; m[1].text = IPText;
1813   IPText[0]=0;
1814
1815   choice = newmenu_do( NULL, "Join a TCPIP game", 2, m, NULL );
1816
1817   if (choice==-1 || m[1].text[0]==0)
1818    return;
1819
1820   nm_messagebox (TXT_SORRY,1,TXT_OK,"That address is not valid!");
1821  }
1822
1823 #endif // NETWORK