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