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

confgurable destination sign background, minor bug fixes

This commit is contained in:
tmj-fstate
2020-05-05 20:34:41 +02:00
parent 8aee89ffa9
commit 6112198610
6 changed files with 56 additions and 40 deletions

View File

@@ -4618,9 +4618,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
mdModel = TModelsManager::GetModel(asModel, true);
if (ReplacableSkin != "none") {
m_materialdata.assign( ReplacableSkin );
// potentially set blank destination texture
DestinationSign.destination_off = DestinationFind( "nowhere" );
// DestinationSet( {}, {} );
}
Global.asCurrentTexturePath = szTexturePath; // z powrotem defaultowa sciezka do tekstur
do {
@@ -6001,6 +5998,10 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
DestinationSign.script = asBaseDir + DestinationSign.script;
}
}
else if( token == "destinationsignbackground:" ) {
parser.getTokens();
parser >> DestinationSign.background;
}
} while( token != "" );
@@ -6013,6 +6014,11 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
ErrorLog( "Animations tag is missing from the .mmd file \"" + asFileName + "\"" );
}
if( ReplacableSkin != "none" ) {
// potentially set blank destination texture
DestinationSign.destination_off = DestinationFind( ( DestinationSign.background.empty() ? "nowhere" : DestinationSign.background ) );
}
// assign default samples to sound emitters which weren't included in the config file
if( TestFlag( MoverParameters->CategoryFlag, 1 ) ) {
// rail vehicles:
@@ -6259,6 +6265,37 @@ void TDynamicObject::Damage(char flag)
MoverParameters->EngDmgFlag = flag;
};
void TDynamicObject::SetLights() {
TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4);
bool kier = (DirectionGet() * MoverParameters->CabOccupied > 0);
int xs = (kier ? 0 : 1);
if (kier ? p->NextC(1) : p->PrevC(1)) // jesli jest nastepny, to tylko przod
{
p->RaLightsSet(MoverParameters->Lights[xs][MoverParameters->LightsPos - 1] * (1 - xs),
MoverParameters->Lights[1 - xs][MoverParameters->LightsPos - 1] * xs);
p = (kier ? p->NextC(4) : p->PrevC(4));
while (p)
{
if (kier ? p->NextC(1) : p->PrevC(1))
{
p->RaLightsSet(0, 0);
}
else
{
p->RaLightsSet(MoverParameters->Lights[xs][MoverParameters->LightsPos - 1] * xs,
MoverParameters->Lights[1 - xs][MoverParameters->LightsPos - 1] * (1 - xs));
}
p = (kier ? p->NextC(4) : p->PrevC(4));
}
}
else // calosc
{
p->RaLightsSet(MoverParameters->Lights[xs][MoverParameters->LightsPos - 1],
MoverParameters->Lights[1 - xs][MoverParameters->LightsPos - 1]);
}
};
void TDynamicObject::RaLightsSet(int head, int rear)
{ // zapalenie świateł z przodu i z
// tyłu, zależne od kierunku