#include <Main/fg_init.h>
#include <Main/views.h>
-#include <Include/constants.h>
+#include <Include/fg_constants.h>
#include <Include/general.h>
#include <Aircraft/aircraft.h>
#include <Astro/moon.h>
+#include <Astro/planets.h>
#include <Astro/sky.h>
#include <Astro/stars.h>
#include <Astro/sun.h>
#include <Cockpit/cockpit.h>
#include <Joystick/joystick.h>
#include <Math/fg_random.h>
-#include <Scenery/mesh.h>
#include <Scenery/scenery.h>
#include <Scenery/tilemgr.h>
#include <Time/event.h>
#include <Time/fg_time.h>
#include <Time/sunpos.h>
#include <Weather/weather.h>
-
+#include <Main/fg_debug.h>
extern int show_hud; /* HUD state */
extern int displayInstruments;
g = &general;
- printf("General Initialization\n");
- printf("======= ==============\n");
+ fgInitDebug();
+
+ fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
+ fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
/* seed the random number generater */
fg_srandom();
/* determine the fg root path */
if ( (g->root_dir = getenv("FG_ROOT")) == NULL ) {
/* environment variable not defined */
- printf("FG_ROOT needs to be defined! See the documentation.\n");
- exit(0);
+ fgPrintf(FG_GENERAL, FG_EXIT, "FG_ROOT needs to be defined! "
+ "See the documentation.\n");
}
- printf("FG_ROOT = %s\n", g->root_dir);
-
- printf("\n");
+ fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", g->root_dir);
}
void fgInitSubsystems( void ) {
double cur_elev;
- struct fgFLIGHT *f;
+ fgFLIGHT *f;
struct fgLIGHT *l;
struct fgTIME *t;
struct fgVIEW *v;
- f = ¤t_aircraft.flight;
l = &cur_light_params;
t = &cur_time_params;
v = ¤t_view;
- printf("Initialize Subsystems\n");
- printf("========== ==========\n");
+ fgPrintf( FG_GENERAL, FG_INFO, "Initialize Subsystems\n");
+ fgPrintf( FG_GENERAL, FG_INFO, "========== ==========\n");
/****************************************************************
* The following section sets up the flight model EOM parameters and
* should really be read in from one or more files.
****************************************************************/
+ /* Must happen before any of the flight model or control
+ * parameters are set */
+ fgAircraftInit();
+ f = current_aircraft.flight;
+
/* Globe Aiport, AZ */
FG_Runway_longitude = -398391.28;
FG_Runway_latitude = 120070.41;
FG_Runway_altitude = 3234.5;
FG_Runway_heading = 102.0 * DEG_TO_RAD;
- /* Initial Position at (P13) GLOBE airport */
+ /* Initial Position at (P13) Globe, AZ */
FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD;
+ FG_Runway_altitude = (3234.5 + 300);
FG_Altitude = FG_Runway_altitude + 3.758099;
-
+
+ /* Initial Position at (E81) Superior, AZ */
+ /* FG_Longitude = ( -111.1270650 ) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 33.2778339 ) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = (2646 + 1000); */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
+
+ /* Initial Position at (TUS) Tucson, AZ */
+ /* FG_Longitude = ( -110.9412597 ) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 32.1162439 ) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = (2641 + 0); */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
+
+ /* Initial Position at near Anchoraze, AK */
+ /* FG_Longitude = ( -150.00 ) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 61.17 ) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = (2641 + 07777); */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
+
/* Initial Position at (SEZ) SEDONA airport */
- FG_Longitude = -111.7884614 * DEG_TO_RAD;
- FG_Latitude = 34.8486289 * DEG_TO_RAD;
- FG_Runway_altitude = 4827;
- FG_Altitude = FG_Runway_altitude + 3.758099;
+ /* FG_Longitude = (-111.7884614 + 0.02) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 34.8486289 - 0.04) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = (4827 + 800); */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
+
+ /* Initial Position at (HSP) Hot Springs, VA */
+ /* FG_Longitude = (-79.8338964 + 0.02) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 37.9514564 + 0.05) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = (792 + 1500); */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
/* Initial Position at (ANE) Anoka County airport */
- FG_Longitude = -93.2113889 * DEG_TO_RAD;
- FG_Latitude = 45.145 * DEG_TO_RAD;
- FG_Runway_altitude = 912;
- FG_Altitude = FG_Runway_altitude + 3.758099;
+ /* FG_Longitude = -93.2113889 * DEG_TO_RAD; */
+ /* FG_Latitude = 45.145 * DEG_TO_RAD; */
+ /* FG_Runway_altitude = 912; */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
/* Initial Position north of the city of Globe */
/* FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD; */
/* Initial Posisition near where I used to live in Globe, AZ */
/* FG_Longitude = ( -398757.6 / 3600.0 ) * DEG_TO_RAD; */
- /* FG_Latitude = ( 120160.0 / 3600.0 ) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 120160.0 / 3600.0 ) * DEG_TO_RAD; */
/* FG_Runway_altitude = 5000.0; */
/* FG_Altitude = FG_Runway_altitude + 3.758099; */
/* FG_Latitude = ( 45.15 ) * DEG_TO_RAD; */
/* 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; */
+
+ /* Initial Position: (GCN) Grand Canyon Airport, AZ */
+ /* FG_Longitude = ( -112.1469647 ) * DEG_TO_RAD; */
+ /* FG_Latitude = ( 35.9523539 ) * DEG_TO_RAD; */
+ /* FG_Runway_altitude = 6606.0; */
+ /* FG_Altitude = FG_Runway_altitude + 3.758099; */
+
/* 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,
- FG_Altitude * FEET_TO_METER);
+ fgPrintf( FG_GENERAL, FG_INFO,
+ "Initial position is: (%.4f, %.4f, %.2f)\n",
+ FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
+ FG_Altitude * FEET_TO_METER);
- /* Initial Velocity */
+ /* Initial Velocity */
FG_V_north = 0.0 /* 7.287719E+00 */;
FG_V_east = 0.0 /* 1.521770E+03 */;
FG_V_down = 0.0 /* -1.265722E-05 */;
FG_EVENT_READY, 120000 );
/* Initialize the Cockpit subsystem */
- if( fgCockpitInit( current_aircraft ) == NULL ) {
- printf( "Error in Cockpit initialization!\n" );
- exit( 1 );
+ if( fgCockpitInit( ¤t_aircraft ) == NULL ) {
+ fgPrintf( FG_GENERAL, FG_EXIT, "Error in Cockpit initialization!\n" );
}
/* Initialize the orbital elements of sun, moon and mayor planets */
/* Initialize the Stars subsystem */
fgStarsInit();
+ /* Initialize the planetary subsystem */
+ fgEventRegister("fgPlanetsInit()", fgPlanetsInit, FG_EVENT_READY, 600000);
+
/* Initialize the sun's position */
- fgEventRegister( "fgSunInit()", fgSunInit, FG_EVENT_READY, 600000 );
+ fgEventRegister( "fgSunInit()", fgSunInit, FG_EVENT_READY, 60000 );
/* Intialize the moon's position */
fgEventRegister( "fgMoonInit()", fgMoonInit, FG_EVENT_READY, 600000 );
/* I'm just sticking this here for now, it should probably move
* eventually */
- cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
- FG_Latitude * RAD_TO_DEG * 3600.0);
- printf("True ground elevation is %.2f meters here.\n", cur_elev);
+ /* cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
+ FG_Latitude * RAD_TO_DEG * 3600.0); */
+ /* fgPrintf( FG_GENERAL, FG_INFO,
+ "True ground elevation is %.2f meters here.\n",
+ cur_elev); */
+ cur_elev = FG_Runway_altitude * FEET_TO_METER;
if ( cur_elev > -9990.0 ) {
FG_Runway_altitude = cur_elev * METER_TO_FEET;
}
if ( FG_Altitude < FG_Runway_altitude ) {
FG_Altitude = FG_Runway_altitude + 3.758099;
}
- printf("Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
+ fgPrintf(FG_GENERAL, FG_INFO,
+ "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
FG_Altitude * FEET_TO_METER);
/* end of thing that I just stuck in that I should probably move */
/* One more try here to get the sky synced up */
fgSkyColorsInit();
- printf("\n");
+ fgPrintf(FG_GENERAL, FG_INFO,"\n");
}
/* $Log$
-/* Revision 1.32 1998/01/19 19:27:08 curt
-/* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
-/* This should simplify things tremendously.
+/* Revision 1.42 1998/02/09 22:56:58 curt
+/* Removed "depend" files from cvs control. Other minor make tweaks.
/*
+ * 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
+ * <chotchkiss@namg.us.anritsu.com>
+ *
+ * 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
+ * passed arguments along to the real printf(). Also incorporated HUD changes
+ * by Michele America.
+ *
+ * Revision 1.38 1998/02/02 20:53:58 curt
+ * Incorporated Durk's changes.
+ *
+ * Revision 1.37 1998/02/01 03:39:54 curt
+ * Minor tweaks.
+ *
+ * Revision 1.36 1998/01/31 00:43:13 curt
+ * Added MetroWorks patches from Carmen Volpe.
+ *
+ * Revision 1.35 1998/01/27 00:47:57 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
+ * Revision 1.34 1998/01/22 02:59:37 curt
+ * Changed #ifdef FILE_H to #ifdef _FILE_H
+ *
+ * Revision 1.33 1998/01/21 21:11:34 curt
+ * Misc. tweaks.
+ *
+ * Revision 1.32 1998/01/19 19:27:08 curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
* Revision 1.31 1998/01/19 18:40:32 curt
* Tons of little changes to clean up the code and to remove fatal errors
* when building with the c++ compiler.