From fc84045169c0cd0c587aa22946384ee51954dd17 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 22 Jul 2000 23:25:49 +0000 Subject: [PATCH] Activated gyro drift ... look out! Cleaned a bit of cruft out of gui.[ch]xx Cleaned up win_ratio() and fov code to make more sense and be a bit more consistant and robust and less buggy and less susceptible to screw ups. Panel is activated now by default, HUD is off by default. --- src/Cockpit/steam.cxx | 2 +- src/GUI/gui.cxx | 20 -------------------- src/GUI/gui.h | 2 -- src/Main/main.cxx | 13 +++++++------ src/Main/options.cxx | 19 +++++++++++-------- src/Main/views.cxx | 12 +++--------- src/Main/views.hxx | 2 +- 7 files changed, 23 insertions(+), 47 deletions(-) diff --git a/src/Cockpit/steam.cxx b/src/Cockpit/steam.cxx index 5955cda94..fb7acb686 100644 --- a/src/Cockpit/steam.cxx +++ b/src/Cockpit/steam.cxx @@ -323,7 +323,7 @@ void FGSteam::_CatchUp() */ if ( _UpdatesPending > 999999 ) the_DG_err = FGBFI::getMagVar(); - the_DG_degps = 0.0; /* HACK! */ + the_DG_degps = 0.01; /* HACK! */ if (dt<1.0) the_DG_err += dt * the_DG_degps; the_DG_deg = FGBFI::getHeading () - the_DG_err; diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 1695acb8b..23464e22a 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -667,26 +667,6 @@ void mkDialog (const char *txt) FG_PUSH_PUI_DIALOG( dialogBox ); } -// Repair any damage done to the Panel by other Gui Items -void guiFixPanel( void ) -{ -#if 0 // this function does nothing anyway - bool freeze = globals->get_freeze(); - - if ( current_options.get_panel_status() ) { - // FGView *v = ¤t_view; - if( !freeze ) - globals->set_freeze( true ); - - // we must have some something here at some point but this - // function does nothing now. - - if( !freeze ) - globals->set_freeze( false ); - } -#endif -} - // Toggle the Menu and Mouse display state void guiToggleMenu(void) { diff --git a/src/GUI/gui.h b/src/GUI/gui.h index dc0e171e8..e33d61717 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -37,7 +37,6 @@ extern void BusyCursor( int restore ); extern void guiToggleMenu(void); extern void mkDialog(const char *txt); extern void ConfirmExitDialog(void); -extern void guiFixPanel( void ); extern void fgDumpSnapShot(); @@ -66,7 +65,6 @@ extern char *gui_msg_RESET; // "RESET" #define FG_POP_PUI_DIALOG( X ) \ (X)->hide(); \ puPopLiveInterface(); \ - guiFixPanel(); \ maybeToggleMouse(); // Finalize Dialog Box Construction diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 6837c403b..ca412ad3c 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -480,7 +480,8 @@ void fgRenderFrame( void ) { // glMatrixMode( GL_PROJECTION ); // glLoadIdentity(); float fov = current_options.get_fov(); - ssgSetFOV(fov * current_view.get_win_ratio(), fov); + // ssgSetFOV(fov * current_view.get_win_ratio(), fov); + ssgSetFOV(fov, fov * current_view.get_win_ratio()); double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER - scenery.cur_elev; @@ -1111,12 +1112,11 @@ static void fgIdleFunction ( void ) { // options.cxx needs to see this for toggle_panel() // Handle new window size or exposure void fgReshape( int width, int height ) { - if ( ! current_options.get_panel_status() ) { - current_view.set_win_ratio( (GLfloat) width / (GLfloat) height ); + if ( ! current_options.get_panel_status() || idle_state != 1000 ) { + current_view.set_win_ratio( height / width ); glViewport(0, 0 , (GLint)(width), (GLint)(height) ); } else { - current_view.set_win_ratio( (GLfloat) width / - ((GLfloat) (height)*0.4232) ); + current_view.set_win_ratio( (height*0.4232) / width ); glViewport(0, (GLint)((height)*0.5768), (GLint)(width), (GLint)((height)*0.4232) ); } @@ -1132,7 +1132,8 @@ void fgReshape( int width, int height ) { // glViewport ( 0, 0, width, height ); float fov = current_options.get_fov(); - ssgSetFOV(fov * current_view.get_win_ratio(), fov); + // ssgSetFOV(fov * current_view.get_win_ratio(), fov); + ssgSetFOV(fov, fov * current_view.get_win_ratio()); fgHUDReshape(); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 5f5904384..bea86b188 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -160,8 +160,8 @@ fgOPTIONS::fgOPTIONS() : auto_coordination(FG_AUTO_COORD_NOT_SPECIFIED), // Features - hud_status(1), - panel_status(0), + hud_status(0), + panel_status(1), sound(1), anti_alias_hud(0), @@ -182,8 +182,8 @@ fgOPTIONS::fgOPTIONS() : skyblend(1), textures(1), wireframe(0), - xsize(640), - ysize(480), + xsize(800), + ysize(600), bpp(16), view_mode(FG_VIEW_PILOT), @@ -257,11 +257,14 @@ fgOPTIONS::toggle_panel() { if ( current_panel != NULL ) current_panel->setVisibility(true); } - if ( panel_status ) { + + // new rule .. "fov" shouldn't get messed with like this. + /* if ( panel_status ) { fov *= 0.4232; } else { fov *= (1.0 / 0.4232); - } + } */ + // fgReshape( xsize, ysize); fgReshape( current_view.get_winWidth(), current_view.get_winHeight() ); @@ -633,8 +636,8 @@ int fgOPTIONS::parse_option( const string& arg ) { } else if ( arg == "--enable-panel" ) { panel_status = true; if ( current_panel != NULL ) - current_panel->setVisibility(true); - fov *= 0.4232; + current_panel->setVisibility(true); + // fov *= 0.4232; /* NO!!! */ } else if ( arg == "--disable-sound" ) { sound = false; } else if ( arg == "--enable-sound" ) { diff --git a/src/Main/views.cxx b/src/Main/views.cxx index f9d6f682a..af24b3a6b 100644 --- a/src/Main/views.cxx +++ b/src/Main/views.cxx @@ -42,10 +42,6 @@ #include "views.hxx" -// temporary (hopefully) hack -static int panel_hist = 0; - - // This is a record containing current view parameters for the current // aircraft position FGView pilot_view; @@ -72,10 +68,9 @@ void FGView::Init( void ) { winHeight = current_options.get_ysize(); if ( ! current_options.get_panel_status() ) { - set_win_ratio( (GLfloat) winWidth / (GLfloat) winHeight ); + set_win_ratio( winHeight / winWidth ); } else { - set_win_ratio( (GLfloat) winWidth / - ((GLfloat) (winHeight)*0.4232) ); + set_win_ratio( (winHeight*0.4232) / winWidth ); } // This never changes -- NHV @@ -137,6 +132,7 @@ inline static void fgMakeLOCAL( sgMat4 dst, const double Theta, } #endif + // Update the view volume, position, and orientation void FGView::UpdateViewParams( const FGInterface& f ) { UpdateViewMath(f); @@ -147,8 +143,6 @@ void FGView::UpdateViewParams( const FGInterface& f ) { xglViewport(0, (GLint)((winHeight)*0.5768), (GLint)(winWidth), (GLint)((winHeight)*0.4232) ); } - - panel_hist = current_options.get_panel_status(); } diff --git a/src/Main/views.hxx b/src/Main/views.hxx index ec5bc00d0..4ff5bda49 100644 --- a/src/Main/views.hxx +++ b/src/Main/views.hxx @@ -64,7 +64,7 @@ public: bool update_fov; // fov of view is specified in the y direction, win_ratio is used to - // calculate the fov in the X direction = width/height + // calculate the fov in the X direction = width / height double win_ratio; // width & height of window