X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCockpit%2Fcockpit.cxx;h=ce8d5d897546c5779fc82061b25dc418a803d8bc;hb=f057fd0d4897ef65c4d36159af37ba3fdd544798;hp=2c84e573decbf7f4d90992c104cbe041de232a42;hpb=215491546530f79d49351a4c89f76eceaafef572;p=flightgear.git diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 2c84e573d..ce8d5d897 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -29,7 +29,9 @@ # include #endif -#include +#include + +#include SG_GLU_H #include #include @@ -38,11 +40,14 @@ #include #include #include -#include +#include +#include #include #include -#include +#ifdef ENABLE_SP_FMDS +#include +#endif #include
#include
#include
@@ -51,6 +56,7 @@ #include #include "cockpit.hxx" +#include "hud.hxx" // This is a structure that contains all data related to @@ -182,7 +188,7 @@ float get_altitude( void ) float altitude; - if ( startup_units_node->getStringValue() == "feet" ) { + if ( !strcmp(startup_units_node->getStringValue(), "feet") ) { altitude = current_aircraft.fdm_state->get_Altitude(); } else { altitude = (current_aircraft.fdm_state->get_Altitude() @@ -194,14 +200,17 @@ float get_altitude( void ) float get_agl( void ) { + static const SGPropertyNode *startup_units_node + = fgGetNode("/sim/startup/units"); + float agl; - if ( fgGetString("/sim/startup/units") == "feet" ) { + if ( !strcmp(startup_units_node->getStringValue(), "feet") ) { agl = (current_aircraft.fdm_state->get_Altitude() - - scenery.cur_elev * SG_METER_TO_FEET); + - current_aircraft.fdm_state->get_Runway_altitude()); } else { - agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER - - scenery.cur_elev); + agl = (current_aircraft.fdm_state->get_Altitude() + - current_aircraft.fdm_state->get_Runway_altitude()) * SG_FEET_TO_METER; } return agl; @@ -245,8 +254,11 @@ float get_vfc_tris_culled ( void ) float get_climb_rate( void ) { + static const SGPropertyNode *startup_units_node + = fgGetNode("/sim/startup/units"); + float climb_rate; - if ( fgGetString("/sim/startup/units") == "feet" ) { + if ( !strcmp(startup_units_node->getStringValue(), "feet") ) { climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0; } else { climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0; @@ -258,7 +270,7 @@ float get_climb_rate( void ) float get_view_direction( void ) { - double view_off = SGD_2PI - globals->get_current_view()->get_view_offset(); + double view_off = SGD_2PI - globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS; double view = ( current_aircraft.fdm_state->get_Psi() + view_off) * SGD_RADIANS_TO_DEGREES; @@ -270,6 +282,15 @@ float get_view_direction( void ) return view; } +// Added by Markus Hof on 5. Jan 2004 +float get_dme( void ) +{ + static const SGPropertyNode * dme_node = + fgGetNode("/instrumentation/dme/indicated-distance-nm"); + + return dme_node->getFloatValue(); +} + // $$$ begin - added, VS Renganathan 13 Oct 2K // #ifdef FIGHTER_HUD float get_Vx ( void ) @@ -320,6 +341,7 @@ float get_anzg ( void ) return anzg; } +#ifdef ENABLE_SP_FMDS int get_iaux1 (void) { FGADA *fdm = (FGADA *)current_aircraft.fdm_state; @@ -499,7 +521,7 @@ float get_aux18 (void) FGADA *fdm = (FGADA *)current_aircraft.fdm_state; return fdm->get_faux(10); } -// #endif +#endif // $$$ end - added, VS Renganathan 13 Oct 2K @@ -706,15 +728,9 @@ void fgCockpitUpdate( void ) { fgUpdateHUD(); } -#define DISPLAY_COUNTER -#ifdef DISPLAY_COUNTER - else - { + if ( fgGetBool( "/sim/hud/draw-fps", false ) ) { char buf[64]; - float fps = get_frame_rate(); -// float tris = fps * get_vfc_tris_drawn(); -// float culled = fps * get_vfc_tris_culled(); -// sprintf(buf,"%-4.1f %7.0f %7.0f", fps, tris, culled); + float fps = get_frame_rate(); sprintf(buf,"%-5.1f", fps); glMatrixMode( GL_PROJECTION ); @@ -740,7 +756,7 @@ void fgCockpitUpdate( void ) { glMatrixMode( GL_MODELVIEW ); glPopMatrix(); } -#endif // #ifdef DISPLAY_COUNTER glViewport( 0, 0, iwidth, iheight ); } +