Output position & orientation when pausing.
Eliminated libtool use. Added options to specify initial position and orientation. Changed default fov to 55 degrees. Added command line option to start in paused or unpaused state.
This commit is contained in:
parent
09ef1dd426
commit
e81eeba64f
6 changed files with 274 additions and 108 deletions
|
@ -58,6 +58,7 @@
|
||||||
/* Handle keyboard events */
|
/* Handle keyboard events */
|
||||||
void GLUTkey(unsigned char k, int x, int y) {
|
void GLUTkey(unsigned char k, int x, int y) {
|
||||||
fgCONTROLS *c;
|
fgCONTROLS *c;
|
||||||
|
fgFLIGHT *f;
|
||||||
fgTIME *t;
|
fgTIME *t;
|
||||||
fgVIEW *v;
|
fgVIEW *v;
|
||||||
struct fgWEATHER *w;
|
struct fgWEATHER *w;
|
||||||
|
@ -65,6 +66,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
c = current_aircraft.controls;
|
c = current_aircraft.controls;
|
||||||
|
f = current_aircraft.flight;
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
w = ¤t_weather;
|
w = ¤t_weather;
|
||||||
|
@ -189,6 +191,17 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case 112: /* p key */
|
case 112: /* p key */
|
||||||
t->pause = !t->pause;
|
t->pause = !t->pause;
|
||||||
|
// printf position and attitude information
|
||||||
|
fgPrintf( FG_INPUT, FG_INFO,
|
||||||
|
"Lon = %.4f Lat = %.4f Altitude = %.1f\n",
|
||||||
|
FG_Longitude * RAD_TO_DEG,
|
||||||
|
FG_Latitude * RAD_TO_DEG,
|
||||||
|
FG_Altitude * FEET_TO_METER);
|
||||||
|
fgPrintf( FG_INPUT, FG_INFO,
|
||||||
|
"Heading = %.2f Roll = %.2f Pitch = %.2f\n",
|
||||||
|
FG_Psi * RAD_TO_DEG,
|
||||||
|
FG_Phi * RAD_TO_DEG,
|
||||||
|
FG_Theta * RAD_TO_DEG);
|
||||||
return;
|
return;
|
||||||
case 116: /* t key */
|
case 116: /* t key */
|
||||||
t->warp_delta += 30;
|
t->warp_delta += 30;
|
||||||
|
@ -308,11 +321,18 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.17 1998/07/27 18:41:23 curt
|
/* Revision 1.18 1998/07/30 23:48:24 curt
|
||||||
/* Added a pause command "p"
|
/* Output position & orientation when pausing.
|
||||||
/* Fixed some initialization order problems between pui and glut.
|
/* Eliminated libtool use.
|
||||||
/* Added an --enable/disable-sound option.
|
/* Added options to specify initial position and orientation.
|
||||||
|
/* Changed default fov to 55 degrees.
|
||||||
|
/* Added command line option to start in paused or unpaused state.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.17 1998/07/27 18:41:23 curt
|
||||||
|
* Added a pause command "p"
|
||||||
|
* Fixed some initialization order problems between pui and glut.
|
||||||
|
* Added an --enable/disable-sound option.
|
||||||
|
*
|
||||||
* Revision 1.16 1998/07/16 17:33:34 curt
|
* Revision 1.16 1998/07/16 17:33:34 curt
|
||||||
* "H" / "h" now control hud brightness as well with off being one of the
|
* "H" / "h" now control hud brightness as well with off being one of the
|
||||||
* states.
|
* states.
|
||||||
|
|
|
@ -379,6 +379,7 @@ static void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// render the moon
|
// render the moon
|
||||||
xglEnable( GL_LIGHTING );
|
xglEnable( GL_LIGHTING );
|
||||||
|
xglEnable( GL_LIGHT0 );
|
||||||
// set lighting parameters
|
// set lighting parameters
|
||||||
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
|
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
|
||||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
|
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
|
||||||
|
@ -466,9 +467,9 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
|
||||||
|
|
||||||
if ( !t->pause ) {
|
if ( !t->pause ) {
|
||||||
// printf("updating flight model x %d\n", multi_loop);
|
// printf("updating flight model x %d\n", multi_loop);
|
||||||
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
|
fgFlightModelUpdate(current_options.get_flight_model(), f, multi_loop);
|
||||||
} else {
|
} else {
|
||||||
fgFlightModelUpdate(FG_LARCSIM, f, 0);
|
fgFlightModelUpdate(current_options.get_flight_model(), f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the view angle
|
// update the view angle
|
||||||
|
@ -559,7 +560,7 @@ static void fgMainLoop( void ) {
|
||||||
FG_Altitude * FEET_TO_METER,
|
FG_Altitude * FEET_TO_METER,
|
||||||
scenery.cur_elev + 3.758099 * FEET_TO_METER - 3.0,
|
scenery.cur_elev + 3.758099 * FEET_TO_METER - 3.0,
|
||||||
scenery.cur_elev + 3.758099 * FEET_TO_METER);
|
scenery.cur_elev + 3.758099 * FEET_TO_METER);
|
||||||
fgFlightModelSetAltitude( FG_LARCSIM, f,
|
fgFlightModelSetAltitude( current_options.get_flight_model(), f,
|
||||||
scenery.cur_elev +
|
scenery.cur_elev +
|
||||||
3.758099 * FEET_TO_METER);
|
3.758099 * FEET_TO_METER);
|
||||||
|
|
||||||
|
@ -933,6 +934,13 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.42 1998/07/30 23:48:25 curt
|
||||||
|
// Output position & orientation when pausing.
|
||||||
|
// Eliminated libtool use.
|
||||||
|
// Added options to specify initial position and orientation.
|
||||||
|
// Changed default fov to 55 degrees.
|
||||||
|
// Added command line option to start in paused or unpaused state.
|
||||||
|
//
|
||||||
// Revision 1.41 1998/07/27 18:41:24 curt
|
// Revision 1.41 1998/07/27 18:41:24 curt
|
||||||
// Added a pause command "p"
|
// Added a pause command "p"
|
||||||
// Fixed some initialization order problems between pui and glut.
|
// Fixed some initialization order problems between pui and glut.
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
if ENABLE_AUDIO_SUPPORT
|
if ENABLE_AUDIO_SUPPORT
|
||||||
DEFS += -DENABLE_AUDIO_SUPPORT
|
DEFS += -DENABLE_AUDIO_SUPPORT
|
||||||
AUDIO_LIBS = \
|
AUDIO_LIBS = \
|
||||||
$(top_builddir)/Lib/Audio/src/libsl.la \
|
$(top_builddir)/Lib/Audio/src/libsl.a \
|
||||||
$(top_builddir)/Lib/Audio/src/libsm.la
|
$(top_builddir)/Lib/Audio/src/libsm.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ENABLE_IRIX_AUDIO
|
||||||
|
LIBS += -laudio
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_WIN32_AUDIO
|
if ENABLE_WIN32_AUDIO
|
||||||
|
@ -44,11 +48,11 @@ fg_LDADD = \
|
||||||
$(top_builddir)/Simulator/Weather/libWeather.a \
|
$(top_builddir)/Simulator/Weather/libWeather.a \
|
||||||
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
||||||
$(AUDIO_LIBS) \
|
$(AUDIO_LIBS) \
|
||||||
$(top_builddir)/Lib/Math/libMath.la \
|
$(top_builddir)/Lib/Math/libMath.a \
|
||||||
$(top_builddir)/Lib/Bucket/libBucket.la \
|
$(top_builddir)/Lib/Bucket/libBucket.a \
|
||||||
$(top_builddir)/Lib/Debug/libDebug.la \
|
$(top_builddir)/Lib/Debug/libDebug.a \
|
||||||
$(top_builddir)/Lib/PUI/libPUI.la \
|
$(top_builddir)/Lib/PUI/libPUI.a \
|
||||||
$(top_builddir)/Lib/zlib/libz.la
|
$(top_builddir)/Lib/zlib/libz.a
|
||||||
|
|
||||||
INCLUDES += \
|
INCLUDES += \
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
|
|
100
Main/fg_init.cxx
100
Main/fg_init.cxx
|
@ -70,83 +70,17 @@
|
||||||
extern const char *default_root;
|
extern const char *default_root;
|
||||||
|
|
||||||
|
|
||||||
// Set initial position
|
// Set initial position and orientation
|
||||||
int fgInitPosition( void ) {
|
int fgInitPosition( void ) {
|
||||||
char id[5];
|
char id[5];
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
// If nothing else is specified, default initial position is
|
|
||||||
// Globe, AZ (P13)
|
|
||||||
FG_Longitude = ( -110.6642444 ) * DEG_TO_RAD;
|
|
||||||
FG_Latitude = ( 33.3528917 ) * DEG_TO_RAD;
|
|
||||||
FG_Runway_altitude = (3234.5);
|
|
||||||
FG_Altitude = -1000 /* FG_Runway_altitude + 3.758099 */;
|
|
||||||
|
|
||||||
// Initial Position north of the city of Globe
|
|
||||||
// FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Longitude = ( -397867.44 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 119548.21 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Altitude = 0.0 + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position near where I used to live in Globe, AZ
|
|
||||||
// FG_Longitude = ( -398757.6 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 120160.0 / 3600.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 4000.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position: 10125 Jewell St. NE
|
|
||||||
// FG_Longitude = ( -93.15 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 45.15 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 950.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position near KHSP (Hot Springs, VA)
|
|
||||||
// FG_Longitude = (-79.8338964 + 0.01) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 37.9514564 + 0.008) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = (3792 + 2800);
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position at (SEZ) SEDONA airport
|
|
||||||
// FG_Longitude = (-111.7884614 + 0.01) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 34.8486289 - 0.015) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = (4827 + 450);
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position: Somewhere near the Grand Canyon
|
|
||||||
// FG_Longitude = ( -112.5 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 36.5 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 8000.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position: Jim Brennon's Kingmont Observatory
|
|
||||||
// FG_Longitude = ( -121.1131667 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 38.8293917 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 920.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Initial Position: Huaras, Peru (S09d 31.871' W077d 31.498')
|
|
||||||
// FG_Longitude = ( -77.5249667 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( -9.5311833 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 0.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Eclipse Watching w73.5 n10 (approx) 18:00 UT
|
|
||||||
// FG_Longitude = ( -73.5 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 10.0 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = 0.0;
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
// Test Position
|
|
||||||
// FG_Longitude = ( 8.5 ) * DEG_TO_RAD;
|
|
||||||
// FG_Latitude = ( 47.5 ) * DEG_TO_RAD;
|
|
||||||
// FG_Runway_altitude = ( 6000 );
|
|
||||||
// FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
|
|
||||||
current_options.get_airport_id(id);
|
current_options.get_airport_id(id);
|
||||||
if ( strlen(id) ) {
|
if ( strlen(id) ) {
|
||||||
|
// set initial position from airport id
|
||||||
|
|
||||||
fgAIRPORTS airports;
|
fgAIRPORTS airports;
|
||||||
fgAIRPORT a;
|
fgAIRPORT a;
|
||||||
|
|
||||||
|
@ -164,11 +98,19 @@ int fgInitPosition( void ) {
|
||||||
} else {
|
} else {
|
||||||
FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
|
FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
|
||||||
FG_Latitude = ( a.latitude ) * DEG_TO_RAD;
|
FG_Latitude = ( a.latitude ) * DEG_TO_RAD;
|
||||||
FG_Runway_altitude = ( -1000 /* a.elevation */ );
|
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// set initial position from default or command line coordinates
|
||||||
|
|
||||||
|
FG_Longitude = current_options.get_lon() * DEG_TO_RAD;
|
||||||
|
FG_Latitude = current_options.get_lat() * DEG_TO_RAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("starting altitude is = %.2f\n", current_options.get_altitude());
|
||||||
|
|
||||||
|
FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
|
||||||
|
FG_Runway_altitude = FG_Altitude - 3.758099;
|
||||||
|
|
||||||
fgPrintf( FG_GENERAL, FG_INFO,
|
fgPrintf( FG_GENERAL, FG_INFO,
|
||||||
"Initial position is: (%.4f, %.4f, %.2f)\n",
|
"Initial position is: (%.4f, %.4f, %.2f)\n",
|
||||||
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
|
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
|
||||||
|
@ -249,9 +191,9 @@ int fgInitSubsystems( void ) {
|
||||||
FG_V_down = 0.0; // -1.265722E-05
|
FG_V_down = 0.0; // -1.265722E-05
|
||||||
|
|
||||||
// Initial Orientation
|
// Initial Orientation
|
||||||
FG_Phi = -2.658474E-06;
|
FG_Phi = current_options.get_roll() * DEG_TO_RAD;
|
||||||
FG_Theta = 7.401790E-03;
|
FG_Theta = current_options.get_pitch() * DEG_TO_RAD;
|
||||||
FG_Psi = 270.0 * DEG_TO_RAD;
|
FG_Psi = current_options.get_heading() * DEG_TO_RAD;
|
||||||
|
|
||||||
// Initial Angular B rates
|
// Initial Angular B rates
|
||||||
FG_P_body = 7.206685E-05;
|
FG_P_body = 7.206685E-05;
|
||||||
|
@ -371,7 +313,8 @@ int fgInitSubsystems( void ) {
|
||||||
// Initialize the flight model subsystem data structures base on
|
// Initialize the flight model subsystem data structures base on
|
||||||
// above values
|
// above values
|
||||||
|
|
||||||
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
|
fgFlightModelInit( current_options.get_flight_model(), f,
|
||||||
|
1.0 / DEFAULT_MODEL_HZ );
|
||||||
|
|
||||||
// I'm just sticking this here for now, it should probably move
|
// I'm just sticking this here for now, it should probably move
|
||||||
// eventually
|
// eventually
|
||||||
|
@ -404,6 +347,13 @@ int fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.29 1998/07/30 23:48:27 curt
|
||||||
|
// Output position & orientation when pausing.
|
||||||
|
// Eliminated libtool use.
|
||||||
|
// Added options to specify initial position and orientation.
|
||||||
|
// Changed default fov to 55 degrees.
|
||||||
|
// Added command line option to start in paused or unpaused state.
|
||||||
|
//
|
||||||
// Revision 1.28 1998/07/27 18:41:25 curt
|
// Revision 1.28 1998/07/27 18:41:25 curt
|
||||||
// Added a pause command "p"
|
// Added a pause command "p"
|
||||||
// Fixed some initialization order problems between pui and glut.
|
// Fixed some initialization order problems between pui and glut.
|
||||||
|
|
193
Main/options.cxx
193
Main/options.cxx
|
@ -33,6 +33,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
|
#include <Flight/flight.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Include/fg_zlib.h>
|
#include <Include/fg_zlib.h>
|
||||||
|
|
||||||
|
@ -64,21 +65,89 @@ fgOPTIONS::fgOPTIONS( void ) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// default airport id
|
// Starting posistion and orientation
|
||||||
strcpy(airport_id, "");
|
strcpy(airport_id, ""); // default airport id
|
||||||
|
lon = 0.0; // starting longitude in degrees (west = -)
|
||||||
|
lat = 0.0; // starting latitude in degrees (south = -)
|
||||||
|
|
||||||
|
// If nothing else is specified, default initial position is
|
||||||
|
// Globe, AZ (P13)
|
||||||
|
lon = -110.6642444;
|
||||||
|
lat = 33.3528917;
|
||||||
|
|
||||||
|
// North of the city of Globe
|
||||||
|
// lon = -110.7;
|
||||||
|
// lat = 33.4;
|
||||||
|
|
||||||
|
// North of the city of Globe
|
||||||
|
// lon = -110.742578;
|
||||||
|
// lat = 33.507122;
|
||||||
|
|
||||||
|
// Near where I used to live in Globe, AZ
|
||||||
|
// lon = -110.766000;
|
||||||
|
// lat = 33.377778;
|
||||||
|
|
||||||
|
// 10125 Jewell St. NE
|
||||||
|
// lon = -93.15;
|
||||||
|
// lat = 45.15;
|
||||||
|
|
||||||
|
// Near KHSP (Hot Springs, VA)
|
||||||
|
// lon = -79.8338964 + 0.01;
|
||||||
|
// lat = 37.9514564 + 0.008;
|
||||||
|
|
||||||
|
// (SEZ) SEDONA airport
|
||||||
|
// lon = -111.7884614 + 0.01;
|
||||||
|
// lat = 34.8486289 - 0.015;
|
||||||
|
|
||||||
|
// Somewhere near the Grand Canyon
|
||||||
|
// lon = -112.5;
|
||||||
|
// lat = 36.5;
|
||||||
|
|
||||||
|
// Jim Brennon's Kingmont Observatory
|
||||||
|
// lon = -121.1131667;
|
||||||
|
// lat = 38.8293917;
|
||||||
|
|
||||||
|
// Huaras, Peru (S09d 31.871' W077d 31.498')
|
||||||
|
// lon = -77.5249667;
|
||||||
|
// lat = -9.5311833;
|
||||||
|
|
||||||
|
// Eclipse Watching w73.5 n10 (approx) 18:00 UT
|
||||||
|
// lon = -73.5;
|
||||||
|
// lat = 10.0;
|
||||||
|
|
||||||
|
// Test Position
|
||||||
|
// lon = 8.5;
|
||||||
|
// lat = 47.5;
|
||||||
|
|
||||||
|
// Timms Hill (WI)
|
||||||
|
// lon = -90.1953055556;
|
||||||
|
// lat = 45.4511388889;
|
||||||
|
|
||||||
|
altitude = -9999.0; // starting altitude in meters (this will be
|
||||||
|
// reset to ground level if it is lower
|
||||||
|
// than the terrain
|
||||||
|
|
||||||
|
// Initial Orientation
|
||||||
|
heading = 270.0; // heading (yaw) angle in degress (Psi)
|
||||||
|
roll = 0.0; // roll angle in degrees (Phi)
|
||||||
|
pitch = 0.424; // pitch angle in degrees (Theta)
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
splash_screen = 1;
|
splash_screen = 1;
|
||||||
intro_music = 1;
|
intro_music = 1;
|
||||||
mouse_pointer = 0;
|
mouse_pointer = 0;
|
||||||
|
pause = 0;
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
hud_status = 1;
|
hud_status = 1;
|
||||||
panel_status = 0;
|
panel_status = 0;
|
||||||
|
|
||||||
|
// Flight Model options
|
||||||
|
flight_model = FG_LARCSIM;
|
||||||
|
|
||||||
// Rendering options
|
// Rendering options
|
||||||
fog = 2; // nicest
|
fog = 2; // nicest
|
||||||
fov = 65.0;
|
fov = 55.0;
|
||||||
fullscreen = 0;
|
fullscreen = 0;
|
||||||
shading = 1;
|
shading = 1;
|
||||||
skyblend = 1;
|
skyblend = 1;
|
||||||
|
@ -129,17 +198,16 @@ static double parse_double(char *arg) {
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("parse_double(): arg = %s\n", arg);
|
// printf("parse_double(): arg = %s\n", arg);
|
||||||
|
|
||||||
result = atof(arg);
|
result = atof(arg);
|
||||||
|
|
||||||
printf("parse_double(): result = %.4f\n", result);
|
// printf("parse_double(): result = %.4f\n", result);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse time string in the form of [+-]hh:mm:ss, returns the value in seconds
|
|
||||||
static double parse_time(char *time_str) {
|
static double parse_time(char *time_str) {
|
||||||
char num[256];
|
char num[256];
|
||||||
double hours, minutes, seconds;
|
double hours, minutes, seconds;
|
||||||
|
@ -176,7 +244,7 @@ static double parse_time(char *time_str) {
|
||||||
hours = atof(num);
|
hours = atof(num);
|
||||||
// printf("hours = %.2lf\n", hours);
|
// printf("hours = %.2lf\n", hours);
|
||||||
|
|
||||||
result += hours * 3600.0;
|
result += hours;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get minutes
|
// get minutes
|
||||||
|
@ -194,7 +262,7 @@ static double parse_time(char *time_str) {
|
||||||
minutes = atof(num);
|
minutes = atof(num);
|
||||||
// printf("minutes = %.2lf\n", minutes);
|
// printf("minutes = %.2lf\n", minutes);
|
||||||
|
|
||||||
result += minutes * 60.0;
|
result += minutes / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get seconds
|
// get seconds
|
||||||
|
@ -209,28 +277,56 @@ static double parse_time(char *time_str) {
|
||||||
seconds = atof(num);
|
seconds = atof(num);
|
||||||
// printf("seconds = %.2lf\n", seconds);
|
// printf("seconds = %.2lf\n", seconds);
|
||||||
|
|
||||||
result += seconds;
|
result += seconds / 3600.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(sign * result);
|
return(sign * result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// parse degree in the form of [+/-]hhh:mm:ss
|
||||||
|
static double parse_degree(char *degree_str) {
|
||||||
|
double result;
|
||||||
|
|
||||||
|
// advance past the '='
|
||||||
|
while ( (degree_str[0] != '=') && (degree_str[0] != '\0') ) {
|
||||||
|
degree_str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( degree_str[0] == '=' ) {
|
||||||
|
degree_str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = parse_time(degree_str);
|
||||||
|
|
||||||
|
// printf("Degree = %.4f\n", result);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse time offset command line option
|
// parse time offset command line option
|
||||||
static int parse_time_offset(char *time_str) {
|
static int parse_time_offset(char *time_str) {
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
time_str += 14;
|
// advance past the '='
|
||||||
|
while ( (time_str[0] != '=') && (time_str[0] != '\0') ) {
|
||||||
|
time_str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( time_str[0] == '=' ) {
|
||||||
|
time_str++;
|
||||||
|
}
|
||||||
|
|
||||||
// printf("time offset = %s\n", time_str);
|
// printf("time offset = %s\n", time_str);
|
||||||
|
|
||||||
#ifdef HAVE_RINT
|
#ifdef HAVE_RINT
|
||||||
result = (int)rint(parse_time(time_str));
|
result = (int)rint(parse_time(time_str) * 3600.0);
|
||||||
#else
|
#else
|
||||||
result = (int)parse_time(time_str);
|
result = (int)(parse_time(time_str) * 3600.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("parse_time_offset(): %d\n", result);
|
// printf("parse_time_offset(): %d\n", result);
|
||||||
|
|
||||||
return( result );
|
return( result );
|
||||||
}
|
}
|
||||||
|
@ -242,7 +338,7 @@ static int parse_time_offset(char *time_str) {
|
||||||
#define FG_RADIUS_MAX 4
|
#define FG_RADIUS_MAX 4
|
||||||
|
|
||||||
static int parse_tile_radius(char *arg) {
|
static int parse_tile_radius(char *arg) {
|
||||||
int radius, tmp;
|
int radius;
|
||||||
|
|
||||||
radius = parse_int(arg);
|
radius = parse_int(arg);
|
||||||
|
|
||||||
|
@ -255,6 +351,27 @@ static int parse_tile_radius(char *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Parse --flightmode=abcdefg type option
|
||||||
|
static int parse_flight_model(char *fm) {
|
||||||
|
fm += 15;
|
||||||
|
|
||||||
|
// printf("flight model = %s\n", fm);
|
||||||
|
|
||||||
|
if ( strcmp(fm, "slew") == 0 ) {
|
||||||
|
return(FG_SLEW);
|
||||||
|
} else if ( strcmp(fm, "larcsim") == 0 ) {
|
||||||
|
return(FG_LARCSIM);
|
||||||
|
} else if ( strcmp(fm, "LaRCsim") == 0 ) {
|
||||||
|
return(FG_LARCSIM);
|
||||||
|
} else {
|
||||||
|
fgPrintf( FG_GENERAL, FG_EXIT, "Unknown flight model = %s\n", fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// we'll never get here, but it makes the compiler happy.
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse --fov=x.xx type option
|
// Parse --fov=x.xx type option
|
||||||
static double parse_fov(char *arg) {
|
static double parse_fov(char *arg) {
|
||||||
double fov;
|
double fov;
|
||||||
|
@ -264,7 +381,7 @@ static double parse_fov(char *arg) {
|
||||||
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
||||||
if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
|
if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
|
||||||
|
|
||||||
printf("parse_fov(): result = %.4f\n", fov);
|
// printf("parse_fov(): result = %.4f\n", fov);
|
||||||
|
|
||||||
return(fov);
|
return(fov);
|
||||||
}
|
}
|
||||||
|
@ -289,6 +406,10 @@ int fgOPTIONS::parse_option( char *arg ) {
|
||||||
mouse_pointer = 1;
|
mouse_pointer = 1;
|
||||||
} else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) {
|
} else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) {
|
||||||
mouse_pointer = 2;
|
mouse_pointer = 2;
|
||||||
|
} else if ( strcmp(arg, "--disable-pause") == 0 ) {
|
||||||
|
pause = 0;
|
||||||
|
} else if ( strcmp(arg, "--enable-pause") == 0 ) {
|
||||||
|
pause = 1;
|
||||||
} else if ( strcmp(arg, "--disable-hud") == 0 ) {
|
} else if ( strcmp(arg, "--disable-hud") == 0 ) {
|
||||||
hud_status = 0;
|
hud_status = 0;
|
||||||
} else if ( strcmp(arg, "--enable-hud") == 0 ) {
|
} else if ( strcmp(arg, "--enable-hud") == 0 ) {
|
||||||
|
@ -304,9 +425,23 @@ int fgOPTIONS::parse_option( char *arg ) {
|
||||||
} else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
|
} else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
|
||||||
arg += 13;
|
arg += 13;
|
||||||
strncpy(airport_id, arg, 4);
|
strncpy(airport_id, arg, 4);
|
||||||
|
} else if ( strncmp(arg, "--lon=", 6) == 0 ) {
|
||||||
|
lon = parse_degree(arg);
|
||||||
|
} else if ( strncmp(arg, "--lat=", 6) == 0 ) {
|
||||||
|
lat = parse_degree(arg);
|
||||||
|
} else if ( strncmp(arg, "--altitude=", 11) == 0 ) {
|
||||||
|
altitude = parse_double(arg);
|
||||||
|
} else if ( strncmp(arg, "--heading=", 6) == 0 ) {
|
||||||
|
heading = parse_double(arg);
|
||||||
|
} else if ( strncmp(arg, "--roll=", 7) == 0 ) {
|
||||||
|
roll = parse_double(arg);
|
||||||
|
} else if ( strncmp(arg, "--pitch=", 8) == 0 ) {
|
||||||
|
pitch = parse_double(arg);
|
||||||
} else if ( strncmp(arg, "--fg-root=", 10) == 0 ) {
|
} else if ( strncmp(arg, "--fg-root=", 10) == 0 ) {
|
||||||
arg += 10;
|
arg += 10;
|
||||||
strcpy(fg_root, arg);
|
strcpy(fg_root, arg);
|
||||||
|
} else if ( strncmp(arg, "--flight-model=", 15) == 0 ) {
|
||||||
|
flight_model = parse_flight_model(arg);
|
||||||
} else if ( strcmp(arg, "--fog-disable") == 0 ) {
|
} else if ( strcmp(arg, "--fog-disable") == 0 ) {
|
||||||
fog = 0;
|
fog = 0;
|
||||||
} else if ( strcmp(arg, "--fog-fastest") == 0 ) {
|
} else if ( strcmp(arg, "--fog-fastest") == 0 ) {
|
||||||
|
@ -341,6 +476,7 @@ int fgOPTIONS::parse_option( char *arg ) {
|
||||||
} else if ( strncmp(arg, "--time-offset=", 14) == 0 ) {
|
} else if ( strncmp(arg, "--time-offset=", 14) == 0 ) {
|
||||||
time_offset = parse_time_offset(arg);
|
time_offset = parse_time_offset(arg);
|
||||||
} else {
|
} else {
|
||||||
|
fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n", arg);
|
||||||
return(FG_OPTIONS_ERROR);
|
return(FG_OPTIONS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +564,9 @@ void fgOPTIONS::usage ( void ) {
|
||||||
printf("\t--enable-intro-music: enable introduction music\n");
|
printf("\t--enable-intro-music: enable introduction music\n");
|
||||||
printf("\t--disable-mouse-pointer: disable extra mouse pointer\n");
|
printf("\t--disable-mouse-pointer: disable extra mouse pointer\n");
|
||||||
printf("\t--enable-mouse-pointer: enable extra mouse pointer (i.e. for\n");
|
printf("\t--enable-mouse-pointer: enable extra mouse pointer (i.e. for\n");
|
||||||
printf("\t\tfull screen voodoo/voodoo-II based cards.\n");
|
printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
|
||||||
|
printf("\t--disable-pause: start out in an active state\n");
|
||||||
|
printf("\t--enable-pause: start out in a paused state\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Features:\n");
|
printf("Features:\n");
|
||||||
|
@ -440,8 +578,14 @@ void fgOPTIONS::usage ( void ) {
|
||||||
printf("\t--enable-sound: enable sound effects\n");
|
printf("\t--enable-sound: enable sound effects\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Initial Position:\n");
|
printf("Initial Position and Orientation:\n");
|
||||||
printf("\t--airport-id=ABCD: specify starting postion by airport id\n");
|
printf("\t--airport-id=ABCD: specify starting postion by airport id\n");
|
||||||
|
printf("\t--lon=degrees: starting longitude in degrees (west = -)\n");
|
||||||
|
printf("\t--lat=degrees: starting latitude in degrees (south = -)\n");
|
||||||
|
printf("\t--altitude=meters: starting altitude in meters\n");
|
||||||
|
printf("\t--heading=degrees: heading (yaw) angle in degress (Psi)\n");
|
||||||
|
printf("\t--roll=degrees: roll angle in degrees (Phi)\n");
|
||||||
|
printf("\t--pitch=degrees: pitch angle in degrees (Theta)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Rendering Options:\n");
|
printf("Rendering Options:\n");
|
||||||
|
@ -473,12 +617,20 @@ void fgOPTIONS::usage ( void ) {
|
||||||
// Query functions
|
// Query functions
|
||||||
void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
|
void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
|
||||||
void fgOPTIONS::get_airport_id(char *id) { strcpy(id, airport_id); }
|
void fgOPTIONS::get_airport_id(char *id) { strcpy(id, airport_id); }
|
||||||
|
double fgOPTIONS::get_lon( void ) { return(lon); }
|
||||||
|
double fgOPTIONS::get_lat( void ) { return(lat); }
|
||||||
|
double fgOPTIONS::get_altitude( void ) { return(altitude); }
|
||||||
|
double fgOPTIONS::get_heading( void ) { return(heading); }
|
||||||
|
double fgOPTIONS::get_roll( void ) { return(roll); }
|
||||||
|
double fgOPTIONS::get_pitch( void ) { return(pitch); }
|
||||||
int fgOPTIONS::get_splash_screen( void ) { return(splash_screen); }
|
int fgOPTIONS::get_splash_screen( void ) { return(splash_screen); }
|
||||||
int fgOPTIONS::get_intro_music( void ) { return(intro_music); }
|
int fgOPTIONS::get_intro_music( void ) { return(intro_music); }
|
||||||
int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); }
|
int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); }
|
||||||
|
int fgOPTIONS::get_pause( void ) { return(pause); }
|
||||||
int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
|
int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
|
||||||
int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
|
int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
|
||||||
int fgOPTIONS::get_sound( void ) { return(sound); }
|
int fgOPTIONS::get_sound( void ) { return(sound); }
|
||||||
|
int fgOPTIONS::get_flight_model( void ) { return(flight_model); }
|
||||||
int fgOPTIONS::get_fog( void ) { return(fog); }
|
int fgOPTIONS::get_fog( void ) { return(fog); }
|
||||||
double fgOPTIONS::get_fov( void ) { return(fov); }
|
double fgOPTIONS::get_fov( void ) { return(fov); }
|
||||||
int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
|
int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
|
||||||
|
@ -501,6 +653,13 @@ fgOPTIONS::~fgOPTIONS( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.20 1998/07/30 23:48:28 curt
|
||||||
|
// Output position & orientation when pausing.
|
||||||
|
// Eliminated libtool use.
|
||||||
|
// Added options to specify initial position and orientation.
|
||||||
|
// Changed default fov to 55 degrees.
|
||||||
|
// Added command line option to start in paused or unpaused state.
|
||||||
|
//
|
||||||
// Revision 1.19 1998/07/27 18:41:25 curt
|
// Revision 1.19 1998/07/27 18:41:25 curt
|
||||||
// Added a pause command "p"
|
// Added a pause command "p"
|
||||||
// Fixed some initialization order problems between pui and glut.
|
// Fixed some initialization order problems between pui and glut.
|
||||||
|
|
|
@ -42,19 +42,29 @@ class fgOPTIONS {
|
||||||
// The flight gear "root" directory
|
// The flight gear "root" directory
|
||||||
char fg_root[256];
|
char fg_root[256];
|
||||||
|
|
||||||
// ID of initial starting airport
|
// Starting position and orientation
|
||||||
char airport_id[5];
|
char airport_id[5]; // ID of initial starting airport
|
||||||
|
double lon; // starting longitude in degrees (west = -)
|
||||||
|
double lat; // starting latitude in degrees (south = -)
|
||||||
|
double altitude; // starting altitude in meters
|
||||||
|
double heading; // heading (yaw) angle in degress (Psi)
|
||||||
|
double roll; // roll angle in degrees (Phi)
|
||||||
|
double pitch; // pitch angle in degrees (Theta)
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
int splash_screen; // show splash screen
|
int splash_screen; // show splash screen
|
||||||
int intro_music; // play introductory music
|
int intro_music; // play introductory music
|
||||||
int mouse_pointer; // show mouse pointer
|
int mouse_pointer; // show mouse pointer
|
||||||
|
int pause; // pause intially enabled/disabled
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
int hud_status; // HUD on/off
|
int hud_status; // HUD on/off
|
||||||
int panel_status; // Panel on/off
|
int panel_status; // Panel on/off
|
||||||
int sound; // play sound effects
|
int sound; // play sound effects
|
||||||
|
|
||||||
|
// Flight Model options
|
||||||
|
int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
|
||||||
|
|
||||||
// Rendering options
|
// Rendering options
|
||||||
int fog; // Fog enabled/disabled
|
int fog; // Fog enabled/disabled
|
||||||
double fov; // Field of View
|
double fov; // Field of View
|
||||||
|
@ -95,12 +105,20 @@ public:
|
||||||
// Query functions
|
// Query functions
|
||||||
void get_fg_root(char *root);
|
void get_fg_root(char *root);
|
||||||
void get_airport_id(char *id);
|
void get_airport_id(char *id);
|
||||||
|
double get_lon( void );
|
||||||
|
double get_lat( void );
|
||||||
|
double get_altitude( void );
|
||||||
|
double get_heading( void );
|
||||||
|
double get_roll( void );
|
||||||
|
double get_pitch( void );
|
||||||
int get_splash_screen( void );
|
int get_splash_screen( void );
|
||||||
int get_intro_music( void );
|
int get_intro_music( void );
|
||||||
int get_mouse_pointer( void );
|
int get_mouse_pointer( void );
|
||||||
|
int get_pause( void );
|
||||||
int get_hud_status( void );
|
int get_hud_status( void );
|
||||||
int get_panel_status( void );
|
int get_panel_status( void );
|
||||||
int get_sound( void );
|
int get_sound( void );
|
||||||
|
int get_flight_model( void );
|
||||||
int get_fog( void );
|
int get_fog( void );
|
||||||
double get_fov( void );
|
double get_fov( void );
|
||||||
int get_fullscreen( void );
|
int get_fullscreen( void );
|
||||||
|
@ -129,6 +147,13 @@ extern fgOPTIONS current_options;
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.13 1998/07/30 23:48:29 curt
|
||||||
|
// Output position & orientation when pausing.
|
||||||
|
// Eliminated libtool use.
|
||||||
|
// Added options to specify initial position and orientation.
|
||||||
|
// Changed default fov to 55 degrees.
|
||||||
|
// Added command line option to start in paused or unpaused state.
|
||||||
|
//
|
||||||
// Revision 1.12 1998/07/27 18:41:26 curt
|
// Revision 1.12 1998/07/27 18:41:26 curt
|
||||||
// Added a pause command "p"
|
// Added a pause command "p"
|
||||||
// Fixed some initialization order problems between pui and glut.
|
// Fixed some initialization order problems between pui and glut.
|
||||||
|
|
Loading…
Add table
Reference in a new issue