From 0d457e78e2f6c6a9a0bf31dba3426531b132e572 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 14 Dec 2000 21:59:47 +0000 Subject: [PATCH] Fix a view bug that could make the aircraft appear rotated from an external view if the primary view was rotated before we switched. --- Makefile.am | 12 +++--------- src/GUI/gui.cxx | 22 ++++++++++++++++++++++ src/GUI/gui.h | 1 + src/Main/keyboard.cxx | 2 ++ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9f83df0f5..d1124d23b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,9 +32,7 @@ fgfs-base-tar: FlightGear/Scenery/w130n30/w123n37 \ FlightGear/Scenery/w130n30/w122n37 \ FlightGear/Sounds \ - FlightGear/Textures \ - FlightGear/T[A-Za-df-z]* \ - FlightGear/[U-W]* FlightGear/[c-m]*) + FlightGear/[T-Za]* FlightGear/[c-z]*) fgfs-base-zip: (cd $(HOME); \ @@ -44,9 +42,7 @@ fgfs-base-zip: FlightGear/Scenery/w130n30/w123n37 \ FlightGear/Scenery/w130n30/w122n37 \ FlightGear/Sounds \ - FlightGear/Textures \ - FlightGear/T[A-Za-df-z]* \ - FlightGear/[U-W]* FlightGear/[c-z]* \ + FlightGear/[T-Za]* FlightGear/[c-z]* \ -x '*/CVS/*' ) fgfs-base-patch: @@ -57,9 +53,7 @@ fgfs-base-patch: FlightGear/Scenery/w130n30/w123n37 \ FlightGear/Scenery/w130n30/w122n37 \ FlightGear/Sounds \ - FlightGear/Textures \ - FlightGear/T[A-Za-df-z]* \ - FlightGear/[U-W]* FlightGear/[c-m]*) + FlightGear/[T-Za]* FlightGear/[c-z]*) fgfs-textures-high: (cd $(HOME); \ diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 0b2843bd4..9521d276b 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -354,6 +354,28 @@ void BusyCursor( int restore ) } } + +// Center the view offsets +void CenterView( void ) { + if( mouse_mode = MOUSE_VIEW ) { + mouse_mode = MOUSE_POINTER; + _savedX = globals->get_options()->get_xsize()/2; + _savedY = globals->get_options()->get_ysize()/2; + _mVtoggle = 0; + Quat0(); + build_rotmatrix(quat_mat, curquat); + glutSetCursor(GLUT_CURSOR_INHERIT); + + // Is this necessary ?? + if( !menu_on ) TurnCursorOff(); + + glutWarpPointer( _savedX, _savedY ); + } + globals->get_current_view()->set_goal_view_offset(0.0); + globals->get_current_view()->set_view_offset(0.0); +} + + int guiGetMouseButton(void) { return last_buttons; diff --git a/src/GUI/gui.h b/src/GUI/gui.h index e33d61717..133a5b4da 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -33,6 +33,7 @@ extern void guiMotionFunc ( int x, int y ); extern void guiMouseFunc(int button, int updown, int x, int y); extern void maybeToggleMouse( void ); extern void BusyCursor( int restore ); +extern void CenterView( void ); extern void guiToggleMenu(void); extern void mkDialog(const char *txt); diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index f983144ea..531f910de 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -370,6 +370,8 @@ void GLUTkey(unsigned char k, int x, int y) { fgUpdateSkyAndLightingParams(); return; case 118: // v key + // handles GUI state as well as Viewer LookAt Direction + CenterView(); globals->set_current_view( globals->get_viewmgr()->next_view() ); fgReshape( globals->get_options()->get_xsize(), globals->get_options()->get_ysize() );