16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 13:59:19 +02:00

diesel-powered vehicle startup ai tweaks, gfx renderer tweaks, crash fixes

This commit is contained in:
tmj-fstate
2017-12-26 17:17:06 +01:00
parent c780f3efbf
commit 10c5907c4d
8 changed files with 167 additions and 150 deletions

View File

@@ -1886,21 +1886,10 @@ bool TController::CheckVehicles(TOrders user)
fMass += p->MoverParameters->TotalMass; // dodanie masy łącznie z ładunkiem fMass += p->MoverParameters->TotalMass; // dodanie masy łącznie z ładunkiem
if (fVelMax < 0 ? true : p->MoverParameters->Vmax < fVelMax) if (fVelMax < 0 ? true : p->MoverParameters->Vmax < fVelMax)
fVelMax = p->MoverParameters->Vmax; // ustalenie maksymalnej prędkości dla składu fVelMax = p->MoverParameters->Vmax; // ustalenie maksymalnej prędkości dla składu
/* //youBy: bez przesady, to jest proteza, napelniac mozna, a nawet trzeba, ale z umiarem!
//uwzględnić jeszcze wyłączenie hamulca
if
((p->MoverParameters->BrakeSystem!=Pneumatic)&&(p->MoverParameters->BrakeSystem!=ElectroPneumatic))
iDrivigFlags&=~moveOerlikons; //no jednak nie
else if (p->MoverParameters->BrakeSubsystem!=Oerlikon)
iDrivigFlags&=~moveOerlikons; //wtedy też nie */
p = p->Neightbour(dir); // pojazd podłączony od wskazanej strony p = p->Neightbour(dir); // pojazd podłączony od wskazanej strony
} }
if (main) if (main)
iDrivigFlags |= movePrimary; // nie znaleziono innego, można się porządzić iDrivigFlags |= movePrimary; // nie znaleziono innego, można się porządzić
/* //tabelka z listą pojazdów jest na razie nie potrzebna
delete[] pVehicles;
pVehicles=new TDynamicObject*[iVehicles];
*/
ControllingSet(); // ustalenie członu do sterowania (może być inny niż zasiedziany) ControllingSet(); // ustalenie członu do sterowania (może być inny niż zasiedziany)
int pantmask = 1; int pantmask = 1;
if (iDrivigFlags & movePrimary) if (iDrivigFlags & movePrimary)
@@ -2187,42 +2176,19 @@ bool TController::PrepareEngine()
LastReactionTime = 0.0; LastReactionTime = 0.0;
ReactionTime = PrepareTime; ReactionTime = PrepareTime;
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
// with Controlling do
if ( mvControlling->EnginePowerSource.SourceType == CurrentCollector ) if ( mvControlling->EnginePowerSource.SourceType == CurrentCollector ) {
/*
|| ( (mvOccupied->TrainType==dt_EZT)
&& (mvControlling->GetTrainsetVoltage() > 0.0 ) ) ) // sprawdzanie, czy zasilanie jest może w innym członie
*/
{
voltfront = true; voltfront = true;
voltrear = true; voltrear = true;
} }
// begin else {
// if Couplers[0].Connected<>nil) if( mvOccupied->TrainType != dt_EZT ) {
// begin // Ra 2014-06: to jest wirtualny prąd dla spalinowych???
// if Couplers[0].Connected^.PantFrontVolt or Couplers[0].Connected^.PantRearVolt) voltfront = true;
// voltfront:=true }
// else }
// voltfront:=false; if (AIControllFlag) {
// end // część wykonawcza dla sterowania przez komputer
// else
// voltfront:=false;
// if Couplers[1].Connected<>nil)
// begin
// if Couplers[1].Connected^.PantFrontVolt or Couplers[1].Connected^.PantRearVolt)
// voltrear:=true
// else
// voltrear:=false;
// end
// else
// voltrear:=false;
// end
else
// if EnginePowerSource.SourceType<>CurrentCollector)
if (mvOccupied->TrainType != dt_EZT)
voltfront = true; // Ra 2014-06: to jest wirtualny prąd dla spalinowych???
if (AIControllFlag) // jeśli prowadzi komputer
{ // część wykonawcza dla sterowania przez komputer
mvOccupied->BatterySwitch(true); mvOccupied->BatterySwitch(true);
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector) if (mvControlling->EnginePowerSource.SourceType == CurrentCollector)
{ // jeśli silnikowy jest pantografującym { // jeśli silnikowy jest pantografującym
@@ -2244,39 +2210,42 @@ bool TController::PrepareEngine()
mvControlling->PantCompFlag = false; // sprężarkę pantografów można już wyłączyć mvControlling->PantCompFlag = false; // sprężarkę pantografów można już wyłączyć
} }
} }
// if (mvOccupied->TrainType==dt_EZT)
//{//Ra 2014-12: po co to tutaj?
// mvControlling->PantFront(true);
// mvControlling->PantRear(true);
//}
// if (mvControlling->EngineType==DieselElectric)
// mvControlling->Battery=true; //Ra: to musi być tak?
} }
if (mvControlling->PantFrontVolt || mvControlling->PantRearVolt || voltfront || voltrear) if (mvControlling->PantFrontVolt || mvControlling->PantRearVolt || voltfront || voltrear)
{ // najpierw ustalamy kierunek, jeśli nie został ustalony { // najpierw ustalamy kierunek, jeśli nie został ustalony
if (!iDirection) // jeśli nie ma ustalonego kierunku if( !iDirection ) {
if (mvOccupied->V == 0) // jeśli nie ma ustalonego kierunku
{ // ustalenie kierunku, gdy stoi if( mvOccupied->V == 0 ) { // ustalenie kierunku, gdy stoi
iDirection = mvOccupied->CabNo; // wg wybranej kabiny iDirection = mvOccupied->CabNo; // wg wybranej kabiny
if (!iDirection) // jeśli nie ma ustalonego kierunku if( !iDirection ) {
if ((mvControlling->PantFrontVolt != 0.0) || // jeśli nie ma ustalonego kierunku
(mvControlling->PantRearVolt != 0.0) || voltfront || voltrear) if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) {
{ if( mvOccupied->Couplers[ 1 ].CouplingFlag == ctrain_virtual ) {
if (mvOccupied->Couplers[1].CouplingFlag == // jeśli z tyłu nie ma nic
ctrain_virtual) // jeśli z tyłu nie ma nic
iDirection = -1; // jazda w kierunku sprzęgu 1 iDirection = -1; // jazda w kierunku sprzęgu 1
if (mvOccupied->Couplers[0].CouplingFlag == }
ctrain_virtual) // jeśli z przodu nie ma nic if( mvOccupied->Couplers[ 0 ].CouplingFlag == ctrain_virtual ) {
// jeśli z przodu nie ma nic
iDirection = 1; // jazda w kierunku sprzęgu 0 iDirection = 1; // jazda w kierunku sprzęgu 0
} }
} }
else // ustalenie kierunku, gdy jedzie }
if ((mvControlling->PantFrontVolt != 0.0) || (mvControlling->PantRearVolt != 0.0) || }
voltfront || voltrear) else {
if (mvOccupied->V < 0) // jedzie do tyłu // ustalenie kierunku, gdy jedzie
if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) {
if( mvOccupied->V < 0 ) {
// jedzie do tyłu
iDirection = -1; // jazda w kierunku sprzęgu 1 iDirection = -1; // jazda w kierunku sprzęgu 1
else // jak nie do tyłu, to do przodu }
else {
// jak nie do tyłu, to do przodu
iDirection = 1; // jazda w kierunku sprzęgu 0 iDirection = 1; // jazda w kierunku sprzęgu 0
}
}
}
}
if (AIControllFlag) // jeśli prowadzi komputer if (AIControllFlag) // jeśli prowadzi komputer
{ // część wykonawcza dla sterowania przez komputer { // część wykonawcza dla sterowania przez komputer
if (mvControlling->ConvOvldFlag) if (mvControlling->ConvOvldFlag)
@@ -2285,38 +2254,48 @@ bool TController::PrepareEngine()
; // zerowanie napędu ; // zerowanie napędu
mvControlling->ConvOvldFlag = false; // reset nadmiarowego mvControlling->ConvOvldFlag = false; // reset nadmiarowego
} }
else if (!mvControlling->Mains) else if (false == mvControlling->Mains) {
{
// if TrainType=dt_SN61)
// begin
// OK:=(OrderDirectionChange(ChangeDir,Controlling)=-1);
// OK:=IncMainCtrl(1);
// end;
while (DecSpeed(true)) while (DecSpeed(true))
; // zerowanie napędu ; // zerowanie napędu
if( ( mvOccupied->EngineType == DieselEngine )
|| ( mvOccupied->EngineType == DieselElectric ) ) {
// start helper devices before spinning up the engine
// TODO: replace with dedicated diesel engine subsystems
mvOccupied->ConverterSwitch( true );
mvOccupied->CompressorSwitch( true );
}
if( mvOccupied->TrainType == dt_SN61 ) {
// specjalnie dla SN61 żeby nie zgasł
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
mvControlling->IncMainCtrl( 1 );
}
}
OK = mvControlling->MainSwitch(true); OK = mvControlling->MainSwitch(true);
if (mvControlling->EngineType == DieselEngine) /*
{ // Ra 2014-06: dla SN61 trzeba wrzucić pierwszą pozycję - nie wiem, czy tutaj... if (mvControlling->EngineType == DieselEngine) {
// Ra 2014-06: dla SN61 trzeba wrzucić pierwszą pozycję - nie wiem, czy tutaj...
// kiedyś działało... // kiedyś działało...
if (!mvControlling->MainCtrlPos) if (!mvControlling->MainCtrlPos) {
{ if( mvControlling->RList[ 0 ].R == 0.0 ) {
if (mvControlling->RList[0].R == // gdy na pozycji 0 dawka paliwa jest zerowa, to zgaśnie dlatego trzeba zwiększyć pozycję
0.0) // gdy na pozycji 0 dawka paliwa jest zerowa, to zgaśnie mvControlling->IncMainCtrl( 1 );
mvControlling->IncMainCtrl(1); // dlatego trzeba zwiększyć pozycję }
if (!mvControlling->ScndCtrlPos) // jeśli bieg nie został ustawiony if( ( !mvControlling->ScndCtrlPos ) // jeśli bieg nie został ustawiony
if (!mvControlling->MotorParam[0].AutoSwitch) // gdy biegi ręczne && ( !mvControlling->MotorParam[ 0 ].AutoSwitch ) // gdy biegi ręczne
if (mvControlling->MotorParam[0].mIsat == 0.0) // bl,mIsat,fi,mfi && ( mvControlling->MotorParam[ 0 ].mIsat == 0.0 ) ) { // bl,mIsat,fi,mfi
mvControlling->IncScndCtrl(1); // pierwszy bieg // pierwszy bieg
mvControlling->IncScndCtrl( 1 );
} }
} }
} }
else */
{ // Ra: iDirection określa, w którą stronę jedzie skład względem sprzęgów pojazdu z AI }
else {
OK = ( OrderDirectionChange( iDirection, mvOccupied ) == -1 ); OK = ( OrderDirectionChange( iDirection, mvOccupied ) == -1 );
mvOccupied->ConverterSwitch( true );
// w EN57 sprężarka w ra jest zasilana z silnikowego // w EN57 sprężarka w ra jest zasilana z silnikowego
mvControlling->CompressorSwitch( true ); mvControlling->CompressorSwitch( true );
mvControlling->ConverterSwitch(true);
mvControlling->CompressorSwitch(true);
} }
} }
else else
@@ -2721,17 +2700,19 @@ bool TController::IncSpeed()
break; break;
case DieselEngine: case DieselEngine:
if (mvControlling->ShuntModeAllow) if (mvControlling->ShuntModeAllow)
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga { // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga zerowania kierunku)
// zerowania kierunku)
// mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0); // mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0);
} }
if ((mvControlling->Vel > mvControlling->dizel_minVelfullengage) && if( true == Ready ) {
(mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0)) if( ( mvControlling->Vel > mvControlling->dizel_minVelfullengage )
&& ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn > 0 ) ) {
OK = mvControlling->IncMainCtrl( 1 ); OK = mvControlling->IncMainCtrl( 1 );
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0) }
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
OK = mvControlling->IncMainCtrl( 1 ); OK = mvControlling->IncMainCtrl( 1 );
if (!mvControlling->Mains) }
{ }
if( false == mvControlling->Mains ) {
mvControlling->MainSwitch( true ); mvControlling->MainSwitch( true );
mvControlling->ConverterSwitch( true ); mvControlling->ConverterSwitch( true );
mvControlling->CompressorSwitch( true ); mvControlling->CompressorSwitch( true );
@@ -3194,12 +3175,11 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
vCommandLocation = *NewLocation; vCommandLocation = *NewLocation;
if ((NewValue1 != 0.0) && (OrderList[OrderPos] != Obey_train)) if ((NewValue1 != 0.0) && (OrderList[OrderPos] != Obey_train))
{ // o ile jazda { // o ile jazda
if (!iEngineActive) if( iEngineActive == 0 ) {
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw, światła ustawi // trzeba odpalić silnik najpierw, światła ustawi
// JumpToNextOrder() OrderNext( Prepare_engine );
// if (OrderList[OrderPos]!=Obey_train) //jeśli nie pociągowa }
OrderNext(Obey_train); // to uruchomić jazdę pociągową (od razu albo po odpaleniu OrderNext(Obey_train); // to uruchomić jazdę pociągową (od razu albo po odpaleniu silnika
// silnika
OrderCheck(); // jeśli jazda pociągowa teraz, to wykonać niezbędne operacje OrderCheck(); // jeśli jazda pociągowa teraz, to wykonać niezbędne operacje
} }
if (NewValue1 != 0.0) // jeśli jechać if (NewValue1 != 0.0) // jeśli jechać
@@ -3502,6 +3482,7 @@ TController::UpdateSituation(double dt) {
index = std::min(BrakeAccTableSize, std::max(1, index)); index = std::min(BrakeAccTableSize, std::max(1, index));
fBrake_a0[0] = fBrake_a0[index]; fBrake_a0[0] = fBrake_a0[index];
fBrake_a1[0] = fBrake_a1[index]; fBrake_a1[0] = fBrake_a1[index];
Ready = true; // wstępnie gotowy Ready = true; // wstępnie gotowy
fReady = 0.0; // założenie, że odhamowany fReady = 0.0; // założenie, że odhamowany
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
@@ -3510,8 +3491,8 @@ TController::UpdateSituation(double dt) {
TDynamicObject *p = pVehicles[0]; // pojazd na czole składu TDynamicObject *p = pVehicles[0]; // pojazd na czole składu
while (p) while (p)
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów { // sprawdzenie odhamowania wszystkich połączonych pojazdów
if (Ready) // bo jak coś nie odhamowane, to dalej nie ma co sprawdzać if (Ready) {
// if (p->MoverParameters->BrakePress>=0.03*p->MoverParameters->MaxBrakePress) // bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
if (p->MoverParameters->BrakePress >= 0.4) // wg UIC określone sztywno na 0.04 if (p->MoverParameters->BrakePress >= 0.4) // wg UIC określone sztywno na 0.04
{ {
Ready = false; // nie gotowy Ready = false; // nie gotowy
@@ -3529,6 +3510,7 @@ TController::UpdateSituation(double dt) {
Need_TryAgain = true; // reset jak przy wywaleniu nadmiarowego Need_TryAgain = true; // reset jak przy wywaleniu nadmiarowego
} }
} }
}
if (fReady < p->MoverParameters->BrakePress) if (fReady < p->MoverParameters->BrakePress)
fReady = p->MoverParameters->BrakePress; // szukanie najbardziej zahamowanego fReady = p->MoverParameters->BrakePress; // szukanie najbardziej zahamowanego
if( ( dy = p->VectorFront().y ) != 0.0 ) { if( ( dy = p->VectorFront().y ) != 0.0 ) {
@@ -3547,6 +3529,25 @@ TController::UpdateSituation(double dt) {
// if (mvOccupied->BrakePress<0.08) //to wystarczy, że zadziałają liniowe (nie ma ich jeszcze!!!) // if (mvOccupied->BrakePress<0.08) //to wystarczy, że zadziałają liniowe (nie ma ich jeszcze!!!)
if (fReady < 0.8) // delikatniejszy warunek, obejmuje wszystkie wagony if (fReady < 0.8) // delikatniejszy warunek, obejmuje wszystkie wagony
Ready = true; //żeby uznać za odhamowany Ready = true; //żeby uznać za odhamowany
// second pass, for diesel engines verify the engines are fully started
// TODO: cache presence of diesel engines in the consist, to skip this test if there isn't any
p = pVehicles[ 0 ]; // pojazd na czole składu
while( ( true == Ready )
&& ( p != nullptr ) ) {
auto const *vehicle { p->MoverParameters };
if( ( vehicle->EngineType == DieselEngine )
|| ( vehicle->EngineType == DieselElectric ) ) {
Ready = (
vehicle->enrot > 0.9 * (
vehicle->EngineType == DieselEngine ?
vehicle->dizel_nmin :
vehicle->DElist[ 0 ].RPM / 60.0 ) );
}
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
}
// crude way to deal with automatic door opening on W4 preventing further ride // crude way to deal with automatic door opening on W4 preventing further ride
// for human-controlled vehicles with no door control and dynamic brake auto-activating with door open // for human-controlled vehicles with no door control and dynamic brake auto-activating with door open
@@ -5696,10 +5697,12 @@ void TController::DirectionForward(bool forward)
else else
while (mvOccupied->ActiveDir >= 0) while (mvOccupied->ActiveDir >= 0)
mvOccupied->DirectionBackward(); // do tyłu w obecnej kabinie mvOccupied->DirectionBackward(); // do tyłu w obecnej kabinie
if (mvOccupied->EngineType == DieselEngine) // specjalnie dla SN61 if( mvOccupied->TrainType == dt_SN61 ) {
if (iDrivigFlags & moveActive) // jeśli był już odpalony // specjalnie dla SN61 żeby nie zgasł
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0) if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
mvControlling->IncMainCtrl(1); //żeby nie zgasł mvControlling->IncMainCtrl( 1 );
}
}
}; };
std::string TController::Relation() std::string TController::Relation()

