From d126b3d8f0b37edd1a5c9a1b2ec231ec9d65a605 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 9 Feb 1998 15:07:47 +0000 Subject: [PATCH] Minor tweaks. --- Astro/stars.c | 11 +-- Cockpit/hud.c | 159 ++++++++++++++++++++++-------------------- Main/GLUTmain.c | 11 +-- Main/fg_init.c | 17 +++-- Main/views.c | 11 +-- Scenery/bucketutils.c | 11 +-- Scenery/obj.c | 11 +-- Simulator/commondefs | 6 +- Time/fg_time.c | 11 +-- Time/sunpos.c | 13 ++-- Weather/weather.c | 13 ++-- 11 files changed, 155 insertions(+), 119 deletions(-) diff --git a/Astro/stars.c b/Astro/stars.c index dcc85156f..8b23ffdcc 100644 --- a/Astro/stars.c +++ b/Astro/stars.c @@ -215,13 +215,13 @@ void fgStarsInit( void ) { /* Draw the Stars */ void fgStarsRender( void ) { - struct fgFLIGHT *f; + fgFLIGHT *f; struct fgVIEW *v; struct fgLIGHT *l; struct fgTIME *t; int i; - f = ¤t_aircraft.flight; + f = current_aircraft.flight; l = &cur_light_params; t = &cur_time_params; v = ¤t_view; @@ -253,9 +253,12 @@ void fgStarsRender( void ) { /* $Log$ -/* Revision 1.6 1998/02/02 20:53:23 curt -/* To version 0.29 +/* Revision 1.7 1998/02/09 15:07:48 curt +/* Minor tweaks. /* + * Revision 1.6 1998/02/02 20:53:23 curt + * To version 0.29 + * * Revision 1.5 1998/01/27 18:35:53 curt * Minor tweaks. * diff --git a/Cockpit/hud.c b/Cockpit/hud.c index 590fda67c..5c6cab76a 100644 --- a/Cockpit/hud.c +++ b/Cockpit/hud.c @@ -758,6 +758,8 @@ Hptr fgHUDInit( fgAIRCRAFT *current_aircraft ) { Hptr hud; + fgPrintf( FG_COCKPIT, FG_INFO, "Initializing HUD\n" ); + hud = (Hptr)calloc(sizeof( HUD),1); if( hud == NULL ) return( NULL ); @@ -787,20 +789,22 @@ Hptr fgHUDInit( fgAIRCRAFT *current_aircraft ) return( hud ); } + // add_instrument // // This is a stand in for linked list code that will get replaced later // by some more elegant list handling code. -void add_instrument( Hptr hud, HIptr pinstrument ) -{ - if( !hud || !pinstrument ) { - return; +void add_instrument( Hptr hud, HIptr pinstrument ) { + if( !hud || !pinstrument ) { + return; } - pinstrument->next = hud->instruments; - hud->instruments = pinstrument; + + pinstrument->next = hud->instruments; + hud->instruments = pinstrument; } + // fgHUDAddHorizon // // Constructs a HUD_horizon "object" and installs it into the hud instrument @@ -813,36 +817,36 @@ Hptr fgHUDAddHorizon( Hptr hud, \ int hole_len, \ double (*load_value)() ) { - HUD_horizon *phorizon; - HUD_instr *pinstrument; + HUD_horizon *phorizon; + HUD_instr *pinstrument; - if( !hud ) { - return NULL; + if( !hud ) { + return NULL; } // construct the parent object - pinstrument = (HIptr)calloc(sizeof(HUD_instr),1); - if( pinstrument == NULL ) { - return( NULL ); + pinstrument = (HIptr)calloc(sizeof(HUD_instr),1); + if( pinstrument == NULL ) { + return( NULL ); } - pinstrument->type = HUDhorizon; // ARTIFICIAL_HORIZON; + pinstrument->type = HUDhorizon; // ARTIFICIAL_HORIZON; // Construct the horizon - phorizon = (HUD_horizon *) calloc( sizeof(HUD_horizon),1); - if( phorizon == NULL ) { - return( NULL ); + phorizon = (HUD_horizon *) calloc( sizeof(HUD_horizon),1); + if( phorizon == NULL ) { + return( NULL ); } - phorizon->x_pos = x_pos; - phorizon->y_pos = y_pos; - phorizon->scr_width = length; - phorizon->scr_hole = hole_len; - phorizon->load_value = load_value; - // Install the horizon in the parent. - pinstrument->instr = phorizon; + phorizon->x_pos = x_pos; + phorizon->y_pos = y_pos; + phorizon->scr_width = length; + phorizon->scr_hole = hole_len; + phorizon->load_value = load_value; + // Install the horizon in the parent. + pinstrument->instr = phorizon; // Install the instrument into hud. - add_instrument( hud, pinstrument); + add_instrument( hud, pinstrument); - return( hud ); + return( hud ); } // fgHUDAddScale @@ -1045,73 +1049,78 @@ Hptr fgHUDAddNumDisp( Hptr hud, \ // all C++. // -void fgUpdateHUD( Hptr hud ) -{ - HIptr phud_instr; +void fgUpdateHUD( Hptr hud ) { + HIptr phud_instr; - glMatrixMode(GL_PROJECTION); - glPushMatrix(); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, 640, 0, 480); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); + glLoadIdentity(); + gluOrtho2D(0, 640, 0, 480); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); - glColor3f(1.0, 1.0, 1.0); - glIndexi(7); + glColor3f(1.0, 1.0, 1.0); + glIndexi(7); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); - glLineWidth(1); - glColor3f (0.1, 0.9, 0.1); + glLineWidth(1); + glColor3f (0.1, 0.9, 0.1); - fgPrintf( FG_COCKPIT, FG_DEBUG, - "HUD Code %d Status %d\n", - hud->code, hud->status ); + fgPrintf( FG_COCKPIT, FG_DEBUG, + "HUD Code %d Status %d\n", + hud->code, hud->status ); - phud_instr = hud->instruments; - while( phud_instr ) { - switch (phud_instr->type){ - case HUDhorizon: // ARTIFICIAL HORIZON - drawhorizon( (pHUDhorizon)phud_instr ); - break; + phud_instr = hud->instruments; + while( phud_instr ) { + /* printf("Drawing Instrument %d\n", phud_instr->type); */ - case HUDscale: // Need to simplify this call. - drawscale ( (pHUDscale) phud_instr ); - break; + switch (phud_instr->type){ + case HUDhorizon: // ARTIFICIAL HORIZON + drawhorizon( (pHUDhorizon)phud_instr->instr ); + break; + + case HUDscale: // Need to simplify this call. + drawscale ( (pHUDscale) phud_instr->instr ); + break; - case HUDlabel: - drawlabel ( (pHUDlabel) phud_instr ); - break; + case HUDlabel: + drawlabel ( (pHUDlabel) phud_instr->instr ); + break; - case HUDladder: - drawladder( (pHUDladder) phud_instr ); - break; + case HUDladder: + drawladder( (pHUDladder) phud_instr->instr ); + break; - case HUDcontrols: - drawControlSurfaces( (pHUDControlSurface) phud_instr ); - default:; // Ignore anything you don't know about. - } - phud_instr = phud_instr->next; - } + case HUDcontrols: + drawControlSurfaces( (pHUDControlSurface) phud_instr->instr ); + + default:; // Ignore anything you don't know about. + } - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHTING); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + phud_instr = phud_instr->next; + } + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHTING); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); } /* $Log$ -/* Revision 1.11 1998/02/07 15:29:34 curt -/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss -/* +/* Revision 1.12 1998/02/09 15:07:48 curt +/* Minor tweaks. /* + * Revision 1.11 1998/02/07 15:29:34 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * * Revision 1.10 1998/02/03 23:20:14 curt * Lots of little tweaks to fix various consistency problems discovered by * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper diff --git a/Main/GLUTmain.c b/Main/GLUTmain.c index a5ac4bc61..772028794 100644 --- a/Main/GLUTmain.c +++ b/Main/GLUTmain.c @@ -286,7 +286,7 @@ static void fgRenderFrame( void ) { xglPopMatrix(); /* draw scenery */ - xglShadeModel( GL_SMOOTH ); + xglShadeModel( GL_FLAT /* GL_SMOOTH */ ); xglEnable( GL_DEPTH_TEST ); xglEnable( GL_FOG ); xglFogfv (GL_FOG_COLOR, l->fog_color); @@ -647,10 +647,13 @@ int main( int argc, char *argv[] ) { #endif /* $Log$ -/* Revision 1.57 1998/02/07 15:29:40 curt -/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss -/* +/* Revision 1.58 1998/02/09 15:07:49 curt +/* Minor tweaks. /* + * Revision 1.57 1998/02/07 15:29:40 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * * Revision 1.56 1998/02/03 23:20:23 curt * Lots of little tweaks to fix various consistency problems discovered by * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper diff --git a/Main/fg_init.c b/Main/fg_init.c index 40391a5fb..282e7e88f 100644 --- a/Main/fg_init.c +++ b/Main/fg_init.c @@ -175,10 +175,10 @@ void fgInitSubsystems( void ) { /* FG_Altitude = FG_Runway_altitude + 3.758099; */ /* Initial Position: Somewhere near the Grand Canyon */ - FG_Longitude = ( -112.5 ) * DEG_TO_RAD; - FG_Latitude = ( 36.5 ) * DEG_TO_RAD; - FG_Runway_altitude = 5000.0; - FG_Altitude = FG_Runway_altitude + 3.758099; + /* FG_Longitude = ( -112.5 ) * DEG_TO_RAD; */ + /* FG_Latitude = ( 36.5 ) * DEG_TO_RAD; */ + /* FG_Runway_altitude = 5000.0; */ + /* FG_Altitude = FG_Runway_altitude + 3.758099; */ /* A random test position */ /* FG_Longitude = ( 88128.00 / 3600.0 ) * DEG_TO_RAD; */ @@ -328,10 +328,13 @@ void fgInitSubsystems( void ) { /* $Log$ -/* Revision 1.40 1998/02/07 15:29:44 curt -/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss -/* +/* Revision 1.41 1998/02/09 15:07:50 curt +/* Minor tweaks. /* + * Revision 1.40 1998/02/07 15:29:44 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * * Revision 1.39 1998/02/03 23:20:25 curt * Lots of little tweaks to fix various consistency problems discovered by * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper diff --git a/Main/views.c b/Main/views.c index d263862d1..f8a8e1057 100644 --- a/Main/views.c +++ b/Main/views.c @@ -136,7 +136,7 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) { /* printf(" Alt Up = (%.4f, %.4f, %.4f)\n", alt_up.x, alt_up.y, alt_up.z); */ - /* Derive the VIEW matrix */ + /* Calculate the VIEW matrix */ MAT3mult(VIEW, LOCAL, UP); /* printf("VIEW matrix\n"); */ /* MAT3print(VIEW, stdout); */ @@ -184,10 +184,13 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) { /* $Log$ -/* Revision 1.13 1998/02/07 15:29:45 curt -/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss -/* +/* Revision 1.14 1998/02/09 15:07:50 curt +/* Minor tweaks. /* + * Revision 1.13 1998/02/07 15:29:45 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * * Revision 1.12 1998/01/29 00:50:28 curt * Added a view record field for absolute x, y, z position. * diff --git a/Scenery/bucketutils.c b/Scenery/bucketutils.c index e3bb6e1f4..a1c96fc03 100644 --- a/Scenery/bucketutils.c +++ b/Scenery/bucketutils.c @@ -197,8 +197,8 @@ void fgBucketFind(double lon, double lat, struct fgBUCKET *p) { } /* printf(" p->lat = %d\n", p->lat); */ - p->x = (lon - p->lon) * 8; - p->y = (lat - p->lat) * 8; + p->x = (int)((lon - p->lon) * 8); + p->y = (int)((lat - p->lat) * 8); /* printf( "Bucket = lon,lat = %d,%d x,y index = %d,%d\n", p->lon, p->lat, p->x, p->y); */ } @@ -266,9 +266,12 @@ int main() { /* $Log$ -/* Revision 1.5 1998/01/29 00:51:38 curt -/* First pass at tile cache, dynamic tile loading and tile unloading now works. +/* Revision 1.6 1998/02/09 15:07:51 curt +/* Minor tweaks. /* + * Revision 1.5 1998/01/29 00:51:38 curt + * First pass at tile cache, dynamic tile loading and tile unloading now works. + * * Revision 1.4 1998/01/27 03:26:41 curt * Playing with new fgPrintf command. * diff --git a/Scenery/obj.c b/Scenery/obj.c index 90a8b7968..b7e5c83bc 100644 --- a/Scenery/obj.c +++ b/Scenery/obj.c @@ -42,8 +42,8 @@ #define MAXNODES 100000 -double nodes[MAXNODES][3]; -double normals[MAXNODES][3]; +static double nodes[MAXNODES][3]; +static double normals[MAXNODES][3]; /* given three points defining a triangle, calculate the normal */ @@ -71,7 +71,7 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref, double *radius) { GLint tile; FILE *f; int first, ncount, vncount, n1, n2, n3, n4; - static int use_vertex_norms = 1; + static int use_vertex_norms = 0; int winding; int last1, last2, odd; @@ -354,9 +354,12 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref, double *radius) { /* $Log$ -/* Revision 1.22 1998/02/01 03:39:54 curt +/* Revision 1.23 1998/02/09 15:07:52 curt /* Minor tweaks. /* + * Revision 1.22 1998/02/01 03:39:54 curt + * Minor tweaks. + * * Revision 1.21 1998/01/31 00:43:25 curt * Added MetroWorks patches from Carmen Volpe. * diff --git a/Simulator/commondefs b/Simulator/commondefs index d1f700d77..e1ea85b17 100644 --- a/Simulator/commondefs +++ b/Simulator/commondefs @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- FG_VERSION_MAJOR = 0 -FG_VERSION_MINOR = 31 +FG_VERSION_MINOR = 32 FG_VERSION = $(FG_VERSION_MAJOR).$(FG_VERSION_MINOR) @@ -13,8 +13,8 @@ FG_VERSION = $(FG_VERSION_MAJOR).$(FG_VERSION_MINOR) # Choose your weapons #--------------------------------------------------------------------------- -CC = gcc -CXX = gcc +CC = g++ +CXX = g++ LD = ld AR = ar RANLIB = ranlib diff --git a/Time/fg_time.c b/Time/fg_time.c index 07e5b3c83..1429d6c33 100644 --- a/Time/fg_time.c +++ b/Time/fg_time.c @@ -98,7 +98,7 @@ double cal_mjd (int mn, double dy, int yr) { c = (long)(365.25*y) - 694025L; } - d = 30.6001*(m+1); + d = (int)(30.6001*(m+1)); mjd = b + c + d + dy - 0.5; @@ -311,10 +311,13 @@ void fgTimeUpdate(fgFLIGHT *f, struct fgTIME *t) { /* $Log$ -/* Revision 1.34 1998/02/07 15:29:47 curt -/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss -/* +/* Revision 1.35 1998/02/09 15:07:52 curt +/* Minor tweaks. /* + * Revision 1.34 1998/02/07 15:29:47 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * * Revision 1.33 1998/02/02 20:54:04 curt * Incorporated Durk's changes. * diff --git a/Time/sunpos.c b/Time/sunpos.c index 3f4c4e5cd..60f7e8631 100644 --- a/Time/sunpos.c +++ b/Time/sunpos.c @@ -190,8 +190,8 @@ static double julian_date(int y, int m, int d) { A = y / 100; B = 2 - A + (A / 4); - C = 365.25 * y; - D = 30.6001 * (m + 1); + C = (int)(365.25 * y); + D = (int)(30.6001 * (m + 1)); JD = B + C + D + d + 1720994.5; @@ -373,10 +373,13 @@ void fgUpdateSunPos( void ) { /* $Log$ -/* Revision 1.24 1998/01/27 00:48:07 curt -/* Incorporated Paul Bleisch's new debug message -/* system and commandline/config file processing code. +/* Revision 1.25 1998/02/09 15:07:53 curt +/* Minor tweaks. /* + * Revision 1.24 1998/01/27 00:48:07 curt + * Incorporated Paul Bleisch's new debug message + * system and commandline/config file processing code. + * * Revision 1.23 1998/01/19 19:27:21 curt * Merged in make system changes from Bob Kuehne * This should simplify things tremendously. diff --git a/Weather/weather.c b/Weather/weather.c index da044f1e9..7b075480e 100644 --- a/Weather/weather.c +++ b/Weather/weather.c @@ -56,10 +56,10 @@ void fgWeatherUpdate( void ) { /* temporarily remove the code of this do-nothing routine */ #ifdef FG_WEATHER_UPDATE - struct fgFLIGHT *f; + fgFLIGHT *f; struct fgWEATHER *w; - f = ¤t_aircraft.flight; + f = current_aircraft.flight; w = ¤t_weather; /* Add some random turbulence */ @@ -71,10 +71,13 @@ void fgWeatherUpdate( void ) { /* $Log$ -/* Revision 1.13 1998/01/27 00:48:08 curt -/* Incorporated Paul Bleisch's new debug message -/* system and commandline/config file processing code. +/* Revision 1.14 1998/02/09 15:07:54 curt +/* Minor tweaks. /* + * Revision 1.13 1998/01/27 00:48:08 curt + * Incorporated Paul Bleisch's new debug message + * system and commandline/config file processing code. + * * Revision 1.12 1998/01/19 19:27:22 curt * Merged in make system changes from Bob Kuehne * This should simplify things tremendously. -- 2.39.2