Added support for david@megginson.com's mouse yoke patch.
Added a flight model acceleration options (controlled by a/A keys.)
$(top_builddir)/Simulator/Objects/libObjects.a \
$(top_builddir)/Simulator/Time/libTime.a \
$(top_builddir)/Simulator/Weather/libWeather.a \
+ $(top_builddir)/Simulator/WeatherCM/libWeatherCM.a \
$(top_builddir)/Simulator/Joystick/libJoystick.a \
$(SERIAL_LIBS) \
$(top_builddir)/Lib/Math/libMath.a \
$(top_builddir)/Lib/Bucket/libBucket.a \
+ $(top_builddir)/Lib/Voronoi/libVoronoi.a \
$(top_builddir)/Lib/Debug/libDebug.a \
-lpu -lfnt -lssg -lsg \
$(top_builddir)/Lib/Misc/libMisc.a \
#include <Time/light.hxx>
#include <Time/sunpos.hxx>
#include <Time/moonpos.hxx>
-#include <Weather/weather.hxx>
+// #include <Weather/weather.hxx>
+#include <WeatherCM/FGLocalWeatherDatabase.h>
#include "fg_init.hxx"
#include "options.hxx"
fgEVENT::FG_EVENT_READY, 30000 );
// 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
if( fgCockpitInit( ¤t_aircraft )) {
#include <Objects/materialmgr.hxx>
#include <Time/fg_time.hxx>
#include <Time/light.hxx>
-#include <Weather/weather.hxx>
+// #include <Weather/weather.hxx>
+#include <WeatherCM/FGLocalWeatherDatabase.h>
#include "keyboard.hxx"
#include "options.hxx"
FGInterface *f;
FGTime *t;
FGView *v;
- FGWeather *w;
+ // FGWeather *w;
float fov, tmp;
static bool winding_ccw = true;
+ int speed;
f = current_aircraft.fdm_state;
t = FGTime::cur_time_params;
v = ¤t_view;
- w = ¤t_weather;
+ // w = ¤t_weather;
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
if ( puKeyboard(k, PU_DOWN) ) {
case 57: // numeric keypad 9
v->set_goal_view_offset( FG_PI * 1.75 );
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
// status = current_options.get_hud_status();
// current_options.set_hud_status(!status);
v->force_update_fov_math();
return;
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;
- w->set_visibility( tmp );
+ WeatherDatabase->setWeatherVisibility( tmp );
return;
}
} else {
controls.move_throttle( FGControls::ALL_ENGINES, -0.01 );
}
return;
+ case 97: // a key
+ speed = current_options.get_speed_up();
+ speed++;
+ current_options.set_speed_up( speed );
+ return;
case 98: // b key
int b_ret;
double b_set;
v->force_update_fov_math();
return;
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;
- w->set_visibility( tmp );
+ WeatherDatabase->setWeatherVisibility( tmp );
return;
case 27: // ESC
// if( fg_DebugOutput ) {
#include <Time/fg_time.hxx>
#include <Time/fg_timer.hxx>
#include <Time/sunpos.hxx>
-#include <Weather/weather.hxx>
+// #include <Weather/weather.hxx>
+// #include <WeatherCM/FGLocalWeatherDatabase.h>
#include "fg_init.hxx"
#include "keyboard.hxx"
// printf("updating flight model x %d\n", multi_loop);
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 {
fgFDMUpdate( current_options.get_flight_model(),
cur_fdm_state, 0, remainder );
#if defined( ENABLE_PLIB_JOYSTICK )
// Read joystick and update control settings
- fgJoystickRead();
+ if ( current_options.get_control_mode() == fgOPTIONS::FG_JOYSTICK ) {
+ fgJoystickRead();
+ }
#elif defined( ENABLE_GLUT_JOYSTICK )
// Glut joystick support works by feeding a joystick handler
// function to glut. This is taken care of once in the joystick
// init routine and we don't have to worry about it again.
#endif
- current_weather.Update();
+ // current_weather.Update();
// Fix elevation. I'm just sticking this here for now, it should
// probably move eventually
intro_music(1),
mouse_pointer(0),
pause(0),
+ control_mode(FG_JOYSTICK),
// Features
hud_status(1),
sound(1),
// Flight Model options
- flight_model(FGInterface::FG_LARCSIM),
+ flight_model( FGInterface::FG_LARCSIM ),
+ speed_up( 1 ),
// Rendering options
fog(FG_FOG_NICEST), // nicest
// 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
fgOPTIONS::parse_degree( const string& degree_str) {
double result = parse_time( degree_str );
pause = false;
} else if ( arg == "--enable-pause" ) {
pause = true;
+ } else if ( arg.find( "--control=") != string::npos ) {
+ parse_control( arg.substr(10) );
} else if ( arg == "--disable-hud" ) {
hud_status = false;
} else if ( arg == "--enable-hud" ) {
fg_root = arg.substr( 10 );
} else if ( arg.find( "--fdm=" ) != string::npos ) {
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" ) {
fog = FG_FOG_DISABLED;
} else if ( arg == "--fog-fastest" ) {
printf("\t\tfull screen voodoo/voodoo-II based cards.)\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--control=mode: primary control mode (joystick, keyboard, mouse)\n");
printf("\n");
printf("Features:\n");
printf("Flight Model:\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("Initial Position and Orientation:\n");
FG_RADIUS_MAX = 4
};
+ enum fgControlMode
+ {
+ FG_JOYSTICK = 0,
+ FG_KEYBOARD = 1,
+ FG_MOUSE = 2
+ };
+
private:
// The flight gear "root" directory
bool intro_music; // play introductory music
int mouse_pointer; // show mouse pointer
bool pause; // pause intially enabled/disabled
+ fgControlMode control_mode; // primary control mode
// Features
bool hud_status; // HUD on/off
// Flight Model options
int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
+ int speed_up; // Sim mechanics run this much faster than normal speed
// Rendering options
fgFogKind fog; // Fog nicest/fastest/disabled
inline bool get_intro_music() const { return intro_music; }
inline int get_mouse_pointer() const { return mouse_pointer; }
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_panel_status() const { return panel_status; }
inline bool get_sound() const { return sound; }
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 fgFogKind get_fog() const { return fog; }
inline double get_fov() const { return fov; }
private:
+ void parse_control( const string& mode );
double parse_time( const string& time_str );
long int parse_date( const string& date_str );
double parse_degree( const string& degree_str );