View File

@@ -3531,7 +3531,7 @@ void TDynamicObject::RenderSounds() {
} }
m_lastbrakepressure = MoverParameters->BrakePress; m_lastbrakepressure = MoverParameters->BrakePress;
// ensure some basic level of volume and scale it up depending on pressure in the cylinder; scale this by the leak rate // ensure some basic level of volume and scale it up depending on pressure in the cylinder; scale this by the leak rate
volume = 20 * m_brakepressurechange * ( 0.25 + 0.75 * ( std::max( MoverParameters->BrakePress, 0.0 ) / MoverParameters->MaxBrakePress[ 3 ] ) ); volume = 20 * m_brakepressurechange * ( 0.25 + 0.75 * ( std::max( 0.0, MoverParameters->BrakePress ) / std::max( 1.0, MoverParameters->MaxBrakePress[ 3 ] ) ) );
if( volume > 0.075f ) { if( volume > 0.075f ) {
rsUnbrake rsUnbrake
.gain( volume ) .gain( volume )
@@ -3589,7 +3589,7 @@ void TDynamicObject::RenderSounds() {
brakeforceratio = brakeforceratio =
clamp( clamp(
MoverParameters->UnitBrakeForce / ( MoverParameters->BrakeForceR( 1.0, MoverParameters->Vel ) / ( MoverParameters->NAxles * std::max( 1, MoverParameters->NBpA ) ) ), MoverParameters->UnitBrakeForce / std::max( 1.0, MoverParameters->BrakeForceR( 1.0, MoverParameters->Vel ) / ( MoverParameters->NAxles * std::max( 1, MoverParameters->NBpA ) ) ),
0.0, 1.0 ); 0.0, 1.0 );
rsBrake rsBrake
.pitch( rsBrake.m_frequencyoffset + MoverParameters->Vel * rsBrake.m_frequencyfactor ) .pitch( rsBrake.m_frequencyoffset + MoverParameters->Vel * rsBrake.m_frequencyfactor )

View File

@@ -46,7 +46,7 @@ public:
// returns offset of submodel associated with the button from the model centre // returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const; glm::vec3 model_offset() const;
// members // members
TSubModel *SubModel; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie TSubModel *SubModel { nullptr }; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
private: private:
// methods // methods

View File

@@ -8262,10 +8262,9 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
// end // end
else if (Command == "CompressorSwitch") /*NBMX*/ else if (Command == "CompressorSwitch") /*NBMX*/
{ {
if ((CValue1 == 1)) if( CompressorPower < 2 ) {
CompressorAllow = true; CompressorAllow = ( CValue1 == 1 );
else if ((CValue1 == 0)) }
CompressorAllow = false;
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
} }
else if (Command == "DoorOpen") /*NBMX*/ else if (Command == "DoorOpen") /*NBMX*/

View File

@@ -247,10 +247,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
NBpA = i_nbpa; NBpA = i_nbpa;
BrakeDelays = i_BD; BrakeDelays = i_BD;
BrakeDelayFlag = bdelay_P; BrakeDelayFlag = bdelay_P;
DCV = false;
ASBP = 0.0;
BrakeStatus = b_hld;
SoundFlag = 0;
// 210.88 // 210.88
// SizeBR:=i_bcn*i_bcr*i_bcr*i_bcd*40.17*MaxBP/(5-MaxBP); //objetosc ZP w stosunku do cylindra // SizeBR:=i_bcn*i_bcr*i_bcr*i_bcd*40.17*MaxBP/(5-MaxBP); //objetosc ZP w stosunku do cylindra
// 14" i cisnienia 4.2 atm // 14" i cisnienia 4.2 atm
@@ -258,7 +254,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
SizeBC = i_bcn * i_bcr * i_bcr * i_bcd * 210.88 * MaxBP / SizeBC = i_bcn * i_bcr * i_bcr * i_bcd * 210.88 * MaxBP /
4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm 4.2; // objetosc CH w stosunku do cylindra 14" i cisnienia 4.2 atm
// BrakeCyl:=TReservoir.Create;
BrakeCyl = std::make_shared<TBrakeCyl>(); BrakeCyl = std::make_shared<TBrakeCyl>();
BrakeRes = std::make_shared<TReservoir>(); BrakeRes = std::make_shared<TReservoir>();
ValveRes = std::make_shared<TReservoir>(); ValveRes = std::make_shared<TReservoir>();
@@ -268,7 +263,6 @@ TBrake::TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, int i_bcn
BrakeRes->CreateCap(i_brc); BrakeRes->CreateCap(i_brc);
ValveRes->CreateCap(0.25); ValveRes->CreateCap(0.25);
// FM.Free;
// materialy cierne // materialy cierne
i_mat = i_mat & (255 - bp_MHS); i_mat = i_mat & (255 - bp_MHS);
switch (i_mat) switch (i_mat)

View File

@@ -1396,7 +1396,7 @@ TWorld::Update_UI() {
uitextline2 += ( vehicle->MoverParameters->PantPressLockActive ? "!" : ( vehicle->MoverParameters->PantPressSwitchActive ? "*" : "." ) ); uitextline2 += ( vehicle->MoverParameters->PantPressLockActive ? "!" : ( vehicle->MoverParameters->PantPressSwitchActive ? "*" : "." ) );
uitextline2 += ( false == vehicle->MoverParameters->ConverterAllowLocal ? "-" : ( vehicle->MoverParameters->ConverterAllow ? ( vehicle->MoverParameters->ConverterFlag ? "X" : "x" ) : "." ) ); uitextline2 += ( false == vehicle->MoverParameters->ConverterAllowLocal ? "-" : ( vehicle->MoverParameters->ConverterAllow ? ( vehicle->MoverParameters->ConverterFlag ? "X" : "x" ) : "." ) );
uitextline2 += ( vehicle->MoverParameters->ConvOvldFlag ? "!" : "." ); uitextline2 += ( vehicle->MoverParameters->ConvOvldFlag ? "!" : "." );
uitextline2 += ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( vehicle->MoverParameters->CompressorAllow ? ( vehicle->MoverParameters->CompressorFlag ? "C" : "c" ) : "." ) ); uitextline2 += ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( ( vehicle->MoverParameters->CompressorAllow || vehicle->MoverParameters->CompressorPower > 1 ) ? ( vehicle->MoverParameters->CompressorFlag ? "C" : "c" ) : "." ) );
uitextline2 += ( vehicle->MoverParameters->CompressorGovernorLock ? "!" : "." ); uitextline2 += ( vehicle->MoverParameters->CompressorGovernorLock ? "!" : "." );
/* /*
uitextline2 += uitextline2 +=

View File

@@ -56,20 +56,7 @@ struct openal_source {
// methods // methods
template <class Iterator_> template <class Iterator_>
openal_source & openal_source &
bind( sound_source *Controller, uint32_sequence Sounds, Iterator_ First, Iterator_ Last ) { bind( sound_source *Controller, uint32_sequence Sounds, Iterator_ First, Iterator_ Last );
controller = Controller;
sounds = Sounds;
// look up and queue assigned buffers
std::vector<ALuint> buffers;
std::for_each(
First, Last,
[&]( audio::buffer_handle const &buffer ) {
buffers.emplace_back( audio::renderer.buffer( buffer ).id ); } );
if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
::alSourceRewind( id ); }
is_multipart = ( buffers.size() > 1 );
return *this; }
// starts playback of queued buffers // starts playback of queued buffers
void void
play(); play();
@@ -163,6 +150,32 @@ private:
extern openal_renderer renderer; extern openal_renderer renderer;
template <class Iterator_>
openal_source &
openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_ First, Iterator_ Last ) {
controller = Controller;
sounds = Sounds;
// look up and queue assigned buffers
std::vector<ALuint> buffers;
std::for_each(
First, Last,
[&]( audio::buffer_handle const &buffer ) {
buffers.emplace_back( audio::renderer.buffer( buffer ).id ); } );
if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
::alSourceRewind( id );
}
is_multipart = ( buffers.size() > 1 );
return *this;
}
inline inline
float float
amplitude_to_db( float const Amplitude ) { amplitude_to_db( float const Amplitude ) {

View File

@@ -111,7 +111,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
::glDepthFunc( GL_LEQUAL ); ::glDepthFunc( GL_LEQUAL );
glEnable( GL_DEPTH_TEST ); glEnable( GL_DEPTH_TEST );
glAlphaFunc( GL_GREATER, 0.04f ); glAlphaFunc( GL_GREATER, 0.f );
glEnable( GL_ALPHA_TEST ); glEnable( GL_ALPHA_TEST );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND ); glEnable( GL_BLEND );
@@ -828,11 +828,11 @@ opengl_renderer::setup_drawing( bool const Alpha ) {
if( true == Alpha ) { if( true == Alpha ) {
::glEnable( GL_BLEND ); ::glEnable( GL_BLEND );
::glAlphaFunc( GL_GREATER, 0.04f ); ::glAlphaFunc( GL_GREATER, 0.f );
} }
else { else {
::glDisable( GL_BLEND ); ::glDisable( GL_BLEND );
::glAlphaFunc( GL_GREATER, 0.50f ); ::glAlphaFunc( GL_GREATER, 0.5f );
} }
switch( m_renderpass.draw_mode ) { switch( m_renderpass.draw_mode ) {
@@ -1807,6 +1807,10 @@ opengl_renderer::Render( scene::shape_node const &Shape, bool const Ignorerange
void void
opengl_renderer::Render( TAnimModel *Instance ) { opengl_renderer::Render( TAnimModel *Instance ) {
if( false == Instance->m_visible ) {
return;
}
double distancesquared; double distancesquared;
switch( m_renderpass.draw_mode ) { switch( m_renderpass.draw_mode ) {
case rendermode::shadows: { case rendermode::shadows: {
@@ -2634,6 +2638,10 @@ opengl_renderer::Render_Alpha( cell_sequence::reverse_iterator First, cell_seque
void void
opengl_renderer::Render_Alpha( TAnimModel *Instance ) { opengl_renderer::Render_Alpha( TAnimModel *Instance ) {
if( false == Instance->m_visible ) {
return;
}
double distancesquared; double distancesquared;
switch( m_renderpass.draw_mode ) { switch( m_renderpass.draw_mode ) {
case rendermode::shadows: { case rendermode::shadows: {