mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
support for specifying multiple replaceable skins
This commit is contained in:
77
DynObj.cpp
77
DynObj.cpp
@@ -798,7 +798,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btnOn = true;
|
||||
}
|
||||
// else btCPass2.TurnOff();
|
||||
if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) )
|
||||
if (MoverParameters->Battery)
|
||||
{ // sygnaly konca pociagu
|
||||
if (btEndSignals1.Active())
|
||||
{
|
||||
@@ -900,9 +900,10 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||
// if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m
|
||||
}
|
||||
if( ( true == MoverParameters->Battery ) || ( true == MoverParameters->ConverterFlag ) ) {
|
||||
// sygnały czoła pociagu
|
||||
//Ra: wyświetlamy bez ograniczeń odległości, by były widoczne z daleka
|
||||
if (MoverParameters->Battery)
|
||||
{ // sygnały czoła pociagu //Ra: wyświetlamy bez
|
||||
// ograniczeń odległości, by były widoczne z
|
||||
// daleka
|
||||
if (TestFlag(iLights[0], 1))
|
||||
{
|
||||
btHeadSignals11.TurnOn();
|
||||
@@ -4293,45 +4294,47 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
}
|
||||
#else
|
||||
{ // tekstura wymienna jest raczej jedynie w "dynamic\"
|
||||
ReplacableSkin = Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
|
||||
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
|
||||
if (!x.empty())
|
||||
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9 );
|
||||
// ReplacableSkin = Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
|
||||
std::string nowheretexture = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
|
||||
if( false == nowheretexture.empty() ) {
|
||||
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( nowheretexture, "", 9 );
|
||||
}
|
||||
|
||||
if (m_materialdata.multi_textures > 0)
|
||||
{ // jeśli model ma 4 tekstury
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin + ",1", "", Global::iDynamicFiltering);
|
||||
if( m_materialdata.replacable_skins[ 1 ] )
|
||||
{ // pierwsza z zestawu znaleziona
|
||||
m_materialdata.replacable_skins[ 2 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin + ",2", "", Global::iDynamicFiltering);
|
||||
if( m_materialdata.replacable_skins[ 2 ] )
|
||||
{
|
||||
m_materialdata.multi_textures = 2; // już są dwie
|
||||
m_materialdata.replacable_skins[ 3 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin + ",3", "", Global::iDynamicFiltering);
|
||||
if( m_materialdata.replacable_skins[ 3 ] )
|
||||
{
|
||||
m_materialdata.multi_textures = 3; // a teraz nawet trzy
|
||||
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin + ",4", "", Global::iDynamicFiltering);
|
||||
if( m_materialdata.replacable_skins[ 4 ] )
|
||||
m_materialdata.multi_textures = 4; // jak są cztery, to blokujemy podmianę tekstury
|
||||
// rozkładem
|
||||
}
|
||||
if (m_materialdata.multi_textures > 0) {
|
||||
// jeśli model ma 4 tekstury
|
||||
// check for the pipe method first
|
||||
if( ReplacableSkin.find( '|' ) != std::string::npos ) {
|
||||
cParser nameparser( ReplacableSkin );
|
||||
nameparser.getTokens( 4, true, "|" );
|
||||
int skinindex = 0;
|
||||
std::string texturename; nameparser >> texturename;
|
||||
while( ( texturename != "" ) && ( skinindex < 4 ) ) {
|
||||
m_materialdata.replacable_skins[ skinindex + 1 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + texturename, "" );
|
||||
++skinindex;
|
||||
texturename = ""; nameparser >> texturename;
|
||||
}
|
||||
m_materialdata.multi_textures = skinindex;
|
||||
}
|
||||
else
|
||||
{ // zestaw nie zadziałał, próbujemy normanie
|
||||
m_materialdata.multi_textures = 0;
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin, "", Global::iDynamicFiltering);
|
||||
else {
|
||||
// otherwise try the basic approach
|
||||
int skinindex = 0;
|
||||
do {
|
||||
texture_manager::size_type texture = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + ReplacableSkin + "," + std::to_string( skinindex + 1 ), "", Global::iDynamicFiltering, true );
|
||||
if( false == GfxRenderer.Texture( texture ).is_ready ) {
|
||||
break;
|
||||
}
|
||||
m_materialdata.replacable_skins[ skinindex + 1 ] = texture;
|
||||
++skinindex;
|
||||
} while( skinindex < 4 );
|
||||
m_materialdata.multi_textures = skinindex;
|
||||
if( m_materialdata.multi_textures == 0 ) {
|
||||
// zestaw nie zadziałał, próbujemy normanie
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + ReplacableSkin, "", Global::iDynamicFiltering );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||
ReplacableSkin, "", Global::iDynamicFiltering);
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + ReplacableSkin, "", Global::iDynamicFiltering );
|
||||
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 1 ] ).has_alpha )
|
||||
m_materialdata.textures_alpha = 0x31310031; // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||
else
|
||||
|
||||
@@ -1716,7 +1716,7 @@ TWorld::Update_UI() {
|
||||
uitextline1 += " (paused)";
|
||||
}
|
||||
|
||||
uitextline2 = Global::Bezogonkow( owner->Relation(), true ) + " (" + owner->Timetable()->TrainName + ")";
|
||||
uitextline2 = Global::Bezogonkow( owner->Relation(), true ) + " (" + Global::Bezogonkow( owner->Timetable()->TrainName, true ) + ")";
|
||||
auto const nextstation = Global::Bezogonkow( owner->NextStop(), true );
|
||||
if( !nextstation.empty() ) {
|
||||
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
|
||||
|
||||
Reference in New Issue
Block a user