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