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

build 170725. cab control sound support tweaks, excluded track nodes from casting shadows

This commit is contained in:
tmj-fstate
2017-07-25 18:34:24 +02:00
parent 2f1358422d
commit 000603877c
3 changed files with 18 additions and 12 deletions

View File

@@ -139,8 +139,8 @@ TGauge::Load_mapping( cParser &Input ) {
}
else if( key.find( "sound" ) == 0 ) {
// sounds assigned to specific gauge values, defined by key soundFoo: where Foo = value
auto const indexstart = key.find_first_of( "1234567890" );
auto const indexend = key.find_first_not_of( "1234567890", indexstart );
auto const indexstart = key.find_first_of( "-1234567890" );
auto const indexend = key.find_first_not_of( "-1234567890", indexstart );
if( indexstart != std::string::npos ) {
m_soundfxvalues.emplace(
std::stoi( key.substr( indexstart, indexend - indexstart ) ),
@@ -180,17 +180,20 @@ void TGauge::DecValue(double fNewDesired)
void
TGauge::UpdateValue( double fNewDesired, PSound Fallbacksound ) {
if( static_cast<int>( std::round( 100.0 * ( fDesiredValue - fOffset ) / fScale ) ) == static_cast<int>( 100.0 * fNewDesired ) ) {
auto const desiredtimes100 = static_cast<int>( 100.0 * fNewDesired );
if( static_cast<int>( std::round( 100.0 * ( fDesiredValue - fOffset ) / fScale ) ) == desiredtimes100 ) {
return;
}
fDesiredValue = fNewDesired * fScale + fOffset;
// if there's any sound associated with new requested value, play it
// check value-specific table first...
auto const desiredvalue = static_cast<int>( std::round( fNewDesired ) );
auto const lookup = m_soundfxvalues.find( desiredvalue );
if( lookup != m_soundfxvalues.end() ) {
play( lookup->second );
return;
if( desiredtimes100 % 100 == 0 ) {
// filter out values other than full integers
auto const lookup = m_soundfxvalues.find( desiredtimes100 / 100 );
if( lookup != m_soundfxvalues.end() ) {
play( lookup->second );
return;
}
}
// ...and if there isn't any, fall back on the basic set...
auto const currentvalue = GetValue();

View File

@@ -1258,10 +1258,10 @@ opengl_renderer::Render( TGroundNode *Node ) {
case TP_TRACK: {
// setup
::glPushMatrix();
auto const originoffset = Node->m_rootposition - m_renderpass.camera.position();
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
switch( m_renderpass.draw_mode ) {
case rendermode::shadows: {
return false;
}
case rendermode::pickscenery: {
// add the node to the pick list
m_picksceneryitems.emplace_back( Node );
@@ -1271,6 +1271,9 @@ opengl_renderer::Render( TGroundNode *Node ) {
break;
}
}
::glPushMatrix();
auto const originoffset = Node->m_rootposition - m_renderpass.camera.position();
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
// render
Render( Node->pTrack );
// post-render cleanup

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 17
#define VERSION_MINOR 724
#define VERSION_MINOR 725
#define VERSION_REVISION 0