From 2b5a8288fe3e67e8ac7cd4e2c76071655b89c418 Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Mon, 21 Aug 2017 18:32:34 +0200 Subject: [PATCH 1/4] maintenance: removed deprecated render code --- AnimModel.cpp | 17 +------------ AnimModel.h | 7 ------ Driver.cpp | 19 +++------------ Driver.h | 2 +- Model3d.cpp | 66 --------------------------------------------------- renderer.cpp | 1 - sky.cpp | 21 ---------------- sky.h | 3 --- stars.cpp | 18 -------------- stars.h | 3 --- 10 files changed, 5 insertions(+), 152 deletions(-) diff --git a/AnimModel.cpp b/AnimModel.cpp index 64eab101..778b4704 100644 --- a/AnimModel.cpp +++ b/AnimModel.cpp @@ -606,23 +606,8 @@ int TAnimModel::Flags() return i; }; -//----------------------------------------------------------------------------- -// 2011-03-16 funkcje renderowania z możliwością pochylania obiektów -//----------------------------------------------------------------------------- -#ifdef EU07_USE_OLD_RENDERCODE -void TAnimModel::Render( vector3 const &Position ) { - RaAnimate(); // jednorazowe przeliczenie animacji - RaPrepare(); - if( pModel ) // renderowanie rekurencyjne submodeli - GfxRenderer.Render( pModel, Material(), Position, vAngle ); -}; -void TAnimModel::RenderAlpha( vector3 const &Position ) { - RaPrepare(); - if( pModel ) // renderowanie rekurencyjne submodeli - GfxRenderer.Render_Alpha( pModel, Material(), Position, vAngle ); -}; -#endif //--------------------------------------------------------------------------- + bool TAnimModel::TerrainLoaded() { // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy return (this ? pModel != NULL : false); diff --git a/AnimModel.h b/AnimModel.h index cd5018ef..a542fe50 100644 --- a/AnimModel.h +++ b/AnimModel.h @@ -164,10 +164,6 @@ class TAnimModel { bool Load(cParser *parser, bool ter = false); TAnimContainer * AddContainer(char *pName); TAnimContainer * GetContainer(char *pName); -#ifdef EU07_USE_OLD_RENDERCODE - void Render( vector3 const &Position ); - void RenderAlpha( vector3 const &Position ); -#endif int Flags(); void RaAnglesSet(double a, double b, double c) { @@ -178,9 +174,6 @@ class TAnimModel { bool TerrainLoaded(); int TerrainCount(); TSubModel * TerrainSquare(int n); -#ifdef EU07_USE_OLD_RENDERCODE - void TerrainRenderVBO(int n); -#endif void AnimationVND(void *pData, double a, double b, double c, double d); void LightSet(int n, float v); static void AnimUpdate(double dt); diff --git a/Driver.cpp b/Driver.cpp index 7b653b34..177a280b 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -187,7 +187,7 @@ void TSpeedPos::CommandCheck() } }; -bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len, TOrders const &Orders ) +bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len ) { // przeliczenie odległości od punktu (*p), w kierunku (*dir), zaczynając od pojazdu // dla kolejnych pozycji podawane są współrzędne poprzedniego obiektu w (*p) vector3 v = vPos - *p; // wektor od poprzedniego obiektu (albo pojazdu) do punktu zmiany @@ -253,19 +253,6 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len, TOrders const &Ord if( trTrack->iCategoryFlag & 1 ) { // railways -/* - if( ( iFlags & spElapsed ) == 0 ) { - // jeśli nie wjechał - // TODO: remove this block when the detection of vehicles ahead is working properly - if( false == trTrack->Dynamics.empty() ) { - // to zabronić wjazdu (chyba że ten z przodu też jedzie prosto) - fVelNext = 25.0; // can't force full stop as it can prevent vehicles from leaving the track. slow down should be enough to ensure slow enough movement to stop - if( Global::iWriteLogEnabled & 8 ) { - WriteLog( "Track " + trTrack->NameGet() + " is occupied. Vehicle count: " + std::to_string( trTrack->Dynamics.size() ) + ", distance: " + std::to_string( fDist ) + " m." ); - } - } - } -*/ if( iFlags & spSwitch ) { // jeśli odcinek zmienny if( ( ( trTrack->GetSwitchState() & 1 ) != 0 ) != @@ -701,7 +688,7 @@ void TController::TableCheck(double fDistance) { // aktualizacja rekordów z wyjątkiem ostatniego if (sSpeedTable[i].iFlags & spEnabled) // jeśli pozycja istotna { - if (sSpeedTable[i].Update(&pos, &dir, len, OrderCurrentGet())) + if(sSpeedTable[i].Update( &pos, &dir, len )) { if( Global::iWriteLogEnabled & 8 ) { WriteLog( "Speed table for " + OwnerName() + " detected switch change at " + sSpeedTable[ i ].trTrack->NameGet() + " (generating fresh trace)" ); @@ -744,7 +731,7 @@ void TController::TableCheck(double fDistance) } } } - sSpeedTable[iLast].Update(&pos, &dir, len, OrderCurrentGet()); // aktualizacja ostatniego + sSpeedTable[iLast].Update( &pos, &dir, len ); // aktualizacja ostatniego // WriteLog("TableCheck: Upate last track. Dist=" + AnsiString(sSpeedTable[iLast].fDist)); if( sSpeedTable[ iLast ].fDist < fDistance ) { TableTraceRoute( fDistance, pVehicles[ 1 ] ); // doskanowanie dalszego odcinka diff --git a/Driver.h b/Driver.h index 68d44633..2079a8e0 100644 --- a/Driver.h +++ b/Driver.h @@ -144,7 +144,7 @@ class TSpeedPos public: void Clear(); - bool Update(vector3 *p, vector3 *dir, double &len, TOrders const &Orders ); + bool Update(vector3 *p, vector3 *dir, double &len ); bool Set(TEvent *e, double d, TOrders order = Wait_for_orders); void Set(TTrack *t, double d, int f); std::string TableText(); diff --git a/Model3d.cpp b/Model3d.cpp index 1eea864a..12862a9d 100644 --- a/Model3d.cpp +++ b/Model3d.cpp @@ -645,72 +645,6 @@ basic_vertex *TSubModel::TrianglePtr(int tex, int pos, glm::vec3 const &Ambient, return s->Vertices + pos; // wskaźnik na wolne miejsce w tabeli wierzchołków }; */ -#ifdef EU07_USE_OLD_RENDERCODE -void TSubModel::DisplayLists() -{ // utworznie po jednej skompilowanej liście dla - // każdego submodelu - if (Global::bUseVBO) - return; // Ra: przy VBO to się nie przyda - if (eType < TP_ROTATOR) - { - if (iNumVerts > 0) - { - uiDisplayList = glGenLists(1); - glNewList(uiDisplayList, GL_COMPILE); -#ifdef USE_VERTEX_ARRAYS - // ShaXbee-121209: przekazywanie wierzcholkow hurtem - glVertexPointer(3, GL_DOUBLE, sizeof(GLVERTEX), &Vertices[0].Point.x); - glNormalPointer(GL_DOUBLE, sizeof(GLVERTEX), &Vertices[0].Normal.x); - glTexCoordPointer(2, GL_FLOAT, sizeof(GLVERTEX), &Vertices[0].tu); - glDrawArrays(eType, 0, iNumVerts); -#else - glBegin(eType); - for (int i = 0; i < iNumVerts; i++) - { - /* - glNormal3dv(&Vertices[i].Normal.x); - glTexCoord2f(Vertices[i].tu,Vertices[i].tv); - glVertex3dv(&Vertices[i].Point.x); - */ - glNormal3fv(glm::value_ptr(Vertices[i].normal)); - glTexCoord2fv(glm::value_ptr(Vertices[i].material)); - glVertex3fv(glm::value_ptr(Vertices[i].position)); - }; - glEnd(); -#endif - glEndList(); - } - } - else if (eType == TP_FREESPOTLIGHT) - { - uiDisplayList = glGenLists(1); - glNewList(uiDisplayList, GL_COMPILE); - glBegin(GL_POINTS); - glVertex3f( 0.0f, 0.0f, -0.05f ); // shift point towards the viewer, to avoid z-fighting with the light polygons - glEnd(); - glEndList(); - } - else if (eType == TP_STARS) - { // punkty świecące dookólnie - uiDisplayList = glGenLists(1); - glNewList(uiDisplayList, GL_COMPILE); - glBegin(GL_POINTS); - for (int i = 0; i < iNumVerts; ++i) - { - glColor3fv(glm::value_ptr(Vertices[i].normal)); - glVertex3fv(glm::value_ptr(Vertices[i].position)); - }; - glEnd(); - glEndList(); - } - // SafeDeleteArray(Vertices); //przy VBO muszą zostać do załadowania całego - // modelu - if (Child) - Child->DisplayLists(); - if (Next) - Next->DisplayLists(); -}; -#endif void TSubModel::InitialRotate(bool doit) { // konwersja układu współrzędnych na zgodny ze scenerią diff --git a/renderer.cpp b/renderer.cpp index e741a261..39e4cd5c 100644 --- a/renderer.cpp +++ b/renderer.cpp @@ -250,7 +250,6 @@ opengl_renderer::Init( GLFWwindow *Window ) { } else { ErrorLog( "Shadows framebuffer setup failed" ); - m_framebuffersupport = false; Global::RenderShadows = false; } ::glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch back to primary render target for now diff --git a/sky.cpp b/sky.cpp index 86aba2fe..7d6ee679 100644 --- a/sky.cpp +++ b/sky.cpp @@ -24,25 +24,4 @@ void TSky::Init() { } }; -#ifdef EU07_USE_OLD_RENDERCODE -void TSky::Render( glm::vec3 const &Tint ) -{ - if (mdCloud) - { // jeśli jest model nieba - // setup - ::glEnable( GL_LIGHTING ); - GfxRenderer.Disable_Lights(); - ::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr(Tint) ); - // render - GfxRenderer.Render( mdCloud, nullptr, 100.0 ); - GfxRenderer.Render_Alpha( mdCloud, nullptr, 100.0 ); - // post-render cleanup - GLfloat noambient[] = { 0.0f, 0.0f, 0.0f, 1.0f }; - ::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, noambient ); - ::glEnable( GL_LIGHT0 ); // other lights will be enabled during lights update - ::glDisable( GL_LIGHTING ); - } -}; -#endif - //--------------------------------------------------------------------------- diff --git a/sky.h b/sky.h index 4b544e0e..ca48434e 100644 --- a/sky.h +++ b/sky.h @@ -21,9 +21,6 @@ private: public: void Init(); -#ifdef EU07_USE_OLD_RENDERCODE - void Render( glm::vec3 const &Tint = glm::vec3(1.0f, 1.0f, 1.0f) ); -#endif }; //--------------------------------------------------------------------------- diff --git a/stars.cpp b/stars.cpp index ebbd84a6..b7c9ef79 100644 --- a/stars.cpp +++ b/stars.cpp @@ -12,21 +12,3 @@ cStars::init() { m_stars = TModelsManager::GetModel( "models\\skydome_stars.t3d", false ); } -#ifdef EU07_USE_OLD_RENDERCODE -void -cStars::render() { - // setup - ::glPushMatrix(); - - ::glRotatef( m_latitude, 1.0f, 0.0f, 0.0f ); // ustawienie osi OY na północ - ::glRotatef( -std::fmod( (float)Global::fTimeAngleDeg, 360.0f ), 0.0f, 1.0f, 0.0f ); // obrót dobowy osi OX - - ::glPointSize( 2.0f ); - // render - GfxRenderer.Render( &m_stars, nullptr, 1.0 ); - // post-render cleanup - ::glPointSize( 3.0f ); - - ::glPopMatrix(); -} -#endif diff --git a/stars.h b/stars.h index dc579ff5..7541bf77 100644 --- a/stars.h +++ b/stars.h @@ -15,9 +15,6 @@ public: // methods: void init(); -#ifdef EU07_USE_OLD_RENDERCODE - void render(); -#endif // constructors: // deconstructor: From c3975e96a02b60a824271473ea387d71ee932bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Sun, 20 Aug 2017 20:22:04 +0200 Subject: [PATCH 2/4] AI: Better acceleration with ElectricSeriesMotor - motor current is set acording to ahdesion and fuse limit --- Driver.cpp | 139 +++++++++++++++++++++++++++++++++++------------------ Driver.h | 1 + 2 files changed, 94 insertions(+), 46 deletions(-) diff --git a/Driver.cpp b/Driver.cpp index 177a280b..dd7a5004 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -1719,7 +1719,41 @@ void TController::AutoRewident() fAccThreshold = -fBrake_a0[BrakeAccTableSize] - 1 * fBrake_a1[BrakeAccTableSize]; fBrakeReaction = 1.00 + fLength*0.005; } -}; +} + +double TController::ESMVelocity(bool Main) +{ + double fCurrentCoeff = 0.9; + double fFrictionCoeff = 0.85; + double ESMVel = 9999; + int MCPN = mvControlling->MainCtrlActualPos; + int SCPN = mvControlling->ScndCtrlActualPos; + if (Main) + MCPN += 1; + else + SCPN += 1; + if ((mvControlling->RList[MCPN].ScndAct < 255)&&(mvControlling->ScndCtrlActualPos==0)) + SCPN = mvControlling->RList[MCPN].ScndAct; + double FrictionMax = mvControlling->Mass*9.81*mvControlling->Adhesive(mvControlling->RunningTrack.friction)*fFrictionCoeff; + double IF = mvControlling->Imax; + double MS = 0; + double Fmax = 0; + for (int i = 0; i < 5; i++) + { + MS = mvControlling->MomentumF(IF, IF, SCPN); + Fmax = MS * mvControlling->RList[MCPN].Bn*mvControlling->RList[MCPN].Mn * 2 / mvControlling->WheelDiameter * mvControlling->Transmision.Ratio; + IF = 0.5*IF*(1 + FrictionMax/Fmax); + } + IF = std::min(IF, mvControlling->Imax*fCurrentCoeff); + double R = mvControlling->RList[MCPN].R + mvControlling->CircuitRes + mvControlling->RList[MCPN].Mn*mvControlling->WindingRes; + double pole = mvControlling->MotorParam[SCPN].fi * + std::max(abs(IF) / (abs(IF) + mvControlling->MotorParam[SCPN].Isat) - mvControlling->MotorParam[SCPN].fi0, 0.0); + double Us = abs(mvControlling->Voltage) - IF*R; + double ns = std::max(0.0, Us / (pole*mvControlling->RList[MCPN].Mn)); + ESMVel = ns * mvControlling->WheelDiameter*M_PI*3.6/mvControlling->Transmision.Ratio; + return ESMVel; +} +; int TController::CheckDirection() { @@ -2469,51 +2503,64 @@ bool TController::IncSpeed() (mvControlling->StLinFlag)) // youBy polecił dodać 2012-09-08 v367 // na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe // (zgaśnie DelayCtrlFlag) - if (Ready || (iDrivigFlags & movePress)) - if (fabs(mvControlling->Im) < - (fReady < 0.4 ? mvControlling->Imin : mvControlling->IminLo)) - { // Ra: wywalał nadmiarowy, bo Im może być ujemne; jak nie odhamowany, to nie - // przesadzać z prądem - if ((mvOccupied->Vel <= 30) || - (mvControlling->Imax > mvControlling->ImaxLo) || - (fVoltage + fVoltage < - mvControlling->EnginePowerSource.CollectorParameters.MinV + - mvControlling->EnginePowerSource.CollectorParameters.MaxV)) - { // bocznik na szeregowej przy ciezkich bruttach albo przy wysokim rozruchu - // pod górę albo przy niskim napięciu - if (mvControlling->MainCtrlPos ? - mvControlling->RList[mvControlling->MainCtrlPos].R > 0.0 : - true) // oporowa - { - OK = (mvControlling->DelayCtrlFlag ? - true : - mvControlling->IncMainCtrl(1)); // kręcimy nastawnik jazdy - if ((OK) && - (mvControlling->MainCtrlPos == - 1)) // czekaj na 1 pozycji, zanim się nie włączą liniowe - iDrivigFlags |= moveIncSpeed; - else - iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi czekania - } - else // jeśli bezoporowa (z wyjątekiem 0) - OK = false; // to dać bocznik - } - else - { // przekroczone 30km/h, można wejść na jazdę równoległą - if (mvControlling->ScndCtrlPos) // jeśli ustawiony bocznik - if (mvControlling->MainCtrlPos < - mvControlling->MainCtrlPosNo - 1) // a nie jest ostatnia pozycja - mvControlling->DecScndCtrl(2); // to bocznik na zero po chamsku - // (ktoś miał to poprawić...) - OK = mvControlling->IncMainCtrl(1); - } - if ((mvControlling->MainCtrlPos > 2) && - (mvControlling->Im == 0)) // brak prądu na dalszych pozycjach - Need_TryAgain = true; // nie załączona lokomotywa albo wywalił - // nadmiarowy - else if (!OK) // nie da się wrzucić kolejnej pozycji - OK = mvControlling->IncScndCtrl(1); // to dać bocznik - } + if (Ready || (iDrivigFlags & movePress)) + { + bool scndctrl = ((mvOccupied->Vel <= 30) || + (mvControlling->Imax > mvControlling->ImaxLo) || + (fVoltage + fVoltage < + mvControlling->EnginePowerSource.CollectorParameters.MinV + + mvControlling->EnginePowerSource.CollectorParameters.MaxV) || + (mvControlling->MainCtrlPos == mvControlling->MainCtrlPosNo)); + scndctrl = ((scndctrl) && (mvControlling->MainCtrlPos > 1) && (mvControlling->RList[mvControlling->MainCtrlActualPos].R < 0.01)&& (mvControlling->ScndCtrlPos != mvControlling->ScndCtrlPosNo)); + double Vs = 99999; + if((mvControlling->MainCtrlPos != mvControlling->MainCtrlPosNo)||(mvControlling->ScndCtrlPos!=mvControlling->ScndCtrlPosNo)) + Vs = ESMVelocity(!scndctrl); + + if ((fabs(mvControlling->Im) < + (fReady < 0.4 ? mvControlling->Imin : mvControlling->IminLo))||(mvControlling->Vel>Vs)) + { // Ra: wywalał nadmiarowy, bo Im może być ujemne; jak nie odhamowany, to nie + // przesadzać z prądem + if ((mvOccupied->Vel <= 30) || + (mvControlling->Imax > mvControlling->ImaxLo) || + (fVoltage + fVoltage < + mvControlling->EnginePowerSource.CollectorParameters.MinV + + mvControlling->EnginePowerSource.CollectorParameters.MaxV)) + { // bocznik na szeregowej przy ciezkich bruttach albo przy wysokim rozruchu + // pod górę albo przy niskim napięciu + if (mvControlling->MainCtrlPos ? + mvControlling->RList[mvControlling->MainCtrlPos].R > 0.0 : + true) // oporowa + { + OK = (mvControlling->DelayCtrlFlag ? + true : + mvControlling->IncMainCtrl(1)); // kręcimy nastawnik jazdy + if ((OK) && + (mvControlling->MainCtrlPos == + 1)) // czekaj na 1 pozycji, zanim się nie włączą liniowe + iDrivigFlags |= moveIncSpeed; + else + iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi czekania + } + else // jeśli bezoporowa (z wyjątekiem 0) + OK = false; // to dać bocznik + } + else + { // przekroczone 30km/h, można wejść na jazdę równoległą + if (mvControlling->ScndCtrlPos) // jeśli ustawiony bocznik + if (mvControlling->MainCtrlPos < + mvControlling->MainCtrlPosNo - 1) // a nie jest ostatnia pozycja + mvControlling->DecScndCtrl(2); // to bocznik na zero po chamsku + // (ktoś miał to poprawić...) + OK = mvControlling->IncMainCtrl(1); + } + if ((mvControlling->MainCtrlPos > 2) && + (mvControlling->Im == 0)) // brak prądu na dalszych pozycjach + Need_TryAgain = true; // nie załączona lokomotywa albo wywalił + // nadmiarowy + else if (!OK) // nie da się wrzucić kolejnej pozycji + OK = mvControlling->IncScndCtrl(1); // to dać bocznik + } + } mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania break; case Dumb: diff --git a/Driver.h b/Driver.h index 2079a8e0..a182f9b1 100644 --- a/Driver.h +++ b/Driver.h @@ -310,6 +310,7 @@ class TController void Activation(); // umieszczenie obsady w odpowiednim członie void ControllingSet(); // znajduje człon do sterowania void AutoRewident(); // ustawia hamulce w składzie + double ESMVelocity(bool Main); public: Mtable::TTrainParameters *Timetable() { From 18043f2a0e302e2f3cd46fe24fdcf3638de34a0b Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Mon, 21 Aug 2017 20:25:41 +0200 Subject: [PATCH 3/4] maintenance: removed deprecated audio code --- Train.cpp | 658 +----------------------------------------------------- 1 file changed, 2 insertions(+), 656 deletions(-) diff --git a/Train.cpp b/Train.cpp index 3db1a780..c46ff0bf 100644 --- a/Train.cpp +++ b/Train.cpp @@ -557,14 +557,7 @@ void TTrain::OnCommand_mastercontrollerincrease( TTrain *Train, command_data con if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->IncMainCtrl( 1 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikJazdy ); - } -#else Train->mvControlled->IncMainCtrl( 1 ); -#endif } } @@ -572,14 +565,7 @@ void TTrain::OnCommand_mastercontrollerincreasefast( TTrain *Train, command_data if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->IncMainCtrl( 2 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikJazdy ); - } -#else Train->mvControlled->IncMainCtrl( 2 ); -#endif } } @@ -587,14 +573,7 @@ void TTrain::OnCommand_mastercontrollerdecrease( TTrain *Train, command_data con if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->DecMainCtrl( 1 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikJazdy ); - } -#else Train->mvControlled->DecMainCtrl( 1 ); -#endif } } @@ -602,14 +581,7 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->DecMainCtrl( 2 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikJazdy ); - } -#else Train->mvControlled->DecMainCtrl( 2 ); -#endif } } @@ -622,16 +594,9 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con if( Train->mvControlled->AnPos > 1 ) Train->mvControlled->AnPos = 1; } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - else if( Train->mvControlled->IncScndCtrl( 1 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikBocz, Train->dsbNastawnikJazdy, DSBVOLUME_MAX, 0 ); - } -#else else { Train->mvControlled->IncScndCtrl( 1 ); } -#endif } } @@ -639,14 +604,7 @@ void TTrain::OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->IncScndCtrl( 2 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikBocz, Train->dsbNastawnikJazdy, DSBVOLUME_MAX, 0 ); - } -#else Train->mvControlled->IncScndCtrl( 2 ); -#endif } } @@ -656,31 +614,11 @@ void TTrain::OnCommand_notchingrelaytoggle( TTrain *Train, command_data const &C // only reacting to press, so the switch doesn't flip back and forth if key is held down if( false == Train->mvOccupied->AutoRelayFlag ) { // turn on -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvOccupied->AutoRelaySwitch( true ) ) { - // audio feedback - Train->play_sound( Train->dsbSwitch ); - // visual feedback - // NOTE: there's no button for notching relay control - // TBD, TODO: add notching relay control button? - } -#else Train->mvOccupied->AutoRelaySwitch( true ); -#endif } else { //turn off -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvOccupied->AutoRelaySwitch( false ) ) { - // audio feedback - Train->play_sound( Train->dsbSwitch ); - // visual feedback - // NOTE: there's no button for notching relay control - // TBD, TODO: add notching relay control button? - } -#else Train->mvOccupied->AutoRelaySwitch( false ); -#endif } } } @@ -697,24 +635,12 @@ void TTrain::OnCommand_mucurrentindicatorothersourceactivate( TTrain *Train, com if( Command.action == GLFW_PRESS ) { // turn on Train->ShowNextCurrent = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggNextCurrentButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggNextCurrentButton.UpdateValue( 1.0, Train->dsbSwitch ); } else if( Command.action == GLFW_RELEASE ) { //turn off Train->ShowNextCurrent = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggNextCurrentButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggNextCurrentButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -729,14 +655,7 @@ void TTrain::OnCommand_secondcontrollerdecrease( TTrain *Train, command_data con if( Train->mvControlled->AnPos > 1 ) Train->mvControlled->AnPos = 1; } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - else if( Train->mvControlled->DecScndCtrl( 1 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikBocz, Train->dsbNastawnikJazdy, DSBVOLUME_MAX, 0 ); - } -#else Train->mvControlled->DecScndCtrl( 1 ); -#endif } } @@ -744,14 +663,7 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data if( Command.action != GLFW_RELEASE ) { // on press or hold -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( Train->mvControlled->DecScndCtrl( 2 ) ) { - // sound feedback - Train->play_sound( Train->dsbNastawnikBocz, Train->dsbNastawnikJazdy, DSBVOLUME_MAX, 0 ); - } -#else Train->mvControlled->DecScndCtrl( 2 ); -#endif } } @@ -813,12 +725,6 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons if( Command.action != GLFW_RELEASE ) { // press or hold Train->mvOccupied->BrakeReleaser( 1 ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggReleaserButton.GetValue() < 0.05 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggReleaserButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -1020,12 +926,6 @@ void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const if( Command.action != GLFW_RELEASE ) { // press or hold Train->mvControlled->AntiSlippingBrake(); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggAntiSlipButton.GetValue() < 0.05 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggAntiSlipButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -1055,10 +955,6 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma if( Command.action == GLFW_PRESS ) { // press Train->mvControlled->Sandbox( true ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -#endif // visual feedback Train->ggSandButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -1115,13 +1011,6 @@ void TTrain::OnCommand_brakeactingspeedincrease( TTrain *Train, command_data con Train->mvOccupied->BrakeDelayFlag << 1 : Train->mvOccupied->BrakeDelayFlag | bdelay_M ); if( true == Train->mvOccupied->BrakeDelaySwitch( fasterbrakesetting ) ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -/* - Train->play_sound( Train->dsbPneumaticRelay ); -*/ -#endif // visual feedback if( Train->ggBrakeProfileCtrl.SubModel != nullptr ) { Train->ggBrakeProfileCtrl.UpdateValue( @@ -1160,13 +1049,6 @@ void TTrain::OnCommand_brakeactingspeeddecrease( TTrain *Train, command_data con Train->mvOccupied->BrakeDelayFlag >> 1 : Train->mvOccupied->BrakeDelayFlag ^ bdelay_M ); if( true == Train->mvOccupied->BrakeDelaySwitch( slowerbrakesetting ) ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -/* - Train->play_sound( Train->dsbPneumaticRelay ); -*/ -#endif // visual feedback if( Train->ggBrakeProfileCtrl.SubModel != nullptr ) { Train->ggBrakeProfileCtrl.UpdateValue( @@ -1211,24 +1093,12 @@ void TTrain::OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data con if( false == Train->mvControlled->Signalling) { // turn on Train->mvControlled->Signalling = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggSignallingButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggSignallingButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { //turn off Train->mvControlled->Signalling = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggSignallingButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggSignallingButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -1240,10 +1110,6 @@ void TTrain::OnCommand_reverserincrease( TTrain *Train, command_data const &Comm if( Command.action == GLFW_PRESS ) { if( Train->mvOccupied->DirectionForward() ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - Train->play_sound( Train->dsbReverserKey, Train->dsbSwitch, DSBVOLUME_MAX, 0 ); -#endif // aktualizacja skrajnych pojazdów w składzie if( ( Train->mvOccupied->ActiveDir ) && ( Train->DynamicObject->Mechanik ) ) { @@ -1259,10 +1125,6 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm if( Command.action == GLFW_PRESS ) { if( Train->mvOccupied->DirectionBackward() ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - Train->play_sound( Train->dsbReverserKey, Train->dsbSwitch, DSBVOLUME_MAX, 0 ); -#endif // aktualizacja skrajnych pojazdów w składzie if( ( Train->mvOccupied->ActiveDir ) && ( Train->DynamicObject->Mechanik ) ) { @@ -1289,12 +1151,6 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co } // visual feedback Train->ggSecurityResetButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggSecurityResetButton.GetValue() < 0.05 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { // release @@ -1322,10 +1178,6 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command if( Train->ggBatteryButton.SubModel ) { Train->ggBatteryButton.UpdateValue( 1.0, Train->dsbSwitch ); } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -#endif // side-effects if( Train->mvOccupied->LightsPosNo > 0 ) { Train->SetLights(); @@ -1344,10 +1196,6 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command if( Train->ggBatteryButton.SubModel ) { Train->ggBatteryButton.UpdateValue( 0.0, Train->dsbSwitch ); } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -#endif // side-effects if( false == Train->mvControlled->ConverterFlag ) { // if there's no (low voltage) power source left, drop pantographs @@ -1533,18 +1381,10 @@ void TTrain::OnCommand_pantographcompressorvalvetoggle( TTrain *Train, command_d if( Train->mvControlled->bPantKurek3 == false ) { // connect pantographs with primary tank Train->mvControlled->bPantKurek3 = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -#endif } else { // connect pantograps with pantograph compressor Train->mvControlled->bPantKurek3 = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - Train->play_sound( Train->dsbSwitch ); -#endif } } } @@ -1567,12 +1407,6 @@ void TTrain::OnCommand_pantographcompressoractivate( TTrain *Train, command_data if( Command.action != GLFW_RELEASE ) { // press or hold to activate Train->mvControlled->PantCompFlag = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Command.action == GLFW_PRESS ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { // release to disable @@ -1599,13 +1433,6 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co // ...and rear Train->mvControlled->PantRearSP = false; Train->mvControlled->PantRear( false ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - // TODO: separate sound effect for pneumatic buttons - if( Train->ggPantAllDownButton.GetValue() < 0.35 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback if( Train->ggPantAllDownButton.SubModel ) Train->ggPantAllDownButton.UpdateValue( 1.0, Train->dsbSwitch ); @@ -1615,16 +1442,6 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co } else if( Command.action == GLFW_RELEASE ) { // release the button -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback -/* - // NOTE: release sound disabled as this is typically pneumatic button - // TODO: separate sound effect for pneumatic buttons - if( Train->ggPantAllDownButton.GetValue() > 0.65 ) { - Train->play_sound( Train->dsbSwitch ); - } -*/ -#endif // visual feedback if( Train->ggPantAllDownButton.SubModel ) Train->ggPantAllDownButton.UpdateValue( 0.0 ); @@ -1663,23 +1480,11 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com } if( Train->ggMainOnButton.SubModel != nullptr ) { // two separate switches to close and break the circuit -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Command.action == GLFW_PRESS ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainOnButton.UpdateValue( 1.0, Train->dsbSwitch ); } else if( Train->ggMainButton.SubModel != nullptr ) { // single two-state switch -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Command.action == GLFW_PRESS ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -1722,12 +1527,6 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com if( Train->ggMainOffButton.SubModel != nullptr ) { // two separate switches to close and break the circuit -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Command.action == GLFW_PRESS ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainOffButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -1748,12 +1547,6 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com else */ { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Command.action == GLFW_PRESS ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -1779,24 +1572,12 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com // for setup with two separate swiches if( Train->ggMainOnButton.SubModel != nullptr ) { Train->ggMainOnButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggMainOnButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } if( Train->ggMainOffButton.SubModel != nullptr ) { Train->ggMainOffButton.UpdateValue( 0.0, Train->dsbSwitch ); } // and the two-state switch too, for good measure if( Train->ggMainButton.SubModel != nullptr ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggMainButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -1813,12 +1594,6 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com Train->mvControlled->CompressorSwitch( Train->ggCompressorButton.GetValue() > 0.5 ); } } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggMainOnButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback if( Train->ggMainOnButton.SubModel != nullptr ) { // setup with two separate switches @@ -1829,12 +1604,6 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com // TODO: have proper switch type config for all switches, and put it in the cab switch descriptions, not in the .fiz if( Train->mvControlled->TrainType == dt_EZT ) { if( Train->ggMainButton.SubModel != nullptr ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggMainButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggMainButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -1859,12 +1628,6 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma if( ( false == Train->mvControlled->ConverterAllow ) && ( Train->ggConverterButton.GetValue() < 0.5 ) ) { // turn on -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggConverterButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggConverterButton.UpdateValue( 1.0, Train->dsbSwitch ); /* @@ -1892,19 +1655,6 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma } else { //turn off -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->mvOccupied->ConvSwitchType == "impulse" ) { - if( Train->ggConverterOffButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } - } - else { - if( Train->ggConverterButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } - } -#endif // visual feedback Train->ggConverterButton.UpdateValue( 0.0, Train->dsbSwitch ); if( Train->ggConverterOffButton.SubModel != nullptr ) { @@ -1933,13 +1683,6 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma // on button release... if( Train->mvOccupied->ConvSwitchType == "impulse" ) { // ...return switches to start position if applicable -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( ( Train->ggConverterButton.GetValue() > 0.0 ) - || ( Train->ggConverterOffButton.GetValue() > 0.0 ) ) { - // sound feedback - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->ggConverterButton.UpdateValue( 0.0, Train->dsbSwitch ); Train->ggConverterOffButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -1961,12 +1704,6 @@ void TTrain::OnCommand_convertertogglelocal( TTrain *Train, command_data const & if( ( false == Train->mvOccupied->ConverterAllowLocal ) && ( Train->ggConverterLocalButton.GetValue() < 0.5 ) ) { // turn on -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggConverterLocalButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggConverterLocalButton.UpdateValue( 1.0, Train->dsbSwitch ); // effect @@ -1984,12 +1721,6 @@ void TTrain::OnCommand_convertertogglelocal( TTrain *Train, command_data const & } else { //turn off -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggConverterLocalButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggConverterLocalButton.UpdateValue( 0.0, Train->dsbSwitch ); // effect @@ -2029,23 +1760,11 @@ void TTrain::OnCommand_converteroverloadrelayreset( TTrain *Train, command_data && ( Train->mvControlled->TrainType != dt_EZT ) ) { Train->mvControlled->ConvOvldFlag = false; } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggConverterFuseButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggConverterFuseButton.UpdateValue( 1.0, Train->dsbSwitch ); } else if( Command.action == GLFW_RELEASE ) { // release -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggConverterFuseButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggConverterFuseButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2063,12 +1782,6 @@ void TTrain::OnCommand_compressortoggle( TTrain *Train, command_data const &Comm // turn on // visual feedback Train->ggCompressorButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggCompressorButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // impulse type switch has no effect if there's no power // NOTE: this is most likely setup wrong, but the whole thing is smoke and mirrors anyway // (we're presuming impulse type switch for all EMUs for the time being) @@ -2081,10 +1794,6 @@ void TTrain::OnCommand_compressortoggle( TTrain *Train, command_data const &Comm else { //turn off if( true == Train->mvControlled->CompressorSwitch( false ) ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - Train->play_sound( Train->dsbSwitch ); -#endif // NOTE: we don't have switch type definition for the compresor switch // so for the time being we have hard coded "impulse" switches for all EMUs // TODO: have proper switch type config for all switches, and put it in the cab switch descriptions, not in the .fiz @@ -2131,25 +1840,13 @@ void TTrain::OnCommand_compressortogglelocal( TTrain *Train, command_data const // only reacting to press, so the switch doesn't flip back and forth if key is held down if( false == Train->mvOccupied->CompressorAllowLocal ) { // turn on -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggCompressorLocalButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggCompressorLocalButton.UpdateValue( 1.0, Train->dsbSwitch ); // effect Train->mvOccupied->CompressorAllowLocal = true; } else { - //turn off -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggCompressorLocalButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif + // turn off // visual feedback Train->ggCompressorLocalButton.UpdateValue( 0.0, Train->dsbSwitch ); // effect @@ -2189,12 +1886,6 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C Train->mvControlled->Couplers[ 1 ].Connected->StLinSwitchOff = true; } } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggStLinOffButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggStLinOffButton.UpdateValue( 1.0, Train->dsbSwitch ); // effect @@ -2238,12 +1929,6 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C Train->mvControlled->Couplers[ 1 ].Connected->StLinSwitchOff = false; } } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggStLinOffButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggStLinOffButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2269,12 +1954,6 @@ void TTrain::OnCommand_motorconnectorsopen( TTrain *Train, command_data const &C Train->mvControlled->Couplers[ 1 ].Connected->StLinSwitchOff = false; } } -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggStLinOffButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggStLinOffButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2291,14 +1970,7 @@ void TTrain::OnCommand_motordisconnect( TTrain *Train, command_data const &Comma } if( Command.action == GLFW_PRESS ) { -#ifdef EU07_USE_OLD_CONTROLSOUNDS - if( true == Train->mvControlled->CutOffEngine() ) { - // sound feedback - Train->play_sound( Train->dsbSwitch ); - } -#else Train->mvControlled->CutOffEngine(); -#endif } } @@ -2311,12 +1983,6 @@ void TTrain::OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command if( true == Train->mvControlled->CurrentSwitch( true ) ) { // visual feedback Train->ggMaxCurrentCtrl.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggMaxCurrentCtrl.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } else { @@ -2324,12 +1990,6 @@ void TTrain::OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command if( true == Train->mvControlled->CurrentSwitch( false ) ) { // visual feedback Train->ggMaxCurrentCtrl.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggMaxCurrentCtrl.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2347,23 +2007,11 @@ void TTrain::OnCommand_motoroverloadrelayreset( TTrain *Train, command_data cons if( Command.action == GLFW_PRESS ) { // press Train->mvControlled->FuseOn(); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggFuseButton.GetValue() < 0.05 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggFuseButton.UpdateValue( 1.0, Train->dsbSwitch ); } else if( Command.action == GLFW_RELEASE ) { // release -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggFuseButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggFuseButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2388,24 +2036,12 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; // visual feedback Train->ggLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggLeftLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; // visual feedback Train->ggLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggLeftLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2429,24 +2065,12 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const & Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; // visual feedback Train->ggRightLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRightLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; // visual feedback Train->ggRightLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRightLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2470,24 +2094,12 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const & Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; // visual feedback Train->ggUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggUpperLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; // visual feedback Train->ggUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggUpperLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2511,24 +2123,12 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; // visual feedback Train->ggLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggLeftEndLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; // visual feedback Train->ggLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggLeftEndLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2552,24 +2152,12 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const & Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; // visual feedback Train->ggRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRightEndLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; // visual feedback Train->ggRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRightEndLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2594,24 +2182,12 @@ void TTrain::OnCommand_headlighttogglerearleft( TTrain *Train, command_data cons Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; // visual feedback Train->ggRearLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearLeftLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right; // visual feedback Train->ggRearLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearLeftLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2636,24 +2212,12 @@ void TTrain::OnCommand_headlighttogglerearright( TTrain *Train, command_data con Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; // visual feedback Train->ggRearRightLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearRightLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left; // visual feedback Train->ggRearRightLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearRightLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2677,24 +2241,12 @@ void TTrain::OnCommand_headlighttogglerearupper( TTrain *Train, command_data con Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; // visual feedback Train->ggRearUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearUpperLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper; // visual feedback Train->ggRearUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearUpperLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2719,24 +2271,12 @@ void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data cons Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; // visual feedback Train->ggRearLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearLeftEndLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right; // visual feedback Train->ggRearLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearLeftEndLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2761,24 +2301,12 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; // visual feedback Train->ggRearRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearRightEndLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } else { //turn off Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left; // visual feedback Train->ggRearRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggRearRightEndLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif } } } @@ -2799,24 +2327,12 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C if( false == Train->DynamicObject->DimHeadlights ) { // turn on Train->DynamicObject->DimHeadlights = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDimHeadlightsButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDimHeadlightsButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { //turn off Train->DynamicObject->DimHeadlights = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDimHeadlightsButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDimHeadlightsButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2840,12 +2356,6 @@ void TTrain::OnCommand_interiorlighttoggle( TTrain *Train, command_data const &C // turn on Train->bCabLight = true; Train->btCabLight.TurnOn(); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggCabLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggCabLightButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -2853,12 +2363,6 @@ void TTrain::OnCommand_interiorlighttoggle( TTrain *Train, command_data const &C //turn off Train->bCabLight = false; Train->btCabLight.TurnOff(); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggCabLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggCabLightButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2880,24 +2384,12 @@ void TTrain::OnCommand_interiorlightdimtoggle( TTrain *Train, command_data const if( false == Train->bCabLightDim ) { // turn on Train->bCabLightDim = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggCabLightDimButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggCabLightDimButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { //turn off Train->bCabLightDim = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggCabLightDimButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggCabLightDimButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2921,24 +2413,12 @@ void TTrain::OnCommand_instrumentlighttoggle( TTrain *Train, command_data const if( false == Train->InstrumentLightActive ) { // turn on Train->InstrumentLightActive = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggInstrumentLightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggInstrumentLightButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { //turn off Train->InstrumentLightActive = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggInstrumentLightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggInstrumentLightButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2959,24 +2439,12 @@ void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command if( false == Train->mvControlled->Heating ) { // turn on Train->mvControlled->Heating = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggTrainHeatingButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggTrainHeatingButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { //turn off Train->mvControlled->Heating = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggTrainHeatingButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggTrainHeatingButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -2999,23 +2467,11 @@ void TTrain::OnCommand_generictoggle( 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( item.GetValue() < 0.25 ) { // turn on -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( item.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback item.UpdateValue( 1.0, Train->dsbSwitch ); } else { - //turn off -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( item.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif + // turn off // visual feedback item.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -3038,12 +2494,6 @@ void TTrain::OnCommand_doorlocktoggle( TTrain *Train, command_data const &Comman // TODO: check wheter we really need separate flags for this Train->mvControlled->DoorSignalling = true; Train->mvOccupied->DoorBlocked = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDoorSignallingButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDoorSignallingButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -3052,12 +2502,6 @@ void TTrain::OnCommand_doorlocktoggle( TTrain *Train, command_data const &Comman // TODO: check wheter we really need separate flags for this Train->mvControlled->DoorSignalling = false; Train->mvOccupied->DoorBlocked = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDoorSignallingButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDoorSignallingButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -3079,12 +2523,6 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->DoorLeft( true ) ) { Train->ggDoorLeftButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorLeftButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorOpen ); } } @@ -3092,12 +2530,6 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman // in the rear cab sides are reversed if( Train->mvOccupied->DoorRight( true ) ) { Train->ggDoorRightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorRightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorOpen ); } } @@ -3107,12 +2539,6 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->DoorLeft( false ) ) { Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorLeftButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorClose ); } } @@ -3120,12 +2546,6 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman // in the rear cab sides are reversed if( Train->mvOccupied->DoorRight( false ) ) { Train->ggDoorRightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorRightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorClose ); } } @@ -3148,12 +2568,6 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->DoorRight( true ) ) { Train->ggDoorRightButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorRightButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorOpen ); } } @@ -3161,12 +2575,6 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma // in the rear cab sides are reversed if( Train->mvOccupied->DoorLeft( true ) ) { Train->ggDoorLeftButton.UpdateValue( 1.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorLeftButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorOpen ); } } @@ -3176,12 +2584,6 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma if( Train->mvOccupied->ActiveCab == 1 ) { if( Train->mvOccupied->DoorRight( false ) ) { Train->ggDoorRightButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorRightButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorClose ); } } @@ -3189,12 +2591,6 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma // in the rear cab sides are reversed if( Train->mvOccupied->DoorLeft( false ) ) { Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch ); -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // sound feedback - if( Train->ggDoorLeftButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif Train->play_sound( Train->dsbDoorClose ); } } @@ -3216,12 +2612,6 @@ void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Com if( false == Train->mvControlled->DepartureSignal ) { // turn on Train->mvControlled->DepartureSignal = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDepartureSignalButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDepartureSignalButton.UpdateValue( 1.0, Train->dsbSwitch ); } @@ -3229,12 +2619,6 @@ void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Com else if( Command.action == GLFW_RELEASE ) { // turn off Train->mvControlled->DepartureSignal = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggDepartureSignalButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggDepartureSignalButton.UpdateValue( 0.0, Train->dsbSwitch ); } @@ -3261,13 +2645,6 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma Train->mvControlled->WarningSignal &= ~2; } */ -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( ( Train->ggHornButton.GetValue() > -0.5 ) - || ( Train->ggHornLowButton.GetValue() < 0.5 ) ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggHornButton.UpdateValue( -1.0 ); Train->ggHornLowButton.UpdateValue( 1.0 ); @@ -3280,13 +2657,6 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma Train->mvOccupied->WarningSignal &= ~( 1 | 2 ); */ Train->mvOccupied->WarningSignal &= ~1; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( ( Train->ggHornButton.GetValue() < -0.5 ) - || ( Train->ggHornLowButton.GetValue() > 0.5 ) ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggHornButton.UpdateValue( 0.0 ); Train->ggHornLowButton.UpdateValue( 0.0 ); @@ -3314,12 +2684,6 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm Train->mvControlled->WarningSignal &= ~1; } */ -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggHornButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggHornButton.UpdateValue( 1.0 ); Train->ggHornHighButton.UpdateValue( 1.0 ); @@ -3332,12 +2696,6 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm Train->mvOccupied->WarningSignal &= ~( 1 | 2 ); */ Train->mvOccupied->WarningSignal &= ~2; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggHornButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggHornButton.UpdateValue( 0.0 ); Train->ggHornHighButton.UpdateValue( 0.0 ); @@ -3361,24 +2719,12 @@ void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command ) if( false == Train->mvOccupied->Radio ) { // turn on Train->mvOccupied->Radio = true; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggRadioButton.GetValue() < 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggRadioButton.UpdateValue( 1.0, Train->dsbSwitch ); } else { // turn off Train->mvOccupied->Radio = false; -#ifdef EU07_USE_OLD_CONTROLSOUNDS - // audio feedback - if( Train->ggRadioButton.GetValue() > 0.5 ) { - Train->play_sound( Train->dsbSwitch ); - } -#endif // visual feedback Train->ggRadioButton.UpdateValue( 0.0, Train->dsbSwitch ); } From a3bde32bc640db0b041fa52cab1a6b772442075b Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Mon, 21 Aug 2017 20:32:24 +0200 Subject: [PATCH 4/4] build 170821. --- color.h | 6 +++--- moon.cpp | 29 ++++++++++++++--------------- sun.cpp | 29 +++++++++++------------------ version.h | 2 +- 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/color.h b/color.h index 56a15abb..0a618426 100644 --- a/color.h +++ b/color.h @@ -76,9 +76,9 @@ HSVtoRGB( glm::vec3 const &HSV ) { hh /= 60.0; int const i = (int)hh; float const ff = hh - i; - float const p = HSV.z * ( 1.0 - HSV.y ); - float const q = HSV.z * ( 1.0 - ( HSV.y * ff ) ); - float const t = HSV.z * ( 1.0 - ( HSV.y * ( 1.0 - ff ) ) ); + float const p = HSV.z * ( 1.f - HSV.y ); + float const q = HSV.z * ( 1.f - ( HSV.y * ff ) ); + float const t = HSV.z * ( 1.f - ( HSV.y * ( 1.f - ff ) ) ); switch( i ) { case 0: diff --git a/moon.cpp b/moon.cpp index 02db79f1..d4da4c38 100644 --- a/moon.cpp +++ b/moon.cpp @@ -37,8 +37,8 @@ cMoon::update() { move(); glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor ); - position = glm::rotateX( position, glm::radians( m_body.elevref ) ); - position = glm::rotateY( position, glm::radians( -m_body.hrang ) ); + position = glm::rotateX( position, glm::radians( static_cast( m_body.elevref ) ) ); + position = glm::rotateY( position, glm::radians( static_cast( -m_body.hrang ) ) ); m_position = position; } @@ -46,17 +46,16 @@ cMoon::update() { void cMoon::render() { - glColor4f( 225.0f/255.0f, 225.0f/255.0f, 255.0f/255.0f, 1.f ); - // debug line to locate the sun easier - Math3D::vector3 position = m_position; - glBegin( GL_LINES ); - glVertex3f( position.x, position.y, position.z ); - glVertex3f( position.x, 0.0f, position.z ); - glEnd(); - glPushMatrix(); - glTranslatef( position.x, position.y, position.z ); - gluSphere( moonsphere, /* (float)( Global::iWindowHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 ); - glPopMatrix(); + ::glColor4f( 225.f / 255.f, 225.f / 255.f, 255.f / 255.f, 1.f ); + // debug line to locate the moon easier + ::glBegin( GL_LINES ); + ::glVertex3fv( glm::value_ptr( m_position ) ); + ::glVertex3f( m_position.x, 0.f, m_position.z ); + ::glEnd(); + ::glPushMatrix(); + ::glTranslatef( m_position.x, m_position.y, m_position.z ); + ::gluSphere( moonsphere, /* (float)( Global::iWindowHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 ); + ::glPopMatrix(); } glm::vec3 @@ -78,8 +77,8 @@ float cMoon::getIntensity() { // calculating intensity of the sun instead, and returning 15% of the value, // which roughly matches how much sunlight is reflected by the moon // We alter the intensity further based on current phase of the moon - auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53 * 0.5f ); - return (float)( m_body.etr/ 1399.0 ) * phasefactor * 0.15f; // arbitrary scaling factor taken from etrn value + auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53f * 0.5f ); + return static_cast( ( m_body.etr/ 1399.0 ) * phasefactor * 0.15 ); // arbitrary scaling factor taken from etrn value } void cMoon::setLocation( float const Longitude, float const Latitude ) { diff --git a/sun.cpp b/sun.cpp index ed08aa2b..9f4ac2b5 100644 --- a/sun.cpp +++ b/sun.cpp @@ -34,8 +34,8 @@ cSun::update() { move(); glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor ); - position = glm::rotateX( position, glm::radians( m_body.elevref ) ); - position = glm::rotateY( position, glm::radians( -m_body.hrang ) ); + position = glm::rotateX( position, glm::radians( static_cast( m_body.elevref ) ) ); + position = glm::rotateY( position, glm::radians( static_cast( -m_body.hrang ) ) ); m_position = position; } @@ -43,24 +43,17 @@ cSun::update() { void cSun::render() { -/* - glLightfv(GL_LIGHT0, GL_POSITION, position.getVector() ); // sun - - GLfloat LightPosition[]= { 10.0f, 50.0f, -5.0f, 1.0f }; // ambient - glLightfv(GL_LIGHT1, GL_POSITION, LightPosition ); -*/ - glColor4f( 255.0f/255.0f, 242.0f/255.0f, 231.0f/255.0f, 1.f ); + ::glColor4f( 255.f / 255.f, 242.f / 255.f, 231.f / 255.f, 1.f ); // debug line to locate the sun easier - Math3D::vector3 position = m_position; - glBegin( GL_LINES ); - glVertex3f( position.x, position.y, position.z ); - glVertex3f( position.x, 0.0f, position.z ); - glEnd(); - glPushMatrix(); - glTranslatef( position.x, position.y, position.z ); + ::glBegin( GL_LINES ); + ::glVertex3fv( glm::value_ptr( m_position ) ); + ::glVertex3f( m_position.x, 0.f, m_position.z ); + ::glEnd(); + ::glPushMatrix(); + ::glTranslatef( m_position.x, m_position.y, m_position.z ); // radius is a result of scaling true distance down to 2km -- it's scaled by equal ratio - gluSphere( sunsphere, (float)(m_body.distance * 9.359157), 12, 12 ); - glPopMatrix(); + ::gluSphere( sunsphere, m_body.distance * 9.359157, 12, 12 ); + ::glPopMatrix(); } glm::vec3 diff --git a/version.h b/version.h index 3221e61c..99ba44c0 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 17 -#define VERSION_MINOR 820 +#define VERSION_MINOR 821 #define VERSION_REVISION 0