#endif
#include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
#include <stdlib.h>
#include <stdio.h>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
+#include <simgear/misc/props.hxx>
#include <Aircraft/aircraft.hxx>
#include <Include/general.hxx>
#include <FDM/ADA.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
+#include <Main/fg_props.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include <GUI/gui.h>
{
double lat;
- lat = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
+ lat = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
float flat = lat;
return(flat);
{
double a, d;
- a = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
+ a = current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
if (a < 0.0) {
a = -a;
}
{
double lon;
- lon = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
+ lon = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
float flon = lon;
return(flon);
float get_long_min( void )
{
double a, d;
- a = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
+ a = current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
if (a < 0.0) {
a = -a;
}
float get_speed( void )
{
- // Make an explicit function call.
+ static const SGPropertyNode * speedup_node = fgGetNode("/sim/speed-up");
+
float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
- * globals->get_options()->get_speed_up();
- return( speed );
+ * speedup_node->getIntValue();
+
+ return speed;
}
float get_mach(void)
float get_aoa( void )
{
- float aoa = current_aircraft.fdm_state->get_Alpha() * RAD_TO_DEG;
+ float aoa = current_aircraft.fdm_state->get_Alpha() * SGD_RADIANS_TO_DEGREES;
return( aoa );
}
float get_heading( void )
{
- float heading = (current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG);
+ float heading = (current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES);
return( heading );
}
float get_altitude( void )
{
-// FGState *f;
- // double rough_elev;
+ static const SGPropertyNode *startup_units_node
+ = fgGetNode("/sim/startup/units");
-// current_aircraft.fdm_state
- // rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
- // f->get_Latitude() * RAD_TO_ARCSEC);
float altitude;
- if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
+ if ( startup_units_node->getStringValue() == "feet" ) {
altitude = current_aircraft.fdm_state->get_Altitude();
} else {
- altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
+ altitude = (current_aircraft.fdm_state->get_Altitude()
+ * SG_FEET_TO_METER);
}
+
return altitude;
}
{
float agl;
- if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
+ if ( fgGetString("/sim/startup/units") == "feet" ) {
agl = (current_aircraft.fdm_state->get_Altitude()
- - scenery.cur_elev * METER_TO_FEET);
+ - scenery.cur_elev * SG_METER_TO_FEET);
} else {
- agl = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
+ agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
- scenery.cur_elev);
}
return agl;
float get_fov( void )
{
- float fov = globals->get_options()->get_fov();
+ float fov = globals->get_current_view()->get_fov();
return (fov);
}
float get_climb_rate( void )
{
float climb_rate;
- if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
+ if ( fgGetString("/sim/startup/units") == "feet" ) {
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
} else {
- climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
+ climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0;
}
return (climb_rate);
}
float get_view_direction( void )
{
- double view_off = FG_2PI - globals->get_current_view()->get_view_offset();
+ double view_off = SGD_2PI - globals->get_current_view()->get_view_offset();
double view = ( current_aircraft.fdm_state->get_Psi() + view_off)
- * RAD_TO_DEG;
+ * SGD_RADIANS_TO_DEGREES;
if(view > 360.)
view -= 360.;
}
// $$$ begin - added, VS Renganathan 13 Oct 2K
-#ifdef FIGHTER_HUD
+// #ifdef FIGHTER_HUD
float get_Vx ( void )
{
- float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+ float Vxx = 0;
return (Vxx);
}
float get_Vy ( void )
{
- float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+ float Vyy = 0;
return (Vyy);
}
float get_Vz ( void )
{
- float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+ float Vzz = 0;
return (Vzz);
}
FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
return fdm->get_aux18();
}
-#endif
+// #endif
// $$$ end - added, VS Renganathan 13 Oct 2K
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
{
- FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
+ SG_LOG( SG_COCKPIT, SG_INFO, "Initializing cockpit subsystem" );
// cockpit->code = 1; /* It will be aircraft dependent */
// cockpit->status = 0;
// Have to set the LatLon display type
fgLatLonFormat = toDM;
- FG_LOG( FG_COCKPIT, FG_INFO,
+ SG_LOG( SG_COCKPIT, SG_INFO,
" Code " << ac_cockpit->code() << " Status "
<< ac_cockpit->status() );
void fgCockpitUpdate( void ) {
- FG_LOG( FG_COCKPIT, FG_DEBUG,
- "Cockpit: code " << ac_cockpit->code() << " status "
- << ac_cockpit->status() );
+ SG_LOG( SG_COCKPIT, SG_DEBUG,
+ "Cockpit: code " << ac_cockpit->code() << " status "
+ << ac_cockpit->status() );
+
+ static const SGPropertyNode * xsize_node = fgGetNode("/sim/startup/xsize");
+ static const SGPropertyNode * ysize_node = fgGetNode("/sim/startup/ysize");
+ static const SGPropertyNode * hud_visibility_node
+ = fgGetNode("/sim/hud/visibility");
- int iwidth = globals->get_current_view()->get_winWidth();
- int iheight = globals->get_current_view()->get_winHeight();
- float width = iwidth;
- float height = iheight;
+ int iwidth = xsize_node->getIntValue();
+ int iheight = ysize_node->getIntValue();
+ float width = iwidth;
+ // float height = iheight;
- if ( globals->get_options()->get_hud_status() ) {
+ // FIXME: inefficient
+ if ( hud_visibility_node->getBoolValue() ) {
// This will check the global hud linked list pointer.
// If these is anything to draw it will.
fgUpdateHUD();
// sprintf(buf,"%-4.1f %7.0f %7.0f", fps, tris, culled);
sprintf(buf,"%-5.1f", fps);
- glMatrixMode(GL_PROJECTION);
+ glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
- gluOrtho2D(0, width, 0, height);
- glMatrixMode(GL_MODELVIEW);
+ gluOrtho2D( 0, iwidth, 0, iheight );
+ glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
+ glDisable( GL_DEPTH_TEST );
+ glDisable( GL_LIGHTING );
- glColor3f (0.9, 0.4, 0.2);
+ glColor3f( 0.9, 0.4, 0.2 );
guiFnt.drawString( buf,
- // width/2 - guiFnt.getStringWidth(buf)/2,
int(width - guiFnt.getStringWidth(buf) - 10),
10 );
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHTING);
- glMatrixMode(GL_PROJECTION);
+ glEnable( GL_DEPTH_TEST );
+ glEnable( GL_LIGHTING );
+ glMatrixMode( GL_PROJECTION );
glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ glMatrixMode( GL_MODELVIEW );
glPopMatrix();
}
#endif // #ifdef DISPLAY_COUNTER
- xglViewport( 0, 0, iwidth, iheight );
-
- if (current_panel != 0)
- current_panel->update();
+ glViewport( 0, 0, iwidth, iheight );
}