16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 20:29:17 +02:00

Merge branch 'milek-dev' into gfx-work

This commit is contained in:
milek7
2018-12-09 23:31:10 +01:00
7 changed files with 35 additions and 21 deletions

View File

@@ -363,7 +363,7 @@ enum class TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
/*podtypy hamulcow zespolonych*/
enum class TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
enum class TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other };
enum class TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P };
enum class TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P, MHZ_K8P };
/*typy hamulcow indywidualnych*/
enum class TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
/*dla osob/towar: opoznienie hamowania/odhamowania*/

View File

@@ -8223,6 +8223,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
{ "D2", TBrakeHandle::D2 },
{ "MHZ_EN57", TBrakeHandle::MHZ_EN57 },
{ "MHZ_K5P", TBrakeHandle::MHZ_K5P },
{ "MHZ_K8P", TBrakeHandle::MHZ_K8P },
{ "M394", TBrakeHandle::M394 },
{ "Knorr", TBrakeHandle::Knorr },
{ "Westinghouse", TBrakeHandle::West },
@@ -9013,6 +9014,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
Handle = std::make_shared<TFV4aM>();
break;
case TBrakeHandle::MHZ_EN57:
case TBrakeHandle::MHZ_K8P:
Handle = std::make_shared<TMHZ_EN57>();
break;
case TBrakeHandle::FVel6:

View File

@@ -800,6 +800,8 @@ uint32_t TSubModel::FlagsCheck()
// samo pomijanie glBindTexture() nie poprawi wydajności
// ale można sprawdzić, czy można w ogóle pominąć kod do tekstur (sprawdzanie
// replaceskin)
m_rotation_init_done = true;
uint32_t i = 0;
if (Child)
{ // Child jest renderowany po danym submodelu
@@ -1264,16 +1266,10 @@ TSubModel::offset( float const Geometrytestoffsetthreshold ) const {
}
}
if( true == TestFlag( iFlags, 0x0200 ) ) {
// flip coordinates for t3d file which wasn't yet initialized
if( ( false == simulation::is_ready )
|| ( false == Vertices.empty() ) ) {
// NOTE, HACK: results require flipping if the model wasn't yet initialized, so we're using crude method to detect possible cases
// TODO: sort out this mess, either unify offset lookups to take place before (or after) initialization,
// or provide way to determine on submodel level whether the initialization took place
offset = { -offset.x, offset.z, offset.y };
}
}
if (!m_rotation_init_done)
// NOTE, HACK: results require flipping if the model wasn't yet initialized,
// TODO: sort out this mess, maybe try unify offset lookups to take place before (or after) initialization,
offset = { -offset.x, offset.z, offset.y };
return offset;
}
@@ -1521,6 +1517,9 @@ void TSubModel::deserialize(std::istream &s)
fCosFalloffAngle = sn_utils::ld_float32(s);
fCosHotspotAngle = sn_utils::ld_float32(s);
fCosViewAngle = sn_utils::ld_float32(s);
// necessary rotations were already done during t3d->e3d conversion
m_rotation_init_done = true;
}
void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)

View File

@@ -121,6 +121,8 @@ private:
float fCosHotspotAngle { 0.3f }; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie światła
float fCosViewAngle { 0.0f }; // cos kata pod jakim sie teraz patrzy
bool m_rotation_init_done = false;
TSubModel *Next { nullptr };
TSubModel *Child { nullptr };
public: // temporary access, clean this up during refactoring

View File

