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

Add radiocall1

This commit is contained in:
2026-04-19 04:15:25 +02:00
parent dcfd34908a
commit 6177cfb01d
6 changed files with 35 additions and 3 deletions

View File

@@ -147,6 +147,7 @@ commanddescription_sequence Commands_descriptions = {
{"radiostopenable", command_target::vehicle, command_mode::oneoff}, {"radiostopenable", command_target::vehicle, command_mode::oneoff},
{"radiostopdisable", command_target::vehicle, command_mode::oneoff}, {"radiostopdisable", command_target::vehicle, command_mode::oneoff},
{"radiostoptest", command_target::vehicle, command_mode::oneoff}, {"radiostoptest", command_target::vehicle, command_mode::oneoff},
{"radiocall1send", command_target::vehicle, command_mode::oneoff},
{"radiocall3send", command_target::vehicle, command_mode::oneoff}, {"radiocall3send", command_target::vehicle, command_mode::oneoff},
{"radiovolumeincrease", command_target::vehicle, command_mode::oneoff}, {"radiovolumeincrease", command_target::vehicle, command_mode::oneoff},
{"radiovolumedecrease", command_target::vehicle, command_mode::oneoff}, {"radiovolumedecrease", command_target::vehicle, command_mode::oneoff},
@@ -526,6 +527,7 @@ std::unordered_map<std::string, user_command> commandMap = {
{"radiostopenable", user_command::radiostopenable}, {"radiostopenable", user_command::radiostopenable},
{"radiostopdisable", user_command::radiostopdisable}, {"radiostopdisable", user_command::radiostopdisable},
{"radiostoptest", user_command::radiostoptest}, {"radiostoptest", user_command::radiostoptest},
{"radiocall1send", user_command::radiocall1send},
{"radiocall3send", user_command::radiocall3send}, {"radiocall3send", user_command::radiocall3send},
{"radiovolumeincrease", user_command::radiovolumeincrease}, {"radiovolumeincrease", user_command::radiovolumeincrease},
{"radiovolumedecrease", user_command::radiovolumedecrease}, {"radiovolumedecrease", user_command::radiovolumedecrease},

View File

@@ -141,6 +141,7 @@ enum class user_command
radiostopenable, radiostopenable,
radiostopdisable, radiostopdisable,
radiostoptest, radiostoptest,
radiocall1send,
radiocall3send, radiocall3send,
radiovolumeincrease, radiovolumeincrease,
radiovolumedecrease, radiovolumedecrease,

View File

@@ -835,6 +835,9 @@ drivermouse_input::default_bindings() {
{ "radiotest_sw:", { { "radiotest_sw:", {
user_command::radiostoptest, user_command::radiostoptest,
user_command::none } }, user_command::none } },
{ "radiocall1_sw:", {
user_command::radiocall1send,
user_command::none } },
{ "radiocall3_sw:", { { "radiocall3_sw:", {
user_command::radiocall3send, user_command::radiocall3send,
user_command::none } }, user_command::none } },

View File

@@ -450,6 +450,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
{ user_command::radiostopenable, &TTrain::OnCommand_radiostopenable }, { user_command::radiostopenable, &TTrain::OnCommand_radiostopenable },
{ user_command::radiostopdisable, &TTrain::OnCommand_radiostopdisable }, { user_command::radiostopdisable, &TTrain::OnCommand_radiostopdisable },
{ user_command::radiostoptest, &TTrain::OnCommand_radiostoptest }, { user_command::radiostoptest, &TTrain::OnCommand_radiostoptest },
{ user_command::radiocall1send, &TTrain::OnCommand_radiocall1send },
{ user_command::radiocall3send, &TTrain::OnCommand_radiocall3send }, { user_command::radiocall3send, &TTrain::OnCommand_radiocall3send },
{ user_command::radiovolumeincrease, &TTrain::OnCommand_radiovolumeincrease }, { user_command::radiovolumeincrease, &TTrain::OnCommand_radiovolumeincrease },
{ user_command::radiovolumedecrease, &TTrain::OnCommand_radiovolumedecrease }, { user_command::radiovolumedecrease, &TTrain::OnCommand_radiovolumedecrease },
@@ -6917,6 +6918,23 @@ void TTrain::OnCommand_radiostoptest( TTrain *Train, command_data const &Command
} }
} }
void TTrain::OnCommand_radiocall1send( TTrain *Train, command_data const &Command )
{
if( Command.action == GLFW_PRESS ) {
if( ( Train->RadioChannel() != 10 )
&& ( true == Train->mvOccupied->Radio )
&& ( Train->mvOccupied->Power24vIsAvailable || Train->mvOccupied->Power110vIsAvailable) ) {
simulation::Events.queue_receivers( radio_message::call1, Train->Dynamic()->GetPosition() );
}
// visual feedback
Train->ggRadioCall1.UpdateValue( 1.0 );
}
else if( Command.action == GLFW_RELEASE ) {
// visual feedback
Train->ggRadioCall1.UpdateValue( 0.0 );
}
}
void TTrain::OnCommand_radiocall3send( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_radiocall3send( TTrain *Train, command_data const &Command ) {
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
@@ -8343,6 +8361,7 @@ bool TTrain::Update( double const Deltatime )
ggRadioChannelNext.Update(); ggRadioChannelNext.Update();
ggRadioStop.Update(); ggRadioStop.Update();
ggRadioTest.Update(); ggRadioTest.Update();
ggRadioCall1.Update();
ggRadioCall3.Update(); ggRadioCall3.Update();
ggRadioVolumeSelector.Update(); ggRadioVolumeSelector.Update();
ggRadioVolumePrevious.Update(); ggRadioVolumePrevious.Update();
@@ -9861,6 +9880,7 @@ void TTrain::clear_cab_controls()
ggRadioChannelNext.Clear(); ggRadioChannelNext.Clear();
ggRadioStop.Clear(); ggRadioStop.Clear();
ggRadioTest.Clear(); ggRadioTest.Clear();
ggRadioCall1.Clear();
ggRadioCall3.Clear(); ggRadioCall3.Clear();
ggRadioVolumeSelector.Clear(); ggRadioVolumeSelector.Clear();
ggRadioVolumePrevious.Clear(); ggRadioVolumePrevious.Clear();
@@ -10668,6 +10688,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
{ "radiochannelnext_sw:", ggRadioChannelNext }, { "radiochannelnext_sw:", ggRadioChannelNext },
{ "radiostop_sw:", ggRadioStop }, { "radiostop_sw:", ggRadioStop },
{ "radiotest_sw:", ggRadioTest }, { "radiotest_sw:", ggRadioTest },
{ "radiocall1_sw:", ggRadioCall1 },
{ "radiocall3_sw:", ggRadioCall3 }, { "radiocall3_sw:", ggRadioCall3 },
{ "radiovolume_sw:", ggRadioVolumeSelector }, { "radiovolume_sw:", ggRadioVolumeSelector },
{ "radiovolumeprev_sw:", ggRadioVolumePrevious }, { "radiovolumeprev_sw:", ggRadioVolumePrevious },

View File

@@ -475,6 +475,7 @@ class TTrain {
static void OnCommand_radiostopenable( TTrain *Train, command_data const &Command ); static void OnCommand_radiostopenable( TTrain *Train, command_data const &Command );
static void OnCommand_radiostopdisable( TTrain *Train, command_data const &Command ); static void OnCommand_radiostopdisable( TTrain *Train, command_data const &Command );
static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command ); static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command );
static void OnCommand_radiocall1send( TTrain *Train, command_data const &Command );
static void OnCommand_radiocall3send( TTrain *Train, command_data const &Command ); static void OnCommand_radiocall3send( TTrain *Train, command_data const &Command );
static void OnCommand_radiovolumeincrease(TTrain *Train, command_data const &Command); static void OnCommand_radiovolumeincrease(TTrain *Train, command_data const &Command);
static void OnCommand_radiovolumedecrease(TTrain *Train, command_data const &Command); static void OnCommand_radiovolumedecrease(TTrain *Train, command_data const &Command);
@@ -580,6 +581,7 @@ public: // reszta może by?publiczna
TGauge ggRadioChannelNext; TGauge ggRadioChannelNext;
TGauge ggRadioTest; TGauge ggRadioTest;
TGauge ggRadioStop; TGauge ggRadioStop;
TGauge ggRadioCall1;
TGauge ggRadioCall3; TGauge ggRadioCall3;
TGauge ggRadioVolumeSelector; TGauge ggRadioVolumeSelector;
TGauge ggRadioVolumePrevious; TGauge ggRadioVolumePrevious;

View File

@@ -687,9 +687,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
{ "radiotest_sw:", { { "radiotest_sw:", {
user_command::radiostoptest, user_command::radiostoptest,
user_command::none } }, user_command::none } },
{ "radiocall3_sw:", { { "radiocall1_sw:", {
user_command::radiocall3send, user_command::radiocall1send,
user_command::none } }, user_command::none } },
{ "radiocall3_sw:", {
user_command::radiocall3send,
user_command::none } },
{ "radiovolume_sw:",{ { "radiovolume_sw:",{
user_command::radiovolumeincrease, user_command::radiovolumeincrease,
user_command::radiovolumedecrease } }, user_command::radiovolumedecrease } },