1
0
Fork 0

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.
This commit is contained in:
curt 1998-05-07 23:14:14 +00:00
parent b96a60f8aa
commit 58eb9b9089
5 changed files with 64 additions and 15 deletions

View 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!
*

View 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
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);
}
// 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.

View 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.

View file

@ -172,11 +172,18 @@ static int parse_int(char *arg, int min, int max) {
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.

View file

@ -3,7 +3,7 @@ REM @ECHO OFF
REM Skip ahead to CONT1 if FG_ROOT has a value
IF NOT %FG_ROOT%.==. GOTO CONT1
SET FG_ROOT=@prefix@
SET FG_ROOT=.
:CONT1
@ -12,7 +12,7 @@ IF NOT EXIST %FG_ROOT%\BIN\FG.EXE GOTO ERROR1
REM Now that FG_ROOT has been set, run the program
ECHO FG_ROOT = %FG_ROOT%
%FG_ROOT%\BIN\FG.EXE
%FG_ROOT%\BIN\FG.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO END