float alt = cur_fdm_state->get_Altitude();
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_METERS) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_METERS) {
alt *= FEET_TO_METER;
}
TgtAptId = tmp.substr( 0, pos );
string alt_str = tmp.substr( pos + 1 );
alt = atof( alt_str.c_str() );
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
alt *= FEET_TO_METER;
}
} else {
void TgtAptDialog_Reset(puObject *)
{
- // strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
- sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+ // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+ sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
TgtAptDialogInput->setValue ( NewTgtAirportId );
TgtAptDialogInput->setCursor( 0 ) ;
}
void AddWayPoint(puObject *cb)
{
- // strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
- sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+ // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+ sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
TgtAptDialogInput->setValue( NewTgtAirportId );
FG_PUSH_PUI_DIALOG( TgtAptDialog );
void NewTgtAirportInit(void)
{
FG_LOG( FG_AUTOPILOT, FG_INFO, " enter NewTgtAirportInit()" );
- // fgAPset_tgt_airport_id( current_options.get_airport_id() );
- sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+ // fgAPset_tgt_airport_id( globals->get_options()->get_airport_id() );
+ sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
FG_LOG( FG_AUTOPILOT, FG_INFO, " NewTgtAirportId " << NewTgtAirportId );
// printf(" NewTgtAirportId %s\n", NewTgtAirportId);
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
static inline double get_ground_speed() {
// starts in ft/s so we convert to kts
double ft_s = cur_fdm_state->get_V_ground_speed()
- * current_options.get_speed_up();;
+ * globals->get_options()->get_speed_up();;
double kts = ft_s * FEET_TO_METER * 3600 * METER_TO_NM;
return kts;
update_old_control_values();
- sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+ sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
// TargetLatitude = FGBFI::getLatitude();
// TargetLongitude = FGBFI::getLongitude();
// lock at current altitude
TargetAltitude = FGBFI::getAltitude() * FEET_TO_METER;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
} else {
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
TargetAGL = FGBFI::getAGL() * FEET_TO_METER;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
} else {
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
// cout << "new altitude = " << new_altitude << endl;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
target_alt = new_altitude * FEET_TO_METER;
}
// cout << "TargetAltitude = " << TargetAltitude << endl;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
target_alt *= METER_TO_FEET;
}
// ApAltitudeDialogInput->setValue((float)target_alt);
{
double target_alt, target_agl;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
target_alt = TargetAltitude * METER_TO_FEET;
target_agl = TargetAGL * METER_TO_FEET;
} else {
target_agl = ( int ) ( target_agl / inc ) * inc + inc;
}
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
target_alt *= FEET_TO_METER;
target_agl *= FEET_TO_METER;
}
TargetAltitude = target_alt;
TargetAGL = target_agl;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET )
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET )
target_alt *= METER_TO_FEET;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET )
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET )
target_agl *= METER_TO_FEET;
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
{
// Make an explicit function call.
float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
- * current_options.get_speed_up();
+ * globals->get_options()->get_speed_up();
return( speed );
}
// f->get_Latitude() * RAD_TO_ARCSEC);
float altitude;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
altitude = current_aircraft.fdm_state->get_Altitude();
} else {
altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
{
float agl;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
agl = (current_aircraft.fdm_state->get_Altitude()
- scenery.cur_elev * METER_TO_FEET);
} else {
float get_fov( void )
{
- float fov = current_options.get_fov();
+ float fov = globals->get_options()->get_fov();
return (fov);
}
float get_climb_rate( void )
{
float climb_rate;
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_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;
float width = iwidth;
float height = iheight;
- if ( current_options.get_hud_status() ) {
+ if ( globals->get_options()->get_hud_status() ) {
// This will check the global hud linked list pointer.
// If these is anything to draw it will.
fgUpdateHUD();
int gap = 10;
#endif
-// int font_size = current_options.get_xsize() / 60;
- int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+// int font_size = globals->get_options()->get_xsize() / 60;
+ int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
HUD_style = 1;
HUD_deque.insert( HUD_deque.begin(), HIptr);
// case 20:
- switch( current_options.get_tris_or_culled() ) {
+ switch( globals->get_options()->get_tris_or_culled() ) {
case 0:
HIptr = (instr_item *) new instr_label( 10,
25,
int compass_w = 200;
// int gap = 10;
-// int font_size = current_options.get_xsize() / 60;
- int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+// int font_size = globals->get_options()->get_xsize() / 60;
+ int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
HUD_style = 2;
TRUE );
HUD_deque.push_front( p );
- if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
strcpy(units, " ft");
} else {
strcpy(units, " m");
void HUD_masterswitch( bool incr )
{
- if ( current_options.get_hud_status() ) {
+ if ( globals->get_options()->get_hud_status() ) {
if ( global_day_night_switch == DAY ) {
global_day_night_switch = NIGHT;
} else {
- current_options.set_hud_status( false );
+ globals->get_options()->set_hud_status( false );
}
} else {
- current_options.set_hud_status( true );
+ globals->get_options()->set_hud_status( true );
global_day_night_switch = DAY;
}
}
instr_item *pHUDInstr = HUD_deque[0];
int brightness = pHUDInstr->get_brightness();
- if( current_options.get_hud_status() ) {
+ if( globals->get_options()->get_hud_status() ) {
if( incr_bright ) {
switch (brightness)
{
break;
default:
- current_options.set_hud_status(0);
+ globals->get_options()->set_hud_status(0);
}
}
} else {
- current_options.set_hud_status(true);
+ globals->get_options()->set_hud_status(true);
}
pHUDInstr->SetBrightness( brightness );
}
void fgHUDalphaAdjust( puObject * ) {
- current_options.set_anti_alias_hud(1);
+ globals->get_options()->set_anti_alias_hud(1);
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
}
static void cancelHUDalphaAdjust (puObject *)
{
- current_options.set_anti_alias_hud(0);
+ globals->get_options()->set_anti_alias_hud(0);
FG_POP_PUI_DIALOG( HUDalphaDialog );
}
if ( HUDtext )
delete HUDtext;
- HUD_TextSize = current_options.get_xsize() / 60;
+ HUD_TextSize = globals->get_options()->get_xsize() / 60;
HUD_TextSize = 10;
HUDtext = new fntRenderer();
HUDtext -> setFont ( guiFntHandle ) ;
static void set_hud_color(float r, float g, float b) {
- current_options.get_anti_alias_hud() ?
+ globals->get_options()->get_anti_alias_hud() ?
glColor4f(r,g,b,hud_trans_alpha) :
glColor3f(r,g,b);
}
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
- if( current_options.get_anti_alias_hud() ) {
+ if( globals->get_options()->get_anti_alias_hud() ) {
glEnable(GL_LINE_SMOOTH);
// glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// HUD_StippleLineList.draw();
// glDisable(GL_LINE_STIPPLE);
- if( current_options.get_anti_alias_hud() ) {
+ if( globals->get_options()->get_anti_alias_hud() ) {
// glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glLineWidth(1.0);
glPushMatrix();
glTranslatef( centroid.x, centroid.y, 0);
// Alex's panel patch
-// glScalef( current_options.get_fov()/55.0, 1.0, 1.0 );
+// glScalef( globals->get_options()->get_fov()/55.0, 1.0, 1.0 );
glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
// Draw the target spot.
bool
fgPanelVisible ()
{
- return ((current_options.get_panel_status()) &&
- (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT) &&
+ return ((globals->get_options()->get_panel_status()) &&
+ (globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT) &&
(globals->get_current_view()->get_view_offset() == 0.0));
}
ssgTexture * texture = _textureMap[relativePath];
if (texture == 0) {
cerr << "Texture " << relativePath << " does not yet exist" << endl;
- FGPath tpath(current_options.get_fg_root());
+ FGPath tpath(globals->get_options()->get_fg_root());
tpath.append(relativePath);
texture = new ssgTexture((char *)tpath.c_str(), false, false);
_textureMap[relativePath] = texture;
#include <fstream>
#include <string>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include "panel.hxx"
#include "steam.hxx"
SGPropertyList props2;
SGPropertyNode node = instrument_group.getChild(i);
- FGPath path(current_options.get_fg_root());
+ FGPath path( globals->get_options()->get_fg_root() );
path.append(node.getStringValue("path"));
FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
fgReadPanel (const string &relative_path)
{
FGPanel * panel = 0;
- FGPath path(current_options.get_fg_root());
+ FGPath path(globals->get_options()->get_fg_root());
path.append(relative_path);
ifstream input(path.c_str());
if (!input.good()) {
void FGSteam::_CatchUp()
{ if ( _UpdatesPending != 0 )
- { double dt = _UpdatesPending * 1.0 / current_options.get_model_hz();
+ { double dt = _UpdatesPending * 1.0 /
+ globals->get_options()->get_model_hz();
double AccN, AccE, AccU;
int i /*,j*/;
double d, the_ENGINE_rpm;
#ifndef _CONTROLS_HXX
#define _CONTROLS_HXX
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#ifndef __cplusplus
# error This library requires C++
CLAMP( &aileron, -1.0, 1.0 );
// check for autocoordination
- if ( current_options.get_auto_coordination() ==
- fgOPTIONS::FG_AUTO_COORD_ENABLED )
+ if ( globals->get_options()->get_auto_coordination() ==
+ FGOptions::FG_AUTO_COORD_ENABLED )
{
set_rudder( aileron / 2.0 );
}
CLAMP( &aileron, -1.0, 1.0 );
// check for autocoordination
- if ( current_options.get_auto_coordination() ==
- fgOPTIONS::FG_AUTO_COORD_ENABLED )
+ if ( globals->get_options()->get_auto_coordination() ==
+ FGOptions::FG_AUTO_COORD_ENABLED )
{
set_rudder( aileron / 2.0 );
}
//set velocities
sgSetVec3( temp,
- current_options.get_uBody(),
- current_options.get_vBody(),
- current_options.get_wBody() );
+ globals->get_options()->get_uBody(),
+ globals->get_options()->get_vBody(),
+ globals->get_options()->get_wBody() );
current_balloon.setVelocity( temp );
FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing BalloonSim" );
bool FGExternal::update( int multiloop ) {
// cout << "FGExternal::update()" << endl;
- // double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+ // double time_step = (1.0 / globals->get_options()->get_model_hz())
+ // * multiloop;
return true;
FG_LOG( FG_FLIGHT, FG_INFO, "Starting and initializing JSBsim" );
FG_LOG( FG_FLIGHT, FG_INFO, " created FDMExec" );
- FGPath aircraft_path( current_options.get_fg_root() );
+ FGPath aircraft_path( globals->get_options()->get_fg_root() );
aircraft_path.append( "Aircraft" );
- FGPath engine_path( current_options.get_fg_root() );
+ FGPath engine_path( globals->get_options()->get_fg_root() );
engine_path.append( "Engine" );
//FDMExec.GetState()->Setdt( dt );
result = FDMExec.LoadModel( aircraft_path.str(),
engine_path.str(),
- current_options.get_aircraft() );
+ globals->get_options()->get_aircraft() );
FDMExec.GetState()->Setdt( dt );
if (result) {
- FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft " << current_options.get_aircraft() );
+ FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft "
+ << globals->get_options()->get_aircraft() );
} else {
- FG_LOG( FG_FLIGHT, FG_INFO, " aircraft " << current_options.get_aircraft()
+ FG_LOG( FG_FLIGHT, FG_INFO, " aircraft "
+ << globals->get_options()->get_aircraft()
<< " does not exist" );
return false;
}
FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
fgic->SetAltitudeFtIC(get_Altitude());
- if((current_options.get_mach() < 0) && (current_options.get_vc() < 0 )) {
- fgic->SetUBodyFpsIC(current_options.get_uBody());
- fgic->SetVBodyFpsIC(current_options.get_vBody());
- fgic->SetWBodyFpsIC(current_options.get_wBody());
- FG_LOG(FG_FLIGHT,FG_INFO, " u,v,w= " << current_options.get_uBody()
- << ", " << current_options.get_vBody()
- << ", " << current_options.get_wBody());
- } else if (current_options.get_vc() < 0) {
- fgic->SetMachIC(current_options.get_mach());
- FG_LOG(FG_FLIGHT,FG_INFO, " mach: " << current_options.get_mach() );
+ if ( (globals->get_options()->get_mach() < 0) &&
+ (globals->get_options()->get_vc() < 0 ) )
+ {
+ fgic->SetUBodyFpsIC(globals->get_options()->get_uBody());
+ fgic->SetVBodyFpsIC(globals->get_options()->get_vBody());
+ fgic->SetWBodyFpsIC(globals->get_options()->get_wBody());
+ FG_LOG(FG_FLIGHT,FG_INFO, " u,v,w= " << globals->get_options()->get_uBody()
+ << ", " << globals->get_options()->get_vBody()
+ << ", " << globals->get_options()->get_wBody());
+ } else if (globals->get_options()->get_vc() < 0) {
+ fgic->SetMachIC(globals->get_options()->get_mach());
+ FG_LOG( FG_FLIGHT,FG_INFO, " mach: "
+ << globals->get_options()->get_mach() );
} else {
- fgic->SetVcalibratedKtsIC(current_options.get_vc());
- FG_LOG(FG_FLIGHT,FG_INFO, " vc: " << current_options.get_vc() );
+ fgic->SetVcalibratedKtsIC(globals->get_options()->get_vc());
+ FG_LOG(FG_FLIGHT,FG_INFO, " vc: " << globals->get_options()->get_vc() );
//this should cover the case in which no speed switches are used
- //current_options.get_vc() will return zero by default
+ //globals->get_options()->get_vc() will return zero by default
}
- //fgic->SetFlightPathAngleDegIC(current_options.get_Gamma());
+ //fgic->SetFlightPathAngleDegIC(globals->get_options()->get_Gamma());
fgic->SetRollAngleRadIC(get_Phi());
fgic->SetPitchAngleRadIC(get_Theta());
fgic->SetHeadingRadIC(get_Psi());
fgic->SetLatitudeRadIC(get_Lat_geocentric());
fgic->SetLongitudeRadIC(get_Longitude());
- //FG_LOG( FG_FLIGHT, FG_INFO, " gamma: " << current_options.get_Gamma());
+ // FG_LOG( FG_FLIGHT, FG_INFO, " gamma: "
+ // << globals->get_options()->get_Gamma());
FG_LOG( FG_FLIGHT, FG_INFO, " phi: " << get_Phi());
//FG_LOG( FG_FLIGHT, FG_INFO, " theta: " << get_Theta() );
FG_LOG( FG_FLIGHT, FG_INFO, " psi: " << get_Psi() );
<< get_Altitude() + get_Sea_level_radius()
- scenery.cur_radius*METER_TO_FEET );
- FG_LOG( FG_FLIGHT, FG_INFO, " current_options.get_altitude(): "
- << current_options.get_altitude() );
+ FG_LOG( FG_FLIGHT, FG_INFO, " globals->get_options()->get_altitude(): "
+ << globals->get_options()->get_altitude() );
//must check > 0, != 0 will give bad result if --notrim set
- if(current_options.get_trim_mode() > 0) {
+ if(globals->get_options()->get_trim_mode() > 0) {
if(fgic->GetVcalibratedKtsIC() > 50) {
FDMExec.RunIC(fgic);
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
- controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
+ controls.set_throttle( FGControls::ALL_ENGINES,
+ FDMExec.GetFCS()->GetThrottleCmd(0)/100 );
trimmed=true;
trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
bool FGJSBsim::update( int multiloop ) {
double save_alt = 0.0;
- double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+ double time_step = (1.0 / globals->get_options()->get_model_hz()) * multiloop;
double start_elev = get_Altitude();
FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) );
// Inform JSBsim of the local terrain altitude; uncommented 5/3/00
- // FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
+ // FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
FDMExec.GetRotation()->GetEulerRates()(1),
FDMExec.GetRotation()->GetEulerRates()(3));
- // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+ // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot,
+ // Radius_dot );
set_Mach_number( FDMExec.GetTranslation()->GetMach());
// each subsequent iteration through the EOM
bool FGLaRCsim::init( double dt ) {
- if ( current_options.get_aircraft() == "c172" ) {
+ if ( globals->get_options()->get_aircraft() == "c172" ) {
// Initialize our little engine that hopefully might
eng.init(dt);
// dcl - in passing dt to init rather than update I am assuming
copy_to_LaRCsim();
// actual LaRCsim top level init
- ls_toplevel_init( dt, (char *)current_options.get_aircraft().c_str() );
+ ls_toplevel_init( dt, (char *)globals->get_options()->get_aircraft().c_str() );
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " <<
get_Latitude() );
bool FGLaRCsim::update( int multiloop ) {
// cout << "FGLaRCsim::update()" << endl;
- if ( current_options.get_aircraft() == "c172" ) {
+ if ( globals->get_options()->get_aircraft() == "c172" ) {
// set control inputs
eng.set_IAS( V_calibrated_kts );
eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
}
double save_alt = 0.0;
- double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+ double time_step = (1.0 / globals->get_options()->get_model_hz())
+ * multiloop;
double start_elev = get_Altitude();
// lets try to avoid really screwing up the LaRCsim model
}
// copy control positions into the LaRCsim structure
- Lat_control = controls.get_aileron() / current_options.get_speed_up();
+ Lat_control = controls.get_aileron() /
+ globals->get_options()->get_speed_up();
Long_control = controls.get_elevator();
Long_trim = controls.get_elevator_trim();
- Rudder_pedal = controls.get_rudder() / current_options.get_speed_up();
+ Rudder_pedal = controls.get_rudder() /
+ globals->get_options()->get_speed_up();
Flap_handle = 30.0 * controls.get_flaps();
- if ( current_options.get_aircraft() == "c172" ) {
+ if ( globals->get_options()->get_aircraft() == "c172" ) {
Use_External_Engine = 1;
} else {
Use_External_Engine = 0;
#include <simgear/math/polar3d.hxx>
#include <Controls/controls.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include "MagicCarpet.hxx"
bool FGMagicCarpet::update( int multiloop ) {
// cout << "FGLaRCsim::update()" << endl;
- double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+ double time_step = (1.0 / globals->get_options()->get_model_hz()) *
+ multiloop;
// speed and distance traveled
double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
case MOUSE_YOKE:
if( !mouse_joystick_control ) {
mouse_joystick_control = 1;
- current_options.set_control_mode( fgOPTIONS::FG_MOUSE );
+ globals->get_options()->set_control_mode( FGOptions::FG_MOUSE );
} else {
if ( left_button() ) {
offset = (_mX - x) * brake_sensitivity;
case MOUSE_YOKE:
mouse_mode = MOUSE_VIEW;
- current_options.set_control_mode( fgOPTIONS::FG_JOYSTICK );
+ globals->get_options()->set_control_mode( FGOptions::FG_JOYSTICK );
x = globals->get_current_view()->get_winWidth()/2;
y = globals->get_current_view()->get_winHeight()/2;
_mVtoggle = 0;
// This is the accessor function
void guiTogglePanel(puObject *cb)
{
- current_options.toggle_panel();
+ globals->get_options()->toggle_panel();
}
//void MenuHideMenuCb(puObject *cb)
cout << "Program exiting normally at user request." << endl;
#ifdef FG_NETWORK_OLK
- if ( current_options.get_network_olk() ) {
+ if ( globals->get_options()->get_network_olk() ) {
if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
}
#endif
void mkDialogInit (void)
{
// printf("mkDialogInit\n");
- int x = (current_options.get_xsize()/2 - 400/2);
- int y = (current_options.get_ysize()/2 - 100/2);
+ int x = (globals->get_options()->get_xsize()/2 - 400/2);
+ int y = (globals->get_options()->get_ysize()/2 - 100/2);
dialogBox = new puDialogBox (x, y); // 150, 50
{
dialogFrame = new puFrame (0,0,400,100);
// printf("ConfirmExitDialogInit\n");
int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2;
- int x = (current_options.get_xsize()/2 - 400/2);
- int y = (current_options.get_ysize()/2 - 100/2);
+ int x = (globals->get_options()->get_xsize()/2 - 400/2);
+ int y = (globals->get_options()->get_ysize()/2 - 100/2);
YNdialogBox = new puDialogBox (x, y); // 150, 50
// YNdialogBox = new puDialogBox (150, 50);
extern FGInterface cur_view_fdm;
GLubyte *hiResScreenCapture( int multiplier )
{
- float oldfov = current_options.get_fov();
+ float oldfov = globals->get_options()->get_fov();
float fov = oldfov / multiplier;
FGViewer *v = globals->get_current_view();
- current_options.set_fov(fov);
+ globals->get_options()->set_fov(fov);
v->force_update_fov_math();
fgInitVisuals();
int cur_width = globals->get_current_view()->get_winWidth( );
}
}
globals->get_current_view()->UpdateViewParams(cur_view_fdm);
- current_options.set_fov(oldfov);
+ globals->get_options()->set_fov(oldfov);
v->force_update_fov_math();
return b1->getBitmap();
}
fgRenderFrame();
my_glDumpWindow( "fgfs-screen.ppm",
- current_options.get_xsize(),
- current_options.get_ysize() );
+ globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
mkDialog ("Snap shot saved to fgfs-screen.ppm");
void AptDialog_OK (puObject *)
{
- FGPath path( current_options.get_fg_root() );
+ FGPath path( globals->get_options()->get_fg_root() );
path.append( "Airports" );
path.append( "simple.mk4" );
FGAirports airports( path.c_str() );
if ( airports.search( AptId, &a ) )
{
- current_options.set_airport_id( AptId.c_str() );
- current_options.set_altitude( -9999.0 );
+ globals->get_options()->set_airport_id( AptId.c_str() );
+ globals->get_options()->set_altitude( -9999.0 );
// fgSetPosFromAirportID( AptId );
fgSetPosFromAirportIDandHdg( AptId,
cur_fdm_state->get_Psi() * RAD_TO_DEG);
void AptDialog_Reset(puObject *)
{
- // strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
- sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+ // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+ sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
AptDialogInput->setValue ( NewAirportId );
AptDialogInput->setCursor( 0 ) ;
}
void NewAirport(puObject *cb)
{
- // strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
- sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+ // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+ sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
// cout << "NewAirport " << NewAirportId << endl;
AptDialogInput->setValue( NewAirportId );
static void NewAirportInit(void)
{
- sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+ sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
NewAirportLabel ) / 2;
NetId = net_callsign;
NetIdDialog_Cancel( NULL );
- current_options.set_net_id( NetId.c_str() );
+ globals->get_options()->set_net_id( NetId.c_str() );
strcpy( fgd_callsign, net_callsign);
-// strcpy( fgd_callsign, current_options.get_net_id().c_str());
+// strcpy( fgd_callsign, globals->get_options()->get_net_id().c_str());
/* Entering a callsign indicates : user wants Net HUD Info */
net_hud_display = 1;
void NewCallSign(puObject *cb)
{
- sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+ sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
// sprintf( NewNetId, "%s", fgd_callsign );
NetIdDialogInput->setValue( NewNetId );
static void NewNetIdInit(void)
{
- sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+ sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
// sprintf( NewNetId, "%s", fgd_callsign );
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
NewNetIdLabel ) / 2;
static void NewNetFGDInit(void)
{
-// sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+// sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
// sprintf( NewNetId, "%s", fgd_callsign );
int len = 170 - puGetStringWidth( puGetDefaultLabelFont(),
NewNetFGDLabel ) / 2;
if ( envp != NULL ) {
fntpath.set( envp );
} else {
- fntpath.set( current_options.get_fg_root() );
+ fntpath.set( globals->get_options()->get_fg_root() );
fntpath.append( "Fonts" );
}
puSetDefaultFonts( GuiFont, GuiFont ) ;
guiFnt = puGetDefaultLabelFont();
- if ( current_options.get_mouse_pointer() == 0 ) {
+ if ( globals->get_options()->get_mouse_pointer() == 0 ) {
// no preference specified for mouse pointer, attempt to autodetect...
// Determine if we need to render the cursor, or if the windowing
// system will do it. First test if we are rendering with glide.
}
}
mouse_active = ~mouse_active;
- } else if ( current_options.get_mouse_pointer() == 1 ) {
+ } else if ( globals->get_options()->get_mouse_pointer() == 1 ) {
// don't show pointer
- } else if ( current_options.get_mouse_pointer() == 2 ) {
+ } else if ( globals->get_options()->get_mouse_pointer() == 2 ) {
// force showing pointer
puShowCursor();
mouse_active = ~mouse_active;
mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
// mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
#ifdef FG_NETWORK_OLK
- if ( current_options.get_network_olk() ) {
+ if ( globals->get_options()->get_network_olk() ) {
mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
}
#endif
double gpsLongitude = getGPSTargetLongitude();
setTargetAirport("");
- cout << "Target airport is " << current_options.get_airport_id() << endl;
+ cout << "Target airport is " << globals->get_options()->get_airport_id() << endl;
fgReInitSubsystems();
int
FGBFI::getFlightModel ()
{
- return current_options.get_flight_model();
+ return globals->get_options()->get_flight_model();
}
const string
FGBFI::getAircraft ()
{
- return current_options.get_aircraft();
+ return globals->get_options()->get_aircraft();
}
FGBFI::setFlightModel (int model)
{
if (getFlightModel() != model) {
- current_options.set_flight_model(model);
+ globals->get_options()->set_flight_model(model);
needReinit();
}
}
FGBFI::setAircraft (const string &aircraft)
{
if (getAircraft() != aircraft) {
- current_options.set_aircraft(aircraft);
+ globals->get_options()->set_aircraft(aircraft);
needReinit();
}
}
if (getTimeGMT() != time) {
// FIXME: need to update lighting
// and solar system
- current_options.set_time_offset(time);
- current_options.set_time_offset_type(fgOPTIONS::FG_TIME_GMT_ABSOLUTE);
+ globals->get_options()->set_time_offset(time);
+ globals->get_options()->set_time_offset_type(FGOptions::FG_TIME_GMT_ABSOLUTE);
globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
globals->get_warp() );
bool
FGBFI::getHUDVisible ()
{
- return current_options.get_hud_status();
+ return globals->get_options()->get_hud_status();
}
void
FGBFI::setHUDVisible (bool visible)
{
- current_options.set_hud_status(visible);
+ globals->get_options()->set_hud_status(visible);
}
bool
FGBFI::getPanelVisible ()
{
- return current_options.get_panel_status();
+ return globals->get_options()->get_panel_status();
}
void
FGBFI::setPanelVisible (bool visible)
{
- if (current_options.get_panel_status() != visible) {
- current_options.toggle_panel();
+ if (globals->get_options()->get_panel_status() != visible) {
+ globals->get_options()->toggle_panel();
}
}
FGBFI::setLatitude (double latitude)
{
if (getLatitude() != latitude) {
- current_options.set_lat(latitude);
+ globals->get_options()->set_lat(latitude);
current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
needReinit();
}
FGBFI::setLongitude (double longitude)
{
if (getLongitude() != longitude) {
- current_options.set_lon(longitude);
+ globals->get_options()->set_lon(longitude);
current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
needReinit();
}
{
if (getAltitude() != altitude) {
fgFDMForceAltitude(getFlightModel(), altitude);
- current_options.set_altitude(altitude);
+ globals->get_options()->set_altitude(altitude);
current_aircraft.fdm_state->set_Altitude(altitude);
}
}
FGBFI::setHeading (double heading)
{
if (getHeading() != heading) {
- current_options.set_heading(heading);
+ globals->get_options()->set_heading(heading);
current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
getPitch() * DEG_TO_RAD,
heading * DEG_TO_RAD);
FGBFI::setPitch (double pitch)
{
if (getPitch() != pitch) {
- current_options.set_pitch(pitch);
+ globals->get_options()->set_pitch(pitch);
current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
pitch * DEG_TO_RAD,
getHeading() * DEG_TO_RAD);
FGBFI::setRoll (double roll)
{
if (getRoll() != roll) {
- current_options.set_roll(roll);
+ globals->get_options()->set_roll(roll);
current_aircraft.fdm_state->set_Euler_Angles(roll * DEG_TO_RAD,
getPitch() * DEG_TO_RAD,
getHeading() * DEG_TO_RAD);
FGBFI::setSpeedNorth (double speed)
{
if (getSpeedNorth() != speed) {
- current_options.set_uBody(speed);
+ globals->get_options()->set_uBody(speed);
current_aircraft.fdm_state->set_Velocities_Local(speed,
getSpeedEast(),
getSpeedDown());
FGBFI::setSpeedEast (double speed)
{
if (getSpeedEast() != speed) {
- current_options.set_vBody(speed);
+ globals->get_options()->set_vBody(speed);
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
speed,
getSpeedDown());
FGBFI::setSpeedDown (double speed)
{
if (getSpeedDown() != speed) {
- current_options.set_wBody(speed);
+ globals->get_options()->set_wBody(speed);
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
getSpeedEast(),
speed);
{
// FIXME: not thread-safe
static string out;
- out = current_options.get_airport_id();
+ out = globals->get_options()->get_airport_id();
return out;
}
FGBFI::setTargetAirport (const string &airportId)
{
// cout << "setting target airport id = " << airportId << endl;
- current_options.set_airport_id(airportId);
+ globals->get_options()->set_airport_id(airportId);
}
bool
FGBFI::getClouds ()
{
- return current_options.get_clouds();
+ return globals->get_options()->get_clouds();
}
double
FGBFI::getCloudsASL ()
{
- return current_options.get_clouds_asl();
+ return globals->get_options()->get_clouds_asl();
}
{
if (getClouds() != clouds) {
cout << "Set clouds to " << clouds << endl;
- current_options.set_clouds(clouds);
+ globals->get_options()->set_clouds(clouds);
needReinit();
}
}
FGBFI::setCloudsASL (double cloudsASL)
{
if (getCloudsASL() != cloudsASL) {
- current_options.set_clouds_asl(cloudsASL);
+ globals->get_options()->set_clouds_asl(cloudsASL);
needReinit();
}
}
bool fgInitFGRoot ( int argc, char **argv ) {
// Attempt to locate and parse a config file
// First check fg_root
- FGPath config( current_options.get_fg_root() );
+ FGPath config( globals->get_options()->get_fg_root() );
config.append( "system.fgfsrc" );
- current_options.scan_config_file_for_root( config.str() );
+ globals->get_options()->scan_config_file_for_root( config.str() );
// Next check home directory
char* envp = ::getenv( "HOME" );
if ( envp != NULL ) {
config.set( envp );
config.append( ".fgfsrc" );
- current_options.scan_config_file_for_root( config.str() );
+ globals->get_options()->scan_config_file_for_root( config.str() );
}
// Parse remaining command line options
// These will override anything specified in a config file
- current_options.scan_command_line_for_root(argc, argv);
+ globals->get_options()->scan_command_line_for_root(argc, argv);
return true;
}
bool fgInitConfig ( int argc, char **argv ) {
// Attempt to locate and parse a config file
// First check fg_root
- FGPath config( current_options.get_fg_root() );
+ FGPath config( globals->get_options()->get_fg_root() );
config.append( "system.fgfsrc" );
- current_options.parse_config_file( config.str() );
+ globals->get_options()->parse_config_file( config.str() );
// Next check home directory
char* envp = ::getenv( "HOME" );
if ( envp != NULL ) {
config.set( envp );
config.append( ".fgfsrc" );
- current_options.parse_config_file( config.str() );
+ globals->get_options()->parse_config_file( config.str() );
}
// Parse remaining command line options
// These will override anything specified in a config file
- if ( current_options.parse_command_line(argc, argv) !=
- fgOPTIONS::FG_OPTIONS_OK )
+ if ( globals->get_options()->parse_command_line(argc, argv) !=
+ FGOptions::FG_OPTIONS_OK )
{
// Something must have gone horribly wrong with the command
// line parsing or maybe the user just requested help ... :-)
- current_options.usage();
+ globals->get_options()->usage();
FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
return false;
}
// find basic airport location info from airport database
bool fgFindAirportID( const string& id, FGAirport *a ) {
if ( id.length() ) {
- FGPath path( current_options.get_fg_root() );
+ FGPath path( globals->get_options()->get_fg_root() );
path.append( "Airports" );
path.append( "simple.mk4" );
FGAirports airports( path.c_str() );
"Attempting to set starting position from airport code " << id );
if ( fgFindAirportID( id, &a ) ) {
- current_options.set_lon( a.longitude );
- current_options.set_lat( a.latitude );
+ globals->get_options()->set_lon( a.longitude );
+ globals->get_options()->set_lat( a.latitude );
current_properties.setDoubleValue("/position/longitude",
a.longitude);
current_properties.setDoubleValue("/position/latitude",
if ( id.length() ) {
// set initial position from runway and heading
- FGPath path( current_options.get_fg_root() );
+ FGPath path( globals->get_options()->get_fg_root() );
path.append( "Airports" );
path.append( "runways.mk4" );
FGRunways runways( path.c_str() );
"Attempting to set starting position from runway code "
<< id << " heading " << tgt_hdg );
- // FGPath inpath( current_options.get_fg_root() );
+ // FGPath inpath( globals->get_options()->get_fg_root() );
// inpath.append( "Airports" );
// inpath.append( "apt_simple" );
// airports.load( inpath.c_str() );
- // FGPath outpath( current_options.get_fg_root() );
+ // FGPath outpath( globals->get_options()->get_fg_root() );
// outpath.append( "Airports" );
// outpath.append( "simple.gdbm" );
// airports.dump_gdbm( outpath.c_str() );
geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon,
azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
&lat2, &lon2, &az2 );
- current_options.set_lon( lon2 );
- current_options.set_lat( lat2 );
- current_options.set_heading( heading );
+ globals->get_options()->set_lon( lon2 );
+ globals->get_options()->set_lat( lat2 );
+ globals->get_options()->set_heading( heading );
current_properties.setDoubleValue("/position/longitude", lon2);
current_properties.setDoubleValue("/position/latitude", lat2);
current_properties.setDoubleValue("/orientation/heading", heading);
// Set initial position and orientation
bool fgInitPosition( void ) {
FGInterface *f = current_aircraft.fdm_state;
- string id = current_options.get_airport_id();
+ string id = globals->get_options()->get_airport_id();
// set initial position from default or command line coordinates
- f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
- f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
+ f->set_Longitude( globals->get_options()->get_lon() * DEG_TO_RAD );
+ f->set_Latitude( globals->get_options()->get_lat() * DEG_TO_RAD );
- if ( scenery.cur_elev > current_options.get_altitude() - 1) {
- current_options.set_altitude( scenery.cur_elev + 1 );
+ if ( scenery.cur_elev > globals->get_options()->get_altitude() - 1) {
+ globals->get_options()->set_altitude( scenery.cur_elev + 1 );
}
FG_LOG( FG_GENERAL, FG_INFO,
- "starting altitude is = " << current_options.get_altitude() );
+ "starting altitude is = " << globals->get_options()->get_altitude() );
- f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
- fgFDMSetGroundElevation( current_options.get_flight_model(),
+ f->set_Altitude( globals->get_options()->get_altitude() * METER_TO_FEET );
+ fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
f->get_Altitude() * FEET_TO_METER );
#if 0
FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
- root = current_options.get_fg_root();
+ root = globals->get_options()->get_fg_root();
if ( ! root.length() ) {
// No root path set? Then bail ...
FG_LOG( FG_GENERAL, FG_ALERT,
FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
// Initialize the material property lib
- FGPath mpath( current_options.get_fg_root() );
+ FGPath mpath( globals->get_options()->get_fg_root() );
mpath.append( "materials" );
if ( material_lib.load( mpath.str() ) ) {
} else {
if ( global_tile_mgr.init() ) {
// Load the local scenery data
- global_tile_mgr.update( current_options.get_lon(),
- current_options.get_lat() );
+ global_tile_mgr.update( globals->get_options()->get_lon(),
+ globals->get_options()->get_lat() );
} else {
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
exit(-1);
"Current terrain elevation after tile mgr init " <<
scenery.cur_elev );
- if ( current_options.get_flight_model() == FGInterface::FG_LARCSIM ) {
+ if ( globals->get_options()->get_flight_model() == FGInterface::FG_LARCSIM ) {
cur_fdm_state = new FGLaRCsim;
- } else if ( current_options.get_flight_model() == FGInterface::FG_JSBSIM ) {
+ } else if ( globals->get_options()->get_flight_model() == FGInterface::FG_JSBSIM ) {
cur_fdm_state = new FGJSBsim;
- } else if ( current_options.get_flight_model() == FGInterface::FG_ADA ) {
+ } else if ( globals->get_options()->get_flight_model() == FGInterface::FG_ADA ) {
cur_fdm_state = new FGADA;
- } else if ( current_options.get_flight_model() ==
+ } else if ( globals->get_options()->get_flight_model() ==
FGInterface::FG_BALLOONSIM ) {
cur_fdm_state = new FGBalloonSim;
- } else if ( current_options.get_flight_model() ==
+ } else if ( globals->get_options()->get_flight_model() ==
FGInterface::FG_MAGICCARPET ) {
cur_fdm_state = new FGMagicCarpet;
- } else if ( current_options.get_flight_model() ==
+ } else if ( globals->get_options()->get_flight_model() ==
FGInterface::FG_EXTERNAL ) {
cur_fdm_state = new FGExternal;
} else {
"Altitude after update " << scenery.cur_elev );
*/
- fgFDMSetGroundElevation( current_options.get_flight_model(),
+ fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
scenery.cur_elev );
// Reset our altitude if we are below ground
// and should really be read in from one or more files.
// Initial Velocity
- cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
- current_options.get_vBody(),
- current_options.get_wBody());
+ cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
+ globals->get_options()->get_vBody(),
+ globals->get_options()->get_wBody());
// Initial Orientation
- cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
- current_options.get_pitch() * DEG_TO_RAD,
- current_options.get_heading() * DEG_TO_RAD );
+ cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
+ globals->get_options()->get_pitch() * DEG_TO_RAD,
+ globals->get_options()->get_heading() * DEG_TO_RAD );
// Initial Angular Body rates
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
current_aircraft.fdm_state->get_Longitude(),
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
- new FGLocalWeatherDatabase( position, current_options.get_fg_root() );
+ new FGLocalWeatherDatabase( position, globals->get_options()->get_fg_root() );
// cout << theFGLocalWeatherDatabase << endl;
// cout << "visibility = "
// << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
FG_LOG(FG_GENERAL, FG_INFO, " VOR/NDB");
current_navlist = new FGNavList;
- FGPath p_nav( current_options.get_fg_root() );
+ FGPath p_nav( globals->get_options()->get_fg_root() );
p_nav.append( "Navaids/default.nav" );
current_navlist->init( p_nav );
FG_LOG(FG_GENERAL, FG_INFO, " ILS");
current_ilslist = new FGILSList;
- FGPath p_ils( current_options.get_fg_root() );
+ FGPath p_ils( globals->get_options()->get_fg_root() );
p_ils.append( "Navaids/default.ils" );
current_ilslist->init( p_ils );
FG_LOG(FG_GENERAL, FG_INFO, " Fixes");
current_fixlist = new FGFixList;
- FGPath p_fix( current_options.get_fg_root() );
+ FGPath p_fix( globals->get_options()->get_fg_root() );
p_fix.append( "Navaids/default.fix" );
current_fixlist->init( p_fix );
// Initialize the flight model subsystem data structures base on
// above values
- // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
- // 1.0 / current_options.get_model_hz() );
- if ( cur_fdm_state->init( 1.0 / current_options.get_model_hz() ) ) {
+ // fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state,
+ // 1.0 / globals->get_options()->get_model_hz() );
+ if ( cur_fdm_state->init( 1.0 / globals->get_options()->get_model_hz() ) ) {
// fdm init successful
} else {
FG_LOG( FG_GENERAL, FG_ALERT, "FDM init() failed! Cannot continue." );
if( global_tile_mgr.init() ) {
// Load the local scenery data
- global_tile_mgr.update( current_options.get_lon(),
- current_options.get_lat() );
+ global_tile_mgr.update( globals->get_options()->get_lon(),
+ globals->get_options()->get_lat() );
} else {
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
exit(-1);
// cout << "current scenery elev = " << scenery.cur_elev << endl;
fgInitPosition();
- fgFDMSetGroundElevation( current_options.get_flight_model(),
+ fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
scenery.cur_elev );
// Reset our altitude if we are below ground
// and should really be read in from one or more files.
// Initial Velocity
- cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
- current_options.get_vBody(),
- current_options.get_wBody());
+ cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
+ globals->get_options()->get_vBody(),
+ globals->get_options()->get_wBody());
// Initial Orientation
- cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
- current_options.get_pitch() * DEG_TO_RAD,
- current_options.get_heading() * DEG_TO_RAD );
+ cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
+ globals->get_options()->get_pitch() * DEG_TO_RAD,
+ globals->get_options()->get_heading() * DEG_TO_RAD );
// Initial Angular Body rates
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = "
<< globals->get_current_view()->get_abs_view_pos());
- // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
- // 1.0 / current_options.get_model_hz() );
- cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
+ // fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state,
+ // 1.0 / globals->get_options()->get_model_hz() );
+ cur_fdm_state->init( 1.0 / globals->get_options()->get_model_hz() );
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
// find basic airport location info from airport database
bool fgFindAirportID( const string& id, FGAirport *a );
-// Set current_options lon/lat given an airport id
+// Set pos given an airport id
bool fgSetPosFromAirportID( const string& id );
-// Set current_options lon/lat given an airport id and heading (degrees)
+// Set position and heading given an airport id and heading (degrees)
bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg );
-#endif // _FG_INIT_H
+#endif // _FG_INIT_HXX
#include <simgear/io/sg_socket.hxx>
#include <simgear/math/sg_types.hxx>
-#include <Main/options.hxx>
-
#include <Network/protocol.hxx>
#include <Network/native.hxx>
#include <Network/garmin.hxx>
#include <Time/timestamp.hxx>
+#include "globals.hxx"
+
FG_USING_STD(string);
void fgIOInit() {
FGProtocol *p;
string_list channel_options_list =
- current_options.get_channel_options_list();
+ globals->get_options()->get_channel_options_list();
// we could almost do this in a single step except pushing a valid
// port onto the port list copies the structure and destroys the
#include <simgear/route/route.hxx>
#include <simgear/timing/sg_time.hxx>
+#include "options.hxx"
#include "viewer.hxx"
// Global autopilot "route"
SGRoute *route;
+ // options
+ FGOptions *options;
+
+ // viewers
FGViewer *pilot_view;
FGViewer *current_view;
inline SGRoute *get_route() const { return route; }
inline void set_route( SGRoute *r ) { route = r; }
+ inline FGOptions *get_options() const { return options; }
+ inline void set_options( FGOptions *o ) { options = o; }
+
inline FGViewer *get_pilot_view() const { return pilot_view; }
inline void set_pilot_view( FGViewer *v ) { pilot_view = v; }
// unflipping yourself :-)
{
double alt = cur_fdm_state->get_Altitude() + 1000;
- fgFDMForceAltitude( current_options.get_flight_model(),
+ fgFDMForceAltitude( globals->get_options()->get_flight_model(),
alt * FEET_TO_METER );
}
return;
case 49: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.75 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.75 );
}
return;
case 50: // numeric keypad 2
v->set_goal_view_offset( FG_PI );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
- v->set_view_offset( FG_PI );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
+ v->set_view_offset( FG_PI );
}
return;
case 51: // numeric keypad 3
v->set_goal_view_offset( FG_PI * 1.25 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.25 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.25 );
}
return;
case 52: // numeric keypad 4
v->set_goal_view_offset( FG_PI * 0.50 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.50 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.50 );
}
return;
case 54: // numeric keypad 6
v->set_goal_view_offset( FG_PI * 1.50 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.50 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.50 );
}
return;
case 55: // numeric keypad 7
v->set_goal_view_offset( FG_PI * 0.25 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.25 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.25 );
}
return;
case 56: // numeric keypad 8
v->set_goal_view_offset( 0.00 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
- v->set_view_offset( 0.00 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
+ v->set_view_offset( 0.00 );
}
return;
case 57: // numeric keypad 9
v->set_goal_view_offset( FG_PI * 1.75 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.75 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.75 );
}
return;
case 65: // A key
- speed = current_options.get_speed_up();
+ speed = globals->get_options()->get_speed_up();
speed--;
if ( speed < 1 ) {
speed = 1;
}
- current_options.set_speed_up( speed );
+ globals->get_options()->set_speed_up( speed );
return;
case 72: // H key
- // status = current_options.get_hud_status();
- // current_options.set_hud_status(!status);
+ // status = globals->get_options()->get_hud_status();
+ // globals->get_options()->set_hud_status(!status);
HUD_brightkey( true );
return;
case 73: // I key
fgUpdateSkyAndLightingParams();
return;
case 80: // P key
- current_options.toggle_panel();
+ globals->get_options()->toggle_panel();
break;
case 84: // T key
globals->inc_warp_delta( -30 );
#endif
return;
case 88: // X key
- fov = current_options.get_fov();
+ fov = globals->get_options()->get_fov();
fov *= 1.05;
if ( fov > FG_FOV_MAX ) {
fov = FG_FOV_MAX;
}
- current_options.set_fov(fov);
+ globals->get_options()->set_fov(fov);
v->force_update_fov_math();
return;
case 90: // Z key
"Set flaps to " << controls.get_flaps() );
return;
case 97: // a key
- speed = current_options.get_speed_up();
+ speed = globals->get_options()->get_speed_up();
speed++;
- current_options.set_speed_up( speed );
+ globals->get_options()->set_speed_up( speed );
return;
case 98: // b key
int b_ret;
{
FGBucket p( f->get_Longitude() * RAD_TO_DEG,
f->get_Latitude() * RAD_TO_DEG );
- FGPath tile_path( current_options.get_fg_root() );
+ FGPath tile_path( globals->get_options()->get_fg_root() );
tile_path.append( "Scenery" );
tile_path.append( p.gen_base_path() );
tile_path.append( p.gen_index_str() );
fgUpdateSkyAndLightingParams();
return;
case 118: // v key
-// current_options.cycle_view_mode();
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- current_options.set_view_mode(fgOPTIONS::FG_VIEW_PILOT);
- v->set_goal_view_offset( 0.0 );
- v->set_view_offset( 0.0 );
- } else if (current_options.get_view_mode() ==
- fgOPTIONS::FG_VIEW_PILOT) {
- current_options.set_view_mode(fgOPTIONS::FG_VIEW_FOLLOW);
- v->set_goal_view_offset( FG_PI * 1.75 );
- v->set_view_offset( FG_PI * 1.75 );
- globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+// globals->get_options()->cycle_view_mode();
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_options()->set_view_mode(FGOptions::FG_VIEW_PILOT);
+ v->set_goal_view_offset( 0.0 );
+ v->set_view_offset( 0.0 );
+ } else if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_PILOT )
+ {
+ globals->get_options()->set_view_mode( FGOptions::FG_VIEW_FOLLOW );
+ v->set_goal_view_offset( FG_PI * 1.75 );
+ v->set_view_offset( FG_PI * 1.75 );
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
}
fgReshape( globals->get_current_view()->get_winWidth(),
globals->get_current_view()->get_winHeight() );
return;
case 120: // x key
- fov = current_options.get_fov();
+ fov = globals->get_options()->get_fov();
fov /= 1.05;
if ( fov < FG_FOV_MIN ) {
fov = FG_FOV_MIN;
}
- current_options.set_fov(fov);
+ globals->get_options()->set_fov(fov);
v->force_update_fov_math();
return;
case 122: // z key
return;
}
case GLUT_KEY_F4: {
- FGPath props_path(current_options.get_fg_root());
+ FGPath props_path(globals->get_options()->get_fg_root());
props_path.append("preferences.xml");
FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
if (!readPropertyList(props_path.str(), ¤t_properties)) {
}
case GLUT_KEY_END: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.75 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW)
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.75 );
}
return;
case GLUT_KEY_DOWN: // numeric keypad 2
v->set_goal_view_offset( FG_PI );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
- v->set_view_offset( FG_PI );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
+ v->set_view_offset( FG_PI );
}
return;
case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
v->set_goal_view_offset( FG_PI * 1.25 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.25 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW)
+ {
+ globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.25 );
}
return;
case GLUT_KEY_LEFT: // numeric keypad 4
v->set_goal_view_offset( FG_PI * 0.50 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.50 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.50 );
}
return;
case GLUT_KEY_RIGHT: // numeric keypad 6
v->set_goal_view_offset( FG_PI * 1.50 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.50 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.50 );
}
return;
case GLUT_KEY_HOME: // numeric keypad 7
v->set_goal_view_offset( FG_PI * 0.25 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
- v->set_view_offset( FG_PI * 0.25 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
+ v->set_view_offset( FG_PI * 0.25 );
}
return;
case GLUT_KEY_UP: // numeric keypad 8
v->set_goal_view_offset( 0.00 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
- v->set_view_offset( 0.00 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
+ v->set_view_offset( 0.00 );
}
return;
case GLUT_KEY_PAGE_UP: // numeric keypad 9
v->set_goal_view_offset( FG_PI * 1.75 );
- if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
- v->set_view_offset( FG_PI * 1.75 );
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
+ {
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+ v->set_view_offset( FG_PI * 1.75 );
}
return;
}
}
return;
case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
- current_options.cycle_fog();
+ globals->get_options()->cycle_fog();
- if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) {
+ if ( globals->get_options()->get_fog() ==
+ FGOptions::FG_FOG_DISABLED )
+ {
FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
- } else if ( current_options.get_fog() ==
- fgOPTIONS::FG_FOG_FASTEST )
+ } else if ( globals->get_options()->get_fog() ==
+ FGOptions::FG_FOG_FASTEST )
{
FG_LOG( FG_INPUT, FG_INFO,
"Fog enabled, hint set to fastest" );
- } else if ( current_options.get_fog() ==
- fgOPTIONS::FG_FOG_NICEST )
+ } else if ( globals->get_options()->get_fog() ==
+ FGOptions::FG_FOG_NICEST )
{
FG_LOG( FG_INPUT, FG_INFO,
"Fog enabled, hint set to nicest" );
return;
case GLUT_KEY_F9: // F9 toggles textures on and off...
FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
- if ( current_options.get_textures() ) {
- current_options.set_textures( false );
+ if ( globals->get_options()->get_textures() ) {
+ globals->get_options()->set_textures( false );
material_lib.set_step( 1 );
} else {
- current_options.set_textures( true );
+ globals->get_options()->set_textures( true );
material_lib.set_step( 0 );
}
return;
#ifndef GLUT_WRONG_VERSION
// Go full screen if requested ...
- if ( current_options.get_fullscreen() ) {
+ if ( globals->get_options()->get_fullscreen() ) {
glutFullScreen();
}
#endif
// glFogi (GL_FOG_MODE, GL_LINEAR);
glFogi (GL_FOG_MODE, GL_EXP2);
- if ( (current_options.get_fog() == 1) ||
- (current_options.get_shading() == 0) ) {
+ if ( (globals->get_options()->get_fog() == 1) ||
+ (globals->get_options()->get_shading() == 0) ) {
// if fastest fog requested, or if flat shading force fastest
glHint ( GL_FOG_HINT, GL_FASTEST );
- } else if ( current_options.get_fog() == 2 ) {
+ } else if ( globals->get_options()->get_fog() == 2 ) {
glHint ( GL_FOG_HINT, GL_NICEST );
}
- if ( current_options.get_wireframe() ) {
+ if ( globals->get_options()->get_wireframe() ) {
// draw wire frame
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
if ( idle_state != 1000 ) {
// still initializing, draw the splash screen
- if ( current_options.get_splash_screen() == 1 ) {
+ if ( globals->get_options()->get_splash_screen() == 1 ) {
fgSplashUpdate(0.0);
}
} else {
// update view volume parameters
// cout << "before pilot_view update" << endl;
- if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
- float * offset = globals->get_pilot_view()->get_pilot_offset();
- globals->get_current_view()->set_pilot_offset( offset[0],
- offset[1],
- offset[2] );
+ if ( globals->get_options()->get_view_mode()
+ == FGOptions::FG_VIEW_FOLLOW )
+ {
+ float * offset = globals->get_pilot_view()->get_pilot_offset();
+ globals->get_current_view()->set_pilot_offset( offset[0],
+ offset[1],
+ offset[2] );
} else {
- globals->get_current_view()->set_pilot_offset(0.0, 0.0, 0.0);
+ globals->get_current_view()->set_pilot_offset(0.0, 0.0, 0.0);
}
globals->get_pilot_view()->UpdateViewParams(*cur_fdm_state);
// cout << "after pilot_view update" << endl;
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
clear_mask = GL_DEPTH_BUFFER_BIT;
- if ( current_options.get_wireframe() ) {
+ if ( globals->get_options()->get_wireframe() ) {
clear_mask |= GL_COLOR_BUFFER_BIT;
}
- if ( current_options.get_skyblend() ) {
- if ( current_options.get_textures() ) {
+ if ( globals->get_options()->get_skyblend() ) {
+ if ( globals->get_options()->get_textures() ) {
// glClearColor(black[0], black[1], black[2], black[3]);
glClearColor(l->adj_fog_color[0], l->adj_fog_color[1],
l->adj_fog_color[2], l->adj_fog_color[3]);
thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
( global_multi_loop *
- current_options.get_speed_up() ) /
- (double)current_options.get_model_hz() );
+ globals->get_options()->get_speed_up() ) /
+ (double)globals->get_options()->get_model_hz() );
double actual_visibility = thesky->get_visibility();
// cout << "actual visibility = " << actual_visibility << endl;
}
// update the sky dome
- if ( current_options.get_skyblend() ) {
+ if ( globals->get_options()->get_skyblend() ) {
sgVec3 view_pos;
sgSetVec3( view_pos,
globals->get_current_view()->get_view_pos().x(),
}
glEnable( GL_DEPTH_TEST );
- if ( current_options.get_fog() > 0 ) {
+ if ( globals->get_options()->get_fog() > 0 ) {
glEnable( GL_FOG );
glFogi( GL_FOG_MODE, GL_EXP2 );
glFogfv( GL_FOG_COLOR, l->adj_fog_color );
// glMatrixMode( GL_PROJECTION );
// glLoadIdentity();
- float fov = current_options.get_fov();
+ float fov = globals->get_options()->get_fov();
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
ssgSetNearFar( 0.5f, 120000.0f );
}
- if ( current_options.get_view_mode() ==
- fgOPTIONS::FG_VIEW_PILOT )
+ if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_PILOT )
{
// disable TuX
penguin_sel->select(0);
- } else if ( current_options.get_view_mode() ==
- fgOPTIONS::FG_VIEW_FOLLOW )
+ } else if ( globals->get_options()->get_view_mode() ==
+ FGOptions::FG_VIEW_FOLLOW )
{
// select view matrix from front of view matrix queue
// FGMat4Wrapper tmp = current_view.follow.front();
// $$$ end - added VS Renganthan 17 Oct 2K
# ifdef FG_NETWORK_OLK
- if ( current_options.get_network_olk() ) {
+ if ( globals->get_options()->get_network_olk() ) {
sgCoord fgdpos;
other = head->next; /* put listpointer to start */
while ( other != tail) { /* display all except myself */
current_autopilot->run();
// printf("updating flight model x %d\n", multi_loop);
- /* fgFDMUpdate( current_options.get_flight_model(),
+ /* fgFDMUpdate( globals->get_options()->get_flight_model(),
fdm_state,
- multi_loop * current_options.get_speed_up(),
+ multi_loop * globals->get_options()->get_speed_up(),
remainder ); */
- cur_fdm_state->update( multi_loop * current_options.get_speed_up() );
- FGSteam::update( multi_loop * current_options.get_speed_up() );
+ cur_fdm_state->update( multi_loop *
+ globals->get_options()->get_speed_up() );
+ FGSteam::update( multi_loop * globals->get_options()->get_speed_up() );
} else {
- // fgFDMUpdate( current_options.get_flight_model(),
+ // fgFDMUpdate( globals->get_options()->get_flight_model(),
// fdm_state, 0, remainder );
cur_fdm_state->update( 0 );
FGSteam::update( 0 );
fdm_list.pop_front();
}
- if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT ) {
+ if ( globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT ) {
cur_view_fdm = *cur_fdm_state;
// do nothing
- } else if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
+ } else if ( globals->get_options()->get_view_mode()
+ == FGOptions::FG_VIEW_FOLLOW )
+ {
cur_view_fdm = fdm_list.front();
}
globals->get_current_view()->set_view_offset( globals->get_current_view()->get_goal_view_offset() );
break;
} else {
- // move current_view.view_offset towards current_view.goal_view_offset
+ // move current_view.view_offset towards
+ // current_view.goal_view_offset
if ( globals->get_current_view()->get_goal_view_offset() >
globals->get_current_view()->get_view_offset() )
{
}
} else {
if ( globals->get_current_view()->get_view_offset() -
- globals->get_current_view()->get_goal_view_offset() < FG_PI )
+ globals->get_current_view()->get_goal_view_offset() <
+ FG_PI )
{
globals->get_current_view()->inc_view_offset( -0.01 );
} else {
}
double tmp = -(l->sun_rotation + FG_PI)
- - (cur_fdm_state->get_Psi() - globals->get_current_view()->get_view_offset() );
+ - (cur_fdm_state->get_Psi() -
+ globals->get_current_view()->get_view_offset() );
while ( tmp < 0.0 ) {
tmp += FG_2PI;
}
// initialize timer
// #ifdef HAVE_SETITIMER
- // fgTimerInit( 1.0 / current_options.get_model_hz(),
+ // fgTimerInit( 1.0 / globals->get_options()->get_model_hz(),
// fgUpdateTimeDepCalcs );
// #endif HAVE_SETITIMER
}
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
#ifdef FG_NETWORK_OLK
- if ( current_options.get_network_olk() ) {
+ if ( globals->get_options()->get_network_olk() ) {
if ( net_is_registered == 0 ) { // We first have to reg. to fgd
// printf("FGD: Netupdate\n");
fgd_send_com( "A", FGFS_host); // Send Mat4 data
#if defined( ENABLE_PLIB_JOYSTICK )
// Read joystick and update control settings
- if ( current_options.get_control_mode() == fgOPTIONS::FG_JOYSTICK ) {
+ if ( globals->get_options()->get_control_mode() == FGOptions::FG_JOYSTICK )
+ {
fgJoystickRead();
}
#elif defined( ENABLE_GLUT_JOYSTICK )
cur_fdm_state->get_Altitude() * FEET_TO_METER,
scenery.cur_elev + alt_adjust_m - 3.0,
scenery.cur_elev + alt_adjust_m );
- fgFDMForceAltitude( current_options.get_flight_model(),
+ fgFDMForceAltitude( globals->get_options()->get_flight_model(),
scenery.cur_elev + alt_adjust_m );
FG_LOG( FG_ALL, FG_DEBUG,
"<*> resetting altitude to "
- << cur_fdm_state->get_Altitude() * FEET_TO_METER << " meters" );
+ << cur_fdm_state->get_Altitude() * FEET_TO_METER
+ << " meters" );
}
- fgFDMSetGroundElevation( current_options.get_flight_model(),
+ fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
scenery.cur_elev ); // meters
}
elapsed += remainder;
global_multi_loop = (int)(((double)elapsed * 0.000001) *
- current_options.get_model_hz());
+ globals->get_options()->get_model_hz());
remainder = elapsed - ( (global_multi_loop*1000000) /
- current_options.get_model_hz() );
+ globals->get_options()->get_model_hz() );
FG_LOG( FG_ALL, FG_DEBUG,
"Model iterations needed = " << global_multi_loop
<< ", new remainder = " << remainder );
// Run audio scheduler
#ifdef ENABLE_AUDIO_SUPPORT
- if ( current_options.get_sound() && !audio_sched->not_working() ) {
+ if ( globals->get_options()->get_sound() && !audio_sched->not_working() ) {
- if ( current_options.get_aircraft() == "c172" ) {
+ if ( globals->get_options()->get_aircraft() == "c172" ) {
// pitch corresponds to rpm
// volume corresponds to manifold pressure
if ( idle_state == 0 ) {
// Initialize the splash screen right away
- if ( current_options.get_splash_screen() ) {
+ if ( globals->get_options()->get_splash_screen() ) {
fgSplashInit();
}
} else if ( idle_state == 1 ) {
// Start the intro music
#if !defined(WIN32)
- if ( current_options.get_intro_music() ) {
+ if ( globals->get_options()->get_intro_music() ) {
string lockfile = "/tmp/mpg123.running";
- FGPath mp3file( current_options.get_fg_root() );
+ FGPath mp3file( globals->get_options()->get_fg_root() );
mp3file.append( "Sounds/intro.mp3" );
string command = "(touch " + lockfile + "; mpg123 "
#ifdef ENABLE_AUDIO_SUPPORT
#if !defined(WIN32)
- if ( current_options.get_intro_music() ) {
+ if ( globals->get_options()->get_intro_music() ) {
// Let's wait for mpg123 to finish
string lockfile = "/tmp/mpg123.running";
struct stat stat_buf;
}
#endif // WIN32
- if ( current_options.get_sound() ) {
+ if ( globals->get_options()->get_sound() ) {
audio_sched = new slScheduler ( 8000 );
audio_mixer = new smMixer;
audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
audio_sched -> setSafetyMargin ( 1.0 ) ;
- FGPath slfile( current_options.get_fg_root() );
+ FGPath slfile( globals->get_options()->get_fg_root() );
slfile.append( "Sounds/wasp.wav" );
s1 = new slSample ( (char *)slfile.c_str() );
fgMainLoop();
} else {
- if ( current_options.get_splash_screen() == 1 ) {
+ if ( globals->get_options()->get_splash_screen() == 1 ) {
fgSplashUpdate(0.0);
}
}
// Handle new window size or exposure
void fgReshape( int width, int height ) {
if ( ! fgPanelVisible() || idle_state != 1000 ) {
- globals->get_current_view()->set_win_ratio( (float)height / (float)width );
+ globals->get_current_view()->set_win_ratio( (float)height /
+ (float)width );
glViewport(0, 0 , (GLint)(width), (GLint)(height) );
} else {
int view_h =
int((current_panel->getViewHeight() - current_panel->getYOffset())
* (height / 768.0)) + 1;
- globals->get_current_view()->set_win_ratio( (float)view_h / (float)width );
+ globals->get_current_view()->set_win_ratio( (float)view_h /
+ (float)width );
glViewport(0, (GLint)(height - view_h),
(GLint)(width), (GLint)(view_h) );
}
globals->get_current_view()->force_update_fov_math();
// set these fov to be the same as in fgRenderFrame()
- // float x_fov = current_options.get_fov();
+ // float x_fov = globals->get_options()->get_fov();
// float y_fov = x_fov * 1.0 / current_view.get_win_ratio();
// ssgSetFOV( x_fov, y_fov );
// glViewport ( 0, 0, width, height );
- float fov = current_options.get_fov();
+ float fov = globals->get_options()->get_fov();
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
FG_LOG( FG_GENERAL, FG_INFO, "Opening a window: " <<
- current_options.get_xsize() << "x" << current_options.get_ysize() );
+ globals->get_options()->get_xsize() << "x"
+ << globals->get_options()->get_ysize() );
// Define initial window size
- glutInitWindowSize( current_options.get_xsize(),
- current_options.get_ysize() );
+ glutInitWindowSize( globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
// Initialize windows
- if ( current_options.get_game_mode() == 0 ) {
+ if ( globals->get_options()->get_game_mode() == 0 ) {
// Open the regular window
glutCreateWindow("FlightGear");
#ifndef GLUT_WRONG_VERSION
// Open the cool new 'game mode' window
char game_mode_str[256];
sprintf( game_mode_str, "width=%d height=%d bpp=%d",
- current_options.get_xsize(),
- current_options.get_ysize(),
- current_options.get_bpp());
+ globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize(),
+ globals->get_options()->get_bpp());
FG_LOG( FG_GENERAL, FG_INFO,
"game mode params = " << game_mode_str );
// probably a voodoo-2
if ( renderer.find( "TMU/SLI" ) != string::npos ) {
// probably two SLI'd Voodoo-2's
- current_options.set_xsize( 1024 );
- current_options.set_ysize( 768 );
+ globals->get_options()->set_xsize( 1024 );
+ globals->get_options()->set_ysize( 768 );
FG_LOG( FG_GENERAL, FG_INFO,
"It looks like you have two sli'd voodoo-2's." << endl
<< "upgrading your win resolution to 1024 x 768" );
glutReshapeWindow(1024, 768);
} else {
// probably a single non-SLI'd Voodoo-2
- current_options.set_xsize( 800 );
- current_options.set_ysize( 600 );
+ globals->get_options()->set_xsize( 800 );
+ globals->get_options()->set_ysize( 600 );
FG_LOG( FG_GENERAL, FG_INFO,
"It looks like you have a voodoo-2." << endl
<< "upgrading your win resolution to 800 x 600" );
// seed the random number generater
fg_srandom();
+ // needs to happen before we parse command line options
+ globals = new FGGlobals;
+
+ SGRoute *route = new SGRoute;
+ globals->set_route( route );
+
+ FGOptions *options = new FGOptions;
+ globals->set_options( options );
+
+ FGViewer *pv = new FGViewer;
+ globals->set_pilot_view( pv );
+ FGViewer *cv = new FGViewer;
+ globals->set_current_view( cv );
+
// Scan the config file(s) and command line options to see if
// fg_root was specified (ignore all other options for now)
fgInitFGRoot(argc, argv);
- // cout << "1. airport_id = " << current_options.get_airport_id() << endl;
+ // cout << "1. airport_id = " << globals->get_options()->get_airport_id() << endl;
// Read global preferences from $FG_ROOT/preferences.xml
- FGPath props_path(current_options.get_fg_root());
+ FGPath props_path(globals->get_options()->get_fg_root());
props_path.append("preferences.xml");
FG_LOG(FG_INPUT, FG_INFO, "Reading global preferences");
if (!readPropertyList(props_path.str(), ¤t_properties)) {
FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
}
- // cout << "2. airport_id = " << current_options.get_airport_id() << endl;
+ // cout << "2. airport_id = " << globals->get_options()->get_airport_id() << endl;
// Initialize the Aircraft directory to "" (UIUC)
aircraft_dir = "";
- // needs to happen before we parse command line options
- globals = new FGGlobals;
- SGRoute *route = new SGRoute;
- globals->set_route( route );
- FGViewer *pv = new FGViewer;
- globals->set_pilot_view( pv );
- FGViewer *cv = new FGViewer;
- globals->set_current_view( cv );
-
// Load the configuration parameters
if ( !fgInitConfig(argc, argv) ) {
FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );
guiInit();
// set current_options lon/lat if an airport id is specified
- // cout << "3. airport_id = " << current_options.get_airport_id() << endl;
- if ( current_options.get_airport_id().length() ) {
- // fgSetPosFromAirportID( current_options.get_airport_id() );
- fgSetPosFromAirportIDandHdg( current_options.get_airport_id(),
- current_options.get_heading() );
+ // cout << "3. airport_id = " << globals->get_options()->get_airport_id() << endl;
+ if ( globals->get_options()->get_airport_id().length() ) {
+ // fgSetPosFromAirportID( globals->get_options()->get_airport_id() );
+ fgSetPosFromAirportIDandHdg( globals->get_options()->get_airport_id(),
+ globals->get_options()->get_heading() );
}
// Initialize time
- FGPath zone( current_options.get_fg_root() );
+ FGPath zone( globals->get_options()->get_fg_root() );
zone.append( "Timezone" );
- SGTime *t = new SGTime( current_options.get_lon() * DEG_TO_RAD,
- current_options.get_lat() * DEG_TO_RAD,
+ SGTime *t = new SGTime( globals->get_options()->get_lon() * DEG_TO_RAD,
+ globals->get_options()->get_lat() * DEG_TO_RAD,
zone.str() );
// Handle potential user specified time offsets
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
// Okay, we now have six possible scenarios
- switch ( current_options.get_time_offset_type() ) {
- case fgOPTIONS::FG_TIME_SYS_OFFSET:
- globals->set_warp( current_options.get_time_offset() );
+ switch ( globals->get_options()->get_time_offset_type() ) {
+ case FGOptions::FG_TIME_SYS_OFFSET:
+ globals->set_warp( globals->get_options()->get_time_offset() );
break;
- case fgOPTIONS::FG_TIME_GMT_OFFSET:
- globals->set_warp( current_options.get_time_offset() -
+ case FGOptions::FG_TIME_GMT_OFFSET:
+ globals->set_warp( globals->get_options()->get_time_offset() -
(currGMT - systemLocalTime) );
break;
- case fgOPTIONS::FG_TIME_LAT_OFFSET:
- globals->set_warp( current_options.get_time_offset() -
+ case FGOptions::FG_TIME_LAT_OFFSET:
+ globals->set_warp( globals->get_options()->get_time_offset() -
(aircraftLocalTime - systemLocalTime) );
break;
- case fgOPTIONS::FG_TIME_SYS_ABSOLUTE:
- globals->set_warp( current_options.get_time_offset() - cur_time );
+ case FGOptions::FG_TIME_SYS_ABSOLUTE:
+ globals->set_warp( globals->get_options()->get_time_offset() -
+ cur_time );
//printf("warp = %d\n", warp);
break;
- case fgOPTIONS::FG_TIME_GMT_ABSOLUTE:
- globals->set_warp( current_options.get_time_offset() - currGMT );
+ case FGOptions::FG_TIME_GMT_ABSOLUTE:
+ globals->set_warp( globals->get_options()->get_time_offset() -
+ currGMT );
break;
- case fgOPTIONS::FG_TIME_LAT_ABSOLUTE:
- globals->set_warp( current_options.get_time_offset() -
+ case FGOptions::FG_TIME_LAT_ABSOLUTE:
+ globals->set_warp( globals->get_options()->get_time_offset() -
(aircraftLocalTime - systemLocalTime) -
cur_time );
break;
// distribution) specifically from the ssg tux example
//
- FGPath modelpath( current_options.get_fg_root() );
+ FGPath modelpath( globals->get_options()->get_fg_root() );
// modelpath.append( "Models" );
// modelpath.append( "Geometry" );
- FGPath texturepath( current_options.get_fg_root() );
+ FGPath texturepath( globals->get_options()->get_fg_root() );
texturepath.append( "Models" );
texturepath.append( "Textures" );
scene->setName( "Scene" );
// Initialize the sky
- FGPath ephem_data_path( current_options.get_fg_root() );
+ FGPath ephem_data_path( globals->get_options()->get_fg_root() );
ephem_data_path.append( "Astro" );
SGEphemeris *ephem = new SGEphemeris( ephem_data_path.c_str() );
ephem->update( globals->get_time_params()->getMjd(),
0.0 );
globals->set_ephem( ephem );
- FGPath sky_tex_path( current_options.get_fg_root() );
+ FGPath sky_tex_path( globals->get_options()->get_fg_root() );
sky_tex_path.append( "Textures" );
sky_tex_path.append( "Sky" );
thesky = new SGSky;
globals->get_ephem()->getNumStars(),
globals->get_ephem()->getStars(), 60000.0 );
- if ( current_options.get_clouds() == true ) {
+ if ( globals->get_options()->get_clouds() == true ) {
thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
SG_CLOUD_MOSTLY_SUNNY );
thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
#ifdef FG_NETWORK_OLK
// Do the network intialization
- if ( current_options.get_network_olk() ) {
+ if ( globals->get_options()->get_network_olk() ) {
printf("Multipilot mode %s\n", fg_net_init( scene ) );
}
#endif
int i = 1;
string obj_filename;
- FGPath tile_path( current_options.get_fg_root());
+ FGPath tile_path( globals->get_options()->get_fg_root());
tile_path.append( "Scenery" );
tile_path.append( "Objects.txt" );
fg_gzifstream in( tile_path.str() );
FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << tile_path.str() );
}
- FGPath modelpath( current_options.get_fg_root() );
+ FGPath modelpath( globals->get_options()->get_fg_root() );
modelpath.append( "Models" );
modelpath.append( "Geometry" );
- FGPath texturepath( current_options.get_fg_root() );
+ FGPath texturepath( globals->get_options()->get_fg_root() );
texturepath.append( "Models" );
texturepath.append( "Textures" );
// Defined the shared options class here
-fgOPTIONS current_options;
+// FGOptions current_options;
// Constructor
-fgOPTIONS::fgOPTIONS() :
+FGOptions::FGOptions() :
// starting longitude in degrees (west = -)
// starting latitude in degrees (south = -)
// Rendering options
fog(FG_FOG_NICEST), // nicest
- clouds(false),
+ clouds(true),
clouds_asl(5000*FEET_TO_METER),
fov(55.0),
fullscreen(0),
wireframe(0),
xsize(800),
ysize(600),
+ xmin(0),
+ ymin(0),
+ xmax(800),
+ ymax(600),
bpp(16),
view_mode(FG_VIEW_PILOT),
default_view_offset(0),
}
void
-fgOPTIONS::toggle_panel() {
+FGOptions::toggle_panel() {
bool freeze = globals->get_freeze();
}
double
-fgOPTIONS::parse_time(const string& time_in) {
+FGOptions::parse_time(const string& time_in) {
char *time_str, num[256];
double hours, minutes, seconds;
double result = 0.0;
}
-long int fgOPTIONS::parse_date( const string& date)
+long int FGOptions::parse_date( const string& date)
{
struct tm gmt;
char * date_str, num[256];
// parse degree in the form of [+/-]hhh:mm:ss
-void fgOPTIONS::parse_control( const string& mode ) {
+void FGOptions::parse_control( const string& mode ) {
if ( mode == "joystick" ) {
control_mode = FG_JOYSTICK;
} else if ( mode == "mouse" ) {
/// parse degree in the form of [+/-]hhh:mm:ss
double
-fgOPTIONS::parse_degree( const string& degree_str) {
+FGOptions::parse_degree( const string& degree_str) {
double result = parse_time( degree_str );
// printf("Degree = %.4f\n", result);
// parse time offset command line option
int
-fgOPTIONS::parse_time_offset( const string& time_str) {
+FGOptions::parse_time_offset( const string& time_str) {
int result;
// printf("time offset = %s\n", time_str);
// Parse --tile-diameter=n type option
int
-fgOPTIONS::parse_tile_radius( const string& arg ) {
+FGOptions::parse_tile_radius( const string& arg ) {
int radius = atoi( arg );
if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
// Parse --fdm=abcdefg type option
int
-fgOPTIONS::parse_fdm( const string& fm ) {
+FGOptions::parse_fdm( const string& fm ) {
// cout << "fdm = " << fm << endl;
if ( fm == "ada" ) {
// Parse --fov=x.xx type option
double
-fgOPTIONS::parse_fov( const string& arg ) {
+FGOptions::parse_fov( const string& arg ) {
double fov = atof(arg);
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
// filename = file system file name
bool
-fgOPTIONS::parse_channel( const string& type, const string& channel_str ) {
+FGOptions::parse_channel( const string& type, const string& channel_str ) {
// cout << "Channel string = " << channel_str << endl;
channel_options_list.push_back( type + "," + channel_str );
// Parse --wp=ID[,alt]
-bool fgOPTIONS::parse_wp( const string& arg ) {
+bool FGOptions::parse_wp( const string& arg ) {
string id, alt_str;
double alt = 0.0;
// Parse a single option
-int fgOPTIONS::parse_option( const string& arg ) {
+int FGOptions::parse_option( const string& arg ) {
// General Options
if ( (arg == "--help") || (arg == "-h") ) {
// help/usage request
FG_LOG( FG_GENERAL, FG_ALERT,
"Setting geometry to " << xsize << 'x' << ysize << '\n');
}
+
+ xmin = ymin = 0;
+ xmax = xsize;
+ ymax = ysize;
} else if ( arg.find( "--bpp=" ) != string::npos ) {
string bits_per_pix = arg.substr( 6 );
if ( bits_per_pix == "16" ) {
// Scan the command line options for an fg_root definition and set
// just that.
-int fgOPTIONS::scan_command_line_for_root( int argc, char **argv ) {
+int FGOptions::scan_command_line_for_root( int argc, char **argv ) {
int i = 1;
int result;
// Scan the config file for an fg_root definition and set just that.
-int fgOPTIONS::scan_config_file_for_root( const string& path ) {
+int FGOptions::scan_config_file_for_root( const string& path ) {
fg_gzifstream in( path );
if ( !in.is_open() )
return(FG_OPTIONS_ERROR);
// Parse the command line options
-int fgOPTIONS::parse_command_line( int argc, char **argv ) {
+int FGOptions::parse_command_line( int argc, char **argv ) {
int i = 1;
int result;
// Parse config file options
-int fgOPTIONS::parse_config_file( const string& path ) {
+int FGOptions::parse_config_file( const string& path ) {
fg_gzifstream in( path );
if ( !in.is_open() )
return(FG_OPTIONS_ERROR);
// Print usage message
-void fgOPTIONS::usage ( void ) {
+void FGOptions::usage ( void ) {
cout << "Usage: fg [ options ... ]" << endl;
cout << endl;
// Destructor
-fgOPTIONS::~fgOPTIONS( void ) {
+FGOptions::~FGOptions( void ) {
}
#define NEW_DEFAULT_MODEL_HZ 120
-class fgOPTIONS {
+class FGOptions {
public:
bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled
int xsize, ysize; // window size derived from geometry string
+ int xmin, ymin; // upper left corner of window to draw in
+ int xmax, ymax; // lower right corner of window to draw in
int bpp; // bits per pixel
fgViewMode view_mode; // view mode
double default_view_offset; // default forward view offset (for use by
public:
- fgOPTIONS();
- ~fgOPTIONS();
+ FGOptions();
+ ~FGOptions();
// Parse a single option
int parse_option( const string& arg );
inline bool get_wireframe() const { return wireframe; }
inline int get_xsize() const { return xsize; }
inline int get_ysize() const { return ysize; }
+ inline int get_xmin() const { return xmin; }
+ inline int get_ymin() const { return ymin; }
+ inline int get_xmax() const { return xmax; }
+ inline int get_ymax() const { return ymax; }
inline int get_bpp() const { return bpp; }
inline fgViewMode get_view_mode() const { return view_mode; }
inline double get_default_view_offset() const {
};
-extern fgOPTIONS current_options;
+// extern FGOptions current_options;
#endif /* _OPTIONS_HXX */
#include <simgear/math/fg_random.h>
#include <simgear/misc/fgpath.hxx>
-#include <Main/options.hxx>
#include <Objects/texload.h>
#include "globals.hxx"
char num_str[256];
sprintf(num_str, "%d", num);
- FGPath tpath( current_options.get_fg_root() );
+ FGPath tpath( globals->get_options()->get_fg_root() );
tpath.append( "Textures/Splash" );
tpath.concat( num_str );
tpath.concat( ".rgb" );
void FGViewer::Init( void ) {
FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
- view_offset = goal_view_offset = current_options.get_default_view_offset();
+ view_offset = goal_view_offset = globals->get_options()->get_default_view_offset();
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
- winWidth = current_options.get_xsize();
- winHeight = current_options.get_ysize();
+ winWidth = globals->get_options()->get_xsize();
+ winHeight = globals->get_options()->get_ysize();
set_win_ratio( winHeight / winWidth );
sgMat4 VIEWo, TMP;
if ( update_fov ) {
- ssgSetFOV( current_options.get_fov(),
- current_options.get_fov() * win_ratio );
+ ssgSetFOV( globals->get_options()->get_fov(),
+ globals->get_options()->get_fov() * win_ratio );
update_fov = false;
}
void UpdateViewMath( const FGInterface& f );
// Update the field of view coefficients
- void UpdateFOV( const fgOPTIONS& o );
+ void UpdateFOV( const FGOptions *o );
// Transform a vector from world coordinates to the local plane
void CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src);
#endif
*/
-#include <Main/options.hxx>
#include <plib/sg.h>
#include <plib/ssg.h>
+#include <Main/globals.hxx>
+
int net_blast_toggle, net_hud_display, net_is_registered;
char *net_callsign, *FGFS_host;
sgMat4 sgFGD_VIEW;
// We enable display of netinfos only if user wishes it via cmd-line param
net_hud_display = (net_hud_display == 0) ? 0 : 1;
// Get pilot's name from options, can be modified at runtime via menu
- net_callsign = (char *) current_options.get_net_id().c_str();
+ net_callsign = (char *) globals->get_options()->get_net_id().c_str();
// Disable Blast Mode -1 = Disable, 0 = Enable
net_blast_toggle = -1;
// We start unregistered, we reg. later via menu to fgd
#include <simgear/misc/fgstream.hxx>
#include <Include/general.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include <Scenery/tileentry.hxx>
#include "matlib.hxx"
in >> m;
// build the ssgSimpleState
- FGPath tex_path( current_options.get_fg_root() );
+ FGPath tex_path( globals->get_options()->get_fg_root() );
tex_path.append( "Textures.high" );
FGPath tmp_path = tex_path;
tmp_path.append( m.get_texture_name() );
if ( ! local_file_exists(tmp_path.str())
|| general.get_glMaxTexSize() < 512 ) {
- tex_path = FGPath( current_options.get_fg_root() );
+ tex_path = FGPath( globals->get_options()->get_fg_root() );
tex_path.append( "Textures" );
}
<< material_name << " (" << tex_path.c_str() << ")");
GLenum shade_model = GL_SMOOTH;
- if ( current_options.get_shading() == 1 ) {
+ if ( globals->get_options()->get_shading() == 1 ) {
shade_model = GL_SMOOTH;
} else {
shade_model = GL_FLAT;
}
m.build_ssg_state( tex_path.str(), shade_model,
- current_options.get_textures() );
+ globals->get_options()->get_textures() );
#if EXTRA_DEBUG
m.dump_info();
#endif
GLenum shade_model = GL_SMOOTH;
- if ( current_options.get_shading() == 1 ) {
+ if ( globals->get_options()->get_shading() == 1 ) {
shade_model = GL_SMOOTH;
} else {
shade_model = GL_FLAT;
}
- m.build_ssg_state( tex_path, shade_model, current_options.get_textures() );
+ m.build_ssg_state( tex_path, shade_model,
+ globals->get_options()->get_textures() );
material_lib.matlib[mat_name] = m;
#include <simgear/misc/stopwatch.hxx>
#include <simgear/misc/texcoord.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include <Scenery/tileentry.hxx>
#include "matlib.hxx"
leaf->setState( state );
tile->addKid( leaf );
- // if ( current_options.get_clouds() ) {
+ // if ( globals->get_options()->get_clouds() ) {
// fgGenCloudTile(path, t, tile);
// }
return fgGenTile( path, t );
}
- shading = current_options.get_shading();
+ shading = globals->get_options()->get_shading();
if ( is_base ) {
t->ncount = 0;
<< stopwatch.elapsedSeconds() << " seconds" );
// Generate a cloud layer above the tiles
- // if ( current_options.get_clouds() ) {
+ // if ( globals->get_options()->get_clouds() ) {
// fgGenCloudTile(path, t, tile);
// }
return tile;
#include <simgear/misc/fgpath.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Objects/obj.hxx>
#include <Scenery/scenery.hxx> // for scenery.center
//
// target_cache_size >= (current.options.tile_diameter + 1) ** 2
//
- int side = current_options.get_tile_diameter() + 2;
+ int side = globals->get_options()->get_tile_diameter() + 2;
int target_cache_size = (side*side);
FG_LOG( FG_TERRAIN, FG_DEBUG, " target cache size = "
<< target_cache_size );
tile_cache[index].tile_bucket = p;
FGPath tile_path;
- if ( current_options.get_fg_scenery() != "" ) {
- tile_path.set( current_options.get_fg_scenery() );
+ if ( globals->get_options()->get_fg_scenery() != "" ) {
+ tile_path.set( globals->get_options()->get_fg_scenery() );
} else {
- tile_path.set( current_options.get_fg_root() );
+ tile_path.set( globals->get_options()->get_fg_root() );
tile_path.append( "Scenery" );
}
tile_path.append( p.gen_base_path() );
// #include <Aircraft/aircraft.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Objects/obj.hxx>
#ifndef FG_OLD_WEATHER
state = Inited;
- tile_diameter = current_options.get_tile_diameter();
+ tile_diameter = globals->get_options()->get_tile_diameter();
FG_LOG( FG_TERRAIN, FG_INFO, "Tile Diameter = " << tile_diameter);
previous_bucket.make_bad();
#include <Aircraft/aircraft.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include "light.hxx"
#include "sunpos.hxx"
"Initializing Lighting interpolation tables." );
// build the path name to the ambient lookup table
- FGPath path( current_options.get_fg_root() );
+ FGPath path( globals->get_options()->get_fg_root() );
FGPath ambient = path;
ambient.append( "Lighting/ambient" );
FGPath diffuse = path;
#include <FDM/flight.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include "light.hxx"
#include "moonpos.hxx"
// periodic time updater wrapper
void fgUpdateLocalTime() {
- FGPath zone( current_options.get_fg_root() );
+ FGPath zone( globals->get_options()->get_fg_root() );
zone.append( "Timezone" );
globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),