]> git.mxchange.org Git - flightgear.git/commitdiff
Add an option to advance/decrease time from keyboard.
authorcurt <curt>
Mon, 5 Jan 1998 18:44:33 +0000 (18:44 +0000)
committercurt <curt>
Mon, 5 Jan 1998 18:44:33 +0000 (18:44 +0000)
Main/GLUTkey.c
Main/fg_init.c
Scenery/moon.c
Scenery/sun.c
Simulator/make.inc
Time/fg_time.c
Time/fg_time.h

index 8e178befba861df5daba4e1d6c70246b4cdabe6b..22a5b526f9e96baac5d34723c3560b80027fd488 100644 (file)
@@ -48,10 +48,12 @@ extern int displayInstruments;
 /* Handle keyboard events */
 void GLUTkey(unsigned char k, int x, int y) {
     struct fgCONTROLS *c;
+    struct fgTIME *t;
     struct fgVIEW *v;
     struct fgWEATHER *w;
 
     c = &current_aircraft.controls;
+    t = &cur_time_params;
     v = &current_view;
     w = &current_weather;
 
@@ -87,6 +89,12 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 72: /* H key */
            show_hud = !show_hud;
            return;
+       case 77: /* M key */
+           t->warp -= 60;
+           return;
+       case 84: /* T key */
+           t->warp_delta -= 30;
+           return;
        case 87: /* W key */
            displayInstruments = !displayInstruments;
            return;
@@ -134,6 +142,12 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 51: /* numeric keypad 3 (Pg Dn) */
            fgThrottleMove(0, -0.01);
            return;
+       case 109: /* m key */
+           t->warp += 60;
+           return;
+       case 116: /* t key */
+           t->warp_delta += 30;
+           return;
        case 122: /* z key */
            w->visibility *= 1.10;
            xglFogf(GL_FOG_END, w->visibility);
@@ -229,9 +243,12 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 /* $Log$
-/* Revision 1.24  1997/12/30 16:36:46  curt
-/* Merged in Durk's changes ...
+/* Revision 1.25  1998/01/05 18:44:34  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.24  1997/12/30 16:36:46  curt
+ * Merged in Durk's changes ...
+ *
  * Revision 1.23  1997/12/15 23:54:44  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.
index 60bbc65b8ecc8ca6c8a24b263cf5457188862ed1..7e35e9203afda633cc45dd0a419c3ac9c0139110 100644 (file)
@@ -217,7 +217,7 @@ void fgInitSubsystems( void ) {
     fgEventRegister( "fgSunInit()", fgSunInit, FG_EVENT_READY, 600000 );
 
     /* Intialize the moon's position */
-    fgEventRegister( "fgMoonInit()", fgSunInit, FG_EVENT_READY, 600000 );
+    fgEventRegister( "fgMoonInit()", fgMoonInit, FG_EVENT_READY, 600000 );
 
     /* Initialize the "sky" */
     fgSkyInit();
@@ -267,9 +267,12 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.26  1997/12/30 23:09:04  curt
-/* Tweaking initialization sequences.
+/* Revision 1.27  1998/01/05 18:44:35  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.26  1997/12/30 23:09:04  curt
+ * Tweaking initialization sequences.
+ *
  * Revision 1.25  1997/12/30 22:22:33  curt
  * Further integration of event manager.
  *
index bc2592b0561f8bc61b08cd79aea550ae07b889fc..4f4652be41532b9a69b42dd7e1e6812e59e23c30 100644 (file)
@@ -273,6 +273,10 @@ void fgMoonInit() {
           moonPos.Declination);
 #endif
 
+    xMoon = 60000.0 * cos(moonPos.RightAscension) * cos(moonPos.Declination);
+    yMoon = 60000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination);
+    zMoon = 60000.0 * sin(moonPos.Declination);
+
     if ( !dl_exists ) {
        dl_exists = 1;
 
@@ -285,12 +289,6 @@ void fgMoonInit() {
           xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
 
 
-       xMoon = 60000.0 * cos(moonPos.RightAscension) * 
-           cos(moonPos.Declination);
-       yMoon = 60000.0 * sin(moonPos.RightAscension) * 
-           cos(moonPos.Declination);
-       zMoon = 60000.0 * sin(moonPos.Declination);
-
        glutSolidSphere(1.0, 10, 10);
 
        xglEndList();
@@ -303,6 +301,8 @@ void fgMoonRender() {
     struct fgLIGHT *l;
     GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
 
+    /* printf("Rendering moon\n"); */
+
     l = &cur_light_params;
 
     xglMaterialfv(GL_FRONT, GL_AMBIENT, l->sky_color );
@@ -319,9 +319,12 @@ void fgMoonRender() {
 
 
 /* $Log$
-/* Revision 1.14  1997/12/30 20:47:50  curt
-/* Integrated new event manager with subsystem initializations.
+/* Revision 1.15  1998/01/05 18:44:35  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.14  1997/12/30 20:47:50  curt
+ * Integrated new event manager with subsystem initializations.
+ *
  * Revision 1.13  1997/12/30 16:41:00  curt
  * Added log at end of file.
  *
index 5aa32341e5c65cfdab89d95fe5dab5ebef7e114b..d68d179a9b7d44d4ce79e0649593f4a0a4d95f44 100644 (file)
@@ -106,6 +106,10 @@ void fgSunInit() {
           sunPos.Declination);
 #endif
 
+    xSun = 60000.0 * cos(sunPos.RightAscension) * cos(sunPos.Declination);
+    ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
+    zSun = 60000.0 * sin(sunPos.Declination);
+
     if ( !dl_exists ) {
        dl_exists = 1;
 
@@ -114,10 +118,6 @@ void fgSunInit() {
        sun_obj = xglGenLists(1);
        xglNewList(sun_obj, GL_COMPILE );
 
-       xSun = 60000.0 * cos(sunPos.RightAscension) * cos(sunPos.Declination);
-       ySun = 60000.0 * sin(sunPos.RightAscension) * cos(sunPos.Declination);
-       zSun = 60000.0 * sin(sunPos.Declination);
-
        glutSolidSphere(1.0, 10, 10);
 
        xglEndList();
@@ -190,10 +190,13 @@ void fgSunRender() {
 
 
 /* $Log$
-/* Revision 1.11  1997/12/30 23:09:40  curt
-/* Worked on winding problem without luck, so back to calling glFrontFace()
-/* 3 times for each scenery area.
+/* Revision 1.12  1998/01/05 18:44:36  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.11  1997/12/30 23:09:40  curt
+ * Worked on winding problem without luck, so back to calling glFrontFace()
+ * 3 times for each scenery area.
+ *
  * Revision 1.10  1997/12/30 20:47:54  curt
  * Integrated new event manager with subsystem initializations.
  *
index 67fe077274f645edddab555b8568632dad877359..c529906d1b70782a2656d734ecba855556296ac4 100644 (file)
@@ -66,7 +66,7 @@ TAR = tar
 # -
 #---------------------------------------------------------------------------
 
-GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
+GLOBAL_CFLAGS = -Wall -DVERSION=\"$(FG_VERSION)\"
 
 
 #---------------------------------------------------------------------------
@@ -159,6 +159,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS) $(FG_DEBUG_FLAGS)
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.29  1998/01/05 18:44:33  curt
+# Add an option to advance/decrease time from keyboard.
+#
 # Revision 1.28  1997/12/30 23:08:50  curt
 # Version 0.21
 #
index e7d921c062f7734771d362c1cfac71590acd238e..a5d25af430b69cc81ec658cdcf2198c9785c7958 100644 (file)
@@ -56,6 +56,8 @@ void fgTimeInit(struct fgTIME *t) {
     printf("Initializing Time\n");
 
     t->gst_diff = -9999.0;
+    t->warp = 0;
+    t->warp_delta = 0;
 }
 
 
@@ -238,17 +240,15 @@ double sidereal_course(struct tm *gmt, time_t now, double lng) {
 
 void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
     double gst_precise, gst_course;
-    static long int warp = 0;
 
     printf("Updating time\n");
 
     /* get current Unix calendar time (in seconds) */
     /* warp = 60; */
-    warp += 0;
-    t->cur_time = time(NULL) + (0) * 60 * 60;
-    t->cur_time += warp;
-    printf("  Current Unix calendar time = %ld  warp = %ld\n", 
-          t->cur_time, warp);
+    t->warp += t->warp_delta;
+    t->cur_time = time(NULL) + t->warp;
+    printf("  Current Unix calendar time = %ld  warp = %ld  delta = %ld\n", 
+          t->cur_time, t->warp, t->warp_delta);
 
     /* get GMT break down for current time */
     t->gmt = gmtime(&t->cur_time);
@@ -298,9 +298,12 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
 
 
 /* $Log$
-/* Revision 1.25  1997/12/31 17:46:50  curt
-/* Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+/* Revision 1.26  1998/01/05 18:44:36  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.25  1997/12/31 17:46:50  curt
+ * Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+ *
  * Revision 1.24  1997/12/30 22:22:42  curt
  * Further integration of event manager.
  *
index a1743f90fd3a87ede0987e9fbe120c258bd6a895..9f98ac6d25568e22f3e1a17a048ce549bf76f807 100644 (file)
@@ -55,6 +55,13 @@ struct fgTIME {
                            sidereal time algorithm result and the
                            course result.  course + diff has good
                            accuracy for the short term */
+
+    long int warp;       /* An offset in seconds from the true time.
+                           Allows us to adjust the effective time of day. */
+
+    long int warp_delta; /* How much to change the value of warp each
+                           iteration.  Allows us to make time
+                           progress faster than normal. */
 };
 
 extern struct fgTIME cur_time_params;
@@ -92,9 +99,12 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t);
 
 
 /* $Log$
-/* Revision 1.11  1997/12/19 23:35:07  curt
-/* Lot's of tweaking with sky rendering and lighting.
+/* Revision 1.12  1998/01/05 18:44:37  curt
+/* Add an option to advance/decrease time from keyboard.
 /*
+ * Revision 1.11  1997/12/19 23:35:07  curt
+ * Lot's of tweaking with sky rendering and lighting.
+ *
  * Revision 1.10  1997/12/15 23:55:07  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.