# include <config.h>
#endif
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <GL/glut.h>
-#include <XGL/xgl.h>
+#include <simgear/xgl/xgl.h>
#if defined(FX) && defined(XMESA)
extern bool global_fullscreen;
#endif
+#include <simgear/math/sg_types.hxx>
+#include <simgear/timing/sg_time.hxx>
+
#include STL_STRING
#include <vector>
FG_USING_STD(vector);
FG_USING_STD(string);
-typedef vector < string > str_container;
-typedef str_container::iterator str_iterator;
-typedef str_container::const_iterator const_str_iterator;
+#define NEW_DEFAULT_MODEL_HZ 120
-class fgOPTIONS {
+class FGOptions {
public:
FG_MOUSE = 2
};
+ enum fgViewMode
+ {
+ FG_VIEW_PILOT = 0, // Pilot perspective
+ FG_VIEW_FOLLOW = 1, // Following in the "foot steps" so to speak
+ FG_VIEW_CHASE = 2, // Chase
+ FG_VIEW_CIRCLING = 3, // Circling
+ FG_VIEW_SATELLITE = 4, // From high above
+ FG_VIEW_ANCHOR = 5, // Drop an anchor and watch from there
+ FG_VIEW_TOWER = 6, // From nearest tower?
+ FG_VIEW_SPOTTER = 7 // Fron a ground spotter
+ };
+
+ enum fgAutoCoordMode
+ {
+ FG_AUTO_COORD_NOT_SPECIFIED = 0,
+ FG_AUTO_COORD_DISABLED = 1,
+ FG_AUTO_COORD_ENABLED = 2
+ };
+
+ enum fgTimingOffsetType {
+ FG_TIME_SYS_OFFSET = 0,
+ FG_TIME_GMT_OFFSET = 1,
+ FG_TIME_LAT_OFFSET = 2,
+ FG_TIME_SYS_ABSOLUTE = 3,
+ FG_TIME_GMT_ABSOLUTE = 4,
+ FG_TIME_LAT_ABSOLUTE = 5
+ };
+
+ enum fgSpeedSet {
+ FG_VC = 1,
+ FG_MACH = 2,
+ FG_VTUVW = 3,
+ FG_VTNED = 4
+ };
+
private:
// The flight gear "root" directory
string fg_root;
+ // The scenery "root" directory
+ string fg_scenery;
+
// Starting position and orientation
string airport_id; // ID of initial starting airport
double lon; // starting longitude in degrees (west = -)
double heading; // heading (yaw) angle in degress (Psi)
double roll; // roll angle in degrees (Phi)
double pitch; // pitch angle in degrees (Theta)
+ fgSpeedSet speedset; // which speed does the user want
double uBody; // Body axis X velocity (U)
double vBody; // Body axis Y velocity (V)
double wBody; // Body axis Z velocity (W)
+ double vNorth; // North component of vt
+ double vEast; // East component of vt
+ double vDown; // Down component of vt
+ double vkcas; // Calibrated airspeed, knots
+ double mach; // Mach number
// Miscellaneous
bool game_mode; // Game mode enabled/disabled
bool splash_screen; // show splash screen
bool intro_music; // play introductory music
int mouse_pointer; // show mouse pointer
- bool pause; // pause intially enabled/disabled
fgControlMode control_mode; // primary control mode
+ fgAutoCoordMode auto_coordination; // enable auto coordination
// Features
bool hud_status; // HUD on/off
bool panel_status; // Panel on/off
bool sound; // play sound effects
+ bool anti_alias_hud;
// Flight Model options
- int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
+ int flight_model; // Core flight model code: jsb, larcsim, magic, etc.
+ string aircraft; // Aircraft to model
+ int model_hz; // number of FDM iterations per second
int speed_up; // Sim mechanics run this much faster than normal speed
+ int trim; // use the FDM trimming routine during init
+ // <0 --notrim set, 0 no trim, >0 trim
+ // default behavior is to enable trimming for jsbsim
+ // disable for all other fdm's
// Rendering options
fgFogKind fog; // Fog nicest/fastest/disabled
+ bool clouds; // Enable clouds
+ double clouds_asl; // Cloud layer height above sea level
double fov; // Field of View
bool fullscreen; // Full screen mode enabled/disabled
int shading; // shading method, 0 = Flat, 1 = Smooth
bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled
int xsize, ysize; // window size derived from geometry string
+ int bpp; // bits per pixel
+ fgViewMode view_mode; // view mode
+ double default_view_offset; // default forward view offset (for use by
+ // multi-display configuration
// Scenery options
int tile_radius; // Square radius of rendered tiles (around center
int tris_or_culled;
// Time options
- int time_offset; // Offset true time by this many seconds
- long int start_gst; // Specify a greenwich sidereal time (gst)
- long int start_lst; // Specify a local sidereal time (lst)
-
- // Serial Ports, we currently support up to four channels
- // fgSerialPortKind port_a_kind; // Port a kind
- // fgSerialPortKind port_b_kind; // Port b kind
- // fgSerialPortKind port_c_kind; // Port c kind
- // fgSerialPortKind port_d_kind; // Port d kind
+ int time_offset; // Use this value to change time.
+ fgTimingOffsetType time_offset_type; // Will be set to one of the
+ // FG_TIME_* enums, to deterine how
+ // time_offset should be used
// Serial port configuration strings
- str_container port_options_list;
+ string_list channel_options_list;
// Network options
+ bool network_olk;
string net_id;
public:
- fgOPTIONS();
- ~fgOPTIONS();
+ FGOptions();
+ ~FGOptions();
// Parse a single option
int parse_option( const string& arg );
+ // Scan the command line options for an fg_root definition and set
+ // just that.
+ int scan_command_line_for_root( int argc, char **argv );
+
+ // Scan the config file for an fg_root definition and set just
+ // that.
+ int scan_config_file_for_root( const string& path );
+
// Parse the command line options
int parse_command_line( int argc, char **argv );
// Query functions
inline string get_fg_root() const { return fg_root; }
+ inline string get_fg_scenery() const { return fg_scenery; }
inline string get_airport_id() const { return airport_id; }
inline double get_lon() const { return lon; }
inline double get_lat() const { return lat; }
inline double get_heading() const { return heading; }
inline double get_roll() const { return roll; }
inline double get_pitch() const { return pitch; }
+ inline fgSpeedSet get_speedset() const { return speedset; }
inline double get_uBody() const {return uBody;}
inline double get_vBody() const {return vBody;}
inline double get_wBody() const {return wBody;}
+ inline double get_vNorth() const {return vNorth;}
+ inline double get_vEast() const {return vEast;}
+ inline double get_vDown() const {return vDown;}
+ inline double get_vc() const {return vkcas;}
+ inline double get_mach() const {return mach;}
+
inline bool get_game_mode() const { return game_mode; }
inline bool get_splash_screen() const { return splash_screen; }
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 bool get_anti_alias_hud() const { return anti_alias_hud; }
inline fgControlMode get_control_mode() const { return control_mode; }
inline void set_control_mode( fgControlMode mode ) { control_mode = mode; }
+ inline fgAutoCoordMode get_auto_coordination() const {
+ return auto_coordination;
+ }
+ inline void set_auto_coordination(fgAutoCoordMode m) {
+ auto_coordination = m;
+ }
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 string get_aircraft() const { return aircraft; }
+ inline int get_model_hz() const { return model_hz; }
inline int get_speed_up() const { return speed_up; }
inline void set_speed_up( int speed ) { speed_up = speed; }
+ inline int get_trim_mode(void) { return trim; }
+
inline bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
inline fgFogKind get_fog() const { return fog; }
+ inline bool get_clouds() const { return clouds; }
+ inline double get_clouds_asl() const { return clouds_asl; }
inline double get_fov() const { return fov; }
inline bool get_fullscreen() const { return fullscreen; }
inline int get_shading() const { return shading; }
inline bool get_wireframe() const { return wireframe; }
inline int get_xsize() const { return xsize; }
inline int get_ysize() const { return ysize; }
+ inline int get_bpp() const { return bpp; }
+ inline fgViewMode get_view_mode() const { return view_mode; }
+ inline double get_default_view_offset() const {
+ return default_view_offset;
+ }
+
+
inline int get_tile_radius() const { return tile_radius; }
inline int get_tile_diameter() const { return tile_diameter; }
inline int get_tris_or_culled() const { return tris_or_culled; }
inline int get_time_offset() const { return time_offset; }
- inline long int get_start_gst() const { return start_gst; };
- inline long int get_start_lst() const { return start_lst; }
+ inline fgTimingOffsetType get_time_offset_type() const {
+ return time_offset_type;
+ };
- inline str_container get_port_options_list() const {
- return port_options_list;
+ inline string_list get_channel_options_list() const {
+ return channel_options_list;
}
+
+ inline bool get_network_olk() const { return network_olk; }
inline string get_net_id() const { return net_id; }
// Update functions
+ inline void set_fg_root (const string value) { fg_root = value; }
+ inline void set_fg_scenery (const string value) { fg_scenery = value; }
inline void set_airport_id( const string id ) { airport_id = id; }
+ inline void set_lon (double value) { lon = value; }
+ inline void set_lat (double value) { lat = value; }
+ inline void set_altitude (double value) { altitude = value; }
+ inline void set_heading (double value) { heading = value; }
+ inline void set_roll (double value) { roll = value; }
+ inline void set_pitch (double value) { pitch = value; }
+ inline void set_uBody (double value) { uBody = value; }
+ inline void set_vBody (double value) { vBody = value; }
+ inline void set_wBody (double value) { wBody = value; }
+ inline void set_vc (double value) { vkcas = value; }
+ inline void set_mach(double value) { mach = value; }
+ inline void set_game_mode (bool value) { game_mode = value; }
+ inline void set_splash_screen (bool value) { splash_screen = value; }
+ inline void set_intro_music (bool value) { intro_music = value; }
+ inline void set_mouse_pointer (int value) { mouse_pointer = value; }
+ inline void set_anti_alias_hud (bool value) { anti_alias_hud = value; }
inline void set_hud_status( bool status ) { hud_status = status; }
+ inline void set_sound (bool value) { sound = value; }
+ inline void set_flight_model (int value) { flight_model = value; }
+ inline void set_aircraft (const string &ac) { aircraft = ac; }
+ inline void set_model_hz (int value) { model_hz = value; }
+ inline void set_trim_mode(int value) { trim = value; }
+ inline void set_fog (fgFogKind value) { fog = value; }
+ inline void set_clouds( bool value ) { clouds = value; }
+ inline void set_clouds_asl( double value ) { clouds_asl = value; }
inline void set_fov( double amount ) { fov = amount; }
+ inline void set_fullscreen (bool value) { fullscreen = value; }
+ inline void set_shading (int value) { shading = value; }
+ inline void set_skyblend (bool value) { skyblend = value; }
inline void set_textures( bool status ) { textures = status; }
+ inline void set_wireframe (bool status) { wireframe = status; }
inline void cycle_fog( void ) {
if ( fog == FG_FOG_DISABLED ) {
fog = FG_FOG_FASTEST;
}
}
void toggle_panel();
- inline void set_xsize( int x ) { xsize= x; }
- inline void set_ysize( int y ) { xsize= y; }
+ inline void set_xsize( int x ) { xsize = x; }
+ inline void set_ysize( int y ) { ysize = y; }
+ inline void set_view_mode (fgViewMode value) { view_mode = value; }
+ inline void set_tile_radius (int value) { tile_radius = value; }
+ inline void set_tile_diameter (int value) { tile_diameter = value; }
+ inline void set_units (int value) { units = value; }
+ inline void set_tris_or_culled (int value) { tris_or_culled = value; }
+ inline void set_time_offset (int value) { time_offset = value; }
+ inline void set_time_offset_type (fgTimingOffsetType value) {
+ time_offset_type = value;
+ }
+ inline void cycle_view_mode() {
+ if ( view_mode == FG_VIEW_PILOT ) {
+ view_mode = FG_VIEW_FOLLOW;
+ } else if ( view_mode == FG_VIEW_FOLLOW ) {
+ view_mode = FG_VIEW_PILOT;
+ }
+ }
+
+ inline void set_network_olk( bool net ) { network_olk = net; }
inline void set_net_id( const string id ) { net_id = id; }
private:
int parse_tile_radius( const string& arg );
int parse_fdm( const string& fm );
double parse_fov( const string& arg );
- bool parse_serial( const string& serial_str );
+ bool parse_channel( const string& type, const string& channel_str );
+ bool parse_wp( const string& arg );
};
-extern fgOPTIONS current_options;
+// extern FGOptions current_options;
#endif /* _OPTIONS_HXX */