16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

minor bug fixes

This commit is contained in:
tmj-fstate
2019-03-23 01:54:26 +01:00
parent a767e36be8
commit ae5daac939
4 changed files with 38 additions and 20 deletions

View File

@@ -1408,9 +1408,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
continue; // i tyle wystarczy
}
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno
// dotyczyć samochodów?)
a = (v == 0.0 ? -1.0 : fAcc); // ruszanie albo hamowanie
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno dotyczyć samochodów?)
a = (v > 0.0 ?
fAcc :
mvOccupied->Vel < 0.01 ?
0.0 : // already standing still so no need to bother with brakes
-2.0 ); // ruszanie albo hamowanie
if ((a < fAcc) && (v == std::min(v, fNext))) {
// mniejsze przyspieszenie to mniejsza możliwość rozpędzenia się albo konieczność hamowania

View File

@@ -1003,10 +1003,8 @@ transcripts_panel::update() {
text_lines.clear();
for( auto const &transcript : ui::Transcripts.aLines ) {
if( Global.fTimeAngleDeg >= transcript.fShow ) {
// NOTE: legacy transcript lines use | as new line mark
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
}
if( Global.fTimeAngleDeg + ( transcript.fShow - Global.fTimeAngleDeg > 180 ? 360 : 0 ) < transcript.fShow ) { continue; }
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
}
}

View File

@@ -92,6 +92,17 @@ world_environment::update() {
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
// ...update skydome to match the current sun position as well...
// twilight factor can be reset later down, so we do it here while it's still reflecting state of the sun
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
m_skydome.SetTurbidity(
2.f
+ clamp( Global.Overcast, 0.f, 1.f )
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
m_skydome.SetOvercastFactor( Global.Overcast );
m_skydome.Update( m_sun.getDirection() );
float keylightintensity;
glm::vec3 keylightcolor;
if( moonlightlevel > sunlightlevel ) {
@@ -117,14 +128,6 @@ world_environment::update() {
glm::vec3( 235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f ),
duskfactor );
}
// ...update skydome to match the current sun position as well...
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
m_skydome.SetTurbidity(
2.f
+ clamp( Global.Overcast, 0.f, 1.f )
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
m_skydome.SetOvercastFactor( Global.Overcast );
m_skydome.Update( m_sun.getDirection() );
// ...retrieve current sky colour and brightness...
auto const skydomecolour = m_skydome.GetAverageColor();
auto const skydomehsv = colors::RGBtoHSV( skydomecolour );

View File

@@ -17,11 +17,12 @@ TTranscripts::AddLine( std::string const &txt, float show, float hide, bool it )
if( show == hide ) { return; } // komentarz jest ignorowany
// TODO: replace the timeangledeg mess with regular time points math
show = Global.fTimeAngleDeg + show / 240.0; // jeśli doba to 360, to 1s będzie równe 1/240
hide = Global.fTimeAngleDeg + hide / 240.0;
TTranscript transcript;
transcript.asText = txt;
transcript.asText = ExchangeCharInString( txt, '|', ' ' ); // NOTE: legacy transcript lines use | as new line mark
transcript.fShow = show;
transcript.fHide = hide;
transcript.bItalic = it;
@@ -64,12 +65,25 @@ TTranscripts::Add( std::string const &txt, bool backgorund ) {
void
TTranscripts::Update() {
// HACK: detect day change
if( fRefreshTime - Global.fTimeAngleDeg > 180 ) {
fRefreshTime -= 360;
}
if( Global.fTimeAngleDeg < fRefreshTime ) { return; } // nie czas jeszcze na zmiany
while( ( false == aLines.empty() )
&& ( Global.fTimeAngleDeg >= aLines.front().fHide ) ) {
// remove expired lines
aLines.pop_front();
// remove expired lines
while( false == aLines.empty() ) {
// HACK: detect day change
if( aLines.front().fHide - Global.fTimeAngleDeg > 180 ) {
aLines.front().fShow -= 360;
aLines.front().fHide -= 360;
}
if( Global.fTimeAngleDeg <= aLines.front().fHide ) {
// no expired lines yet
break;
}
aLines.pop_front(); // this line expired, discard it and start anew with the next one
}
// update next refresh time
if( false == aLines.empty() ) { fRefreshTime = aLines.front().fHide; }