From f17b1af1e3818e7698a1907f45b46f738d770dd5 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 6 Jul 1998 21:34:17 +0000 Subject: [PATCH] Added an enable/disable splash screen option. Added an enable/disable intro music option. Added an enable/disable instrument panel option. Added an enable/disable mouse pointer option. Added using namespace std for compilers that support this. --- Main/GLUTmain.cxx | 65 ++++++++++++++++++++++++++++++----------------- Main/airports.hxx | 10 ++++++++ Main/options.cxx | 45 +++++++++++++++++++++++++++++--- Main/options.hxx | 12 +++++++++ 4 files changed, 104 insertions(+), 28 deletions(-) diff --git a/Main/GLUTmain.cxx b/Main/GLUTmain.cxx index c80f71d95..86986cc31 100644 --- a/Main/GLUTmain.cxx +++ b/Main/GLUTmain.cxx @@ -302,7 +302,9 @@ static void fgRenderFrame( void ) { if ( idle_state != 1000 ) { // still initializing, draw the splash screen - fgSplashUpdate(0.0); + if ( o->splash_screen == 1 ) { + fgSplashUpdate(0.0); + } } else { // idle_state is now 1000 meaning we've finished all our // initializations and are running the main loop, so this will @@ -610,21 +612,25 @@ static void fgIdleFunction ( void ) { if ( idle_state == 0 ) { // Initialize the splash screen right away - fgSplashInit(); + if ( o->splash_screen ) { + fgSplashInit(); + } idle_state++; } else if ( idle_state == 1 ) { // Start the intro music -#ifndef WIN32 - strcpy(mp3file, o->fg_root); - strcat(mp3file, "/Sounds/"); - strcat(mp3file, "intro.mp3"); - sprintf(command, - "(touch %s; ampg123 %s > /dev/null 2>&1; /bin/rm %s) &", - lockfile, mp3file, lockfile ); - fgPrintf( FG_GENERAL, FG_INFO, - "Starting intro music: %s\n", mp3file); - system(command); +#if !defined(WIN32) + if ( o->intro_music ) { + strcpy(mp3file, o->fg_root); + strcat(mp3file, "/Sounds/"); + strcat(mp3file, "intro.mp3"); + sprintf(command, + "(touch %s; ampg123 %s > /dev/null 2>&1; /bin/rm %s) &", + lockfile, mp3file, lockfile ); + fgPrintf( FG_GENERAL, FG_INFO, + "Starting intro music: %s\n", mp3file); + system(command); + } #endif idle_state++; @@ -673,18 +679,20 @@ static void fgIdleFunction ( void ) { // Initialize audio support #ifdef HAVE_AUDIO_SUPPORT -#ifndef WIN32 - // Let's wait for mpg123 to finish - struct stat stat_buf; - - fgPrintf( FG_GENERAL, FG_INFO, - "Waiting for mpg123 player to finish " ); - while ( stat(lockfile, &stat_buf) == 0 ) { - // file exist, wait ... - sleep(1); - fgPrintf( FG_GENERAL, FG_INFO, "."); +#if !defined(WIN32) + if ( o->intro_music ) { + // Let's wait for mpg123 to finish + struct stat stat_buf; + + fgPrintf( FG_GENERAL, FG_INFO, + "Waiting for mpg123 player to finish " ); + while ( stat(lockfile, &stat_buf) == 0 ) { + // file exist, wait ... + sleep(1); + fgPrintf( FG_GENERAL, FG_INFO, "."); + } + fgPrintf( FG_GENERAL, FG_INFO, "\n"); } - fgPrintf( FG_GENERAL, FG_INFO, "\n"); #endif // WIN32 // audio_sched = new slScheduler ( 8000 ); @@ -720,7 +728,9 @@ static void fgIdleFunction ( void ) { fgMainLoop(); } else { - fgSplashUpdate(0.0); + if ( o->splash_screen == 1 ) { + fgSplashUpdate(0.0); + } } } @@ -859,6 +869,13 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.31 1998/07/06 21:34:17 curt +// Added an enable/disable splash screen option. +// Added an enable/disable intro music option. +// Added an enable/disable instrument panel option. +// Added an enable/disable mouse pointer option. +// Added using namespace std for compilers that support this. +// // Revision 1.30 1998/07/06 02:42:03 curt // Added support for switching between fullscreen and window mode for // Mesa/3dfx/glide. diff --git a/Main/airports.hxx b/Main/airports.hxx index a0b6d2853..f34ed6221 100644 --- a/Main/airports.hxx +++ b/Main/airports.hxx @@ -36,6 +36,9 @@ #include // Standard C++ string library #include // STL associative "array" +#ifdef NEEDNAMESPACESTD +using namespace std; +#endif typedef struct { @@ -70,6 +73,13 @@ public: // $Log$ +// Revision 1.6 1998/07/06 21:34:19 curt +// Added an enable/disable splash screen option. +// Added an enable/disable intro music option. +// Added an enable/disable instrument panel option. +// Added an enable/disable mouse pointer option. +// Added using namespace std for compilers that support this. +// // Revision 1.5 1998/06/17 21:35:11 curt // Refined conditional audio support compilation. // Moved texture parameter setup calls to ../Scenery/materials.cxx diff --git a/Main/options.cxx b/Main/options.cxx index 25c48a65f..02c74ca83 100644 --- a/Main/options.cxx +++ b/Main/options.cxx @@ -67,6 +67,11 @@ fgOPTIONS::fgOPTIONS( void ) { // default airport id strcpy(airport_id, ""); + // Miscellaneous + splash_screen = 1; + intro_music = 1; + mouse_pointer = 0; + // Features hud_status = 1; panel_status = 0; @@ -101,11 +106,11 @@ static int parse_int(char *arg) { arg++; } - printf("parse_int(): arg = %s\n", arg); + // printf("parse_int(): arg = %s\n", arg); result = atoi(arg); - printf("parse_int(): result = %d\n", result); + // printf("parse_int(): result = %d\n", result); return(result); } @@ -244,7 +249,7 @@ static int parse_tile_radius(char *arg) { if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; } if ( radius > FG_RADIUS_MAX ) { radius = FG_RADIUS_MAX; } - printf("parse_tile_radius(): radius = %d\n", radius); + // printf("parse_tile_radius(): radius = %d\n", radius); return(radius); } @@ -272,10 +277,26 @@ int fgOPTIONS::parse_option( char *arg ) { (strcmp(arg, "-h") == 0) ) { // help/usage request return(FG_OPTIONS_HELP); + } else if ( strcmp(arg, "--disable-splash-screen") == 0 ) { + splash_screen = 0; + } else if ( strcmp(arg, "--enable-splash-screen") == 0 ) { + splash_screen = 1; + } else if ( strcmp(arg, "--disable-intro-music") == 0 ) { + intro_music = 0; + } else if ( strcmp(arg, "--enable-intro-music") == 0 ) { + intro_music = 1; + } else if ( strcmp(arg, "--disable-mouse-pointer") == 0 ) { + mouse_pointer = 1; + } else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) { + mouse_pointer = 2; } else if ( strcmp(arg, "--disable-hud") == 0 ) { hud_status = 0; } else if ( strcmp(arg, "--enable-hud") == 0 ) { hud_status = 1; + } else if ( strcmp(arg, "--disable-panel") == 0 ) { + panel_status = 0; + } else if ( strcmp(arg, "--enable-panel") == 0 ) { + panel_status = 1; } else if ( strncmp(arg, "--airport-id=", 13) == 0 ) { arg += 13; strncpy(airport_id, arg, 4); @@ -331,7 +352,7 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) { fgPrintf(FG_GENERAL, FG_INFO, "Processing command line arguments\n"); while ( i < argc ) { - fgPrintf(FG_GENERAL, FG_INFO, "argv[%d] = %s\n", i, argv[i]); + fgPrintf(FG_GENERAL, FG_DEBUG, "argv[%d] = %s\n", i, argv[i]); result = parse_option(argv[i]); if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) { @@ -391,11 +412,20 @@ void fgOPTIONS::usage ( void ) { printf("General Options:\n"); printf("\t--help -h: print usage\n"); printf("\t--fg-root=path: specify the root path for all the data files\n"); + printf("\t--disable-splash-screen: disable splash screen\n"); + printf("\t--enable-splash-screen: enable splash screen\n"); + printf("\t--disable-intro-music: disable introduction music\n"); + printf("\t--enable-intro-music: enable introduction music\n"); + printf("\t--disable-mouse-pointer: disable extra mouse pointer\n"); + printf("\t--enable-mouse-pointer: enable extra mouse pointer (i.e. for\n"); + printf("\t\tfull screen voodoo/voodoo-II based cards.\n"); printf("\n"); printf("Features:\n"); printf("\t--disable-hud: disable heads up display\n"); 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("\n"); printf("Initial Position:\n"); @@ -434,6 +464,13 @@ fgOPTIONS::~fgOPTIONS( void ) { // $Log$ +// Revision 1.15 1998/07/06 21:34:19 curt +// Added an enable/disable splash screen option. +// Added an enable/disable intro music option. +// Added an enable/disable instrument panel option. +// Added an enable/disable mouse pointer option. +// Added using namespace std for compilers that support this. +// // Revision 1.14 1998/07/04 00:52:26 curt // Add my own version of gluLookAt() (which is nearly identical to the // Mesa/glu version.) But, by calculating the Model View matrix our selves diff --git a/Main/options.hxx b/Main/options.hxx index 73203f227..b01a63135 100644 --- a/Main/options.hxx +++ b/Main/options.hxx @@ -46,6 +46,11 @@ public: // ID of initial starting airport char airport_id[5]; + // Miscellaneous + int splash_screen; // show splash screen + int intro_music; // play introductory music + int mouse_pointer; // show mouse pointer + // Features int hud_status; // HUD on/off int panel_status; // Panel on/off @@ -98,6 +103,13 @@ extern fgOPTIONS current_options; // $Log$ +// Revision 1.10 1998/07/06 21:34:20 curt +// Added an enable/disable splash screen option. +// Added an enable/disable intro music option. +// Added an enable/disable instrument panel option. +// Added an enable/disable mouse pointer option. +// Added using namespace std for compilers that support this. +// // Revision 1.9 1998/06/27 16:54:34 curt // Replaced "extern displayInstruments" with a entry in fgOPTIONS. // Don't change the view port when displaying the panel. -- 2.39.2