Added support for Christian Mayers new weather subsystem.
Added support for david@megginson.com's mouse yoke patch. Added a flight model acceleration options (controlled by a/A keys.)
This commit is contained in:
parent
06ee5a4f0a
commit
9e3edfb47b
6 changed files with 91 additions and 14 deletions
|
@ -39,10 +39,12 @@ fgfs_LDADD = \
|
||||||
$(top_builddir)/Simulator/Objects/libObjects.a \
|
$(top_builddir)/Simulator/Objects/libObjects.a \
|
||||||
$(top_builddir)/Simulator/Time/libTime.a \
|
$(top_builddir)/Simulator/Time/libTime.a \
|
||||||
$(top_builddir)/Simulator/Weather/libWeather.a \
|
$(top_builddir)/Simulator/Weather/libWeather.a \
|
||||||
|
$(top_builddir)/Simulator/WeatherCM/libWeatherCM.a \
|
||||||
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
||||||
$(SERIAL_LIBS) \
|
$(SERIAL_LIBS) \
|
||||||
$(top_builddir)/Lib/Math/libMath.a \
|
$(top_builddir)/Lib/Math/libMath.a \
|
||||||
$(top_builddir)/Lib/Bucket/libBucket.a \
|
$(top_builddir)/Lib/Bucket/libBucket.a \
|
||||||
|
$(top_builddir)/Lib/Voronoi/libVoronoi.a \
|
||||||
$(top_builddir)/Lib/Debug/libDebug.a \
|
$(top_builddir)/Lib/Debug/libDebug.a \
|
||||||
-lpu -lfnt -lssg -lsg \
|
-lpu -lfnt -lssg -lsg \
|
||||||
$(top_builddir)/Lib/Misc/libMisc.a \
|
$(top_builddir)/Lib/Misc/libMisc.a \
|
||||||
|
|
|
@ -70,7 +70,8 @@
|
||||||
#include <Time/light.hxx>
|
#include <Time/light.hxx>
|
||||||
#include <Time/sunpos.hxx>
|
#include <Time/sunpos.hxx>
|
||||||
#include <Time/moonpos.hxx>
|
#include <Time/moonpos.hxx>
|
||||||
#include <Weather/weather.hxx>
|
// #include <Weather/weather.hxx>
|
||||||
|
#include <WeatherCM/FGLocalWeatherDatabase.h>
|
||||||
|
|
||||||
#include "fg_init.hxx"
|
#include "fg_init.hxx"
|
||||||
#include "options.hxx"
|
#include "options.hxx"
|
||||||
|
@ -405,7 +406,21 @@ bool fgInitSubsystems( void ) {
|
||||||
fgEVENT::FG_EVENT_READY, 30000 );
|
fgEVENT::FG_EVENT_READY, 30000 );
|
||||||
|
|
||||||
// Initialize the weather modeling subsystem
|
// Initialize the weather modeling subsystem
|
||||||
current_weather.Init();
|
// current_weather.Init();
|
||||||
|
// Initialize the WeatherDatabase
|
||||||
|
FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
|
||||||
|
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
|
||||||
|
new FGLocalWeatherDatabase(
|
||||||
|
Point3D( current_aircraft.fdm_state->get_Latitude(),
|
||||||
|
current_aircraft.fdm_state->get_Longitude(),
|
||||||
|
current_aircraft.fdm_state->get_Altitude()
|
||||||
|
* FEET_TO_METER) );
|
||||||
|
|
||||||
|
WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
|
||||||
|
|
||||||
|
// register the periodic update of the weather
|
||||||
|
global_events.Register( "weather update", fgUpdateWeatherDatabase,
|
||||||
|
fgEVENT::FG_EVENT_READY, 30000);
|
||||||
|
|
||||||
// Initialize the Cockpit subsystem
|
// Initialize the Cockpit subsystem
|
||||||
if( fgCockpitInit( ¤t_aircraft )) {
|
if( fgCockpitInit( ¤t_aircraft )) {
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
#include <Objects/materialmgr.hxx>
|
#include <Objects/materialmgr.hxx>
|
||||||
#include <Time/fg_time.hxx>
|
#include <Time/fg_time.hxx>
|
||||||
#include <Time/light.hxx>
|
#include <Time/light.hxx>
|
||||||
#include <Weather/weather.hxx>
|
// #include <Weather/weather.hxx>
|
||||||
|
#include <WeatherCM/FGLocalWeatherDatabase.h>
|
||||||
|
|
||||||
#include "keyboard.hxx"
|
#include "keyboard.hxx"
|
||||||
#include "options.hxx"
|
#include "options.hxx"
|
||||||
|
@ -76,14 +77,15 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
FGInterface *f;
|
FGInterface *f;
|
||||||
FGTime *t;
|
FGTime *t;
|
||||||
FGView *v;
|
FGView *v;
|
||||||
FGWeather *w;
|
// FGWeather *w;
|
||||||
float fov, tmp;
|
float fov, tmp;
|
||||||
static bool winding_ccw = true;
|
static bool winding_ccw = true;
|
||||||
|
int speed;
|
||||||
|
|
||||||
f = current_aircraft.fdm_state;
|
f = current_aircraft.fdm_state;
|
||||||
t = FGTime::cur_time_params;
|
t = FGTime::cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
w = ¤t_weather;
|
// w = ¤t_weather;
|
||||||
|
|
||||||
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
|
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
|
||||||
if ( puKeyboard(k, PU_DOWN) ) {
|
if ( puKeyboard(k, PU_DOWN) ) {
|
||||||
|
@ -138,6 +140,14 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
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 );
|
||||||
return;
|
return;
|
||||||
|
case 65: // A key
|
||||||
|
speed = current_options.get_speed_up();
|
||||||
|
speed--;
|
||||||
|
if ( speed < 1 ) {
|
||||||
|
speed = 1;
|
||||||
|
}
|
||||||
|
current_options.set_speed_up( speed );
|
||||||
|
return;
|
||||||
case 72: // H key
|
case 72: // H key
|
||||||
// status = current_options.get_hud_status();
|
// status = current_options.get_hud_status();
|
||||||
// current_options.set_hud_status(!status);
|
// current_options.set_hud_status(!status);
|
||||||
|
@ -177,9 +187,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 90: // Z key
|
case 90: // Z key
|
||||||
tmp = w->get_visibility(); // in meters
|
// tmp = w->get_visibility(); // in meters
|
||||||
|
// tmp /= 1.10;
|
||||||
|
// w->set_visibility( tmp );
|
||||||
|
tmp = WeatherDatabase->getWeatherVisibility();
|
||||||
tmp /= 1.10;
|
tmp /= 1.10;
|
||||||
w->set_visibility( tmp );
|
WeatherDatabase->setWeatherVisibility( tmp );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -244,6 +257,11 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
|
controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
case 97: // a key
|
||||||
|
speed = current_options.get_speed_up();
|
||||||
|
speed++;
|
||||||
|
current_options.set_speed_up( speed );
|
||||||
|
return;
|
||||||
case 98: // b key
|
case 98: // b key
|
||||||
int b_ret;
|
int b_ret;
|
||||||
double b_set;
|
double b_set;
|
||||||
|
@ -290,9 +308,12 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
v->force_update_fov_math();
|
v->force_update_fov_math();
|
||||||
return;
|
return;
|
||||||
case 122: // z key
|
case 122: // z key
|
||||||
tmp = w->get_visibility(); // in meters
|
// tmp = w->get_visibility(); // in meters
|
||||||
|
// tmp *= 1.10;
|
||||||
|
// w->set_visibility( tmp );
|
||||||
|
tmp = WeatherDatabase->getWeatherVisibility();
|
||||||
tmp *= 1.10;
|
tmp *= 1.10;
|
||||||
w->set_visibility( tmp );
|
WeatherDatabase->setWeatherVisibility( tmp );
|
||||||
return;
|
return;
|
||||||
case 27: // ESC
|
case 27: // ESC
|
||||||
// if( fg_DebugOutput ) {
|
// if( fg_DebugOutput ) {
|
||||||
|
|
|
@ -91,7 +91,8 @@
|
||||||
#include <Time/fg_time.hxx>
|
#include <Time/fg_time.hxx>
|
||||||
#include <Time/fg_timer.hxx>
|
#include <Time/fg_timer.hxx>
|
||||||
#include <Time/sunpos.hxx>
|
#include <Time/sunpos.hxx>
|
||||||
#include <Weather/weather.hxx>
|
// #include <Weather/weather.hxx>
|
||||||
|
// #include <WeatherCM/FGLocalWeatherDatabase.h>
|
||||||
|
|
||||||
#include "fg_init.hxx"
|
#include "fg_init.hxx"
|
||||||
#include "keyboard.hxx"
|
#include "keyboard.hxx"
|
||||||
|
@ -473,7 +474,9 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
|
|
||||||
// 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( current_options.get_flight_model(),
|
||||||
cur_fdm_state, multi_loop * 1, remainder );
|
cur_fdm_state,
|
||||||
|
multi_loop * current_options.get_speed_up(),
|
||||||
|
remainder );
|
||||||
} else {
|
} else {
|
||||||
fgFDMUpdate( current_options.get_flight_model(),
|
fgFDMUpdate( current_options.get_flight_model(),
|
||||||
cur_fdm_state, 0, remainder );
|
cur_fdm_state, 0, remainder );
|
||||||
|
@ -556,14 +559,16 @@ 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
|
||||||
fgJoystickRead();
|
if ( current_options.get_control_mode() == fgOPTIONS::FG_JOYSTICK ) {
|
||||||
|
fgJoystickRead();
|
||||||
|
}
|
||||||
#elif defined( ENABLE_GLUT_JOYSTICK )
|
#elif defined( ENABLE_GLUT_JOYSTICK )
|
||||||
// Glut joystick support works by feeding a joystick handler
|
// Glut joystick support works by feeding a joystick handler
|
||||||
// function to glut. This is taken care of once in the joystick
|
// function to glut. This is taken care of once in the joystick
|
||||||
// init routine and we don't have to worry about it again.
|
// init routine and we don't have to worry about it again.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
current_weather.Update();
|
// current_weather.Update();
|
||||||
|
|
||||||
// Fix elevation. I'm just sticking this here for now, it should
|
// Fix elevation. I'm just sticking this here for now, it should
|
||||||
// probably move eventually
|
// probably move eventually
|
||||||
|
|
|
@ -152,6 +152,7 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
intro_music(1),
|
intro_music(1),
|
||||||
mouse_pointer(0),
|
mouse_pointer(0),
|
||||||
pause(0),
|
pause(0),
|
||||||
|
control_mode(FG_JOYSTICK),
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
hud_status(1),
|
hud_status(1),
|
||||||
|
@ -159,7 +160,8 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
sound(1),
|
sound(1),
|
||||||
|
|
||||||
// Flight Model options
|
// Flight Model options
|
||||||
flight_model(FGInterface::FG_LARCSIM),
|
flight_model( FGInterface::FG_LARCSIM ),
|
||||||
|
speed_up( 1 ),
|
||||||
|
|
||||||
// Rendering options
|
// Rendering options
|
||||||
fog(FG_FOG_NICEST), // nicest
|
fog(FG_FOG_NICEST), // nicest
|
||||||
|
@ -433,6 +435,18 @@ 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 ) {
|
||||||
|
if ( mode == "joystick" ) {
|
||||||
|
control_mode = FG_JOYSTICK;
|
||||||
|
} else if ( mode == "mouse" ) {
|
||||||
|
control_mode = FG_MOUSE;
|
||||||
|
} else {
|
||||||
|
control_mode = FG_KEYBOARD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 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 );
|
||||||
|
@ -570,6 +584,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
|
||||||
pause = false;
|
pause = false;
|
||||||
} else if ( arg == "--enable-pause" ) {
|
} else if ( arg == "--enable-pause" ) {
|
||||||
pause = true;
|
pause = true;
|
||||||
|
} else if ( arg.find( "--control=") != string::npos ) {
|
||||||
|
parse_control( arg.substr(10) );
|
||||||
} else if ( arg == "--disable-hud" ) {
|
} else if ( arg == "--disable-hud" ) {
|
||||||
hud_status = false;
|
hud_status = false;
|
||||||
} else if ( arg == "--enable-hud" ) {
|
} else if ( arg == "--enable-hud" ) {
|
||||||
|
@ -623,6 +639,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
|
||||||
fg_root = arg.substr( 10 );
|
fg_root = arg.substr( 10 );
|
||||||
} else if ( arg.find( "--fdm=" ) != string::npos ) {
|
} else if ( arg.find( "--fdm=" ) != string::npos ) {
|
||||||
flight_model = parse_fdm( arg.substr(6) );
|
flight_model = parse_fdm( arg.substr(6) );
|
||||||
|
} else if ( arg.find( "--speed=" ) != string::npos ) {
|
||||||
|
speed_up = atoi( arg.substr(8) );
|
||||||
} else if ( arg == "--fog-disable" ) {
|
} else if ( arg == "--fog-disable" ) {
|
||||||
fog = FG_FOG_DISABLED;
|
fog = FG_FOG_DISABLED;
|
||||||
} else if ( arg == "--fog-fastest" ) {
|
} else if ( arg == "--fog-fastest" ) {
|
||||||
|
@ -778,6 +796,7 @@ void fgOPTIONS::usage ( void ) {
|
||||||
printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
|
printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
|
||||||
printf("\t--disable-pause: start out in an active state\n");
|
printf("\t--disable-pause: start out in an active state\n");
|
||||||
printf("\t--enable-pause: start out in a paused state\n");
|
printf("\t--enable-pause: start out in a paused state\n");
|
||||||
|
printf("\t--control=mode: primary control mode (joystick, keyboard, mouse)\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Features:\n");
|
printf("Features:\n");
|
||||||
|
@ -791,6 +810,7 @@ void fgOPTIONS::usage ( void ) {
|
||||||
|
|
||||||
printf("Flight Model:\n");
|
printf("Flight Model:\n");
|
||||||
printf("\t--fdm=abcd: one of slew, jsb, larcsim, or external\n");
|
printf("\t--fdm=abcd: one of slew, jsb, larcsim, or external\n");
|
||||||
|
printf("\t--speed=n: run the FDM this much faster than real time\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Initial Position and Orientation:\n");
|
printf("Initial Position and Orientation:\n");
|
||||||
|
|
|
@ -87,6 +87,13 @@ public:
|
||||||
FG_RADIUS_MAX = 4
|
FG_RADIUS_MAX = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum fgControlMode
|
||||||
|
{
|
||||||
|
FG_JOYSTICK = 0,
|
||||||
|
FG_KEYBOARD = 1,
|
||||||
|
FG_MOUSE = 2
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// The flight gear "root" directory
|
// The flight gear "root" directory
|
||||||
|
@ -110,6 +117,7 @@ private:
|
||||||
bool intro_music; // play introductory music
|
bool intro_music; // play introductory music
|
||||||
int mouse_pointer; // show mouse pointer
|
int mouse_pointer; // show mouse pointer
|
||||||
bool pause; // pause intially enabled/disabled
|
bool pause; // pause intially enabled/disabled
|
||||||
|
fgControlMode control_mode; // primary control mode
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
bool hud_status; // HUD on/off
|
bool hud_status; // HUD on/off
|
||||||
|
@ -118,6 +126,7 @@ private:
|
||||||
|
|
||||||
// Flight Model options
|
// Flight Model options
|
||||||
int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
|
int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
|
||||||
|
int speed_up; // Sim mechanics run this much faster than normal speed
|
||||||
|
|
||||||
// Rendering options
|
// Rendering options
|
||||||
fgFogKind fog; // Fog nicest/fastest/disabled
|
fgFogKind fog; // Fog nicest/fastest/disabled
|
||||||
|
@ -192,10 +201,14 @@ public:
|
||||||
inline bool get_intro_music() const { return intro_music; }
|
inline bool get_intro_music() const { return intro_music; }
|
||||||
inline int get_mouse_pointer() const { return mouse_pointer; }
|
inline int get_mouse_pointer() const { return mouse_pointer; }
|
||||||
inline bool get_pause() const { return pause; }
|
inline bool get_pause() const { return pause; }
|
||||||
|
inline fgControlMode get_control_mode() const { return control_mode; }
|
||||||
|
inline void set_control_mode( fgControlMode mode ) { control_mode = mode; }
|
||||||
inline bool get_hud_status() const { return hud_status; }
|
inline bool get_hud_status() const { return hud_status; }
|
||||||
inline bool get_panel_status() const { return panel_status; }
|
inline bool get_panel_status() const { return panel_status; }
|
||||||
inline bool get_sound() const { return sound; }
|
inline bool get_sound() const { return sound; }
|
||||||
inline int get_flight_model() const { return flight_model; }
|
inline int get_flight_model() const { return flight_model; }
|
||||||
|
inline int get_speed_up() const { return speed_up; }
|
||||||
|
inline void set_speed_up( int speed ) { speed_up = speed; }
|
||||||
inline bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
|
inline bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
|
||||||
inline fgFogKind get_fog() const { return fog; }
|
inline fgFogKind get_fog() const { return fog; }
|
||||||
inline double get_fov() const { return fov; }
|
inline double get_fov() const { return fov; }
|
||||||
|
@ -244,6 +257,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void parse_control( const string& mode );
|
||||||
double parse_time( const string& time_str );
|
double parse_time( const string& time_str );
|
||||||
long int parse_date( const string& date_str );
|
long int parse_date( const string& date_str );
|
||||||
double parse_degree( const string& degree_str );
|
double parse_degree( const string& degree_str );
|
||||||
|
|
Loading…
Add table
Reference in a new issue