mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 180309. additional control commands, serial port output fix
This commit is contained in:
@@ -5095,7 +5095,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
||||
if( ( sides == "both" )
|
||||
|| ( sides == "left" ) ) {
|
||||
// left...
|
||||
auto const location { glm::vec3 { MoverParameters->DimHalf.x, MoverParameters->DimHalf.y, offset } };
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * 0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
m_doorsounds.emplace_back( door );
|
||||
@@ -5103,7 +5103,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
||||
if( ( sides == "both" )
|
||||
|| ( sides == "right" ) ) {
|
||||
// ...and right
|
||||
auto const location { glm::vec3 { -MoverParameters->DimHalf.x, MoverParameters->DimHalf.y, offset } };
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * -0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
m_doorsounds.emplace_back( door );
|
||||
@@ -5360,12 +5360,12 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
||||
dooranimationfirstindex += iAnimType[ i ];
|
||||
}
|
||||
// couplers
|
||||
auto const frontcoupleroffset { glm::vec3{ 0.f, 1.f, MoverParameters->DimHalf.z } };
|
||||
auto const frontcoupleroffset { glm::vec3{ 0.f, 1.f, MoverParameters->Dim.L * 0.5f } };
|
||||
m_couplersounds[ side::front ].dsbCouplerAttach.offset( frontcoupleroffset );
|
||||
m_couplersounds[ side::front ].dsbCouplerDetach.offset( frontcoupleroffset );
|
||||
m_couplersounds[ side::front ].dsbCouplerStretch.offset( frontcoupleroffset );
|
||||
m_couplersounds[ side::front ].dsbBufferClamp.offset( frontcoupleroffset );
|
||||
auto const rearcoupleroffset{ glm::vec3{ 0.f, 1.f, MoverParameters->DimHalf.z * -1.f } };
|
||||
auto const rearcoupleroffset { glm::vec3{ 0.f, 1.f, MoverParameters->Dim.L * -0.5f } };
|
||||
m_couplersounds[ side::rear ].dsbCouplerAttach.offset( rearcoupleroffset );
|
||||
m_couplersounds[ side::rear ].dsbCouplerDetach.offset( rearcoupleroffset );
|
||||
m_couplersounds[ side::rear ].dsbCouplerStretch.offset( rearcoupleroffset );
|
||||
|
||||
@@ -1067,8 +1067,6 @@ public:
|
||||
double TotalMassxg = 0.0; /*TotalMass*g*/
|
||||
|
||||
Math3D::vector3 vCoulpler[2]; // powtórzenie współrzędnych sprzęgów z DynObj :/
|
||||
Math3D::vector3 DimHalf; // połowy rozmiarów do obliczeń geometrycznych
|
||||
// int WarningSignal; //0: nie trabi, 1,2: trabi syreną o podanym numerze
|
||||
int WarningSignal = 0; // tymczasowo 8bit, ze względu na funkcje w MTools
|
||||
double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego
|
||||
bool bPantKurek3 = true; // kurek trójdrogowy (pantografu): true=połączenie z ZG, false=połączenie z małą sprężarką // domyślnie zbiornik pantografu połączony jest ze zbiornikiem głównym
|
||||
|
||||
@@ -7052,10 +7052,6 @@ void TMoverParameters::LoadFIZ_Dimensions( std::string const &line ) {
|
||||
extract_value( Dim.H, "H", line, "" );
|
||||
extract_value( Dim.W, "W", line, "" );
|
||||
|
||||
DimHalf.x = 0.5 * Dim.W; // połowa szerokości, OX jest w bok?
|
||||
DimHalf.y = 0.5 * Dim.L; // połowa długości, OY jest do przodu?
|
||||
DimHalf.z = 0.5 * Dim.H; // połowa wysokości, OZ jest w górę?
|
||||
|
||||
extract_value( Cx, "Cx", line, "0.3" );
|
||||
if( Dim.H <= 2.0 ) {
|
||||
//gdyby nie było parametru, lepsze to niż zero
|
||||
|
||||
58
Train.cpp
58
Train.cpp
@@ -203,6 +203,9 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::mubrakingindicatortoggle, &TTrain::OnCommand_mubrakingindicatortoggle },
|
||||
{ user_command::reverserincrease, &TTrain::OnCommand_reverserincrease },
|
||||
{ user_command::reverserdecrease, &TTrain::OnCommand_reverserdecrease },
|
||||
{ user_command::reverserforward, &TTrain::OnCommand_reverserforward },
|
||||
{ user_command::reverserneutral, &TTrain::OnCommand_reverserneutral },
|
||||
{ user_command::reverserbackward, &TTrain::OnCommand_reverserbackward },
|
||||
{ user_command::alerteracknowledge, &TTrain::OnCommand_alerteracknowledge },
|
||||
{ user_command::batterytoggle, &TTrain::OnCommand_batterytoggle },
|
||||
{ user_command::batteryenable, &TTrain::OnCommand_batteryenable },
|
||||
@@ -1394,6 +1397,61 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
if( Train->mvOccupied->ActiveDir < 1 ) {
|
||||
|
||||
while( ( Train->mvOccupied->ActiveDir < 1 )
|
||||
&& ( true == Train->mvOccupied->DirectionForward() ) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
// aktualizacja skrajnych pojazdów w składzie
|
||||
if( ( Train->mvOccupied->ActiveDir == 1 )
|
||||
&& ( Train->DynamicObject->Mechanik ) ) {
|
||||
|
||||
Train->DynamicObject->Mechanik->CheckVehicles( Change_direction );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
while( ( Train->mvOccupied->ActiveDir < 0 )
|
||||
&& ( true == Train->mvOccupied->DirectionForward() ) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
while( ( Train->mvOccupied->ActiveDir > 0 )
|
||||
&& ( true == Train->mvOccupied->DirectionBackward() ) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
if( Train->mvOccupied->ActiveDir > -1 ) {
|
||||
|
||||
while( ( Train->mvOccupied->ActiveDir > -1 )
|
||||
&& ( true == Train->mvOccupied->DirectionBackward() ) ) {
|
||||
// all work is done in the header
|
||||
}
|
||||
// aktualizacja skrajnych pojazdów w składzie
|
||||
if( ( Train->mvOccupied->ActiveDir == -1 )
|
||||
&& ( Train->DynamicObject->Mechanik ) ) {
|
||||
|
||||
Train->DynamicObject->Mechanik->CheckVehicles( Change_direction );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
3
Train.h
3
Train.h
@@ -193,6 +193,9 @@ class TTrain
|
||||
static void OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserdecrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserforward( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserneutral( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_reverserbackward( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_batterytoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_batteryenable( TTrain *Train, command_data const &Command );
|
||||
|
||||
1
color.h
1
color.h
@@ -4,6 +4,7 @@ namespace colors {
|
||||
|
||||
glm::vec4 const none{ 0.f, 0.f, 0.f, 1.f };
|
||||
glm::vec4 const white{ 1.f, 1.f, 1.f, 1.f };
|
||||
glm::vec4 const shadow{ 0.65f, 0.65f, 0.65f, 1.f };
|
||||
|
||||
inline
|
||||
glm::vec3
|
||||
|
||||
@@ -60,6 +60,9 @@ commanddescription_sequence Commands_descriptions = {
|
||||
{ "sandboxactivate", command_target::vehicle },
|
||||
{ "reverserincrease", command_target::vehicle },
|
||||
{ "reverserdecrease", command_target::vehicle },
|
||||
{ "reverserforward", command_target::vehicle },
|
||||
{ "reverserneutral", command_target::vehicle },
|
||||
{ "reverserbackward", command_target::vehicle },
|
||||
{ "linebreakertoggle", command_target::vehicle },
|
||||
{ "linebreakeropen", command_target::vehicle },
|
||||
{ "linebreakerclose", command_target::vehicle },
|
||||
|
||||
@@ -54,6 +54,9 @@ enum class user_command {
|
||||
sandboxactivate,
|
||||
reverserincrease,
|
||||
reverserdecrease,
|
||||
reverserforward,
|
||||
reverserneutral,
|
||||
reverserbackward,
|
||||
linebreakertoggle,
|
||||
linebreakeropen,
|
||||
linebreakerclose,
|
||||
|
||||
@@ -249,6 +249,12 @@ keyboard_input::default_bindings() {
|
||||
{ GLFW_KEY_D },
|
||||
// reverserdecrease
|
||||
{ GLFW_KEY_R },
|
||||
// reverserforward
|
||||
{ -1 },
|
||||
// reverserneutral
|
||||
{ -1 },
|
||||
// reverserbackward
|
||||
{ -1 },
|
||||
// linebreakertoggle
|
||||
{ GLFW_KEY_M },
|
||||
// linebreakeropen
|
||||
|
||||
@@ -1379,18 +1379,18 @@ opengl_renderer::Render( world_environment *Environment ) {
|
||||
|
||||
// calculate shadow tone, based on positions of celestial bodies
|
||||
m_shadowcolor = interpolate(
|
||||
glm::vec4{ 0.5f, 0.5f, 0.5f, 1.f },
|
||||
glm::vec4{ colors::shadow },
|
||||
glm::vec4{ colors::white },
|
||||
clamp( -Environment->m_sun.getAngle(), 0.f, 6.f ) / 6.f );
|
||||
if( ( Environment->m_sun.getAngle() < -18.f )
|
||||
&& ( Environment->m_moon.getAngle() > 0.f ) ) {
|
||||
// turn on moon shadows after nautical twilight, if the moon is actually up
|
||||
m_shadowcolor = glm::vec4{ 0.5f, 0.5f, 0.5f, 1.f };
|
||||
m_shadowcolor = colors::shadow;
|
||||
}
|
||||
// soften shadows depending on sky overcast factor
|
||||
m_shadowcolor = glm::min(
|
||||
colors::white,
|
||||
m_shadowcolor + glm::vec4{ glm::vec3{ 0.5f * Global.Overcast }, 1.f } );
|
||||
m_shadowcolor + ( ( colors::white - colors::shadow ) * Global.Overcast ) );
|
||||
|
||||
if( Global.bWireFrame ) {
|
||||
// bez nieba w trybie rysowania linii
|
||||
|
||||
@@ -372,7 +372,7 @@ private:
|
||||
std::string m_debugstatstext;
|
||||
|
||||
glm::vec4 m_baseambient { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
glm::vec4 m_shadowcolor { 0.65f, 0.65f, 0.65f, 1.f };
|
||||
glm::vec4 m_shadowcolor { colors::shadow };
|
||||
// TEnvironmentType m_environment { e_flat };
|
||||
float m_specularopaquescalefactor { 1.f };
|
||||
float m_speculartranslucentscalefactor { 1.f };
|
||||
|
||||
2
uart.cpp
2
uart.cpp
@@ -250,7 +250,7 @@ void uart_input::poll()
|
||||
0,
|
||||
//byte 2
|
||||
(uint8_t)(
|
||||
trainstate.motor_resistors << 1
|
||||
trainstate.ventilator_overload << 1
|
||||
| trainstate.motor_overload_threshold << 2),
|
||||
//byte 3
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user