]> git.mxchange.org Git - flightgear.git/blobdiff - Main/GLUTmain.cxx
Modifications to incorporate Jon S. Berndts flight model code.
[flightgear.git] / Main / GLUTmain.cxx
index f1fba8050f92c08dde5f8b3c7267a8d440e41400..d8d24ac9b2c3036b40798832f3595c4d310aa8da 100644 (file)
@@ -42,7 +42,9 @@
 #   include <stdlib.h>
 #endif
 
-#include <sys/stat.h> /* for stat() */
+#ifdef HAVE_SYS_STAT_H
+#  include <sys/stat.h> /* for stat() */
+#endif
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>    /* for stat() */
@@ -83,6 +85,7 @@
 #include "options.hxx"
 #include "splash.hxx"
 #include "views.hxx"
+#include "fg_serial.hxx"
 
 
 // This is a record containing a bit of global housekeeping information
@@ -368,7 +371,7 @@ static void fgRenderFrame( void ) {
 
 // Update internal time dependent calculations (i.e. flight model)
 void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
-    FGState *f = current_aircraft.fdm_state;
+    FGInterface *f = current_aircraft.fdm_state;
     fgLIGHT *l = &cur_light_params;
     fgTIME *t = &cur_time_params;
     FGView *v = &current_view;
@@ -384,10 +387,10 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        fgAPRun();
 
        // printf("updating flight model x %d\n", multi_loop);
-       fgFlightModelUpdate( current_options.get_flight_model(), 
+       fgFDMUpdate( current_options.get_flight_model(), 
                             cur_fdm_state, multi_loop, remainder );
     } else {
-       fgFlightModelUpdate( current_options.get_flight_model(), 
+       fgFDMUpdate( current_options.get_flight_model(), 
                             cur_fdm_state, 0, remainder );
     }
 
@@ -448,7 +451,7 @@ static const double alt_adjust_m = alt_adjust_ft * FEET_TO_METER;
 // What should we do when we have nothing else to do?  Let's get ready
 // for the next move and update the display?
 static void fgMainLoop( void ) {
-    FGState *f;
+    FGInterface *f;
     fgTIME *t;
     static long remainder = 0;
     long elapsed, multi_loop;
@@ -490,14 +493,15 @@ static void fgMainLoop( void ) {
                   f->get_Altitude() * FEET_TO_METER,
                   scenery.cur_elev + alt_adjust_m - 3.0,
                   scenery.cur_elev + alt_adjust_m );
-           fgFlightModelSetAltitude( current_options.get_flight_model(), 
-                                     scenery.cur_elev + alt_adjust_m );
+           fgFDMForceAltitude( current_options.get_flight_model(), 
+                               scenery.cur_elev + alt_adjust_m );
 
            FG_LOG( FG_ALL, FG_DEBUG, 
                    "<*> resetting altitude to " 
                    << f->get_Altitude() * FEET_TO_METER << " meters" );
        }
-       f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
+       fgFDMSetGroundElevation( current_options.get_flight_model(),
+                                scenery.cur_elev );  // meters
     }
 
     /* printf("Adjustment - ground = %.2f  runway = %.2f  alt = %.2f\n",
@@ -736,7 +740,7 @@ static void fgIdleFunction ( void ) {
 
        audio_sched = new slScheduler ( 8000 );
        audio_mixer = new smMixer;
-       audio_mixer -> setMasterVolume ( 50 ) ;  /* 80% of max volume. */
+       audio_mixer -> setMasterVolume ( 80 ) ;  /* 80% of max volume. */
        audio_sched -> setSafetyMargin ( 1.0 ) ;
        string slfile = current_options.get_fg_root() + "/Sounds/wasp.wav";
 
@@ -836,11 +840,14 @@ int fgGlutInit( int *argc, char **argv ) {
        xglutCreateWindow("Flight Gear");
     } else {
        // Open the cool new 'game mode' window
-       string game_mode_params = "width=" + current_options.get_xsize();
-       game_mode_params += "height=" + current_options.get_ysize();
-       game_mode_params += " bpp=16";
-       cout << "game mode params = " << game_mode_params;
-       glutGameModeString( game_mode_params.c_str() );
+       char game_mode_str[256];
+       sprintf( game_mode_str, "width=%d height=%d bpp=16",
+                current_options.get_xsize(),
+                current_options.get_ysize() );
+
+       FG_LOG( FG_GENERAL, FG_INFO, 
+               "game mode params = " << game_mode_str );
+       glutGameModeString( game_mode_str );
        glutEnterGameMode();
     }
 
@@ -920,7 +927,7 @@ int fgGlutInitEvents( void ) {
 
 // Main ...
 int main( int argc, char **argv ) {
-    FGState *f;
+    FGInterface *f;
 
     f = current_aircraft.fdm_state;
 
@@ -962,8 +969,8 @@ int main( int argc, char **argv ) {
        // Something must have gone horribly wrong with the command
        // line parsing or maybe the user just requested help ... :-)
        current_options.usage();
-       // FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
-       cout << endl << "Exiting ..." << endl;
+       FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
+       // cout << endl << "Exiting ..." << endl;
        exit(-1);
     }
     
@@ -1000,6 +1007,37 @@ int main( int argc, char **argv ) {
 
 
 // $Log$
+// Revision 1.85  1999/02/05 21:29:08  curt
+// Modifications to incorporate Jon S. Berndts flight model code.
+//
+// Revision 1.84  1999/02/02 20:13:34  curt
+// MSVC++ portability changes by Bernie Bright:
+//
+// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
+// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
+// Simulator/Cockpit/hud.cxx: Added Standard headers
+// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
+// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG.  Deleted <stdio.h>
+// Simulator/Main/fg_init.cxx:
+// Simulator/Main/GLUTmain.cxx:
+// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
+// Simulator/Objects/material.hxx:
+// Simulator/Time/timestamp.hxx: VC++ friend kludge
+// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
+// Simulator/Main/views.hxx: Added a constant
+//
+// Revision 1.83  1999/01/27 04:49:17  curt
+// Game mode fixes from Norman Vine.
+// Initial altitude setting tweaks and fixes (especially for when starting
+// below sea level.)
+//
+// Revision 1.82  1999/01/20 13:42:24  curt
+// Tweaked FDM interface.
+// Testing check sum support for NMEA serial output.
+//
+// Revision 1.81  1999/01/19 20:57:03  curt
+// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
+//
 // Revision 1.80  1999/01/09 13:37:40  curt
 // Convert fgTIMESTAMP to FGTimeStamp which holds usec instead of ms.
 //