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.
/* Handle keyboard events */
void GLUTkey(unsigned char k, int x, int y) {
fgCONTROLS *c;
+ fgFLIGHT *f;
fgTIME *t;
fgVIEW *v;
struct fgWEATHER *w;
int status;
c = current_aircraft.controls;
+ f = current_aircraft.flight;
t = &cur_time_params;
v = ¤t_view;
w = ¤t_weather;
return;
case 112: /* p key */
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;
case 116: /* t key */
t->warp_delta += 30;
/* $Log$
-/* 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.18 1998/07/30 23:48:24 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.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
* "H" / "h" now control hud brightness as well with off being one of the
* states.
// render the moon
xglEnable( GL_LIGHTING );
+ xglEnable( GL_LIGHT0 );
// set lighting parameters
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
if ( !t->pause ) {
// 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 {
- fgFlightModelUpdate(FG_LARCSIM, f, 0);
+ fgFlightModelUpdate(current_options.get_flight_model(), f, 0);
}
// update the view angle
FG_Altitude * FEET_TO_METER,
scenery.cur_elev + 3.758099 * FEET_TO_METER - 3.0,
scenery.cur_elev + 3.758099 * FEET_TO_METER);
- fgFlightModelSetAltitude( FG_LARCSIM, f,
+ fgFlightModelSetAltitude( current_options.get_flight_model(), f,
scenery.cur_elev +
3.758099 * FEET_TO_METER);
// $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
// Added a pause command "p"
// Fixed some initialization order problems between pui and glut.
if ENABLE_AUDIO_SUPPORT
DEFS += -DENABLE_AUDIO_SUPPORT
AUDIO_LIBS = \
- $(top_builddir)/Lib/Audio/src/libsl.la \
- $(top_builddir)/Lib/Audio/src/libsm.la
+ $(top_builddir)/Lib/Audio/src/libsl.a \
+ $(top_builddir)/Lib/Audio/src/libsm.a
+endif
+
+if ENABLE_IRIX_AUDIO
+LIBS += -laudio
endif
if ENABLE_WIN32_AUDIO
$(top_builddir)/Simulator/Weather/libWeather.a \
$(top_builddir)/Simulator/Joystick/libJoystick.a \
$(AUDIO_LIBS) \
- $(top_builddir)/Lib/Math/libMath.la \
- $(top_builddir)/Lib/Bucket/libBucket.la \
- $(top_builddir)/Lib/Debug/libDebug.la \
- $(top_builddir)/Lib/PUI/libPUI.la \
- $(top_builddir)/Lib/zlib/libz.la
+ $(top_builddir)/Lib/Math/libMath.a \
+ $(top_builddir)/Lib/Bucket/libBucket.a \
+ $(top_builddir)/Lib/Debug/libDebug.a \
+ $(top_builddir)/Lib/PUI/libPUI.a \
+ $(top_builddir)/Lib/zlib/libz.a
INCLUDES += \
-I$(top_builddir) \
extern const char *default_root;
-// Set initial position
+// Set initial position and orientation
int fgInitPosition( void ) {
char id[5];
fgFLIGHT *f;
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);
if ( strlen(id) ) {
+ // set initial position from airport id
+
fgAIRPORTS airports;
fgAIRPORT a;
} else {
FG_Longitude = ( a.longitude ) * 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,
"Initial position is: (%.4f, %.4f, %.2f)\n",
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
FG_V_down = 0.0; // -1.265722E-05
// Initial Orientation
- FG_Phi = -2.658474E-06;
- FG_Theta = 7.401790E-03;
- FG_Psi = 270.0 * DEG_TO_RAD;
+ FG_Phi = current_options.get_roll() * DEG_TO_RAD;
+ FG_Theta = current_options.get_pitch() * DEG_TO_RAD;
+ FG_Psi = current_options.get_heading() * DEG_TO_RAD;
// Initial Angular B rates
FG_P_body = 7.206685E-05;
// Initialize the flight model subsystem data structures base on
// 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
// eventually
// $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
// Added a pause command "p"
// Fixed some initialization order problems between pui and glut.
#include <string.h>
#include <Debug/fg_debug.h>
+#include <Flight/flight.h>
#include <Include/fg_constants.h>
#include <Include/fg_zlib.h>
#endif
}
- // default airport id
- strcpy(airport_id, "");
+ // Starting posistion and orientation
+ 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
splash_screen = 1;
intro_music = 1;
mouse_pointer = 0;
+ pause = 0;
// Features
hud_status = 1;
panel_status = 0;
+ // Flight Model options
+ flight_model = FG_LARCSIM;
+
// Rendering options
fog = 2; // nicest
- fov = 65.0;
+ fov = 55.0;
fullscreen = 0;
shading = 1;
skyblend = 1;
arg++;
}
- printf("parse_double(): arg = %s\n", arg);
+ // printf("parse_double(): arg = %s\n", arg);
result = atof(arg);
- printf("parse_double(): result = %.4f\n", result);
+ // printf("parse_double(): result = %.4f\n", 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) {
char num[256];
double hours, minutes, seconds;
hours = atof(num);
// printf("hours = %.2lf\n", hours);
- result += hours * 3600.0;
+ result += hours;
}
// get minutes
minutes = atof(num);
// printf("minutes = %.2lf\n", minutes);
- result += minutes * 60.0;
+ result += minutes / 60.0;
}
// get seconds
seconds = atof(num);
// printf("seconds = %.2lf\n", seconds);
- result += seconds;
+ result += seconds / 3600.0;
}
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
static int parse_time_offset(char *time_str) {
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);
#ifdef HAVE_RINT
- result = (int)rint(parse_time(time_str));
+ result = (int)rint(parse_time(time_str) * 3600.0);
#else
- result = (int)parse_time(time_str);
+ result = (int)(parse_time(time_str) * 3600.0);
#endif
- printf("parse_time_offset(): %d\n", result);
+ // printf("parse_time_offset(): %d\n", result);
return( result );
}
#define FG_RADIUS_MAX 4
static int parse_tile_radius(char *arg) {
- int radius, tmp;
+ int radius;
radius = parse_int(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
static double parse_fov(char *arg) {
double fov;
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
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);
}
mouse_pointer = 1;
} else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) {
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 ) {
hud_status = 0;
} else if ( strcmp(arg, "--enable-hud") == 0 ) {
} else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
arg += 13;
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 ) {
arg += 10;
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 ) {
fog = 0;
} else if ( strcmp(arg, "--fog-fastest") == 0 ) {
} else if ( strncmp(arg, "--time-offset=", 14) == 0 ) {
time_offset = parse_time_offset(arg);
} else {
+ fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n", arg);
return(FG_OPTIONS_ERROR);
}
printf("\t--enable-intro-music: enable introduction music\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\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("Features:\n");
printf("\t--enable-sound: enable sound effects\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--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("Rendering Options:\n");
// Query functions
void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
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_intro_music( void ) { return(intro_music); }
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_panel_status( void ) { return(panel_status); }
int fgOPTIONS::get_sound( void ) { return(sound); }
+int fgOPTIONS::get_flight_model( void ) { return(flight_model); }
int fgOPTIONS::get_fog( void ) { return(fog); }
double fgOPTIONS::get_fov( void ) { return(fov); }
int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
// $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
// Added a pause command "p"
// Fixed some initialization order problems between pui and glut.
// The flight gear "root" directory
char fg_root[256];
- // ID of initial starting airport
- char airport_id[5];
+ // Starting position and orientation
+ 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
int splash_screen; // show splash screen
int intro_music; // play introductory music
int mouse_pointer; // show mouse pointer
+ int pause; // pause intially enabled/disabled
// Features
int hud_status; // HUD on/off
int panel_status; // Panel on/off
int sound; // play sound effects
+ // Flight Model options
+ int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
+
// Rendering options
int fog; // Fog enabled/disabled
double fov; // Field of View
// Query functions
void get_fg_root(char *root);
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_intro_music( void );
int get_mouse_pointer( void );
+ int get_pause( void );
int get_hud_status( void );
int get_panel_status( void );
int get_sound( void );
+ int get_flight_model( void );
int get_fog( void );
double get_fov( void );
int get_fullscreen( void );
// $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
// Added a pause command "p"
// Fixed some initialization order problems between pui and glut.