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