]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed #321: --enable-clock-freeze freezed the splash screen
authorThorstenB <brehmt@gmail.com>
Sat, 21 May 2011 12:51:10 +0000 (14:51 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 21 May 2011 12:54:38 +0000 (14:54 +0200)
Splash screen effect must use system time - not freezable sim time

src/Main/fg_commands.cxx
src/Main/renderer.cxx
src/Main/renderer.hxx

index fc70b43f107347eb2c4c6b4fb806d9f32e1000a7..6baed83154f5f3b4ec2605ceeb94429e72545fbd 100644 (file)
@@ -317,7 +317,7 @@ do_resume (const SGPropertyNode * arg)
 static bool
 do_pause (const SGPropertyNode * arg)
 {
-    bool paused = fgGetBool("/sim/freeze/master",true);
+    bool paused = fgGetBool("/sim/freeze/master",true) || fgGetBool("/sim/freeze/clock",true);
     fgSetBool("/sim/freeze/master",!paused);
     fgSetBool("/sim/freeze/clock",!paused);
     if (fgGetBool("/sim/freeze/replay-state",false))
index 055a33aba18228421321171d80ac6f329903d586..b57c4f53e6e27a5e77aa433fb3930a822b7a98b9 100644 (file)
@@ -362,15 +362,18 @@ public:
     assert(dynamic_cast<osg::Switch*>(node));
     osg::Switch* sw = static_cast<osg::Switch*>(node);
 
-    double t = globals->get_sim_time_sec();
-    bool enabled = 0 < t;
+    bool enabled = scenery_enabled;
     sw->setValue(0, enabled);
     if (!enabled)
       return;
     traverse(node, nv);
   }
+
+  static bool scenery_enabled;
 };
 
+bool FGScenerySwitchCallback::scenery_enabled = false;
+
 // Sky structures
 SGSky *thesky;
 
@@ -604,7 +607,14 @@ FGRenderer::update( bool refresh_camera_settings ) {
     if (_splash_screen_active)
     {
         // Fade out the splash screen
-        double sAlpha = SGMiscd::max(0, (2.5 - globals->get_sim_time_sec()) / 2.5);
+        const double fade_time = 0.8;
+        const double fade_steps_per_sec = 20;
+        double delay_time = SGMiscd::min(fade_time/fade_steps_per_sec,
+                                         (SGTimeStamp::now() - _splash_time).toSecs());
+        _splash_time = SGTimeStamp::now();
+        double sAlpha = fgGetDouble("/sim/startup/splash-alpha", 1.0);
+        sAlpha -= SGMiscd::max(0.0,delay_time/fade_time);
+        FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
         _splash_screen_active = (sAlpha > 0.0);
         fgSetDouble("/sim/startup/splash-alpha", sAlpha);
     }
index 3d7133e02c9f899477192e41feb679d97f55f041..42198b9f2f7c3b3eab16c8f6f7bdd805eaaeccbf 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <simgear/scene/util/SGPickCallback.hxx>
 #include <simgear/props/props.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 #include <osg/ref_ptr>
 
@@ -85,6 +86,7 @@ protected:
     SGPropertyNode_ptr _xsize, _ysize;
     SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
     SGPropertyNode_ptr _virtual_cockpit;
+    SGTimeStamp _splash_time;
     bool _splash_screen_active;
 };