mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
(commands) add radioenable and radiodisable commands
This commit is contained in:
21
Train.cpp
21
Train.cpp
@@ -426,6 +426,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::hornhighactivate, &TTrain::OnCommand_hornhighactivate },
|
{ user_command::hornhighactivate, &TTrain::OnCommand_hornhighactivate },
|
||||||
{ user_command::whistleactivate, &TTrain::OnCommand_whistleactivate },
|
{ user_command::whistleactivate, &TTrain::OnCommand_whistleactivate },
|
||||||
{ user_command::radiotoggle, &TTrain::OnCommand_radiotoggle },
|
{ user_command::radiotoggle, &TTrain::OnCommand_radiotoggle },
|
||||||
|
{ user_command::radioenable, &TTrain::OnCommand_radioenable },
|
||||||
|
{ user_command::radiodisable, &TTrain::OnCommand_radiodisable },
|
||||||
{ user_command::radiochannelincrease, &TTrain::OnCommand_radiochannelincrease },
|
{ user_command::radiochannelincrease, &TTrain::OnCommand_radiochannelincrease },
|
||||||
{ user_command::radiochanneldecrease, &TTrain::OnCommand_radiochanneldecrease },
|
{ user_command::radiochanneldecrease, &TTrain::OnCommand_radiochanneldecrease },
|
||||||
{ user_command::radiostopsend, &TTrain::OnCommand_radiostopsend },
|
{ user_command::radiostopsend, &TTrain::OnCommand_radiostopsend },
|
||||||
@@ -6395,7 +6397,6 @@ void TTrain::OnCommand_whistleactivate( TTrain *Train, command_data const &Comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action != GLFW_PRESS ) { return; }
|
if( Command.action != GLFW_PRESS ) { return; }
|
||||||
|
|
||||||
// NOTE: we ignore the lack of 3d model to allow system reset after receiving radio-stop signal
|
// NOTE: we ignore the lack of 3d model to allow system reset after receiving radio-stop signal
|
||||||
@@ -6407,10 +6408,26 @@ void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command )
|
|||||||
// only reacting to press, so the sound can loop uninterrupted
|
// only reacting to press, so the sound can loop uninterrupted
|
||||||
if( false == Train->mvOccupied->Radio ) {
|
if( false == Train->mvOccupied->Radio ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->mvOccupied->Radio = true;
|
OnCommand_radioenable(Train, Command);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// turn off
|
// turn off
|
||||||
|
OnCommand_radiodisable(Train, Command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_radioenable( TTrain *Train, command_data const &Command ) {
|
||||||
|
if( Command.action != GLFW_PRESS ) { return; }
|
||||||
|
|
||||||
|
if( false == Train->mvOccupied->Radio ) {
|
||||||
|
Train->mvOccupied->Radio = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_radiodisable( TTrain *Train, command_data const &Command ) {
|
||||||
|
if( Command.action != GLFW_PRESS ) { return; }
|
||||||
|
|
||||||
|
if(Train->mvOccupied->Radio ) {
|
||||||
Train->mvOccupied->Radio = false;
|
Train->mvOccupied->Radio = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -448,6 +448,8 @@ class TTrain {
|
|||||||
static void OnCommand_hornhighactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_hornhighactivate( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_whistleactivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_whistleactivate( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiotoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiotoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_radioenable( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_radiodisable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command );
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "hornhighactivate", command_target::vehicle, command_mode::oneoff },
|
{ "hornhighactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "whistleactivate", command_target::vehicle, command_mode::oneoff },
|
{ "whistleactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiotoggle", command_target::vehicle, command_mode::oneoff },
|
{ "radiotoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "radioenable", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "radiodisable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiochannelincrease", command_target::vehicle, command_mode::oneoff },
|
{ "radiochannelincrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiochanneldecrease", command_target::vehicle, command_mode::oneoff },
|
{ "radiochanneldecrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiostopsend", command_target::vehicle, command_mode::oneoff },
|
{ "radiostopsend", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ enum class user_command {
|
|||||||
hornhighactivate,
|
hornhighactivate,
|
||||||
whistleactivate,
|
whistleactivate,
|
||||||
radiotoggle,
|
radiotoggle,
|
||||||
|
radioenable,
|
||||||
|
radiodisable,
|
||||||
radiochannelincrease,
|
radiochannelincrease,
|
||||||
radiochanneldecrease,
|
radiochanneldecrease,
|
||||||
radiostopsend,
|
radiostopsend,
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::hornhighactivate, GLFW_KEY_S },
|
{ user_command::hornhighactivate, GLFW_KEY_S },
|
||||||
{ user_command::whistleactivate, GLFW_KEY_Z },
|
{ user_command::whistleactivate, GLFW_KEY_Z },
|
||||||
{ user_command::radiotoggle, GLFW_KEY_R | keymodifier::control },
|
{ user_command::radiotoggle, GLFW_KEY_R | keymodifier::control },
|
||||||
|
// radioenable
|
||||||
|
// radiodisable
|
||||||
{ user_command::radiochannelincrease, GLFW_KEY_EQUAL },
|
{ user_command::radiochannelincrease, GLFW_KEY_EQUAL },
|
||||||
{ user_command::radiochanneldecrease, GLFW_KEY_MINUS },
|
{ user_command::radiochanneldecrease, GLFW_KEY_MINUS },
|
||||||
{ user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control },
|
{ user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control },
|
||||||
|
|||||||
@@ -776,6 +776,12 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "radio_sw:", {
|
{ "radio_sw:", {
|
||||||
user_command::radiotoggle,
|
user_command::radiotoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "radioon_sw:", {
|
||||||
|
user_command::radioenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "radiooff_sw:", {
|
||||||
|
user_command::radiodisable,
|
||||||
|
user_command::none } },
|
||||||
{ "radiochannel_sw:", {
|
{ "radiochannel_sw:", {
|
||||||
user_command::radiochannelincrease,
|
user_command::radiochannelincrease,
|
||||||
user_command::radiochanneldecrease } },
|
user_command::radiochanneldecrease } },
|
||||||
|
|||||||
@@ -657,6 +657,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
{ "radio_sw:", {
|
{ "radio_sw:", {
|
||||||
user_command::radiotoggle,
|
user_command::radiotoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "radioon_sw:", {
|
||||||
|
user_command::radioenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "radiooff_sw:", {
|
||||||
|
user_command::radiodisable,
|
||||||
|
user_command::none } },
|
||||||
{ "radiochannel_sw:", {
|
{ "radiochannel_sw:", {
|
||||||
user_command::radiochannelincrease,
|
user_command::radiochannelincrease,
|
||||||
user_command::radiochanneldecrease } },
|
user_command::radiochanneldecrease } },
|
||||||
|
|||||||
Reference in New Issue
Block a user