]> git.mxchange.org Git - flightgear.git/commitdiff
Added "D" key binding to set autopilot heading.
authorcurt <curt>
Thu, 7 May 1998 23:14:14 +0000 (23:14 +0000)
committercurt <curt>
Thu, 7 May 1998 23:14:14 +0000 (23:14 +0000)
Made frame rate calculation average out over last 10 frames.
Borland C++ floating point exception workaround.
Added a --tile-radius=n option.

Main/GLUTkey.cxx
Main/GLUTmain.cxx
Main/fg_init.cxx
Main/options.cxx
Main/runfg.bat.in

index d8a7e8cd514b707954769b03d1009e3c0c6351cc..a542b685b44c81200ee7219e09ace9ac011e142d 100644 (file)
@@ -120,7 +120,9 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 83: /* S key */
                fgAPSetMode(0);
                return;
-               
+       case 68: /* D key */
+               fgAPSetHeading(AP_CURRENT_HEADING);
+               return;
        }
     } else {
        fgPrintf( FG_INPUT, FG_DEBUG, "\n");
@@ -265,10 +267,16 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 /* $Log$
-/* Revision 1.6  1998/04/28 01:20:20  curt
-/* Type-ified fgTIME and fgVIEW.
-/* Added a command line option to disable textures.
+/* Revision 1.7  1998/05/07 23:14:14  curt
+/* Added "D" key binding to set autopilot heading.
+/* Made frame rate calculation average out over last 10 frames.
+/* Borland C++ floating point exception workaround.
+/* Added a --tile-radius=n option.
 /*
+ * Revision 1.6  1998/04/28 01:20:20  curt
+ * Type-ified fgTIME and fgVIEW.
+ * Added a command line option to disable textures.
+ *
  * Revision 1.5  1998/04/25 22:06:29  curt
  * Edited cvs log messages in source files ... bad bad bad!
  *
index a518a8dca5946f72d6050f1b92baf0c62f7c50b0..d5f2344c8e7d2c2ac37f00e4a6c03159e47b43ea 100644 (file)
@@ -29,6 +29,7 @@
 
 #ifdef HAVE_WINDOWS_H
 #  include <windows.h>                     
+#  include <float.h>                    
 #endif
 
 #include <GL/glut.h>
@@ -542,14 +543,19 @@ static void fgMainLoop( void ) {
              elapsed, remainder);
 
     // Calculate frame rate average
-    accum = 0.0;
-    for ( i = FG_FRAME_RATE_HISTORY - 2; i >= 0; i-- ) {
-       accum += g->frames[i];
-       g->frames[i+1] = g->frames[i];
+    if ( elapsed > 0.0 ) {
+       accum = 0.0;
+       for ( i = FG_FRAME_RATE_HISTORY - 2; i >= 0; i-- ) {
+           accum += g->frames[i];
+           // printf("frame[%d] = %.2f\n", i, g->frames[i]);
+           g->frames[i+1] = g->frames[i];
+       }
+       g->frames[0] = 1000.0 / (float)elapsed;
+       // printf("frame[0] = %.2f\n", g->frames[0]);
+       accum += g->frames[0];
+       g->frame_rate = accum / (float)FG_FRAME_RATE_HISTORY;
+       // printf("ave = %.2f\n", g->frame_rate);
     }
-    g->frames[0] = 1000.0 / (float)elapsed;
-    accum += g->frames[0];
-    g->frame_rate = accum / (float)FG_FRAME_RATE_HISTORY;
 
     // Calculate model iterations needed for next frame
     fgPrintf( FG_ALL, FG_DEBUG, 
@@ -670,6 +676,10 @@ int main( int argc, char **argv ) {
 
     f = current_aircraft.flight;
 
+#ifdef HAVE_BC5PLUS
+    _control87(MCW_EM, MCW_EM);  /* defined in float.h */
+#endif
+
     // Initialize the debugging output system
     fgInitDebug();
 
@@ -737,6 +747,12 @@ extern "C" {
 
 
 // $Log$
+// Revision 1.12  1998/05/07 23:14:15  curt
+// Added "D" key binding to set autopilot heading.
+// Made frame rate calculation average out over last 10 frames.
+// Borland C++ floating point exception workaround.
+// Added a --tile-radius=n option.
+//
 // Revision 1.11  1998/05/06 03:16:23  curt
 // Added an averaged global frame rate counter.
 // Added an option to control tile radius.
index f670e5cf05d3599aa43fa1548fd48c73d5515818..9dd94730161edbc86159e33e7268c5baf5a84271 100644 (file)
@@ -169,6 +169,7 @@ int fgInitPosition( void ) {
 // General house keeping initializations
 int fgInitGeneral( void ) {
     fgGENERAL *g;
+    int i;
 
     g = &general;
 
@@ -189,6 +190,11 @@ int fgInitGeneral( void ) {
     }
     fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", g->root_dir);
 
+    // prime the frame rate counter pump
+    for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
+       g->frames[i] = 0.0;
+    }
+
     return ( 1 ); 
 }
 
@@ -381,6 +387,12 @@ int fgInitSubsystems( void ) {
 
 
 // $Log$
+// Revision 1.11  1998/05/07 23:14:15  curt
+// Added "D" key binding to set autopilot heading.
+// Made frame rate calculation average out over last 10 frames.
+// Borland C++ floating point exception workaround.
+// Added a --tile-radius=n option.
+//
 // Revision 1.10  1998/05/06 03:16:24  curt
 // Added an averaged global frame rate counter.
 // Added an option to control tile radius.
index 1d6d725f63398c7d9d1629cfab58a1d481a3f7ac..498e1a1c53018abe83912a75a6440449b393dc21 100644 (file)
@@ -171,12 +171,19 @@ static int parse_int(char *arg, int min, int max) {
     while ( (arg[0] != '=') && (arg[0] != '\0') ) {
        arg++;
     }
-       
+
+    if ( arg[0] == '=' ) {
+       arg++;
+    }
+
+    printf("parse_int(): arg = %s\n", arg);
+
     result = atoi(arg);
 
     if ( result < min ) { result = min; }
     if ( result > max ) { result = max; }
 
+    printf("parse_int(): result = %d\n", result);
     return(result);
 }
 
@@ -227,7 +234,7 @@ int fgOPTIONS::parse( int argc, char **argv ) {
        } else if ( strcmp(argv[i], "--enable-wireframe") == 0 ) {
            wireframe = 1;      
        } else if ( strncmp(argv[i], "--tile-radius=", 14) == 0 ) {
-           tile_radius = parse_int(argv[i], 3, 7);
+           tile_radius = parse_int(argv[i], 3, 9);
        } else if ( strncmp(argv[i], "--time-offset=", 14) == 0 ) {
            time_offset = parse_time_offset(argv[i]);
        } else {
@@ -289,6 +296,12 @@ fgOPTIONS::~fgOPTIONS( void ) {
 
 
 // $Log$
+// Revision 1.8  1998/05/07 23:14:16  curt
+// Added "D" key binding to set autopilot heading.
+// Made frame rate calculation average out over last 10 frames.
+// Borland C++ floating point exception workaround.
+// Added a --tile-radius=n option.
+//
 // Revision 1.7  1998/05/06 03:16:25  curt
 // Added an averaged global frame rate counter.
 // Added an option to control tile radius.
index f54990caa75d396c6cca28ba4e80f611e25db8cc..62c7f956984e5e5414c9fbbf74c1f4826fb45c29 100755 (executable)
@@ -3,7 +3,7 @@ REM @ECHO OFF
 REM Skip ahead to CONT1 if FG_ROOT has a value\r
 IF NOT %FG_ROOT%.==. GOTO CONT1\r
 \r
-SET FG_ROOT=@prefix@\r
+SET FG_ROOT=.\r
 \r
 :CONT1\r
 \r
@@ -12,7 +12,7 @@ IF NOT EXIST %FG_ROOT%\BIN\FG.EXE GOTO ERROR1
 \r
 REM Now that FG_ROOT has been set, run the program\r
 ECHO FG_ROOT = %FG_ROOT%\r
-%FG_ROOT%\BIN\FG.EXE\r
+%FG_ROOT%\BIN\FG.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9\r
 \r
 GOTO END\r
 \r