mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
confgurable destination sign background, minor bug fixes
This commit is contained in:
@@ -1676,11 +1676,13 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
mvOccupied->TrainType == dt_EZT ? -0.55 :
|
||||
mvOccupied->TrainType == dt_DMU ? -0.45 :
|
||||
-0.2 );
|
||||
/*
|
||||
// HACK: emu with induction motors need to start their braking a bit sooner than the ones with series motors
|
||||
if( ( mvOccupied->TrainType == dt_EZT )
|
||||
&& ( mvControlling->EngineType == TEngineType::ElectricInductionMotor ) ) {
|
||||
fAccThreshold += 0.10;
|
||||
}
|
||||
*/
|
||||
}
|
||||
// TrainParams=NewTrainParams;
|
||||
// if (TrainParams)
|
||||
@@ -2244,6 +2246,11 @@ bool TController::CheckVehicles(TOrders user)
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: ensure vehicle lights are active from the beginning, if it had pre-activated battery
|
||||
if( mvOccupied->LightsPosNo > 0 ) {
|
||||
pVehicle->SetLights();
|
||||
}
|
||||
|
||||
if (AIControllFlag)
|
||||
{ // jeśli prowadzi komputer
|
||||
if( true == TestFlag( OrderCurrentGet(), Obey_train ) ) {
|
||||
|
||||
43
DynObj.cpp
43
DynObj.cpp
@@ -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
|
||||
|
||||
2
DynObj.h
2
DynObj.h
@@ -214,6 +214,7 @@ public:
|
||||
bool has_light { false }; // the submodel was originally configured with self-illumination attribute
|
||||
material_handle destination { null_handle }; // most recently assigned non-blank destination texture
|
||||
material_handle destination_off { null_handle }; // blank destination sign
|
||||
std::string background; // potential default background texture override
|
||||
std::string script; // potential python script used to generate texture data
|
||||
int update_rate { 0 }; // -1: per stop, 0: none, >0: fps // TBD, TODO: implement?
|
||||
std::string instancing; // potential method to generate more than one texture per timetable
|
||||
@@ -663,6 +664,7 @@ private:
|
||||
bool remove_coupler_adapter( int const Side );
|
||||
void RadioStop();
|
||||
void Damage(char flag);
|
||||
void SetLights();
|
||||
void RaLightsSet(int head, int rear);
|
||||
int LightList( end const Side ) const { return iInventory[ Side ]; }
|
||||
void set_cab_lights( int const Cab, float const Level );
|
||||
|
||||
37
Train.cpp
37
Train.cpp
@@ -2087,7 +2087,7 @@ void TTrain::OnCommand_batteryenable( TTrain *Train, command_data const &Command
|
||||
|
||||
// side-effects
|
||||
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
||||
Train->SetLights();
|
||||
Train->Dynamic()->SetLights();
|
||||
}
|
||||
}
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
@@ -3682,7 +3682,7 @@ void TTrain::OnCommand_lightspresetactivatenext( TTrain *Train, command_data con
|
||||
Train->mvOccupied->LightsPos + 1 :
|
||||
1 ); // wrap mode
|
||||
|
||||
Train->SetLights();
|
||||
Train->Dynamic()->SetLights();
|
||||
// visual feedback
|
||||
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||
// HACK: skip submodel animation when restarting cycle, since it plays in the 'wrong' direction
|
||||
@@ -3716,7 +3716,7 @@ void TTrain::OnCommand_lightspresetactivateprevious( TTrain *Train, command_data
|
||||
Train->mvOccupied->LightsPos - 1 :
|
||||
Train->mvOccupied->LightsPosNo ); // wrap mode
|
||||
|
||||
Train->SetLights();
|
||||
Train->Dynamic()->SetLights();
|
||||
// visual feedback
|
||||
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||
// HACK: skip submodel animation when restarting cycle, since it plays in the 'wrong' direction
|
||||
@@ -8191,37 +8191,6 @@ TTrain::radio_message( sound_source *Message, int const Channel ) {
|
||||
.play();
|
||||
}
|
||||
|
||||
void TTrain::SetLights()
|
||||
{
|
||||
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? 1 : 0, 4);
|
||||
bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0);
|
||||
int xs = (kier ? 0 : 1);
|
||||
if (kier ? p->NextC(1) : p->PrevC(1)) // jesli jest nastepny, to tylko przod
|
||||
{
|
||||
p->RaLightsSet(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1] * (1 - xs),
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->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(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1] * xs,
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->LightsPos - 1] * (1 - xs));
|
||||
}
|
||||
p = (kier ? p->NextC(4) : p->PrevC(4));
|
||||
}
|
||||
}
|
||||
else // calosc
|
||||
{
|
||||
p->RaLightsSet(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1],
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->LightsPos - 1]);
|
||||
}
|
||||
};
|
||||
|
||||
// clears state of all cabin controls
|
||||
void TTrain::clear_cab_controls()
|
||||
{
|
||||
|
||||
1
Train.h
1
Train.h
@@ -137,7 +137,6 @@ class TTrain {
|
||||
void UpdateCab();
|
||||
bool Update( double const Deltatime );
|
||||
void add_distance( double const Distance );
|
||||
void SetLights();
|
||||
// McZapkie-310302: ladowanie parametrow z pliku
|
||||
bool LoadMMediaFile(std::string const &asFileName);
|
||||
dictionary_source *GetTrainState();
|
||||
|
||||
@@ -47,7 +47,8 @@ state_serializer::deserialize_begin( std::string const &Scenariofile ) {
|
||||
// TODO: check first for presence of serialized binary files
|
||||
// if this fails, fall back on the legacy text format
|
||||
state->scratchpad.name = Scenariofile;
|
||||
if( Scenariofile != "$.scn" ) {
|
||||
if( ( true == Global.file_binary_terrain )
|
||||
&& ( Scenariofile != "$.scn" ) ) {
|
||||
// compilation to binary file isn't supported for rainsted-created overrides
|
||||
// NOTE: we postpone actual loading of the scene until we process time, season and weather data
|
||||
state->scratchpad.binary.terrain = Region->is_scene( Scenariofile ) ;
|
||||
@@ -128,7 +129,8 @@ state_serializer::deserialize_continue(std::shared_ptr<deserializer_state> state
|
||||
scene::Groups.update_map();
|
||||
Region->create_map_geometry();
|
||||
*/
|
||||
if( ( false == state->scratchpad.binary.terrain )
|
||||
if( ( true == Global.file_binary_terrain )
|
||||
&& ( false == state->scratchpad.binary.terrain )
|
||||
&& ( state->scenariofile != "$.scn" ) ) {
|
||||
// if we didn't find usable binary version of the scenario files, create them now for future use
|
||||
// as long as the scenario file wasn't rainsted-created base file override
|
||||
|
||||
Reference in New Issue
Block a user