1
0
Fork 0

Added a pause command "p"

Fixed some initialization order problems between pui and glut.
Added an --enable/disable-sound option.
This commit is contained in:
curt 1998-07-27 18:41:23 +00:00
parent 009c34bd23
commit 6d427da8d8
5 changed files with 72 additions and 23 deletions

View file

@ -187,6 +187,9 @@ void GLUTkey(unsigned char k, int x, int y) {
case 109: /* m key */ case 109: /* m key */
t->warp += 60; t->warp += 60;
return; return;
case 112: /* p key */
t->pause = !t->pause;
return;
case 116: /* t key */ case 116: /* t key */
t->warp_delta += 30; t->warp_delta += 30;
return; return;
@ -305,16 +308,21 @@ void GLUTspecialkey(int k, int x, int y) {
/* $Log$ /* $Log$
/* Revision 1.16 1998/07/16 17:33:34 curt /* Revision 1.17 1998/07/27 18:41:23 curt
/* "H" / "h" now control hud brightness as well with off being one of the /* Added a pause command "p"
/* states. /* Fixed some initialization order problems between pui and glut.
/* Better checking for xmesa/fx 3dfx fullscreen/window support for deciding /* Added an --enable/disable-sound option.
/* 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/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 * Revision 1.15 1998/07/13 21:01:34 curt
* Wrote access functions for current fgOPTIONS. * Wrote access functions for current fgOPTIONS.
* *

View file

@ -464,8 +464,12 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
multi_loop = DEFAULT_MULTILOOP; multi_loop = DEFAULT_MULTILOOP;
} }
if ( !t->pause ) {
// printf("updating flight model x %d\n", multi_loop); // printf("updating flight model x %d\n", multi_loop);
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop); fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
} else {
fgFlightModelUpdate(FG_LARCSIM, f, 0);
}
// update the view angle // update the view angle
for ( i = 0; i < multi_loop; i++ ) { for ( i = 0; i < multi_loop; i++ ) {
@ -639,7 +643,9 @@ static void fgMainLoop( void ) {
// Run audio scheduler // Run audio scheduler
#ifdef ENABLE_AUDIO_SUPPORT #ifdef ENABLE_AUDIO_SUPPORT
if ( current_options.get_sound() ) {
audio_sched -> update(); audio_sched -> update();
}
#endif #endif
// redraw display // redraw display
@ -694,10 +700,7 @@ static void fgIdleFunction ( void ) {
} else if ( idle_state == 2 ) { } else if ( idle_state == 2 ) {
// These are a few miscellaneous things that aren't really // These are a few miscellaneous things that aren't really
// "subsystems" but still need to be initialized. // "subsystems" but still need to be initialized.
if( !fgInitGeneral()) {
fgPrintf( FG_GENERAL, FG_EXIT,
"General initializations failed ...\n" );
}
#ifdef USE_GLIDE #ifdef USE_GLIDE
if ( strstr ( g->glRenderer, "Glide" ) ) { if ( strstr ( g->glRenderer, "Glide" ) ) {
grTexLodBiasValue ( GR_TMU0, 1.0 ) ; grTexLodBiasValue ( GR_TMU0, 1.0 ) ;
@ -728,8 +731,6 @@ static void fgIdleFunction ( void ) {
idle_state++; idle_state++;
} else if ( idle_state == 5 ) { } else if ( idle_state == 5 ) {
//Init the user interface
guiInit();
idle_state++; idle_state++;
} else if ( idle_state == 6 ) { } else if ( idle_state == 6 ) {
@ -762,8 +763,6 @@ static void fgIdleFunction ( void ) {
strcat(slfile, "wasp.wav"); strcat(slfile, "wasp.wav");
s1 = new slSample ( slfile ); 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", printf("Rate = %d Bps = %d Stereo = %d\n",
s1 -> getRate(), s1 -> getBps(), s1 -> getStereo()); s1 -> getRate(), s1 -> getBps(), s1 -> getStereo());
audio_sched -> loopSample ( s1 ); audio_sched -> loopSample ( s1 );
@ -775,7 +774,7 @@ static void fgIdleFunction ( void ) {
// audio_sched -> playSample ( s2 ); // audio_sched -> playSample ( s2 );
#endif #endif
sleep(1); // sleep(1);
idle_state = 1000; idle_state = 1000;
} }
@ -915,6 +914,16 @@ int main( int argc, char **argv ) {
fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n"); 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 // pass control off to the master GLUT event handler
glutMainLoop(); glutMainLoop();
@ -924,6 +933,11 @@ int main( int argc, char **argv ) {
// $Log$ // $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 // 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. // 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.
// //

View file

@ -127,8 +127,11 @@ int fgInitPosition( void ) {
// FG_Runway_altitude = 920.0; // FG_Runway_altitude = 920.0;
// FG_Altitude = FG_Runway_altitude + 3.758099; // FG_Altitude = FG_Runway_altitude + 3.758099;
// probably interesting for european team members // Initial Position: Huaras, Peru (S09d 31.871' W077d 31.498')
// That is: If I can get the scenery to work -;) (Durk) // 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 // Eclipse Watching w73.5 n10 (approx) 18:00 UT
// FG_Longitude = ( -73.5 ) * DEG_TO_RAD; // FG_Longitude = ( -73.5 ) * DEG_TO_RAD;
@ -401,6 +404,11 @@ int fgInitSubsystems( void ) {
// $Log$ // $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 // Revision 1.27 1998/07/24 21:39:10 curt
// Debugging output tweaks. // Debugging output tweaks.
// Cast glGetString to (char *) to avoid compiler errors. // Cast glGetString to (char *) to avoid compiler errors.

View file

@ -297,6 +297,10 @@ int fgOPTIONS::parse_option( char *arg ) {
panel_status = 0; panel_status = 0;
} else if ( strcmp(arg, "--enable-panel") == 0 ) { } else if ( strcmp(arg, "--enable-panel") == 0 ) {
panel_status = 1; 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 ) { } else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
arg += 13; arg += 13;
strncpy(airport_id, arg, 4); strncpy(airport_id, arg, 4);
@ -432,6 +436,8 @@ void fgOPTIONS::usage ( void ) {
printf("\t--enable-hud: enable heads up display\n"); printf("\t--enable-hud: enable heads up display\n");
printf("\t--disable-panel: disable instrument panel\n"); printf("\t--disable-panel: disable instrument panel\n");
printf("\t--enable-panel: enable instrumetn 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("\n");
printf("Initial Position:\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_mouse_pointer( void ) { return(mouse_pointer); }
int fgOPTIONS::get_hud_status( void ) { return(hud_status); } int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
int fgOPTIONS::get_panel_status( void ) { return(panel_status); } int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
int fgOPTIONS::get_sound( void ) { return(sound); }
int fgOPTIONS::get_fog( void ) { return(fog); } int fgOPTIONS::get_fog( void ) { return(fog); }
double fgOPTIONS::get_fov( void ) { return(fov); } double fgOPTIONS::get_fov( void ) { return(fov); }
int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); } int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
@ -494,6 +501,11 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $Log$ // $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 // 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. // Strip out \r when parsing config file in case we are on a windoze system.
// //

View file

@ -53,6 +53,7 @@ class fgOPTIONS {
// Features // Features
int hud_status; // HUD on/off int hud_status; // HUD on/off
int panel_status; // Panel on/off int panel_status; // Panel on/off
int sound; // play sound effects
// Rendering options // Rendering options
int fog; // Fog enabled/disabled int fog; // Fog enabled/disabled
@ -99,6 +100,7 @@ public:
int get_mouse_pointer( void ); int get_mouse_pointer( void );
int get_hud_status( void ); int get_hud_status( void );
int get_panel_status( void ); int get_panel_status( void );
int get_sound( void );
int get_fog( void ); int get_fog( void );
double get_fov( void ); double get_fov( void );
int get_fullscreen( void ); int get_fullscreen( void );
@ -127,6 +129,11 @@ extern fgOPTIONS current_options;
// $Log$ // $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 // Revision 1.11 1998/07/13 21:01:39 curt
// Wrote access functions for current fgOPTIONS. // Wrote access functions for current fgOPTIONS.
// //