From: ThorstenB Date: Sat, 21 May 2011 12:51:10 +0000 (+0200) Subject: Fixed #321: --enable-clock-freeze freezed the splash screen X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9a3fb418e4a358b65135d1e6d05d870cfc584b55;p=flightgear.git Fixed #321: --enable-clock-freeze freezed the splash screen Splash screen effect must use system time - not freezable sim time --- diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index fc70b43f1..6baed8315 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -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)) diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index 055a33aba..b57c4f53e 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -362,15 +362,18 @@ public: assert(dynamic_cast(node)); osg::Switch* sw = static_cast(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); } diff --git a/src/Main/renderer.hxx b/src/Main/renderer.hxx index 3d7133e02..42198b9f2 100644 --- a/src/Main/renderer.hxx +++ b/src/Main/renderer.hxx @@ -4,6 +4,7 @@ #include #include +#include #include @@ -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; };