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:
19
Gauge.cpp
19
Gauge.cpp
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user