From 6d427da8d87c1d5e6fd54886100fe9fe741136bf Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 27 Jul 1998 18:41:23 +0000 Subject: [PATCH] Added a pause command "p" Fixed some initialization order problems between pui and glut. Added an --enable/disable-sound option. --- Main/GLUTkey.cxx | 26 +++++++++++++++++--------- Main/GLUTmain.cxx | 38 ++++++++++++++++++++++++++------------ Main/fg_init.cxx | 12 ++++++++++-- Main/options.cxx | 12 ++++++++++++ Main/options.hxx | 7 +++++++ 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/Main/GLUTkey.cxx b/Main/GLUTkey.cxx index 3c68267a7..22677956b 100644 --- a/Main/GLUTkey.cxx +++ b/Main/GLUTkey.cxx @@ -187,6 +187,9 @@ void GLUTkey(unsigned char k, int x, int y) { case 109: /* m key */ t->warp += 60; return; + case 112: /* p key */ + t->pause = !t->pause; + return; case 116: /* t key */ t->warp_delta += 30; return; @@ -305,16 +308,21 @@ void GLUTspecialkey(int k, int x, int y) { /* $Log$ -/* Revision 1.16 1998/07/16 17:33:34 curt -/* "H" / "h" now control hud brightness as well with off being one of the -/* states. -/* Better checking for xmesa/fx 3dfx fullscreen/window support for deciding -/* whether or not to build in the feature. -/* Translucent menu support. -/* HAVE_AUDIO_SUPPORT -> ENABLE_AUDIO_SUPPORT -/* Use fork() / wait() for playing mp3 init music in background under unix. -/* Changed default tile diameter to 5. +/* Revision 1.17 1998/07/27 18:41:23 curt +/* Added a pause command "p" +/* Fixed some initialization order problems between pui and glut. +/* Added an --enable/disable-sound option. /* + * Revision 1.16 1998/07/16 17:33:34 curt + * "H" / "h" now control hud brightness as well with off being one of the + * states. + * Better checking for xmesa/fx 3dfx fullscreen/window support for deciding + * whether or not to build in the feature. + * Translucent menu support. + * HAVE_AUDIO_SUPPORT -> ENABLE_AUDIO_SUPPORT + * Use fork() / wait() for playing mp3 init music in background under unix. + * Changed default tile diameter to 5. + * * Revision 1.15 1998/07/13 21:01:34 curt * Wrote access functions for current fgOPTIONS. * diff --git a/Main/GLUTmain.cxx b/Main/GLUTmain.cxx index 5d9f00aa2..3e244ea94 100644 --- a/Main/GLUTmain.cxx +++ b/Main/GLUTmain.cxx @@ -464,8 +464,12 @@ void fgUpdateTimeDepCalcs(int multi_loop) { multi_loop = DEFAULT_MULTILOOP; } - // printf("updating flight model x %d\n", multi_loop); - fgFlightModelUpdate(FG_LARCSIM, f, multi_loop); + if ( !t->pause ) { + // printf("updating flight model x %d\n", multi_loop); + fgFlightModelUpdate(FG_LARCSIM, f, multi_loop); + } else { + fgFlightModelUpdate(FG_LARCSIM, f, 0); + } // update the view angle for ( i = 0; i < multi_loop; i++ ) { @@ -639,7 +643,9 @@ static void fgMainLoop( void ) { // Run audio scheduler #ifdef ENABLE_AUDIO_SUPPORT - audio_sched -> update(); + if ( current_options.get_sound() ) { + audio_sched -> update(); + } #endif // redraw display @@ -694,10 +700,7 @@ static void fgIdleFunction ( void ) { } else if ( idle_state == 2 ) { // These are a few miscellaneous things that aren't really // "subsystems" but still need to be initialized. - if( !fgInitGeneral()) { - fgPrintf( FG_GENERAL, FG_EXIT, - "General initializations failed ...\n" ); - } + #ifdef USE_GLIDE if ( strstr ( g->glRenderer, "Glide" ) ) { grTexLodBiasValue ( GR_TMU0, 1.0 ) ; @@ -728,8 +731,6 @@ static void fgIdleFunction ( void ) { idle_state++; } else if ( idle_state == 5 ) { - //Init the user interface - guiInit(); idle_state++; } else if ( idle_state == 6 ) { @@ -762,8 +763,6 @@ static void fgIdleFunction ( void ) { strcat(slfile, "wasp.wav"); s1 = new slSample ( slfile ); - // s1 = new slSample ( "/dos/X-System-HSR/sounds/xp_recip.wav", - // audio_sched ); printf("Rate = %d Bps = %d Stereo = %d\n", s1 -> getRate(), s1 -> getBps(), s1 -> getStereo()); audio_sched -> loopSample ( s1 ); @@ -775,7 +774,7 @@ static void fgIdleFunction ( void ) { // audio_sched -> playSample ( s2 ); #endif - sleep(1); + // sleep(1); idle_state = 1000; } @@ -914,6 +913,16 @@ int main( int argc, char **argv ) { current_options.usage(); fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n"); } + + // First do some quick general initializations + if( !fgInitGeneral()) { + fgPrintf( FG_GENERAL, FG_EXIT, + "General initializations failed ...\n" ); + } + + // Init the user interface (we need to do this before passing off + // control to glut + guiInit(); // pass control off to the master GLUT event handler glutMainLoop(); @@ -924,6 +933,11 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.41 1998/07/27 18:41:24 curt +// Added a pause command "p" +// Fixed some initialization order problems between pui and glut. +// Added an --enable/disable-sound option. +// // Revision 1.40 1998/07/24 21:56:59 curt // Set near clip plane to 0.5 meters when close to the ground. Also, let the view get a bit closer to the ground before hitting the hard limit. // diff --git a/Main/fg_init.cxx b/Main/fg_init.cxx index 88689046d..bcb4aa9c2 100644 --- a/Main/fg_init.cxx +++ b/Main/fg_init.cxx @@ -127,8 +127,11 @@ int fgInitPosition( void ) { // FG_Runway_altitude = 920.0; // FG_Altitude = FG_Runway_altitude + 3.758099; - // probably interesting for european team members - // That is: If I can get the scenery to work -;) (Durk) + // Initial Position: Huaras, Peru (S09d 31.871' W077d 31.498') + // FG_Longitude = ( -77.5249667 ) * DEG_TO_RAD; + // FG_Latitude = ( -9.5311833 ) * DEG_TO_RAD; + // FG_Runway_altitude = 0.0; + // FG_Altitude = FG_Runway_altitude + 3.758099; // Eclipse Watching w73.5 n10 (approx) 18:00 UT // FG_Longitude = ( -73.5 ) * DEG_TO_RAD; @@ -401,6 +404,11 @@ int fgInitSubsystems( void ) { // $Log$ +// Revision 1.28 1998/07/27 18:41:25 curt +// Added a pause command "p" +// Fixed some initialization order problems between pui and glut. +// Added an --enable/disable-sound option. +// // Revision 1.27 1998/07/24 21:39:10 curt // Debugging output tweaks. // Cast glGetString to (char *) to avoid compiler errors. diff --git a/Main/options.cxx b/Main/options.cxx index bafe1cc4c..f15e04b9a 100644 --- a/Main/options.cxx +++ b/Main/options.cxx @@ -297,6 +297,10 @@ int fgOPTIONS::parse_option( char *arg ) { panel_status = 0; } else if ( strcmp(arg, "--enable-panel") == 0 ) { panel_status = 1; + } else if ( strcmp(arg, "--disable-sound") == 0 ) { + sound = 0; + } else if ( strcmp(arg, "--enable-sound") == 0 ) { + sound = 1; } else if ( strncmp(arg, "--airport-id=", 13) == 0 ) { arg += 13; strncpy(airport_id, arg, 4); @@ -432,6 +436,8 @@ void fgOPTIONS::usage ( void ) { printf("\t--enable-hud: enable heads up display\n"); printf("\t--disable-panel: disable instrument panel\n"); printf("\t--enable-panel: enable instrumetn panel\n"); + printf("\t--disable-sound: disable sound effects\n"); + printf("\t--enable-sound: enable sound effects\n"); printf("\n"); printf("Initial Position:\n"); @@ -472,6 +478,7 @@ int fgOPTIONS::get_intro_music( void ) { return(intro_music); } int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); } int fgOPTIONS::get_hud_status( void ) { return(hud_status); } int fgOPTIONS::get_panel_status( void ) { return(panel_status); } +int fgOPTIONS::get_sound( void ) { return(sound); } int fgOPTIONS::get_fog( void ) { return(fog); } double fgOPTIONS::get_fov( void ) { return(fov); } int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); } @@ -494,6 +501,11 @@ fgOPTIONS::~fgOPTIONS( void ) { // $Log$ +// Revision 1.19 1998/07/27 18:41:25 curt +// Added a pause command "p" +// Fixed some initialization order problems between pui and glut. +// Added an --enable/disable-sound option. +// // Revision 1.18 1998/07/22 01:27:03 curt // Strip out \r when parsing config file in case we are on a windoze system. // diff --git a/Main/options.hxx b/Main/options.hxx index 142d324ce..6982d0589 100644 --- a/Main/options.hxx +++ b/Main/options.hxx @@ -53,6 +53,7 @@ class fgOPTIONS { // Features int hud_status; // HUD on/off int panel_status; // Panel on/off + int sound; // play sound effects // Rendering options int fog; // Fog enabled/disabled @@ -99,6 +100,7 @@ public: int get_mouse_pointer( void ); int get_hud_status( void ); int get_panel_status( void ); + int get_sound( void ); int get_fog( void ); double get_fov( void ); int get_fullscreen( void ); @@ -127,6 +129,11 @@ extern fgOPTIONS current_options; // $Log$ +// Revision 1.12 1998/07/27 18:41:26 curt +// Added a pause command "p" +// Fixed some initialization order problems between pui and glut. +// Added an --enable/disable-sound option. +// // Revision 1.11 1998/07/13 21:01:39 curt // Wrote access functions for current fgOPTIONS. //