mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 181016. freespot color override, vehicle start jolt sound, switch trackbed generation fixes
This commit is contained in:
@@ -413,11 +413,9 @@ void TAnimContainer::EventAssign(basic_event *ev)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
TAnimModel::TAnimModel( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {
|
||||
// TODO: wrap these in a tuple and move to underlying model
|
||||
for( int index = 0; index < iMaxNumLights; ++index ) {
|
||||
LightsOn[ index ] = LightsOff[ index ] = nullptr; // normalnie nie ma
|
||||
lsLights[ index ] = ls_Off; // a jeśli są, to wyłączone
|
||||
}
|
||||
|
||||
m_lightcolors.fill( glm::vec3{ -1.f } );
|
||||
m_lightopacities.fill( 1.f );
|
||||
}
|
||||
|
||||
TAnimModel::~TAnimModel()
|
||||
@@ -498,20 +496,44 @@ bool TAnimModel::Load(cParser *parser, bool ter)
|
||||
if (LightsOn[i] || LightsOff[i]) // Ra: zlikwidowałem wymóg istnienia obu
|
||||
iNumLights = i + 1;
|
||||
|
||||
if ( parser->getToken<std::string>() == "lights" )
|
||||
{
|
||||
int i = 0;
|
||||
std::string token = parser->getToken<std::string>();
|
||||
while( ( token != "" )
|
||||
&& ( token != "endmodel" ) ) {
|
||||
std::string token;
|
||||
do {
|
||||
token = parser->getToken<std::string>();
|
||||
|
||||
LightSet( i, std::stof( token ) ); // stan światła jest liczbą z ułamkiem
|
||||
++i;
|
||||
if( token == "lights" ) {
|
||||
auto i{ 0 };
|
||||
while( ( false == ( token = parser->getToken<std::string>() ).empty() )
|
||||
&& ( token != "lightcolors" )
|
||||
&& ( token != "endmodel" ) ) {
|
||||
|
||||
if( i < iNumLights ) {
|
||||
// stan światła jest liczbą z ułamkiem
|
||||
LightSet( i, std::stof( token ) );
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if( token == "lightcolors" ) {
|
||||
auto i{ 0 };
|
||||
while( ( false == ( token = parser->getToken<std::string>() ).empty() )
|
||||
&& ( token != "lights" )
|
||||
&& ( token != "endmodel" ) ) {
|
||||
|
||||
if( ( i < iNumLights )
|
||||
&& ( token != "-1" ) ) { // -1 leaves the default color intact
|
||||
auto const lightcolor { std::stoi( token, 0, 16 ) };
|
||||
m_lightcolors[i] = {
|
||||
( ( lightcolor >> 16 ) & 0xff ) / 255.f,
|
||||
( ( lightcolor >> 8 ) & 0xff ) / 255.f,
|
||||
( ( lightcolor ) & 0xff ) / 255.f };
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
} while( ( false == token.empty() )
|
||||
&& ( token != "endmodel" ) );
|
||||
|
||||
token = "";
|
||||
parser->getTokens(); *parser >> token;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -683,6 +705,10 @@ void TAnimModel::RaPrepare()
|
||||
if (LightsOff[i])
|
||||
LightsOff[i]->iVisible = !state;
|
||||
}
|
||||
// potentially modify freespot colors
|
||||
if( LightsOn[i] ) {
|
||||
LightsOn[i]->SetDiffuseOverride( m_lightcolors[i], true);
|
||||
}
|
||||
}
|
||||
TSubModel::iInstance = reinterpret_cast<std::uintptr_t>( this ); //żeby nie robić cudzych animacji
|
||||
TSubModel::pasText = &asText; // przekazanie tekstu do wyświetlacza (!!!! do przemyślenia)
|
||||
|
||||
Reference in New Issue
Block a user