From 3fe61cf7ef1260c7e625d440333f1d2544c97989 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 23 Sep 1997 00:29:27 +0000 Subject: [PATCH] Tweaks to get things to compile with gcc-win32. --- Cockpit/hud.c | 15 +++++++++++++-- Main/GLUTmain.c | 9 ++++++--- Main/fg_init.c | 12 ++++++++---- Scenery/stars.c | 9 ++++++--- Simulator/Makefile | 5 ++++- Simulator/make.inc | 27 +++++++++++++++------------ Time/fg_time.c | 32 ++++++++++++++++++++++++++++++-- 7 files changed, 82 insertions(+), 27 deletions(-) diff --git a/Cockpit/hud.c b/Cockpit/hud.c index 33a004355..207a79830 100644 --- a/Cockpit/hud.c +++ b/Cockpit/hud.c @@ -551,6 +551,7 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color ) Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \ int hole_len, double (*load_value)() ) { +#ifndef WIN32 struct HUD_horizon *horizon; struct HUD_instr *instrument; HIptr tmp_first, tmp_next; @@ -581,11 +582,13 @@ Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \ hud->instruments = instrument; return( hud ); +#endif } Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, int div_min, int div_max, \ int orientation, int with_min, int min_value, int width_units, double (*load_value)() ) { +#ifndef WIN32 struct HUD_scale *scale; struct HUD_instr *instrument; HIptr tmp_first, tmp_next; @@ -622,11 +625,13 @@ Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, i hud->instruments = instrument; return( hud ); +#endif } Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int justify, \ char *pre_str, char *post_str, char *format, double (*load_value)() ) { +#ifndef WIN32 struct HUD_label *label; struct HUD_instr *instrument; HIptr tmp_first, tmp_next; @@ -661,12 +666,14 @@ Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int jus hud->instruments = instrument; return( hud ); +#endif } Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_height, \ int hole_len, int div_units, int label_pos, int width_units, \ double (*load_roll)(), double (*load_pitch)() ) { +#ifndef WIN32 struct HUD_ladder *ladder; struct HUD_instr *instrument; HIptr tmp_first, tmp_next; @@ -703,6 +710,7 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig hud->instruments = instrument; return( hud ); +#endif } /* @@ -799,9 +807,12 @@ void fgUpdateHUD( Hptr hud ) /* $Log$ -/* Revision 1.3 1997/09/05 14:17:26 curt -/* More tweaking with stars. +/* Revision 1.4 1997/09/23 00:29:32 curt +/* Tweaks to get things to compile with gcc-win32. /* + * Revision 1.3 1997/09/05 14:17:26 curt + * More tweaking with stars. + * * Revision 1.2 1997/09/04 02:17:30 curt * Shufflin' stuff. * diff --git a/Main/GLUTmain.c b/Main/GLUTmain.c index c5a21745b..7ecd89eab 100644 --- a/Main/GLUTmain.c +++ b/Main/GLUTmain.c @@ -192,7 +192,7 @@ static void fgUpdateViewParams() { sky = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15; - sky = 0.15; /* force a dark sky (for testing) */ + /* sky = 0.15; */ /* to force a dark sky (for testing) */ if ( ambient < 0.1 ) { ambient = 0.1; } if ( diffuse < 0.0 ) { diffuse = 0.0; } @@ -577,9 +577,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.20 1997/09/22 14:44:19 curt -/* Continuing to try to align stars correctly. +/* Revision 1.21 1997/09/23 00:29:38 curt +/* Tweaks to get things to compile with gcc-win32. /* + * Revision 1.20 1997/09/22 14:44:19 curt + * Continuing to try to align stars correctly. + * * Revision 1.19 1997/09/18 16:20:08 curt * At dusk/dawn add/remove stars in stages. * diff --git a/Main/fg_init.c b/Main/fg_init.c index 4c97095ac..1b7950e85 100644 --- a/Main/fg_init.c +++ b/Main/fg_init.c @@ -111,8 +111,9 @@ void fgInitSubsystems( void ) { /* FG_Latitude = ( 45.15 ) * DEG_TO_RAD; */ /* FG_Altitude = FG_Runway_altitude + 3.758099; */ - FG_Longitude = ( -583200.00 / 3600.0 ) * DEG_TO_RAD; - FG_Latitude = ( 110808.41 / 3600.0 ) * DEG_TO_RAD; + /* A random test position */ + /* FG_Longitude = ( 88128.00 / 3600.0 ) * DEG_TO_RAD; */ + /* FG_Latitude = ( 93312.00 / 3600.0 ) * DEG_TO_RAD; */ printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, @@ -215,9 +216,12 @@ void fgInitSubsystems( void ) { /* $Log$ -/* Revision 1.8 1997/09/22 14:44:20 curt -/* Continuing to try to align stars correctly. +/* Revision 1.9 1997/09/23 00:29:39 curt +/* Tweaks to get things to compile with gcc-win32. /* + * Revision 1.8 1997/09/22 14:44:20 curt + * Continuing to try to align stars correctly. + * * Revision 1.7 1997/09/16 15:50:30 curt * Working on star alignment and time issues. * diff --git a/Scenery/stars.c b/Scenery/stars.c index fb2f67beb..c6e889c04 100644 --- a/Scenery/stars.c +++ b/Scenery/stars.c @@ -213,7 +213,7 @@ void fgStarsRender() { /* FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise */ - t->sun_angle = 3.0; /* force stars (for testing) */ + /* t->sun_angle = 3.0; */ /* to force stars to be drawn (for testing) */ if ( t->sun_angle > (FG_PI_2 + 5 * DEG_TO_RAD ) ) { /* determine which star structure to draw */ @@ -254,9 +254,12 @@ void fgStarsRender() { /* $Log$ -/* Revision 1.11 1997/09/22 14:44:21 curt -/* Continuing to try to align stars correctly. +/* Revision 1.12 1997/09/23 00:29:43 curt +/* Tweaks to get things to compile with gcc-win32. /* + * Revision 1.11 1997/09/22 14:44:21 curt + * Continuing to try to align stars correctly. + * * Revision 1.10 1997/09/20 03:34:32 curt * Still trying to get those durned stars aligned properly. * diff --git a/Simulator/Makefile b/Simulator/Makefile index 96e80aa28..01a2cbaac 100644 --- a/Simulator/Makefile +++ b/Simulator/Makefile @@ -82,7 +82,7 @@ bin-tar: all tar cvzf bin-$(VERSION).tar.gz FlightGear/fgtop FlightGear/fg0 \ FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/Thanks) -bin-zip: all +bin-zip: cp GLUT/fg0.exe GLUT/runfg.bat GLUT/cygwin.dll .. (cd ../..; \ zip -r bin-$(VERSION).zip FlightGear/fgtop FlightGear/fg0.exe \ @@ -92,6 +92,9 @@ bin-zip: all #--------------------------------------------------------------------------- # $Log$ +# Revision 1.27 1997/09/23 00:29:27 curt +# Tweaks to get things to compile with gcc-win32. +# # Revision 1.26 1997/09/04 02:17:18 curt # Shufflin' stuff. # diff --git a/Simulator/make.inc b/Simulator/make.inc index 19e926ac5..5adadbaca 100644 --- a/Simulator/make.inc +++ b/Simulator/make.inc @@ -98,28 +98,31 @@ GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(VERSION)\" #--------------------------------------------------------------------------- # Linux/Mesa with the GLUT toolkit # -INTERFACE_FLAGS = -DGLUT -INTERFACE_LIBS = -lglut -INTERFACE_FILES = GLUTmain.c GLUTkey.c -MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL -X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS) -FG_CFLAGS = $(GLOBAL_CFLAGS) +# INTERFACE_FLAGS = -DGLUT +# INTERFACE_LIBS = -lglut +# INTERFACE_FILES = GLUTmain.c GLUTkey.c +# MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL +# X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 +# GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS) +# FG_CFLAGS = $(GLOBAL_CFLAGS) #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # Cygnus Win32 (gcc based) with a static version of the GLUT toolkit # -# INTERFACE_FLAGS = -DGLUT -# INTERFACE_LIBS = ../Win32/libglut.a -# INTERFACE_FILES = GLUTmain.c GLUTkey.c -# GRAPHICS_LIBS = -lglu32 -lopengl32 -luser32 -lgdi32 -# FG_CFLAGS = $(GLOBAL_CFLAGS) -DWIN32 -DUSE_RAND +INTERFACE_FLAGS = -DGLUT +INTERFACE_LIBS = ../Win32/libglut.a +INTERFACE_FILES = GLUTmain.c GLUTkey.c +GRAPHICS_LIBS = -lglu32 -lopengl32 -luser32 -lgdi32 +FG_CFLAGS = $(GLOBAL_CFLAGS) -DWIN32 -DUSE_RAND #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # $Log$ +# Revision 1.15 1997/09/23 00:29:27 curt +# Tweaks to get things to compile with gcc-win32. +# # Revision 1.14 1997/09/16 22:14:47 curt # Tweaked time of day lighting equations. Don't draw stars during the day. # diff --git a/Time/fg_time.c b/Time/fg_time.c index 4b9c23075..e05c870d5 100644 --- a/Time/fg_time.c +++ b/Time/fg_time.c @@ -29,6 +29,11 @@ #include #include +#ifdef WIN32 +#include /* for gettimeofday() */ +#include /* for gettimeofday() */ +#endif + #include "fg_time.h" #include "../constants.h" #include "../Flight/flight.h" @@ -152,6 +157,14 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) { long int offset; double diff, part, days, hours, lst; +#ifdef WIN32 + int daylight; + long int timezone; + + struct timeval tv; + struct timezone tz; +#endif + printf("COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n", gmt->tm_mon, gmt->tm_mday, gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); @@ -165,6 +178,18 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) { start = mktime(&mt); +#ifdef WIN32 + daylight = mt.tm_isdst; + gettimeofday(&tv, &tz); + timezone = tz.tz_minuteswest * 60; +#endif + + if ( daylight > 0 ) { + daylight = 1; + } else if ( daylight < 0 ) { + printf("OOOPS, big time problem in fg_time.c, no daylight savings info.\n"); + } + offset = -(timezone / 3600 - daylight); printf("Raw time zone offset = %ld\n", timezone); @@ -259,9 +284,12 @@ void fgTimeUpdate(struct FLIGHT *f, struct fgTIME *t) { /* $Log$ -/* Revision 1.6 1997/09/20 03:34:34 curt -/* Still trying to get those durned stars aligned properly. +/* Revision 1.7 1997/09/23 00:29:50 curt +/* Tweaks to get things to compile with gcc-win32. /* + * Revision 1.6 1997/09/20 03:34:34 curt + * Still trying to get those durned stars aligned properly. + * * Revision 1.5 1997/09/16 22:14:52 curt * Tweaked time of day lighting equations. Don't draw stars during the day. * -- 2.39.2