mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
(commands) Add alarmchainenable and alarmchaindisable commands
This commit is contained in:
56
Train.cpp
56
Train.cpp
@@ -246,6 +246,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::manualbrakeincrease, &TTrain::OnCommand_manualbrakeincrease },
|
{ user_command::manualbrakeincrease, &TTrain::OnCommand_manualbrakeincrease },
|
||||||
{ user_command::manualbrakedecrease, &TTrain::OnCommand_manualbrakedecrease },
|
{ user_command::manualbrakedecrease, &TTrain::OnCommand_manualbrakedecrease },
|
||||||
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
||||||
|
{ user_command::alarmchainenable, &TTrain::OnCommand_alarmchainenable},
|
||||||
|
{ user_command::alarmchaindisable, &TTrain::OnCommand_alarmchaindisable},
|
||||||
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
||||||
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
||||||
{ user_command::autosandboxtoggle, &TTrain::OnCommand_autosandboxtoggle },
|
{ user_command::autosandboxtoggle, &TTrain::OnCommand_autosandboxtoggle },
|
||||||
@@ -1047,7 +1049,7 @@ void TTrain::OnCommand_jointcontrollerset( TTrain *Train, command_data const &Co
|
|||||||
// on press or hold
|
// on press or hold
|
||||||
// value controls brake in range 0-0.5, master controller in range 0.5-1.0
|
// value controls brake in range 0-0.5, master controller in range 0.5-1.0
|
||||||
if( Command.param1 >= 0.5 ) {
|
if( Command.param1 >= 0.5 ) {
|
||||||
Train->set_master_controller(
|
Train->set_master_controller(
|
||||||
( Command.param1 * 2 - 1 )
|
( Command.param1 * 2 - 1 )
|
||||||
* ( Train->mvControlled->CoupledCtrl ?
|
* ( Train->mvControlled->CoupledCtrl ?
|
||||||
Train->mvControlled->MainCtrlPosNo + Train->mvControlled->ScndCtrlPosNo :
|
Train->mvControlled->MainCtrlPosNo + Train->mvControlled->ScndCtrlPosNo :
|
||||||
@@ -1822,20 +1824,36 @@ void TTrain::OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Comm
|
|||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
|
||||||
if( false == Train->mvOccupied->AlarmChainFlag ) {
|
if( false == Train->mvOccupied->AlarmChainFlag ) {
|
||||||
// pull
|
OnCommand_alarmchainenable(Train, Command);
|
||||||
Train->mvOccupied->AlarmChainSwitch( true );
|
|
||||||
// visual feedback
|
|
||||||
Train->ggAlarmChain.UpdateValue( 1.0 );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// release
|
OnCommand_alarmchaindisable(Train, Command);
|
||||||
Train->mvOccupied->AlarmChainSwitch( false );
|
|
||||||
// visual feedback
|
|
||||||
Train->ggAlarmChain.UpdateValue( 0.0 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_alarmchainenable(TTrain *Train, command_data const &Command)
|
||||||
|
{
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
|
||||||
|
// pull
|
||||||
|
Train->mvOccupied->AlarmChainSwitch(true);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggAlarmChain.UpdateValue(1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TTrain::OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command) {
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
|
||||||
|
// release
|
||||||
|
Train->mvOccupied->AlarmChainSwitch(false);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggAlarmChain.UpdateValue(0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||||
@@ -3682,7 +3700,7 @@ void TTrain::OnCommand_compressorpresetactivateprevious(TTrain *Train, command_d
|
|||||||
if( Train->ggCompressorListButton.type() == TGaugeType::push ) {
|
if( Train->ggCompressorListButton.type() == TGaugeType::push ) {
|
||||||
// impulse switch toggles only between positions 'default' and 'default+1'
|
// impulse switch toggles only between positions 'default' and 'default+1'
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Train->mvOccupied->CompressorListPos > 1)
|
if ((Train->mvOccupied->CompressorListPos > 1)
|
||||||
|| (true == Train->mvOccupied->CompressorListWrap)) {
|
|| (true == Train->mvOccupied->CompressorListWrap)) {
|
||||||
@@ -5215,7 +5233,7 @@ void TTrain::OnCommand_heatingdisable( TTrain *Train, command_data const &Comman
|
|||||||
|
|
||||||
Train->mvOccupied->HeatingSwitch( false );
|
Train->mvOccupied->HeatingSwitch( false );
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggTrainHeatingButton.UpdateValue(
|
Train->ggTrainHeatingButton.UpdateValue(
|
||||||
( Train->ggTrainHeatingButton.type() == TGaugeType::push ?
|
( Train->ggTrainHeatingButton.type() == TGaugeType::push ?
|
||||||
1.0 :
|
1.0 :
|
||||||
0.0 ),
|
0.0 ),
|
||||||
@@ -5351,7 +5369,7 @@ void TTrain::OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data con
|
|||||||
void TTrain::OnCommand_springbrakerelease(TTrain *Train, command_data const &Command) {
|
void TTrain::OnCommand_springbrakerelease(TTrain *Train, command_data const &Command) {
|
||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
|
|
||||||
auto *vehicle{ Train->find_nearest_consist_vehicle(Command.freefly, Command.location) };
|
auto *vehicle{ Train->find_nearest_consist_vehicle(Command.freefly, Command.location) };
|
||||||
if (vehicle == nullptr) { return; }
|
if (vehicle == nullptr) { return; }
|
||||||
Train->mvOccupied->SpringBrakeRelease();
|
Train->mvOccupied->SpringBrakeRelease();
|
||||||
@@ -5455,7 +5473,7 @@ void TTrain::OnCommand_inverterenable(TTrain *Train, command_data const &Command
|
|||||||
{
|
{
|
||||||
itemindex -= p->MoverParameters->InvertersNo;
|
itemindex -= p->MoverParameters->InvertersNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p = (kier ? p->Next(flag) : p->Prev(flag));
|
p = (kier ? p->Next(flag) : p->Prev(flag));
|
||||||
}
|
}
|
||||||
@@ -6618,8 +6636,8 @@ void TTrain::UpdateCab() {
|
|||||||
|
|
||||||
// Ra: przesiadka, jeśli AI zmieniło kabinę (a człon?)...
|
// Ra: przesiadka, jeśli AI zmieniło kabinę (a człon?)...
|
||||||
if( ( DynamicObject->Mechanik ) // może nie być?
|
if( ( DynamicObject->Mechanik ) // może nie być?
|
||||||
&& ( DynamicObject->Mechanik->AIControllFlag ) ) {
|
&& ( DynamicObject->Mechanik->AIControllFlag ) ) {
|
||||||
|
|
||||||
if( iCabn != ( // numer kabiny (-1: kabina B)
|
if( iCabn != ( // numer kabiny (-1: kabina B)
|
||||||
mvOccupied->CabOccupied == -1 ?
|
mvOccupied->CabOccupied == -1 ?
|
||||||
2 :
|
2 :
|
||||||
@@ -7650,7 +7668,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (DynamicObject->Mechanik ?
|
if (DynamicObject->Mechanik ?
|
||||||
(DynamicObject->Mechanik->AIControllFlag ? false :
|
(DynamicObject->Mechanik->AIControllFlag ? false :
|
||||||
(Global.iFeedbackMode == 4 /*|| (Global.bMWDmasterEnable && Global.bMWDBreakEnable)*/)) :
|
(Global.iFeedbackMode == 4 /*|| (Global.bMWDmasterEnable && Global.bMWDBreakEnable)*/)) :
|
||||||
false && Global.fCalibrateIn[ 0 ][ 1 ] != 0.0) // nie blokujemy AI
|
false && Global.fCalibrateIn[ 0 ][ 1 ] != 0.0) // nie blokujemy AI
|
||||||
{ // Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
|
{ // Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
|
||||||
@@ -7844,7 +7862,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggHelperButton.UpdateValue( DynamicObject->Mechanik->HelperState );
|
ggHelperButton.UpdateValue( DynamicObject->Mechanik->HelperState );
|
||||||
}
|
}
|
||||||
ggHelperButton.Update();
|
ggHelperButton.Update();
|
||||||
|
|
||||||
ggSpeedControlIncreaseButton.Update( lowvoltagepower );
|
ggSpeedControlIncreaseButton.Update( lowvoltagepower );
|
||||||
ggSpeedControlDecreaseButton.Update( lowvoltagepower );
|
ggSpeedControlDecreaseButton.Update( lowvoltagepower );
|
||||||
ggSpeedControlPowerIncreaseButton.Update( lowvoltagepower );
|
ggSpeedControlPowerIncreaseButton.Update( lowvoltagepower );
|
||||||
@@ -8043,7 +8061,7 @@ TTrain::update_sounds( double const Deltatime ) {
|
|||||||
rsHissX->stop();
|
rsHissX->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// upuszczanie z czasowego
|
// upuszczanie z czasowego
|
||||||
if( rsHissT ) {
|
if( rsHissT ) {
|
||||||
volume = mvOccupied->Handle->GetSound( s_fv4a_t ) * rsHissT->m_amplitudefactor + +rsHissT->m_amplitudeoffset;
|
volume = mvOccupied->Handle->GetSound( s_fv4a_t ) * rsHissT->m_amplitudefactor + +rsHissT->m_amplitudeoffset;
|
||||||
if( volume * brakevolumescale > 0.05 ) {
|
if( volume * brakevolumescale > 0.05 ) {
|
||||||
@@ -9701,7 +9719,7 @@ void TTrain::set_cab_controls( int const Cab ) {
|
|||||||
p = (kier ? p->Next(flag) : p->Prev(flag));
|
p = (kier ? p->Next(flag) : p->Prev(flag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we reset all indicators, as they're set during the update pass
|
// we reset all indicators, as they're set during the update pass
|
||||||
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
||||||
}
|
}
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -265,6 +265,8 @@ class TTrain {
|
|||||||
static void OnCommand_manualbrakeincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_manualbrakeincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_manualbrakedecrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_manualbrakedecrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_alarmchainenable(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command);
|
static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command);
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "manualbrakeincrease", command_target::vehicle, command_mode::oneoff },
|
{ "manualbrakeincrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "manualbrakedecrease", command_target::vehicle, command_mode::oneoff },
|
{ "manualbrakedecrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "alarmchaintoggle", command_target::vehicle, command_mode::oneoff },
|
{ "alarmchaintoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "alarmchainenable", command_target::vehicle, command_mode::oneoff},
|
||||||
|
{ "alarmchaindisable", command_target::vehicle, command_mode::oneoff},
|
||||||
{ "wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff },
|
{ "wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "sandboxactivate", command_target::vehicle, command_mode::oneoff },
|
{ "sandboxactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "autosandboxtoggle", command_target::vehicle, command_mode::oneoff },
|
{ "autosandboxtoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ enum class user_command {
|
|||||||
manualbrakeincrease,
|
manualbrakeincrease,
|
||||||
manualbrakedecrease,
|
manualbrakedecrease,
|
||||||
alarmchaintoggle,
|
alarmchaintoggle,
|
||||||
|
alarmchainenable,
|
||||||
|
alarmchaindisable,
|
||||||
wheelspinbrakeactivate,
|
wheelspinbrakeactivate,
|
||||||
sandboxactivate,
|
sandboxactivate,
|
||||||
autosandboxtoggle,
|
autosandboxtoggle,
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::manualbrakeincrease, GLFW_KEY_KP_1 | keymodifier::control },
|
{ user_command::manualbrakeincrease, GLFW_KEY_KP_1 | keymodifier::control },
|
||||||
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
|
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
|
||||||
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
|
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
|
||||||
|
// alarmchainenable,
|
||||||
|
// alarmchaindisable,
|
||||||
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
|
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
|
||||||
{ user_command::sandboxactivate, GLFW_KEY_S | keymodifier::shift },
|
{ user_command::sandboxactivate, GLFW_KEY_S | keymodifier::shift },
|
||||||
// autosandboxtoggle,
|
// autosandboxtoggle,
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ mouse_slider::bind( user_command const &Command ) {
|
|||||||
auto const brakerangemultiplier { powerrange / LocalBrakePosNo };
|
auto const brakerangemultiplier { powerrange / LocalBrakePosNo };
|
||||||
|
|
||||||
m_valuerange = 1.0;
|
m_valuerange = 1.0;
|
||||||
m_value =
|
m_value =
|
||||||
0.5
|
0.5
|
||||||
+ 0.5 * ( vehicle->CoupledCtrl ?
|
+ 0.5 * ( vehicle->CoupledCtrl ?
|
||||||
vehicle->MainCtrlPos + vehicle->ScndCtrlPos :
|
vehicle->MainCtrlPos + vehicle->ScndCtrlPos :
|
||||||
@@ -550,6 +550,12 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "alarmchain:", {
|
{ "alarmchain:", {
|
||||||
user_command::alarmchaintoggle,
|
user_command::alarmchaintoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "alarmchainon:", {
|
||||||
|
user_command::alarmchainenable,
|
||||||
|
user_command::none} },
|
||||||
|
{ "alarmchainoff:", {
|
||||||
|
user_command::alarmchainenable,
|
||||||
|
user_command::none} },
|
||||||
{ "brakeprofile_sw:", {
|
{ "brakeprofile_sw:", {
|
||||||
user_command::brakeactingspeedincrease,
|
user_command::brakeactingspeedincrease,
|
||||||
user_command::brakeactingspeeddecrease } },
|
user_command::brakeactingspeeddecrease } },
|
||||||
|
|||||||
@@ -434,6 +434,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
{ "alarmchain:", {
|
{ "alarmchain:", {
|
||||||
user_command::alarmchaintoggle,
|
user_command::alarmchaintoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "alarmchainon:", {
|
||||||
|
user_command::alarmchainenable,
|
||||||
|
user_command::none} },
|
||||||
|
{ "alarmchainoff:", {
|
||||||
|
user_command::alarmchainenable,
|
||||||
|
user_command::none} },
|
||||||
{ "brakeprofile_sw:", {
|
{ "brakeprofile_sw:", {
|
||||||
user_command::brakeactingspeedincrease,
|
user_command::brakeactingspeedincrease,
|
||||||
user_command::brakeactingspeeddecrease } },
|
user_command::brakeactingspeeddecrease } },
|
||||||
@@ -942,4 +948,3 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool vr_openvr::backend_register = vr_interface_factory::get_instance()->register_backend("openvr", vr_openvr::create_func);
|
bool vr_openvr::backend_register = vr_interface_factory::get_instance()->register_backend("openvr", vr_openvr::create_func);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user