]> git.mxchange.org Git - flightgear.git/blob - src/Main/options.cxx
Added fullscreen to globals, and fixed compile bug for 3DFX cards.
[flightgear.git] / src / 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
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #include <simgear/compiler.h>
29 #include <simgear/misc/exception.hxx>
30
31 #include <math.h>            // rint()
32 #include <stdio.h>
33 #include <stdlib.h>          // atof(), atoi()
34 #include <string.h>
35
36 #include STL_STRING
37
38 #include <simgear/misc/sgstream.hxx>
39
40 // #include <Include/general.hxx>
41 // #include <Airports/simple.hxx>
42 // #include <Cockpit/cockpit.hxx>
43 // #include <FDM/flight.hxx>
44 // #include <FDM/UIUCModel/uiuc_aircraftdir.h>
45 #ifdef FG_NETWORK_OLK
46 #  include <NetworkOLK/network.h>
47 #endif
48
49 #include <GUI/gui.h>
50
51 #include "globals.hxx"
52 #include "fg_init.hxx"
53 #include "fg_props.hxx"
54 #include "options.hxx"
55 #include "viewmgr.hxx"
56
57 SG_USING_STD(string);
58 SG_USING_NAMESPACE(std);
59
60
61 #define NEW_DEFAULT_MODEL_HZ 120
62
63 enum
64 {
65     FG_OPTIONS_OK = 0,
66     FG_OPTIONS_HELP = 1,
67     FG_OPTIONS_ERROR = 2
68 };
69
70 static double
71 atof( const string& str )
72 {
73
74 #ifdef __MWERKS__ 
75     // -dw- if ::atof is called, then we get an infinite loop
76     return std::atof( str.c_str() );
77 #else
78     return ::atof( str.c_str() );
79 #endif
80 }
81
82 static int
83 atoi( const string& str )
84 {
85 #ifdef __MWERKS__ 
86     // -dw- if ::atoi is called, then we get an infinite loop
87     return std::atoi( str.c_str() );
88 #else
89     return ::atoi( str.c_str() );
90 #endif
91 }
92
93
94 /**
95  * Set a few fail-safe default property values.
96  *
97  * These should all be set in $FG_ROOT/preferences.xml, but just
98  * in case, we provide some initial sane values here. This method 
99  * should be invoked *before* reading any init files.
100  */
101 void
102 fgSetDefaults ()
103 {
104     // set a possibly independent location for scenery data
105     char *envp = ::getenv( "FG_SCENERY" );
106
107     if ( envp != NULL ) {
108         // fg_root could be anywhere, so default to environmental
109         // variable $FG_ROOT if it is set.
110         globals->set_fg_scenery(envp);
111     } else {
112         // Otherwise, default to Scenery being in $FG_ROOT/Scenery
113         globals->set_fg_scenery("");
114     }
115                                 // Position (Globe, AZ)
116     fgSetDouble("/position/longitude-deg", -110.6642444);
117     fgSetDouble("/position/latitude-deg", 33.3528917);
118     fgSetDouble("/position/altitude-ft", -9999.0);
119
120                                 // Orientation
121     fgSetDouble("/orientation/heading-deg", 270);
122     fgSetDouble("/orientation/roll-deg", 0);
123     fgSetDouble("/orientation/pitch-deg", 0.424);
124
125                                 // Velocities
126     fgSetString("/sim/startup/speed-set", "knots");
127     fgSetDouble("/velocities/uBody-fps", 0.0);
128     fgSetDouble("/velocities/vBody-fps", 0.0);
129     fgSetDouble("/velocities/wBody-fps", 0.0);
130     fgSetDouble("/velocities/speed-north-fps", 0.0);
131     fgSetDouble("/velocities/speed-east-fps", 0.0);
132     fgSetDouble("/velocities/speed-down-fps", 0.0);
133     fgSetDouble("/velocities/airspeed-kt", 0.0);
134     fgSetDouble("/velocities/mach", 0.0);
135
136                                 // Miscellaneous
137     fgSetBool("/sim/startup/game-mode", false);
138     fgSetBool("/sim/startup/splash-screen", true);
139     fgSetBool("/sim/startup/intro-music", true);
140     // we want mouse-pointer to have an undefined value if nothing is
141     // specified so we can do the right thing for voodoo-1/2 cards.
142     // fgSetString("/sim/startup/mouse-pointer", "disabled");
143     fgSetString("/sim/control-mode", "joystick");
144     fgSetBool("/sim/auto-coordination", false);
145 #if !defined(WIN32)
146     fgSetString("/sim/startup/browser-app", "netscape");
147 #else
148     fgSetString("/sim/startup/browser-app", "webrun.bat");
149 #endif
150                                 // Features
151     fgSetBool("/sim/hud/visibility", false);
152     fgSetBool("/sim/panel/visibility", true);
153     fgSetBool("/sim/sound", true);
154     fgSetBool("/sim/hud/antialiased", false);
155
156                                 // Flight Model options
157     fgSetString("/sim/flight-model", "jsb");
158     fgSetString("/sim/aero", "c172");
159     fgSetInt("/sim/model-hz", NEW_DEFAULT_MODEL_HZ);
160     fgSetInt("/sim/speed-up", 1);
161     fgSetBool("/sim/startup/trim", false);
162     fgSetBool("/sim/startup/onground", true);
163
164                                 // Rendering options
165     fgSetString("/sim/rendering/fog", "nicest");
166     fgSetBool("/environment/clouds/status", true);
167     fgSetDouble("/environment/clouds/altitude-ft", 5000);
168     fgSetBool("/sim/startup/fullscreen", false);
169     fgSetBool("/sim/rendering/shading", true);
170     fgSetBool("/sim/rendering/skyblend", true);
171     fgSetBool("/sim/rendering/textures", true);
172     fgSetBool("/sim/rendering/wireframe", false);
173     fgSetInt("/sim/startup/xsize", 800);
174     fgSetInt("/sim/startup/ysize", 600);
175     fgSetInt("/sim/rendering/bits-per-pixel", 16);
176     fgSetString("/sim/view-mode", "pilot");
177     fgSetDouble("/sim/view/offset-deg", 0);
178     fgSetDouble("/environment/visibility-m", 20000);
179
180                                 // HUD options
181     fgSetString("/sim/startup/units", "feet");
182     fgSetString("/sim/hud/frame-stat-type", "tris");
183         
184                                 // Time options
185     fgSetInt("/sim/startup/time-offset", 0);
186     fgSetString("/sim/startup/time-offset-type", "system-offset");
187
188     fgSetBool("/sim/networking/network-olk", false);
189     fgSetString("/sim/networking/call-sign", "Johnny");
190 }
191
192
193 // parse a time string ([+/-]%f[:%f[:%f]]) into hours
194 static double
195 parse_time(const string& time_in) {
196     char *time_str, num[256];
197     double hours, minutes, seconds;
198     double result = 0.0;
199     int sign = 1;
200     int i;
201
202     time_str = (char *)time_in.c_str();
203
204     // printf("parse_time(): %s\n", time_str);
205
206     // check for sign
207     if ( strlen(time_str) ) {
208         if ( time_str[0] == '+' ) {
209             sign = 1;
210             time_str++;
211         } else if ( time_str[0] == '-' ) {
212             sign = -1;
213             time_str++;
214         }
215     }
216     // printf("sign = %d\n", sign);
217
218     // get hours
219     if ( strlen(time_str) ) {
220         i = 0;
221         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
222             num[i] = time_str[0];
223             time_str++;
224             i++;
225         }
226         if ( time_str[0] == ':' ) {
227             time_str++;
228         }
229         num[i] = '\0';
230         hours = atof(num);
231         // printf("hours = %.2lf\n", hours);
232
233         result += hours;
234     }
235
236     // get minutes
237     if ( strlen(time_str) ) {
238         i = 0;
239         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
240             num[i] = time_str[0];
241             time_str++;
242             i++;
243         }
244         if ( time_str[0] == ':' ) {
245             time_str++;
246         }
247         num[i] = '\0';
248         minutes = atof(num);
249         // printf("minutes = %.2lf\n", minutes);
250
251         result += minutes / 60.0;
252     }
253
254     // get seconds
255     if ( strlen(time_str) ) {
256         i = 0;
257         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
258             num[i] = time_str[0];
259             time_str++;
260             i++;
261         }
262         num[i] = '\0';
263         seconds = atof(num);
264         // printf("seconds = %.2lf\n", seconds);
265
266         result += seconds / 3600.0;
267     }
268
269     return(sign * result);
270 }
271
272
273 // parse a date string (yyyy:mm:dd:hh:mm:ss) into a time_t (seconds)
274 static long int 
275 parse_date( const string& date)
276 {
277     struct tm gmt;
278     char * date_str, num[256];
279     int i;
280     // initialize to zero
281     gmt.tm_sec = 0;
282     gmt.tm_min = 0;
283     gmt.tm_hour = 0;
284     gmt.tm_mday = 0;
285     gmt.tm_mon = 0;
286     gmt.tm_year = 0;
287     gmt.tm_isdst = 0; // ignore daylight savings time for the moment
288     date_str = (char *)date.c_str();
289     // get year
290     if ( strlen(date_str) ) {
291         i = 0;
292         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
293             num[i] = date_str[0];
294             date_str++;
295             i++;
296         }
297         if ( date_str[0] == ':' ) {
298             date_str++;
299         }
300         num[i] = '\0';
301         gmt.tm_year = atoi(num) - 1900;
302     }
303     // get month
304     if ( strlen(date_str) ) {
305         i = 0;
306         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
307             num[i] = date_str[0];
308             date_str++;
309             i++;
310         }
311         if ( date_str[0] == ':' ) {
312             date_str++;
313         }
314         num[i] = '\0';
315         gmt.tm_mon = atoi(num) -1;
316     }
317     // get day
318     if ( strlen(date_str) ) {
319         i = 0;
320         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
321             num[i] = date_str[0];
322             date_str++;
323             i++;
324         }
325         if ( date_str[0] == ':' ) {
326             date_str++;
327         }
328         num[i] = '\0';
329         gmt.tm_mday = atoi(num);
330     }
331     // get hour
332     if ( strlen(date_str) ) {
333         i = 0;
334         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
335             num[i] = date_str[0];
336             date_str++;
337             i++;
338         }
339         if ( date_str[0] == ':' ) {
340             date_str++;
341         }
342         num[i] = '\0';
343         gmt.tm_hour = atoi(num);
344     }
345     // get minute
346     if ( strlen(date_str) ) {
347         i = 0;
348         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
349             num[i] = date_str[0];
350             date_str++;
351             i++;
352         }
353         if ( date_str[0] == ':' ) {
354             date_str++;
355         }
356         num[i] = '\0';
357         gmt.tm_min = atoi(num);
358     }
359     // get second
360     if ( strlen(date_str) ) {
361         i = 0;
362         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
363             num[i] = date_str[0];
364             date_str++;
365             i++;
366         }
367         if ( date_str[0] == ':' ) {
368             date_str++;
369         }
370         num[i] = '\0';
371         gmt.tm_sec = atoi(num);
372     }
373     time_t theTime = sgTimeGetGMT( gmt.tm_year, gmt.tm_mon, gmt.tm_mday,
374                                    gmt.tm_hour, gmt.tm_min, gmt.tm_sec );
375     //printf ("Date is %s\n", ctime(&theTime));
376     //printf ("in seconds that is %d\n", theTime);
377     //exit(1);
378     return (theTime);
379 }
380
381
382 // parse angle in the form of [+/-]ddd:mm:ss into degrees
383 static double
384 parse_degree( const string& degree_str) {
385     double result = parse_time( degree_str );
386
387     // printf("Degree = %.4f\n", result);
388
389     return(result);
390 }
391
392
393 // parse time offset string into seconds
394 static int
395 parse_time_offset( const string& time_str) {
396     int result;
397
398     // printf("time offset = %s\n", time_str);
399
400 #ifdef HAVE_RINT
401     result = (int)rint(parse_time(time_str) * 3600.0);
402 #else
403     result = (int)(parse_time(time_str) * 3600.0);
404 #endif
405
406     // printf("parse_time_offset(): %d\n", result);
407
408     return( result );
409 }
410
411
412 // Parse --fov=x.xx type option 
413 static double
414 parse_fov( const string& arg ) {
415     double fov = atof(arg);
416
417     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
418     if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
419
420     fgSetDouble("/sim/field-of-view", fov);
421
422     // printf("parse_fov(): result = %.4f\n", fov);
423
424     return fov;
425 }
426
427
428 // Parse I/O channel option
429 //
430 // Format is "--protocol=medium,direction,hz,medium_options,..."
431 //
432 //   protocol = { native, nmea, garmin, fgfs, rul, pve, etc. }
433 //   medium = { serial, socket, file, etc. }
434 //   direction = { in, out, bi }
435 //   hz = number of times to process channel per second (floating
436 //        point values are ok.
437 //
438 // Serial example "--nmea=serial,dir,hz,device,baud" where
439 // 
440 //  device = OS device name of serial line to be open()'ed
441 //  baud = {300, 1200, 2400, ..., 230400}
442 //
443 // Socket exacmple "--native=socket,dir,hz,machine,port,style" where
444 // 
445 //  machine = machine name or ip address if client (leave empty if server)
446 //  port = port, leave empty to let system choose
447 //  style = tcp or udp
448 //
449 // File example "--garmin=file,dir,hz,filename" where
450 // 
451 //  filename = file system file name
452
453 static bool 
454 add_channel( const string& type, const string& channel_str ) {
455     // cout << "Channel string = " << channel_str << endl;
456
457     globals->get_channel_options_list()->push_back( type + "," + channel_str );
458
459     return true;
460 }
461
462
463 // Parse --wp=ID[@alt]
464 static bool 
465 parse_wp( const string& arg ) {
466     string id, alt_str;
467     double alt = 0.0;
468
469     unsigned int pos = arg.find( "@" );
470     if ( pos != string::npos ) {
471         id = arg.substr( 0, pos );
472         alt_str = arg.substr( pos + 1 );
473         // cout << "id str = " << id << "  alt str = " << alt_str << endl;
474         alt = atof( alt_str.c_str() );
475         if ( fgGetString("/sim/startup/units") == "feet" ) {
476             alt *= SG_FEET_TO_METER;
477         }
478     } else {
479         id = arg;
480     }
481
482     FGAirport a;
483     if ( fgFindAirportID( id, &a ) ) {
484         SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
485         globals->get_route()->add_waypoint( wp );
486
487         return true;
488     } else {
489         return false;
490     }
491 }
492
493
494 // Parse --flight-plan=[file]
495 static bool 
496 parse_flightplan(const string& arg)
497 {
498     sg_gzifstream in(arg.c_str());
499     if ( !in.is_open() ) {
500         return false;
501     }
502     while ( true ) {
503         string line;
504
505 #if defined( macintosh )
506         getline( in, line, '\r' );
507 #else
508         getline( in, line, '\n' );
509 #endif
510
511         // catch extraneous (DOS) line ending character
512         if ( line[line.length() - 1] < 32 ) {
513             line = line.substr( 0, line.length()-1 );
514         }
515
516         if ( in.eof() ) {
517             break;
518         }
519         parse_wp(line);
520     }
521
522     return true;
523 }
524
525
526 // Parse a single option
527 static int 
528 parse_option (const string& arg) 
529 {
530     // General Options
531     if ( (arg == "--help") || (arg == "-h") ) {
532         // help/usage request
533         return(FG_OPTIONS_HELP);
534     } else if ( arg == "--disable-game-mode") {
535         fgSetBool("/sim/startup/game-mode", false);
536     } else if ( arg == "--enable-game-mode" ) {
537         fgSetBool("/sim/startup/game-mode", true);
538     } else if ( arg == "--disable-splash-screen" ) {
539         fgSetBool("/sim/startup/splash-screen", false); 
540     } else if ( arg == "--enable-splash-screen" ) {
541         fgSetBool("/sim/startup/splash-screen", true);
542     } else if ( arg == "--disable-intro-music" ) {
543         fgSetBool("/sim/startup/intro-music", false);
544     } else if ( arg == "--enable-intro-music" ) {
545         fgSetBool("/sim/startup/intro-music", true);
546     } else if ( arg == "--disable-mouse-pointer" ) {
547         fgSetString("/sim/startup/mouse-pointer", "disabled");
548     } else if ( arg == "--enable-mouse-pointer" ) {
549         fgSetString("/sim/startup/mouse-pointer", "enabled");
550     } else if ( arg == "--disable-freeze" ) {
551         fgSetBool("/sim/freeze", false);
552     } else if ( arg == "--enable-freeze" ) {
553         fgSetBool("/sim/freeze", true);
554     } else if ( arg == "--disable-anti-alias-hud" ) {
555         fgSetBool("/sim/hud/antialiased", false);
556     } else if ( arg == "--enable-anti-alias-hud" ) {
557         fgSetBool("/sim/hud/antialiased", true);
558     } else if ( arg.find( "--control=") == 0 ) {
559         fgSetString("/sim/control-mode", arg.substr(10));
560     } else if ( arg == "--disable-auto-coordination" ) {
561         fgSetBool("/sim/auto-coordination", false);
562     } else if ( arg == "--enable-auto-coordination" ) {
563         fgSetBool("/sim/auto-coordination", true);
564     } else if ( arg.find( "--browser-app=") == 0 ) {
565         fgSetString("/sim/startup/browser-app", arg.substr(14));
566     } else if ( arg == "--disable-hud" ) {
567         fgSetBool("/sim/hud/visibility", false);
568     } else if ( arg == "--enable-hud" ) {
569         fgSetBool("/sim/hud/visibility", true);
570     } else if ( arg == "--disable-panel" ) {
571         fgSetBool("/sim/panel/visibility", false);
572     } else if ( arg == "--enable-panel" ) {
573         fgSetBool("/sim/panel/visibility", true);
574     } else if ( arg == "--disable-sound" ) {
575         fgSetBool("/sim/sound", false);
576     } else if ( arg == "--enable-sound" ) {
577         fgSetBool("/sim/sound", true);
578     } else if ( arg.find( "--airport-id=") == 0 ) {
579                                 // NB: changed property name!!!
580         fgSetString("/sim/startup/airport-id", arg.substr(13));
581     } else if ( arg.find( "--offset-distance=") == 0 ) {
582         fgSetDouble("/sim/startup/offset-distance", atof(arg.substr(18)));
583     } else if ( arg.find( "--offset-azimuth=") == 0 ) {
584         fgSetDouble("/sim/startup/offset-azimuth", atof(arg.substr(17))); 
585     } else if ( arg.find( "--lon=" ) == 0 ) {
586         fgSetDouble("/position/longitude-deg",
587                               parse_degree(arg.substr(6)));
588         fgSetString("/sim/startup/airport-id", "");
589     } else if ( arg.find( "--lat=" ) == 0 ) {
590         fgSetDouble("/position/latitude-deg",
591                               parse_degree(arg.substr(6)));
592         fgSetString("/sim/startup/airport-id", "");
593     } else if ( arg.find( "--altitude=" ) == 0 ) {
594         fgSetBool("/sim/startup/onground", false);
595         if ( fgGetString("/sim/startup/units") == "feet" )
596             fgSetDouble("/position/altitude-ft", atof(arg.substr(11)));
597         else
598             fgSetDouble("/position/altitude-ft",
599                         atof(arg.substr(11)) * SG_METER_TO_FEET);
600     } else if ( arg.find( "--uBody=" ) == 0 ) {
601         fgSetString("/sim/startup/speed-set", "UVW");
602         if ( fgGetString("/sim/startup/units") == "feet" )
603           fgSetDouble("/velocities/uBody-fps", atof(arg.substr(8)));
604         else
605           fgSetDouble("/velocities/uBody-fps",
606                                atof(arg.substr(8)) * SG_METER_TO_FEET);
607     } else if ( arg.find( "--vBody=" ) == 0 ) {
608         fgSetString("/sim/startup/speed-set", "UVW");
609         if ( fgGetString("/sim/startup/units") == "feet" )
610           fgSetDouble("/velocities/vBody-fps", atof(arg.substr(8)));
611         else
612           fgSetDouble("/velocities/vBody-fps",
613                                atof(arg.substr(8)) * SG_METER_TO_FEET);
614     } else if ( arg.find( "--wBody=" ) == 0 ) {
615         fgSetString("/sim/startup/speed-set", "UVW");
616         if ( fgGetString("/sim/startup/units") == "feet" )
617           fgSetDouble("/velocities/wBody-fps", atof(arg.substr(8)));
618         else
619           fgSetDouble("/velocities/wBody-fps",
620                                atof(arg.substr(8)) * SG_METER_TO_FEET);
621     } else if ( arg.find( "--vNorth=" ) == 0 ) {
622         fgSetString("/sim/startup/speed-set", "NED");
623         if ( fgGetString("/sim/startup/units") == "feet" )
624           fgSetDouble("/velocities/speed-north-fps", atof(arg.substr(9)));
625         else
626           fgSetDouble("/velocities/speed-north-fps",
627                                atof(arg.substr(9)) * SG_METER_TO_FEET);
628     } else if ( arg.find( "--vEast=" ) == 0 ) {
629         fgSetString("/sim/startup/speed-set", "NED");
630         if ( fgGetString("/sim/startup/units") == "feet" )
631           fgSetDouble("/velocities/speed-east-fps", atof(arg.substr(8)));
632         else
633           fgSetDouble("/velocities/speed-east-fps",
634                       atof(arg.substr(8)) * SG_METER_TO_FEET);
635     } else if ( arg.find( "--vDown=" ) == 0 ) {
636         fgSetString("/sim/startup/speed-set", "NED");
637         if ( fgGetString("/sim/startup/units") == "feet" )
638           fgSetDouble("/velocities/speed-down-fps", atof(arg.substr(8)));
639         else
640           fgSetDouble("/velocities/speed-down-fps",
641                                atof(arg.substr(8)) * SG_METER_TO_FEET);
642     } else if ( arg.find( "--vc=" ) == 0) {
643         fgSetString("/sim/startup/speed-set", "knots");
644         fgSetDouble("/velocities/airspeed-kt", atof(arg.substr(5)));
645     } else if ( arg.find( "--mach=" ) == 0) {
646         fgSetString("/sim/startup/speed-set", "mach");
647         fgSetDouble("/velocities/mach", atof(arg.substr(7)));
648     } else if ( arg.find( "--heading=" ) == 0 ) {
649         fgSetDouble("/orientation/heading-deg", atof(arg.substr(10)));
650     } else if ( arg.find( "--roll=" ) == 0 ) {
651         fgSetDouble("/orientation/roll-deg", atof(arg.substr(7)));
652     } else if ( arg.find( "--pitch=" ) == 0 ) {
653         fgSetDouble("/orientation/pitch-deg", atof(arg.substr(8)));
654     } else if ( arg.find( "--fg-root=" ) == 0 ) {
655         globals->set_fg_root(arg.substr( 10 ));
656     } else if ( arg.find( "--fg-scenery=" ) == 0 ) {
657         globals->set_fg_scenery(arg.substr( 13 ));
658     } else if ( arg.find( "--fdm=" ) == 0 ) {
659         fgSetString("/sim/flight-model", arg.substr(6));
660     } else if ( arg.find( "--aero=" ) == 0 ) {
661         fgSetString("/sim/aero", arg.substr(7));
662     } else if ( arg.find( "--aircraft-dir=" ) == 0 ) {
663         fgSetString("/sim/aircraft-dir", arg.substr(15));
664     } else if ( arg.find( "--model-hz=" ) == 0 ) {
665         fgSetInt("/sim/model-hz", atoi(arg.substr(11)));
666     } else if ( arg.find( "--speed=" ) == 0 ) {
667         fgSetInt("/sim/speed-up", atoi(arg.substr(8)));
668     } else if ( arg.find( "--trim") == 0) {
669         fgSetBool("/sim/startup/trim", true);
670     } else if ( arg.find( "--notrim") == 0) {
671         fgSetBool("/sim/startup/trim", false);
672     } else if ( arg.find( "--on-ground") == 0) {
673         fgSetBool("/sim/startup/onground", true);
674     } else if ( arg.find( "--in-air") == 0) {
675         fgSetBool("/sim/startup/onground", false);
676     } else if ( arg == "--fog-disable" ) {
677         fgSetString("/sim/rendering/fog", "disabled");
678     } else if ( arg == "--fog-fastest" ) {
679         fgSetString("/sim/rendering/fog", "fastest");
680     } else if ( arg == "--fog-nicest" ) {
681         fgSetString("/sim/fog", "nicest");
682     } else if ( arg == "--disable-clouds" ) {
683         fgSetBool("/environment/clouds/status", false);
684     } else if ( arg == "--enable-clouds" ) {
685         fgSetBool("/environment/clouds/status", true);
686     } else if ( arg.find( "--clouds-asl=" ) == 0 ) {
687                                 // FIXME: check units
688         if ( fgGetString("/sim/startup/units") == "feet" )
689           fgSetDouble("/environment/clouds/altitude-ft",
690                                 atof(arg.substr(13)) * SG_FEET_TO_METER);
691         else
692           fgSetDouble("/environment/clouds/altitude-ft",
693                                 atof(arg.substr(13)));
694     } else if ( arg.find( "--fov=" ) == 0 ) {
695         parse_fov( arg.substr(6) );
696     } else if ( arg == "--disable-fullscreen" ) {
697         fgSetBool("/sim/startup/fullscreen", false);
698     } else if ( arg== "--enable-fullscreen") {
699         fgSetBool("/sim/startup/fullscreen", true);
700     } else if ( arg == "--shading-flat") {
701         fgSetBool("/sim/rendering/shading", false);
702     } else if ( arg == "--shading-smooth") {
703         fgSetBool("/sim/rendering/shading", true);
704     } else if ( arg == "--disable-skyblend") {
705         fgSetBool("/sim/rendering/skyblend", false);
706     } else if ( arg== "--enable-skyblend" ) {
707         fgSetBool("/sim/rendering/skyblend", true);
708     } else if ( arg == "--disable-textures" ) {
709         fgSetBool("/sim/rendering/textures", false);
710     } else if ( arg == "--enable-textures" ) {
711         fgSetBool("/sim/rendering/textures", true);
712     } else if ( arg == "--disable-wireframe" ) {
713         fgSetBool("/sim/rendering/wireframe", false);
714     } else if ( arg == "--enable-wireframe" ) {
715         fgSetBool("/sim/rendering/wireframe", true);
716     } else if ( arg.find( "--geometry=" ) == 0 ) {
717         bool geometry_ok = true;
718         int xsize = 0, ysize = 0;
719         string geometry = arg.substr( 11 );
720         string::size_type i = geometry.find('x');
721
722         if (i != string::npos) {
723             xsize = atoi(geometry.substr(0, i));
724             ysize = atoi(geometry.substr(i+1));
725         } else {
726             geometry_ok = false;
727         }
728
729         if ( xsize <= 0 || ysize <= 0 ) {
730             xsize = 640;
731             ysize = 480;
732             geometry_ok = false;
733         }
734
735         if ( !geometry_ok ) {
736             SG_LOG( SG_GENERAL, SG_ALERT, "Unknown geometry: " << geometry );
737             SG_LOG( SG_GENERAL, SG_ALERT,
738                     "Setting geometry to " << xsize << 'x' << ysize << '\n');
739         } else {
740           SG_LOG( SG_GENERAL, SG_INFO,
741                   "Setting geometry to " << xsize << 'x' << ysize << '\n');
742           fgSetInt("/sim/startup/xsize", xsize);
743           fgSetInt("/sim/startup/ysize", ysize);
744         }
745     } else if ( arg.find( "--bpp=" ) == 0 ) {
746         string bits_per_pix = arg.substr( 6 );
747         if ( bits_per_pix == "16" ) {
748             fgSetInt("/sim/rendering/bits-per-pixel", 16);
749         } else if ( bits_per_pix == "24" ) {
750             fgSetInt("/sim/rendering/bits-per-pixel", 24);
751         } else if ( bits_per_pix == "32" ) {
752             fgSetInt("/sim/rendering/bits-per-pixel", 32);
753         } else {
754           SG_LOG(SG_GENERAL, SG_ALERT, "Unsupported bpp " << bits_per_pix);
755         }
756     } else if ( arg == "--units-feet" ) {
757         fgSetString("/sim/startup/units", "feet");
758     } else if ( arg == "--units-meters" ) {
759         fgSetString("/sim/startup/units", "meters");
760     } else if ( arg.find( "--time-offset" ) == 0 ) {
761         fgSetInt("/sim/startup/time-offset",
762                            parse_time_offset( (arg.substr(14)) ));
763     } else if ( arg.find( "--time-match-real") == 0 ) {
764         fgSetString("/sim/startup/time-offset-type",
765                               "system-offset");
766     } else if ( arg.find( "--time-match-local") == 0 ) {
767         fgSetString("/sim/startup/time-offset-type",
768                               "latitude-offset");
769     } else if ( arg.find( "--start-date-sys=") == 0 ) {
770         fgSetInt("/sim/startup/time-offset",
771                            parse_date((arg.substr(17))));
772         fgSetString("/sim/startup/time-offset-type", "system");
773     } else if ( arg.find( "--start-date-lat=") == 0 ) {
774         fgSetInt("/sim/startup/time-offset",
775                            parse_date((arg.substr(17))));
776         fgSetString("/sim/startup/time-offset-type",
777                            "latitude");
778     } else if ( arg.find( "--start-date-gmt=") == 0 ) {
779         fgSetInt("/sim/startup/time-offset",
780                            parse_date((arg.substr(17))));
781         fgSetString("/sim/startup/time-offset-type", "gmt");
782     } else if ( arg == "--hud-tris" ) {
783         fgSetString("/sim/hud/frame-stat-type", "tris");
784     } else if ( arg == "--hud-culled" ) {
785         fgSetString("/sim/hud/frame-stat-type", "culled");
786     } else if ( arg.find( "--atlas=" ) == 0 ) {
787         add_channel( "atlas", arg.substr(8) );
788     } else if ( arg.find( "--httpd=" ) == 0 ) {
789         add_channel( "httpd", arg.substr(8) );
790     } else if ( arg.find( "--native=" ) == 0 ) {
791         add_channel( "native", arg.substr(9) );
792     } else if ( arg.find( "--native-ctrls=" ) == 0 ) {
793         add_channel( "native_ctrls", arg.substr(15) );
794     } else if ( arg.find( "--native-fdm=" ) == 0 ) {
795         add_channel( "native_fdm", arg.substr(13) );
796     } else if ( arg.find( "--opengc=" ) == 0 ) {
797         // char stop;
798         // cout << "Adding channel for OpenGC Display" << endl; cin >> stop;
799         add_channel( "opengc", arg.substr(9) );
800     } else if ( arg.find( "--garmin=" ) == 0 ) {
801         add_channel( "garmin", arg.substr(9) );
802     } else if ( arg.find( "--nmea=" ) == 0 ) {
803         add_channel( "nmea", arg.substr(7) );
804     } else if ( arg.find( "--props=" ) == 0 ) {
805         add_channel( "props", arg.substr(8) );
806     } else if ( arg.find( "--pve=" ) == 0 ) {
807         add_channel( "pve", arg.substr(6) );
808     } else if ( arg.find( "--ray=" ) == 0 ) {
809         add_channel( "ray", arg.substr(6) );
810     } else if ( arg.find( "--rul=" ) == 0 ) {
811         add_channel( "rul", arg.substr(6) );
812     } else if ( arg.find( "--joyclient=" ) == 0 ) {
813         add_channel( "joyclient", arg.substr(12) );
814 #ifdef FG_NETWORK_OLK
815     } else if ( arg == "--disable-network-olk" ) {
816         fgSetBool("/sim/networking/olk", false);
817     } else if ( arg== "--enable-network-olk") {
818         fgSetBool("/sim/networking/olk", true);
819     } else if ( arg == "--net-hud" ) {
820         fgSetBool("/sim/hud/net-display", true);
821         net_hud_display = 1;    // FIXME
822     } else if ( arg.find( "--net-id=") == 0 ) {
823         fgSetString("sim/networking/call-sign", arg.substr(9));
824 #endif
825     } else if ( arg.find( "--prop:" ) == 0 ) {
826         string assign = arg.substr(7);
827         unsigned int pos = assign.find('=');
828         if ( pos == arg.npos || pos == 0 ) {
829             SG_LOG( SG_GENERAL, SG_ALERT, "Bad property assignment: " << arg );
830             return FG_OPTIONS_ERROR;
831         }
832         string name = assign.substr(0, pos);
833         string value = assign.substr(pos + 1);
834         fgSetString(name.c_str(), value);
835         // SG_LOG(SG_GENERAL, SG_INFO, "Setting default value of property "
836         //        << name << " to \"" << value << '"');
837     } else if ( arg.find("--trace-read=") == 0) {
838         string name = arg.substr(13);
839         SG_LOG(SG_GENERAL, SG_INFO, "Tracing reads for property " << name);
840         fgGetNode(name, true)->setAttribute(SGPropertyNode::TRACE_READ, true);
841     } else if ( arg.find("--trace-write=") == 0) {
842         string name = arg.substr(14);
843         SG_LOG(SG_GENERAL, SG_INFO, "Tracing writes for property " << name);
844         fgGetNode(name, true)->setAttribute(SGPropertyNode::TRACE_WRITE, true);
845     } else if ( arg.find( "--view-offset=" ) == 0 ) {
846         // $$$ begin - added VS Renganathan, 14 Oct 2K
847         // for multi-window outside window imagery
848         string woffset = arg.substr( 14 );
849         double default_view_offset = 0.0;
850         if ( woffset == "LEFT" ) {
851                default_view_offset = SGD_PI * 0.25;
852         } else if ( woffset == "RIGHT" ) {
853             default_view_offset = SGD_PI * 1.75;
854         } else if ( woffset == "CENTER" ) {
855             default_view_offset = 0.00;
856         } else {
857             default_view_offset = atof( woffset.c_str() ) * SGD_DEGREES_TO_RADIANS;
858         }
859         FGViewerRPH *pilot_view =
860             (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
861         pilot_view->set_view_offset( default_view_offset );
862         pilot_view->set_goal_view_offset( default_view_offset );
863         fgSetDouble("/sim/view/offset-deg", default_view_offset);
864     // $$$ end - added VS Renganathan, 14 Oct 2K
865     } else if ( arg.find( "--visibility=" ) == 0 ) {
866         fgSetDouble("/environment/visibility-m", atof(arg.substr(13)));
867     } else if ( arg.find( "--visibility-miles=" ) == 0 ) {
868         double visibility = atof(arg.substr(19)) * 5280.0 * SG_FEET_TO_METER;
869         fgSetDouble("/environment/visibility-m", visibility);
870     } else if ( arg.find( "--wind=" ) == 0 ) {
871         string val = arg.substr(7);
872         unsigned int pos = val.find('@');
873         if ( pos == string::npos ) {
874           SG_LOG( SG_GENERAL, SG_ALERT, "bad wind value " << val );
875           return FG_OPTIONS_ERROR;
876         }
877         double dir = atof(val.substr(0,pos).c_str());
878         double speed = atof(val.substr(pos+1).c_str());
879         SG_LOG(SG_GENERAL, SG_INFO, "WIND: " << dir << '@' << 
880                speed << " knots" << endl);
881         fgSetDouble("/environment/wind-from-heading-deg", dir);
882         fgSetDouble("/environment/wind-speed-knots", speed);
883
884         // convert to fps
885         speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
886         // dir += 180;
887         if (dir >= 360)
888           dir -= 360;
889         dir *= SGD_DEGREES_TO_RADIANS;
890         fgSetDouble("/environment/wind-north-fps",
891                     speed * cos(dir));
892         fgSetDouble("/environment/wind-east-fps",
893                     speed * sin(dir));
894     } else if ( arg.find( "--wp=" ) == 0 ) {
895         parse_wp( arg.substr( 5 ) );
896     } else if ( arg.find( "--flight-plan=") == 0) {
897         parse_flightplan ( arg.substr (14) );
898     } else if ( arg.find( "--config=" ) == 0 ) {
899         string file = arg.substr(9);
900         try {
901           readProperties(file, globals->get_props());
902         } catch (const sg_exception &e) {
903           string message = "Error loading config file: ";
904           message += e.getFormattedMessage();
905           SG_LOG(SG_INPUT, SG_ALERT, message);
906           exit(2);
907         }
908     } else if ( arg.find( "--aircraft=" ) == 0 ) {
909         // read in the top level aircraft definition file
910         SGPath apath( globals->get_fg_root() );
911         apath.append( "Aircraft" );
912         apath.append( arg.substr(11) );
913         apath.concat( "-set.xml" );
914         try {
915             readProperties( apath.str(), globals->get_props() );
916         } catch (const sg_exception &e) {
917             string message = "Error loading aircraft file: ";
918             message += e.getFormattedMessage();
919             SG_LOG(SG_INPUT, SG_ALERT, message);
920             exit(2);
921         }
922     } else {
923         SG_LOG( SG_GENERAL, SG_ALERT, "Unknown option '" << arg << "'" );
924         return FG_OPTIONS_ERROR;
925     }
926     
927     return FG_OPTIONS_OK;
928 }
929
930
931 // Scan the command line options for an fg_root definition and set
932 // just that.
933 string
934 fgScanForRoot (int argc, char **argv) 
935 {
936     int i = 1;
937
938     SG_LOG(SG_GENERAL, SG_INFO, "Scanning for root: command line");
939
940     while ( i < argc ) {
941         SG_LOG( SG_GENERAL, SG_DEBUG, "argv[" << i << "] = " << argv[i] );
942
943         string arg = argv[i];
944         if ( arg.find( "--fg-root=" ) == 0 ) {
945             return arg.substr( 10 );
946         }
947
948         i++;
949     }
950
951     return "";
952 }
953
954
955 // Scan the config file for an fg_root definition and set just that.
956 string
957 fgScanForRoot (const string& path)
958 {
959     sg_gzifstream in( path );
960     if ( !in.is_open() )
961       return "";
962
963     SG_LOG( SG_GENERAL, SG_INFO, "Scanning for root: " << path );
964
965     in >> skipcomment;
966 #ifndef __MWERKS__
967     while ( ! in.eof() ) {
968 #else
969     char c = '\0';
970     while ( in.get(c) && c != '\0' ) {
971         in.putback(c);
972 #endif
973         string line;
974
975 #if defined( macintosh )
976         getline( in, line, '\r' );
977 #else
978         getline( in, line, '\n' );
979 #endif
980
981         // catch extraneous (DOS) line ending character
982         if ( line[line.length() - 1] < 32 ) {
983             line = line.substr( 0, line.length()-1 );
984         }
985
986         if ( line.find( "--fg-root=" ) == 0 ) {
987             return line.substr( 10 );
988         }
989
990         in >> skipcomment;
991     }
992
993     return "";
994 }
995
996
997 // Parse the command line options
998 void
999 fgParseArgs (int argc, char **argv)
1000 {
1001     bool in_options = true;
1002
1003     SG_LOG(SG_GENERAL, SG_INFO, "Processing command line arguments");
1004
1005     for (int i = 1; i < argc; i++) {
1006         string arg = argv[i];
1007
1008         if (in_options && (arg.find('-') == 0)) {
1009           if (arg == "--") {
1010             in_options = false;
1011           } else {
1012             int result = parse_option(arg);
1013             if ( (result == FG_OPTIONS_HELP) ||
1014                  (result == FG_OPTIONS_ERROR) ) {
1015               fgUsage();
1016               exit(-1);
1017             }
1018           }
1019         } else {
1020           in_options = false;
1021           SG_LOG(SG_GENERAL, SG_INFO,
1022                  "Reading command-line property file " << arg);
1023           readProperties(arg, globals->get_props());
1024         }
1025     }
1026
1027     SG_LOG(SG_GENERAL, SG_INFO, "Finished command line arguments");
1028 }
1029
1030
1031 // Parse config file options
1032 void
1033 fgParseOptions (const string& path) {
1034     sg_gzifstream in( path );
1035     if ( !in.is_open() ) {
1036         return;
1037     }
1038
1039     SG_LOG( SG_GENERAL, SG_INFO, "Processing config file: " << path );
1040
1041     in >> skipcomment;
1042 #ifndef __MWERKS__
1043     while ( ! in.eof() ) {
1044 #else
1045     char c = '\0';
1046     while ( in.get(c) && c != '\0' ) {
1047         in.putback(c);
1048 #endif
1049         string line;
1050
1051 #if defined( macintosh )
1052         getline( in, line, '\r' );
1053 #else
1054         getline( in, line, '\n' );
1055 #endif
1056
1057         // catch extraneous (DOS) line ending character
1058         if ( line[line.length() - 1] < 32 ) {
1059             line = line.substr( 0, line.length()-1 );
1060         }
1061
1062         if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
1063             SG_LOG( SG_GENERAL, SG_ALERT, 
1064                     "Config file parse error: " << path << " '" 
1065                     << line << "'" );
1066             fgUsage();
1067             exit(-1);
1068         }
1069         in >> skipcomment;
1070     }
1071 }
1072
1073
1074 // Print usage message
1075 void 
1076 fgUsage ()
1077 {
1078     cout << "Usage: fgfs [ options ... ]" << endl;
1079     cout << endl;
1080
1081     cout << "General Options:" << endl;
1082     cout << "\t--help -h:  print usage" << endl;
1083     cout << "\t--fg-root=path:  specify the root path for all the data files"
1084          << endl;
1085     cout << "\t--fg-scenery=path:  specify the base path for all the scenery"
1086          << " data." << endl
1087          << "\t\tdefaults to $FG_ROOT/Scenery" << endl;
1088     cout << "\t--disable-game-mode:  disable full-screen game mode" << endl;
1089     cout << "\t--enable-game-mode:  enable full-screen game mode" << endl;
1090     cout << "\t--disable-splash-screen:  disable splash screen" << endl;
1091     cout << "\t--enable-splash-screen:  enable splash screen" << endl;
1092     cout << "\t--disable-intro-music:  disable introduction music" << endl;
1093     cout << "\t--enable-intro-music:  enable introduction music" << endl;
1094     cout << "\t--disable-mouse-pointer:  disable extra mouse pointer" << endl;
1095     cout << "\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for"
1096          << endl;
1097     cout << "\t\tfull screen voodoo/voodoo-II based cards.)" << endl;
1098     cout << "\t--disable-freeze:  start out in a running state" << endl;
1099     cout << "\t--enable-freeze:  start out in a frozen state" << endl;
1100     cout << "\t--control=mode:  primary control mode " 
1101          << "(joystick, keyboard, mouse)" << endl;
1102     cout << "\t--enable-auto-coordination:  enable auto coordination" << endl;
1103     cout << "\t--disable-auto-coordination:  disable auto coordination" << endl;
1104     cout << "\t--browser-app=/path/to/app:  specify location of your web browser" << endl;
1105     cout << "\t--prop:name=value:  set property <name> to <value>" << endl;
1106     cout << "\t--config=path:  load additional properties from path" << endl;
1107     cout << endl;
1108
1109     cout << "Features:" << endl;
1110     cout << "\t--disable-hud:  disable heads up display" << endl;
1111     cout << "\t--enable-hud:  enable heads up display" << endl;
1112     cout << "\t--disable-panel:  disable instrument panel" << endl;
1113     cout << "\t--enable-panel:  enable instrument panel" << endl;
1114     cout << "\t--disable-sound:  disable sound effects" << endl;
1115     cout << "\t--enable-sound:  enable sound effects" << endl;
1116     cout << "\t--disable-anti-alias-hud:  disable anti aliased hud" << endl;
1117     cout << "\t--enable-anti-alias-hud:  enable anti aliased hud" << endl;
1118     cout << endl;
1119
1120     cout << "Aircraft:" <<endl;
1121     cout << "\t--aircraft=name:  select a top level <name>-set.xml file which" << endl;
1122     cout << "\t\twill automatically pull in the correct flight dynamics model," << endl;
1123     cout << "\t\taero specification, external 3d model, instrument panel, sounds," << endl;
1124     cout << "\t\tetc." << endl;
1125     
1126     cout << endl;
1127
1128     cout << "Flight Model:" << endl;
1129     cout << "\t--fdm=abcd:  selects the core flight model code." << endl;
1130     cout << "\t\tcan be one of jsb, larcsim, magic, null, external, balloon, or ada"
1131          << endl;
1132     cout << "\t--aero=abcd:  aerodynamics model to load" << endl;
1133     cout << "\t--model-hz=n:  run the FDM this rate (iterations per second)" 
1134          << endl;
1135     cout << "\t--speed=n:  run the FDM this much faster than real time" << endl;
1136     cout << "\t--notrim:  Do NOT attempt to trim the model when initializing JSBsim" << endl;
1137     cout << "\t--on-ground:  Start up at ground level (default)" << endl;
1138     cout << "\t--in-air:  Start up in air (implied by specifying an initial"
1139          << " altitude above ground level." << endl;
1140     cout << "\t--wind=DIR@SPEED: specify wind coming from DIR (degrees) at SPEED (knots)" << endl;
1141     cout << endl;
1142
1143     //(UIUC)
1144     cout <<"Aircraft model directory:" << endl;
1145     cout <<"\t--aircraft-dir=<path> path is relative to the path of the executable" << endl;
1146     cout << endl;
1147
1148     cout << "Initial Position and Orientation:" << endl;
1149     cout << "\t--airport-id=ABCD:  specify starting postion by airport id" 
1150          << endl;
1151     cout << "\t--offset-distance:  specify distance to threshold"
1152          << " (NM)" << endl; 
1153     cout << "\t--offset-azimuth:  specify heading to threshold (deg) " 
1154          << endl;    
1155     cout << "\t--lon=degrees:  starting longitude in degrees (west = -)" 
1156          << endl;
1157     cout << "\t--lat=degrees:  starting latitude in degrees (south = -)"
1158          << endl;
1159     cout << "\t--altitude=feet:  starting altitude in feet" << endl;
1160     cout << "\t\t(unless --units-meters specified)" << endl;
1161     cout << "\t--heading=degrees:  heading (yaw) angle in degrees (Psi)"
1162          << endl;
1163     cout << "\t--roll=degrees:  roll angle in degrees (Phi)" << endl;
1164     cout << "\t--pitch=degrees:  pitch angle in degrees (Theta)" << endl;
1165     cout << "\t--uBody=feet per second:  velocity along the body X axis"
1166          << endl;
1167     cout << "\t--vBody=feet per second:  velocity along the body Y axis"
1168          << endl;
1169     cout << "\t--wBody=feet per second:  velocity along the body Z axis"
1170          << endl;
1171     cout << "\t\t(unless --units-meters specified)" << endl;
1172     cout << "\t--vc= initial airspeed in knots" << endl;
1173     cout << "\t--mach= initial mach number" << endl;
1174     cout << endl;
1175
1176     cout << "Rendering Options:" << endl;
1177     cout << "\t--fog-disable:  disable fog/haze" << endl;
1178     cout << "\t--fog-fastest:  enable fastest fog/haze" << endl;
1179     cout << "\t--fog-nicest:  enable nicest fog/haze" << endl;
1180     cout << "\t--enable-clouds:  enable demo cloud layer" << endl;
1181     cout << "\t--disable-clouds:  disable demo cloud layer" << endl;
1182     cout << "\t--clouds-asl=xxx:  specify altitude of cloud layer above sea level" << endl;
1183     cout << "\t--fov=xx.x:  specify initial field of view angle in degrees"
1184          << endl;
1185     cout << "\t--disable-fullscreen:  disable fullscreen mode" << endl;
1186     cout << "\t--enable-fullscreen:  enable fullscreen mode" << endl;
1187     cout << "\t--shading-flat:  enable flat shading" << endl;
1188     cout << "\t--shading-smooth:  enable smooth shading" << endl;
1189     cout << "\t--disable-skyblend:  disable sky blending" << endl;
1190     cout << "\t--enable-skyblend:  enable sky blending" << endl;
1191     cout << "\t--disable-textures:  disable textures" << endl;
1192     cout << "\t--enable-textures:  enable textures" << endl;
1193     cout << "\t--disable-wireframe:  disable wireframe drawing mode" << endl;
1194     cout << "\t--enable-wireframe:  enable wireframe drawing mode" << endl;
1195     cout << "\t--geometry=WWWxHHH:  window geometry: 640x480, 800x600, etc."
1196          << endl;
1197     cout << "\t--view-offset=xxx:  set the default forward view direction"
1198          << endl;
1199     cout << "\t\tas an offset from straight ahead.  Allowable values are"
1200          << endl;
1201     cout << "\t\tLEFT, RIGHT, CENTER, or a specific number of degrees" << endl;
1202     cout << "\t--visibility=xxx:  specify initial visibility in meters" << endl;
1203     cout << "\t--visibility-miles=xxx:  specify initial visibility in miles"
1204          << endl;
1205     cout << endl;
1206
1207     cout << "Scenery Options:" << endl;
1208     cout << "\t--tile-radius=n:  specify tile radius, must be 1 - 4" << endl;
1209     cout << endl;
1210
1211     cout << "Hud Options:" << endl;
1212     cout << "\t--units-feet:  Hud displays units in feet" << endl;
1213     cout << "\t--units-meters:  Hud displays units in meters" << endl;
1214     cout << "\t--hud-tris:  Hud displays number of triangles rendered" << endl;
1215     cout << "\t--hud-culled:  Hud displays percentage of triangles culled"
1216          << endl;
1217     cout << endl;
1218         
1219     cout << "Time Options:" << endl;
1220     cout << "\t--time-offset=[+-]hh:mm:ss: add this time offset" << endl;
1221     cout << "\t--time-match-real: Synchronize real-world and FlightGear" << endl
1222          << "\t\ttime. Can be used in combination with --time-offset." << endl;
1223     cout << "\t--time-match-local:Synchronize local real-world and " << endl
1224          << "\t\tFlightGear time" << endl;   
1225     cout << "\t--start-date-sys=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1226          << "\t\tdate/time. Uses your system time " << endl;
1227     cout << "\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1228          << "\t\tdate/time. Uses Greenwich Mean Time" << endl;
1229     cout << "\t--start-date-lat=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1230          << "\t\tdate/time. Uses Local Aircraft Time" << endl;
1231 #ifdef FG_NETWORK_OLK
1232     cout << endl;
1233
1234     cout << "Network Options:" << endl;
1235     cout << "\t--httpd=port:  enable http server on the specified port" << endl;
1236     cout << "\t--enable-network-olk:  enable Multipilot mode" << endl;
1237     cout << "\t--disable-network-olk:  disable Multipilot mode (default)" << endl;
1238     cout << "\t--net-hud:  Hud displays network info" << endl;
1239     cout << "\t--net-id=name:  specify your own callsign" << endl;
1240 #endif
1241
1242     cout << endl;
1243     cout << "Route/Way Point Options:" << endl;
1244     cout << "\t--wp=ID[@alt]:  specify a waypoint for the GC autopilot" << endl;
1245     cout << "\t\tYou can specify multiple waypoints (a route) with multiple"
1246          << endl;
1247     cout << "\t\tinstances of --wp=" << endl;
1248     cout << "\t--flight-plan=[file]: Read all waypoints from [file]" <<endl;
1249 }