mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 20:29:17 +02:00
control for motor connectors, instrument and cab lighting. keyboard leds signalling, increased level of detail in zoom mode
This commit is contained in:
57
Console.cpp
57
Console.cpp
@@ -82,29 +82,14 @@ public static Int32 GetScreenSaverTimeout()
|
||||
// static class member storage allocation
|
||||
TKeyTrans Console::ktTable[4 * 256];
|
||||
|
||||
// Ra: do poprawienia
|
||||
void SetLedState(unsigned char Code, bool bOn){
|
||||
// Ra: bajer do migania LED-ami w klawiaturze
|
||||
// NOTE: disabled for the time being
|
||||
// TODO: find non Borland specific equivalent, or get rid of it
|
||||
/* if (Win32Platform == VER_PLATFORM_WIN32_NT)
|
||||
{
|
||||
// WriteLog(AnsiString(int(GetAsyncKeyState(Code))));
|
||||
if (bool(GetAsyncKeyState(Code)) != bOn)
|
||||
{
|
||||
keybd_event(Code, MapVirtualKey(Code, 0), KEYEVENTF_EXTENDEDKEY, 0);
|
||||
keybd_event(Code, MapVirtualKey(Code, 0), KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
|
||||
0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TKeyboardState KBState;
|
||||
GetKeyboardState(KBState);
|
||||
KBState[Code] = bOn ? 1 : 0;
|
||||
SetKeyboardState(KBState);
|
||||
};
|
||||
*/
|
||||
// Ra: bajer do migania LED-ami w klawiaturze
|
||||
void SetLedState( unsigned char Code, bool bOn ) {
|
||||
#ifdef _WINDOWS
|
||||
if( bOn != ( ::GetKeyState( Code ) != 0 ) ) {
|
||||
keybd_event( Code, MapVirtualKey( Code, 0 ), KEYEVENTF_EXTENDEDKEY | 0, 0 );
|
||||
keybd_event( Code, MapVirtualKey( Code, 0 ), KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -243,22 +228,24 @@ void Console::BitsUpdate(int mask)
|
||||
switch (iMode)
|
||||
{
|
||||
case 1: // sterowanie światełkami klawiatury: CA/SHP+opory
|
||||
if (mask & 3) // gdy SHP albo CA
|
||||
SetLedState(VK_CAPITAL, (iBits & 3) != 0);
|
||||
if (mask & 4) // gdy jazda na oporach
|
||||
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
||||
SetLedState(VK_SCROLL, true); // przyciśnięty
|
||||
SetLedState(VK_SCROLL, false); // zwolniony
|
||||
if( mask & 3 ) {
|
||||
// gdy SHP albo CA
|
||||
SetLedState( VK_CAPITAL, ( iBits & 3 ) != 0 );
|
||||
}
|
||||
if (mask & 4) {
|
||||
// gdy jazda na oporach
|
||||
SetLedState( VK_SCROLL, ( iBits & 4 ) != 0 );
|
||||
++iConfig; // licznik użycia Scroll Lock
|
||||
}
|
||||
break;
|
||||
case 2: // sterowanie światełkami klawiatury: CA+SHP
|
||||
if (mask & 2) // gdy CA
|
||||
SetLedState(VK_CAPITAL, (iBits & 2) != 0);
|
||||
if (mask & 1) // gdy SHP
|
||||
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
||||
SetLedState(VK_SCROLL, true); // przyciśnięty
|
||||
SetLedState(VK_SCROLL, false); // zwolniony
|
||||
if( mask & 2 ) {
|
||||
// gdy CA
|
||||
SetLedState( VK_CAPITAL, ( iBits & 2 ) != 0 );
|
||||
}
|
||||
if (mask & 1) {
|
||||
// gdy SHP
|
||||
SetLedState( VK_SCROLL, ( iBits & 1 ) != 0 );
|
||||
++iConfig; // licznik użycia Scroll Lock
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -675,7 +675,7 @@ public:
|
||||
headlight_right = 0x10,
|
||||
redmarker_right = 0x20,
|
||||
};
|
||||
bool ScndInMain = false; /*zaleznosc bocznika od nastawnika*/
|
||||
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
|
||||
bool MBrake = false; /*Czy jest hamulec reczny*/
|
||||
double StopBrakeDecc = 0.0;
|
||||
TSecuritySystem SecuritySystem;
|
||||
@@ -880,6 +880,7 @@ public:
|
||||
bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/
|
||||
bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/
|
||||
bool StLinFlag = false; /*!o styczniki liniowe*/
|
||||
bool StLinSwitchOff{ false }; // state of the button forcing motor connectors open
|
||||
bool ResistorsFlag = false; /*!o jazda rezystorowa*/
|
||||
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
|
||||
bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/
|
||||
|
||||
@@ -129,11 +129,15 @@ double TMoverParameters::current(double n, double U)
|
||||
|
||||
R = RList[MainCtrlActualPos].R * Bn + CircuitRes;
|
||||
|
||||
if ((TrainType != dt_EZT) || (Imin != IminLo) ||
|
||||
(!ScndS)) // yBARC - boczniki na szeregu poprawnie
|
||||
Mn = RList[MainCtrlActualPos].Mn; // to jest wykonywane dla EU07
|
||||
else
|
||||
Mn = RList[MainCtrlActualPos].Mn * RList[MainCtrlActualPos].Bn;
|
||||
if( ( TrainType != dt_EZT )
|
||||
|| ( Imin != IminLo )
|
||||
|| ( false == ScndS ) ) {
|
||||
// yBARC - boczniki na szeregu poprawnie
|
||||
Mn = RList[ MainCtrlActualPos ].Mn; // to jest wykonywane dla EU07
|
||||
}
|
||||
else {
|
||||
Mn = RList[ MainCtrlActualPos ].Mn * RList[ MainCtrlActualPos ].Bn;
|
||||
}
|
||||
|
||||
// writepaslog("#",
|
||||
// "C++-----------------------------------------------------------------------------");
|
||||
@@ -154,21 +158,25 @@ double TMoverParameters::current(double n, double U)
|
||||
if (DynamicBrakeFlag && (!FuseFlag) && (DynamicBrakeType == dbrake_automatic) &&
|
||||
ConverterFlag && Mains) // hamowanie EP09 //TUHEX
|
||||
{
|
||||
// TODO: zrobic bardziej uniwersalne nie tylko dla EP09
|
||||
MotorCurrent =
|
||||
-Max0R(MotorParam[0].fi * (Vadd / (Vadd + MotorParam[0].Isat) - MotorParam[0].fi0), 0) *
|
||||
n * 2.0 / ep09resED; // TODO: zrobic bardziej uniwersalne nie tylko dla EP09
|
||||
-Max0R(MotorParam[0].fi * (Vadd / (Vadd + MotorParam[0].Isat) - MotorParam[0].fi0), 0) * n * 2.0 / ep09resED;
|
||||
}
|
||||
else if( ( RList[ MainCtrlActualPos ].Bn == 0 )
|
||||
|| ( false == StLinFlag ) ) {
|
||||
// wylaczone
|
||||
MotorCurrent = 0;
|
||||
}
|
||||
else if ((RList[MainCtrlActualPos].Bn == 0) || (!StLinFlag))
|
||||
MotorCurrent = 0; // wylaczone
|
||||
else
|
||||
{ // wlaczone...
|
||||
SP = ScndCtrlActualPos;
|
||||
|
||||
if (ScndCtrlActualPos < 255) // tak smiesznie bede wylaczal
|
||||
{
|
||||
if (ScndInMain)
|
||||
if (!(RList[MainCtrlActualPos].ScndAct == 255))
|
||||
SP = RList[MainCtrlActualPos].ScndAct;
|
||||
if( ( ScndInMain )
|
||||
&& ( RList[ MainCtrlActualPos ].ScndAct != 255 ) ) {
|
||||
SP = RList[ MainCtrlActualPos ].ScndAct;
|
||||
}
|
||||
|
||||
Rz = Mn * WindingRes + R;
|
||||
|
||||
@@ -212,10 +220,10 @@ double TMoverParameters::current(double n, double U)
|
||||
{
|
||||
if (U > 0)
|
||||
MotorCurrent =
|
||||
(U1 - Isf * Rz - Mn * MotorParam[SP].fi * n + sqrt(Delta)) / (2.0 * Rz);
|
||||
(U1 - Isf * Rz - Mn * MotorParam[SP].fi * n + std::sqrt(Delta)) / (2.0 * Rz);
|
||||
else
|
||||
MotorCurrent =
|
||||
(U1 - Isf * Rz - Mn * MotorParam[SP].fi * n - sqrt(Delta)) / (2.0 * Rz);
|
||||
(U1 - Isf * Rz - Mn * MotorParam[SP].fi * n - std::sqrt(Delta)) / (2.0 * Rz);
|
||||
}
|
||||
else
|
||||
MotorCurrent = 0;
|
||||
@@ -1593,7 +1601,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
|
||||
// OK = false;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if( ( TrainType == dt_ET42 ) && ( true == DynamicBrakeFlag ) ) {
|
||||
if( MainCtrlPos > 20 ) {
|
||||
@@ -4895,7 +4903,8 @@ bool TMoverParameters::AutoRelayCheck(void)
|
||||
(MainCtrlActualPos == 0) && (ActiveDir != 0))
|
||||
{ //^^ TODO: sprawdzic BUG, prawdopodobnie w CreateBrakeSys()
|
||||
DelayCtrlFlag = true;
|
||||
if (LastRelayTime >= InitialCtrlDelay)
|
||||
if( (LastRelayTime >= InitialCtrlDelay)
|
||||
&& ( false == StLinSwitchOff ) )
|
||||
{
|
||||
StLinFlag = true; // ybARC - zalaczenie stycznikow liniowych
|
||||
MainCtrlActualPos = 1;
|
||||
@@ -5975,10 +5984,15 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||
continue;
|
||||
}
|
||||
|
||||
if( inputline.length() == 0 ) {
|
||||
if( inputline[ 0 ] == ' ' ) {
|
||||
// guard against malformed config files with leading spaces
|
||||
inputline.erase( 0, inputline.find_first_not_of( ' ' ) );
|
||||
}
|
||||
if( inputline.length() == 0 ) {
|
||||
startBPT = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// checking if table parsing should be switched off goes first...
|
||||
if( issection( "END-MPT", inputline ) ) {
|
||||
startBPT = false;
|
||||
|
||||
232
Train.cpp
232
Train.cpp
@@ -170,6 +170,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::linebreakertoggle, &TTrain::OnCommand_linebreakertoggle },
|
||||
{ user_command::convertertoggle, &TTrain::OnCommand_convertertoggle },
|
||||
{ user_command::compressortoggle, &TTrain::OnCommand_compressortoggle },
|
||||
{ user_command::motorconnectorsopen, &TTrain::OnCommand_motorconnectorsopen },
|
||||
{ user_command::motoroverloadrelaythresholdtoggle, &TTrain::OnCommand_motoroverloadrelaythresholdtoggle },
|
||||
{ user_command::heatingtoggle, &TTrain::OnCommand_heatingtoggle },
|
||||
{ user_command::headlighttoggleleft, &TTrain::OnCommand_headlighttoggleleft },
|
||||
@@ -182,6 +183,9 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::headlighttogglerearupper, &TTrain::OnCommand_headlighttogglerearupper },
|
||||
{ user_command::redmarkertogglerearleft, &TTrain::OnCommand_redmarkertogglerearleft },
|
||||
{ user_command::redmarkertogglerearright, &TTrain::OnCommand_redmarkertogglerearright },
|
||||
{ user_command::interiorlighttoggle, &TTrain::OnCommand_interiorlighttoggle },
|
||||
{ user_command::interiorlightdimtoggle, &TTrain::OnCommand_interiorlightdimtoggle },
|
||||
{ user_command::instrumentlighttoggle, &TTrain::OnCommand_instrumentlighttoggle },
|
||||
{ user_command::doortoggleleft, &TTrain::OnCommand_doortoggleleft },
|
||||
{ user_command::doortoggleright, &TTrain::OnCommand_doortoggleright },
|
||||
{ user_command::departureannounce, &TTrain::OnCommand_departureannounce },
|
||||
@@ -866,7 +870,9 @@ void TTrain::OnCommand_brakeactingspeedincrease( TTrain *Train, command_data con
|
||||
if( true == Train->mvOccupied->BrakeDelaySwitch( fasterbrakesetting ) ) {
|
||||
// audio feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
/*
|
||||
Train->play_sound( Train->dsbPneumaticRelay );
|
||||
*/
|
||||
// visual feedback
|
||||
if( Train->ggBrakeProfileCtrl.SubModel != nullptr ) {
|
||||
Train->ggBrakeProfileCtrl.UpdateValue(
|
||||
@@ -904,7 +910,9 @@ void TTrain::OnCommand_brakeactingspeeddecrease( TTrain *Train, command_data con
|
||||
if( true == Train->mvOccupied->BrakeDelaySwitch( slowerbrakesetting ) ) {
|
||||
// audio feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
/*
|
||||
Train->play_sound( Train->dsbPneumaticRelay );
|
||||
*/
|
||||
// visual feedback
|
||||
if( Train->ggBrakeProfileCtrl.SubModel != nullptr ) {
|
||||
Train->ggBrakeProfileCtrl.UpdateValue(
|
||||
@@ -1584,6 +1592,36 @@ void TTrain::OnCommand_compressortoggle( TTrain *Train, command_data const &Comm
|
||||
*/
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// TODO: don't rely on presense of 3d model to determine presence of the switch
|
||||
if( Train->ggStLinOffButton.SubModel == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( Command.action != GLFW_RELEASE ) {
|
||||
// button works while it's held down
|
||||
if( true == Train->mvControlled->StLinFlag ) {
|
||||
// yBARC - zmienione na przeciwne, bo true to zalaczone
|
||||
Train->mvControlled->StLinFlag = false;
|
||||
Train->play_sound( Train->dsbRelay );
|
||||
}
|
||||
Train->mvControlled->StLinSwitchOff = true;
|
||||
// visual feedback
|
||||
Train->ggStLinOffButton.UpdateValue( 1.0 );
|
||||
// sound feedback
|
||||
if( Train->ggStLinOffButton.GetValue() < 0.05 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// button released
|
||||
Train->mvControlled->StLinSwitchOff = false;
|
||||
// visual feedback
|
||||
Train->ggStLinOffButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
@@ -1987,6 +2025,107 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_interiorlighttoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// NOTE: the check is disabled, as we're presuming light control is present in every vehicle
|
||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||
if( Train->ggCabLightButton.SubModel == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == Train->bCabLight ) {
|
||||
// turn on
|
||||
Train->bCabLight = true;
|
||||
Train->btCabLight.TurnOn();
|
||||
// audio feedback
|
||||
if( Train->ggCabLightButton.GetValue() < 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggCabLightButton.UpdateValue( 1.0 );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->bCabLight = false;
|
||||
Train->btCabLight.TurnOff();
|
||||
// audio feedback
|
||||
if( Train->ggCabLightButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggCabLightButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_interiorlightdimtoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||
if( Train->ggCabLightDimButton.SubModel == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == Train->bCabLightDim ) {
|
||||
// turn on
|
||||
Train->bCabLightDim = true;
|
||||
// audio feedback
|
||||
if( Train->ggCabLightDimButton.GetValue() < 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggCabLightDimButton.UpdateValue( 1.0 );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->bCabLightDim = false;
|
||||
// audio feedback
|
||||
if( Train->ggCabLightDimButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggCabLightDimButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_instrumentlighttoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// NOTE: the check is disabled, as we're presuming light control is present in every vehicle
|
||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||
if( Train->ggUniversal3Button.SubModel == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
// NOTE: instrument lighting isn't fully implemented, so we have to rely on the state of the 'button' i.e. light itself
|
||||
if( false == Train->LampkaUniversal3_st ) {
|
||||
// turn on
|
||||
Train->LampkaUniversal3_st = true;
|
||||
// audio feedback
|
||||
if( Train->ggUniversal3Button.GetValue() < 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggUniversal3Button.UpdateValue( 1.0 );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->LampkaUniversal3_st = false;
|
||||
// audio feedback
|
||||
if( Train->ggUniversal3Button.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggUniversal3Button.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->ggTrainHeatingButton.SubModel == nullptr ) {
|
||||
@@ -2530,14 +2669,13 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//-----------
|
||||
// hunter-131211: dzwiek dla przelacznika universala podniesionego
|
||||
// hunter-091012: ubajerowanie swiatla w kabinie (wyrzucenie
|
||||
// przyciemnienia pod Univ4)
|
||||
else if (cKey == Global::Keys[k_Univ3])
|
||||
{
|
||||
if (Global::ctrlState)
|
||||
if( Global::ctrlState )
|
||||
{
|
||||
if (bCabLight == false) //(ggCabLightButton.GetValue()==0)
|
||||
{
|
||||
@@ -2571,7 +2709,6 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
//-----------
|
||||
else if (cKey == Global::Keys[k_PantFrontUp])
|
||||
{ // Winger 160204: podn.
|
||||
@@ -3736,7 +3873,6 @@ if
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//-----------
|
||||
// hunter-131211: dzwiek dla przelacznika universala
|
||||
// hunter-091012: ubajerowanie swiatla w kabinie (wyrzucenie
|
||||
@@ -3763,7 +3899,6 @@ if
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
//-----------
|
||||
// hunter-091012: dzwiek dla przyciemnienia swiatelka w kabinie
|
||||
else if (cKey == Global::Keys[k_Univ4])
|
||||
@@ -3777,7 +3912,6 @@ if
|
||||
}
|
||||
}
|
||||
//-----------
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
else if (cKey == Global::Keys[k_PantFrontDown]) // Winger 160204:
|
||||
// opuszczanie prz. patyka
|
||||
{
|
||||
@@ -4118,7 +4252,8 @@ if
|
||||
else if ((cKey == Global::Keys[k_StLinOff]) && (!Global::shiftState) && (!Global::ctrlState)) // Winger 110904: wylacznik st.
|
||||
// liniowych
|
||||
{
|
||||
if ((mvControlled->TrainType != dt_EZT) && (mvControlled->TrainType != dt_EP05) &&
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( ( mvControlled->TrainType != dt_EZT ) && ( mvControlled->TrainType != dt_EP05 ) &&
|
||||
(mvControlled->TrainType != dt_ET40))
|
||||
{
|
||||
ggStLinOffButton.PutValue(1); // Ra: było Fuse...
|
||||
@@ -4130,6 +4265,7 @@ if
|
||||
play_sound( dsbRelay );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (mvControlled->TrainType == dt_EZT)
|
||||
{
|
||||
if (mvControlled->Signalling == true)
|
||||
@@ -4268,7 +4404,8 @@ if
|
||||
|
||||
void TTrain::OnKeyUp(int cKey)
|
||||
{ // zwolnienie klawisza
|
||||
if (Global::shiftState)
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( Global::shiftState )
|
||||
{ // wciśnięty [Shift]
|
||||
}
|
||||
else
|
||||
@@ -4280,6 +4417,7 @@ void TTrain::OnKeyUp(int cKey)
|
||||
ggStLinOffButton.PutValue(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// cab movement update, fixed step part
|
||||
@@ -5347,7 +5485,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// - pokićkał ktoś?
|
||||
scp = mvControlled->RList[mvControlled->MainCtrlPos].ScndAct;
|
||||
scp = (scp == 255 ? 0 : scp); // Ra: whatta hella is this?
|
||||
if ((mvControlled->ScndCtrlPos > 0) || (mvControlled->ScndInMain) && (scp > 0))
|
||||
if ((mvControlled->ScndCtrlPos > 0) || (mvControlled->ScndInMain != 0) && (scp > 0))
|
||||
{ // boczniki pojedynczo
|
||||
btLampkaBocznik1.TurnOn();
|
||||
btLampkaBocznik2.Turn(mvControlled->ScndCtrlPos > 1);
|
||||
@@ -6305,6 +6443,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (DynamicObject->Mechanik ? !DynamicObject->Mechanik->AIControllFlag :
|
||||
false) // nie wyłączać, gdy AI
|
||||
mvControlled->PantCompFlag = false; // wyłączona, gdy nie trzymamy klawisza
|
||||
|
||||
if (Console::Pressed(Global::Keys[k_Univ2]))
|
||||
{
|
||||
if (!DebugModeFlag)
|
||||
@@ -6317,6 +6456,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
// hunter-091012: zrobione z uwzglednieniem przelacznika swiatla
|
||||
if (Console::Pressed(Global::Keys[k_Univ3]))
|
||||
{
|
||||
@@ -6367,47 +6507,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hunter-091012: to w ogole jest bez sensu i tak namodzone ze nie wiadomo o
|
||||
// co chodzi - zakomentowalem i zrobilem po swojemu
|
||||
/*
|
||||
if ( Console::Pressed(Global::Keys[k_Univ3]) )
|
||||
{
|
||||
if (ggUniversal3Button.SubModel)
|
||||
|
||||
|
||||
if (Global::ctrlState)
|
||||
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
||||
//tutaj jest bez sensu, trzeba reagować na wciskanie klawisza!
|
||||
if (Global::shiftState)
|
||||
{//zapalenie
|
||||
if (iCabLightFlag<2) ++iCabLightFlag;
|
||||
}
|
||||
else
|
||||
{//gaszenie
|
||||
if (iCabLightFlag) --iCabLightFlag;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{//bez [Ctrl] przełączamy cośtem
|
||||
if (Global::shiftState)
|
||||
{
|
||||
ggUniversal3Button.PutValue(1); //hunter-131211: z UpdateValue na
|
||||
PutValue - by zachowywal sie jak pozostale przelaczniki
|
||||
if (btLampkaUniversal3.Active())
|
||||
LampkaUniversal3_st=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ggUniversal3Button.PutValue(0); //hunter-131211: z UpdateValue na
|
||||
PutValue - by zachowywal sie jak pozostale przelaczniki
|
||||
if (btLampkaUniversal3.Active())
|
||||
LampkaUniversal3_st=false;
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
#endif
|
||||
// ABu030405 obsluga lampki uniwersalnej:
|
||||
if (btLampkaUniversal3.Active()) // w ogóle jest
|
||||
if (LampkaUniversal3_st) // załączona
|
||||
@@ -6428,28 +6528,12 @@ bool TTrain::Update( double const Deltatime )
|
||||
else
|
||||
btLampkaUniversal3.TurnOff();
|
||||
|
||||
/*
|
||||
if (Console::Pressed(Global::Keys[k_Univ4]))
|
||||
{
|
||||
if (ggUniversal4Button.SubModel)
|
||||
if (Global::shiftState)
|
||||
{
|
||||
ActiveUniversal4=true;
|
||||
//ggUniversal4Button.UpdateValue(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveUniversal4=false;
|
||||
//ggUniversal4Button.UpdateValue(0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
// hunter-091012: przepisanie univ4 i zrobione z uwzglednieniem przelacznika
|
||||
// swiatla
|
||||
if (Console::Pressed(Global::Keys[k_Univ4]))
|
||||
{
|
||||
if (Global::shiftState)
|
||||
if( Global::shiftState )
|
||||
{
|
||||
if (Global::ctrlState)
|
||||
{
|
||||
@@ -6484,7 +6568,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
// Odskakiwanie hamulce EP
|
||||
if ((!Console::Pressed(Global::Keys[k_DecBrakeLevel])) &&
|
||||
(!Console::Pressed(Global::Keys[k_WaveBrake])) && (mvOccupied->BrakeCtrlPos == -1) &&
|
||||
@@ -7754,6 +7837,17 @@ void TTrain::set_cab_controls() {
|
||||
ggRightEndLightButton.PutValue( 1.0 );
|
||||
}
|
||||
|
||||
// cab lights
|
||||
if( true == bCabLight ) {
|
||||
ggCabLightButton.PutValue( 1.0 );
|
||||
}
|
||||
if( true == bCabLightDim ) {
|
||||
ggCabLightDimButton.PutValue( 1.0 );
|
||||
}
|
||||
if( true == LampkaUniversal3_st ) {
|
||||
ggUniversal3Button.PutValue( 1.0 );
|
||||
}
|
||||
|
||||
// doors
|
||||
// NOTE: we're relying on the cab models to have switches reversed for the rear cab(?)
|
||||
ggDoorLeftButton.PutValue( mvOccupied->DoorLeftOpened ? 1.0 : 0.0 );
|
||||
|
||||
4
Train.h
4
Train.h
@@ -146,6 +146,7 @@ class TTrain
|
||||
static void OnCommand_linebreakertoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_convertertoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_compressortoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_motorconnectorsopen( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_heatingtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command );
|
||||
@@ -158,6 +159,9 @@ class TTrain
|
||||
static void OnCommand_headlighttogglerearupper( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_redmarkertogglerearleft( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_redmarkertogglerearright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_interiorlighttoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_interiorlightdimtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_instrumentlighttoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doortoggleleft( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doortoggleright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_departureannounce( TTrain *Train, command_data const &Command );
|
||||
|
||||
@@ -112,8 +112,15 @@ const int k_ProgramHelp = 48;
|
||||
{ "redmarkertogglerearright", command_target::vehicle },
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
*/
|
||||
{ "motorconnectorsopen", command_target::vehicle },
|
||||
/*
|
||||
const int k_CurrentNext = 65;
|
||||
*/
|
||||
{ "interiorlighttoggle", command_target::vehicle },
|
||||
{ "interiorlightdimtoggle", command_target::vehicle },
|
||||
{ "instrumentlighttoggle", command_target::vehicle },
|
||||
/*
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
|
||||
@@ -104,8 +104,15 @@ const int k_ProgramHelp = 48;
|
||||
redmarkertogglerearright,
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
*/
|
||||
motorconnectorsopen,
|
||||
/*
|
||||
const int k_CurrentNext = 65;
|
||||
*/
|
||||
interiorlighttoggle,
|
||||
interiorlightdimtoggle,
|
||||
instrumentlighttoggle,
|
||||
/*
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
|
||||
@@ -92,112 +92,112 @@ void
|
||||
keyboard_input::default_bindings() {
|
||||
|
||||
m_commands = {
|
||||
//"mastercontrollerincrease"
|
||||
// mastercontrollerincrease
|
||||
{ GLFW_KEY_KP_ADD },
|
||||
//"mastercontrollerincreasefast"
|
||||
// mastercontrollerincreasefast
|
||||
{ GLFW_KEY_KP_ADD | keymodifier::shift },
|
||||
// "mastercontrollerdecrease"
|
||||
// mastercontrollerdecrease
|
||||
{ GLFW_KEY_KP_SUBTRACT },
|
||||
// "mastercontrollerdecreasefast"
|
||||
// mastercontrollerdecreasefast
|
||||
{ GLFW_KEY_KP_SUBTRACT | keymodifier::shift },
|
||||
// "secondcontrollerincrease"
|
||||
// secondcontrollerincrease
|
||||
{ GLFW_KEY_KP_DIVIDE },
|
||||
// "secondcontrollerincreasefast"
|
||||
// secondcontrollerincreasefast
|
||||
{ GLFW_KEY_KP_DIVIDE | keymodifier::shift },
|
||||
// "secondcontrollerdecrease"
|
||||
// secondcontrollerdecrease
|
||||
{ GLFW_KEY_KP_MULTIPLY },
|
||||
// "secondcontrollerdecreasefast"
|
||||
// secondcontrollerdecreasefast
|
||||
{ GLFW_KEY_KP_MULTIPLY | keymodifier::shift },
|
||||
// "independentbrakeincrease"
|
||||
// independentbrakeincrease
|
||||
{ GLFW_KEY_KP_1 },
|
||||
// "independentbrakeincreasefast"
|
||||
// independentbrakeincreasefast
|
||||
{ GLFW_KEY_KP_1 | keymodifier::shift },
|
||||
// "independentbrakedecrease"
|
||||
// independentbrakedecrease
|
||||
{ GLFW_KEY_KP_7 },
|
||||
// "independentbrakedecreasefast"
|
||||
// independentbrakedecreasefast
|
||||
{ GLFW_KEY_KP_7 | keymodifier::shift },
|
||||
// "independentbrakebailoff"
|
||||
// independentbrakebailoff
|
||||
{ GLFW_KEY_KP_4 },
|
||||
// "trainbrakeincrease"
|
||||
// trainbrakeincrease
|
||||
{ GLFW_KEY_KP_3 },
|
||||
// "trainbrakedecrease"
|
||||
// trainbrakedecrease
|
||||
{ GLFW_KEY_KP_9 },
|
||||
// "trainbrakecharging"
|
||||
// trainbrakecharging
|
||||
{ GLFW_KEY_KP_DECIMAL },
|
||||
// "trainbrakerelease"
|
||||
// trainbrakerelease
|
||||
{ GLFW_KEY_KP_6 },
|
||||
// "trainbrakefirstservice"
|
||||
// trainbrakefirstservice
|
||||
{ GLFW_KEY_KP_8 },
|
||||
// "trainbrakeservice"
|
||||
// trainbrakeservice
|
||||
{ GLFW_KEY_KP_5 },
|
||||
// "trainbrakefullservice"
|
||||
// trainbrakefullservice
|
||||
{ GLFW_KEY_KP_2 },
|
||||
// "trainbrakeemergency"
|
||||
// trainbrakeemergency
|
||||
{ GLFW_KEY_KP_0 },
|
||||
/*
|
||||
const int k_AntiSlipping = 21;
|
||||
const int k_Sand = 22;
|
||||
*/
|
||||
// "reverserincrease"
|
||||
// reverserincrease
|
||||
{ GLFW_KEY_D },
|
||||
// "reverserdecrease"
|
||||
// reverserdecrease
|
||||
{ GLFW_KEY_R },
|
||||
// "linebreakertoggle"
|
||||
// linebreakertoggle
|
||||
{ GLFW_KEY_M },
|
||||
/*
|
||||
const int k_Fuse = 26;
|
||||
*/
|
||||
// "convertertoggle"
|
||||
// convertertoggle
|
||||
{ GLFW_KEY_X },
|
||||
// "compressortoggle"
|
||||
// compressortoggle
|
||||
{ GLFW_KEY_C },
|
||||
// "motoroverloadrelaythresholdtoggle"
|
||||
// motoroverloadrelaythresholdtoggle
|
||||
{ GLFW_KEY_F },
|
||||
// "notchingrelaytoggle"
|
||||
// notchingrelaytoggle
|
||||
{ GLFW_KEY_G },
|
||||
// "epbrakecontroltoggle"
|
||||
// epbrakecontroltoggle
|
||||
{ GLFW_KEY_Z | keymodifier::control },
|
||||
// "brakeactingspeedincrease"
|
||||
// brakeactingspeedincrease
|
||||
{ GLFW_KEY_B | keymodifier::shift },
|
||||
// "brakeactingspeeddecrease"
|
||||
// brakeactingspeeddecrease
|
||||
{ GLFW_KEY_B },
|
||||
/*
|
||||
const int k_BrakeProfile = 31;
|
||||
*/
|
||||
// "alerteracknowledge"
|
||||
// alerteracknowledge
|
||||
{ GLFW_KEY_SPACE },
|
||||
/*
|
||||
const int k_Horn = 33;
|
||||
const int k_Horn2 = 34;
|
||||
const int k_FailedEngineCutOff = 35;
|
||||
*/
|
||||
// "viewturn"
|
||||
// viewturn
|
||||
{ -1 },
|
||||
// "movevector"
|
||||
// movevector
|
||||
{ -1 },
|
||||
// "moveleft"
|
||||
// moveleft
|
||||
{ GLFW_KEY_LEFT },
|
||||
// "moveright"
|
||||
// moveright
|
||||
{ GLFW_KEY_RIGHT },
|
||||
// "moveforward"
|
||||
// moveforward
|
||||
{ GLFW_KEY_UP },
|
||||
// "moveback"
|
||||
// moveback
|
||||
{ GLFW_KEY_DOWN },
|
||||
// "moveup"
|
||||
// moveup
|
||||
{ GLFW_KEY_PAGE_UP },
|
||||
// "movedown"
|
||||
// movedown
|
||||
{ GLFW_KEY_PAGE_DOWN },
|
||||
// "moveleftfast"
|
||||
// moveleftfast
|
||||
{ -1 },
|
||||
// "moverightfast"
|
||||
// moverightfast
|
||||
{ -1 },
|
||||
// "moveforwardfast"
|
||||
// moveforwardfast
|
||||
{ -1 },
|
||||
// "movebackfast"
|
||||
// movebackfast
|
||||
{ -1 },
|
||||
// "moveupfast"
|
||||
// moveupfast
|
||||
{ -1 },
|
||||
// "movedownfast"
|
||||
// movedownfast
|
||||
{ -1 },
|
||||
/*
|
||||
const int k_CabForward = 42;
|
||||
@@ -208,49 +208,60 @@ const int k_ProgramQuit = 46;
|
||||
// const int k_ProgramPause= 47;
|
||||
const int k_ProgramHelp = 48;
|
||||
*/
|
||||
// "doortoggleleft"
|
||||
// doortoggleleft
|
||||
{ GLFW_KEY_COMMA },
|
||||
// "doortoggleright"
|
||||
// doortoggleright
|
||||
{ GLFW_KEY_PERIOD },
|
||||
// "departureannounce"
|
||||
// departureannounce
|
||||
{ GLFW_KEY_SLASH },
|
||||
// "doorlocktoggle"
|
||||
// doorlocktoggle
|
||||
{ GLFW_KEY_S | keymodifier::shift },
|
||||
// "pantographtogglefront"
|
||||
// pantographtogglefront
|
||||
{ GLFW_KEY_P },
|
||||
// "pantographtogglerear"
|
||||
// pantographtogglerear
|
||||
{ GLFW_KEY_O },
|
||||
// "pantographlowerall"
|
||||
// pantographlowerall
|
||||
{ GLFW_KEY_P | keymodifier::control },
|
||||
// "heatingtoggle"
|
||||
// heatingtoggle
|
||||
{ GLFW_KEY_H },
|
||||
/*
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
// "headlighttoggleleft"
|
||||
// headlighttoggleleft
|
||||
{ GLFW_KEY_Y },
|
||||
// "headlighttoggleright"
|
||||
// headlighttoggleright
|
||||
{ GLFW_KEY_I },
|
||||
// "headlighttoggleupper"
|
||||
// headlighttoggleupper
|
||||
{ GLFW_KEY_U },
|
||||
// "redmarkertoggleleft"
|
||||
// redmarkertoggleleft
|
||||
{ GLFW_KEY_Y | keymodifier::shift },
|
||||
// "redmarkertoggleright"
|
||||
// redmarkertoggleright
|
||||
{ GLFW_KEY_I | keymodifier::shift },
|
||||
// "headlighttogglerearleft"
|
||||
// headlighttogglerearleft
|
||||
{ GLFW_KEY_Y | keymodifier::control },
|
||||
// "headlighttogglerearright"
|
||||
// headlighttogglerearright
|
||||
{ GLFW_KEY_I | keymodifier::control },
|
||||
// "headlighttogglerearupper"
|
||||
// headlighttogglerearupper
|
||||
{ GLFW_KEY_U | keymodifier::control },
|
||||
// "redmarkertogglerearleft"
|
||||
// redmarkertogglerearleft
|
||||
{ GLFW_KEY_Y | keymodifier::control | keymodifier::shift },
|
||||
// "redmarkertogglerearright"
|
||||
// redmarkertogglerearright
|
||||
{ GLFW_KEY_I | keymodifier::control | keymodifier::shift },
|
||||
/*
|
||||
const int k_SmallCompressor = 63;
|
||||
const int k_StLinOff = 64;
|
||||
*/
|
||||
// motorconnectorsopen
|
||||
{ GLFW_KEY_L },
|
||||
/*
|
||||
const int k_CurrentNext = 65;
|
||||
*/
|
||||
// interiorlighttoggle
|
||||
{ GLFW_KEY_APOSTROPHE },
|
||||
// interiorlightdimtoggle
|
||||
{ GLFW_KEY_APOSTROPHE | keymodifier::control },
|
||||
// instrumentlighttoggle
|
||||
{ GLFW_KEY_SEMICOLON },
|
||||
/*
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
|
||||
@@ -319,7 +319,7 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
||||
|
||||
// setup
|
||||
TSubModel::iInstance = ( size_t )this; //żeby nie robić cudzych animacji
|
||||
double squaredistance = SquareMagnitude( Global::pCameraPosition - Dynamic->vPosition ) / Global::ZoomFactor;
|
||||
double squaredistance = SquareMagnitude( ( Global::pCameraPosition - Dynamic->vPosition ) / Global::ZoomFactor );
|
||||
Dynamic->ABuLittleUpdate( squaredistance ); // ustawianie zmiennych submodeli dla wspólnego modelu
|
||||
|
||||
::glPushMatrix();
|
||||
@@ -591,7 +591,7 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
||||
|
||||
// setup
|
||||
TSubModel::iInstance = ( size_t )this; //żeby nie robić cudzych animacji
|
||||
double squaredistance = SquareMagnitude( Global::pCameraPosition - Dynamic->vPosition ) / Global::ZoomFactor;
|
||||
double squaredistance = SquareMagnitude( ( Global::pCameraPosition - Dynamic->vPosition ) / Global::ZoomFactor );
|
||||
Dynamic->ABuLittleUpdate( squaredistance ); // ustawianie zmiennych submodeli dla wspólnego modelu
|
||||
|
||||
::glPushMatrix();
|
||||
|
||||
Reference in New Issue
Block a user