Merge branch 'milek-dev' into gfx-work

This commit is contained in:
milek7
2019-01-19 19:51:32 +01:00
8 changed files with 41 additions and 39 deletions

View File

@@ -892,10 +892,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength;
TrainParams->UpdateMTable( simulation::Time, asNextStop );
UpdateDelayFlag();
TrainParams->StationIndexInc(); // przejście do następnej
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
// TableClear(); //aby od nowa sprawdziło W4 z inną nazwą już - to nie
// jest dobry pomysł
sSpeedTable[i].iFlags = 0; // nie liczy się już
continue; // nie analizować prędkości
}
@@ -970,21 +969,13 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
iDrivigFlags &= ~( moveStartHorn | moveStartHornNow );
}
UpdateDelayFlag();
// perform loading/unloading
auto const platformside = static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10;
auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], *TrainParams, platformside );
WaitingSet( exchangetime );
if( TrainParams->CheckTrainLatency() < 0.0 ) {
// odnotowano spóźnienie
iDrivigFlags |= moveLate;
}
else {
// przyjazd o czasie
iDrivigFlags &= ~moveLate;
}
if (TrainParams->DirectionChange()) {
// jeśli "@" w rozkładzie, to wykonanie dalszych komend
// wykonanie kolejnej komendy, nie dotyczy ostatniej stacji
@@ -1912,9 +1903,12 @@ void TController::AutoRewident()
d = d->Next(); // kolejny pojazd, podłączony od tyłu (licząc od czoła)
}
//ustawianie trybu pracy zadajnika hamulca, wystarczy raz po inicjalizacji AI
for( int i = 1; i <= 8; i *= 2 ) {
if( ( mvOccupied->BrakeOpModes & i ) > 0 ) {
mvOccupied->BrakeOpModeFlag = i;
if( true == AIControllFlag ) {
// if a human is in charge leave the brake mode up to them, otherwise do as you like
for( int i = 1; i <= 8; i *= 2 ) {
if( ( mvOccupied->BrakeOpModes & i ) > 0 ) {
mvOccupied->BrakeOpModeFlag = i;
}
}
}
@@ -6208,6 +6202,18 @@ std::string TController::NextStop() const
return nextstop;
};
void TController::UpdateDelayFlag() {
if( TrainParams->CheckTrainLatency() < 0.0 ) {
// odnotowano spóźnienie
iDrivigFlags |= moveLate;
}
else {
// przyjazd o czasie
iDrivigFlags &= ~moveLate;
}
}
//-----------koniec skanowania semaforow
void TController::TakeControl(bool yes)

View File

@@ -388,6 +388,8 @@ private:
int StationCount() const;
bool IsStop() const;
std::string NextStop() const;
// tests whether the train is delayed and sets accordingly a driving flag
void UpdateDelayFlag();
// members
Mtable::TTrainParameters *TrainParams = nullptr; // rozkład jazdy zawsze jest, nawet jeśli pusty
std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu

View File

@@ -4450,7 +4450,7 @@ void TDynamicObject::RenderSounds() {
// youBy: dzwiek ostrych lukow i ciasnych zwrotek
if( ( ts.R * ts.R > 1 )
&& ( MoverParameters->Vel > 0 ) ) {
&& ( MoverParameters->Vel > 5.0 ) ) {
// scale volume with curve radius and vehicle speed
volume =
MoverParameters->AccN * MoverParameters->AccN
@@ -4652,11 +4652,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
mdModel = TModelsManager::GetModel(asModel, true);
if (ReplacableSkin != "none")
{
std::string nowheretexture = TextureTest( "nowhere" ); // na razie prymitywnie
if( false == nowheretexture.empty() ) {
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.Fetch_Material( nowheretexture );
}
if (m_materialdata.multi_textures > 0) {
// jeśli model ma 4 tekstury
// check for the pipe method first
@@ -4695,6 +4690,9 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.Fetch_Material( ReplacableSkin );
}
// potentially set blank destination texture
DestinationSet( {}, {} );
if( GfxRenderer.Material( m_materialdata.replacable_skins[ 1 ] ).get_or_guess_opacity() == 0.0f ) {
// tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
m_materialdata.textures_alpha = 0x31310031;

View File

@@ -514,13 +514,19 @@ getvalues_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad )
void
getvalues_event::run_() {
WriteLog( "Type: GetValues" );
auto const *cell { m_input.data_cell() };
WriteLog( "Type: GetValues - "
+ cell->name() + " - ["
+ cell->Text() + "] ["
+ to_string( cell->Value1(), 2 ) + "] ["
+ to_string( cell->Value2(), 2 ) + "]" );
if( m_activator == nullptr ) { return; }
m_input.data_cell()->PutCommand(
cell->PutCommand(
m_activator->Mechanik,
&( m_input.data_cell()->location() ) );
&( cell->location() ) );
// potwierdzenie wykonania dla serwera (odczyt semafora już tak nie działa)
if( Global.iMultiplayer ) {

View File

@@ -3183,18 +3183,7 @@ bool TMoverParameters::DecBrakePress(double &brake, double PressLimit, double dp
bool TMoverParameters::BrakeDelaySwitch(int BDS)
{
bool rBDS;
// if (BrakeCtrlPosNo > 0)
if (BrakeHandle == TBrakeHandle::MHZ_EN57)
{
if ((BDS != BrakeOpModeFlag) && ((BDS & BrakeOpModes) > 0))
{
BrakeOpModeFlag = BDS;
rBDS = true;
}
else
rBDS = false;
}
else if (Hamulec->SetBDF(BDS))
if (Hamulec->SetBDF(BDS))
{
BrakeDelayFlag = BDS;
rBDS = true;

View File

@@ -6424,7 +6424,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
rsRunningNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax );
rsRunningNoise.owner( DynamicObject );
rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
// rsRunningNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
rsRunningNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax );
}
else if( token == "huntingnoise:" ) {
@@ -6432,7 +6432,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
rsHuntingNoise.deserialize( parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency, mvOccupied->Vmax );
rsHuntingNoise.owner( DynamicObject );
rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
// rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
rsHuntingNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax );
}
@@ -7358,7 +7358,7 @@ void TTrain::set_cab_controls( int const Cab ) {
if (ggBrakeOperationModeCtrl.SubModel != nullptr) {
ggBrakeOperationModeCtrl.PutValue(
(mvOccupied->BrakeOpModeFlag > 0 ?
log2(mvOccupied->BrakeOpModeFlag) :
std::log2(mvOccupied->BrakeOpModeFlag) :
0));
}
// alarm chain

View File

@@ -141,6 +141,7 @@ public:
shapenode_data const &
data() const;
// get bounding radius
// NOTE: use this method instead of direct access to the data member, due to lazy radius evaluation
float radius();
private:

View File

@@ -1 +1 @@
#define VERSION_INFO "M7 (GL3) 14.01.2018, based on milek-204b6001, tmj-6f48a6e5"
#define VERSION_INFO "M7 (GL3) 19.01.2018, based on milek-b648ca7c, tmj-330e52d4"