diff --git a/Main/GLUTkey.cxx b/Main/GLUTkey.cxx index c176504fe..3c68267a7 100644 --- a/Main/GLUTkey.cxx +++ b/Main/GLUTkey.cxx @@ -39,6 +39,7 @@ #include <Aircraft/aircraft.h> #include <Autopilot/autopilot.h> // Added autopilot.h to list, Jeff Goeke-Smith +#include <Cockpit/hud.hxx> #include <Debug/fg_debug.h> #include <GUI/gui.h> #include <Include/fg_constants.h> @@ -99,8 +100,9 @@ void GLUTkey(unsigned char k, int x, int y) { v->goal_view_offset = FG_PI * 1.75; return; case 72: /* H key */ - status = current_options.get_hud_status(); - current_options.set_hud_status(!status); + // status = current_options.get_hud_status(); + // current_options.set_hud_status(!status); + HUD_brightkey( true ); return; case 77: /* M key */ t->warp -= 60; @@ -111,7 +113,9 @@ void GLUTkey(unsigned char k, int x, int y) { case 87: /* W key */ #if defined(FX) && !defined(WIN32) fullscreen = ( !fullscreen ); +#if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW) XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); +#endif #endif return; case 88: /* X key */ @@ -177,6 +181,9 @@ void GLUTkey(unsigned char k, int x, int y) { case 51: /* numeric keypad 3 (Pg Dn) */ fgThrottleMove(0, -0.01); return; + case 104: /* h key */ + HUD_brightkey( false ); + return; case 109: /* m key */ t->warp += 60; return; @@ -298,9 +305,19 @@ void GLUTspecialkey(int k, int x, int y) { /* $Log$ -/* Revision 1.15 1998/07/13 21:01:34 curt -/* Wrote access functions for current fgOPTIONS. +/* 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. + * * Revision 1.14 1998/07/06 02:42:02 curt * Added support for switching between fullscreen and window mode for * Mesa/3dfx/glide. diff --git a/Main/GLUTmain.cxx b/Main/GLUTmain.cxx index bea6d4215..b4d7f400f 100644 --- a/Main/GLUTmain.cxx +++ b/Main/GLUTmain.cxx @@ -45,7 +45,9 @@ #include <sys/stat.h> /* for stat() */ #ifdef HAVE_UNISTD_H -# include <unistd.h> /* for stat() */ +# include <unistd.h> /* for fork() && stat() */ +# include <sys/types.h> /* for wait() */ +# include <sys/wait.h> /* for wait() */ #endif #include <Include/fg_constants.h> // for VERSION @@ -58,7 +60,7 @@ #include <Astro/stars.hxx> #include <Astro/sun.hxx> -#ifdef HAVE_AUDIO_SUPPORT +#ifdef ENABLE_AUDIO_SUPPORT # include <Audio/src/sl.h> # include <Audio/src/sm.h> #endif @@ -98,7 +100,7 @@ static idle_state = 0; int use_signals = 0; // Global structures for the Audio library -#ifdef HAVE_AUDIO_SUPPORT +#ifdef ENABLE_AUDIO_SUPPORT slScheduler *audio_sched; smMixer *audio_mixer; slSample *s1; @@ -155,9 +157,9 @@ static void fgInitVisuals( void ) { if ( (current_options.get_fog() == 1) || (current_options.get_shading() == 0) ) { // if fastest fog requested, or if flat shading force fastest - xglHint (GL_FOG_HINT, GL_FASTEST ); + xglHint ( GL_FOG_HINT, GL_FASTEST ); } else if ( current_options.get_fog() == 2 ) { - xglHint (GL_FOG_HINT, GL_NICEST ); + xglHint ( GL_FOG_HINT, GL_NICEST ); } if ( current_options.get_wireframe() ) { // draw wire frame @@ -424,7 +426,12 @@ static void fgRenderFrame( void ) { // if (!o->panel_status) { // fgUpdateInstrViewParams(); // } + + // We can do translucent menus, so why not. :-) + xglEnable ( GL_BLEND ) ; + xglBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; puDisplay(); + xglDisable ( GL_BLEND ) ; } xglutSwapBuffers(); @@ -609,7 +616,7 @@ static void fgMainLoop( void ) { global_events.Process(); // Run audio scheduler -#ifdef HAVE_AUDIO_SUPPORT +#ifdef ENABLE_AUDIO_SUPPORT audio_sched -> update(); #endif @@ -631,7 +638,7 @@ static void fgMainLoop( void ) { static void fgIdleFunction ( void ) { fgGENERAL *g; char path[256], mp3file[256], command[256], slfile[256]; - static char *lockfile = "/tmp/mpg123.running"; + // static char *lockfile = "/tmp/mpg123.running"; g = &general; @@ -651,12 +658,21 @@ static void fgIdleFunction ( void ) { current_options.get_fg_root(mp3file); strcat(mp3file, "/Sounds/"); strcat(mp3file, "intro.mp3"); + /* sprintf(command, "(touch %s; mpg123 %s > /dev/null 2>&1; /bin/rm %s) &", lockfile, mp3file, lockfile ); + */ + sprintf(command, "mpg123 %s > /dev/null 2>&1", mp3file); fgPrintf( FG_GENERAL, FG_INFO, "Starting intro music: %s\n", mp3file); - system(command); + + int pid = fork () ; + + if ( pid == 0 ) { + system ( command ); + exit ( 0 ) ; + } } #endif @@ -704,21 +720,25 @@ static void fgIdleFunction ( void ) { idle_state++; } else if ( idle_state == 6 ) { // Initialize audio support -#ifdef HAVE_AUDIO_SUPPORT +#ifdef ENABLE_AUDIO_SUPPORT #if !defined(WIN32) if ( current_options.get_intro_music() ) { // Let's wait for mpg123 to finish - struct stat stat_buf; + // struct stat stat_buf; fgPrintf( FG_GENERAL, FG_INFO, - "Waiting for mpg123 player to finish " ); + "Waiting for mpg123 player to finish ...\n" ); + /* while ( stat(lockfile, &stat_buf) == 0 ) { // file exist, wait ... sleep(1); fgPrintf( FG_GENERAL, FG_INFO, "."); } fgPrintf( FG_GENERAL, FG_INFO, "\n"); + */ + + wait(0); } #endif // WIN32 @@ -728,12 +748,12 @@ static void fgIdleFunction ( void ) { audio_sched -> setSafetyMargin ( 1.0 ) ; current_options.get_fg_root(path); strcat(path, "/Sounds/"); - strcpy(slfile, path); - strcat(slfile, "prpidle.wav"); - // s1 = new slSample ( slfile ); - s1 = new slSample ( "/dos/X-System-HSR/sounds/xp_recip.wav", - audio_sched ); + 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 ); @@ -894,6 +914,16 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.36 1998/07/16 17:33:35 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.35 1998/07/13 21:01:36 curt // Wrote access functions for current fgOPTIONS. // diff --git a/Main/Makefile.am b/Main/Makefile.am index 454d74120..4c9b97390 100644 --- a/Main/Makefile.am +++ b/Main/Makefile.am @@ -1,14 +1,18 @@ -if HAVE_AUDIO_SUPPORT -DEFS += -DHAVE_AUDIO_SUPPORT +if ENABLE_AUDIO_SUPPORT +DEFS += -DENABLE_AUDIO_SUPPORT AUDIO_LIBS = \ $(top_builddir)/Lib/Audio/src/libsl.la \ $(top_builddir)/Lib/Audio/src/libsm.la endif -if HAVE_WIN32_AUDIO +if ENABLE_WIN32_AUDIO LIBS += -lwinmm endif +if ENABLE_XMESA_FX +DEFS += -DXMESA -DFX +endif + EXTRA_DIST = runfg.in runfg.bat.in bin_PROGRAMS = fg diff --git a/Main/options.cxx b/Main/options.cxx index 5e3b9ff40..314dbe576 100644 --- a/Main/options.cxx +++ b/Main/options.cxx @@ -86,7 +86,7 @@ fgOPTIONS::fgOPTIONS( void ) { wireframe = 0; // Scenery options - tile_diameter = 7; + tile_diameter = 5; // Time options time_offset = 0; @@ -488,6 +488,16 @@ fgOPTIONS::~fgOPTIONS( void ) { // $Log$ +// Revision 1.17 1998/07/16 17:33:38 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.16 1998/07/13 21:01:39 curt // Wrote access functions for current fgOPTIONS. //