From 6ef6f4d986036b65dd181d798e53f889834cf6c3 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 18 Jul 1997 23:41:20 +0000 Subject: [PATCH] Tweaks for building with Cygnus Win32 compiler. --- LaRCsim/Makefile | 5 ++- Main/GLUTkey.c | 98 ++++++++++++++++++++++++++++++++++++---------- Main/GLmain.c | 27 +++++++++++-- Main/Makefile | 5 ++- Main/mesh2GL.c | 19 +++++++-- Scenery/mesh.c | 27 +++++++------ Scenery/scenery.c | 11 ++++-- Simulator/Makefile | 7 +++- Simulator/make.inc | 44 +++++++++++++++------ 9 files changed, 183 insertions(+), 60 deletions(-) diff --git a/LaRCsim/Makefile b/LaRCsim/Makefile index 4d5d18038..eff9016fa 100644 --- a/LaRCsim/Makefile +++ b/LaRCsim/Makefile @@ -44,7 +44,7 @@ simtest: $(TARGET) LaRCsim.o all: $(TARGET) clean: - rm -f *.o $(TARGET) *~ core + rm -f *.o $(TARGET) lib*.a *~ core #--------------------------------------------------------------------------- @@ -56,6 +56,9 @@ include depend #--------------------------------------------------------------------------- # $Log$ +# Revision 1.9 1997/07/18 23:41:23 curt +# Tweaks for building with Cygnus Win32 compiler. +# # Revision 1.8 1997/07/12 02:24:48 curt # Added ranlib. # diff --git a/Main/GLUTkey.c b/Main/GLUTkey.c index 1ff5048a0..1e2ac31fb 100644 --- a/Main/GLUTkey.c +++ b/Main/GLUTkey.c @@ -27,7 +27,7 @@ #include #include -#ifdef __CYGWIN32__ +#ifdef WIN32 # include #endif @@ -49,9 +49,10 @@ void GLUTkey(unsigned char k, int x, int y) { c = ¤t_aircraft.controls; - printf("Key hit = %d\n", k); + printf("Key hit = %d", k); if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) { + printf(" SHIFTED\n"); switch (k) { case 49: /* numeric keypad 1 */ goal_view_offset = M_PI * 0.75; @@ -79,6 +80,7 @@ void GLUTkey(unsigned char k, int x, int y) { return; } } else { + printf("\n"); switch (k) { case 50: /* numeric keypad 2 */ fgElevMove(-0.05); @@ -139,30 +141,86 @@ void GLUTspecialkey(int k, int x, int y) { c = ¤t_aircraft.controls; - printf("Special key hit = %d\n", k); - - switch (k) { - case GLUT_KEY_UP: - fgElevMove(0.05); - return; - case GLUT_KEY_DOWN: - fgElevMove(-0.05); - return; - case GLUT_KEY_LEFT: - fgAileronMove(-0.05); - return; - case GLUT_KEY_RIGHT: - fgAileronMove(0.05); - return; - } + printf("Special key hit = %d", k); + if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) { + printf(" SHIFTED\n"); + switch (k) { + case GLUT_KEY_END: /* numeric keypad 1 */ + goal_view_offset = M_PI * 0.75; + return; + case GLUT_KEY_DOWN: /* numeric keypad 2 */ + goal_view_offset = M_PI; + return; + case GLUT_KEY_PAGE_DOWN: /* numeric keypad 3 */ + goal_view_offset = M_PI * 1.25; + return; + case GLUT_KEY_LEFT: /* numeric keypad 4 */ + goal_view_offset = M_PI * 0.50; + return; + case GLUT_KEY_RIGHT: /* numeric keypad 6 */ + goal_view_offset = M_PI * 1.50; + return; + case GLUT_KEY_HOME: /* numeric keypad 7 */ + goal_view_offset = M_PI * 0.25; + return; + case GLUT_KEY_UP: /* numeric keypad 8 */ + goal_view_offset = 0.00; + return; + case GLUT_KEY_PAGE_UP: /* numeric keypad 9 */ + goal_view_offset = M_PI * 1.75; + return; + } + } else { + printf("\n"); + switch (k) { + case GLUT_KEY_UP: + fgElevMove(0.05); + return; + case GLUT_KEY_DOWN: + fgElevMove(-0.05); + return; + case GLUT_KEY_LEFT: + fgAileronMove(-0.05); + return; + case GLUT_KEY_RIGHT: + fgAileronMove(0.05); + return; + case GLUT_KEY_HOME: /* numeric keypad 1 */ + fgElevTrimMove(-0.001); + return; + case GLUT_KEY_END: /* numeric keypad 7 */ + fgElevTrimMove(0.001); + return; + case GLUT_KEY_INSERT: /* numeric keypad Ins */ + fgRudderMove(-0.05); + return; + case 13: /* numeric keypad Enter */ + fgRudderMove(0.05); + return; + case 53: /* numeric keypad 5 */ + fgAileronSet(0.0); + fgElevSet(0.0); + fgRudderSet(0.0); + return; + case GLUT_KEY_PAGE_UP: /* numeric keypad 9 (Pg Up) */ + fgThrottleMove(0, 0.01); + return; + case GLUT_KEY_PAGE_DOWN: /* numeric keypad 3 (Pg Dn) */ + fgThrottleMove(0, -0.01); + return; + } + } } /* $Log$ -/* Revision 1.15 1997/07/16 20:04:47 curt -/* Minor tweaks to aid Win32 port. +/* Revision 1.16 1997/07/18 23:41:24 curt +/* Tweaks for building with Cygnus Win32 compiler. /* + * Revision 1.15 1997/07/16 20:04:47 curt + * Minor tweaks to aid Win32 port. + * * Revision 1.14 1997/07/12 03:50:20 curt * Added an #include to help compiling for Win32 * diff --git a/Main/GLmain.c b/Main/GLmain.c index 43d22415b..1f6f84f8e 100644 --- a/Main/GLmain.c +++ b/Main/GLmain.c @@ -28,7 +28,7 @@ #include #include -#ifdef __CYGWIN32__ +#ifdef WIN32 # include #endif @@ -417,6 +417,14 @@ static void fgMainLoop( void ) { FG_Altitude * FEET_TO_METER); } + +#ifndef USE_RAND +# ifdef sgi +# undef RAND_MAX +# define RAND_MAX 2147483647 +# endif +#endif + #ifdef USE_RAND FG_U_gust = rand() * 3.0 / RAND_MAX - 1.0; FG_V_gust = rand() * 3.0 / RAND_MAX - 1.0; @@ -460,7 +468,7 @@ int main( int argc, char *argv[] ) { f = ¤t_aircraft.flight; - printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n"); + /* printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n");*/ /********************************************************************** @@ -627,11 +635,22 @@ int main( int argc, char *argv[] ) { return(0); } +#ifdef NO_PRINTF + +#include +int printf (const char *format, ...) { +} + +#endif + /* $Log$ -/* Revision 1.35 1997/07/18 14:28:34 curt -/* Hacked in some support for wind/turbulence. +/* Revision 1.36 1997/07/18 23:41:25 curt +/* Tweaks for building with Cygnus Win32 compiler. /* + * Revision 1.35 1997/07/18 14:28:34 curt + * Hacked in some support for wind/turbulence. + * * Revision 1.34 1997/07/16 20:04:48 curt * Minor tweaks to aid Win32 port. * diff --git a/Main/Makefile b/Main/Makefile index 74b7a7101..8560edc87 100644 --- a/Main/Makefile +++ b/Main/Makefile @@ -52,7 +52,7 @@ $(TARGET): $(OFILES) $(AFILES) all: $(TARGET) clean: - rm -f *.o $(TARGET) lib*.a *~ core + rm -f *.o $(TARGET) $(TARGET).exe lib*.a *~ core #--------------------------------------------------------------------------- @@ -76,6 +76,9 @@ mesh2GL.o: #--------------------------------------------------------------------------- # $Log$ +# Revision 1.22 1997/07/18 23:41:25 curt +# Tweaks for building with Cygnus Win32 compiler. +# # Revision 1.21 1997/07/05 20:43:34 curt # renamed mat3 directory to Math so we could add other math related routines. # diff --git a/Main/mesh2GL.c b/Main/mesh2GL.c index 8f7c298cc..f29635f5f 100644 --- a/Main/mesh2GL.c +++ b/Main/mesh2GL.c @@ -24,7 +24,7 @@ **************************************************************************/ -#ifdef __CYGWIN32__ +#ifdef WIN32 # include #endif @@ -40,6 +40,14 @@ #include "../Math/polar.h" +#ifndef USE_RAND +# ifdef sgi +# undef RAND_MAX +# define RAND_MAX 2147483647 +# endif +#endif + + /* The following routine is a real hack used for testing puposes only * and should probably be removed. */ void mesh_make_test_object(double lon, double lat) { @@ -188,11 +196,13 @@ GLint mesh2GL(struct mesh *m) { } */ +/* #ifdef USE_RAND srand(time(&t)); #else srandom(time(&t)); #endif +*/ for ( i = 0; i < 200; i++ ) { #ifdef USE_RAND @@ -214,9 +224,12 @@ GLint mesh2GL(struct mesh *m) { /* $Log$ -/* Revision 1.35 1997/07/18 14:28:35 curt -/* Hacked in some support for wind/turbulence. +/* Revision 1.36 1997/07/18 23:41:25 curt +/* Tweaks for building with Cygnus Win32 compiler. /* + * Revision 1.35 1997/07/18 14:28:35 curt + * Hacked in some support for wind/turbulence. + * * Revision 1.34 1997/07/16 20:04:50 curt * Minor tweaks to aid Win32 port. * diff --git a/Scenery/mesh.c b/Scenery/mesh.c index 07429f624..61e436446 100644 --- a/Scenery/mesh.c +++ b/Scenery/mesh.c @@ -28,7 +28,7 @@ # include #endif -#ifdef __CYGWIN32__ +#ifdef WIN32 # include #endif @@ -197,7 +197,7 @@ double mesh_altitude(double lon, double lat) { if ( dx > dy ) { /* lower triangle */ - printf(" Lower triangle\n"); + /* printf(" Lower triangle\n"); */ x1 = xindex; y1 = yindex; @@ -211,15 +211,15 @@ double mesh_altitude(double lon, double lat) { y3 = yindex + skip; z3 = eg.mesh_data[y3 * eg.cols + x3]; - printf(" dx = %.2f dy = %.2f\n", dx, dy); + /* printf(" dx = %.2f dy = %.2f\n", dx, dy); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2); - printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); + printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); */ zA = dx * (z2 - z1) / skip + z1; zB = dx * (z3 - z1) / skip + z1; - printf(" zA = %.2f zB = %.2f\n", zA, zB); + /* printf(" zA = %.2f zB = %.2f\n", zA, zB); */ if ( dx > EPSILON ) { elev = dy * (zB - zA) / dx + zA; @@ -228,7 +228,7 @@ double mesh_altitude(double lon, double lat) { } } else { /* upper triangle */ - printf(" Upper triangle\n"); + /* printf(" Upper triangle\n"); */ x1 = xindex; y1 = yindex; @@ -242,16 +242,16 @@ double mesh_altitude(double lon, double lat) { y3 = yindex + skip; z3 = eg.mesh_data[y3 * eg.cols + x3]; - printf(" dx = %.2f dy = %.2f\n", dx, dy); + /* printf(" dx = %.2f dy = %.2f\n", dx, dy); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2); - printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); + printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); */ zA = dy * (z2 - z1) / skip + z1; zB = dy * (z3 - z1) / skip + z1; - printf(" zA = %.2f zB = %.2f\n", zA, zB ); - printf(" xB - xA = %.2f\n", eg.col_step * dy / eg.row_step); + /* printf(" zA = %.2f zB = %.2f\n", zA, zB ); + printf(" xB - xA = %.2f\n", eg.col_step * dy / eg.row_step); */ if ( dy > EPSILON ) { elev = dx * (zB - zA) / dy + zA; @@ -265,9 +265,12 @@ double mesh_altitude(double lon, double lat) { /* $Log$ -/* Revision 1.16 1997/07/16 20:04:51 curt -/* Minor tweaks to aid Win32 port. +/* Revision 1.17 1997/07/18 23:41:26 curt +/* Tweaks for building with Cygnus Win32 compiler. /* + * Revision 1.16 1997/07/16 20:04:51 curt + * Minor tweaks to aid Win32 port. + * * Revision 1.15 1997/07/14 16:26:04 curt * Testing/playing -- placed objects randomly across the entire terrain. * diff --git a/Scenery/scenery.c b/Scenery/scenery.c index f8a8188cf..7f319f12b 100644 --- a/Scenery/scenery.c +++ b/Scenery/scenery.c @@ -24,7 +24,7 @@ **************************************************************************/ -#ifdef __CYGWIN32__ +#ifdef WIN32 # include #endif @@ -45,7 +45,7 @@ struct scenery_params cur_scenery_params; /* Initialize the Scenery Management system */ void fgSceneryInit() { /* set the default terrain detail level */ - cur_scenery_params.terrain_skip = 20; + cur_scenery_params.terrain_skip = 10; } @@ -69,9 +69,12 @@ void fgSceneryRender() { /* $Log$ -/* Revision 1.7 1997/07/16 20:04:52 curt -/* Minor tweaks to aid Win32 port. +/* Revision 1.8 1997/07/18 23:41:27 curt +/* Tweaks for building with Cygnus Win32 compiler. /* + * Revision 1.7 1997/07/16 20:04:52 curt + * Minor tweaks to aid Win32 port. + * * Revision 1.6 1997/07/14 16:26:05 curt * Testing/playing -- placed objects randomly across the entire terrain. * diff --git a/Simulator/Makefile b/Simulator/Makefile index 97a9ef566..6df780ddf 100644 --- a/Simulator/Makefile +++ b/Simulator/Makefile @@ -52,17 +52,20 @@ clean: tar: clean (cd ../..; \ - tar cvf prototype-0.05.tar FlightGear/COPYING FlightGear/Docs \ + tar cvf prototype-$(VERSION).tar FlightGear/COPYING FlightGear/Docs \ FlightGear/Src FlightGear/Thanks) zip: clean (cd ../..; \ - zip -r prototype-0.05.zip FlightGear/COPYING FlightGear/Docs \ + zip -r prototype-$(VERSION).zip FlightGear/COPYING FlightGear/Docs \ FlightGear/Src FlightGear/Thanks) #--------------------------------------------------------------------------- # $Log$ +# Revision 1.17 1997/07/18 23:41:20 curt +# Tweaks for building with Cygnus Win32 compiler. +# # Revision 1.16 1997/07/07 20:59:47 curt # Working on scenery transformations to enable us to fly fluidly over the # poles with no discontinuity/distortion in scenery. diff --git a/Simulator/make.inc b/Simulator/make.inc index cbc2bae1c..e7e8e92d3 100644 --- a/Simulator/make.inc +++ b/Simulator/make.inc @@ -25,6 +25,8 @@ #--------------------------------------------------------------------------- +VERSION = 0.07 + #--------------------------------------------------------------------------- # Choose your weapons #--------------------------------------------------------------------------- @@ -48,6 +50,18 @@ RANLIB = ranlib # # -O2 - Enable compiler optimization # +#--------------------------------------------------------------------------- + +GLOBAL_CFLAGS = -g -Wall + + +#--------------------------------------------------------------------------- +# Platform specific compile options, these should be set with FG_CFLAGS +# below. These have been predefined for the supported platforms below. +# +# -DNO_PRINTF - Disable all printf()'s. Works by replacing the printf +# fuction with an empty function. +# # -DUSE_ITIMER - Use setitimer(), getitimer(), and signal() to mimic # a real time system and call the flight model routines # at a regular interval, rather than between screen updates @@ -61,8 +75,6 @@ RANLIB = ranlib # #--------------------------------------------------------------------------- -FG_CFLAGS = -g -Wall - #--------------------------------------------------------------------------- # Uncomment one of the following sections depending on your system @@ -80,31 +92,37 @@ FG_CFLAGS = -g -Wall # INTERFACE_LIBS = -lglut # INTERFACE_FILES = GLUTkey.c # GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11 +# FG_CFLAGS = $(GLOBAL_CFLAGS) #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # Linux/Mesa with the GLUT toolkit # -INTERFACE_FLAGS = -DGLUT -INTERFACE_LIBS = -lglut -INTERFACE_FILES = 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) +# INTERFACE_FLAGS = -DGLUT +# INTERFACE_LIBS = -lglut +# INTERFACE_FILES = 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 the GLUT toolkit +# Cygnus Win32 (gcc based) with a static version of the GLUT toolkit # -# INTERFACE_FLAGS = -DGLUT -# INTERFACE_LIBS = -Wl,--subsystem,windows -L. -lglut -# INTERFACE_FILES = GLUTkey.c -# GRAPHICS_LIBS = -lglu32 -lopengl32 +INTERFACE_FLAGS = -DGLUT +INTERFACE_LIBS = ../Win32/libglut.a +INTERFACE_FILES = GLUTkey.c +GRAPHICS_LIBS = -lglu32 -lopengl32 -luser32 -lgdi32 +FG_CFLAGS = $(GLOBAL_CFLAGS) -DWIN32 -DUSE_RAND #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # $Log$ +# Revision 1.8 1997/07/18 23:41:20 curt +# Tweaks for building with Cygnus Win32 compiler. +# # Revision 1.7 1997/07/18 14:28:34 curt # Hacked in some support for wind/turbulence. # -- 2.39.2