Move FGControls declaration to globals.hxx
This commit is contained in:
parent
fe82a3d31f
commit
96b88e539f
31 changed files with 135 additions and 100 deletions
|
@ -26,6 +26,8 @@
|
|||
#include <simgear/constants.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
#include "aircraft.hxx"
|
||||
|
||||
// This is a record containing all the info for the aircraft currently
|
||||
|
@ -38,7 +40,7 @@ void fgAircraftInit( void ) {
|
|||
SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" );
|
||||
|
||||
current_aircraft.fdm_state = cur_fdm_state;
|
||||
current_aircraft.controls = &controls;
|
||||
current_aircraft.controls = globals->get_controls();
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,10 +62,10 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
|
|||
|
||||
SG_LOG( SG_FLIGHT, SG_DEBUG,
|
||||
"Kts = " << f->get_V_equiv_kts()
|
||||
<< " Elev = " << controls.get_elevator()
|
||||
<< " Aileron = " << controls.get_aileron()
|
||||
<< " Rudder = " << controls.get_rudder()
|
||||
<< " Power = " << controls.get_throttle( 0 ) );
|
||||
<< " Elev = " << globals->get_controls()->get_elevator()
|
||||
<< " Aileron = " << globals->get_controls()->get_aileron()
|
||||
<< " Rudder = " << globals->get_controls()->get_rudder()
|
||||
<< " Power = " << globals->get_controls()->get_throttle( 0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -207,10 +207,10 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
|
|||
|
||||
|
||||
void FGAutopilot::update_old_control_values() {
|
||||
old_aileron = controls.get_aileron();
|
||||
old_elevator = controls.get_elevator();
|
||||
old_elevator_trim = controls.get_elevator_trim();
|
||||
old_rudder = controls.get_rudder();
|
||||
old_aileron = globals->get_controls()->get_aileron();
|
||||
old_elevator = globals->get_controls()->get_elevator();
|
||||
old_elevator_trim = globals->get_controls()->get_elevator_trim();
|
||||
old_rudder = globals->get_controls()->get_rudder();
|
||||
}
|
||||
|
||||
|
||||
|
@ -514,8 +514,8 @@ int FGAutopilot::run() {
|
|||
double AileronSet = -turn / 2.0;
|
||||
if ( AileronSet < -1.0 ) { AileronSet = -1.0; }
|
||||
if ( AileronSet > 1.0 ) { AileronSet = 1.0; }
|
||||
controls.set_aileron( AileronSet );
|
||||
controls.set_rudder( AileronSet / 4.0 );
|
||||
globals->get_controls()->set_aileron( AileronSet );
|
||||
globals->get_controls()->set_rudder( AileronSet / 4.0 );
|
||||
} else {
|
||||
// steer towards the target heading
|
||||
|
||||
|
@ -580,8 +580,8 @@ int FGAutopilot::run() {
|
|||
MaxAileron );
|
||||
}
|
||||
|
||||
controls.set_aileron( AileronSet );
|
||||
controls.set_rudder( AileronSet / 4.0 );
|
||||
globals->get_controls()->set_aileron( AileronSet );
|
||||
globals->get_controls()->set_rudder( AileronSet / 4.0 );
|
||||
// controls.set_rudder( 0.0 );
|
||||
}
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ int FGAutopilot::run() {
|
|||
total_adj = -1.0;
|
||||
}
|
||||
|
||||
controls.set_elevator( total_adj );
|
||||
globals->get_controls()->set_elevator( total_adj );
|
||||
}
|
||||
|
||||
// auto throttle
|
||||
|
@ -737,7 +737,8 @@ int FGAutopilot::run() {
|
|||
total_adj = 0.0;
|
||||
}
|
||||
|
||||
controls.set_throttle( FGControls::ALL_ENGINES, total_adj );
|
||||
globals->get_controls()->set_throttle( FGControls::ALL_ENGINES,
|
||||
total_adj );
|
||||
}
|
||||
|
||||
#ifdef THIS_CODE_IS_NOT_USED
|
||||
|
@ -769,10 +770,10 @@ int FGAutopilot::run() {
|
|||
|
||||
// stash this runs control settings
|
||||
// update_old_control_values();
|
||||
old_aileron = controls.get_aileron();
|
||||
old_elevator = controls.get_elevator();
|
||||
old_elevator_trim = controls.get_elevator_trim();
|
||||
old_rudder = controls.get_rudder();
|
||||
old_aileron = globals->get_controls()->get_aileron();
|
||||
old_elevator = globals->get_controls()->get_elevator();
|
||||
old_elevator_trim = globals->get_controls()->get_elevator_trim();
|
||||
old_rudder = globals->get_controls()->get_rudder();
|
||||
|
||||
// for cross track error
|
||||
old_lat = lat;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <FDM/ADA.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Time/fg_timer.hxx>
|
||||
#include <GUI/gui.h>
|
||||
|
@ -123,31 +124,31 @@ float get_long_min( void )
|
|||
|
||||
float get_throttleval( void )
|
||||
{
|
||||
float throttle = controls.get_throttle( 0 );
|
||||
float throttle = globals->get_controls()->get_throttle( 0 );
|
||||
return (throttle); // Hack limiting to one engine
|
||||
}
|
||||
|
||||
float get_aileronval( void )
|
||||
{
|
||||
float aileronval = controls.get_aileron();
|
||||
float aileronval = globals->get_controls()->get_aileron();
|
||||
return (aileronval);
|
||||
}
|
||||
|
||||
float get_elevatorval( void )
|
||||
{
|
||||
float elevator_val = (float)controls.get_elevator();
|
||||
float elevator_val = (float)globals->get_controls()->get_elevator();
|
||||
return elevator_val;
|
||||
}
|
||||
|
||||
float get_elev_trimval( void )
|
||||
{
|
||||
float elevatorval = controls.get_elevator_trim();
|
||||
float elevatorval = globals->get_controls()->get_elevator_trim();
|
||||
return (elevatorval);
|
||||
}
|
||||
|
||||
float get_rudderval( void )
|
||||
{
|
||||
float rudderval = controls.get_rudder();
|
||||
float rudderval = globals->get_controls()->get_rudder();
|
||||
return (rudderval);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <GUI/gui.h>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
#ifdef FG_NETWORK_OLK
|
||||
#include <NetworkOLK/network.h>
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
#include <Objects/texload.h>
|
||||
#include <Time/light.hxx>
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ void FGSteam::_CatchUp()
|
|||
scaling capability for the vacuum pump later on.
|
||||
When we have a real engine model, we can ask it.
|
||||
*/
|
||||
the_ENGINE_rpm = controls.get_throttle(0) * 26.0;
|
||||
the_ENGINE_rpm = globals->get_controls()->get_throttle(0) * 26.0;
|
||||
|
||||
/**************************
|
||||
First, we need to know what the static line is reporting,
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
#include <Main/fg_props.hxx>
|
||||
|
||||
|
||||
FGControls controls;
|
||||
|
||||
|
||||
// Constructor
|
||||
FGControls::FGControls() :
|
||||
aileron( 0.0 ),
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
#include <Sound/soundmgr.hxx>
|
||||
#include <Main/fgfs.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
|
@ -266,9 +267,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
extern FGControls controls;
|
||||
|
||||
|
||||
#endif // _CONTROLS_HXX
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <Controls/controls.hxx>
|
||||
#include <GUI/gui.h>
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
#include "ADA.hxx"
|
||||
|
||||
|
@ -261,10 +262,10 @@ bool FGADA::copy_from_FGADA() {
|
|||
// printf("psi = %f %f\n",Psi,Psi*SGD_RADIANS_TO_DEGREES);
|
||||
|
||||
// controls
|
||||
controls.set_throttle(0,throttle/131.0);
|
||||
controls.set_elevator(pstick);
|
||||
controls.set_aileron(rstick);
|
||||
controls.set_rudder(rpedal);
|
||||
globals->get_controls()->set_throttle(0,throttle/131.0);
|
||||
globals->get_controls()->set_elevator(pstick);
|
||||
globals->get_controls()->set_aileron(rstick);
|
||||
globals->get_controls()->set_rudder(rpedal);
|
||||
|
||||
// auxilliary parameters for HUD
|
||||
set_iaux1(sixdof_to_visuals.iaux1);
|
||||
|
|
|
@ -121,7 +121,7 @@ bool FGBalloonSim::update( int multiloop ) {
|
|||
}
|
||||
|
||||
// set control positions
|
||||
current_balloon.set_burner_strength ( controls.get_throttle(0) );
|
||||
current_balloon.set_burner_strength ( globals->get_controls()->get_throttle(0) );
|
||||
//not more implemented yet
|
||||
|
||||
// Inform BalloonSim of the local terrain altitude
|
||||
|
|
|
@ -235,20 +235,20 @@ bool FGJSBsim::update( int multiloop ) {
|
|||
aileron_trim->setDoubleValue( FCS->GetDaCmd() );
|
||||
rudder_trim->setDoubleValue( FCS->GetDrCmd() );
|
||||
|
||||
controls.set_elevator_trim(FCS->GetPitchTrimCmd());
|
||||
controls.set_elevator(FCS->GetDeCmd());
|
||||
controls.set_throttle(FGControls::ALL_ENGINES,
|
||||
globals->get_controls()->set_elevator_trim(FCS->GetPitchTrimCmd());
|
||||
globals->get_controls()->set_elevator(FCS->GetDeCmd());
|
||||
globals->get_controls()->set_throttle(FGControls::ALL_ENGINES,
|
||||
FCS->GetThrottleCmd(0));
|
||||
|
||||
controls.set_aileron(FCS->GetDaCmd());
|
||||
controls.set_rudder( FCS->GetDrCmd());
|
||||
globals->get_controls()->set_aileron(FCS->GetDaCmd());
|
||||
globals->get_controls()->set_rudder( FCS->GetDrCmd());
|
||||
|
||||
SG_LOG( SG_FLIGHT, SG_INFO, " Trim complete" );
|
||||
}
|
||||
|
||||
for( i=0; i<get_num_engines(); i++ ) {
|
||||
get_engine(i)->set_RPM( Propulsion->GetThruster(i)->GetRPM() );
|
||||
get_engine(i)->set_Throttle( controls.get_throttle(i) );
|
||||
get_engine(i)->set_Throttle( globals->get_controls()->get_throttle(i) );
|
||||
}
|
||||
|
||||
for ( i=0; i < multiloop; i++ ) {
|
||||
|
@ -272,18 +272,18 @@ bool FGJSBsim::update( int multiloop ) {
|
|||
bool FGJSBsim::copy_to_JSBsim() {
|
||||
// copy control positions into the JSBsim structure
|
||||
|
||||
FCS->SetDaCmd( controls.get_aileron());
|
||||
FCS->SetDeCmd( controls.get_elevator());
|
||||
FCS->SetPitchTrimCmd(controls.get_elevator_trim());
|
||||
FCS->SetDrCmd( -controls.get_rudder());
|
||||
FCS->SetDfCmd( controls.get_flaps() );
|
||||
FCS->SetDaCmd( globals->get_controls()->get_aileron());
|
||||
FCS->SetDeCmd( globals->get_controls()->get_elevator());
|
||||
FCS->SetPitchTrimCmd(globals->get_controls()->get_elevator_trim());
|
||||
FCS->SetDrCmd( -globals->get_controls()->get_rudder());
|
||||
FCS->SetDfCmd( globals->get_controls()->get_flaps() );
|
||||
FCS->SetDsbCmd( 0.0 ); //speedbrakes
|
||||
FCS->SetDspCmd( 0.0 ); //spoilers
|
||||
FCS->SetThrottleCmd( FGControls::ALL_ENGINES,
|
||||
controls.get_throttle( 0 ));
|
||||
FCS->SetLBrake( controls.get_brake( 0 ) );
|
||||
FCS->SetRBrake( controls.get_brake( 1 ) );
|
||||
FCS->SetCBrake( controls.get_brake( 2 ) );
|
||||
globals->get_controls()->get_throttle( 0 ));
|
||||
FCS->SetLBrake( globals->get_controls()->get_brake( 0 ) );
|
||||
FCS->SetRBrake( globals->get_controls()->get_brake( 1 ) );
|
||||
FCS->SetCBrake( globals->get_controls()->get_brake( 2 ) );
|
||||
|
||||
Position->SetSeaLevelRadius( get_Sea_level_radius() );
|
||||
Position->SetRunwayRadius( scenery.cur_elev*SG_METER_TO_FEET
|
||||
|
|
|
@ -101,9 +101,11 @@ bool FGLaRCsim::update( int multiloop ) {
|
|||
// set control inputs
|
||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||
eng.set_IAS( V_calibrated_kts );
|
||||
eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
|
||||
eng.set_Throttle_Lever_Pos( globals->get_controls()->get_throttle( 0 )
|
||||
* 100.0 );
|
||||
eng.set_Propeller_Lever_Pos( 100 );
|
||||
eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 );
|
||||
eng.set_Mixture_Lever_Pos( globals->get_controls()->get_mixture( 0 )
|
||||
* 100.0 );
|
||||
eng.set_p_amb( Static_pressure );
|
||||
eng.set_T_amb( Static_temperature );
|
||||
|
||||
|
@ -112,7 +114,7 @@ bool FGLaRCsim::update( int multiloop ) {
|
|||
|
||||
// copy engine state values onto "bus"
|
||||
FGEngInterface *e = get_engine( 0 );
|
||||
e->set_Throttle( controls.get_throttle( 0 ) * 100.0 );
|
||||
e->set_Throttle( globals->get_controls()->get_throttle( 0 ) * 100.0 );
|
||||
e->set_Mixture( 80 );
|
||||
e->set_Prop_Advance( 100 );
|
||||
e->set_RPM( eng.get_RPM() );
|
||||
|
@ -132,7 +134,7 @@ bool FGLaRCsim::update( int multiloop ) {
|
|||
|
||||
#if 0
|
||||
SG_LOG( SG_FLIGHT, SG_INFO, "Throttle = "
|
||||
<< controls.get_throttle( 0 ) * 100.0);
|
||||
<< globals->get_controls()->get_throttle( 0 ) * 100.0);
|
||||
SG_LOG( SG_FLIGHT, SG_INFO, " Mixture = " << 80);
|
||||
SG_LOG( SG_FLIGHT, SG_INFO, " RPM = " << eng.get_RPM());
|
||||
SG_LOG( SG_FLIGHT, SG_INFO, " MP = " << eng.get_Manifold_Pressure());
|
||||
|
@ -156,13 +158,13 @@ bool FGLaRCsim::update( int multiloop ) {
|
|||
}
|
||||
|
||||
// copy control positions into the LaRCsim structure
|
||||
Lat_control = controls.get_aileron() /
|
||||
Lat_control = globals->get_controls()->get_aileron() /
|
||||
speed_up->getIntValue();
|
||||
Long_control = controls.get_elevator();
|
||||
Long_trim = controls.get_elevator_trim();
|
||||
Rudder_pedal = controls.get_rudder() /
|
||||
Long_control = globals->get_controls()->get_elevator();
|
||||
Long_trim = globals->get_controls()->get_elevator_trim();
|
||||
Rudder_pedal = globals->get_controls()->get_rudder() /
|
||||
speed_up->getIntValue();
|
||||
Flap_handle = 30.0 * controls.get_flaps();
|
||||
Flap_handle = 30.0 * globals->get_controls()->get_flaps();
|
||||
|
||||
if ( aircraft->getStringValue() == "c172" ) {
|
||||
Use_External_Engine = 1;
|
||||
|
@ -170,10 +172,10 @@ bool FGLaRCsim::update( int multiloop ) {
|
|||
Use_External_Engine = 0;
|
||||
}
|
||||
|
||||
Throttle_pct = controls.get_throttle( 0 ) * 1.0;
|
||||
Throttle_pct = globals->get_controls()->get_throttle( 0 ) * 1.0;
|
||||
|
||||
Brake_pct[0] = controls.get_brake( 1 );
|
||||
Brake_pct[1] = controls.get_brake( 0 );
|
||||
Brake_pct[0] = globals->get_controls()->get_brake( 1 );
|
||||
Brake_pct[1] = globals->get_controls()->get_brake( 0 );
|
||||
|
||||
// Inform LaRCsim of the local terrain altitude
|
||||
// Runway_altitude = get_Runway_altitude();
|
||||
|
|
|
@ -57,7 +57,7 @@ bool FGMagicCarpet::update( int multiloop ) {
|
|||
double time_step = get_delta_t() * multiloop;
|
||||
|
||||
// speed and distance traveled
|
||||
double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
|
||||
double speed = globals->get_controls()->get_throttle( 0 ) * 2000; // meters/sec
|
||||
double dist = speed * time_step;
|
||||
double kts = speed * SG_METER_TO_NM * 3600.0;
|
||||
_set_V_equiv_kts( kts );
|
||||
|
@ -65,7 +65,7 @@ bool FGMagicCarpet::update( int multiloop ) {
|
|||
_set_V_ground_speed( kts );
|
||||
|
||||
// angle of turn
|
||||
double turn_rate = controls.get_aileron() * SGD_PI_4; // radians/sec
|
||||
double turn_rate = globals->get_controls()->get_aileron() * SGD_PI_4; // radians/sec
|
||||
double turn = turn_rate * time_step;
|
||||
|
||||
// update euler angles
|
||||
|
@ -94,7 +94,7 @@ bool FGMagicCarpet::update( int multiloop ) {
|
|||
sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
|
||||
|
||||
// update altitude
|
||||
double real_climb_rate = -controls.get_elevator() * 5000; // feet/sec
|
||||
double real_climb_rate = -globals->get_controls()->get_elevator() * 5000; // feet/sec
|
||||
_set_Climb_Rate( real_climb_rate / 500.0 );
|
||||
double climb = real_climb_rate * time_step;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
|
||||
#ifdef FG_NETWORK_OLK
|
||||
#include <NetworkOLK/network.h>
|
||||
|
|
|
@ -66,9 +66,7 @@
|
|||
#include <FDM/flight.hxx>
|
||||
#include <Main/fg_init.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
//#include <Main/views.hxx>
|
||||
//#include <Network/network.h>
|
||||
//#include <Time/fg_time.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
|
||||
#if defined( WIN32 ) && !defined( __CYGWIN__ )
|
||||
# include <simgear/screen/win32-printer.h>
|
||||
|
@ -293,26 +291,26 @@ void guiMotionFunc ( int x, int y )
|
|||
} else {
|
||||
if ( left_button() ) {
|
||||
offset = (_mX - x) * brake_sensitivity;
|
||||
controls.move_brake(FGControls::ALL_WHEELS, offset);
|
||||
globals->get_controls()->move_brake(FGControls::ALL_WHEELS, offset);
|
||||
offset = (_mY - y) * throttle_sensitivity;
|
||||
controls.move_throttle(FGControls::ALL_ENGINES, offset);
|
||||
globals->get_controls()->move_throttle(FGControls::ALL_ENGINES, offset);
|
||||
} else if ( right_button() ) {
|
||||
if( ! current_autopilot->get_HeadingEnabled() ) {
|
||||
offset = (x - _mX) * rudder_sensitivity;
|
||||
controls.move_rudder(offset);
|
||||
globals->get_controls()->move_rudder(offset);
|
||||
}
|
||||
if( ! current_autopilot->get_AltitudeEnabled() ) {
|
||||
offset = (_mY - y) * trim_sensitivity;
|
||||
controls.move_elevator_trim(offset);
|
||||
globals->get_controls()->move_elevator_trim(offset);
|
||||
}
|
||||
} else {
|
||||
if( ! current_autopilot->get_HeadingEnabled() ) {
|
||||
offset = (x - _mX) * aileron_sensitivity;
|
||||
controls.move_aileron(offset);
|
||||
globals->get_controls()->move_aileron(offset);
|
||||
}
|
||||
if( ! current_autopilot->get_AltitudeEnabled() ) {
|
||||
offset = (_mY - y) * elevator_sensitivity;
|
||||
controls.move_elevator(offset);
|
||||
globals->get_controls()->move_elevator(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,9 +484,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
|
|||
|
||||
// try to have the MOUSE_YOKE position
|
||||
// reflect the current stick position
|
||||
offset = controls.get_aileron();
|
||||
offset = globals->get_controls()->get_aileron();
|
||||
x = _mX - (int)(offset * aileron_sensitivity);
|
||||
offset = controls.get_elevator();
|
||||
offset = globals->get_controls()->get_elevator();
|
||||
y = _mY - (int)(offset * elevator_sensitivity);
|
||||
|
||||
glutSetCursor(GLUT_CURSOR_CROSSHAIR);
|
||||
|
|
|
@ -27,6 +27,7 @@ SG_USING_STD(ofstream);
|
|||
#include "fg_props.hxx"
|
||||
#include "fg_io.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
#include "fg_props.hxx"
|
||||
#include "options.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
#if defined(FX) && defined(XMESA)
|
||||
#include <GL/xmesa.h>
|
||||
|
@ -810,8 +811,8 @@ bool fgInitSubsystems( void ) {
|
|||
// Initialize the controls subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
controls.init();
|
||||
controls.bind();
|
||||
globals->get_controls()->init();
|
||||
globals->get_controls()->bind();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -885,7 +886,7 @@ void fgReInitSubsystems( void )
|
|||
|
||||
cur_fdm_state->init();
|
||||
|
||||
controls.reset_all();
|
||||
globals->get_controls()->reset_all();
|
||||
current_autopilot->reset();
|
||||
|
||||
fgUpdateSunPos();
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "fgfs.hxx"
|
||||
#include "fg_props.hxx"
|
||||
#include "viewer.hxx"
|
||||
|
||||
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
SG_USING_STD(istream);
|
||||
|
@ -668,7 +669,7 @@ getAPRudderControl ()
|
|||
if (getAPHeadingLock())
|
||||
return current_autopilot->get_TargetHeading();
|
||||
else
|
||||
return controls.get_rudder();
|
||||
return globals->get_controls()->get_rudder();
|
||||
}
|
||||
|
||||
// kludge
|
||||
|
@ -680,7 +681,7 @@ setAPRudderControl (double value)
|
|||
value -= current_autopilot->get_TargetHeading();
|
||||
current_autopilot->HeadingAdjust(value < 0.0 ? -1.0 : 1.0);
|
||||
} else {
|
||||
controls.set_rudder(value);
|
||||
globals->get_controls()->set_rudder(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,7 +692,7 @@ getAPElevatorControl ()
|
|||
if (getAPAltitudeLock())
|
||||
return current_autopilot->get_TargetAltitude();
|
||||
else
|
||||
return controls.get_elevator();
|
||||
return globals->get_controls()->get_elevator();
|
||||
}
|
||||
|
||||
// kludge
|
||||
|
@ -703,7 +704,7 @@ setAPElevatorControl (double value)
|
|||
value -= current_autopilot->get_TargetAltitude();
|
||||
current_autopilot->AltitudeAdjust(value < 0.0 ? 100.0 : -100.0);
|
||||
} else {
|
||||
controls.set_elevator(value);
|
||||
globals->get_controls()->set_elevator(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,7 +715,7 @@ getAPThrottleControl ()
|
|||
if (getAPAutoThrottleLock())
|
||||
return 0.0; // always resets
|
||||
else
|
||||
return controls.get_throttle(0);
|
||||
return globals->get_controls()->get_throttle(0);
|
||||
}
|
||||
|
||||
// kludge
|
||||
|
@ -724,7 +725,7 @@ setAPThrottleControl (double value)
|
|||
if (getAPAutoThrottleLock())
|
||||
current_autopilot->AutoThrottleAdjust(value < 0.0 ? -0.01 : 0.01);
|
||||
else
|
||||
controls.set_throttle(0, value);
|
||||
globals->get_controls()->set_throttle(0, value);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
#include <simgear/misc/commands.hxx>
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
#include <Sound/soundmgr.hxx>
|
||||
#include "viewmgr.hxx"
|
||||
// #include <Controls/controls.hxx>
|
||||
// #include <Sound/soundmgr.hxx>
|
||||
// #include "viewmgr.hxx"
|
||||
|
||||
SG_USING_STD( vector );
|
||||
SG_USING_STD( string );
|
||||
|
@ -46,6 +47,12 @@ SG_USING_STD( string );
|
|||
typedef vector<string> string_list;
|
||||
|
||||
|
||||
// Forward declarations
|
||||
class FGControls;
|
||||
class FGSoundMgr;
|
||||
class FGViewMgr;
|
||||
class FGViewer;
|
||||
|
||||
class FGGlobals {
|
||||
|
||||
private:
|
||||
|
@ -82,6 +89,9 @@ private:
|
|||
// sound manager
|
||||
FGSoundMgr *soundmgr;
|
||||
|
||||
// control input state
|
||||
FGControls *controls;
|
||||
|
||||
// viewer manager
|
||||
FGViewMgr *viewmgr;
|
||||
FGViewer *current_view;
|
||||
|
@ -134,6 +144,9 @@ public:
|
|||
inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
|
||||
inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
|
||||
|
||||
inline FGControls *get_controls() const { return controls; }
|
||||
inline void set_controls( FGControls *c ) { controls = c; }
|
||||
|
||||
inline FGViewMgr *get_viewmgr() const { return viewmgr; }
|
||||
inline void set_viewmgr( FGViewMgr *vm ) { viewmgr = vm; }
|
||||
inline FGViewer *get_current_view() const { return current_view; }
|
||||
|
|
|
@ -131,6 +131,7 @@ int objc=0;
|
|||
#include "fg_props.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "splash.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
#ifdef macintosh
|
||||
# include <console.h> // -dw- for command line dialog
|
||||
|
@ -716,7 +717,7 @@ void fgRenderFrame( void ) {
|
|||
|
||||
// set up moving parts
|
||||
if (flaps_selector != NULL) {
|
||||
flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
|
||||
flaps_selector->select( (globals->get_controls()->get_flaps() > 0.5f) ? 1 : 2 );
|
||||
}
|
||||
|
||||
if (prop_selector != NULL) {
|
||||
|
@ -799,7 +800,7 @@ void fgRenderFrame( void ) {
|
|||
current_input.update();
|
||||
|
||||
// update the controls subsystem
|
||||
controls.update();
|
||||
globals->get_controls()->update();
|
||||
|
||||
hud_and_panel->apply();
|
||||
fgCockpitUpdate();
|
||||
|
@ -1175,7 +1176,8 @@ static void fgMainLoop( void ) {
|
|||
s1->set_pitch( pitch );
|
||||
s1->set_volume( volume );
|
||||
} else {
|
||||
double param = controls.get_throttle( 0 ) * 2.0 + 1.0;
|
||||
double param
|
||||
= globals->get_controls()->get_throttle( 0 ) * 2.0 + 1.0;
|
||||
s1->set_pitch( param );
|
||||
s1->set_volume( param );
|
||||
}
|
||||
|
@ -1463,6 +1465,9 @@ int mainLoop( int argc, char **argv ) {
|
|||
SGRoute *route = new SGRoute;
|
||||
globals->set_route( route );
|
||||
|
||||
FGControls *controls = new FGControls;
|
||||
globals->set_controls( controls );
|
||||
|
||||
FGViewMgr *viewmgr = new FGViewMgr;
|
||||
globals->set_viewmgr( viewmgr );
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ bool global_fullscreen = true;
|
|||
#include "fg_init.hxx"
|
||||
#include "fg_props.hxx"
|
||||
#include "options.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
SG_USING_STD(string);
|
||||
SG_USING_NAMESPACE(std);
|
||||
|
|
|
@ -6,9 +6,11 @@ libNetwork_a_SOURCES = \
|
|||
garmin.cxx garmin.hxx \
|
||||
joyclient.cxx joyclient.hxx \
|
||||
native.cxx native.hxx \
|
||||
native_ctrls.cxx native_ctrls.hxx \
|
||||
nmea.cxx nmea.hxx \
|
||||
props.cxx props.hxx \
|
||||
pve.cxx pve.hxx \
|
||||
raw_ctrls.hxx \
|
||||
ray.cxx ray.hxx \
|
||||
rul.cxx rul.hxx
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ bool FGJoyClient::process() {
|
|||
if ( fabs(elevator) < 0.05 ) {
|
||||
elevator = 0.0;
|
||||
}
|
||||
controls.set_aileron( aileron );
|
||||
controls.set_elevator( -elevator );
|
||||
globals->get_controls()->set_aileron( aileron );
|
||||
globals->get_controls()->set_elevator( -elevator );
|
||||
}
|
||||
} else {
|
||||
while ( io->read( (char *)(& buf), length ) == length ) {
|
||||
|
@ -100,8 +100,8 @@ bool FGJoyClient::process() {
|
|||
if ( fabs(elevator) < 0.05 ) {
|
||||
elevator = 0.0;
|
||||
}
|
||||
controls.set_aileron( aileron );
|
||||
controls.set_elevator( -elevator );
|
||||
globals->get_controls()->set_aileron( aileron );
|
||||
globals->get_controls()->set_elevator( -elevator );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <Cockpit/hud.hxx>
|
||||
#include <plib/ssg.h>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
|
||||
//#define printf //
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <simgear/math/vector.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
|
||||
#include "hitlist.hxx"
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
#include <Scenery/scenery.hxx> // for scenery.center
|
||||
|
||||
#include "newcache.hxx"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Include/general.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Time/light.hxx>
|
||||
#include <Objects/apt_signs.hxx>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <simgear/math/vector.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
#include <Objects/obj.hxx>
|
||||
|
||||
#ifndef FG_OLD_WEATHER
|
||||
|
|
|
@ -56,6 +56,7 @@ SG_USING_STD(string);
|
|||
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
|
||||
#include "light.hxx"
|
||||
#include "sunpos.hxx"
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include <simgear/math/vector.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Time/light.hxx>
|
||||
|
||||
|
@ -335,7 +336,7 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) {
|
|||
// update the cur_time_params structure with the current moon position
|
||||
void fgUpdateMoonPos( void ) {
|
||||
fgLIGHT *l;
|
||||
FGViewerRPH *v;
|
||||
FGViewer *v;
|
||||
sgVec3 nup, nmoon;
|
||||
Point3D p, rel_moonpos;
|
||||
double dot, east_dot;
|
||||
|
@ -350,7 +351,7 @@ void fgUpdateMoonPos( void ) {
|
|||
|
||||
l = &cur_light_params;
|
||||
SGTime *t = globals->get_time_params();
|
||||
v = (FGViewerRPH *)globals->get_current_view();
|
||||
v = globals->get_current_view();
|
||||
|
||||
SG_LOG( SG_EVENT, SG_INFO, " Updating Moon position" );
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <simgear/math/vector.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/viewer.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Time/light.hxx>
|
||||
|
||||
|
@ -243,7 +244,7 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) {
|
|||
// update the cur_time_params structure with the current sun position
|
||||
void fgUpdateSunPos( void ) {
|
||||
fgLIGHT *l;
|
||||
FGViewerRPH *v;
|
||||
FGViewer *v;
|
||||
sgVec3 nup, nsun;
|
||||
Point3D p, rel_sunpos;
|
||||
double dot, east_dot;
|
||||
|
@ -258,7 +259,7 @@ void fgUpdateSunPos( void ) {
|
|||
|
||||
l = &cur_light_params;
|
||||
SGTime *t = globals->get_time_params();
|
||||
v = (FGViewerRPH *)globals->get_current_view();
|
||||
v = globals->get_current_view();
|
||||
|
||||
SG_LOG( SG_EVENT, SG_INFO, " Updating Sun position" );
|
||||
SG_LOG( SG_EVENT, SG_INFO, " Gst = " << t->getGst() );
|
||||
|
|
Loading…
Reference in a new issue