]> git.mxchange.org Git - flightgear.git/blob - Main/options.cxx
d889c7bbf92b894ad92a987839a46da90b1d48c7
[flightgear.git] / Main / options.cxx
1 // options.cxx -- class to handle command line options
2 //
3 // Written by Curtis Olson, started April 1998.
4 //
5 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28
29 #include <math.h>            // rint()
30 #include <stdio.h>
31 #include <stdlib.h>          // atof(), atoi()
32 #include <string.h>
33 #include <string>
34
35 #include <Debug/logstream.hxx>
36 #include <FDM/flight.hxx>
37 #include <Include/fg_constants.h>
38 #include <Main/options.hxx>
39 #include <Misc/fgstream.hxx>
40
41 #include "fg_serial.hxx"
42
43
44 inline double
45 atof( const string& str )
46 {
47     return ::atof( str.c_str() );
48 }
49
50 inline int
51 atoi( const string& str )
52 {
53     return ::atoi( str.c_str() );
54 }
55
56 // Defined the shared options class here
57 fgOPTIONS current_options;
58
59
60 // Constructor
61 fgOPTIONS::fgOPTIONS() :
62     // starting longitude in degrees (west = -)
63     // starting latitude in degrees (south = -)
64
65     // Default initial position is Globe, AZ (P13)
66     lon(-110.6642444),
67     lat(  33.3528917),
68
69     // North of the city of Globe
70     // lon(-110.7),
71     // lat(  33.4),
72
73     // North of the city of Globe
74     // lon(-110.742578),
75     // lat(  33.507122),
76
77     // Near where I used to live in Globe, AZ
78     // lon(-110.766000),
79     // lat(  33.377778),
80
81     // 10125 Jewell St. NE
82     // lon(-93.15),
83     // lat( 45.15),
84
85     // Near KHSP (Hot Springs, VA)
86     // lon(-79.8338964 + 0.01),
87     // lat( 37.9514564 + 0.008),
88
89     // (SEZ) SEDONA airport
90     // lon(-111.7884614 + 0.01),
91     // lat(  34.8486289 - 0.015),
92
93     // Jim Brennon's Kingmont Observatory
94     // lon(-121.1131667),
95     // lat(  38.8293917),
96
97     // Huaras, Peru (S09d 31.871'  W077d 31.498')
98     // lon(-77.5249667),
99     // lat( -9.5311833),
100  
101     // Eclipse Watching w73.5 n10 (approx) 18:00 UT
102     // lon(-73.5),
103     // lat( 10.0),
104
105     // Timms Hill (WI)
106     // lon(-90.1953055556),
107     // lat( 45.4511388889),
108
109     // starting altitude in meters (this will be reset to ground level
110     // if it is lower than the terrain
111     altitude(-9999.0),
112
113     // Initial Orientation
114     heading(270.0),      // heading (yaw) angle in degress (Psi)
115     roll(0.0),           // roll angle in degrees (Phi)
116     pitch(0.424),        // pitch angle in degrees (Theta)
117
118     // Miscellaneous
119     game_mode(0),
120     splash_screen(1),
121     intro_music(1),
122     mouse_pointer(0),
123     pause(0),
124
125     // Features
126     hud_status(1),
127     panel_status(0),
128     sound(1),
129
130     // Flight Model options
131     flight_model(FGState::FG_LARCSIM),
132
133     // Rendering options
134     fog(FG_FOG_NICEST),  // nicest
135     fov(55.0),
136     fullscreen(0),
137     shading(1),
138     skyblend(1),
139     textures(1),
140     wireframe(0),
141     xsize(640),
142     ysize(480),
143
144     // Scenery options
145     tile_diameter(5),
146
147     // HUD options
148     units(FG_UNITS_FEET),
149     tris_or_culled(0),
150         
151     // Time options
152     time_offset(0)
153
154 {
155     // set initial values/defaults
156     char* envp = ::getenv( "FG_ROOT" );
157
158     if ( envp != NULL ) {
159         // fg_root could be anywhere, so default to environmental
160         // variable $FG_ROOT if it is set.
161         fg_root = envp;
162     } else {
163         // Otherwise, default to a random compiled in location if
164         // $FG_ROOT is not set.  This can still be overridden from the
165         // command line or a config file.
166
167 #if defined(WIN32)
168         fg_root = "\\FlightGear";
169 #else
170         fg_root = "/usr/local/lib/FlightGear";
171 #endif
172     }
173
174     airport_id = "";  // default airport id
175
176     // initialize port config string list
177     port_options_list.erase ( port_options_list.begin(), 
178                               port_options_list.end() );
179 }
180
181
182 double
183 fgOPTIONS::parse_time(const string& time_in) {
184     char *time_str, num[256];
185     double hours, minutes, seconds;
186     double result = 0.0;
187     int sign = 1;
188     int i;
189
190     time_str = (char *)time_in.c_str();
191
192     // printf("parse_time(): %s\n", time_str);
193
194     // check for sign
195     if ( strlen(time_str) ) {
196         if ( time_str[0] == '+' ) {
197             sign = 1;
198             time_str++;
199         } else if ( time_str[0] == '-' ) {
200             sign = -1;
201             time_str++;
202         }
203     }
204     // printf("sign = %d\n", sign);
205
206     // get hours
207     if ( strlen(time_str) ) {
208         i = 0;
209         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
210             num[i] = time_str[0];
211             time_str++;
212             i++;
213         }
214         if ( time_str[0] == ':' ) {
215             time_str++;
216         }
217         num[i] = '\0';
218         hours = atof(num);
219         // printf("hours = %.2lf\n", hours);
220
221         result += hours;
222     }
223
224     // get minutes
225     if ( strlen(time_str) ) {
226         i = 0;
227         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
228             num[i] = time_str[0];
229             time_str++;
230             i++;
231         }
232         if ( time_str[0] == ':' ) {
233             time_str++;
234         }
235         num[i] = '\0';
236         minutes = atof(num);
237         // printf("minutes = %.2lf\n", minutes);
238
239         result += minutes / 60.0;
240     }
241
242     // get seconds
243     if ( strlen(time_str) ) {
244         i = 0;
245         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
246             num[i] = time_str[0];
247             time_str++;
248             i++;
249         }
250         num[i] = '\0';
251         seconds = atof(num);
252         // printf("seconds = %.2lf\n", seconds);
253
254         result += seconds / 3600.0;
255     }
256
257     return(sign * result);
258 }
259
260
261 // parse degree in the form of [+/-]hhh:mm:ss
262 double
263 fgOPTIONS::parse_degree( const string& degree_str) {
264     double result = parse_time( degree_str );
265
266     // printf("Degree = %.4f\n", result);
267
268     return(result);
269 }
270
271
272 // parse time offset command line option
273 int
274 fgOPTIONS::parse_time_offset( const string& time_str) {
275     int result;
276
277     // printf("time offset = %s\n", time_str);
278
279 #ifdef HAVE_RINT
280     result = (int)rint(parse_time(time_str) * 3600.0);
281 #else
282     result = (int)(parse_time(time_str) * 3600.0);
283 #endif
284
285     // printf("parse_time_offset(): %d\n", result);
286
287     return( result );
288 }
289
290
291 // Parse --tile-diameter=n type option 
292
293 int
294 fgOPTIONS::parse_tile_radius( const string& arg ) {
295     int radius = atoi( arg );
296
297     if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
298     if ( radius > FG_RADIUS_MAX ) { radius = FG_RADIUS_MAX; }
299
300     // printf("parse_tile_radius(): radius = %d\n", radius);
301
302     return(radius);
303 }
304
305
306 // Parse --flightmode=abcdefg type option 
307 int
308 fgOPTIONS::parse_flight_model( const string& fm ) {
309     // printf("flight model = %s\n", fm);
310
311     if ( fm == "slew" ) {
312         return FGState::FG_SLEW;
313     } else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
314         return FGState::FG_LARCSIM;
315     } else if ( fm == "external" ) {
316         return FGState::FG_EXTERNAL;
317     } else {
318         FG_LOG( FG_GENERAL, FG_ALERT, "Unknown flight model = " << fm );
319         exit(-1);
320     }
321
322     // we'll never get here, but it makes the compiler happy.
323     return -1;
324 }
325
326
327 // Parse --fov=x.xx type option 
328 double
329 fgOPTIONS::parse_fov( const string& arg ) {
330     double fov = atof(arg);
331
332     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
333     if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
334
335     // printf("parse_fov(): result = %.4f\n", fov);
336
337     return(fov);
338 }
339
340
341 // Parse serial port option --serial=/dev/ttyS1,nmea,4800,out
342 //
343 // Format is "--serial=device,format,baud,direction" where
344 // 
345 //  device = OS device name to be open()'ed
346 //  format = {nmea, fgfs}
347 //  baud = {300, 1200, 2400, ..., 230400}
348 //  direction = {in, out, bi}
349
350 bool 
351 fgOPTIONS::parse_serial( const string& serial_str ) {
352     string::size_type pos;
353
354     // cout << "Serial string = " << serial_str << endl;
355
356     // a flailing attempt to see if the port config string has a
357     // chance at being valid
358     pos = serial_str.find(",");
359     if ( pos == string::npos ) {
360         FG_LOG( FG_GENERAL, FG_ALERT, 
361                 "Malformed serial port configure string" );
362         return false;
363     }
364     
365     port_options_list.push_back( serial_str );
366
367     return true;
368 }
369
370
371 // Parse a single option
372 int fgOPTIONS::parse_option( const string& arg ) {
373     // General Options
374     if ( (arg == "--help") || (arg == "-h") ) {
375         // help/usage request
376         return(FG_OPTIONS_HELP);
377     } else if ( arg == "--disable-game-mode") {
378         game_mode = false;
379     } else if ( arg == "--enable-game-mode" ) {
380         game_mode = true;
381     } else if ( arg == "--disable-splash-screen" ) {
382         splash_screen = false;
383     } else if ( arg == "--enable-splash-screen" ) {
384         splash_screen = true;
385     } else if ( arg == "--disable-intro-music" ) {
386         intro_music = false;
387     } else if ( arg == "--enable-intro-music" ) {
388         intro_music = true;
389     } else if ( arg == "--disable-mouse-pointer" ) {
390         mouse_pointer = 1;
391     } else if ( arg == "--enable-mouse-pointer" ) {
392         mouse_pointer = 2;
393     } else if ( arg == "--disable-pause" ) {
394         pause = false;  
395     } else if ( arg == "--enable-pause" ) {
396         pause = true;   
397     } else if ( arg == "--disable-hud" ) {
398         hud_status = false;     
399     } else if ( arg == "--enable-hud" ) {
400         hud_status = true;      
401     } else if ( arg == "--disable-panel" ) {
402         panel_status = false;
403     } else if ( arg == "--enable-panel" ) {
404         panel_status = true;
405     } else if ( arg == "--disable-sound" ) {
406         sound = false;
407     } else if ( arg == "--enable-sound" ) {
408         sound = true;
409     } else if ( arg.find( "--airport-id=") != string::npos ) {
410         airport_id = arg.substr( 13 );
411     } else if ( arg.find( "--lon=" ) != string::npos ) {
412         lon = parse_degree( arg.substr(6) );
413     } else if ( arg.find( "--lat=" ) != string::npos ) {
414         lat = parse_degree( arg.substr(6) );
415     } else if ( arg.find( "--altitude=" ) != string::npos ) {
416         if ( units == FG_UNITS_FEET ) {
417             altitude = atof( arg.substr(11) ) * FEET_TO_METER;
418         } else {
419             altitude = atof( arg.substr(11) );
420         }
421     } else if ( arg.find( "--heading=" ) != string::npos ) {
422         heading = atof( arg.substr(10) );
423     } else if ( arg.find( "--roll=" ) != string::npos ) {
424         roll = atof( arg.substr(7) );
425     } else if ( arg.find( "--pitch=" ) != string::npos ) {
426         pitch = atof( arg.substr(8) );
427     } else if ( arg.find( "--fg-root=" ) != string::npos ) {
428         fg_root = arg.substr( 10 );
429     } else if ( arg.find( "--flight-model=" ) != string::npos ) {
430         flight_model = parse_flight_model( arg.substr(15) );
431     } else if ( arg == "--fog-disable" ) {
432         fog = FG_FOG_DISABLED;  
433     } else if ( arg == "--fog-fastest" ) {
434         fog = FG_FOG_FASTEST;   
435     } else if ( arg == "--fog-nicest" ) {
436         fog = FG_FOG_NICEST;    
437     } else if ( arg.find( "--fov=" ) != string::npos ) {
438         fov = parse_fov( arg.substr(6) );
439     } else if ( arg == "--disable-fullscreen" ) {
440         fullscreen = false;     
441     } else if ( arg== "--enable-fullscreen") {
442         fullscreen = true;      
443     } else if ( arg == "--shading-flat") {
444         shading = 0;    
445     } else if ( arg == "--shading-smooth") {
446         shading = 1;    
447     } else if ( arg == "--disable-skyblend") {
448         skyblend = false;       
449     } else if ( arg== "--enable-skyblend" ) {
450         skyblend = true;        
451     } else if ( arg == "--disable-textures" ) {
452         textures = false;       
453     } else if ( arg == "--enable-textures" ) {
454         textures = true;
455     } else if ( arg == "--disable-wireframe" ) {
456         wireframe = false;      
457     } else if ( arg == "--enable-wireframe" ) {
458         wireframe = true;
459     } else if ( arg.find( "--geometry=" ) != string::npos ) {
460         string geometry = arg.substr( 11 );
461         if ( geometry == "640x480" ) {
462             xsize = 640;
463             ysize = 480;
464         } else if ( geometry == "800x600" ) {
465             xsize = 800;
466             ysize = 600;
467         } else if ( geometry == "1024x768" ) {
468             xsize = 1024;
469             ysize = 768;
470         } else {
471             FG_LOG( FG_GENERAL, FG_ALERT, "Unknown geometry: " << geometry );
472             exit(-1);
473         }
474     } else if ( arg == "--units-feet" ) {
475         units = FG_UNITS_FEET;  
476     } else if ( arg == "--units-meters" ) {
477         units = FG_UNITS_METERS;        
478     } else if ( arg.find( "--tile-radius=" ) != string::npos ) {
479         tile_radius = parse_tile_radius( arg.substr(14) );
480         tile_diameter = tile_radius * 2 + 1;
481     } else if ( arg.find( "--time-offset=" ) != string::npos ) {
482         time_offset = parse_time_offset( (arg.substr(14)) );
483     } else if ( arg == "--hud-tris" ) {
484         tris_or_culled = 0;     
485     } else if ( arg == "--hud-culled" ) {
486         tris_or_culled = 1;
487     } else if ( arg.find( "--serial=" ) != string::npos ) {
488         parse_serial( arg.substr(9) );
489     } else {
490         FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
491         return FG_OPTIONS_ERROR;
492     }
493     
494     return FG_OPTIONS_OK;
495 }
496
497
498 // Parse the command line options
499 int fgOPTIONS::parse_command_line( int argc, char **argv ) {
500     int i = 1;
501     int result;
502
503     FG_LOG(FG_GENERAL, FG_INFO, "Processing command line arguments");
504
505     while ( i < argc ) {
506         FG_LOG( FG_GENERAL, FG_DEBUG, "argv[" << i << "] = " << argv[i] );
507
508         result = parse_option(argv[i]);
509         if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
510             return(result);
511         }
512
513         i++;
514     }
515     
516     return(FG_OPTIONS_OK);
517 }
518
519
520 // Parse config file options
521 int fgOPTIONS::parse_config_file( const string& path ) {
522     fg_gzifstream in( path );
523     if ( !in )
524         return(FG_OPTIONS_ERROR);
525
526     FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
527
528     in >> skipcomment;
529     while ( !in.eof() )
530     {
531         string line;
532         getline( in, line );
533
534         if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
535             FG_LOG( FG_GENERAL, FG_ALERT, 
536                     "Config file parse error: " << path << " '" 
537                     << line << "'" );
538             exit(-1);
539         }
540         in >> skipcomment;
541     }
542
543     return FG_OPTIONS_OK;
544 }
545
546
547 // Print usage message
548 void fgOPTIONS::usage ( void ) {
549     printf("Usage: fg [ options ... ]\n");
550     printf("\n");
551
552     printf("General Options:\n");
553     printf("\t--help -h:  print usage\n");
554     printf("\t--fg-root=path:  specify the root path for all the data files\n");
555     printf("\t--disable-game-mode:  disable full-screen game mode\n");
556     printf("\t--enable-game-mode:  enable full-screen game mode\n");
557     printf("\t--disable-splash-screen:  disable splash screen\n");
558     printf("\t--enable-splash-screen:  enable splash screen\n");
559     printf("\t--disable-intro-music:  disable introduction music\n");
560     printf("\t--enable-intro-music:  enable introduction music\n");
561     printf("\t--disable-mouse-pointer:  disable extra mouse pointer\n");
562     printf("\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for\n");
563     printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
564     printf("\t--disable-pause:  start out in an active state\n");
565     printf("\t--enable-pause:  start out in a paused state\n");
566     printf("\n");
567
568     printf("Features:\n");
569     printf("\t--disable-hud:  disable heads up display\n");
570     printf("\t--enable-hud:  enable heads up display\n");
571     printf("\t--disable-panel:  disable instrument panel\n");
572     printf("\t--enable-panel:  enable instrumetn panel\n");
573     printf("\t--disable-sound:  disable sound effects\n");
574     printf("\t--enable-sound:  enable sound effects\n");
575     printf("\n");
576  
577     printf("Flight Model:\n");
578     printf("\t--flight-mode=abcd:  one of slew, larcsim, or external\n");
579     printf("\n");
580
581     printf("Initial Position and Orientation:\n");
582     printf("\t--airport-id=ABCD:  specify starting postion by airport id\n");
583     printf("\t--lon=degrees:  starting longitude in degrees (west = -)\n");
584     printf("\t--lat=degrees:  starting latitude in degrees (south = -)\n");
585     printf("\t--altitude=feet:  starting altitude in feet\n");
586     printf("\t\t(unless --units-meters specified\n");
587     printf("\t--heading=degrees:  heading (yaw) angle in degress (Psi)\n");
588     printf("\t--roll=degrees:  roll angle in degrees (Phi)\n");
589     printf("\t--pitch=degrees:  pitch angle in degrees (Theta)\n");
590     printf("\n");
591
592     printf("Rendering Options:\n");
593     printf("\t--fog-disable:  disable fog/haze\n");
594     printf("\t--fog-fastest:  enable fastest fog/haze\n");
595     printf("\t--fog-nicest:  enable nicest fog/haze\n");
596     printf("\t--fov=xx.x:  specify initial field of view angle in degrees\n");
597     printf("\t--disable-fullscreen:  disable fullscreen mode\n");
598     printf("\t--enable-fullscreen:  enable fullscreen mode\n");
599     printf("\t--shading-flat:  enable flat shading\n");
600     printf("\t--shading-smooth:  enable smooth shading\n");
601     printf("\t--disable-skyblend:  disable sky blending\n");
602     printf("\t--enable-skyblend:  enable sky blending\n");
603     printf("\t--disable-textures:  disable textures\n");
604     printf("\t--enable-textures:  enable textures\n");
605     printf("\t--disable-wireframe:  disable wireframe drawing mode\n");
606     printf("\t--enable-wireframe:  enable wireframe drawing mode\n");
607     printf("\t--geometry=WWWxHHH:  window geometry: 640x480, 800x600, etc.\n");
608     printf("\n");
609
610     printf("Scenery Options:\n");
611     printf("\t--tile-radius=n:  specify tile radius, must be 1 - 4\n");
612     printf("\n");
613
614     printf("Hud Options:\n");
615     printf("\t--units-feet:  Hud displays units in feet\n");
616     printf("\t--units-meters:  Hud displays units in meters\n");
617     printf("\t--hud-tris:  Hud displays number of triangles rendered\n");
618     printf("\t--hud-culled:  Hud displays percentage of triangles culled\n");
619     printf("\n");
620         
621     printf("Time Options:\n");
622     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
623 }
624
625
626 // Destructor
627 fgOPTIONS::~fgOPTIONS( void ) {
628 }
629
630
631 // $Log$
632 // Revision 1.38  1999/02/01 21:33:35  curt
633 // Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
634 // Jon accepted my offer to do this and thought it was a good idea.
635 //
636 // Revision 1.37  1999/01/19 20:57:05  curt
637 // MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
638 //
639 // Revision 1.36  1999/01/07 20:25:10  curt
640 // Updated struct fgGENERAL to class FGGeneral.
641 //
642 // Revision 1.35  1998/12/06 14:52:57  curt
643 // Fixed a problem with the initial starting altitude.  "v->abs_view_pos" wasn't
644 // being calculated correctly at the beginning causing the first terrain
645 // intersection to fail, returning a ground altitude of zero, causing the plane
646 // to free fall for one frame, until the ground altitude was corrected, but now
647 // being under the ground we got a big bounce and the plane always ended up
648 // upside down.
649 //
650 // Revision 1.34  1998/12/05 15:54:22  curt
651 // Renamed class fgFLIGHT to class FGState as per request by JSB.
652 //
653 // Revision 1.33  1998/12/04 01:30:44  curt
654 // Added support for the External flight model.
655 //
656 // Revision 1.32  1998/11/25 01:34:00  curt
657 // Support for an arbitrary number of serial ports.
658 //
659 // Revision 1.31  1998/11/23 21:49:04  curt
660 // Borland portability tweaks.
661 //
662 // Revision 1.30  1998/11/16 14:00:02  curt
663 // Added pow() macro bug work around.
664 // Added support for starting FGFS at various resolutions.
665 // Added some initial serial port support.
666 // Specify default log levels in main().
667 //
668 // Revision 1.29  1998/11/06 21:18:12  curt
669 // Converted to new logstream debugging facility.  This allows release
670 // builds with no messages at all (and no performance impact) by using
671 // the -DFG_NDEBUG flag.
672 //
673 // Revision 1.28  1998/11/06 14:47:03  curt
674 // Changes to track Bernie's updates to fgstream.
675 //
676 // Revision 1.27  1998/11/02 23:04:04  curt
677 // HUD units now display in feet by default with meters being a command line
678 // option.
679 //
680 // Revision 1.26  1998/10/17 01:34:24  curt
681 // C++ ifying ...
682 //
683 // Revision 1.25  1998/09/15 02:09:27  curt
684 // Include/fg_callback.hxx
685 //   Moved code inline to stop g++ 2.7 from complaining.
686 //
687 // Simulator/Time/event.[ch]xx
688 //   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
689 //   complain bitterly.
690 //
691 // Minor bugfix and changes.
692 //
693 // Simulator/Main/GLUTmain.cxx
694 //   Added missing type to idle_state definition - eliminates a warning.
695 //
696 // Simulator/Main/fg_init.cxx
697 //   Changes to airport lookup.
698 //
699 // Simulator/Main/options.cxx
700 //   Uses fg_gzifstream when loading config file.
701 //
702 // Revision 1.24  1998/09/08 15:04:33  curt
703 // Optimizations by Norman Vine.
704 //
705 // Revision 1.23  1998/08/27 17:02:07  curt
706 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
707 // - use strings for fg_root and airport_id and added methods to return
708 //   them as strings,
709 // - inlined all access methods,
710 // - made the parsing functions private methods,
711 // - deleted some unused functions.
712 // - propogated some of these changes out a bit further.
713 //
714 // Revision 1.22  1998/08/24 20:11:13  curt
715 // Added i/I to toggle full vs. minimal HUD.
716 // Added a --hud-tris vs --hud-culled option.
717 // Moved options accessor funtions to options.hxx.
718 //
719 // Revision 1.21  1998/08/20 15:10:34  curt
720 // Added GameGLUT support.
721 //
722 // Revision 1.20  1998/07/30 23:48:28  curt
723 // Output position & orientation when pausing.
724 // Eliminated libtool use.
725 // Added options to specify initial position and orientation.
726 // Changed default fov to 55 degrees.
727 // Added command line option to start in paused or unpaused state.
728 //
729 // Revision 1.19  1998/07/27 18:41:25  curt
730 // Added a pause command "p"
731 // Fixed some initialization order problems between pui and glut.
732 // Added an --enable/disable-sound option.
733 //
734 // Revision 1.18  1998/07/22 01:27:03  curt
735 // Strip out \r when parsing config file in case we are on a windoze system.
736 //
737 // Revision 1.17  1998/07/16 17:33:38  curt
738 // "H" / "h" now control hud brightness as well with off being one of the
739 //   states.
740 // Better checking for xmesa/fx 3dfx fullscreen/window support for deciding
741 //   whether or not to build in the feature.
742 // Translucent menu support.
743 // HAVE_AUDIO_SUPPORT -> ENABLE_AUDIO_SUPPORT
744 // Use fork() / wait() for playing mp3 init music in background under unix.
745 // Changed default tile diameter to 5.
746 //
747 // Revision 1.16  1998/07/13 21:01:39  curt
748 // Wrote access functions for current fgOPTIONS.
749 //
750 // Revision 1.15  1998/07/06 21:34:19  curt
751 // Added an enable/disable splash screen option.
752 // Added an enable/disable intro music option.
753 // Added an enable/disable instrument panel option.
754 // Added an enable/disable mouse pointer option.
755 // Added using namespace std for compilers that support this.
756 //
757 // Revision 1.14  1998/07/04 00:52:26  curt
758 // Add my own version of gluLookAt() (which is nearly identical to the
759 // Mesa/glu version.)  But, by calculating the Model View matrix our selves
760 // we can save this matrix without having to read it back in from the video
761 // card.  This hopefully allows us to save a few cpu cycles when rendering
762 // out the fragments because we can just use glLoadMatrixd() with the
763 // precalculated matrix for each tile rather than doing a push(), translate(),
764 // pop() for every fragment.
765 //
766 // Panel status defaults to off for now until it gets a bit more developed.
767 //
768 // Extract OpenGL driver info on initialization.
769 //
770 // Revision 1.13  1998/06/27 16:54:34  curt
771 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
772 // Don't change the view port when displaying the panel.
773 //
774 // Revision 1.12  1998/06/17 21:35:13  curt
775 // Refined conditional audio support compilation.
776 // Moved texture parameter setup calls to ../Scenery/materials.cxx
777 // #include <string.h> before various STL includes.
778 // Make HUD default state be enabled.
779 //
780 // Revision 1.11  1998/06/13 00:40:33  curt
781 // Tweaked fog command line options.
782 //
783 // Revision 1.10  1998/05/16 13:08:36  curt
784 // C++ - ified views.[ch]xx
785 // Shuffled some additional view parameters into the fgVIEW class.
786 // Changed tile-radius to tile-diameter because it is a much better
787 //   name.
788 // Added a WORLD_TO_EYE transformation to views.cxx.  This allows us
789 //  to transform world space to eye space for view frustum culling.
790 //
791 // Revision 1.9  1998/05/13 18:29:59  curt
792 // Added a keyboard binding to dynamically adjust field of view.
793 // Added a command line option to specify fov.
794 // Adjusted terrain color.
795 // Root path info moved to fgOPTIONS.
796 // Added ability to parse options out of a config file.
797 //
798 // Revision 1.8  1998/05/07 23:14:16  curt
799 // Added "D" key binding to set autopilot heading.
800 // Made frame rate calculation average out over last 10 frames.
801 // Borland C++ floating point exception workaround.
802 // Added a --tile-radius=n option.
803 //
804 // Revision 1.7  1998/05/06 03:16:25  curt
805 // Added an averaged global frame rate counter.
806 // Added an option to control tile radius.
807 //
808 // Revision 1.6  1998/05/03 00:47:32  curt
809 // Added an option to enable/disable full-screen mode.
810 //
811 // Revision 1.5  1998/04/30 12:34:19  curt
812 // Added command line rendering options:
813 //   enable/disable fog/haze
814 //   specify smooth/flat shading
815 //   disable sky blending and just use a solid color
816 //   enable wireframe drawing mode
817 //
818 // Revision 1.4  1998/04/28 01:20:22  curt
819 // Type-ified fgTIME and fgVIEW.
820 // Added a command line option to disable textures.
821 //
822 // Revision 1.3  1998/04/26 05:01:19  curt
823 // Added an rint() / HAVE_RINT check.
824 //
825 // Revision 1.2  1998/04/25 15:11:12  curt
826 // Added an command line option to set starting position based on airport ID.
827 //
828 // Revision 1.1  1998/04/24 00:49:21  curt
829 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
830 // Trying out some different option parsing code.
831 // Some code reorganization.
832 //
833 //