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 4dca7335..7100e46c 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 d4f1e9b2..9012e476 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 @@ -1736,7 +1723,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() { @@ -2486,51 +2507,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 7ec35bb6..5584c35e 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(); @@ -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() { diff --git a/Model3d.cpp b/Model3d.cpp index 8d2f8c20..bcd675d5 100644 --- a/Model3d.cpp +++ b/Model3d.cpp @@ -639,70 +639,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 (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/Train.cpp b/Train.cpp index f53eec75..6cce3b5d 100644 --- a/Train.cpp +++ b/Train.cpp @@ -592,14 +592,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 } } @@ -607,14 +600,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 } } @@ -622,14 +608,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 } } @@ -637,14 +616,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 } } @@ -657,16 +629,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); - } -#else else { Train->mvControlled->IncScndCtrl( 1 ); } -#endif } } @@ -674,14 +639,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); - } -#else Train->mvControlled->IncScndCtrl( 2 ); -#endif } } @@ -691,31 +649,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 } } } @@ -732,24 +670,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 ); } @@ -764,14 +690,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); - } -#else Train->mvControlled->DecScndCtrl( 1 ); -#endif } } @@ -779,14 +698,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); - } -#else Train->mvControlled->DecScndCtrl( 2 ); -#endif } } @@ -848,12 +760,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 ); } @@ -1055,12 +961,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 ); } @@ -1090,10 +990,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 ); } @@ -1150,13 +1046,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( @@ -1195,13 +1084,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( @@ -1246,24 +1128,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 ); } @@ -1316,12 +1186,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 @@ -1349,10 +1213,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(); @@ -1371,10 +1231,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 @@ -1560,18 +1416,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 } } } @@ -1594,12 +1442,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 @@ -1626,13 +1468,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 ); @@ -1642,16 +1477,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 ); @@ -1690,23 +1515,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 ); } @@ -1749,12 +1562,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 ); } @@ -1775,12 +1582,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 ); } @@ -1806,24 +1607,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 ); } @@ -1840,12 +1629,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 @@ -1856,12 +1639,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 ); } @@ -1886,12 +1663,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 ); /* @@ -1919,19 +1690,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 ) { @@ -1960,13 +1718,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 ); } @@ -1988,12 +1739,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 @@ -2011,12 +1756,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 @@ -2056,23 +1795,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 ); } @@ -2090,12 +1817,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) @@ -2108,10 +1829,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 @@ -2158,25 +1875,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 @@ -2216,12 +1921,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 @@ -2265,12 +1964,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 ); } @@ -2296,12 +1989,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 ); } @@ -2318,14 +2005,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 } } @@ -2338,12 +2018,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 { @@ -2351,12 +2025,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 } } } @@ -2374,23 +2042,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 ); } @@ -2415,24 +2071,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 } } } @@ -2456,24 +2100,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 } } } @@ -2497,24 +2129,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 } } } @@ -2538,24 +2158,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 } } } @@ -2579,24 +2187,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 } } } @@ -2621,24 +2217,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 } } } @@ -2663,24 +2247,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 } } } @@ -2704,24 +2276,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 } } } @@ -2746,24 +2306,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 } } } @@ -2788,24 +2336,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 } } } @@ -2826,24 +2362,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 ); } @@ -2867,12 +2391,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 ); } @@ -2880,12 +2398,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 ); } @@ -2907,24 +2419,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 ); } @@ -2948,24 +2448,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 ); } @@ -2986,24 +2474,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 ); } @@ -3026,23 +2502,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 ); } @@ -3065,12 +2529,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 ); } @@ -3079,12 +2537,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 ); } @@ -3106,12 +2558,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 ); } } @@ -3119,12 +2565,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 ); } } @@ -3134,12 +2574,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 ); } } @@ -3147,12 +2581,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 ); } } @@ -3175,12 +2603,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 ); } } @@ -3188,12 +2610,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 ); } } @@ -3203,12 +2619,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 ); } } @@ -3216,12 +2626,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 ); } } @@ -3243,12 +2647,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 ); } @@ -3256,12 +2654,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 ); } @@ -3288,13 +2680,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 ); @@ -3307,13 +2692,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 ); @@ -3341,12 +2719,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 ); @@ -3359,12 +2731,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 ); @@ -3388,24 +2754,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 ); } diff --git a/color.h b/color.h index 17e5ea21..804054d1 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 3fb36de8..eae7ba55 100644 --- a/moon.cpp +++ b/moon.cpp @@ -45,8 +45,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; } @@ -54,16 +54,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 - glBegin( GL_LINES ); - glVertex3f( m_position.x, m_position.y, m_position.z ); - glVertex3f( m_position.x, 0.0f, m_position.z ); - glEnd(); - glPushMatrix(); - glTranslatef( m_position.x, m_position.y, m_position.z ); - gluSphere( moonsphere, /* (float)( Global::ScreenHeight / 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 @@ -85,8 +85,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/renderer.cpp b/renderer.cpp index 5251a476..3df1f44b 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.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: diff --git a/sun.cpp b/sun.cpp index 27ae88a2..b2625730 100644 --- a/sun.cpp +++ b/sun.cpp @@ -41,8 +41,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; } @@ -50,23 +50,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 - glBegin( GL_LINES ); - glVertex3f( m_position.x, m_position.y, m_position.z ); - glVertex3f( m_position.x, 0.0f, m_position.z ); - glEnd(); - glPushMatrix(); - glTranslatef( m_position.x, m_position.y, m_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