1
0
Fork 0

Fixed #321: --enable-clock-freeze freezed the splash screen

Splash screen effect must use system time - not freezable sim time
This commit is contained in:
ThorstenB 2011-05-21 14:51:10 +02:00
parent 59fe23dcb3
commit 9a3fb418e4
3 changed files with 16 additions and 4 deletions

View file

@ -317,7 +317,7 @@ do_resume (const SGPropertyNode * arg)
static bool static bool
do_pause (const SGPropertyNode * arg) 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/master",!paused);
fgSetBool("/sim/freeze/clock",!paused); fgSetBool("/sim/freeze/clock",!paused);
if (fgGetBool("/sim/freeze/replay-state",false)) if (fgGetBool("/sim/freeze/replay-state",false))

View file

@ -362,15 +362,18 @@ public:
assert(dynamic_cast<osg::Switch*>(node)); assert(dynamic_cast<osg::Switch*>(node));
osg::Switch* sw = static_cast<osg::Switch*>(node); osg::Switch* sw = static_cast<osg::Switch*>(node);
double t = globals->get_sim_time_sec(); bool enabled = scenery_enabled;
bool enabled = 0 < t;
sw->setValue(0, enabled); sw->setValue(0, enabled);
if (!enabled) if (!enabled)
return; return;
traverse(node, nv); traverse(node, nv);
} }
static bool scenery_enabled;
}; };
bool FGScenerySwitchCallback::scenery_enabled = false;
// Sky structures // Sky structures
SGSky *thesky; SGSky *thesky;
@ -604,7 +607,14 @@ FGRenderer::update( bool refresh_camera_settings ) {
if (_splash_screen_active) if (_splash_screen_active)
{ {
// Fade out the splash screen // 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); _splash_screen_active = (sAlpha > 0.0);
fgSetDouble("/sim/startup/splash-alpha", sAlpha); fgSetDouble("/sim/startup/splash-alpha", sAlpha);
} }

View file

@ -4,6 +4,7 @@
#include <simgear/scene/util/SGPickCallback.hxx> #include <simgear/scene/util/SGPickCallback.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/timing/timestamp.hxx>
#include <osg/ref_ptr> #include <osg/ref_ptr>
@ -85,6 +86,7 @@ protected:
SGPropertyNode_ptr _xsize, _ysize; SGPropertyNode_ptr _xsize, _ysize;
SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft; SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
SGPropertyNode_ptr _virtual_cockpit; SGPropertyNode_ptr _virtual_cockpit;
SGTimeStamp _splash_time;
bool _splash_screen_active; bool _splash_screen_active;
}; };