]> git.mxchange.org Git - flightgear.git/blob - Main/options.cxx
Added i/I to toggle full vs. minimal HUD.
[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
35 #include <Debug/fg_debug.h>
36 #include <Flight/flight.h>
37 #include <Include/fg_constants.h>
38 #include <Include/fg_zlib.h>
39
40 #include "options.hxx"
41
42
43 // Defined the shared options class here
44 fgOPTIONS current_options;
45
46
47 // Constructor
48 fgOPTIONS::fgOPTIONS( void ) {
49     // set initial values/defaults
50
51     if ( getenv("FG_ROOT") != NULL ) {
52         // fg_root could be anywhere, so default to environmental
53         // variable $FG_ROOT if it is set.
54
55         strcpy(fg_root, getenv("FG_ROOT"));
56     } else {
57         // Otherwise, default to a random compiled in location if
58         // $FG_ROOT is not set.  This can still be overridden from the
59         // command line or a config file.
60
61 #if defined(WIN32)
62         strcpy(fg_root, "\\FlightGear");
63 #else
64         strcpy(fg_root, "/usr/local/lib/FlightGear");
65 #endif
66     }
67
68     // Starting posistion and orientation
69     strcpy(airport_id, "");  // default airport id
70     lon = 0.0;               // starting longitude in degrees (west = -)
71     lat = 0.0;               // starting latitude in degrees (south = -)
72
73     // If nothing else is specified, default initial position is
74     // Globe, AZ (P13)
75     lon = -110.6642444;
76     lat  =  33.3528917;
77
78     // North of the city of Globe
79     // lon = -110.7;
80     // lat =   33.4;
81
82     // North of the city of Globe
83     // lon = -110.742578;
84     // lat =   33.507122;
85
86     // Near where I used to live in Globe, AZ
87     // lon = -110.766000;
88     // lat =   33.377778;
89
90     // 10125 Jewell St. NE
91     // lon = -93.15;
92     // lat =  45.15;
93
94     // Near KHSP (Hot Springs, VA)
95     // lon = -79.8338964 + 0.01;
96     // lat =  37.9514564 + 0.008;
97
98     // (SEZ) SEDONA airport
99     // lon = -111.7884614 + 0.01;
100     // lat =   34.8486289 - 0.015;
101
102     // Somewhere near the Grand Canyon
103     // lon = -112.5;
104     // lat =   36.5;
105
106     // Jim Brennon's Kingmont Observatory
107     // lon = -121.1131667;
108     // lat =   38.8293917;
109
110     // Huaras, Peru (S09d 31.871'  W077d 31.498')
111     // lon = -77.5249667;
112     // lat =  -9.5311833;
113  
114     // Eclipse Watching w73.5 n10 (approx) 18:00 UT
115     // lon = -73.5;
116     // lat =  10.0;
117
118     // Test Position
119     // lon =  8.5;
120     // lat = 47.5;
121
122     // Timms Hill (WI)
123     // lon = -90.1953055556;
124     // lat =  45.4511388889;
125
126     altitude = -9999.0;      // starting altitude in meters (this will be
127                              // reset to ground level if it is lower
128                              // than the terrain
129
130     // Initial Orientation
131     heading = 270.0;         // heading (yaw) angle in degress (Psi)
132     roll    =   0.0;         // roll angle in degrees (Phi)
133     pitch   =   0.424;       // pitch angle in degrees (Theta)
134
135     // Miscellaneous
136     game_mode = 0;
137     splash_screen = 1;
138     intro_music = 1;
139     mouse_pointer = 0;
140     pause = 0;
141
142     // Features
143     hud_status = 1;
144     panel_status = 0;
145     sound = 1;
146
147     // Flight Model options
148     flight_model = FG_LARCSIM;
149
150     // Rendering options
151     fog = 2;    // nicest
152     fov = 55.0;
153     fullscreen = 0;
154     shading = 1;
155     skyblend = 1;
156     textures = 1;
157     wireframe = 0;
158
159     // Scenery options
160     tile_diameter = 5;
161
162     // HUD options
163     tris_or_culled = 0;
164         
165     // Time options
166     time_offset = 0;
167 }
168
169
170 // Parse an int out of a --foo-bar=n type option 
171 static int parse_int(char *arg) {
172     int result;
173
174     // advance past the '='
175     while ( (arg[0] != '=') && (arg[0] != '\0') ) {
176         arg++;
177     }
178
179     if ( arg[0] == '=' ) {
180         arg++;
181     }
182
183     // printf("parse_int(): arg = %s\n", arg);
184
185     result = atoi(arg);
186
187     // printf("parse_int(): result = %d\n", result);
188
189     return(result);
190 }
191
192
193 // Parse an int out of a --foo-bar=n type option 
194 static double parse_double(char *arg) {
195     double result;
196
197     // advance past the '='
198     while ( (arg[0] != '=') && (arg[0] != '\0') ) {
199         arg++;
200     }
201
202     if ( arg[0] == '=' ) {
203         arg++;
204     }
205
206     // printf("parse_double(): arg = %s\n", arg);
207
208     result = atof(arg);
209
210     // printf("parse_double(): result = %.4f\n", result);
211
212     return(result);
213 }
214
215
216 static double parse_time(char *time_str) {
217     char num[256];
218     double hours, minutes, seconds;
219     double result = 0.0;
220     int sign = 1;
221     int i;
222
223     // printf("parse_time(): %s\n", time_str);
224
225     // check for sign
226     if ( strlen(time_str) ) {
227         if ( time_str[0] == '+' ) {
228             sign = 1;
229             time_str++;
230         } else if ( time_str[0] == '-' ) {
231             sign = -1;
232             time_str++;
233         }
234     }
235     // printf("sign = %d\n", sign);
236
237     // get hours
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         hours = atof(num);
250         // printf("hours = %.2lf\n", hours);
251
252         result += hours;
253     }
254
255     // get minutes
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         if ( time_str[0] == ':' ) {
264             time_str++;
265         }
266         num[i] = '\0';
267         minutes = atof(num);
268         // printf("minutes = %.2lf\n", minutes);
269
270         result += minutes / 60.0;
271     }
272
273     // get seconds
274     if ( strlen(time_str) ) {
275         i = 0;
276         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
277             num[i] = time_str[0];
278             time_str++;
279             i++;
280         }
281         num[i] = '\0';
282         seconds = atof(num);
283         // printf("seconds = %.2lf\n", seconds);
284
285         result += seconds / 3600.0;
286     }
287
288     return(sign * result);
289 }
290
291
292 // parse degree in the form of [+/-]hhh:mm:ss
293 static double parse_degree(char *degree_str) {
294     double result;
295
296     // advance past the '='
297     while ( (degree_str[0] != '=') && (degree_str[0] != '\0') ) {
298         degree_str++;
299     }
300
301     if ( degree_str[0] == '=' ) {
302         degree_str++;
303     }
304
305     result = parse_time(degree_str);
306
307     // printf("Degree = %.4f\n", result);
308
309     return(result);
310 }
311
312
313 // parse time offset command line option
314 static int parse_time_offset(char *time_str) {
315     int result;
316
317     // advance past the '='
318     while ( (time_str[0] != '=') && (time_str[0] != '\0') ) {
319         time_str++;
320     }
321
322     if ( time_str[0] == '=' ) {
323         time_str++;
324     }
325
326     // printf("time offset = %s\n", time_str);
327
328 #ifdef HAVE_RINT
329     result = (int)rint(parse_time(time_str) * 3600.0);
330 #else
331     result = (int)(parse_time(time_str) * 3600.0);
332 #endif
333
334     // printf("parse_time_offset(): %d\n", result);
335
336     return( result );
337 }
338
339
340 // Parse --tile-diameter=n type option 
341
342 #define FG_RADIUS_MIN 1
343 #define FG_RADIUS_MAX 4
344
345 static int parse_tile_radius(char *arg) {
346     int radius;
347
348     radius = parse_int(arg);
349
350     if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
351     if ( radius > FG_RADIUS_MAX ) { radius = FG_RADIUS_MAX; }
352
353     // printf("parse_tile_radius(): radius = %d\n", radius);
354
355     return(radius);
356 }
357
358
359 // Parse --flightmode=abcdefg type option 
360 static int parse_flight_model(char *fm) {
361     fm += 15;
362
363     // printf("flight model = %s\n", fm);
364
365     if ( strcmp(fm, "slew") == 0 ) {
366         return(FG_SLEW);
367     } else if ( strcmp(fm, "larcsim") == 0 ) {
368         return(FG_LARCSIM);
369     } else if ( strcmp(fm, "LaRCsim") == 0 ) {
370         return(FG_LARCSIM);
371     } else {
372         fgPrintf( FG_GENERAL, FG_EXIT, "Unknown flight model = %s\n", fm);
373     }
374
375     // we'll never get here, but it makes the compiler happy.
376     return(-1);
377 }
378
379
380 // Parse --fov=x.xx type option 
381 static double parse_fov(char *arg) {
382     double fov;
383
384     fov = parse_double(arg);
385
386     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
387     if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
388
389     // printf("parse_fov(): result = %.4f\n", fov);
390
391     return(fov);
392 }
393
394
395 // Parse a single option
396 int fgOPTIONS::parse_option( char *arg ) {
397     // General Options
398     if ( (strcmp(arg, "--help") == 0) ||
399          (strcmp(arg, "-h") == 0) ) {
400         // help/usage request
401         return(FG_OPTIONS_HELP);
402     } else if ( strcmp(arg, "--disable-game-mode") == 0 ) {
403         game_mode = 0;
404     } else if ( strcmp(arg, "--enable-game-mode") == 0 ) {
405         game_mode = 1;
406     } else if ( strcmp(arg, "--disable-splash-screen") == 0 ) {
407         splash_screen = 0;
408     } else if ( strcmp(arg, "--enable-splash-screen") == 0 ) {
409         splash_screen = 1;
410     } else if ( strcmp(arg, "--disable-intro-music") == 0 ) {
411         intro_music = 0;
412     } else if ( strcmp(arg, "--enable-intro-music") == 0 ) {
413         intro_music = 1;
414     } else if ( strcmp(arg, "--disable-mouse-pointer") == 0 ) {
415         mouse_pointer = 1;
416     } else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) {
417         mouse_pointer = 2;
418     } else if ( strcmp(arg, "--disable-pause") == 0 ) {
419         pause = 0;      
420     } else if ( strcmp(arg, "--enable-pause") == 0 ) {
421         pause = 1;      
422     } else if ( strcmp(arg, "--disable-hud") == 0 ) {
423         hud_status = 0; 
424     } else if ( strcmp(arg, "--enable-hud") == 0 ) {
425         hud_status = 1; 
426     } else if ( strcmp(arg, "--disable-panel") == 0 ) {
427         panel_status = 0;
428     } else if ( strcmp(arg, "--enable-panel") == 0 ) {
429         panel_status = 1;
430     } else if ( strcmp(arg, "--disable-sound") == 0 ) {
431         sound = 0;
432     } else if ( strcmp(arg, "--enable-sound") == 0 ) {
433         sound = 1;
434     } else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
435         arg += 13;
436         strncpy(airport_id, arg, 4);
437     } else if ( strncmp(arg, "--lon=", 6) == 0 ) {
438         lon = parse_degree(arg);
439     } else if ( strncmp(arg, "--lat=", 6) == 0 ) {
440         lat = parse_degree(arg);
441     } else if ( strncmp(arg, "--altitude=", 11) == 0 ) {
442         altitude = parse_double(arg);
443     } else if ( strncmp(arg, "--heading=", 6) == 0 ) {
444         heading = parse_double(arg);
445     } else if ( strncmp(arg, "--roll=", 7) == 0 ) {
446         roll = parse_double(arg);
447     } else if ( strncmp(arg, "--pitch=", 8) == 0 ) {
448         pitch = parse_double(arg);
449     } else if ( strncmp(arg, "--fg-root=", 10) == 0 ) {
450         arg += 10;
451         strcpy(fg_root, arg);
452     } else if ( strncmp(arg, "--flight-model=", 15) == 0 ) {
453         flight_model = parse_flight_model(arg);
454     } else if ( strcmp(arg, "--fog-disable") == 0 ) {
455         fog = 0;        
456     } else if ( strcmp(arg, "--fog-fastest") == 0 ) {
457         fog = 1;        
458     } else if ( strcmp(arg, "--fog-nicest") == 0 ) {
459         fog = 2;        
460     } else if ( strncmp(arg, "--fov=", 6) == 0 ) {
461         fov = parse_fov(arg);
462     } else if ( strcmp(arg, "--disable-fullscreen") == 0 ) {
463         fullscreen = 0; 
464     } else if ( strcmp(arg, "--enable-fullscreen") == 0 ) {
465         fullscreen = 1; 
466     } else if ( strcmp(arg, "--shading-flat") == 0 ) {
467         shading = 0;    
468     } else if ( strcmp(arg, "--shading-smooth") == 0 ) {
469         shading = 1;    
470     } else if ( strcmp(arg, "--disable-skyblend") == 0 ) {
471         skyblend = 0;   
472     } else if ( strcmp(arg, "--enable-skyblend") == 0 ) {
473         skyblend = 1;   
474     } else if ( strcmp(arg, "--disable-textures") == 0 ) {
475         textures = 0;   
476     } else if ( strcmp(arg, "--enable-textures") == 0 ) {
477         textures = 1;   
478     } else if ( strcmp(arg, "--disable-wireframe") == 0 ) {
479         wireframe = 0;  
480     } else if ( strcmp(arg, "--enable-wireframe") == 0 ) {
481         wireframe = 1;  
482     } else if ( strncmp(arg, "--tile-radius=", 14) == 0 ) {
483         tile_radius = parse_tile_radius(arg);
484         tile_diameter = tile_radius * 2 + 1;
485     } else if ( strncmp(arg, "--time-offset=", 14) == 0 ) {
486         time_offset = parse_time_offset(arg);
487     } else if ( strcmp(arg, "--hud-tris") == 0 ) {
488         tris_or_culled = 0;     
489     } else if ( strcmp(arg, "--hud-culled") == 0 ) {
490         tris_or_culled = 1;     
491     } else {
492         fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n", arg);
493         return(FG_OPTIONS_ERROR);
494     }
495     
496     return(FG_OPTIONS_OK);
497 }
498
499
500 // Parse the command line options
501 int fgOPTIONS::parse_command_line( int argc, char **argv ) {
502     int i = 1;
503     int result;
504
505     fgPrintf(FG_GENERAL, FG_INFO, "Processing command line arguments\n");
506
507     while ( i < argc ) {
508         fgPrintf(FG_GENERAL, FG_DEBUG, "argv[%d] = %s\n", i, argv[i]);
509
510         result = parse_option(argv[i]);
511         if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
512             return(result);
513         }
514
515         i++;
516     }
517     
518     return(FG_OPTIONS_OK);
519 }
520
521
522 // Parse the command line options
523 int fgOPTIONS::parse_config_file( char *path ) {
524     char fgpath[256], line[256];
525     fgFile f;
526     int len, result;
527
528     strcpy(fgpath, path);
529     strcat(fgpath, ".gz");
530
531     // first try "path.gz"
532     if ( (f = fgopen(fgpath, "rb")) == NULL ) {
533         // next try "path"
534         if ( (f = fgopen(path, "rb")) == NULL ) {
535             return(FG_OPTIONS_ERROR);
536         }
537     }
538
539     fgPrintf(FG_GENERAL, FG_INFO, "Processing config file: %s\n", path);
540
541     while ( fggets(f, line, 250) != NULL ) {
542         // strip trailing newline if it exists
543         len = strlen(line);
544         if ( line[len-1] == '\n' ) {
545             line[len-1] = '\0';
546         }
547
548         // strip dos ^M if it exists
549         len = strlen(line);
550         if ( line[len-1] == '\r' ) {
551             line[len-1] = '\0';
552         }
553
554         result = parse_option(line);
555         if ( result == FG_OPTIONS_ERROR ) {
556             fgPrintf( FG_GENERAL, FG_EXIT, 
557                       "Config file parse error: %s '%s'\n", path, line );
558         }
559     }
560
561     fgclose(f);
562     return(FG_OPTIONS_OK);
563 }
564
565
566 // Print usage message
567 void fgOPTIONS::usage ( void ) {
568     printf("Usage: fg [ options ... ]\n");
569     printf("\n");
570
571     printf("General Options:\n");
572     printf("\t--help -h:  print usage\n");
573     printf("\t--fg-root=path:  specify the root path for all the data files\n");
574     printf("\t--disable-gamemode:  disable full-screen game mode\n");
575     printf("\t--enable-gamemode:  enable full-screen game mode\n");
576     printf("\t--disable-splash-screen:  disable splash screen\n");
577     printf("\t--enable-splash-screen:  enable splash screen\n");
578     printf("\t--disable-intro-music:  disable introduction music\n");
579     printf("\t--enable-intro-music:  enable introduction music\n");
580     printf("\t--disable-mouse-pointer:  disable extra mouse pointer\n");
581     printf("\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for\n");
582     printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
583     printf("\t--disable-pause:  start out in an active state\n");
584     printf("\t--enable-pause:  start out in a paused state\n");
585     printf("\n");
586
587     printf("Features:\n");
588     printf("\t--disable-hud:  disable heads up display\n");
589     printf("\t--enable-hud:  enable heads up display\n");
590     printf("\t--disable-panel:  disable instrument panel\n");
591     printf("\t--enable-panel:  enable instrumetn panel\n");
592     printf("\t--disable-sound:  disable sound effects\n");
593     printf("\t--enable-sound:  enable sound effects\n");
594     printf("\n");
595  
596     printf("Initial Position and Orientation:\n");
597     printf("\t--airport-id=ABCD:  specify starting postion by airport id\n");
598     printf("\t--lon=degrees:  starting longitude in degrees (west = -)\n");
599     printf("\t--lat=degrees:  starting latitude in degrees (south = -)\n");
600     printf("\t--altitude=meters:  starting altitude in meters\n");
601     printf("\t--heading=degrees:  heading (yaw) angle in degress (Psi)\n");
602     printf("\t--roll=degrees:  roll angle in degrees (Phi)\n");
603     printf("\t--pitch=degrees:  pitch angle in degrees (Theta)\n");
604     printf("\n");
605
606     printf("Rendering Options:\n");
607     printf("\t--fog-disable:  disable fog/haze\n");
608     printf("\t--fog-fastest:  enable fastest fog/haze\n");
609     printf("\t--fog-nicest:  enable nicest fog/haze\n");
610     printf("\t--fov=xx.x:  specify initial field of view angle in degrees\n");
611     printf("\t--disable-fullscreen:  disable fullscreen mode\n");
612     printf("\t--enable-fullscreen:  enable fullscreen mode\n");
613     printf("\t--shading-flat:  enable flat shading\n");
614     printf("\t--shading-smooth:  enable smooth shading\n");
615     printf("\t--disable-skyblend:  disable sky blending\n");
616     printf("\t--enable-skyblend:  enable sky blending\n");
617     printf("\t--disable-textures:  disable textures\n");
618     printf("\t--enable-textures:  enable textures\n");
619     printf("\t--disable-wireframe:  disable wireframe drawing mode\n");
620     printf("\t--enable-wireframe:  enable wireframe drawing mode\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--hud-tris:  Hud displays number of triangles rendered\n");
629     printf("\t--hud-culled:  Hud displays percentage of triangles culled\n");
630         
631     printf("Time Options:\n");
632     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
633 }
634
635
636 #if 0
637 // Query functions
638 void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
639 void fgOPTIONS::get_airport_id(char *id) { strcpy(id, airport_id); }
640 double fgOPTIONS::get_lon( void ) { return(lon); }
641 double fgOPTIONS::get_lat( void ) { return(lat); }
642 double fgOPTIONS::get_altitude( void ) { return(altitude); }
643 double fgOPTIONS::get_heading( void ) { return(heading); }
644 double fgOPTIONS::get_roll( void ) { return(roll); }
645 double fgOPTIONS::get_pitch( void ) { return(pitch); }
646 int fgOPTIONS::get_game_mode( void ) { return(game_mode); }
647 int fgOPTIONS::get_splash_screen( void ) { return(splash_screen); }
648 int fgOPTIONS::get_intro_music( void ) { return(intro_music); }
649 int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); }
650 int fgOPTIONS::get_pause( void ) { return(pause); }
651 int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
652 int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
653 int fgOPTIONS::get_sound( void ) { return(sound); }
654 int fgOPTIONS::get_flight_model( void ) { return(flight_model); }
655 int fgOPTIONS::get_fog( void ) { return(fog); }
656 double fgOPTIONS::get_fov( void ) { return(fov); }
657 int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
658 int fgOPTIONS::get_shading( void ) { return(shading); }
659 int fgOPTIONS::get_skyblend( void ) { return(skyblend); }
660 int fgOPTIONS::get_textures( void ) { return(textures); }
661 int fgOPTIONS::get_wireframe( void ) { return(wireframe); }
662 int fgOPTIONS::get_tile_radius( void ) { return(tile_radius); }
663 int fgOPTIONS::get_tile_diameter( void ) { return(tile_diameter); }
664 int fgOPTIONS::get_time_offset( void ) { return(time_offset); }
665
666
667 // Update functions
668 void fgOPTIONS::set_hud_status( int status ) { hud_status = status; }
669 void fgOPTIONS::set_fov( double amount ) { fov = amount; }
670 #endif
671 // Destructor
672 fgOPTIONS::~fgOPTIONS( void ) {
673 }
674
675
676 // $Log$
677 // Revision 1.22  1998/08/24 20:11:13  curt
678 // Added i/I to toggle full vs. minimal HUD.
679 // Added a --hud-tris vs --hud-culled option.
680 // Moved options accessor funtions to options.hxx.
681 //
682 // Revision 1.21  1998/08/20 15:10:34  curt
683 // Added GameGLUT support.
684 //
685 // Revision 1.20  1998/07/30 23:48:28  curt
686 // Output position & orientation when pausing.
687 // Eliminated libtool use.
688 // Added options to specify initial position and orientation.
689 // Changed default fov to 55 degrees.
690 // Added command line option to start in paused or unpaused state.
691 //
692 // Revision 1.19  1998/07/27 18:41:25  curt
693 // Added a pause command "p"
694 // Fixed some initialization order problems between pui and glut.
695 // Added an --enable/disable-sound option.
696 //
697 // Revision 1.18  1998/07/22 01:27:03  curt
698 // Strip out \r when parsing config file in case we are on a windoze system.
699 //
700 // Revision 1.17  1998/07/16 17:33:38  curt
701 // "H" / "h" now control hud brightness as well with off being one of the
702 //   states.
703 // Better checking for xmesa/fx 3dfx fullscreen/window support for deciding
704 //   whether or not to build in the feature.
705 // Translucent menu support.
706 // HAVE_AUDIO_SUPPORT -> ENABLE_AUDIO_SUPPORT
707 // Use fork() / wait() for playing mp3 init music in background under unix.
708 // Changed default tile diameter to 5.
709 //
710 // Revision 1.16  1998/07/13 21:01:39  curt
711 // Wrote access functions for current fgOPTIONS.
712 //
713 // Revision 1.15  1998/07/06 21:34:19  curt
714 // Added an enable/disable splash screen option.
715 // Added an enable/disable intro music option.
716 // Added an enable/disable instrument panel option.
717 // Added an enable/disable mouse pointer option.
718 // Added using namespace std for compilers that support this.
719 //
720 // Revision 1.14  1998/07/04 00:52:26  curt
721 // Add my own version of gluLookAt() (which is nearly identical to the
722 // Mesa/glu version.)  But, by calculating the Model View matrix our selves
723 // we can save this matrix without having to read it back in from the video
724 // card.  This hopefully allows us to save a few cpu cycles when rendering
725 // out the fragments because we can just use glLoadMatrixd() with the
726 // precalculated matrix for each tile rather than doing a push(), translate(),
727 // pop() for every fragment.
728 //
729 // Panel status defaults to off for now until it gets a bit more developed.
730 //
731 // Extract OpenGL driver info on initialization.
732 //
733 // Revision 1.13  1998/06/27 16:54:34  curt
734 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
735 // Don't change the view port when displaying the panel.
736 //
737 // Revision 1.12  1998/06/17 21:35:13  curt
738 // Refined conditional audio support compilation.
739 // Moved texture parameter setup calls to ../Scenery/materials.cxx
740 // #include <string.h> before various STL includes.
741 // Make HUD default state be enabled.
742 //
743 // Revision 1.11  1998/06/13 00:40:33  curt
744 // Tweaked fog command line options.
745 //
746 // Revision 1.10  1998/05/16 13:08:36  curt
747 // C++ - ified views.[ch]xx
748 // Shuffled some additional view parameters into the fgVIEW class.
749 // Changed tile-radius to tile-diameter because it is a much better
750 //   name.
751 // Added a WORLD_TO_EYE transformation to views.cxx.  This allows us
752 //  to transform world space to eye space for view frustum culling.
753 //
754 // Revision 1.9  1998/05/13 18:29:59  curt
755 // Added a keyboard binding to dynamically adjust field of view.
756 // Added a command line option to specify fov.
757 // Adjusted terrain color.
758 // Root path info moved to fgOPTIONS.
759 // Added ability to parse options out of a config file.
760 //
761 // Revision 1.8  1998/05/07 23:14:16  curt
762 // Added "D" key binding to set autopilot heading.
763 // Made frame rate calculation average out over last 10 frames.
764 // Borland C++ floating point exception workaround.
765 // Added a --tile-radius=n option.
766 //
767 // Revision 1.7  1998/05/06 03:16:25  curt
768 // Added an averaged global frame rate counter.
769 // Added an option to control tile radius.
770 //
771 // Revision 1.6  1998/05/03 00:47:32  curt
772 // Added an option to enable/disable full-screen mode.
773 //
774 // Revision 1.5  1998/04/30 12:34:19  curt
775 // Added command line rendering options:
776 //   enable/disable fog/haze
777 //   specify smooth/flat shading
778 //   disable sky blending and just use a solid color
779 //   enable wireframe drawing mode
780 //
781 // Revision 1.4  1998/04/28 01:20:22  curt
782 // Type-ified fgTIME and fgVIEW.
783 // Added a command line option to disable textures.
784 //
785 // Revision 1.3  1998/04/26 05:01:19  curt
786 // Added an rint() / HAVE_RINT check.
787 //
788 // Revision 1.2  1998/04/25 15:11:12  curt
789 // Added an command line option to set starting position based on airport ID.
790 //
791 // Revision 1.1  1998/04/24 00:49:21  curt
792 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
793 // Trying out some different option parsing code.
794 // Some code reorganization.
795 //
796 //