mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
(commands) add dashboardlightenable and dashboardlightdisable commands
This commit is contained in:
25
Train.cpp
25
Train.cpp
@@ -399,6 +399,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::instrumentlightenable, &TTrain::OnCommand_instrumentlightenable },
|
{ user_command::instrumentlightenable, &TTrain::OnCommand_instrumentlightenable },
|
||||||
{ user_command::instrumentlightdisable, &TTrain::OnCommand_instrumentlightdisable },
|
{ user_command::instrumentlightdisable, &TTrain::OnCommand_instrumentlightdisable },
|
||||||
{ user_command::dashboardlighttoggle, &TTrain::OnCommand_dashboardlighttoggle },
|
{ user_command::dashboardlighttoggle, &TTrain::OnCommand_dashboardlighttoggle },
|
||||||
|
{ user_command::dashboardlightenable, &TTrain::OnCommand_dashboardlightenable },
|
||||||
|
{ user_command::dashboardlightdisable, &TTrain::OnCommand_dashboardlightdisable },
|
||||||
{ user_command::timetablelighttoggle, &TTrain::OnCommand_timetablelighttoggle },
|
{ user_command::timetablelighttoggle, &TTrain::OnCommand_timetablelighttoggle },
|
||||||
{ user_command::timetablelightenable, &TTrain::OnCommand_timetablelightenable },
|
{ user_command::timetablelightenable, &TTrain::OnCommand_timetablelightenable },
|
||||||
{ user_command::timetablelightdisable, &TTrain::OnCommand_timetablelightdisable },
|
{ user_command::timetablelightdisable, &TTrain::OnCommand_timetablelightdisable },
|
||||||
@@ -5146,6 +5148,15 @@ void TTrain::OnCommand_instrumentlightdisable( TTrain *Train, command_data const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
if( false == Train->DashboardLightActive ) {
|
||||||
|
OnCommand_dashboardlightenable(Train, Command);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OnCommand_dashboardlightdisable(Train, Command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_dashboardlightenable( TTrain *Train, command_data const &Command ) {
|
||||||
// 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
|
||||||
if( Command.action != GLFW_PRESS ) { return; }
|
if( Command.action != GLFW_PRESS ) { return; }
|
||||||
|
|
||||||
@@ -5161,7 +5172,19 @@ void TTrain::OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &
|
|||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggDashboardLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggDashboardLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_dashboardlightdisable( TTrain *Train, command_data const &Command ) {
|
||||||
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
|
if( Command.action != GLFW_PRESS ) { return; }
|
||||||
|
|
||||||
|
if( Train->ggDashboardLightButton.SubModel == nullptr ) {
|
||||||
|
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||||
|
WriteLog( "Dashboard Light switch is missing, or wasn't defined" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Train->DashboardLightActive ) {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DashboardLightActive = false;
|
Train->DashboardLightActive = false;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -420,6 +420,8 @@ class TTrain {
|
|||||||
static void OnCommand_instrumentlightenable( TTrain *Train, command_data const &Command );
|
static void OnCommand_instrumentlightenable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_instrumentlightdisable( TTrain *Train, command_data const &Command );
|
static void OnCommand_instrumentlightdisable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_dashboardlighttoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_dashboardlightenable( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_dashboardlightdisable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_timetablelighttoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_timetablelighttoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_timetablelightenable( TTrain *Train, command_data const &Command );
|
static void OnCommand_timetablelightenable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_timetablelightdisable( TTrain *Train, command_data const &Command );
|
static void OnCommand_timetablelightdisable( TTrain *Train, command_data const &Command );
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "instrumentlightenable", command_target::vehicle, command_mode::oneoff },
|
{ "instrumentlightenable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "instrumentlightdisable", command_target::vehicle, command_mode::oneoff },
|
{ "instrumentlightdisable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "dashboardlighttoggle", command_target::vehicle, command_mode::oneoff },
|
{ "dashboardlighttoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "dashboardlightenable", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "dashboardlightdisable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "timetablelighttoggle", command_target::vehicle, command_mode::oneoff },
|
{ "timetablelighttoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "timetablelightenable", command_target::vehicle, command_mode::oneoff },
|
{ "timetablelightenable", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "timetablelightdisable", command_target::vehicle, command_mode::oneoff },
|
{ "timetablelightdisable", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -252,6 +252,8 @@ enum class user_command {
|
|||||||
instrumentlightenable,
|
instrumentlightenable,
|
||||||
instrumentlightdisable,
|
instrumentlightdisable,
|
||||||
dashboardlighttoggle,
|
dashboardlighttoggle,
|
||||||
|
dashboardlightenable,
|
||||||
|
dashboardlightdisable,
|
||||||
timetablelighttoggle,
|
timetablelighttoggle,
|
||||||
timetablelightenable,
|
timetablelightenable,
|
||||||
timetablelightdisable,
|
timetablelightdisable,
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ driverkeyboard_input::default_bindings() {
|
|||||||
// instrumentlightenable,
|
// instrumentlightenable,
|
||||||
// instrumentlightdisable,
|
// instrumentlightdisable,
|
||||||
{ user_command::dashboardlighttoggle, GLFW_KEY_SEMICOLON | keymodifier::shift },
|
{ user_command::dashboardlighttoggle, GLFW_KEY_SEMICOLON | keymodifier::shift },
|
||||||
|
// dashboardlightenable
|
||||||
|
// dashboardlightdisable
|
||||||
{ user_command::timetablelighttoggle, GLFW_KEY_APOSTROPHE | keymodifier::shift },
|
{ user_command::timetablelighttoggle, GLFW_KEY_APOSTROPHE | keymodifier::shift },
|
||||||
// timetablelightenable
|
// timetablelightenable
|
||||||
// timetablelightdisable
|
// timetablelightdisable
|
||||||
|
|||||||
@@ -869,6 +869,12 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "dashboardlight_sw:", {
|
{ "dashboardlight_sw:", {
|
||||||
user_command::dashboardlighttoggle,
|
user_command::dashboardlighttoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "dashboardlighton_sw:", {
|
||||||
|
user_command::dashboardlightenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "dashboardlightoff_sw:", {
|
||||||
|
user_command::dashboardlightdisable,
|
||||||
|
user_command::none } },
|
||||||
{ "timetablelight_sw:", {
|
{ "timetablelight_sw:", {
|
||||||
user_command::timetablelighttoggle,
|
user_command::timetablelighttoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -747,6 +747,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
{ "dashboardlight_sw:", {
|
{ "dashboardlight_sw:", {
|
||||||
user_command::dashboardlighttoggle,
|
user_command::dashboardlighttoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "dashboardlighton_sw:", {
|
||||||
|
user_command::dashboardlightenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "dashboardlightoff_sw:", {
|
||||||
|
user_command::dashboardlightdisable,
|
||||||
|
user_command::none } },
|
||||||
{ "timetablelight_sw:", {
|
{ "timetablelight_sw:", {
|
||||||
user_command::timetablelighttoggle,
|
user_command::timetablelighttoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
Reference in New Issue
Block a user