From efe5654b8ba784bbe07d7b0036355834b3d58cbc Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 3 Jul 2000 20:09:56 +0000 Subject: [PATCH] Moved sky code over to simgear. Added David Megginsons property manager. --- Thanks | 4 ++ src/Main/Makefile.am | 3 +- src/Main/bfi.cxx | 134 ++++++++++++++++++++++++++++++++++++++++++- src/Main/bfi.hxx | 3 + src/Main/fg_init.cxx | 4 ++ src/Main/main.cxx | 2 +- src/Main/options.cxx | 13 +++++ src/Makefile.am | 1 - 8 files changed, 157 insertions(+), 7 deletions(-) diff --git a/Thanks b/Thanks index 6f83fe19f..cfb2ff651 100644 --- a/Thanks +++ b/Thanks @@ -76,6 +76,10 @@ Didier Chauveau http://edcwww.cr.usgs.gov/landdaac/gtopo30/gtopo30.html +John Check + Cloud textures + + Oliver Delise FAQ Maintainer, Documentation, Public Relations. Working on adding some networking / multi-user support. diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 198532724..c74160b44 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -64,10 +64,9 @@ fgfs_LDADD = \ $(top_builddir)/src/Objects/libObjects.a \ $(top_builddir)/src/Time/libTime.a \ $(WEATHER_LIBS) \ - $(top_builddir)/src/Sky/libSky.a \ $(top_builddir)/src/Joystick/libJoystick.a \ $(SERIAL_LIBS) \ - -lsgscreen -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc \ + -lsgsky -lsgscreen -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc \ -lplibpu -lplibfnt -lplibssg -lplibsg \ -lmk4 -lz \ $(opengl_LIBS) \ diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index 9c20d6996..cdc577cbe 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,131 @@ bool FGBFI::_needReinit = false; //////////////////////////////////////////////////////////////////////// +/** + * Initialize the BFI by binding its functions to properties. + * + * TODO: perhaps these should migrate into the individual modules + * (i.e. they should register themselves). + */ +void +FGBFI::init () +{ + FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI init"); + // Simulation + current_properties.tieInt("/sim/flight-model", + getFlightModel, setFlightModel); +// current_properties.tieString("/sim/aircraft", +// getAircraft, setAircraft); + // TODO: timeGMT + current_properties.tieBool("/sim/hud/visibility", + getHUDVisible, setHUDVisible); + current_properties.tieBool("/sim/panel/visibility", + getPanelVisible, setPanelVisible); + + // Position + current_properties.tieDouble("/position/latitude", + getLatitude, setLatitude); + current_properties.tieDouble("/position/longitude", + getLongitude, setLongitude); + current_properties.tieDouble("/position/altitude", + getAltitude, setAltitude); + current_properties.tieDouble("/position/altitude-agl", + getAGL, 0); + + // Orientation + current_properties.tieDouble("/orientation/heading", + getHeading, setHeading); + current_properties.tieDouble("/orientation/heading-magnetic", + getHeadingMag, 0); + current_properties.tieDouble("/orientation/pitch", + getPitch, setPitch); + current_properties.tieDouble("/orientation/roll", + getRoll, setRoll); + + // Velocities + current_properties.tieDouble("/velocities/airspeed", + getAirspeed, 0); + current_properties.tieDouble("/velocities/side-slip", + getSideSlip, 0); + current_properties.tieDouble("/velocities/vertical-speed", + getVerticalSpeed, 0); + current_properties.tieDouble("/velocities/speed-north", + getSpeedNorth, setSpeedNorth); + current_properties.tieDouble("/velocities/speed-east", + getSpeedEast, setSpeedEast); + current_properties.tieDouble("/velocities/speed-down", + getSpeedDown, setSpeedDown); + + // Controls + current_properties.tieDouble("/controls/throttle", + getThrottle, setThrottle); + current_properties.tieDouble("/controls/flaps", + getFlaps, setFlaps); + current_properties.tieDouble("/controls/aileron", + getAileron, setAileron); + current_properties.tieDouble("/controls/rudder", + getRudder, setRudder); + current_properties.tieDouble("/controls/elevator", + getElevator, setElevator); + current_properties.tieDouble("/controls/elevator-trim", + getElevatorTrim, setElevatorTrim); + current_properties.tieDouble("/controls/brake", + getBrake, setBrake); + + // Autopilot + current_properties.tieBool("/autopilot/locks/altitude", + getAPAltitudeLock, setAPAltitudeLock); + current_properties.tieDouble("/autopilot/settings/altitude", + getAPAltitude, setAPAltitude); + current_properties.tieBool("/autopilot/locks/heading", + getAPHeadingLock, setAPHeadingLock); + current_properties.tieDouble("/autopilot/settings/heading-magnetic", + getAPHeadingMag, setAPHeadingMag); + current_properties.tieBool("/autopilot/locks/nav1", + getAPNAV1Lock, setAPNAV1Lock); + + // Radio navigation + current_properties.tieDouble("/radios/nav1/frequencies/selected", + getNAV1Freq, setNAV1Freq); + current_properties.tieDouble("/radios/nav1/frequencies/standby", + getNAV1AltFreq, setNAV1AltFreq); + current_properties.tieDouble("/radios/nav1/radials/actual", + getNAV1Radial, 0); + current_properties.tieDouble("/radios/nav1/radials/selected", + getNAV1SelRadial, setNAV1SelRadial); + current_properties.tieDouble("/radios/nav1/dme/distance", + getNAV1DistDME, 0); + current_properties.tieBool("/radios/nav1/in-range", + getNAV1InRange, 0); + current_properties.tieBool("/radios/nav1/dme/in-range", + getNAV1DMEInRange, 0); + + current_properties.tieDouble("/radios/nav2/frequencies/selected", + getNAV2Freq, setNAV2Freq); + current_properties.tieDouble("/radios/nav2/frequencies/standby", + getNAV2AltFreq, setNAV2AltFreq); + current_properties.tieDouble("/radios/nav2/radials/actual", + getNAV2Radial, 0); + current_properties.tieDouble("/radios/nav2/radials/selected", + getNAV2SelRadial, setNAV2SelRadial); + current_properties.tieDouble("/radios/nav2/dme/distance", + getNAV2DistDME, 0); + current_properties.tieBool("/radios/nav2/in-range", + getNAV2InRange, 0); + current_properties.tieBool("/radios/nav2/dme/in-range", + getNAV2DMEInRange, 0); + + current_properties.tieDouble("/radios/adf/frequencies/selected", + getADFFreq, setADFFreq); + current_properties.tieDouble("/radios/adf/frequencies/standby", + getADFAltFreq, setADFAltFreq); + current_properties.tieDouble("/radios/adf/rotation", + getADFRotation, setADFRotation); + + FG_LOG(FG_GENERAL, FG_INFO, "Ending BFI init"); +} + + /** * Reinitialize FGFS if required. * @@ -134,6 +260,7 @@ FGBFI::reinit () setTargetAirport(""); cout << "Target airport is " << current_options.get_airport_id() << endl; + fgReInitSubsystems(); // FIXME: this is wrong. @@ -393,9 +520,10 @@ FGBFI::getAGL () void FGBFI::setAltitude (double altitude) { - current_options.set_altitude(altitude * FEET_TO_METER); - current_aircraft.fdm_state->set_Altitude(altitude); - needReinit(); + fgFDMForceAltitude(getFlightModel(), altitude * FEET_TO_METER); +// current_options.set_altitude(altitude * FEET_TO_METER); +// current_aircraft.fdm_state->set_Altitude(altitude); +// needReinit(); } diff --git a/src/Main/bfi.hxx b/src/Main/bfi.hxx index d27c5913c..cac3bb812 100644 --- a/src/Main/bfi.hxx +++ b/src/Main/bfi.hxx @@ -46,6 +46,9 @@ class FGBFI { public: + // Initialize before first use. + static void init (); + // Reinit if necessary. static void update (); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 652166bf6..4b195dee0 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -92,6 +92,7 @@ #include "fg_io.hxx" #include "options.hxx" #include "views.hxx" +#include "bfi.hxx" #if defined(FX) && defined(XMESA) #include @@ -582,6 +583,9 @@ bool fgInitSubsystems( void ) { // Initialize the 2D panel. current_panel = fgCreateSmallSinglePropPanel(0, 0, 1024, 768); + // Initialize the BFI + FGBFI::init(); + FG_LOG( FG_GENERAL, FG_INFO, endl); return true; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index c30779b25..c4ce83ddc 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include @@ -89,7 +90,6 @@ #endif #include #include -#include #include