Code clean ups relating to FGOptions ... and moved it into globals-> space.
This commit is contained in:
parent
ce574d59f5
commit
01c44cbb99
34 changed files with 560 additions and 470 deletions
|
@ -293,7 +293,7 @@ void NewAltitudeInit(void)
|
||||||
|
|
||||||
float alt = cur_fdm_state->get_Altitude();
|
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;
|
alt *= FEET_TO_METER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ void TgtAptDialog_OK (puObject *)
|
||||||
TgtAptId = tmp.substr( 0, pos );
|
TgtAptId = tmp.substr( 0, pos );
|
||||||
string alt_str = tmp.substr( pos + 1 );
|
string alt_str = tmp.substr( pos + 1 );
|
||||||
alt = atof( alt_str.c_str() );
|
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;
|
alt *= FEET_TO_METER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -636,16 +636,16 @@ void TgtAptDialog_OK (puObject *)
|
||||||
|
|
||||||
void TgtAptDialog_Reset(puObject *)
|
void TgtAptDialog_Reset(puObject *)
|
||||||
{
|
{
|
||||||
// strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
|
// strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
|
||||||
sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
|
sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
|
||||||
TgtAptDialogInput->setValue ( NewTgtAirportId );
|
TgtAptDialogInput->setValue ( NewTgtAirportId );
|
||||||
TgtAptDialogInput->setCursor( 0 ) ;
|
TgtAptDialogInput->setCursor( 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddWayPoint(puObject *cb)
|
void AddWayPoint(puObject *cb)
|
||||||
{
|
{
|
||||||
// strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
|
// strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
|
||||||
sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
|
sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
|
||||||
TgtAptDialogInput->setValue( NewTgtAirportId );
|
TgtAptDialogInput->setValue( NewTgtAirportId );
|
||||||
|
|
||||||
FG_PUSH_PUI_DIALOG( TgtAptDialog );
|
FG_PUSH_PUI_DIALOG( TgtAptDialog );
|
||||||
|
@ -676,8 +676,8 @@ void ClearRoute(puObject *cb)
|
||||||
void NewTgtAirportInit(void)
|
void NewTgtAirportInit(void)
|
||||||
{
|
{
|
||||||
FG_LOG( FG_AUTOPILOT, FG_INFO, " enter NewTgtAirportInit()" );
|
FG_LOG( FG_AUTOPILOT, FG_INFO, " enter NewTgtAirportInit()" );
|
||||||
// fgAPset_tgt_airport_id( current_options.get_airport_id() );
|
// fgAPset_tgt_airport_id( globals->get_options()->get_airport_id() );
|
||||||
sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
|
sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
|
||||||
FG_LOG( FG_AUTOPILOT, FG_INFO, " NewTgtAirportId " << NewTgtAirportId );
|
FG_LOG( FG_AUTOPILOT, FG_INFO, " NewTgtAirportId " << NewTgtAirportId );
|
||||||
// printf(" NewTgtAirportId %s\n", NewTgtAirportId);
|
// printf(" NewTgtAirportId %s\n", NewTgtAirportId);
|
||||||
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
|
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
|
||||||
|
|
|
@ -100,7 +100,7 @@ static inline double get_speed( void ) {
|
||||||
static inline double get_ground_speed() {
|
static inline double get_ground_speed() {
|
||||||
// starts in ft/s so we convert to kts
|
// starts in ft/s so we convert to kts
|
||||||
double ft_s = cur_fdm_state->get_V_ground_speed()
|
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;
|
double kts = ft_s * FEET_TO_METER * 3600 * METER_TO_NM;
|
||||||
|
|
||||||
return kts;
|
return kts;
|
||||||
|
@ -268,7 +268,7 @@ void FGAutopilot::reset() {
|
||||||
|
|
||||||
update_old_control_values();
|
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();
|
// TargetLatitude = FGBFI::getLatitude();
|
||||||
// TargetLongitude = FGBFI::getLongitude();
|
// TargetLongitude = FGBFI::getLongitude();
|
||||||
|
@ -744,7 +744,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
|
||||||
// lock at current altitude
|
// lock at current altitude
|
||||||
TargetAltitude = FGBFI::getAltitude() * FEET_TO_METER;
|
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 );
|
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
|
||||||
} else {
|
} else {
|
||||||
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
|
MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
|
||||||
|
@ -755,7 +755,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
|
||||||
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
|
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
|
||||||
TargetAGL = FGBFI::getAGL() * FEET_TO_METER;
|
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 );
|
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
|
||||||
} else {
|
} else {
|
||||||
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
|
MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
|
||||||
|
@ -821,7 +821,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
|
||||||
|
|
||||||
// cout << "new altitude = " << new_altitude << endl;
|
// 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;
|
target_alt = new_altitude * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,7 +834,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
|
||||||
|
|
||||||
// cout << "TargetAltitude = " << TargetAltitude << endl;
|
// 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;
|
target_alt *= METER_TO_FEET;
|
||||||
}
|
}
|
||||||
// ApAltitudeDialogInput->setValue((float)target_alt);
|
// ApAltitudeDialogInput->setValue((float)target_alt);
|
||||||
|
@ -848,7 +848,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
|
||||||
{
|
{
|
||||||
double target_alt, target_agl;
|
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_alt = TargetAltitude * METER_TO_FEET;
|
||||||
target_agl = TargetAGL * METER_TO_FEET;
|
target_agl = TargetAGL * METER_TO_FEET;
|
||||||
} else {
|
} else {
|
||||||
|
@ -872,7 +872,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
|
||||||
target_agl = ( int ) ( target_agl / inc ) * inc + inc;
|
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_alt *= FEET_TO_METER;
|
||||||
target_agl *= FEET_TO_METER;
|
target_agl *= FEET_TO_METER;
|
||||||
}
|
}
|
||||||
|
@ -880,9 +880,9 @@ void FGAutopilot::AltitudeAdjust( double inc )
|
||||||
TargetAltitude = target_alt;
|
TargetAltitude = target_alt;
|
||||||
TargetAGL = target_agl;
|
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;
|
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;
|
target_agl *= METER_TO_FEET;
|
||||||
|
|
||||||
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
|
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
|
||||||
|
|
|
@ -156,7 +156,7 @@ float get_speed( void )
|
||||||
{
|
{
|
||||||
// Make an explicit function call.
|
// Make an explicit function call.
|
||||||
float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
|
float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
|
||||||
* current_options.get_speed_up();
|
* globals->get_options()->get_speed_up();
|
||||||
return( speed );
|
return( speed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ float get_altitude( void )
|
||||||
// f->get_Latitude() * RAD_TO_ARCSEC);
|
// f->get_Latitude() * RAD_TO_ARCSEC);
|
||||||
float altitude;
|
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();
|
altitude = current_aircraft.fdm_state->get_Altitude();
|
||||||
} else {
|
} else {
|
||||||
altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
|
altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
|
||||||
|
@ -212,7 +212,7 @@ float get_agl( void )
|
||||||
{
|
{
|
||||||
float agl;
|
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()
|
agl = (current_aircraft.fdm_state->get_Altitude()
|
||||||
- scenery.cur_elev * METER_TO_FEET);
|
- scenery.cur_elev * METER_TO_FEET);
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,7 +236,7 @@ float get_frame_rate( void )
|
||||||
|
|
||||||
float get_fov( void )
|
float get_fov( void )
|
||||||
{
|
{
|
||||||
float fov = current_options.get_fov();
|
float fov = globals->get_options()->get_fov();
|
||||||
return (fov);
|
return (fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ float get_vfc_tris_culled ( void )
|
||||||
float get_climb_rate( void )
|
float get_climb_rate( void )
|
||||||
{
|
{
|
||||||
float climb_rate;
|
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;
|
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
|
||||||
} else {
|
} else {
|
||||||
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
|
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
|
||||||
|
@ -705,7 +705,7 @@ void fgCockpitUpdate( void ) {
|
||||||
float width = iwidth;
|
float width = iwidth;
|
||||||
float height = iheight;
|
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.
|
// This will check the global hud linked list pointer.
|
||||||
// If these is anything to draw it will.
|
// If these is anything to draw it will.
|
||||||
fgUpdateHUD();
|
fgUpdateHUD();
|
||||||
|
|
|
@ -225,8 +225,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
int gap = 10;
|
int gap = 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// int font_size = current_options.get_xsize() / 60;
|
// int font_size = globals->get_options()->get_xsize() / 60;
|
||||||
int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
|
int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
|
||||||
|
|
||||||
HUD_style = 1;
|
HUD_style = 1;
|
||||||
|
|
||||||
|
@ -1002,7 +1002,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
HUD_deque.insert( HUD_deque.begin(), HIptr);
|
HUD_deque.insert( HUD_deque.begin(), HIptr);
|
||||||
|
|
||||||
// case 20:
|
// case 20:
|
||||||
switch( current_options.get_tris_or_culled() ) {
|
switch( globals->get_options()->get_tris_or_culled() ) {
|
||||||
case 0:
|
case 0:
|
||||||
HIptr = (instr_item *) new instr_label( 10,
|
HIptr = (instr_item *) new instr_label( 10,
|
||||||
25,
|
25,
|
||||||
|
@ -1090,8 +1090,8 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
int compass_w = 200;
|
int compass_w = 200;
|
||||||
// int gap = 10;
|
// int gap = 10;
|
||||||
|
|
||||||
// int font_size = current_options.get_xsize() / 60;
|
// int font_size = globals->get_options()->get_xsize() / 60;
|
||||||
int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
|
int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
|
||||||
|
|
||||||
HUD_style = 2;
|
HUD_style = 2;
|
||||||
|
|
||||||
|
@ -1266,7 +1266,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
HUD_deque.push_front( p );
|
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");
|
strcpy(units, " ft");
|
||||||
} else {
|
} else {
|
||||||
strcpy(units, " m");
|
strcpy(units, " m");
|
||||||
|
@ -1364,14 +1364,14 @@ int global_day_night_switch = DAY;
|
||||||
|
|
||||||
void HUD_masterswitch( bool incr )
|
void HUD_masterswitch( bool incr )
|
||||||
{
|
{
|
||||||
if ( current_options.get_hud_status() ) {
|
if ( globals->get_options()->get_hud_status() ) {
|
||||||
if ( global_day_night_switch == DAY ) {
|
if ( global_day_night_switch == DAY ) {
|
||||||
global_day_night_switch = NIGHT;
|
global_day_night_switch = NIGHT;
|
||||||
} else {
|
} else {
|
||||||
current_options.set_hud_status( false );
|
globals->get_options()->set_hud_status( false );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
current_options.set_hud_status( true );
|
globals->get_options()->set_hud_status( true );
|
||||||
global_day_night_switch = DAY;
|
global_day_night_switch = DAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ void HUD_brightkey( bool incr_bright )
|
||||||
instr_item *pHUDInstr = HUD_deque[0];
|
instr_item *pHUDInstr = HUD_deque[0];
|
||||||
int brightness = pHUDInstr->get_brightness();
|
int brightness = pHUDInstr->get_brightness();
|
||||||
|
|
||||||
if( current_options.get_hud_status() ) {
|
if( globals->get_options()->get_hud_status() ) {
|
||||||
if( incr_bright ) {
|
if( incr_bright ) {
|
||||||
switch (brightness)
|
switch (brightness)
|
||||||
{
|
{
|
||||||
|
@ -1424,11 +1424,11 @@ void HUD_brightkey( bool incr_bright )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
current_options.set_hud_status(0);
|
globals->get_options()->set_hud_status(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
current_options.set_hud_status(true);
|
globals->get_options()->set_hud_status(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pHUDInstr->SetBrightness( brightness );
|
pHUDInstr->SetBrightness( brightness );
|
||||||
|
@ -1456,7 +1456,7 @@ static void alpha_adj( puObject *hs ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgHUDalphaAdjust( puObject * ) {
|
void fgHUDalphaAdjust( puObject * ) {
|
||||||
current_options.set_anti_alias_hud(1);
|
globals->get_options()->set_anti_alias_hud(1);
|
||||||
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
|
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1467,7 +1467,7 @@ static void goAwayHUDalphaAdjust (puObject *)
|
||||||
|
|
||||||
static void cancelHUDalphaAdjust (puObject *)
|
static void cancelHUDalphaAdjust (puObject *)
|
||||||
{
|
{
|
||||||
current_options.set_anti_alias_hud(0);
|
globals->get_options()->set_anti_alias_hud(0);
|
||||||
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1555,7 +1555,7 @@ void fgHUDReshape(void) {
|
||||||
if ( HUDtext )
|
if ( HUDtext )
|
||||||
delete HUDtext;
|
delete HUDtext;
|
||||||
|
|
||||||
HUD_TextSize = current_options.get_xsize() / 60;
|
HUD_TextSize = globals->get_options()->get_xsize() / 60;
|
||||||
HUD_TextSize = 10;
|
HUD_TextSize = 10;
|
||||||
HUDtext = new fntRenderer();
|
HUDtext = new fntRenderer();
|
||||||
HUDtext -> setFont ( guiFntHandle ) ;
|
HUDtext -> setFont ( guiFntHandle ) ;
|
||||||
|
@ -1565,7 +1565,7 @@ void fgHUDReshape(void) {
|
||||||
|
|
||||||
|
|
||||||
static void set_hud_color(float r, float g, float b) {
|
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) :
|
glColor4f(r,g,b,hud_trans_alpha) :
|
||||||
glColor3f(r,g,b);
|
glColor3f(r,g,b);
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1608,7 @@ void fgUpdateHUD( void ) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
if( current_options.get_anti_alias_hud() ) {
|
if( globals->get_options()->get_anti_alias_hud() ) {
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
// glEnable(GL_BLEND);
|
// glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -1744,7 +1744,7 @@ void fgUpdateHUD( void ) {
|
||||||
// HUD_StippleLineList.draw();
|
// HUD_StippleLineList.draw();
|
||||||
// glDisable(GL_LINE_STIPPLE);
|
// glDisable(GL_LINE_STIPPLE);
|
||||||
|
|
||||||
if( current_options.get_anti_alias_hud() ) {
|
if( globals->get_options()->get_anti_alias_hud() ) {
|
||||||
// glDisable(GL_BLEND);
|
// glDisable(GL_BLEND);
|
||||||
glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
glLineWidth(1.0);
|
glLineWidth(1.0);
|
||||||
|
|
|
@ -530,7 +530,7 @@ void HudLadder :: draw( void )
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef( centroid.x, centroid.y, 0);
|
glTranslatef( centroid.x, centroid.y, 0);
|
||||||
// Alex's panel patch
|
// 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);
|
glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
// Draw the target spot.
|
// Draw the target spot.
|
||||||
|
|
|
@ -44,8 +44,8 @@
|
||||||
bool
|
bool
|
||||||
fgPanelVisible ()
|
fgPanelVisible ()
|
||||||
{
|
{
|
||||||
return ((current_options.get_panel_status()) &&
|
return ((globals->get_options()->get_panel_status()) &&
|
||||||
(current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT) &&
|
(globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT) &&
|
||||||
(globals->get_current_view()->get_view_offset() == 0.0));
|
(globals->get_current_view()->get_view_offset() == 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ FGTextureManager::createTexture (const string &relativePath)
|
||||||
ssgTexture * texture = _textureMap[relativePath];
|
ssgTexture * texture = _textureMap[relativePath];
|
||||||
if (texture == 0) {
|
if (texture == 0) {
|
||||||
cerr << "Texture " << relativePath << " does not yet exist" << endl;
|
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);
|
tpath.append(relativePath);
|
||||||
texture = new ssgTexture((char *)tpath.c_str(), false, false);
|
texture = new ssgTexture((char *)tpath.c_str(), false, false);
|
||||||
_textureMap[relativePath] = texture;
|
_textureMap[relativePath] = texture;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
|
||||||
#include "panel.hxx"
|
#include "panel.hxx"
|
||||||
#include "steam.hxx"
|
#include "steam.hxx"
|
||||||
|
@ -748,7 +748,7 @@ fgReadPanel (istream &input)
|
||||||
SGPropertyList props2;
|
SGPropertyList props2;
|
||||||
SGPropertyNode node = instrument_group.getChild(i);
|
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"));
|
path.append(node.getStringValue("path"));
|
||||||
|
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
|
FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
|
||||||
|
@ -798,7 +798,7 @@ FGPanel *
|
||||||
fgReadPanel (const string &relative_path)
|
fgReadPanel (const string &relative_path)
|
||||||
{
|
{
|
||||||
FGPanel * panel = 0;
|
FGPanel * panel = 0;
|
||||||
FGPath path(current_options.get_fg_root());
|
FGPath path(globals->get_options()->get_fg_root());
|
||||||
path.append(relative_path);
|
path.append(relative_path);
|
||||||
ifstream input(path.c_str());
|
ifstream input(path.c_str());
|
||||||
if (!input.good()) {
|
if (!input.good()) {
|
||||||
|
|
|
@ -166,7 +166,8 @@ void FGSteam::set_lowpass ( double *outthe, double inthe, double tc )
|
||||||
|
|
||||||
void FGSteam::_CatchUp()
|
void FGSteam::_CatchUp()
|
||||||
{ if ( _UpdatesPending != 0 )
|
{ 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;
|
double AccN, AccE, AccU;
|
||||||
int i /*,j*/;
|
int i /*,j*/;
|
||||||
double d, the_ENGINE_rpm;
|
double d, the_ENGINE_rpm;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#ifndef _CONTROLS_HXX
|
#ifndef _CONTROLS_HXX
|
||||||
#define _CONTROLS_HXX
|
#define _CONTROLS_HXX
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
|
@ -94,8 +94,8 @@ public:
|
||||||
CLAMP( &aileron, -1.0, 1.0 );
|
CLAMP( &aileron, -1.0, 1.0 );
|
||||||
|
|
||||||
// check for autocoordination
|
// check for autocoordination
|
||||||
if ( current_options.get_auto_coordination() ==
|
if ( globals->get_options()->get_auto_coordination() ==
|
||||||
fgOPTIONS::FG_AUTO_COORD_ENABLED )
|
FGOptions::FG_AUTO_COORD_ENABLED )
|
||||||
{
|
{
|
||||||
set_rudder( aileron / 2.0 );
|
set_rudder( aileron / 2.0 );
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,8 @@ public:
|
||||||
CLAMP( &aileron, -1.0, 1.0 );
|
CLAMP( &aileron, -1.0, 1.0 );
|
||||||
|
|
||||||
// check for autocoordination
|
// check for autocoordination
|
||||||
if ( current_options.get_auto_coordination() ==
|
if ( globals->get_options()->get_auto_coordination() ==
|
||||||
fgOPTIONS::FG_AUTO_COORD_ENABLED )
|
FGOptions::FG_AUTO_COORD_ENABLED )
|
||||||
{
|
{
|
||||||
set_rudder( aileron / 2.0 );
|
set_rudder( aileron / 2.0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,9 @@ bool FGBalloonSim::init( double dt ) {
|
||||||
|
|
||||||
//set velocities
|
//set velocities
|
||||||
sgSetVec3( temp,
|
sgSetVec3( temp,
|
||||||
current_options.get_uBody(),
|
globals->get_options()->get_uBody(),
|
||||||
current_options.get_vBody(),
|
globals->get_options()->get_vBody(),
|
||||||
current_options.get_wBody() );
|
globals->get_options()->get_wBody() );
|
||||||
current_balloon.setVelocity( temp );
|
current_balloon.setVelocity( temp );
|
||||||
|
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing BalloonSim" );
|
FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing BalloonSim" );
|
||||||
|
|
|
@ -42,7 +42,8 @@ bool FGExternal::init( double dt ) {
|
||||||
bool FGExternal::update( int multiloop ) {
|
bool FGExternal::update( int multiloop ) {
|
||||||
// cout << "FGExternal::update()" << endl;
|
// 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;
|
return true;
|
||||||
|
|
|
@ -67,23 +67,25 @@ bool FGJSBsim::init( double dt ) {
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, "Starting and initializing JSBsim" );
|
FG_LOG( FG_FLIGHT, FG_INFO, "Starting and initializing JSBsim" );
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, " created FDMExec" );
|
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" );
|
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" );
|
engine_path.append( "Engine" );
|
||||||
|
|
||||||
//FDMExec.GetState()->Setdt( dt );
|
//FDMExec.GetState()->Setdt( dt );
|
||||||
|
|
||||||
result = FDMExec.LoadModel( aircraft_path.str(),
|
result = FDMExec.LoadModel( aircraft_path.str(),
|
||||||
engine_path.str(),
|
engine_path.str(),
|
||||||
current_options.get_aircraft() );
|
globals->get_options()->get_aircraft() );
|
||||||
FDMExec.GetState()->Setdt( dt );
|
FDMExec.GetState()->Setdt( dt );
|
||||||
|
|
||||||
if (result) {
|
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 {
|
} 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" );
|
<< " does not exist" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -105,31 +107,35 @@ bool FGJSBsim::init( double dt ) {
|
||||||
|
|
||||||
FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
|
FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
|
||||||
fgic->SetAltitudeFtIC(get_Altitude());
|
fgic->SetAltitudeFtIC(get_Altitude());
|
||||||
if((current_options.get_mach() < 0) && (current_options.get_vc() < 0 )) {
|
if ( (globals->get_options()->get_mach() < 0) &&
|
||||||
fgic->SetUBodyFpsIC(current_options.get_uBody());
|
(globals->get_options()->get_vc() < 0 ) )
|
||||||
fgic->SetVBodyFpsIC(current_options.get_vBody());
|
{
|
||||||
fgic->SetWBodyFpsIC(current_options.get_wBody());
|
fgic->SetUBodyFpsIC(globals->get_options()->get_uBody());
|
||||||
FG_LOG(FG_FLIGHT,FG_INFO, " u,v,w= " << current_options.get_uBody()
|
fgic->SetVBodyFpsIC(globals->get_options()->get_vBody());
|
||||||
<< ", " << current_options.get_vBody()
|
fgic->SetWBodyFpsIC(globals->get_options()->get_wBody());
|
||||||
<< ", " << current_options.get_wBody());
|
FG_LOG(FG_FLIGHT,FG_INFO, " u,v,w= " << globals->get_options()->get_uBody()
|
||||||
} else if (current_options.get_vc() < 0) {
|
<< ", " << globals->get_options()->get_vBody()
|
||||||
fgic->SetMachIC(current_options.get_mach());
|
<< ", " << globals->get_options()->get_wBody());
|
||||||
FG_LOG(FG_FLIGHT,FG_INFO, " mach: " << current_options.get_mach() );
|
} 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 {
|
} else {
|
||||||
fgic->SetVcalibratedKtsIC(current_options.get_vc());
|
fgic->SetVcalibratedKtsIC(globals->get_options()->get_vc());
|
||||||
FG_LOG(FG_FLIGHT,FG_INFO, " vc: " << current_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
|
//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->SetRollAngleRadIC(get_Phi());
|
||||||
fgic->SetPitchAngleRadIC(get_Theta());
|
fgic->SetPitchAngleRadIC(get_Theta());
|
||||||
fgic->SetHeadingRadIC(get_Psi());
|
fgic->SetHeadingRadIC(get_Psi());
|
||||||
fgic->SetLatitudeRadIC(get_Lat_geocentric());
|
fgic->SetLatitudeRadIC(get_Lat_geocentric());
|
||||||
fgic->SetLongitudeRadIC(get_Longitude());
|
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, " phi: " << get_Phi());
|
||||||
//FG_LOG( FG_FLIGHT, FG_INFO, " theta: " << get_Theta() );
|
//FG_LOG( FG_FLIGHT, FG_INFO, " theta: " << get_Theta() );
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, " psi: " << get_Psi() );
|
FG_LOG( FG_FLIGHT, FG_INFO, " psi: " << get_Psi() );
|
||||||
|
@ -143,10 +149,10 @@ bool FGJSBsim::init( double dt ) {
|
||||||
<< get_Altitude() + get_Sea_level_radius()
|
<< get_Altitude() + get_Sea_level_radius()
|
||||||
- scenery.cur_radius*METER_TO_FEET );
|
- scenery.cur_radius*METER_TO_FEET );
|
||||||
|
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, " current_options.get_altitude(): "
|
FG_LOG( FG_FLIGHT, FG_INFO, " globals->get_options()->get_altitude(): "
|
||||||
<< current_options.get_altitude() );
|
<< globals->get_options()->get_altitude() );
|
||||||
//must check > 0, != 0 will give bad result if --notrim set
|
//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) {
|
if(fgic->GetVcalibratedKtsIC() > 50) {
|
||||||
FDMExec.RunIC(fgic);
|
FDMExec.RunIC(fgic);
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
|
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
|
||||||
|
@ -158,7 +164,8 @@ bool FGJSBsim::init( double dt ) {
|
||||||
|
|
||||||
|
|
||||||
controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
|
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;
|
trimmed=true;
|
||||||
trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
|
trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
|
||||||
trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
|
trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
|
||||||
|
@ -192,7 +199,7 @@ bool FGJSBsim::init( double dt ) {
|
||||||
|
|
||||||
bool FGJSBsim::update( int multiloop ) {
|
bool FGJSBsim::update( int multiloop ) {
|
||||||
double save_alt = 0.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();
|
double start_elev = get_Altitude();
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +268,7 @@ bool FGJSBsim::copy_to_JSBsim() {
|
||||||
FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) );
|
FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) );
|
||||||
|
|
||||||
// Inform JSBsim of the local terrain altitude; uncommented 5/3/00
|
// 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()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
|
||||||
FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
|
FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
|
||||||
|
|
||||||
|
@ -343,7 +350,8 @@ bool FGJSBsim::copy_from_JSBsim() {
|
||||||
FDMExec.GetRotation()->GetEulerRates()(1),
|
FDMExec.GetRotation()->GetEulerRates()(1),
|
||||||
FDMExec.GetRotation()->GetEulerRates()(3));
|
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());
|
set_Mach_number( FDMExec.GetTranslation()->GetMach());
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
// each subsequent iteration through the EOM
|
// each subsequent iteration through the EOM
|
||||||
bool FGLaRCsim::init( double dt ) {
|
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
|
// Initialize our little engine that hopefully might
|
||||||
eng.init(dt);
|
eng.init(dt);
|
||||||
// dcl - in passing dt to init rather than update I am assuming
|
// dcl - in passing dt to init rather than update I am assuming
|
||||||
|
@ -63,7 +63,7 @@ bool FGLaRCsim::init( double dt ) {
|
||||||
copy_to_LaRCsim();
|
copy_to_LaRCsim();
|
||||||
|
|
||||||
// actual LaRCsim top level init
|
// 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 = " <<
|
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " <<
|
||||||
get_Latitude() );
|
get_Latitude() );
|
||||||
|
@ -87,7 +87,7 @@ bool FGLaRCsim::init( double dt ) {
|
||||||
bool FGLaRCsim::update( int multiloop ) {
|
bool FGLaRCsim::update( int multiloop ) {
|
||||||
// cout << "FGLaRCsim::update()" << endl;
|
// cout << "FGLaRCsim::update()" << endl;
|
||||||
|
|
||||||
if ( current_options.get_aircraft() == "c172" ) {
|
if ( globals->get_options()->get_aircraft() == "c172" ) {
|
||||||
// set control inputs
|
// set control inputs
|
||||||
eng.set_IAS( V_calibrated_kts );
|
eng.set_IAS( V_calibrated_kts );
|
||||||
eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
|
eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
|
||||||
|
@ -129,7 +129,8 @@ bool FGLaRCsim::update( int multiloop ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
double save_alt = 0.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();
|
double start_elev = get_Altitude();
|
||||||
|
|
||||||
// lets try to avoid really screwing up the LaRCsim model
|
// lets try to avoid really screwing up the LaRCsim model
|
||||||
|
@ -139,13 +140,15 @@ bool FGLaRCsim::update( int multiloop ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy control positions into the LaRCsim structure
|
// 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_control = controls.get_elevator();
|
||||||
Long_trim = controls.get_elevator_trim();
|
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();
|
Flap_handle = 30.0 * controls.get_flaps();
|
||||||
|
|
||||||
if ( current_options.get_aircraft() == "c172" ) {
|
if ( globals->get_options()->get_aircraft() == "c172" ) {
|
||||||
Use_External_Engine = 1;
|
Use_External_Engine = 1;
|
||||||
} else {
|
} else {
|
||||||
Use_External_Engine = 0;
|
Use_External_Engine = 0;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <simgear/math/polar3d.hxx>
|
#include <simgear/math/polar3d.hxx>
|
||||||
|
|
||||||
#include <Controls/controls.hxx>
|
#include <Controls/controls.hxx>
|
||||||
#include <Main/options.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
|
||||||
#include "MagicCarpet.hxx"
|
#include "MagicCarpet.hxx"
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ bool FGMagicCarpet::init( double dt ) {
|
||||||
bool FGMagicCarpet::update( int multiloop ) {
|
bool FGMagicCarpet::update( int multiloop ) {
|
||||||
// cout << "FGLaRCsim::update()" << endl;
|
// 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
|
// speed and distance traveled
|
||||||
double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
|
double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
|
||||||
|
|
|
@ -389,7 +389,7 @@ void guiMotionFunc ( int x, int y )
|
||||||
case MOUSE_YOKE:
|
case MOUSE_YOKE:
|
||||||
if( !mouse_joystick_control ) {
|
if( !mouse_joystick_control ) {
|
||||||
mouse_joystick_control = 1;
|
mouse_joystick_control = 1;
|
||||||
current_options.set_control_mode( fgOPTIONS::FG_MOUSE );
|
globals->get_options()->set_control_mode( FGOptions::FG_MOUSE );
|
||||||
} else {
|
} else {
|
||||||
if ( left_button() ) {
|
if ( left_button() ) {
|
||||||
offset = (_mX - x) * brake_sensitivity;
|
offset = (_mX - x) * brake_sensitivity;
|
||||||
|
@ -596,7 +596,7 @@ void guiMouseFunc(int button, int updown, int x, int y)
|
||||||
|
|
||||||
case MOUSE_YOKE:
|
case MOUSE_YOKE:
|
||||||
mouse_mode = MOUSE_VIEW;
|
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;
|
x = globals->get_current_view()->get_winWidth()/2;
|
||||||
y = globals->get_current_view()->get_winHeight()/2;
|
y = globals->get_current_view()->get_winHeight()/2;
|
||||||
_mVtoggle = 0;
|
_mVtoggle = 0;
|
||||||
|
@ -740,7 +740,7 @@ static void toggleClouds(puObject *cb)
|
||||||
// This is the accessor function
|
// This is the accessor function
|
||||||
void guiTogglePanel(puObject *cb)
|
void guiTogglePanel(puObject *cb)
|
||||||
{
|
{
|
||||||
current_options.toggle_panel();
|
globals->get_options()->toggle_panel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void MenuHideMenuCb(puObject *cb)
|
//void MenuHideMenuCb(puObject *cb)
|
||||||
|
@ -756,7 +756,7 @@ void goodBye(puObject *)
|
||||||
cout << "Program exiting normally at user request." << endl;
|
cout << "Program exiting normally at user request." << endl;
|
||||||
|
|
||||||
#ifdef FG_NETWORK_OLK
|
#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);
|
if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -776,8 +776,8 @@ void goAwayCb (puObject *me)
|
||||||
void mkDialogInit (void)
|
void mkDialogInit (void)
|
||||||
{
|
{
|
||||||
// printf("mkDialogInit\n");
|
// printf("mkDialogInit\n");
|
||||||
int x = (current_options.get_xsize()/2 - 400/2);
|
int x = (globals->get_options()->get_xsize()/2 - 400/2);
|
||||||
int y = (current_options.get_ysize()/2 - 100/2);
|
int y = (globals->get_options()->get_ysize()/2 - 100/2);
|
||||||
dialogBox = new puDialogBox (x, y); // 150, 50
|
dialogBox = new puDialogBox (x, y); // 150, 50
|
||||||
{
|
{
|
||||||
dialogFrame = new puFrame (0,0,400,100);
|
dialogFrame = new puFrame (0,0,400,100);
|
||||||
|
@ -809,8 +809,8 @@ void ConfirmExitDialogInit(void)
|
||||||
// printf("ConfirmExitDialogInit\n");
|
// printf("ConfirmExitDialogInit\n");
|
||||||
int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2;
|
int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2;
|
||||||
|
|
||||||
int x = (current_options.get_xsize()/2 - 400/2);
|
int x = (globals->get_options()->get_xsize()/2 - 400/2);
|
||||||
int y = (current_options.get_ysize()/2 - 100/2);
|
int y = (globals->get_options()->get_ysize()/2 - 100/2);
|
||||||
|
|
||||||
YNdialogBox = new puDialogBox (x, y); // 150, 50
|
YNdialogBox = new puDialogBox (x, y); // 150, 50
|
||||||
// YNdialogBox = new puDialogBox (150, 50);
|
// YNdialogBox = new puDialogBox (150, 50);
|
||||||
|
@ -882,10 +882,10 @@ static GlBitmap *b1 = NULL;
|
||||||
extern FGInterface cur_view_fdm;
|
extern FGInterface cur_view_fdm;
|
||||||
GLubyte *hiResScreenCapture( int multiplier )
|
GLubyte *hiResScreenCapture( int multiplier )
|
||||||
{
|
{
|
||||||
float oldfov = current_options.get_fov();
|
float oldfov = globals->get_options()->get_fov();
|
||||||
float fov = oldfov / multiplier;
|
float fov = oldfov / multiplier;
|
||||||
FGViewer *v = globals->get_current_view();
|
FGViewer *v = globals->get_current_view();
|
||||||
current_options.set_fov(fov);
|
globals->get_options()->set_fov(fov);
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
fgInitVisuals();
|
fgInitVisuals();
|
||||||
int cur_width = globals->get_current_view()->get_winWidth( );
|
int cur_width = globals->get_current_view()->get_winWidth( );
|
||||||
|
@ -908,7 +908,7 @@ GLubyte *hiResScreenCapture( int multiplier )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals->get_current_view()->UpdateViewParams(cur_view_fdm);
|
globals->get_current_view()->UpdateViewParams(cur_view_fdm);
|
||||||
current_options.set_fov(oldfov);
|
globals->get_options()->set_fov(oldfov);
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
return b1->getBitmap();
|
return b1->getBitmap();
|
||||||
}
|
}
|
||||||
|
@ -976,8 +976,8 @@ void fgDumpSnapShot () {
|
||||||
fgRenderFrame();
|
fgRenderFrame();
|
||||||
|
|
||||||
my_glDumpWindow( "fgfs-screen.ppm",
|
my_glDumpWindow( "fgfs-screen.ppm",
|
||||||
current_options.get_xsize(),
|
globals->get_options()->get_xsize(),
|
||||||
current_options.get_ysize() );
|
globals->get_options()->get_ysize() );
|
||||||
|
|
||||||
mkDialog ("Snap shot saved to fgfs-screen.ppm");
|
mkDialog ("Snap shot saved to fgfs-screen.ppm");
|
||||||
|
|
||||||
|
@ -1017,7 +1017,7 @@ void AptDialog_Cancel(puObject *)
|
||||||
|
|
||||||
void AptDialog_OK (puObject *)
|
void AptDialog_OK (puObject *)
|
||||||
{
|
{
|
||||||
FGPath path( current_options.get_fg_root() );
|
FGPath path( globals->get_options()->get_fg_root() );
|
||||||
path.append( "Airports" );
|
path.append( "Airports" );
|
||||||
path.append( "simple.mk4" );
|
path.append( "simple.mk4" );
|
||||||
FGAirports airports( path.c_str() );
|
FGAirports airports( path.c_str() );
|
||||||
|
@ -1044,8 +1044,8 @@ void AptDialog_OK (puObject *)
|
||||||
|
|
||||||
if ( airports.search( AptId, &a ) )
|
if ( airports.search( AptId, &a ) )
|
||||||
{
|
{
|
||||||
current_options.set_airport_id( AptId.c_str() );
|
globals->get_options()->set_airport_id( AptId.c_str() );
|
||||||
current_options.set_altitude( -9999.0 );
|
globals->get_options()->set_altitude( -9999.0 );
|
||||||
// fgSetPosFromAirportID( AptId );
|
// fgSetPosFromAirportID( AptId );
|
||||||
fgSetPosFromAirportIDandHdg( AptId,
|
fgSetPosFromAirportIDandHdg( AptId,
|
||||||
cur_fdm_state->get_Psi() * RAD_TO_DEG);
|
cur_fdm_state->get_Psi() * RAD_TO_DEG);
|
||||||
|
@ -1063,16 +1063,16 @@ void AptDialog_OK (puObject *)
|
||||||
|
|
||||||
void AptDialog_Reset(puObject *)
|
void AptDialog_Reset(puObject *)
|
||||||
{
|
{
|
||||||
// strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
|
// strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
|
||||||
sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
|
sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
|
||||||
AptDialogInput->setValue ( NewAirportId );
|
AptDialogInput->setValue ( NewAirportId );
|
||||||
AptDialogInput->setCursor( 0 ) ;
|
AptDialogInput->setCursor( 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewAirport(puObject *cb)
|
void NewAirport(puObject *cb)
|
||||||
{
|
{
|
||||||
// strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
|
// strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
|
||||||
sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
|
sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
|
||||||
// cout << "NewAirport " << NewAirportId << endl;
|
// cout << "NewAirport " << NewAirportId << endl;
|
||||||
AptDialogInput->setValue( NewAirportId );
|
AptDialogInput->setValue( NewAirportId );
|
||||||
|
|
||||||
|
@ -1081,7 +1081,7 @@ void NewAirport(puObject *cb)
|
||||||
|
|
||||||
static void NewAirportInit(void)
|
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(),
|
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
|
||||||
NewAirportLabel ) / 2;
|
NewAirportLabel ) / 2;
|
||||||
|
|
||||||
|
@ -1149,9 +1149,9 @@ void NetIdDialog_OK (puObject *)
|
||||||
NetId = net_callsign;
|
NetId = net_callsign;
|
||||||
|
|
||||||
NetIdDialog_Cancel( NULL );
|
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, 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 */
|
/* Entering a callsign indicates : user wants Net HUD Info */
|
||||||
net_hud_display = 1;
|
net_hud_display = 1;
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ void NetIdDialog_OK (puObject *)
|
||||||
|
|
||||||
void NewCallSign(puObject *cb)
|
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 );
|
// sprintf( NewNetId, "%s", fgd_callsign );
|
||||||
NetIdDialogInput->setValue( NewNetId );
|
NetIdDialogInput->setValue( NewNetId );
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ void NewCallSign(puObject *cb)
|
||||||
|
|
||||||
static void NewNetIdInit(void)
|
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 );
|
// sprintf( NewNetId, "%s", fgd_callsign );
|
||||||
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
|
int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
|
||||||
NewNetIdLabel ) / 2;
|
NewNetIdLabel ) / 2;
|
||||||
|
@ -1323,7 +1323,7 @@ void net_fgd_scan(puObject *cb)
|
||||||
|
|
||||||
static void NewNetFGDInit(void)
|
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 );
|
// sprintf( NewNetId, "%s", fgd_callsign );
|
||||||
int len = 170 - puGetStringWidth( puGetDefaultLabelFont(),
|
int len = 170 - puGetStringWidth( puGetDefaultLabelFont(),
|
||||||
NewNetFGDLabel ) / 2;
|
NewNetFGDLabel ) / 2;
|
||||||
|
@ -1518,7 +1518,7 @@ void guiInit()
|
||||||
if ( envp != NULL ) {
|
if ( envp != NULL ) {
|
||||||
fntpath.set( envp );
|
fntpath.set( envp );
|
||||||
} else {
|
} else {
|
||||||
fntpath.set( current_options.get_fg_root() );
|
fntpath.set( globals->get_options()->get_fg_root() );
|
||||||
fntpath.append( "Fonts" );
|
fntpath.append( "Fonts" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1530,7 +1530,7 @@ void guiInit()
|
||||||
puSetDefaultFonts( GuiFont, GuiFont ) ;
|
puSetDefaultFonts( GuiFont, GuiFont ) ;
|
||||||
guiFnt = puGetDefaultLabelFont();
|
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...
|
// no preference specified for mouse pointer, attempt to autodetect...
|
||||||
// Determine if we need to render the cursor, or if the windowing
|
// Determine if we need to render the cursor, or if the windowing
|
||||||
// system will do it. First test if we are rendering with glide.
|
// system will do it. First test if we are rendering with glide.
|
||||||
|
@ -1545,9 +1545,9 @@ void guiInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mouse_active = ~mouse_active;
|
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
|
// don't show pointer
|
||||||
} else if ( current_options.get_mouse_pointer() == 2 ) {
|
} else if ( globals->get_options()->get_mouse_pointer() == 2 ) {
|
||||||
// force showing pointer
|
// force showing pointer
|
||||||
puShowCursor();
|
puShowCursor();
|
||||||
mouse_active = ~mouse_active;
|
mouse_active = ~mouse_active;
|
||||||
|
@ -1576,7 +1576,7 @@ void guiInit()
|
||||||
mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
|
mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
|
||||||
// mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
|
// mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
|
||||||
#ifdef FG_NETWORK_OLK
|
#ifdef FG_NETWORK_OLK
|
||||||
if ( current_options.get_network_olk() ) {
|
if ( globals->get_options()->get_network_olk() ) {
|
||||||
mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
|
mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -288,7 +288,7 @@ FGBFI::reinit ()
|
||||||
double gpsLongitude = getGPSTargetLongitude();
|
double gpsLongitude = getGPSTargetLongitude();
|
||||||
|
|
||||||
setTargetAirport("");
|
setTargetAirport("");
|
||||||
cout << "Target airport is " << current_options.get_airport_id() << endl;
|
cout << "Target airport is " << globals->get_options()->get_airport_id() << endl;
|
||||||
|
|
||||||
fgReInitSubsystems();
|
fgReInitSubsystems();
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ FGBFI::reinit ()
|
||||||
int
|
int
|
||||||
FGBFI::getFlightModel ()
|
FGBFI::getFlightModel ()
|
||||||
{
|
{
|
||||||
return current_options.get_flight_model();
|
return globals->get_options()->get_flight_model();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ FGBFI::getFlightModel ()
|
||||||
const string
|
const string
|
||||||
FGBFI::getAircraft ()
|
FGBFI::getAircraft ()
|
||||||
{
|
{
|
||||||
return current_options.get_aircraft();
|
return globals->get_options()->get_aircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ void
|
||||||
FGBFI::setFlightModel (int model)
|
FGBFI::setFlightModel (int model)
|
||||||
{
|
{
|
||||||
if (getFlightModel() != model) {
|
if (getFlightModel() != model) {
|
||||||
current_options.set_flight_model(model);
|
globals->get_options()->set_flight_model(model);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ void
|
||||||
FGBFI::setAircraft (const string &aircraft)
|
FGBFI::setAircraft (const string &aircraft)
|
||||||
{
|
{
|
||||||
if (getAircraft() != aircraft) {
|
if (getAircraft() != aircraft) {
|
||||||
current_options.set_aircraft(aircraft);
|
globals->get_options()->set_aircraft(aircraft);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,8 +422,8 @@ FGBFI::setTimeGMT (time_t time)
|
||||||
if (getTimeGMT() != time) {
|
if (getTimeGMT() != time) {
|
||||||
// FIXME: need to update lighting
|
// FIXME: need to update lighting
|
||||||
// and solar system
|
// and solar system
|
||||||
current_options.set_time_offset(time);
|
globals->get_options()->set_time_offset(time);
|
||||||
current_options.set_time_offset_type(fgOPTIONS::FG_TIME_GMT_ABSOLUTE);
|
globals->get_options()->set_time_offset_type(FGOptions::FG_TIME_GMT_ABSOLUTE);
|
||||||
globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
|
globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
|
||||||
cur_fdm_state->get_Latitude(),
|
cur_fdm_state->get_Latitude(),
|
||||||
globals->get_warp() );
|
globals->get_warp() );
|
||||||
|
@ -454,7 +454,7 @@ FGBFI::getGMTString ()
|
||||||
bool
|
bool
|
||||||
FGBFI::getHUDVisible ()
|
FGBFI::getHUDVisible ()
|
||||||
{
|
{
|
||||||
return current_options.get_hud_status();
|
return globals->get_options()->get_hud_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ FGBFI::getHUDVisible ()
|
||||||
void
|
void
|
||||||
FGBFI::setHUDVisible (bool visible)
|
FGBFI::setHUDVisible (bool visible)
|
||||||
{
|
{
|
||||||
current_options.set_hud_status(visible);
|
globals->get_options()->set_hud_status(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ FGBFI::setHUDVisible (bool visible)
|
||||||
bool
|
bool
|
||||||
FGBFI::getPanelVisible ()
|
FGBFI::getPanelVisible ()
|
||||||
{
|
{
|
||||||
return current_options.get_panel_status();
|
return globals->get_options()->get_panel_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,8 +484,8 @@ FGBFI::getPanelVisible ()
|
||||||
void
|
void
|
||||||
FGBFI::setPanelVisible (bool visible)
|
FGBFI::setPanelVisible (bool visible)
|
||||||
{
|
{
|
||||||
if (current_options.get_panel_status() != visible) {
|
if (globals->get_options()->get_panel_status() != visible) {
|
||||||
current_options.toggle_panel();
|
globals->get_options()->toggle_panel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ void
|
||||||
FGBFI::setLatitude (double latitude)
|
FGBFI::setLatitude (double latitude)
|
||||||
{
|
{
|
||||||
if (getLatitude() != 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);
|
current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ void
|
||||||
FGBFI::setLongitude (double longitude)
|
FGBFI::setLongitude (double longitude)
|
||||||
{
|
{
|
||||||
if (getLongitude() != 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);
|
current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ FGBFI::setAltitude (double altitude)
|
||||||
{
|
{
|
||||||
if (getAltitude() != altitude) {
|
if (getAltitude() != altitude) {
|
||||||
fgFDMForceAltitude(getFlightModel(), altitude);
|
fgFDMForceAltitude(getFlightModel(), altitude);
|
||||||
current_options.set_altitude(altitude);
|
globals->get_options()->set_altitude(altitude);
|
||||||
current_aircraft.fdm_state->set_Altitude(altitude);
|
current_aircraft.fdm_state->set_Altitude(altitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ void
|
||||||
FGBFI::setHeading (double heading)
|
FGBFI::setHeading (double heading)
|
||||||
{
|
{
|
||||||
if (getHeading() != 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,
|
current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
|
||||||
getPitch() * DEG_TO_RAD,
|
getPitch() * DEG_TO_RAD,
|
||||||
heading * DEG_TO_RAD);
|
heading * DEG_TO_RAD);
|
||||||
|
@ -639,7 +639,7 @@ void
|
||||||
FGBFI::setPitch (double pitch)
|
FGBFI::setPitch (double pitch)
|
||||||
{
|
{
|
||||||
if (getPitch() != 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,
|
current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
|
||||||
pitch * DEG_TO_RAD,
|
pitch * DEG_TO_RAD,
|
||||||
getHeading() * DEG_TO_RAD);
|
getHeading() * DEG_TO_RAD);
|
||||||
|
@ -665,7 +665,7 @@ void
|
||||||
FGBFI::setRoll (double roll)
|
FGBFI::setRoll (double roll)
|
||||||
{
|
{
|
||||||
if (getRoll() != 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,
|
current_aircraft.fdm_state->set_Euler_Angles(roll * DEG_TO_RAD,
|
||||||
getPitch() * DEG_TO_RAD,
|
getPitch() * DEG_TO_RAD,
|
||||||
getHeading() * DEG_TO_RAD);
|
getHeading() * DEG_TO_RAD);
|
||||||
|
@ -769,7 +769,7 @@ void
|
||||||
FGBFI::setSpeedNorth (double speed)
|
FGBFI::setSpeedNorth (double speed)
|
||||||
{
|
{
|
||||||
if (getSpeedNorth() != speed) {
|
if (getSpeedNorth() != speed) {
|
||||||
current_options.set_uBody(speed);
|
globals->get_options()->set_uBody(speed);
|
||||||
current_aircraft.fdm_state->set_Velocities_Local(speed,
|
current_aircraft.fdm_state->set_Velocities_Local(speed,
|
||||||
getSpeedEast(),
|
getSpeedEast(),
|
||||||
getSpeedDown());
|
getSpeedDown());
|
||||||
|
@ -795,7 +795,7 @@ void
|
||||||
FGBFI::setSpeedEast (double speed)
|
FGBFI::setSpeedEast (double speed)
|
||||||
{
|
{
|
||||||
if (getSpeedEast() != speed) {
|
if (getSpeedEast() != speed) {
|
||||||
current_options.set_vBody(speed);
|
globals->get_options()->set_vBody(speed);
|
||||||
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
|
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
|
||||||
speed,
|
speed,
|
||||||
getSpeedDown());
|
getSpeedDown());
|
||||||
|
@ -821,7 +821,7 @@ void
|
||||||
FGBFI::setSpeedDown (double speed)
|
FGBFI::setSpeedDown (double speed)
|
||||||
{
|
{
|
||||||
if (getSpeedDown() != speed) {
|
if (getSpeedDown() != speed) {
|
||||||
current_options.set_wBody(speed);
|
globals->get_options()->set_wBody(speed);
|
||||||
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
|
current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
|
||||||
getSpeedEast(),
|
getSpeedEast(),
|
||||||
speed);
|
speed);
|
||||||
|
@ -1530,7 +1530,7 @@ FGBFI::getTargetAirport ()
|
||||||
{
|
{
|
||||||
// FIXME: not thread-safe
|
// FIXME: not thread-safe
|
||||||
static string out;
|
static string out;
|
||||||
out = current_options.get_airport_id();
|
out = globals->get_options()->get_airport_id();
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -1543,7 +1543,7 @@ void
|
||||||
FGBFI::setTargetAirport (const string &airportId)
|
FGBFI::setTargetAirport (const string &airportId)
|
||||||
{
|
{
|
||||||
// cout << "setting target airport id = " << airportId << endl;
|
// cout << "setting target airport id = " << airportId << endl;
|
||||||
current_options.set_airport_id(airportId);
|
globals->get_options()->set_airport_id(airportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1604,7 +1604,7 @@ FGBFI::getVisibility ()
|
||||||
bool
|
bool
|
||||||
FGBFI::getClouds ()
|
FGBFI::getClouds ()
|
||||||
{
|
{
|
||||||
return current_options.get_clouds();
|
return globals->get_options()->get_clouds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1614,7 +1614,7 @@ FGBFI::getClouds ()
|
||||||
double
|
double
|
||||||
FGBFI::getCloudsASL ()
|
FGBFI::getCloudsASL ()
|
||||||
{
|
{
|
||||||
return current_options.get_clouds_asl();
|
return globals->get_options()->get_clouds_asl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1640,7 +1640,7 @@ FGBFI::setClouds (bool clouds)
|
||||||
{
|
{
|
||||||
if (getClouds() != clouds) {
|
if (getClouds() != clouds) {
|
||||||
cout << "Set clouds to " << clouds << endl;
|
cout << "Set clouds to " << clouds << endl;
|
||||||
current_options.set_clouds(clouds);
|
globals->get_options()->set_clouds(clouds);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1653,7 +1653,7 @@ void
|
||||||
FGBFI::setCloudsASL (double cloudsASL)
|
FGBFI::setCloudsASL (double cloudsASL)
|
||||||
{
|
{
|
||||||
if (getCloudsASL() != cloudsASL) {
|
if (getCloudsASL() != cloudsASL) {
|
||||||
current_options.set_clouds_asl(cloudsASL);
|
globals->get_options()->set_clouds_asl(cloudsASL);
|
||||||
needReinit();
|
needReinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,21 +109,21 @@ extern const char *default_root;
|
||||||
bool fgInitFGRoot ( int argc, char **argv ) {
|
bool fgInitFGRoot ( int argc, char **argv ) {
|
||||||
// Attempt to locate and parse a config file
|
// Attempt to locate and parse a config file
|
||||||
// First check fg_root
|
// First check fg_root
|
||||||
FGPath config( current_options.get_fg_root() );
|
FGPath config( globals->get_options()->get_fg_root() );
|
||||||
config.append( "system.fgfsrc" );
|
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
|
// Next check home directory
|
||||||
char* envp = ::getenv( "HOME" );
|
char* envp = ::getenv( "HOME" );
|
||||||
if ( envp != NULL ) {
|
if ( envp != NULL ) {
|
||||||
config.set( envp );
|
config.set( envp );
|
||||||
config.append( ".fgfsrc" );
|
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
|
// Parse remaining command line options
|
||||||
// These will override anything specified in a config file
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -133,26 +133,26 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
||||||
bool fgInitConfig ( int argc, char **argv ) {
|
bool fgInitConfig ( int argc, char **argv ) {
|
||||||
// Attempt to locate and parse a config file
|
// Attempt to locate and parse a config file
|
||||||
// First check fg_root
|
// First check fg_root
|
||||||
FGPath config( current_options.get_fg_root() );
|
FGPath config( globals->get_options()->get_fg_root() );
|
||||||
config.append( "system.fgfsrc" );
|
config.append( "system.fgfsrc" );
|
||||||
current_options.parse_config_file( config.str() );
|
globals->get_options()->parse_config_file( config.str() );
|
||||||
|
|
||||||
// Next check home directory
|
// Next check home directory
|
||||||
char* envp = ::getenv( "HOME" );
|
char* envp = ::getenv( "HOME" );
|
||||||
if ( envp != NULL ) {
|
if ( envp != NULL ) {
|
||||||
config.set( envp );
|
config.set( envp );
|
||||||
config.append( ".fgfsrc" );
|
config.append( ".fgfsrc" );
|
||||||
current_options.parse_config_file( config.str() );
|
globals->get_options()->parse_config_file( config.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse remaining command line options
|
// Parse remaining command line options
|
||||||
// These will override anything specified in a config file
|
// These will override anything specified in a config file
|
||||||
if ( current_options.parse_command_line(argc, argv) !=
|
if ( globals->get_options()->parse_command_line(argc, argv) !=
|
||||||
fgOPTIONS::FG_OPTIONS_OK )
|
FGOptions::FG_OPTIONS_OK )
|
||||||
{
|
{
|
||||||
// Something must have gone horribly wrong with the command
|
// Something must have gone horribly wrong with the command
|
||||||
// line parsing or maybe the user just requested help ... :-)
|
// line parsing or maybe the user just requested help ... :-)
|
||||||
current_options.usage();
|
globals->get_options()->usage();
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
|
FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ bool fgInitConfig ( int argc, char **argv ) {
|
||||||
// find basic airport location info from airport database
|
// find basic airport location info from airport database
|
||||||
bool fgFindAirportID( const string& id, FGAirport *a ) {
|
bool fgFindAirportID( const string& id, FGAirport *a ) {
|
||||||
if ( id.length() ) {
|
if ( id.length() ) {
|
||||||
FGPath path( current_options.get_fg_root() );
|
FGPath path( globals->get_options()->get_fg_root() );
|
||||||
path.append( "Airports" );
|
path.append( "Airports" );
|
||||||
path.append( "simple.mk4" );
|
path.append( "simple.mk4" );
|
||||||
FGAirports airports( path.c_str() );
|
FGAirports airports( path.c_str() );
|
||||||
|
@ -198,8 +198,8 @@ bool fgSetPosFromAirportID( const string& id ) {
|
||||||
"Attempting to set starting position from airport code " << id );
|
"Attempting to set starting position from airport code " << id );
|
||||||
|
|
||||||
if ( fgFindAirportID( id, &a ) ) {
|
if ( fgFindAirportID( id, &a ) ) {
|
||||||
current_options.set_lon( a.longitude );
|
globals->get_options()->set_lon( a.longitude );
|
||||||
current_options.set_lat( a.latitude );
|
globals->get_options()->set_lat( a.latitude );
|
||||||
current_properties.setDoubleValue("/position/longitude",
|
current_properties.setDoubleValue("/position/longitude",
|
||||||
a.longitude);
|
a.longitude);
|
||||||
current_properties.setDoubleValue("/position/latitude",
|
current_properties.setDoubleValue("/position/latitude",
|
||||||
|
@ -227,7 +227,7 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
if ( id.length() ) {
|
if ( id.length() ) {
|
||||||
// set initial position from runway and heading
|
// 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( "Airports" );
|
||||||
path.append( "runways.mk4" );
|
path.append( "runways.mk4" );
|
||||||
FGRunways runways( path.c_str() );
|
FGRunways runways( path.c_str() );
|
||||||
|
@ -236,12 +236,12 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
"Attempting to set starting position from runway code "
|
"Attempting to set starting position from runway code "
|
||||||
<< id << " heading " << tgt_hdg );
|
<< id << " heading " << tgt_hdg );
|
||||||
|
|
||||||
// FGPath inpath( current_options.get_fg_root() );
|
// FGPath inpath( globals->get_options()->get_fg_root() );
|
||||||
// inpath.append( "Airports" );
|
// inpath.append( "Airports" );
|
||||||
// inpath.append( "apt_simple" );
|
// inpath.append( "apt_simple" );
|
||||||
// airports.load( inpath.c_str() );
|
// 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( "Airports" );
|
||||||
// outpath.append( "simple.gdbm" );
|
// outpath.append( "simple.gdbm" );
|
||||||
// airports.dump_gdbm( outpath.c_str() );
|
// airports.dump_gdbm( outpath.c_str() );
|
||||||
|
@ -309,9 +309,9 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon,
|
geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon,
|
||||||
azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
|
azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
|
||||||
&lat2, &lon2, &az2 );
|
&lat2, &lon2, &az2 );
|
||||||
current_options.set_lon( lon2 );
|
globals->get_options()->set_lon( lon2 );
|
||||||
current_options.set_lat( lat2 );
|
globals->get_options()->set_lat( lat2 );
|
||||||
current_options.set_heading( heading );
|
globals->get_options()->set_heading( heading );
|
||||||
current_properties.setDoubleValue("/position/longitude", lon2);
|
current_properties.setDoubleValue("/position/longitude", lon2);
|
||||||
current_properties.setDoubleValue("/position/latitude", lat2);
|
current_properties.setDoubleValue("/position/latitude", lat2);
|
||||||
current_properties.setDoubleValue("/orientation/heading", heading);
|
current_properties.setDoubleValue("/orientation/heading", heading);
|
||||||
|
@ -329,21 +329,21 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
// Set initial position and orientation
|
// Set initial position and orientation
|
||||||
bool fgInitPosition( void ) {
|
bool fgInitPosition( void ) {
|
||||||
FGInterface *f = current_aircraft.fdm_state;
|
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
|
// set initial position from default or command line coordinates
|
||||||
f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
|
f->set_Longitude( globals->get_options()->get_lon() * DEG_TO_RAD );
|
||||||
f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
|
f->set_Latitude( globals->get_options()->get_lat() * DEG_TO_RAD );
|
||||||
|
|
||||||
if ( scenery.cur_elev > current_options.get_altitude() - 1) {
|
if ( scenery.cur_elev > globals->get_options()->get_altitude() - 1) {
|
||||||
current_options.set_altitude( scenery.cur_elev + 1 );
|
globals->get_options()->set_altitude( scenery.cur_elev + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
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 );
|
f->set_Altitude( globals->get_options()->get_altitude() * METER_TO_FEET );
|
||||||
fgFDMSetGroundElevation( current_options.get_flight_model(),
|
fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
|
||||||
f->get_Altitude() * FEET_TO_METER );
|
f->get_Altitude() * FEET_TO_METER );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -376,7 +376,7 @@ bool fgInitGeneral( void ) {
|
||||||
FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
|
FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
|
||||||
FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
|
FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
|
||||||
|
|
||||||
root = current_options.get_fg_root();
|
root = globals->get_options()->get_fg_root();
|
||||||
if ( ! root.length() ) {
|
if ( ! root.length() ) {
|
||||||
// No root path set? Then bail ...
|
// No root path set? Then bail ...
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||||
|
@ -416,7 +416,7 @@ bool fgInitSubsystems( void ) {
|
||||||
FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
|
FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
|
||||||
|
|
||||||
// Initialize the material property lib
|
// Initialize the material property lib
|
||||||
FGPath mpath( current_options.get_fg_root() );
|
FGPath mpath( globals->get_options()->get_fg_root() );
|
||||||
mpath.append( "materials" );
|
mpath.append( "materials" );
|
||||||
if ( material_lib.load( mpath.str() ) ) {
|
if ( material_lib.load( mpath.str() ) ) {
|
||||||
} else {
|
} else {
|
||||||
|
@ -434,8 +434,8 @@ bool fgInitSubsystems( void ) {
|
||||||
|
|
||||||
if ( global_tile_mgr.init() ) {
|
if ( global_tile_mgr.init() ) {
|
||||||
// Load the local scenery data
|
// Load the local scenery data
|
||||||
global_tile_mgr.update( current_options.get_lon(),
|
global_tile_mgr.update( globals->get_options()->get_lon(),
|
||||||
current_options.get_lat() );
|
globals->get_options()->get_lat() );
|
||||||
} else {
|
} else {
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
|
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -445,19 +445,19 @@ bool fgInitSubsystems( void ) {
|
||||||
"Current terrain elevation after tile mgr init " <<
|
"Current terrain elevation after tile mgr init " <<
|
||||||
scenery.cur_elev );
|
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;
|
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;
|
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;
|
cur_fdm_state = new FGADA;
|
||||||
} else if ( current_options.get_flight_model() ==
|
} else if ( globals->get_options()->get_flight_model() ==
|
||||||
FGInterface::FG_BALLOONSIM ) {
|
FGInterface::FG_BALLOONSIM ) {
|
||||||
cur_fdm_state = new FGBalloonSim;
|
cur_fdm_state = new FGBalloonSim;
|
||||||
} else if ( current_options.get_flight_model() ==
|
} else if ( globals->get_options()->get_flight_model() ==
|
||||||
FGInterface::FG_MAGICCARPET ) {
|
FGInterface::FG_MAGICCARPET ) {
|
||||||
cur_fdm_state = new FGMagicCarpet;
|
cur_fdm_state = new FGMagicCarpet;
|
||||||
} else if ( current_options.get_flight_model() ==
|
} else if ( globals->get_options()->get_flight_model() ==
|
||||||
FGInterface::FG_EXTERNAL ) {
|
FGInterface::FG_EXTERNAL ) {
|
||||||
cur_fdm_state = new FGExternal;
|
cur_fdm_state = new FGExternal;
|
||||||
} else {
|
} else {
|
||||||
|
@ -496,7 +496,7 @@ bool fgInitSubsystems( void ) {
|
||||||
"Altitude after update " << scenery.cur_elev );
|
"Altitude after update " << scenery.cur_elev );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fgFDMSetGroundElevation( current_options.get_flight_model(),
|
fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
|
||||||
scenery.cur_elev );
|
scenery.cur_elev );
|
||||||
|
|
||||||
// Reset our altitude if we are below ground
|
// Reset our altitude if we are below ground
|
||||||
|
@ -538,14 +538,14 @@ bool fgInitSubsystems( void ) {
|
||||||
// and should really be read in from one or more files.
|
// and should really be read in from one or more files.
|
||||||
|
|
||||||
// Initial Velocity
|
// Initial Velocity
|
||||||
cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
|
cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
|
||||||
current_options.get_vBody(),
|
globals->get_options()->get_vBody(),
|
||||||
current_options.get_wBody());
|
globals->get_options()->get_wBody());
|
||||||
|
|
||||||
// Initial Orientation
|
// Initial Orientation
|
||||||
cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
|
cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
|
||||||
current_options.get_pitch() * DEG_TO_RAD,
|
globals->get_options()->get_pitch() * DEG_TO_RAD,
|
||||||
current_options.get_heading() * DEG_TO_RAD );
|
globals->get_options()->get_heading() * DEG_TO_RAD );
|
||||||
|
|
||||||
// Initial Angular Body rates
|
// Initial Angular Body rates
|
||||||
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
|
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
|
||||||
|
@ -622,7 +622,7 @@ bool fgInitSubsystems( void ) {
|
||||||
current_aircraft.fdm_state->get_Longitude(),
|
current_aircraft.fdm_state->get_Longitude(),
|
||||||
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
|
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
|
||||||
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
|
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
|
||||||
new FGLocalWeatherDatabase( position, current_options.get_fg_root() );
|
new FGLocalWeatherDatabase( position, globals->get_options()->get_fg_root() );
|
||||||
// cout << theFGLocalWeatherDatabase << endl;
|
// cout << theFGLocalWeatherDatabase << endl;
|
||||||
// cout << "visibility = "
|
// cout << "visibility = "
|
||||||
// << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
|
// << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
|
||||||
|
@ -641,19 +641,19 @@ bool fgInitSubsystems( void ) {
|
||||||
|
|
||||||
FG_LOG(FG_GENERAL, FG_INFO, " VOR/NDB");
|
FG_LOG(FG_GENERAL, FG_INFO, " VOR/NDB");
|
||||||
current_navlist = new FGNavList;
|
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" );
|
p_nav.append( "Navaids/default.nav" );
|
||||||
current_navlist->init( p_nav );
|
current_navlist->init( p_nav );
|
||||||
|
|
||||||
FG_LOG(FG_GENERAL, FG_INFO, " ILS");
|
FG_LOG(FG_GENERAL, FG_INFO, " ILS");
|
||||||
current_ilslist = new FGILSList;
|
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" );
|
p_ils.append( "Navaids/default.ils" );
|
||||||
current_ilslist->init( p_ils );
|
current_ilslist->init( p_ils );
|
||||||
|
|
||||||
FG_LOG(FG_GENERAL, FG_INFO, " Fixes");
|
FG_LOG(FG_GENERAL, FG_INFO, " Fixes");
|
||||||
current_fixlist = new FGFixList;
|
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" );
|
p_fix.append( "Navaids/default.fix" );
|
||||||
current_fixlist->init( p_fix );
|
current_fixlist->init( p_fix );
|
||||||
|
|
||||||
|
@ -706,9 +706,9 @@ bool fgInitSubsystems( void ) {
|
||||||
// Initialize the flight model subsystem data structures base on
|
// Initialize the flight model subsystem data structures base on
|
||||||
// above values
|
// above values
|
||||||
|
|
||||||
// fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
|
// fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state,
|
||||||
// 1.0 / current_options.get_model_hz() );
|
// 1.0 / globals->get_options()->get_model_hz() );
|
||||||
if ( cur_fdm_state->init( 1.0 / current_options.get_model_hz() ) ) {
|
if ( cur_fdm_state->init( 1.0 / globals->get_options()->get_model_hz() ) ) {
|
||||||
// fdm init successful
|
// fdm init successful
|
||||||
} else {
|
} else {
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT, "FDM init() failed! Cannot continue." );
|
FG_LOG( FG_GENERAL, FG_ALERT, "FDM init() failed! Cannot continue." );
|
||||||
|
@ -780,8 +780,8 @@ void fgReInitSubsystems( void )
|
||||||
|
|
||||||
if( global_tile_mgr.init() ) {
|
if( global_tile_mgr.init() ) {
|
||||||
// Load the local scenery data
|
// Load the local scenery data
|
||||||
global_tile_mgr.update( current_options.get_lon(),
|
global_tile_mgr.update( globals->get_options()->get_lon(),
|
||||||
current_options.get_lat() );
|
globals->get_options()->get_lat() );
|
||||||
} else {
|
} else {
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
|
FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -790,7 +790,7 @@ void fgReInitSubsystems( void )
|
||||||
// cout << "current scenery elev = " << scenery.cur_elev << endl;
|
// cout << "current scenery elev = " << scenery.cur_elev << endl;
|
||||||
|
|
||||||
fgInitPosition();
|
fgInitPosition();
|
||||||
fgFDMSetGroundElevation( current_options.get_flight_model(),
|
fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
|
||||||
scenery.cur_elev );
|
scenery.cur_elev );
|
||||||
|
|
||||||
// Reset our altitude if we are below ground
|
// Reset our altitude if we are below ground
|
||||||
|
@ -821,14 +821,14 @@ void fgReInitSubsystems( void )
|
||||||
// and should really be read in from one or more files.
|
// and should really be read in from one or more files.
|
||||||
|
|
||||||
// Initial Velocity
|
// Initial Velocity
|
||||||
cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
|
cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
|
||||||
current_options.get_vBody(),
|
globals->get_options()->get_vBody(),
|
||||||
current_options.get_wBody());
|
globals->get_options()->get_wBody());
|
||||||
|
|
||||||
// Initial Orientation
|
// Initial Orientation
|
||||||
cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
|
cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
|
||||||
current_options.get_pitch() * DEG_TO_RAD,
|
globals->get_options()->get_pitch() * DEG_TO_RAD,
|
||||||
current_options.get_heading() * DEG_TO_RAD );
|
globals->get_options()->get_heading() * DEG_TO_RAD );
|
||||||
|
|
||||||
// Initial Angular Body rates
|
// Initial Angular Body rates
|
||||||
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
|
cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
|
||||||
|
@ -854,9 +854,9 @@ void fgReInitSubsystems( void )
|
||||||
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = "
|
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = "
|
||||||
<< globals->get_current_view()->get_abs_view_pos());
|
<< globals->get_current_view()->get_abs_view_pos());
|
||||||
|
|
||||||
// fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
|
// fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state,
|
||||||
// 1.0 / current_options.get_model_hz() );
|
// 1.0 / globals->get_options()->get_model_hz() );
|
||||||
cur_fdm_state->init( 1.0 / current_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;
|
scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
|
||||||
|
|
||||||
|
|
|
@ -59,13 +59,13 @@ void fgReInitSubsystems( void );
|
||||||
// find basic airport location info from airport database
|
// find basic airport location info from airport database
|
||||||
bool fgFindAirportID( const string& id, FGAirport *a );
|
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 );
|
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 );
|
bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg );
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_INIT_H
|
#endif // _FG_INIT_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
#include <simgear/io/sg_socket.hxx>
|
#include <simgear/io/sg_socket.hxx>
|
||||||
#include <simgear/math/sg_types.hxx>
|
#include <simgear/math/sg_types.hxx>
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
|
||||||
|
|
||||||
#include <Network/protocol.hxx>
|
#include <Network/protocol.hxx>
|
||||||
#include <Network/native.hxx>
|
#include <Network/native.hxx>
|
||||||
#include <Network/garmin.hxx>
|
#include <Network/garmin.hxx>
|
||||||
|
@ -46,6 +44,8 @@
|
||||||
|
|
||||||
#include <Time/timestamp.hxx>
|
#include <Time/timestamp.hxx>
|
||||||
|
|
||||||
|
#include "globals.hxx"
|
||||||
|
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ static FGProtocol *parse_port_config( const string& config )
|
||||||
void fgIOInit() {
|
void fgIOInit() {
|
||||||
FGProtocol *p;
|
FGProtocol *p;
|
||||||
string_list channel_options_list =
|
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
|
// we could almost do this in a single step except pushing a valid
|
||||||
// port onto the port list copies the structure and destroys the
|
// port onto the port list copies the structure and destroys the
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <simgear/route/route.hxx>
|
#include <simgear/route/route.hxx>
|
||||||
#include <simgear/timing/sg_time.hxx>
|
#include <simgear/timing/sg_time.hxx>
|
||||||
|
|
||||||
|
#include "options.hxx"
|
||||||
#include "viewer.hxx"
|
#include "viewer.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +61,10 @@ private:
|
||||||
// Global autopilot "route"
|
// Global autopilot "route"
|
||||||
SGRoute *route;
|
SGRoute *route;
|
||||||
|
|
||||||
|
// options
|
||||||
|
FGOptions *options;
|
||||||
|
|
||||||
|
// viewers
|
||||||
FGViewer *pilot_view;
|
FGViewer *pilot_view;
|
||||||
FGViewer *current_view;
|
FGViewer *current_view;
|
||||||
|
|
||||||
|
@ -91,6 +96,9 @@ public:
|
||||||
inline SGRoute *get_route() const { return route; }
|
inline SGRoute *get_route() const { return route; }
|
||||||
inline void set_route( SGRoute *r ) { route = r; }
|
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 FGViewer *get_pilot_view() const { return pilot_view; }
|
||||||
inline void set_pilot_view( FGViewer *v ) { pilot_view = v; }
|
inline void set_pilot_view( FGViewer *v ) { pilot_view = v; }
|
||||||
|
|
||||||
|
|
|
@ -151,77 +151,93 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
// unflipping yourself :-)
|
// unflipping yourself :-)
|
||||||
{
|
{
|
||||||
double alt = cur_fdm_state->get_Altitude() + 1000;
|
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 );
|
alt * FEET_TO_METER );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 49: // numeric keypad 1
|
case 49: // numeric keypad 1
|
||||||
v->set_goal_view_offset( FG_PI * 0.75 );
|
v->set_goal_view_offset( FG_PI * 0.75 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 0.75 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.75 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 50: // numeric keypad 2
|
case 50: // numeric keypad 2
|
||||||
v->set_goal_view_offset( FG_PI );
|
v->set_goal_view_offset( FG_PI );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 51: // numeric keypad 3
|
case 51: // numeric keypad 3
|
||||||
v->set_goal_view_offset( FG_PI * 1.25 );
|
v->set_goal_view_offset( FG_PI * 1.25 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 1.25 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.25 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 52: // numeric keypad 4
|
case 52: // numeric keypad 4
|
||||||
v->set_goal_view_offset( FG_PI * 0.50 );
|
v->set_goal_view_offset( FG_PI * 0.50 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 0.50 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.50 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 54: // numeric keypad 6
|
case 54: // numeric keypad 6
|
||||||
v->set_goal_view_offset( FG_PI * 1.50 );
|
v->set_goal_view_offset( FG_PI * 1.50 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 1.50 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.50 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 55: // numeric keypad 7
|
case 55: // numeric keypad 7
|
||||||
v->set_goal_view_offset( FG_PI * 0.25 );
|
v->set_goal_view_offset( FG_PI * 0.25 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 0.25 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.25 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 56: // numeric keypad 8
|
case 56: // numeric keypad 8
|
||||||
v->set_goal_view_offset( 0.00 );
|
v->set_goal_view_offset( 0.00 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( 0.00 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
|
||||||
|
v->set_view_offset( 0.00 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 57: // numeric keypad 9
|
case 57: // numeric keypad 9
|
||||||
v->set_goal_view_offset( FG_PI * 1.75 );
|
v->set_goal_view_offset( FG_PI * 1.75 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 1.75 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.75 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 65: // A key
|
case 65: // A key
|
||||||
speed = current_options.get_speed_up();
|
speed = globals->get_options()->get_speed_up();
|
||||||
speed--;
|
speed--;
|
||||||
if ( speed < 1 ) {
|
if ( speed < 1 ) {
|
||||||
speed = 1;
|
speed = 1;
|
||||||
}
|
}
|
||||||
current_options.set_speed_up( speed );
|
globals->get_options()->set_speed_up( speed );
|
||||||
return;
|
return;
|
||||||
case 72: // H key
|
case 72: // H key
|
||||||
// status = current_options.get_hud_status();
|
// status = globals->get_options()->get_hud_status();
|
||||||
// current_options.set_hud_status(!status);
|
// globals->get_options()->set_hud_status(!status);
|
||||||
HUD_brightkey( true );
|
HUD_brightkey( true );
|
||||||
return;
|
return;
|
||||||
case 73: // I key
|
case 73: // I key
|
||||||
|
@ -233,7 +249,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
fgUpdateSkyAndLightingParams();
|
fgUpdateSkyAndLightingParams();
|
||||||
return;
|
return;
|
||||||
case 80: // P key
|
case 80: // P key
|
||||||
current_options.toggle_panel();
|
globals->get_options()->toggle_panel();
|
||||||
break;
|
break;
|
||||||
case 84: // T key
|
case 84: // T key
|
||||||
globals->inc_warp_delta( -30 );
|
globals->inc_warp_delta( -30 );
|
||||||
|
@ -249,12 +265,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
case 88: // X key
|
case 88: // X key
|
||||||
fov = current_options.get_fov();
|
fov = globals->get_options()->get_fov();
|
||||||
fov *= 1.05;
|
fov *= 1.05;
|
||||||
if ( fov > FG_FOV_MAX ) {
|
if ( fov > FG_FOV_MAX ) {
|
||||||
fov = FG_FOV_MAX;
|
fov = FG_FOV_MAX;
|
||||||
}
|
}
|
||||||
current_options.set_fov(fov);
|
globals->get_options()->set_fov(fov);
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 90: // Z key
|
case 90: // Z key
|
||||||
|
@ -342,9 +358,9 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
"Set flaps to " << controls.get_flaps() );
|
"Set flaps to " << controls.get_flaps() );
|
||||||
return;
|
return;
|
||||||
case 97: // a key
|
case 97: // a key
|
||||||
speed = current_options.get_speed_up();
|
speed = globals->get_options()->get_speed_up();
|
||||||
speed++;
|
speed++;
|
||||||
current_options.set_speed_up( speed );
|
globals->get_options()->set_speed_up( speed );
|
||||||
return;
|
return;
|
||||||
case 98: // b key
|
case 98: // b key
|
||||||
int b_ret;
|
int b_ret;
|
||||||
|
@ -383,7 +399,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
{
|
{
|
||||||
FGBucket p( f->get_Longitude() * RAD_TO_DEG,
|
FGBucket p( f->get_Longitude() * RAD_TO_DEG,
|
||||||
f->get_Latitude() * 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( "Scenery" );
|
||||||
tile_path.append( p.gen_base_path() );
|
tile_path.append( p.gen_base_path() );
|
||||||
tile_path.append( p.gen_index_str() );
|
tile_path.append( p.gen_index_str() );
|
||||||
|
@ -406,28 +422,31 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
fgUpdateSkyAndLightingParams();
|
fgUpdateSkyAndLightingParams();
|
||||||
return;
|
return;
|
||||||
case 118: // v key
|
case 118: // v key
|
||||||
// current_options.cycle_view_mode();
|
// globals->get_options()->cycle_view_mode();
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
current_options.set_view_mode(fgOPTIONS::FG_VIEW_PILOT);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_goal_view_offset( 0.0 );
|
{
|
||||||
v->set_view_offset( 0.0 );
|
globals->get_options()->set_view_mode(FGOptions::FG_VIEW_PILOT);
|
||||||
} else if (current_options.get_view_mode() ==
|
v->set_goal_view_offset( 0.0 );
|
||||||
fgOPTIONS::FG_VIEW_PILOT) {
|
v->set_view_offset( 0.0 );
|
||||||
current_options.set_view_mode(fgOPTIONS::FG_VIEW_FOLLOW);
|
} else if ( globals->get_options()->get_view_mode() ==
|
||||||
v->set_goal_view_offset( FG_PI * 1.75 );
|
FGOptions::FG_VIEW_PILOT )
|
||||||
v->set_view_offset( FG_PI * 1.75 );
|
{
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
|
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(),
|
fgReshape( globals->get_current_view()->get_winWidth(),
|
||||||
globals->get_current_view()->get_winHeight() );
|
globals->get_current_view()->get_winHeight() );
|
||||||
return;
|
return;
|
||||||
case 120: // x key
|
case 120: // x key
|
||||||
fov = current_options.get_fov();
|
fov = globals->get_options()->get_fov();
|
||||||
fov /= 1.05;
|
fov /= 1.05;
|
||||||
if ( fov < FG_FOV_MIN ) {
|
if ( fov < FG_FOV_MIN ) {
|
||||||
fov = FG_FOV_MIN;
|
fov = FG_FOV_MIN;
|
||||||
}
|
}
|
||||||
current_options.set_fov(fov);
|
globals->get_options()->set_fov(fov);
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 122: // z key
|
case 122: // z key
|
||||||
|
@ -506,7 +525,7 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case GLUT_KEY_F4: {
|
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");
|
props_path.append("preferences.xml");
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
|
FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
|
||||||
if (!readPropertyList(props_path.str(), ¤t_properties)) {
|
if (!readPropertyList(props_path.str(), ¤t_properties)) {
|
||||||
|
@ -540,58 +559,74 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
}
|
}
|
||||||
case GLUT_KEY_END: // numeric keypad 1
|
case GLUT_KEY_END: // numeric keypad 1
|
||||||
v->set_goal_view_offset( FG_PI * 0.75 );
|
v->set_goal_view_offset( FG_PI * 0.75 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW)
|
||||||
v->set_view_offset( FG_PI * 0.75 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.75 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_DOWN: // numeric keypad 2
|
case GLUT_KEY_DOWN: // numeric keypad 2
|
||||||
v->set_goal_view_offset( FG_PI );
|
v->set_goal_view_offset( FG_PI );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
|
case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
|
||||||
v->set_goal_view_offset( FG_PI * 1.25 );
|
v->set_goal_view_offset( FG_PI * 1.25 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW)
|
||||||
v->set_view_offset( FG_PI * 1.25 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.25 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_LEFT: // numeric keypad 4
|
case GLUT_KEY_LEFT: // numeric keypad 4
|
||||||
v->set_goal_view_offset( FG_PI * 0.50 );
|
v->set_goal_view_offset( FG_PI * 0.50 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 0.50 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.50 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_RIGHT: // numeric keypad 6
|
case GLUT_KEY_RIGHT: // numeric keypad 6
|
||||||
v->set_goal_view_offset( FG_PI * 1.50 );
|
v->set_goal_view_offset( FG_PI * 1.50 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 1.50 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.50 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_HOME: // numeric keypad 7
|
case GLUT_KEY_HOME: // numeric keypad 7
|
||||||
v->set_goal_view_offset( FG_PI * 0.25 );
|
v->set_goal_view_offset( FG_PI * 0.25 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 0.25 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 0.25 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_UP: // numeric keypad 8
|
case GLUT_KEY_UP: // numeric keypad 8
|
||||||
v->set_goal_view_offset( 0.00 );
|
v->set_goal_view_offset( 0.00 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( 0.00 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
|
||||||
|
v->set_view_offset( 0.00 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_PAGE_UP: // numeric keypad 9
|
case GLUT_KEY_PAGE_UP: // numeric keypad 9
|
||||||
v->set_goal_view_offset( FG_PI * 1.75 );
|
v->set_goal_view_offset( FG_PI * 1.75 );
|
||||||
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
v->set_view_offset( FG_PI * 1.75 );
|
{
|
||||||
|
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
|
||||||
|
v->set_view_offset( FG_PI * 1.75 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -635,17 +670,19 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
|
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" );
|
FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
|
||||||
} else if ( current_options.get_fog() ==
|
} else if ( globals->get_options()->get_fog() ==
|
||||||
fgOPTIONS::FG_FOG_FASTEST )
|
FGOptions::FG_FOG_FASTEST )
|
||||||
{
|
{
|
||||||
FG_LOG( FG_INPUT, FG_INFO,
|
FG_LOG( FG_INPUT, FG_INFO,
|
||||||
"Fog enabled, hint set to fastest" );
|
"Fog enabled, hint set to fastest" );
|
||||||
} else if ( current_options.get_fog() ==
|
} else if ( globals->get_options()->get_fog() ==
|
||||||
fgOPTIONS::FG_FOG_NICEST )
|
FGOptions::FG_FOG_NICEST )
|
||||||
{
|
{
|
||||||
FG_LOG( FG_INPUT, FG_INFO,
|
FG_LOG( FG_INPUT, FG_INFO,
|
||||||
"Fog enabled, hint set to nicest" );
|
"Fog enabled, hint set to nicest" );
|
||||||
|
@ -654,11 +691,11 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
case GLUT_KEY_F9: // F9 toggles textures on and off...
|
case GLUT_KEY_F9: // F9 toggles textures on and off...
|
||||||
FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
|
FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
|
||||||
if ( current_options.get_textures() ) {
|
if ( globals->get_options()->get_textures() ) {
|
||||||
current_options.set_textures( false );
|
globals->get_options()->set_textures( false );
|
||||||
material_lib.set_step( 1 );
|
material_lib.set_step( 1 );
|
||||||
} else {
|
} else {
|
||||||
current_options.set_textures( true );
|
globals->get_options()->set_textures( true );
|
||||||
material_lib.set_step( 0 );
|
material_lib.set_step( 0 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -242,7 +242,7 @@ void fgInitVisuals( void ) {
|
||||||
|
|
||||||
#ifndef GLUT_WRONG_VERSION
|
#ifndef GLUT_WRONG_VERSION
|
||||||
// Go full screen if requested ...
|
// Go full screen if requested ...
|
||||||
if ( current_options.get_fullscreen() ) {
|
if ( globals->get_options()->get_fullscreen() ) {
|
||||||
glutFullScreen();
|
glutFullScreen();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -261,14 +261,14 @@ void fgInitVisuals( void ) {
|
||||||
|
|
||||||
// glFogi (GL_FOG_MODE, GL_LINEAR);
|
// glFogi (GL_FOG_MODE, GL_LINEAR);
|
||||||
glFogi (GL_FOG_MODE, GL_EXP2);
|
glFogi (GL_FOG_MODE, GL_EXP2);
|
||||||
if ( (current_options.get_fog() == 1) ||
|
if ( (globals->get_options()->get_fog() == 1) ||
|
||||||
(current_options.get_shading() == 0) ) {
|
(globals->get_options()->get_shading() == 0) ) {
|
||||||
// if fastest fog requested, or if flat shading force fastest
|
// if fastest fog requested, or if flat shading force fastest
|
||||||
glHint ( GL_FOG_HINT, GL_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 );
|
glHint ( GL_FOG_HINT, GL_NICEST );
|
||||||
}
|
}
|
||||||
if ( current_options.get_wireframe() ) {
|
if ( globals->get_options()->get_wireframe() ) {
|
||||||
// draw wire frame
|
// draw wire frame
|
||||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void fgRenderFrame( void ) {
|
||||||
|
|
||||||
if ( idle_state != 1000 ) {
|
if ( idle_state != 1000 ) {
|
||||||
// still initializing, draw the splash screen
|
// still initializing, draw the splash screen
|
||||||
if ( current_options.get_splash_screen() == 1 ) {
|
if ( globals->get_options()->get_splash_screen() == 1 ) {
|
||||||
fgSplashUpdate(0.0);
|
fgSplashUpdate(0.0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -317,13 +317,15 @@ void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// update view volume parameters
|
// update view volume parameters
|
||||||
// cout << "before pilot_view update" << endl;
|
// cout << "before pilot_view update" << endl;
|
||||||
if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
|
if ( globals->get_options()->get_view_mode()
|
||||||
float * offset = globals->get_pilot_view()->get_pilot_offset();
|
== FGOptions::FG_VIEW_FOLLOW )
|
||||||
globals->get_current_view()->set_pilot_offset( offset[0],
|
{
|
||||||
offset[1],
|
float * offset = globals->get_pilot_view()->get_pilot_offset();
|
||||||
offset[2] );
|
globals->get_current_view()->set_pilot_offset( offset[0],
|
||||||
|
offset[1],
|
||||||
|
offset[2] );
|
||||||
} else {
|
} 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);
|
globals->get_pilot_view()->UpdateViewParams(*cur_fdm_state);
|
||||||
// cout << "after pilot_view update" << endl;
|
// cout << "after pilot_view update" << endl;
|
||||||
|
@ -333,12 +335,12 @@ void fgRenderFrame( void ) {
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
|
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
|
||||||
|
|
||||||
clear_mask = GL_DEPTH_BUFFER_BIT;
|
clear_mask = GL_DEPTH_BUFFER_BIT;
|
||||||
if ( current_options.get_wireframe() ) {
|
if ( globals->get_options()->get_wireframe() ) {
|
||||||
clear_mask |= GL_COLOR_BUFFER_BIT;
|
clear_mask |= GL_COLOR_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_options.get_skyblend() ) {
|
if ( globals->get_options()->get_skyblend() ) {
|
||||||
if ( current_options.get_textures() ) {
|
if ( globals->get_options()->get_textures() ) {
|
||||||
// glClearColor(black[0], black[1], black[2], black[3]);
|
// glClearColor(black[0], black[1], black[2], black[3]);
|
||||||
glClearColor(l->adj_fog_color[0], l->adj_fog_color[1],
|
glClearColor(l->adj_fog_color[0], l->adj_fog_color[1],
|
||||||
l->adj_fog_color[2], l->adj_fog_color[3]);
|
l->adj_fog_color[2], l->adj_fog_color[3]);
|
||||||
|
@ -382,8 +384,8 @@ void fgRenderFrame( void ) {
|
||||||
thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
|
thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
|
||||||
|
|
||||||
( global_multi_loop *
|
( global_multi_loop *
|
||||||
current_options.get_speed_up() ) /
|
globals->get_options()->get_speed_up() ) /
|
||||||
(double)current_options.get_model_hz() );
|
(double)globals->get_options()->get_model_hz() );
|
||||||
|
|
||||||
double actual_visibility = thesky->get_visibility();
|
double actual_visibility = thesky->get_visibility();
|
||||||
// cout << "actual visibility = " << actual_visibility << endl;
|
// cout << "actual visibility = " << actual_visibility << endl;
|
||||||
|
@ -407,7 +409,7 @@ void fgRenderFrame( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the sky dome
|
// update the sky dome
|
||||||
if ( current_options.get_skyblend() ) {
|
if ( globals->get_options()->get_skyblend() ) {
|
||||||
sgVec3 view_pos;
|
sgVec3 view_pos;
|
||||||
sgSetVec3( view_pos,
|
sgSetVec3( view_pos,
|
||||||
globals->get_current_view()->get_view_pos().x(),
|
globals->get_current_view()->get_view_pos().x(),
|
||||||
|
@ -471,7 +473,7 @@ void fgRenderFrame( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable( GL_DEPTH_TEST );
|
glEnable( GL_DEPTH_TEST );
|
||||||
if ( current_options.get_fog() > 0 ) {
|
if ( globals->get_options()->get_fog() > 0 ) {
|
||||||
glEnable( GL_FOG );
|
glEnable( GL_FOG );
|
||||||
glFogi( GL_FOG_MODE, GL_EXP2 );
|
glFogi( GL_FOG_MODE, GL_EXP2 );
|
||||||
glFogfv( GL_FOG_COLOR, l->adj_fog_color );
|
glFogfv( GL_FOG_COLOR, l->adj_fog_color );
|
||||||
|
@ -500,7 +502,7 @@ void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// glMatrixMode( GL_PROJECTION );
|
// glMatrixMode( GL_PROJECTION );
|
||||||
// glLoadIdentity();
|
// glLoadIdentity();
|
||||||
float fov = current_options.get_fov();
|
float fov = globals->get_options()->get_fov();
|
||||||
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
|
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
|
||||||
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
|
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
|
||||||
|
|
||||||
|
@ -516,13 +518,13 @@ void fgRenderFrame( void ) {
|
||||||
ssgSetNearFar( 0.5f, 120000.0f );
|
ssgSetNearFar( 0.5f, 120000.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_options.get_view_mode() ==
|
if ( globals->get_options()->get_view_mode() ==
|
||||||
fgOPTIONS::FG_VIEW_PILOT )
|
FGOptions::FG_VIEW_PILOT )
|
||||||
{
|
{
|
||||||
// disable TuX
|
// disable TuX
|
||||||
penguin_sel->select(0);
|
penguin_sel->select(0);
|
||||||
} else if ( current_options.get_view_mode() ==
|
} else if ( globals->get_options()->get_view_mode() ==
|
||||||
fgOPTIONS::FG_VIEW_FOLLOW )
|
FGOptions::FG_VIEW_FOLLOW )
|
||||||
{
|
{
|
||||||
// select view matrix from front of view matrix queue
|
// select view matrix from front of view matrix queue
|
||||||
// FGMat4Wrapper tmp = current_view.follow.front();
|
// FGMat4Wrapper tmp = current_view.follow.front();
|
||||||
|
@ -564,7 +566,7 @@ void fgRenderFrame( void ) {
|
||||||
// $$$ end - added VS Renganthan 17 Oct 2K
|
// $$$ end - added VS Renganthan 17 Oct 2K
|
||||||
|
|
||||||
# ifdef FG_NETWORK_OLK
|
# ifdef FG_NETWORK_OLK
|
||||||
if ( current_options.get_network_olk() ) {
|
if ( globals->get_options()->get_network_olk() ) {
|
||||||
sgCoord fgdpos;
|
sgCoord fgdpos;
|
||||||
other = head->next; /* put listpointer to start */
|
other = head->next; /* put listpointer to start */
|
||||||
while ( other != tail) { /* display all except myself */
|
while ( other != tail) { /* display all except myself */
|
||||||
|
@ -647,14 +649,15 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
current_autopilot->run();
|
current_autopilot->run();
|
||||||
|
|
||||||
// printf("updating flight model x %d\n", multi_loop);
|
// printf("updating flight model x %d\n", multi_loop);
|
||||||
/* fgFDMUpdate( current_options.get_flight_model(),
|
/* fgFDMUpdate( globals->get_options()->get_flight_model(),
|
||||||
fdm_state,
|
fdm_state,
|
||||||
multi_loop * current_options.get_speed_up(),
|
multi_loop * globals->get_options()->get_speed_up(),
|
||||||
remainder ); */
|
remainder ); */
|
||||||
cur_fdm_state->update( multi_loop * current_options.get_speed_up() );
|
cur_fdm_state->update( multi_loop *
|
||||||
FGSteam::update( multi_loop * current_options.get_speed_up() );
|
globals->get_options()->get_speed_up() );
|
||||||
|
FGSteam::update( multi_loop * globals->get_options()->get_speed_up() );
|
||||||
} else {
|
} else {
|
||||||
// fgFDMUpdate( current_options.get_flight_model(),
|
// fgFDMUpdate( globals->get_options()->get_flight_model(),
|
||||||
// fdm_state, 0, remainder );
|
// fdm_state, 0, remainder );
|
||||||
cur_fdm_state->update( 0 );
|
cur_fdm_state->update( 0 );
|
||||||
FGSteam::update( 0 );
|
FGSteam::update( 0 );
|
||||||
|
@ -669,10 +672,12 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
fdm_list.pop_front();
|
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;
|
cur_view_fdm = *cur_fdm_state;
|
||||||
// do nothing
|
// 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();
|
cur_view_fdm = fdm_list.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +689,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
globals->get_current_view()->set_view_offset( globals->get_current_view()->get_goal_view_offset() );
|
globals->get_current_view()->set_view_offset( globals->get_current_view()->get_goal_view_offset() );
|
||||||
break;
|
break;
|
||||||
} else {
|
} 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() >
|
if ( globals->get_current_view()->get_goal_view_offset() >
|
||||||
globals->get_current_view()->get_view_offset() )
|
globals->get_current_view()->get_view_offset() )
|
||||||
{
|
{
|
||||||
|
@ -697,7 +703,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( globals->get_current_view()->get_view_offset() -
|
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 );
|
globals->get_current_view()->inc_view_offset( -0.01 );
|
||||||
} else {
|
} else {
|
||||||
|
@ -713,7 +720,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
double tmp = -(l->sun_rotation + FG_PI)
|
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 ) {
|
while ( tmp < 0.0 ) {
|
||||||
tmp += FG_2PI;
|
tmp += FG_2PI;
|
||||||
}
|
}
|
||||||
|
@ -741,7 +749,7 @@ void fgInitTimeDepCalcs( void ) {
|
||||||
// initialize timer
|
// initialize timer
|
||||||
|
|
||||||
// #ifdef HAVE_SETITIMER
|
// #ifdef HAVE_SETITIMER
|
||||||
// fgTimerInit( 1.0 / current_options.get_model_hz(),
|
// fgTimerInit( 1.0 / globals->get_options()->get_model_hz(),
|
||||||
// fgUpdateTimeDepCalcs );
|
// fgUpdateTimeDepCalcs );
|
||||||
// #endif HAVE_SETITIMER
|
// #endif HAVE_SETITIMER
|
||||||
}
|
}
|
||||||
|
@ -770,7 +778,7 @@ static void fgMainLoop( void ) {
|
||||||
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
|
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
|
||||||
|
|
||||||
#ifdef FG_NETWORK_OLK
|
#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
|
if ( net_is_registered == 0 ) { // We first have to reg. to fgd
|
||||||
// printf("FGD: Netupdate\n");
|
// printf("FGD: Netupdate\n");
|
||||||
fgd_send_com( "A", FGFS_host); // Send Mat4 data
|
fgd_send_com( "A", FGFS_host); // Send Mat4 data
|
||||||
|
@ -781,7 +789,8 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
#if defined( ENABLE_PLIB_JOYSTICK )
|
#if defined( ENABLE_PLIB_JOYSTICK )
|
||||||
// Read joystick and update control settings
|
// 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();
|
fgJoystickRead();
|
||||||
}
|
}
|
||||||
#elif defined( ENABLE_GLUT_JOYSTICK )
|
#elif defined( ENABLE_GLUT_JOYSTICK )
|
||||||
|
@ -810,14 +819,15 @@ static void fgMainLoop( void ) {
|
||||||
cur_fdm_state->get_Altitude() * FEET_TO_METER,
|
cur_fdm_state->get_Altitude() * FEET_TO_METER,
|
||||||
scenery.cur_elev + alt_adjust_m - 3.0,
|
scenery.cur_elev + alt_adjust_m - 3.0,
|
||||||
scenery.cur_elev + alt_adjust_m );
|
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 );
|
scenery.cur_elev + alt_adjust_m );
|
||||||
|
|
||||||
FG_LOG( FG_ALL, FG_DEBUG,
|
FG_LOG( FG_ALL, FG_DEBUG,
|
||||||
"<*> resetting altitude to "
|
"<*> 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
|
scenery.cur_elev ); // meters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,9 +897,9 @@ static void fgMainLoop( void ) {
|
||||||
elapsed += remainder;
|
elapsed += remainder;
|
||||||
|
|
||||||
global_multi_loop = (int)(((double)elapsed * 0.000001) *
|
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) /
|
remainder = elapsed - ( (global_multi_loop*1000000) /
|
||||||
current_options.get_model_hz() );
|
globals->get_options()->get_model_hz() );
|
||||||
FG_LOG( FG_ALL, FG_DEBUG,
|
FG_LOG( FG_ALL, FG_DEBUG,
|
||||||
"Model iterations needed = " << global_multi_loop
|
"Model iterations needed = " << global_multi_loop
|
||||||
<< ", new remainder = " << remainder );
|
<< ", new remainder = " << remainder );
|
||||||
|
@ -917,9 +927,9 @@ static void fgMainLoop( void ) {
|
||||||
|
|
||||||
// Run audio scheduler
|
// Run audio scheduler
|
||||||
#ifdef ENABLE_AUDIO_SUPPORT
|
#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
|
// pitch corresponds to rpm
|
||||||
// volume corresponds to manifold pressure
|
// volume corresponds to manifold pressure
|
||||||
|
|
||||||
|
@ -989,7 +999,7 @@ static void fgIdleFunction ( void ) {
|
||||||
|
|
||||||
if ( idle_state == 0 ) {
|
if ( idle_state == 0 ) {
|
||||||
// Initialize the splash screen right away
|
// Initialize the splash screen right away
|
||||||
if ( current_options.get_splash_screen() ) {
|
if ( globals->get_options()->get_splash_screen() ) {
|
||||||
fgSplashInit();
|
fgSplashInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,9 +1007,9 @@ static void fgIdleFunction ( void ) {
|
||||||
} else if ( idle_state == 1 ) {
|
} else if ( idle_state == 1 ) {
|
||||||
// Start the intro music
|
// Start the intro music
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
if ( current_options.get_intro_music() ) {
|
if ( globals->get_options()->get_intro_music() ) {
|
||||||
string lockfile = "/tmp/mpg123.running";
|
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" );
|
mp3file.append( "Sounds/intro.mp3" );
|
||||||
|
|
||||||
string command = "(touch " + lockfile + "; mpg123 "
|
string command = "(touch " + lockfile + "; mpg123 "
|
||||||
|
@ -1054,7 +1064,7 @@ static void fgIdleFunction ( void ) {
|
||||||
#ifdef ENABLE_AUDIO_SUPPORT
|
#ifdef ENABLE_AUDIO_SUPPORT
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
if ( current_options.get_intro_music() ) {
|
if ( globals->get_options()->get_intro_music() ) {
|
||||||
// Let's wait for mpg123 to finish
|
// Let's wait for mpg123 to finish
|
||||||
string lockfile = "/tmp/mpg123.running";
|
string lockfile = "/tmp/mpg123.running";
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
@ -1070,13 +1080,13 @@ static void fgIdleFunction ( void ) {
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
if ( current_options.get_sound() ) {
|
if ( globals->get_options()->get_sound() ) {
|
||||||
audio_sched = new slScheduler ( 8000 );
|
audio_sched = new slScheduler ( 8000 );
|
||||||
audio_mixer = new smMixer;
|
audio_mixer = new smMixer;
|
||||||
audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
|
audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
|
||||||
audio_sched -> setSafetyMargin ( 1.0 ) ;
|
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" );
|
slfile.append( "Sounds/wasp.wav" );
|
||||||
|
|
||||||
s1 = new slSample ( (char *)slfile.c_str() );
|
s1 = new slSample ( (char *)slfile.c_str() );
|
||||||
|
@ -1118,7 +1128,7 @@ static void fgIdleFunction ( void ) {
|
||||||
|
|
||||||
fgMainLoop();
|
fgMainLoop();
|
||||||
} else {
|
} else {
|
||||||
if ( current_options.get_splash_screen() == 1 ) {
|
if ( globals->get_options()->get_splash_screen() == 1 ) {
|
||||||
fgSplashUpdate(0.0);
|
fgSplashUpdate(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1128,13 +1138,15 @@ static void fgIdleFunction ( void ) {
|
||||||
// Handle new window size or exposure
|
// Handle new window size or exposure
|
||||||
void fgReshape( int width, int height ) {
|
void fgReshape( int width, int height ) {
|
||||||
if ( ! fgPanelVisible() || idle_state != 1000 ) {
|
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) );
|
glViewport(0, 0 , (GLint)(width), (GLint)(height) );
|
||||||
} else {
|
} else {
|
||||||
int view_h =
|
int view_h =
|
||||||
int((current_panel->getViewHeight() - current_panel->getYOffset())
|
int((current_panel->getViewHeight() - current_panel->getYOffset())
|
||||||
* (height / 768.0)) + 1;
|
* (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),
|
glViewport(0, (GLint)(height - view_h),
|
||||||
(GLint)(width), (GLint)(view_h) );
|
(GLint)(width), (GLint)(view_h) );
|
||||||
}
|
}
|
||||||
|
@ -1144,12 +1156,12 @@ void fgReshape( int width, int height ) {
|
||||||
globals->get_current_view()->force_update_fov_math();
|
globals->get_current_view()->force_update_fov_math();
|
||||||
|
|
||||||
// set these fov to be the same as in fgRenderFrame()
|
// 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();
|
// float y_fov = x_fov * 1.0 / current_view.get_win_ratio();
|
||||||
// ssgSetFOV( x_fov, y_fov );
|
// ssgSetFOV( x_fov, y_fov );
|
||||||
|
|
||||||
// glViewport ( 0, 0, width, height );
|
// 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 * current_view.get_win_ratio(), fov);
|
||||||
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
|
ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
|
||||||
|
|
||||||
|
@ -1177,14 +1189,15 @@ int fgGlutInit( int *argc, char **argv ) {
|
||||||
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO, "Opening a window: " <<
|
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
|
// Define initial window size
|
||||||
glutInitWindowSize( current_options.get_xsize(),
|
glutInitWindowSize( globals->get_options()->get_xsize(),
|
||||||
current_options.get_ysize() );
|
globals->get_options()->get_ysize() );
|
||||||
|
|
||||||
// Initialize windows
|
// Initialize windows
|
||||||
if ( current_options.get_game_mode() == 0 ) {
|
if ( globals->get_options()->get_game_mode() == 0 ) {
|
||||||
// Open the regular window
|
// Open the regular window
|
||||||
glutCreateWindow("FlightGear");
|
glutCreateWindow("FlightGear");
|
||||||
#ifndef GLUT_WRONG_VERSION
|
#ifndef GLUT_WRONG_VERSION
|
||||||
|
@ -1192,9 +1205,9 @@ int fgGlutInit( int *argc, char **argv ) {
|
||||||
// Open the cool new 'game mode' window
|
// Open the cool new 'game mode' window
|
||||||
char game_mode_str[256];
|
char game_mode_str[256];
|
||||||
sprintf( game_mode_str, "width=%d height=%d bpp=%d",
|
sprintf( game_mode_str, "width=%d height=%d bpp=%d",
|
||||||
current_options.get_xsize(),
|
globals->get_options()->get_xsize(),
|
||||||
current_options.get_ysize(),
|
globals->get_options()->get_ysize(),
|
||||||
current_options.get_bpp());
|
globals->get_options()->get_bpp());
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"game mode params = " << game_mode_str );
|
"game mode params = " << game_mode_str );
|
||||||
|
@ -1228,16 +1241,16 @@ int fgGlutInit( int *argc, char **argv ) {
|
||||||
// probably a voodoo-2
|
// probably a voodoo-2
|
||||||
if ( renderer.find( "TMU/SLI" ) != string::npos ) {
|
if ( renderer.find( "TMU/SLI" ) != string::npos ) {
|
||||||
// probably two SLI'd Voodoo-2's
|
// probably two SLI'd Voodoo-2's
|
||||||
current_options.set_xsize( 1024 );
|
globals->get_options()->set_xsize( 1024 );
|
||||||
current_options.set_ysize( 768 );
|
globals->get_options()->set_ysize( 768 );
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"It looks like you have two sli'd voodoo-2's." << endl
|
"It looks like you have two sli'd voodoo-2's." << endl
|
||||||
<< "upgrading your win resolution to 1024 x 768" );
|
<< "upgrading your win resolution to 1024 x 768" );
|
||||||
glutReshapeWindow(1024, 768);
|
glutReshapeWindow(1024, 768);
|
||||||
} else {
|
} else {
|
||||||
// probably a single non-SLI'd Voodoo-2
|
// probably a single non-SLI'd Voodoo-2
|
||||||
current_options.set_xsize( 800 );
|
globals->get_options()->set_xsize( 800 );
|
||||||
current_options.set_ysize( 600 );
|
globals->get_options()->set_ysize( 600 );
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"It looks like you have a voodoo-2." << endl
|
"It looks like you have a voodoo-2." << endl
|
||||||
<< "upgrading your win resolution to 800 x 600" );
|
<< "upgrading your win resolution to 800 x 600" );
|
||||||
|
@ -1302,14 +1315,28 @@ int main( int argc, char **argv ) {
|
||||||
// seed the random number generater
|
// seed the random number generater
|
||||||
fg_srandom();
|
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
|
// Scan the config file(s) and command line options to see if
|
||||||
// fg_root was specified (ignore all other options for now)
|
// fg_root was specified (ignore all other options for now)
|
||||||
fgInitFGRoot(argc, argv);
|
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
|
// 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");
|
props_path.append("preferences.xml");
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "Reading global preferences");
|
FG_LOG(FG_INPUT, FG_INFO, "Reading global preferences");
|
||||||
if (!readPropertyList(props_path.str(), ¤t_properties)) {
|
if (!readPropertyList(props_path.str(), ¤t_properties)) {
|
||||||
|
@ -1319,20 +1346,11 @@ int main( int argc, char **argv ) {
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
|
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)
|
// Initialize the Aircraft directory to "" (UIUC)
|
||||||
aircraft_dir = "";
|
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
|
// Load the configuration parameters
|
||||||
if ( !fgInitConfig(argc, argv) ) {
|
if ( !fgInitConfig(argc, argv) ) {
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );
|
FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );
|
||||||
|
@ -1362,18 +1380,18 @@ int main( int argc, char **argv ) {
|
||||||
guiInit();
|
guiInit();
|
||||||
|
|
||||||
// set current_options lon/lat if an airport id is specified
|
// set current_options lon/lat if an airport id is specified
|
||||||
// cout << "3. airport_id = " << current_options.get_airport_id() << endl;
|
// cout << "3. airport_id = " << globals->get_options()->get_airport_id() << endl;
|
||||||
if ( current_options.get_airport_id().length() ) {
|
if ( globals->get_options()->get_airport_id().length() ) {
|
||||||
// fgSetPosFromAirportID( current_options.get_airport_id() );
|
// fgSetPosFromAirportID( globals->get_options()->get_airport_id() );
|
||||||
fgSetPosFromAirportIDandHdg( current_options.get_airport_id(),
|
fgSetPosFromAirportIDandHdg( globals->get_options()->get_airport_id(),
|
||||||
current_options.get_heading() );
|
globals->get_options()->get_heading() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize time
|
// Initialize time
|
||||||
FGPath zone( current_options.get_fg_root() );
|
FGPath zone( globals->get_options()->get_fg_root() );
|
||||||
zone.append( "Timezone" );
|
zone.append( "Timezone" );
|
||||||
SGTime *t = new SGTime( current_options.get_lon() * DEG_TO_RAD,
|
SGTime *t = new SGTime( globals->get_options()->get_lon() * DEG_TO_RAD,
|
||||||
current_options.get_lat() * DEG_TO_RAD,
|
globals->get_options()->get_lat() * DEG_TO_RAD,
|
||||||
zone.str() );
|
zone.str() );
|
||||||
|
|
||||||
// Handle potential user specified time offsets
|
// Handle potential user specified time offsets
|
||||||
|
@ -1384,27 +1402,29 @@ int main( int argc, char **argv ) {
|
||||||
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
|
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
|
||||||
|
|
||||||
// Okay, we now have six possible scenarios
|
// Okay, we now have six possible scenarios
|
||||||
switch ( current_options.get_time_offset_type() ) {
|
switch ( globals->get_options()->get_time_offset_type() ) {
|
||||||
case fgOPTIONS::FG_TIME_SYS_OFFSET:
|
case FGOptions::FG_TIME_SYS_OFFSET:
|
||||||
globals->set_warp( current_options.get_time_offset() );
|
globals->set_warp( globals->get_options()->get_time_offset() );
|
||||||
break;
|
break;
|
||||||
case fgOPTIONS::FG_TIME_GMT_OFFSET:
|
case FGOptions::FG_TIME_GMT_OFFSET:
|
||||||
globals->set_warp( current_options.get_time_offset() -
|
globals->set_warp( globals->get_options()->get_time_offset() -
|
||||||
(currGMT - systemLocalTime) );
|
(currGMT - systemLocalTime) );
|
||||||
break;
|
break;
|
||||||
case fgOPTIONS::FG_TIME_LAT_OFFSET:
|
case FGOptions::FG_TIME_LAT_OFFSET:
|
||||||
globals->set_warp( current_options.get_time_offset() -
|
globals->set_warp( globals->get_options()->get_time_offset() -
|
||||||
(aircraftLocalTime - systemLocalTime) );
|
(aircraftLocalTime - systemLocalTime) );
|
||||||
break;
|
break;
|
||||||
case fgOPTIONS::FG_TIME_SYS_ABSOLUTE:
|
case FGOptions::FG_TIME_SYS_ABSOLUTE:
|
||||||
globals->set_warp( current_options.get_time_offset() - cur_time );
|
globals->set_warp( globals->get_options()->get_time_offset() -
|
||||||
|
cur_time );
|
||||||
//printf("warp = %d\n", warp);
|
//printf("warp = %d\n", warp);
|
||||||
break;
|
break;
|
||||||
case fgOPTIONS::FG_TIME_GMT_ABSOLUTE:
|
case FGOptions::FG_TIME_GMT_ABSOLUTE:
|
||||||
globals->set_warp( current_options.get_time_offset() - currGMT );
|
globals->set_warp( globals->get_options()->get_time_offset() -
|
||||||
|
currGMT );
|
||||||
break;
|
break;
|
||||||
case fgOPTIONS::FG_TIME_LAT_ABSOLUTE:
|
case FGOptions::FG_TIME_LAT_ABSOLUTE:
|
||||||
globals->set_warp( current_options.get_time_offset() -
|
globals->set_warp( globals->get_options()->get_time_offset() -
|
||||||
(aircraftLocalTime - systemLocalTime) -
|
(aircraftLocalTime - systemLocalTime) -
|
||||||
cur_time );
|
cur_time );
|
||||||
break;
|
break;
|
||||||
|
@ -1434,11 +1454,11 @@ int main( int argc, char **argv ) {
|
||||||
// distribution) specifically from the ssg tux example
|
// 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( "Models" );
|
||||||
// modelpath.append( "Geometry" );
|
// modelpath.append( "Geometry" );
|
||||||
|
|
||||||
FGPath texturepath( current_options.get_fg_root() );
|
FGPath texturepath( globals->get_options()->get_fg_root() );
|
||||||
texturepath.append( "Models" );
|
texturepath.append( "Models" );
|
||||||
texturepath.append( "Textures" );
|
texturepath.append( "Textures" );
|
||||||
|
|
||||||
|
@ -1450,7 +1470,7 @@ int main( int argc, char **argv ) {
|
||||||
scene->setName( "Scene" );
|
scene->setName( "Scene" );
|
||||||
|
|
||||||
// Initialize the sky
|
// 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" );
|
ephem_data_path.append( "Astro" );
|
||||||
SGEphemeris *ephem = new SGEphemeris( ephem_data_path.c_str() );
|
SGEphemeris *ephem = new SGEphemeris( ephem_data_path.c_str() );
|
||||||
ephem->update( globals->get_time_params()->getMjd(),
|
ephem->update( globals->get_time_params()->getMjd(),
|
||||||
|
@ -1458,7 +1478,7 @@ int main( int argc, char **argv ) {
|
||||||
0.0 );
|
0.0 );
|
||||||
globals->set_ephem( ephem );
|
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( "Textures" );
|
||||||
sky_tex_path.append( "Sky" );
|
sky_tex_path.append( "Sky" );
|
||||||
thesky = new SGSky;
|
thesky = new SGSky;
|
||||||
|
@ -1470,7 +1490,7 @@ int main( int argc, char **argv ) {
|
||||||
globals->get_ephem()->getNumStars(),
|
globals->get_ephem()->getNumStars(),
|
||||||
globals->get_ephem()->getStars(), 60000.0 );
|
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,
|
thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
|
||||||
SG_CLOUD_MOSTLY_SUNNY );
|
SG_CLOUD_MOSTLY_SUNNY );
|
||||||
thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
|
thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
|
||||||
|
@ -1524,7 +1544,7 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
#ifdef FG_NETWORK_OLK
|
#ifdef FG_NETWORK_OLK
|
||||||
// Do the network intialization
|
// 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 ) );
|
printf("Multipilot mode %s\n", fg_net_init( scene ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1548,7 +1568,7 @@ void fgLoadDCS(void) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
string obj_filename;
|
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( "Scenery" );
|
||||||
tile_path.append( "Objects.txt" );
|
tile_path.append( "Objects.txt" );
|
||||||
fg_gzifstream in( tile_path.str() );
|
fg_gzifstream in( tile_path.str() );
|
||||||
|
@ -1556,11 +1576,11 @@ void fgLoadDCS(void) {
|
||||||
FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << 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( "Models" );
|
||||||
modelpath.append( "Geometry" );
|
modelpath.append( "Geometry" );
|
||||||
|
|
||||||
FGPath texturepath( current_options.get_fg_root() );
|
FGPath texturepath( globals->get_options()->get_fg_root() );
|
||||||
texturepath.append( "Models" );
|
texturepath.append( "Models" );
|
||||||
texturepath.append( "Textures" );
|
texturepath.append( "Textures" );
|
||||||
|
|
||||||
|
|
|
@ -88,11 +88,11 @@ atoi( const string& str )
|
||||||
|
|
||||||
|
|
||||||
// Defined the shared options class here
|
// Defined the shared options class here
|
||||||
fgOPTIONS current_options;
|
// FGOptions current_options;
|
||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
fgOPTIONS::fgOPTIONS() :
|
FGOptions::FGOptions() :
|
||||||
// starting longitude in degrees (west = -)
|
// starting longitude in degrees (west = -)
|
||||||
// starting latitude in degrees (south = -)
|
// starting latitude in degrees (south = -)
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
|
|
||||||
// Rendering options
|
// Rendering options
|
||||||
fog(FG_FOG_NICEST), // nicest
|
fog(FG_FOG_NICEST), // nicest
|
||||||
clouds(false),
|
clouds(true),
|
||||||
clouds_asl(5000*FEET_TO_METER),
|
clouds_asl(5000*FEET_TO_METER),
|
||||||
fov(55.0),
|
fov(55.0),
|
||||||
fullscreen(0),
|
fullscreen(0),
|
||||||
|
@ -185,6 +185,10 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
wireframe(0),
|
wireframe(0),
|
||||||
xsize(800),
|
xsize(800),
|
||||||
ysize(600),
|
ysize(600),
|
||||||
|
xmin(0),
|
||||||
|
ymin(0),
|
||||||
|
xmax(800),
|
||||||
|
ymax(600),
|
||||||
bpp(16),
|
bpp(16),
|
||||||
view_mode(FG_VIEW_PILOT),
|
view_mode(FG_VIEW_PILOT),
|
||||||
default_view_offset(0),
|
default_view_offset(0),
|
||||||
|
@ -243,7 +247,7 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fgOPTIONS::toggle_panel() {
|
FGOptions::toggle_panel() {
|
||||||
|
|
||||||
bool freeze = globals->get_freeze();
|
bool freeze = globals->get_freeze();
|
||||||
|
|
||||||
|
@ -276,7 +280,7 @@ fgOPTIONS::toggle_panel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
fgOPTIONS::parse_time(const string& time_in) {
|
FGOptions::parse_time(const string& time_in) {
|
||||||
char *time_str, num[256];
|
char *time_str, num[256];
|
||||||
double hours, minutes, seconds;
|
double hours, minutes, seconds;
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
|
@ -354,7 +358,7 @@ fgOPTIONS::parse_time(const string& time_in) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long int fgOPTIONS::parse_date( const string& date)
|
long int FGOptions::parse_date( const string& date)
|
||||||
{
|
{
|
||||||
struct tm gmt;
|
struct tm gmt;
|
||||||
char * date_str, num[256];
|
char * date_str, num[256];
|
||||||
|
@ -462,7 +466,7 @@ long int fgOPTIONS::parse_date( const string& date)
|
||||||
|
|
||||||
|
|
||||||
// parse degree in the form of [+/-]hhh:mm:ss
|
// 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" ) {
|
if ( mode == "joystick" ) {
|
||||||
control_mode = FG_JOYSTICK;
|
control_mode = FG_JOYSTICK;
|
||||||
} else if ( mode == "mouse" ) {
|
} else if ( mode == "mouse" ) {
|
||||||
|
@ -475,7 +479,7 @@ void fgOPTIONS::parse_control( const string& mode ) {
|
||||||
|
|
||||||
/// parse degree in the form of [+/-]hhh:mm:ss
|
/// parse degree in the form of [+/-]hhh:mm:ss
|
||||||
double
|
double
|
||||||
fgOPTIONS::parse_degree( const string& degree_str) {
|
FGOptions::parse_degree( const string& degree_str) {
|
||||||
double result = parse_time( degree_str );
|
double result = parse_time( degree_str );
|
||||||
|
|
||||||
// printf("Degree = %.4f\n", result);
|
// printf("Degree = %.4f\n", result);
|
||||||
|
@ -486,7 +490,7 @@ fgOPTIONS::parse_degree( const string& degree_str) {
|
||||||
|
|
||||||
// parse time offset command line option
|
// parse time offset command line option
|
||||||
int
|
int
|
||||||
fgOPTIONS::parse_time_offset( const string& time_str) {
|
FGOptions::parse_time_offset( const string& time_str) {
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
// printf("time offset = %s\n", time_str);
|
// printf("time offset = %s\n", time_str);
|
||||||
|
@ -506,7 +510,7 @@ fgOPTIONS::parse_time_offset( const string& time_str) {
|
||||||
// Parse --tile-diameter=n type option
|
// Parse --tile-diameter=n type option
|
||||||
|
|
||||||
int
|
int
|
||||||
fgOPTIONS::parse_tile_radius( const string& arg ) {
|
FGOptions::parse_tile_radius( const string& arg ) {
|
||||||
int radius = atoi( arg );
|
int radius = atoi( arg );
|
||||||
|
|
||||||
if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
|
if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
|
||||||
|
@ -520,7 +524,7 @@ fgOPTIONS::parse_tile_radius( const string& arg ) {
|
||||||
|
|
||||||
// Parse --fdm=abcdefg type option
|
// Parse --fdm=abcdefg type option
|
||||||
int
|
int
|
||||||
fgOPTIONS::parse_fdm( const string& fm ) {
|
FGOptions::parse_fdm( const string& fm ) {
|
||||||
// cout << "fdm = " << fm << endl;
|
// cout << "fdm = " << fm << endl;
|
||||||
|
|
||||||
if ( fm == "ada" ) {
|
if ( fm == "ada" ) {
|
||||||
|
@ -547,7 +551,7 @@ fgOPTIONS::parse_fdm( const string& fm ) {
|
||||||
|
|
||||||
// Parse --fov=x.xx type option
|
// Parse --fov=x.xx type option
|
||||||
double
|
double
|
||||||
fgOPTIONS::parse_fov( const string& arg ) {
|
FGOptions::parse_fov( const string& arg ) {
|
||||||
double fov = atof(arg);
|
double fov = atof(arg);
|
||||||
|
|
||||||
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
|
||||||
|
@ -585,7 +589,7 @@ fgOPTIONS::parse_fov( const string& arg ) {
|
||||||
// filename = file system file name
|
// filename = file system file name
|
||||||
|
|
||||||
bool
|
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;
|
// cout << "Channel string = " << channel_str << endl;
|
||||||
|
|
||||||
channel_options_list.push_back( type + "," + channel_str );
|
channel_options_list.push_back( type + "," + channel_str );
|
||||||
|
@ -595,7 +599,7 @@ fgOPTIONS::parse_channel( const string& type, const string& channel_str ) {
|
||||||
|
|
||||||
|
|
||||||
// Parse --wp=ID[,alt]
|
// Parse --wp=ID[,alt]
|
||||||
bool fgOPTIONS::parse_wp( const string& arg ) {
|
bool FGOptions::parse_wp( const string& arg ) {
|
||||||
string id, alt_str;
|
string id, alt_str;
|
||||||
double alt = 0.0;
|
double alt = 0.0;
|
||||||
|
|
||||||
|
@ -625,7 +629,7 @@ bool fgOPTIONS::parse_wp( const string& arg ) {
|
||||||
|
|
||||||
|
|
||||||
// Parse a single option
|
// Parse a single option
|
||||||
int fgOPTIONS::parse_option( const string& arg ) {
|
int FGOptions::parse_option( const string& arg ) {
|
||||||
// General Options
|
// General Options
|
||||||
if ( (arg == "--help") || (arg == "-h") ) {
|
if ( (arg == "--help") || (arg == "-h") ) {
|
||||||
// help/usage request
|
// help/usage request
|
||||||
|
@ -822,6 +826,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
|
||||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||||
"Setting geometry to " << xsize << 'x' << ysize << '\n');
|
"Setting geometry to " << xsize << 'x' << ysize << '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xmin = ymin = 0;
|
||||||
|
xmax = xsize;
|
||||||
|
ymax = ysize;
|
||||||
} else if ( arg.find( "--bpp=" ) != string::npos ) {
|
} else if ( arg.find( "--bpp=" ) != string::npos ) {
|
||||||
string bits_per_pix = arg.substr( 6 );
|
string bits_per_pix = arg.substr( 6 );
|
||||||
if ( bits_per_pix == "16" ) {
|
if ( bits_per_pix == "16" ) {
|
||||||
|
@ -926,7 +934,7 @@ int fgOPTIONS::parse_option( const string& arg ) {
|
||||||
|
|
||||||
// Scan the command line options for an fg_root definition and set
|
// Scan the command line options for an fg_root definition and set
|
||||||
// just that.
|
// 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 i = 1;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
@ -948,7 +956,7 @@ int fgOPTIONS::scan_command_line_for_root( int argc, char **argv ) {
|
||||||
|
|
||||||
|
|
||||||
// Scan the config file for an fg_root definition and set just that.
|
// 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 );
|
fg_gzifstream in( path );
|
||||||
if ( !in.is_open() )
|
if ( !in.is_open() )
|
||||||
return(FG_OPTIONS_ERROR);
|
return(FG_OPTIONS_ERROR);
|
||||||
|
@ -985,7 +993,7 @@ int fgOPTIONS::scan_config_file_for_root( const string& path ) {
|
||||||
|
|
||||||
|
|
||||||
// Parse the command line options
|
// 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 i = 1;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
@ -1007,7 +1015,7 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
|
||||||
|
|
||||||
|
|
||||||
// Parse config file options
|
// Parse config file options
|
||||||
int fgOPTIONS::parse_config_file( const string& path ) {
|
int FGOptions::parse_config_file( const string& path ) {
|
||||||
fg_gzifstream in( path );
|
fg_gzifstream in( path );
|
||||||
if ( !in.is_open() )
|
if ( !in.is_open() )
|
||||||
return(FG_OPTIONS_ERROR);
|
return(FG_OPTIONS_ERROR);
|
||||||
|
@ -1046,7 +1054,7 @@ int fgOPTIONS::parse_config_file( const string& path ) {
|
||||||
|
|
||||||
|
|
||||||
// Print usage message
|
// Print usage message
|
||||||
void fgOPTIONS::usage ( void ) {
|
void FGOptions::usage ( void ) {
|
||||||
cout << "Usage: fg [ options ... ]" << endl;
|
cout << "Usage: fg [ options ... ]" << endl;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
|
@ -1195,5 +1203,5 @@ void fgOPTIONS::usage ( void ) {
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
fgOPTIONS::~fgOPTIONS( void ) {
|
FGOptions::~FGOptions( void ) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ FG_USING_STD(string);
|
||||||
#define NEW_DEFAULT_MODEL_HZ 120
|
#define NEW_DEFAULT_MODEL_HZ 120
|
||||||
|
|
||||||
|
|
||||||
class fgOPTIONS {
|
class FGOptions {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -180,6 +180,8 @@ private:
|
||||||
bool textures; // Textures enabled/disabled
|
bool textures; // Textures enabled/disabled
|
||||||
bool wireframe; // Wireframe mode enabled/disabled
|
bool wireframe; // Wireframe mode enabled/disabled
|
||||||
int xsize, ysize; // window size derived from geometry string
|
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
|
int bpp; // bits per pixel
|
||||||
fgViewMode view_mode; // view mode
|
fgViewMode view_mode; // view mode
|
||||||
double default_view_offset; // default forward view offset (for use by
|
double default_view_offset; // default forward view offset (for use by
|
||||||
|
@ -212,8 +214,8 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
fgOPTIONS();
|
FGOptions();
|
||||||
~fgOPTIONS();
|
~FGOptions();
|
||||||
|
|
||||||
// Parse a single option
|
// Parse a single option
|
||||||
int parse_option( const string& arg );
|
int parse_option( const string& arg );
|
||||||
|
@ -286,6 +288,10 @@ public:
|
||||||
inline bool get_wireframe() const { return wireframe; }
|
inline bool get_wireframe() const { return wireframe; }
|
||||||
inline int get_xsize() const { return xsize; }
|
inline int get_xsize() const { return xsize; }
|
||||||
inline int get_ysize() const { return ysize; }
|
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 int get_bpp() const { return bpp; }
|
||||||
inline fgViewMode get_view_mode() const { return view_mode; }
|
inline fgViewMode get_view_mode() const { return view_mode; }
|
||||||
inline double get_default_view_offset() const {
|
inline double get_default_view_offset() const {
|
||||||
|
@ -395,7 +401,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern fgOPTIONS current_options;
|
// extern FGOptions current_options;
|
||||||
|
|
||||||
|
|
||||||
#endif /* _OPTIONS_HXX */
|
#endif /* _OPTIONS_HXX */
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include <simgear/math/fg_random.h>
|
#include <simgear/math/fg_random.h>
|
||||||
#include <simgear/misc/fgpath.hxx>
|
#include <simgear/misc/fgpath.hxx>
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
|
||||||
#include <Objects/texload.h>
|
#include <Objects/texload.h>
|
||||||
|
|
||||||
#include "globals.hxx"
|
#include "globals.hxx"
|
||||||
|
@ -79,7 +78,7 @@ void fgSplashInit ( void ) {
|
||||||
char num_str[256];
|
char num_str[256];
|
||||||
sprintf(num_str, "%d", num);
|
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.append( "Textures/Splash" );
|
||||||
tpath.concat( num_str );
|
tpath.concat( num_str );
|
||||||
tpath.concat( ".rgb" );
|
tpath.concat( ".rgb" );
|
||||||
|
|
|
@ -83,11 +83,11 @@ inline static void fgMakeViewRot( sgMat4 dst, const sgMat4 m1, const sgMat4 m2 )
|
||||||
void FGViewer::Init( void ) {
|
void FGViewer::Init( void ) {
|
||||||
FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
|
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 );
|
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
|
||||||
|
|
||||||
winWidth = current_options.get_xsize();
|
winWidth = globals->get_options()->get_xsize();
|
||||||
winHeight = current_options.get_ysize();
|
winHeight = globals->get_options()->get_ysize();
|
||||||
|
|
||||||
set_win_ratio( winHeight / winWidth );
|
set_win_ratio( winHeight / winWidth );
|
||||||
|
|
||||||
|
@ -189,8 +189,8 @@ void FGViewer::UpdateViewMath( const FGInterface& f ) {
|
||||||
sgMat4 VIEWo, TMP;
|
sgMat4 VIEWo, TMP;
|
||||||
|
|
||||||
if ( update_fov ) {
|
if ( update_fov ) {
|
||||||
ssgSetFOV( current_options.get_fov(),
|
ssgSetFOV( globals->get_options()->get_fov(),
|
||||||
current_options.get_fov() * win_ratio );
|
globals->get_options()->get_fov() * win_ratio );
|
||||||
update_fov = false;
|
update_fov = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ public:
|
||||||
void UpdateViewMath( const FGInterface& f );
|
void UpdateViewMath( const FGInterface& f );
|
||||||
|
|
||||||
// Update the field of view coefficients
|
// 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
|
// Transform a vector from world coordinates to the local plane
|
||||||
void CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src);
|
void CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src);
|
||||||
|
|
|
@ -61,10 +61,11 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
|
||||||
#include <plib/sg.h>
|
#include <plib/sg.h>
|
||||||
#include <plib/ssg.h>
|
#include <plib/ssg.h>
|
||||||
|
|
||||||
|
#include <Main/globals.hxx>
|
||||||
|
|
||||||
int net_blast_toggle, net_hud_display, net_is_registered;
|
int net_blast_toggle, net_hud_display, net_is_registered;
|
||||||
char *net_callsign, *FGFS_host;
|
char *net_callsign, *FGFS_host;
|
||||||
sgMat4 sgFGD_VIEW;
|
sgMat4 sgFGD_VIEW;
|
||||||
|
@ -79,7 +80,7 @@ char *fg_net_init( ssgRoot *orig_scene ){
|
||||||
// We enable display of netinfos only if user wishes it via cmd-line param
|
// We enable display of netinfos only if user wishes it via cmd-line param
|
||||||
net_hud_display = (net_hud_display == 0) ? 0 : 1;
|
net_hud_display = (net_hud_display == 0) ? 0 : 1;
|
||||||
// Get pilot's name from options, can be modified at runtime via menu
|
// 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
|
// Disable Blast Mode -1 = Disable, 0 = Enable
|
||||||
net_blast_toggle = -1;
|
net_blast_toggle = -1;
|
||||||
// We start unregistered, we reg. later via menu to fgd
|
// We start unregistered, we reg. later via menu to fgd
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <simgear/misc/fgstream.hxx>
|
#include <simgear/misc/fgstream.hxx>
|
||||||
|
|
||||||
#include <Include/general.hxx>
|
#include <Include/general.hxx>
|
||||||
#include <Main/options.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Scenery/tileentry.hxx>
|
#include <Scenery/tileentry.hxx>
|
||||||
|
|
||||||
#include "matlib.hxx"
|
#include "matlib.hxx"
|
||||||
|
@ -118,14 +118,14 @@ bool FGMaterialLib::load( const string& mpath ) {
|
||||||
in >> m;
|
in >> m;
|
||||||
|
|
||||||
// build the ssgSimpleState
|
// 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" );
|
tex_path.append( "Textures.high" );
|
||||||
|
|
||||||
FGPath tmp_path = tex_path;
|
FGPath tmp_path = tex_path;
|
||||||
tmp_path.append( m.get_texture_name() );
|
tmp_path.append( m.get_texture_name() );
|
||||||
if ( ! local_file_exists(tmp_path.str())
|
if ( ! local_file_exists(tmp_path.str())
|
||||||
|| general.get_glMaxTexSize() < 512 ) {
|
|| 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" );
|
tex_path.append( "Textures" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,14 +133,14 @@ bool FGMaterialLib::load( const string& mpath ) {
|
||||||
<< material_name << " (" << tex_path.c_str() << ")");
|
<< material_name << " (" << tex_path.c_str() << ")");
|
||||||
|
|
||||||
GLenum shade_model = GL_SMOOTH;
|
GLenum shade_model = GL_SMOOTH;
|
||||||
if ( current_options.get_shading() == 1 ) {
|
if ( globals->get_options()->get_shading() == 1 ) {
|
||||||
shade_model = GL_SMOOTH;
|
shade_model = GL_SMOOTH;
|
||||||
} else {
|
} else {
|
||||||
shade_model = GL_FLAT;
|
shade_model = GL_FLAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
m.build_ssg_state( tex_path.str(), shade_model,
|
m.build_ssg_state( tex_path.str(), shade_model,
|
||||||
current_options.get_textures() );
|
globals->get_options()->get_textures() );
|
||||||
|
|
||||||
#if EXTRA_DEBUG
|
#if EXTRA_DEBUG
|
||||||
m.dump_info();
|
m.dump_info();
|
||||||
|
@ -182,13 +182,14 @@ bool FGMaterialLib::add_item ( const string &mat_name, const string &full_path )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLenum shade_model = GL_SMOOTH;
|
GLenum shade_model = GL_SMOOTH;
|
||||||
if ( current_options.get_shading() == 1 ) {
|
if ( globals->get_options()->get_shading() == 1 ) {
|
||||||
shade_model = GL_SMOOTH;
|
shade_model = GL_SMOOTH;
|
||||||
} else {
|
} else {
|
||||||
shade_model = GL_FLAT;
|
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;
|
material_lib.matlib[mat_name] = m;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
#include <simgear/misc/stopwatch.hxx>
|
#include <simgear/misc/stopwatch.hxx>
|
||||||
#include <simgear/misc/texcoord.hxx>
|
#include <simgear/misc/texcoord.hxx>
|
||||||
|
|
||||||
#include <Main/options.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Scenery/tileentry.hxx>
|
#include <Scenery/tileentry.hxx>
|
||||||
|
|
||||||
#include "matlib.hxx"
|
#include "matlib.hxx"
|
||||||
|
@ -259,7 +259,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
|
||||||
leaf->setState( state );
|
leaf->setState( state );
|
||||||
|
|
||||||
tile->addKid( leaf );
|
tile->addKid( leaf );
|
||||||
// if ( current_options.get_clouds() ) {
|
// if ( globals->get_options()->get_clouds() ) {
|
||||||
// fgGenCloudTile(path, t, tile);
|
// fgGenCloudTile(path, t, tile);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ ssgBranch *fgObjLoad( const string& path, FGTileEntry *t, const bool is_base) {
|
||||||
return fgGenTile( path, t );
|
return fgGenTile( path, t );
|
||||||
}
|
}
|
||||||
|
|
||||||
shading = current_options.get_shading();
|
shading = globals->get_options()->get_shading();
|
||||||
|
|
||||||
if ( is_base ) {
|
if ( is_base ) {
|
||||||
t->ncount = 0;
|
t->ncount = 0;
|
||||||
|
@ -691,7 +691,7 @@ ssgBranch *fgObjLoad( const string& path, FGTileEntry *t, const bool is_base) {
|
||||||
<< stopwatch.elapsedSeconds() << " seconds" );
|
<< stopwatch.elapsedSeconds() << " seconds" );
|
||||||
|
|
||||||
// Generate a cloud layer above the tiles
|
// Generate a cloud layer above the tiles
|
||||||
// if ( current_options.get_clouds() ) {
|
// if ( globals->get_options()->get_clouds() ) {
|
||||||
// fgGenCloudTile(path, t, tile);
|
// fgGenCloudTile(path, t, tile);
|
||||||
// }
|
// }
|
||||||
return tile;
|
return tile;
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <simgear/misc/fgpath.hxx>
|
#include <simgear/misc/fgpath.hxx>
|
||||||
|
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/options.hxx>
|
|
||||||
#include <Objects/obj.hxx>
|
#include <Objects/obj.hxx>
|
||||||
#include <Scenery/scenery.hxx> // for scenery.center
|
#include <Scenery/scenery.hxx> // for scenery.center
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ FGTileCache::init( void )
|
||||||
//
|
//
|
||||||
// target_cache_size >= (current.options.tile_diameter + 1) ** 2
|
// 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);
|
int target_cache_size = (side*side);
|
||||||
FG_LOG( FG_TERRAIN, FG_DEBUG, " target cache size = "
|
FG_LOG( FG_TERRAIN, FG_DEBUG, " target cache size = "
|
||||||
<< target_cache_size );
|
<< target_cache_size );
|
||||||
|
@ -170,10 +169,10 @@ FGTileCache::fill_in( int index, const FGBucket& p )
|
||||||
tile_cache[index].tile_bucket = p;
|
tile_cache[index].tile_bucket = p;
|
||||||
|
|
||||||
FGPath tile_path;
|
FGPath tile_path;
|
||||||
if ( current_options.get_fg_scenery() != "" ) {
|
if ( globals->get_options()->get_fg_scenery() != "" ) {
|
||||||
tile_path.set( current_options.get_fg_scenery() );
|
tile_path.set( globals->get_options()->get_fg_scenery() );
|
||||||
} else {
|
} 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( "Scenery" );
|
||||||
}
|
}
|
||||||
tile_path.append( p.gen_base_path() );
|
tile_path.append( p.gen_base_path() );
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
// #include <Aircraft/aircraft.hxx>
|
// #include <Aircraft/aircraft.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/options.hxx>
|
|
||||||
#include <Objects/obj.hxx>
|
#include <Objects/obj.hxx>
|
||||||
|
|
||||||
#ifndef FG_OLD_WEATHER
|
#ifndef FG_OLD_WEATHER
|
||||||
|
@ -100,7 +99,7 @@ int FGTileMgr::init( void ) {
|
||||||
|
|
||||||
state = Inited;
|
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);
|
FG_LOG( FG_TERRAIN, FG_INFO, "Tile Diameter = " << tile_diameter);
|
||||||
|
|
||||||
previous_bucket.make_bad();
|
previous_bucket.make_bad();
|
||||||
|
|
|
@ -56,7 +56,6 @@ FG_USING_STD(string);
|
||||||
|
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/options.hxx>
|
|
||||||
|
|
||||||
#include "light.hxx"
|
#include "light.hxx"
|
||||||
#include "sunpos.hxx"
|
#include "sunpos.hxx"
|
||||||
|
@ -76,7 +75,7 @@ void fgLIGHT::Init( void ) {
|
||||||
"Initializing Lighting interpolation tables." );
|
"Initializing Lighting interpolation tables." );
|
||||||
|
|
||||||
// build the path name to the ambient lookup table
|
// 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;
|
FGPath ambient = path;
|
||||||
ambient.append( "Lighting/ambient" );
|
ambient.append( "Lighting/ambient" );
|
||||||
FGPath diffuse = path;
|
FGPath diffuse = path;
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/options.hxx>
|
|
||||||
|
|
||||||
#include "light.hxx"
|
#include "light.hxx"
|
||||||
#include "moonpos.hxx"
|
#include "moonpos.hxx"
|
||||||
|
@ -40,7 +39,7 @@
|
||||||
|
|
||||||
// periodic time updater wrapper
|
// periodic time updater wrapper
|
||||||
void fgUpdateLocalTime() {
|
void fgUpdateLocalTime() {
|
||||||
FGPath zone( current_options.get_fg_root() );
|
FGPath zone( globals->get_options()->get_fg_root() );
|
||||||
zone.append( "Timezone" );
|
zone.append( "Timezone" );
|
||||||
|
|
||||||
globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),
|
globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue