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