@@ -745,6 +745,9 @@ void TTrain::OnCommand_aidriverdisable( TTrain *Train, command_data const &Comma
}
}
auto const EU07_CONTROLLER_BASERETURNDELAY { 0.5f };
auto const EU07_CONTROLLER_KEYBOARDETURNDELAY { 1.5f };
void TTrain::OnCommand_mastercontrollerincrease( TTrain *Train, command_data const &Command ) {
if( Command.action != GLFW_RELEASE ) {
@@ -755,6 +758,7 @@ void TTrain::OnCommand_mastercontrollerincrease( TTrain *Train, command_data con
else if (Command.action == GLFW_RELEASE) {
// release
Train->m_mastercontrollerinuse = false;
Train->m_mastercontrollerreturndelay = EU07_CONTROLLER_KEYBOARDETURNDELAY + EU07_CONTROLLER_BASERETURNDELAY;
}
}
@@ -776,6 +780,7 @@ void TTrain::OnCommand_mastercontrollerdecrease( TTrain *Train, command_data con
else if (Command.action == GLFW_RELEASE) {
// release
Train->m_mastercontrollerinuse = false;
Train->m_mastercontrollerreturndelay = EU07_CONTROLLER_KEYBOARDETURNDELAY + EU07_CONTROLLER_BASERETURNDELAY;
}
}
@@ -797,6 +802,7 @@ void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &C
else {
// release
Train->m_mastercontrollerinuse = false;
Train->m_mastercontrollerreturndelay = EU07_CONTROLLER_BASERETURNDELAY; // NOTE: keyboard return delay is omitted for other input sources
}
}
@@ -805,7 +811,7 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos + 0.025,
0.0, 1.0 );
@@ -3697,7 +3703,7 @@ void TTrain::OnCommand_redmarkerstoggle( TTrain *Train, command_data const &Comm
int const CouplNr {
clamp(
vehicle->DirectionGet()
* ( LengthSquared3( vehicle->HeadPosition() - Global.pCamera.Pos ) > LengthSquared3( vehicle->RearPosition() - Global.pCamera.Pos ) ?
* ( Math3D::LengthSquared3( vehicle->HeadPosition() - Global.pCamera.Pos ) > Math3D::LengthSquared3( vehicle->RearPosition() - Global.pCamera.Pos ) ?
1 :
-1 ),
0, 1 ) }; // z [-1,1] zrobić [0,1]
@@ -3723,7 +3729,7 @@ void TTrain::OnCommand_endsignalstoggle( TTrain *Train, command_data const &Comm
int const CouplNr {
clamp(
vehicle->DirectionGet()
* ( LengthSquared3( vehicle->HeadPosition() - Global.pCamera.Pos ) > LengthSquared3( vehicle->RearPosition() - Global.pCamera.Pos ) ?
* ( Math3D::LengthSquared3( vehicle->HeadPosition() - Global.pCamera.Pos ) > Math3D::LengthSquared3( vehicle->RearPosition() - Global.pCamera.Pos ) ?
1 :
-1 ),
0, 1 ) }; // z [-1,1] zrobić [0,1]
@@ -4877,12 +4883,16 @@ bool TTrain::Update( double const Deltatime )
|| ( input::command == user_command::mastercontrollerdecrease ) ) ) {
*/
if( false == m_mastercontrollerinuse ) {
if( mvOccupied->MainCtrlPos > mvOccupied->MainCtrlActualPos ) {
mvOccupied->DecMainCtrl( 1 );
}
else if( mvOccupied->MainCtrlPos < mvOccupied->MainCtrlActualPos ) {
// Ra 15-01: a to nie miało być tylko cofanie?
mvOccupied->IncMainCtrl( 1 );
m_mastercontrollerreturndelay -= Deltatime;
if( m_mastercontrollerreturndelay < 0.f ) {
m_mastercontrollerreturndelay = EU07_CONTROLLER_BASERETURNDELAY;
if( mvOccupied->MainCtrlPos > mvOccupied->MainCtrlActualPos ) {
mvOccupied->DecMainCtrl( 1 );
}
else if( mvOccupied->MainCtrlPos < mvOccupied->MainCtrlActualPos ) {
// Ra 15-01: a to nie miało być tylko cofanie?
mvOccupied->IncMainCtrl( 1 );
}
}
}
}

View File

@@ -646,6 +646,7 @@ private:
// McZapkie: do syczenia
float fPPress, fNPress;
bool m_mastercontrollerinuse { false };
float m_mastercontrollerreturndelay { 0.f };
int iRadioChannel { 1 }; // numer aktualnego kana?u radiowego
std::vector<std::tuple<std::string, texture_handle, std::optional<texture_window>>> m_screens;

View File

@@ -1 +1 @@
#define VERSION_INFO "M7 (GL3) 03.12.2018, based on milek-0b152db, tmj-3fbf5bf8"
#define VERSION_INFO "M7 (GL3) 09.12.2018, based on milek-574e2cf3, tmj-57327f96"