mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
44
Console.cpp
44
Console.cpp
@@ -288,35 +288,25 @@ void Console::ValueSet(int x, double y)
|
||||
if (iMode == 4)
|
||||
if (PoKeys55[0])
|
||||
{
|
||||
//if (x == 7)
|
||||
//{
|
||||
// PoKeys55[0]->PoExtUpdate(8, y);
|
||||
//} // nbmx: wal kulakowy
|
||||
//else
|
||||
//{
|
||||
x = Global::iPoKeysPWM[x];
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog("CalibrateOutDebugInfo: oryginal=" + AnsiString(y), false);
|
||||
if (Global::fCalibrateOutMax[x] > 0)
|
||||
{
|
||||
y = Global::CutValueToRange(0, y, Global::fCalibrateOutMax[x]);
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog("CalibrateOutDebugInfo: oryginal=" + AnsiString(y), false);
|
||||
if (Global::fCalibrateOutMax[x] > 0)
|
||||
{
|
||||
y = Global::CutValueToRange(0, y, Global::fCalibrateOutMax[x]);
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog(" cutted=" + AnsiString(y),false);
|
||||
y = y / Global::fCalibrateOutMax[x]; // sprowadzenie do <0,1> jeśli podana maksymalna wartość
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog(" fraction=" + AnsiString(y),false);
|
||||
}
|
||||
double temp = (((((Global::fCalibrateOut[x][5] * y) + Global::fCalibrateOut[x][4]) * y +
|
||||
Global::fCalibrateOut[x][3]) * y + Global::fCalibrateOut[x][2]) * y +
|
||||
Global::fCalibrateOut[x][1]) * y +
|
||||
Global::fCalibrateOut[x][0]; // zakres <0;1>
|
||||
WriteLog(" cutted=" + AnsiString(y),false);
|
||||
y = y / Global::fCalibrateOutMax[x]; // sprowadzenie do <0,1> jeśli podana maksymalna wartość
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog(" calibrated=" + AnsiString(temp));
|
||||
PoKeys55[0]->PWM(x, temp);
|
||||
//if (x == 6)
|
||||
//{
|
||||
// PoKeys55[0]->PoExtUpdate(9, temp); //dodatkowo hasler na PoExt
|
||||
//}
|
||||
//}
|
||||
WriteLog(" fraction=" + AnsiString(y),false);
|
||||
}
|
||||
double temp = (((((Global::fCalibrateOut[x][5] * y) + Global::fCalibrateOut[x][4]) * y +
|
||||
Global::fCalibrateOut[x][3]) * y + Global::fCalibrateOut[x][2]) * y +
|
||||
Global::fCalibrateOut[x][1]) * y +
|
||||
Global::fCalibrateOut[x][0]; // zakres <0;1>
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog(" calibrated=" + AnsiString(temp));
|
||||
PoKeys55[0]->PWM(x, temp);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ TPoKeys55::TPoKeys55()
|
||||
fAnalog[0] = fAnalog[1] = fAnalog[2] = fAnalog[3] = fAnalog[4] = fAnalog[5] = fAnalog[6] = -1.0;
|
||||
iPWM[0] = iPWM[1] = iPWM[2] = iPWM[3] = iPWM[4] = iPWM[5] = iPWM[6] = 0;
|
||||
iPWM[7] = 4096;
|
||||
PoExt[0] = PoExt[1] = PoExt[2] = PoExt[3] = PoExt[4] = PoExt[5] = PoExt[6] = PoExt[7] = PoExt[8] = PoExt[9] = PoExt[10] = 0;
|
||||
iInputs[0] = 0; // czy normalnie s¹ w stanie wysokim?
|
||||
iRepeats = 0;
|
||||
bNoError = true;
|
||||
@@ -231,29 +230,6 @@ bool TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned char b4, unsig
|
||||
// Read(); //odczyt trzeba zrobiæ inaczej - w tym miejscu bêdzie za szybko i nic siê nie odczyta
|
||||
}
|
||||
|
||||
bool TPoKeys55::PoExtWrite(unsigned char *c)
|
||||
{
|
||||
DWORD BytesWritten = 0;
|
||||
OutputBuffer[0] = 0; //The first byte is the "Report ID" and does not get transmitted over the USB bus. Always set=0.
|
||||
OutputBuffer[1] = 0xBB; //0xBB - bajt rozpoznawczy dla PoKeys55
|
||||
OutputBuffer[2] = iLastCommand = 0xDA; //operacja: 0xDA PoExt
|
||||
OutputBuffer[3] = 1; //1 = enable PoExt
|
||||
OutputBuffer[4] = 0; // Connector selection 0: dedicated , 1: normal pins
|
||||
OutputBuffer[5] = 0;
|
||||
OutputBuffer[6] = 0;
|
||||
OutputBuffer[7] = ++cRequest; //numer ¿¹dania
|
||||
OutputBuffer[8] = 0;
|
||||
for (int i = 0; i<10; ++i)
|
||||
OutputBuffer[9 + i] = c[i];
|
||||
for (int i = 0; i<8; ++i)
|
||||
OutputBuffer[8] += OutputBuffer[i]; //czy sumowaæ te¿ od 9 do 64?
|
||||
//The basic Windows I/O functions WriteFile() and ReadFile() can be used to read and write to HID class USB devices
|
||||
//(once we have the read and write handles to the device, which are obtained with CreateFile()).
|
||||
//The following call to WriteFile() sends 64 bytes of data to the USB device.
|
||||
WriteFile(WriteHandle, &OutputBuffer, 65, &BytesWritten, 0); //Blocking function, unless an "overlapped" structure is used
|
||||
return (BytesWritten == 65);
|
||||
//Read(); //odczyt trzeba zrobiæ inaczej - w tym miejscu bêdzie za szybko i nic siê nie odczyta
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool TPoKeys55::Read()
|
||||
@@ -322,13 +298,6 @@ bool TPoKeys55::PWM(int x, float y)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPoKeys55::PoExtUpdate(int x, char y)
|
||||
{//ustawienie wskazanego PWM (@12Mhz: 12000=1ms=1000Hz)
|
||||
//iPWM[7]=1024; //1024==85333.3333333333ns=11718.75Hz
|
||||
PoExt[x] = y & 0x0FF; //0x0FF=256
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPoKeys55::Update(bool pause)
|
||||
{ // funkcja powinna byæ wywo³ywana regularnie, np. raz w ka¿dej ramce ekranowej
|
||||
if (pause)
|
||||
@@ -385,14 +354,9 @@ bool TPoKeys55::Update(bool pause)
|
||||
case 3: // ustawienie wyjœæ analogowych, 0..4095 mapowaæ na 0..65520 (<<4)
|
||||
if (Write(0x41, 43 - 1, (iPWM[6] >> 4), (iPWM[6] << 4))) // wys³anie ustawieñ
|
||||
iRepeats = 0; // informacja, ¿e posz³o dobrze
|
||||
iFaza = 4; //++iFaza; //ta faza zosta³a zakoñczona
|
||||
iFaza = 0; //++iFaza; //ta faza zosta³a zakoñczona
|
||||
// powinno jeszcze przyjϾ potwierdzenie o kodzie 0x41
|
||||
break;
|
||||
case 4: //ustawienie
|
||||
//if (PoExtWrite(PoExt))
|
||||
// iRepeats = 0; //informacja, ¿e posz³o dobrze
|
||||
iFaza = 0; //++iFaza; //ta faza zosta³a zakoñczona
|
||||
break;
|
||||
default:
|
||||
iFaza = 0; // na wypadek, gdyby zb³¹dzi³o po jakichœ zmianach w kodzie
|
||||
// iRepeats=0;
|
||||
|
||||
@@ -16,7 +16,6 @@ class TPoKeys55
|
||||
unsigned char OutputBuffer[65]; // Allocate a memory buffer equal to our endpoint size + 1
|
||||
unsigned char InputBuffer[65]; // Allocate a memory buffer equal to our endpoint size + 1
|
||||
int iPWM[8]; // 0-5:wyjœcia PWM,6:analogowe,7:czêstotliwoœc PWM
|
||||
char PoExt[10];// Wyjscia PoExt
|
||||
int iPWMbits;
|
||||
int iLastCommand;
|
||||
int iFaza;
|
||||
@@ -30,12 +29,10 @@ class TPoKeys55
|
||||
bool Connect();
|
||||
bool Close();
|
||||
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0, unsigned char b5 = 0);
|
||||
bool PoExtWrite(unsigned char *c);
|
||||
bool Read();
|
||||
bool ReadLoop(int i);
|
||||
AnsiString Version();
|
||||
bool PWM(int x, float y);
|
||||
bool PoExtUpdate(int x, char y);
|
||||
bool Update(bool pause);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
62
Driver.cpp
62
Driver.cpp
@@ -243,6 +243,7 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
if ((iFlags & spElapsed) == 0) // jeśli nie wjechał
|
||||
if (trTrack->iNumDynamics > 0) // a skrzyżowanie zawiera pojazd
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Tor " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= " + fDist);
|
||||
fVelNext =
|
||||
0.0; // to zabronić wjazdu (chyba że ten z przodu też jedzie prosto)
|
||||
@@ -265,6 +266,7 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
trTrack->iNumDynamics >
|
||||
0) // jeśli jeszcze nie wjechano na tor, a coś na nim jest
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Rozjazd " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= "+fDist);
|
||||
//fDist -= 30.0;
|
||||
fVelNext = 0.0; // to niech stanie w zwiększonej odległości
|
||||
@@ -416,6 +418,7 @@ bool TController::TableNotFound(TEvent *e)
|
||||
spEvent)) // o ile używana pozycja
|
||||
if (sSpeedTable[i].evEvent == e)
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableNotFound: Event already in SpeedTable: " + sSpeedTable[i].evEvent->asName);
|
||||
return false; // już jest, drugi raz dodawać nie ma po co
|
||||
}
|
||||
@@ -517,22 +520,27 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
if (TableNotFound(pEvent)) // jeśli nie ma
|
||||
if (TableAddNew())
|
||||
{
|
||||
WriteLog("TableTraceRoute: new event found " + pEvent->asName + " by " +
|
||||
OwnerName());
|
||||
if (sSpeedTable[iLast].Set(
|
||||
pEvent, fCurrentDistance,
|
||||
OrderCurrentGet())) // dodanie odczytu sygnału
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableTraceRoute: new event found " + pEvent->asName + " by " + OwnerName());
|
||||
if (sSpeedTable[iLast].Set( pEvent, fCurrentDistance, OrderCurrentGet())) // dodanie odczytu sygnału
|
||||
{
|
||||
fDistance = fCurrentDistance; // jeśli sygnał stop, to nie ma
|
||||
// potrzeby dalej skanować
|
||||
sSemNextStop = &sSpeedTable[iLast];
|
||||
if (!sSemNext)
|
||||
sSemNext = &sSpeedTable[iLast];
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Signal stop. Next Semaphor ", false);
|
||||
if (sSemNextStop)
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog(sSemNextStop->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("none");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -540,11 +548,18 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
sSemNext == NULL)
|
||||
sSemNext =
|
||||
&sSpeedTable[iLast]; // sprawdzamy czy pierwszy na drodze
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Signal forward. Next Semaphor ", false);
|
||||
if (sSemNext)
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog(sSemNext->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // event dodajemy najpierw, żeby móc sprawdzić, czy tor został dodany po
|
||||
@@ -693,11 +708,12 @@ void TController::TableCheck(double fDistance)
|
||||
{
|
||||
if (sSpeedTable[i].Update(&pos, &dir, len))
|
||||
{
|
||||
WriteLog("TableCheck: Switch change. Delete next entries. (" +
|
||||
sSpeedTable[i].trTrack->NameGet() + ")");
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableCheck: Switch change. Delete next entries. (" + sSpeedTable[i].trTrack->NameGet() + ")");
|
||||
int k = (iLast + 1) % iSpeedTableSize; // skanujemy razem z ostatnią pozycją
|
||||
for (int j = (i+1) % iSpeedTableSize; j != k; j = (j + 1) % iSpeedTableSize)
|
||||
{ // kasowanie wszystkich rekordów za zmienioną zwrotnicą
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableCheck: Delete from table: " + sSpeedTable[j].GetName());
|
||||
sSpeedTable[j].iFlags = 0;
|
||||
if (&sSpeedTable[j] == sSemNext)
|
||||
@@ -705,8 +721,11 @@ void TController::TableCheck(double fDistance)
|
||||
if (&sSpeedTable[j] == sSemNextStop)
|
||||
sSemNextStop = NULL; // przy kasowaniu tabelki zrzucamy także semafor
|
||||
}
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
{
|
||||
WriteLog("TableCheck: Delete entries OK.");
|
||||
WriteLog("TableCheck: New last element: " + sSpeedTable[i].GetName());
|
||||
}
|
||||
iLast = i; // pokazujemy gdzie jest ostatni kawałek
|
||||
break; // nie kontynuujemy pętli, trzeba doskanować ciąg dalszy
|
||||
}
|
||||
@@ -832,8 +851,8 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
} // koniec obsługi przelotu na W4
|
||||
else
|
||||
{ // zatrzymanie na W4
|
||||
if (!eSignNext)
|
||||
eSignNext = sSpeedTable[i].evEvent;
|
||||
if (!eSignNext) //jeśli nie widzi następnego sygnału
|
||||
eSignNext = sSpeedTable[i].evEvent; //ustawia dotychczasową
|
||||
if (mvOccupied->Vel > 0.3) // jeśli jedzie (nie trzeba czekać, aż się
|
||||
// drgania wytłumią - drzwi zamykane od 1.0)
|
||||
sSpeedTable[i].fVelNext = 0; // to będzie zatrzymanie
|
||||
@@ -964,10 +983,11 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
}
|
||||
if (TrainParams->StationIndex < TrainParams->StationCount)
|
||||
{ // jeśli są dalsze stacje, czekamy do godziny odjazdu
|
||||
|
||||
if (TrainParams->IsTimeToGo(GlobalTime->hh, GlobalTime->mm))
|
||||
{ // z dalszą akcją czekamy do godziny odjazdu
|
||||
// if (TrainParams->CheckTrainLatency()<0.0) //jak się ma odjazd
|
||||
// do czasu odjazdu?
|
||||
if (TrainParams->CheckTrainLatency() < 0)
|
||||
WaitingSet(20); //Jak spóźniony to czeka 20s
|
||||
// iDrivigFlags|=moveLate1; //oflagować, gdy odjazd ze
|
||||
// spóźnieniem, będzie jechał forsowniej
|
||||
fLastStopExpDist =
|
||||
@@ -976,14 +996,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// ma przesunąć na następny postój
|
||||
// Controlled-> //zapisać odległość do przejechania
|
||||
TrainParams->StationIndexInc(); // przejście do następnej
|
||||
asNextStop =
|
||||
TrainParams
|
||||
->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
// TableClear(); //aby od nowa sprawdziło W4 z inną nazwą już - to nie jest dobry pomysł
|
||||
#if LOGSTOPS
|
||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName +
|
||||
": at " + AnsiString(GlobalTime->hh) + ":" +
|
||||
AnsiString(GlobalTime->mm) + " next " +
|
||||
AnsiString(GlobalTime->mm) + " Latency:" + AnsiString(TrainParams->CheckTrainLatency()) + " next " +
|
||||
asNextStop); // informacja
|
||||
#endif
|
||||
if (int(floor(sSpeedTable[i].evEvent->ValueGet(1))) & 1)
|
||||
@@ -1052,12 +1070,14 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// sprawdzanie eventów pasywnych miniętych
|
||||
if (sSpeedTable[i].fDist < 0.0 && sSemNext == &sSpeedTable[i])
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: semaphor " + sSemNext->GetName() + " passed by " + OwnerName());
|
||||
sSemNext = NULL; // jeśli minęliśmy semafor od ograniczenia to go kasujemy ze
|
||||
// zmiennej sprawdzającej dla skanowania w przód
|
||||
}
|
||||
if (sSpeedTable[i].fDist < 0.0 && sSemNextStop == &sSpeedTable[i])
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: semaphor " + sSemNextStop->GetName() + " passed by " + OwnerName());
|
||||
sSemNextStop = NULL; // jeśli minęliśmy semafor od ograniczenia to go kasujemy ze
|
||||
// zmiennej sprawdzającej dla skanowania w przód
|
||||
@@ -1071,6 +1091,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// semafor a wcześniej
|
||||
// byl nowy to go dorzucamy do zmiennej, żeby cały
|
||||
// czas widział najbliższy
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: Next semaphor: " + sSemNext->GetName() + " by " + OwnerName());
|
||||
}
|
||||
if (!sSemNextStop || (sSemNextStop && sSemNextStop->fVelNext != 0 &&
|
||||
@@ -1142,6 +1163,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
{
|
||||
if (sSpeedTable[i].fSectionVelocityDist == 0.0)
|
||||
{
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: Event is behind. SVD = 0: " + sSpeedTable[i].evEvent->asName);
|
||||
sSpeedTable[i].iFlags = 0; // jeśli punktowy to kasujemy i nie dajemy ograniczenia na stałe
|
||||
}
|
||||
@@ -1155,6 +1177,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
else if (sSpeedTable[i].fDist < -fLength)
|
||||
{ // jeśli większe to musi wyjechać za poprzednie
|
||||
VelLimitLast = sSpeedTable[i].fVelNext;
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: Event is behind. SVD < 0: " + sSpeedTable[i].evEvent->asName);
|
||||
sSpeedTable[i].iFlags = 0; // wyjechaliśmy poza poprzednie, można skasować
|
||||
}
|
||||
@@ -1173,6 +1196,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
else if (sSpeedTable[i].fDist < -fLength - sSpeedTable[i].fSectionVelocityDist)
|
||||
{ //
|
||||
VelLimitLast = -1.0;
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TableUpdate: Event is behind. SVD > 0: " + sSpeedTable[i].evEvent->asName);
|
||||
sSpeedTable[i].iFlags = 0; // wyjechaliśmy poza poprzednie, można skasować
|
||||
}
|
||||
@@ -1351,6 +1375,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
void TController::TablePurger()
|
||||
{ // odtykacz: usuwa mniej istotne pozycje ze środka tabelki, aby uniknąć zatkania
|
||||
//(np. brak ograniczenia pomiędzy zwrotnicami, usunięte sygnały, minięte odcinki łuku)
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("TablePurger: Czyszczenie tableki.");
|
||||
int i, j, k = iLast - iFirst; // może być 15 albo 16 pozycji, ostatniej nie ma co sprawdzać
|
||||
if (k < 0)
|
||||
@@ -1370,6 +1395,7 @@ void TController::TablePurger()
|
||||
if (&sSpeedTable[(i + 1) % iSpeedTableSize] == sSemNextStop)
|
||||
sSemNextStop = &sSpeedTable[i]; // przeniesienie znacznika o semaforze
|
||||
}
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Odtykacz usuwa pozycję");
|
||||
iLast = (iLast - 1 + iSpeedTableSize) % iSpeedTableSize; // cofnięcie z zawinięciem
|
||||
return;
|
||||
@@ -1394,6 +1420,7 @@ void TController::TablePurger()
|
||||
delete[] sSpeedTable; // to już nie potrzebne
|
||||
sSpeedTable = t; // bo jest nowe
|
||||
iSpeedTableSize += 16;
|
||||
if (Global::iWriteLogEnabled & 8)
|
||||
WriteLog("Tabelka powiększona do "+AnsiString(iSpeedTableSize)+" pozycji");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -1847,7 +1874,7 @@ bool TController::CheckVehicles(TOrders user)
|
||||
{
|
||||
if (TrainParams)
|
||||
if (p->asDestination == "none")
|
||||
p->DestinationSet(TrainParams->Relation2); // relacja docelowa, jeśli nie było
|
||||
p->DestinationSet(TrainParams->Relation2, TrainParams->TrainName); // relacja docelowa, jeśli nie było
|
||||
if (AIControllFlag) // jeśli prowadzi komputer
|
||||
p->RaLightsSet(0, 0); // gasimy światła
|
||||
if (p->MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
|
||||
@@ -2958,7 +2985,7 @@ bool TController::PutCommand(AnsiString NewCommand, double NewValue1, double New
|
||||
TDynamicObject *p = pVehicles[0];
|
||||
while (p)
|
||||
{
|
||||
p->DestinationSet(NewCommand); // relacja docelowa
|
||||
p->DestinationSet(NewCommand, TrainParams->TrainName); // relacja docelowa
|
||||
p = p->Next(); // pojazd podłączony od tyłu (licząc od czoła)
|
||||
}
|
||||
}
|
||||
@@ -4218,6 +4245,7 @@ bool TController::UpdateSituation(double dt)
|
||||
if ((sSemNext && sSemNext->fVelNext != 0.0) || (iDrivigFlags & moveStopHere)==0)
|
||||
{ // jeśli można jechać, to odpalić dźwięk kierownika oraz zamknąć drzwi w
|
||||
// składzie, jeśli nie mamy czekać na sygnał też trzeba odpalić
|
||||
|
||||
if (iDrivigFlags & moveGuardSignal)
|
||||
{ // komunikat od kierownika tu, bo musi być wolna droga i odczekany czas
|
||||
// stania
|
||||
|
||||
80
DynObj.cpp
80
DynObj.cpp
@@ -867,9 +867,11 @@ void __inline TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
if (smWahacze[i])
|
||||
smWahacze[i]->SetRotate(float3(1, 0, 0),
|
||||
fWahaczeAmp * cos(MoverParameters->eAngle));
|
||||
if (Mechanik && (Controller != Humandriver))
|
||||
|
||||
if (Mechanik)
|
||||
{ // rysowanie figurki mechanika
|
||||
if (smMechanik0) // mechanik od strony sprzęgu 0
|
||||
/*
|
||||
if (smMechanik0) // mechanik od strony sprzęgu 0
|
||||
if (smMechanik1) // jak jest drugi, to pierwszego jedynie pokazujemy
|
||||
smMechanik0->iVisible = MoverParameters->ActiveCab > 0;
|
||||
else
|
||||
@@ -881,6 +883,17 @@ void __inline TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
}
|
||||
if (smMechanik1) // mechanik od strony sprzęgu 1
|
||||
smMechanik1->iVisible = MoverParameters->ActiveCab < 0;
|
||||
*/
|
||||
if (MoverParameters->ActiveCab > 0)
|
||||
{
|
||||
btMechanik1.TurnOn();
|
||||
btnOn = true;
|
||||
}
|
||||
if (MoverParameters->ActiveCab < 0)
|
||||
{
|
||||
btMechanik2.TurnOn();
|
||||
btnOn = true;
|
||||
}
|
||||
}
|
||||
// ABu: Przechyly na zakretach
|
||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||
@@ -1572,7 +1585,7 @@ TDynamicObject::TDynamicObject()
|
||||
mdLoad = NULL;
|
||||
mdLowPolyInt = NULL;
|
||||
mdPrzedsionek = NULL;
|
||||
smMechanik0 = smMechanik1 = NULL;
|
||||
//smMechanik0 = smMechanik1 = NULL;
|
||||
smBuforLewy[0] = smBuforLewy[1] = NULL;
|
||||
smBuforPrawy[0] = smBuforPrawy[1] = NULL;
|
||||
enginevolume = 0;
|
||||
@@ -1968,6 +1981,8 @@ TDynamicObject::Init(AnsiString Name, // nazwa pojazdu, np. "EU07-424"
|
||||
btHeadSignals21.Init("headlamp23", mdModel, false);
|
||||
btHeadSignals22.Init("headlamp21", mdModel, false);
|
||||
btHeadSignals23.Init("headlamp22", mdModel, false);
|
||||
btMechanik1.Init("mechanik1", mdLowPolyInt, false);
|
||||
btMechanik2.Init("mechanik2", mdLowPolyInt, false);
|
||||
TurnOff(); // resetowanie zmiennych submodeli
|
||||
// wyszukiwanie zderzakow
|
||||
if (mdModel) // jeśli ma w czym szukać
|
||||
@@ -3356,17 +3371,25 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
|
||||
// NBMX Obsluga drzwi, MC: zuniwersalnione
|
||||
if ((dDoorMoveL < MoverParameters->DoorMaxShiftL) && (MoverParameters->DoorLeftOpened))
|
||||
{
|
||||
rsDoorOpen.Play(vol, 0, MechInside, vPosition);
|
||||
dDoorMoveL += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
|
||||
}
|
||||
if ((dDoorMoveL > 0) && (!MoverParameters->DoorLeftOpened))
|
||||
{
|
||||
rsDoorClose.Play(vol, 0, MechInside, vPosition);
|
||||
dDoorMoveL -= dt1 * MoverParameters->DoorCloseSpeed;
|
||||
if (dDoorMoveL < 0)
|
||||
dDoorMoveL = 0;
|
||||
}
|
||||
if ((dDoorMoveR < MoverParameters->DoorMaxShiftR) && (MoverParameters->DoorRightOpened))
|
||||
{
|
||||
rsDoorOpen.Play(vol, 0, MechInside, vPosition);
|
||||
dDoorMoveR += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
|
||||
}
|
||||
if ((dDoorMoveR > 0) && (!MoverParameters->DoorRightOpened))
|
||||
{
|
||||
rsDoorClose.Play(vol, 0, MechInside, vPosition);
|
||||
dDoorMoveR -= dt1 * MoverParameters->DoorCloseSpeed;
|
||||
if (dDoorMoveR < 0)
|
||||
dDoorMoveR = 0;
|
||||
@@ -3432,7 +3455,8 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
}
|
||||
if (MoverParameters->LoadStatus)
|
||||
LoadUpdate(); // zmiana modelu ładunku
|
||||
return true; // Ra: chyba tak?
|
||||
|
||||
return true; // Ra: chyba tak?
|
||||
}
|
||||
|
||||
bool TDynamicObject::FastUpdate(double dt)
|
||||
@@ -3512,6 +3536,8 @@ void TDynamicObject::TurnOff()
|
||||
btHeadSignals21.TurnOff();
|
||||
btHeadSignals22.TurnOff();
|
||||
btHeadSignals23.TurnOff();
|
||||
btMechanik1.TurnOff();
|
||||
btMechanik2.TurnOff();
|
||||
};
|
||||
|
||||
void TDynamicObject::Render()
|
||||
@@ -3875,7 +3901,11 @@ void TDynamicObject::RenderSounds()
|
||||
sReleaser.TurnOn(MechInside, GetPosition());
|
||||
else
|
||||
sReleaser.TurnOff(MechInside, GetPosition());
|
||||
sReleaser.Update(MechInside, GetPosition());
|
||||
//sReleaser.Update(MechInside, GetPosition());
|
||||
double releaser_vol = 1;
|
||||
if (MoverParameters->BrakePress < 0.1)
|
||||
releaser_vol = MoverParameters->BrakePress * 10;
|
||||
sReleaser.UpdateAF(releaser_vol, 1, MechInside, GetPosition());
|
||||
// if ((MoverParameters->ConverterFlag==false) &&
|
||||
// (MoverParameters->TrainType!=dt_ET22))
|
||||
// if
|
||||
@@ -4244,6 +4274,10 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
{ // tekstura wymienna jest raczej jedynie w "dynamic\"
|
||||
ReplacableSkin =
|
||||
Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
|
||||
AnsiString x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
|
||||
if (!x.IsEmpty())
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID(NULL, NULL, (Global::asCurrentTexturePath + "nowhere").c_str(), 9);
|
||||
/*
|
||||
if ((i = ReplacableSkin.Pos("|")) > 0) // replacable dzielone
|
||||
{
|
||||
iMultiTex = -1;
|
||||
@@ -4302,6 +4336,7 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (iMultiTex > 0)
|
||||
{ // jeśli model ma 4 tekstury
|
||||
ReplacableSkinID[1] = TTexturesManager::GetTextureID(
|
||||
@@ -4336,6 +4371,7 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
ReplacableSkinID[1] = TTexturesManager::GetTextureID(
|
||||
NULL, NULL, ReplacableSkin.c_str(), Global::iDynamicFiltering);
|
||||
if (TTexturesManager::GetAlpha(ReplacableSkinID[1]))
|
||||
@@ -4929,7 +4965,8 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
if (str == AnsiString("pendulumamplitude:"))
|
||||
fWahaczeAmp = Parser->GetNextSymbol().ToDouble();
|
||||
}
|
||||
else if (str == AnsiString("engineer:"))
|
||||
/*
|
||||
else if (str == AnsiString("engineer:"))
|
||||
{ // nazwa submodelu maszynisty
|
||||
str = Parser->GetNextSymbol();
|
||||
smMechanik0 = mdModel->GetFromName(str.c_str());
|
||||
@@ -4944,6 +4981,7 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
// if (smMechanik0) //a jest pierwszy
|
||||
// smMechanik0->WillBeAnimated(); //to będziemy go obracać
|
||||
}
|
||||
*/
|
||||
else if (str == AnsiString("animdoorprefix:"))
|
||||
{ // nazwa animowanych drzwi
|
||||
int i, j, k, m;
|
||||
@@ -5628,7 +5666,7 @@ AnsiString TDynamicObject::TextureTest(AnsiString &name)
|
||||
return ""; // nie znaleziona
|
||||
};
|
||||
|
||||
void TDynamicObject::DestinationSet(AnsiString to)
|
||||
void TDynamicObject::DestinationSet(AnsiString to, AnsiString numer)
|
||||
{ // ustawienie stacji
|
||||
// docelowej oraz wymiennej
|
||||
// tekstury 4, jeśli
|
||||
@@ -5639,25 +5677,39 @@ void TDynamicObject::DestinationSet(AnsiString to)
|
||||
// rozkładu
|
||||
if (abs(iMultiTex) >= 4)
|
||||
return; // jak są 4 tekstury wymienne, to nie zmieniać rozkładem
|
||||
numer = Global::Bezogonkow(numer);
|
||||
asDestination = to;
|
||||
to = Global::Bezogonkow(to); // do szukania pliku obcinamy ogonki
|
||||
AnsiString x;
|
||||
x = TextureTest(asBaseDir + numer + "@" + MoverParameters->TypeName);
|
||||
if (!x.IsEmpty())
|
||||
{
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID( NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
return;
|
||||
}
|
||||
x = TextureTest(asBaseDir + numer );
|
||||
if (!x.IsEmpty())
|
||||
{
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID( NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
return;
|
||||
}
|
||||
if (to.IsEmpty())
|
||||
to = "nowhere";
|
||||
x = TextureTest(asBaseDir + to + "@" +
|
||||
MoverParameters->TypeName); // w pierwszej kolejności z nazwą FIZ/MMD
|
||||
x = TextureTest(asBaseDir + to + "@" + MoverParameters->TypeName); // w pierwszej kolejności z nazwą FIZ/MMD
|
||||
if (!x.IsEmpty())
|
||||
{
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID(
|
||||
NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID( NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
return;
|
||||
}
|
||||
x = TextureTest(asBaseDir + to); // na razie prymitywnie
|
||||
if (!x.IsEmpty())
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID(
|
||||
NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID( NULL, NULL, x.c_str(), 9); // rozmywania 0,1,4,5 nie nadają się
|
||||
else
|
||||
ReplacableSkinID[4] = 0; // 0 to brak? -1 odpada, bo inaczej się będzie mapować
|
||||
{
|
||||
x = TextureTest(asBaseDir + "nowhere"); // jak nie znalazł dedykowanej, to niech daje nowhere
|
||||
if (!x.IsEmpty())
|
||||
ReplacableSkinID[4] = TTexturesManager::GetTextureID(NULL, NULL, x.c_str(), 9);
|
||||
}
|
||||
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
|
||||
// tekstury nr 4
|
||||
};
|
||||
|
||||
8
DynObj.h
8
DynObj.h
@@ -266,8 +266,10 @@ class TDynamicObject
|
||||
TButton btHeadSignals21; // oswietlenie czolowe - tyl
|
||||
TButton btHeadSignals22;
|
||||
TButton btHeadSignals23;
|
||||
TSubModel *smMechanik0; // Ra: mechanik wbudowany w model jako submodel?
|
||||
TSubModel *smMechanik1; // mechanik od strony sprzęgu 1
|
||||
TButton btMechanik1;
|
||||
TButton btMechanik2;
|
||||
//TSubModel *smMechanik0; // Ra: mechanik wbudowany w model jako submodel?
|
||||
//TSubModel *smMechanik1; // mechanik od strony sprzęgu 1
|
||||
double enginevolume; // MC: pomocnicze zeby gladziej silnik buczal
|
||||
|
||||
int iAxles; // McZapkie: to potem mozna skasowac i zastapic iNumAxles
|
||||
@@ -504,7 +506,7 @@ class TDynamicObject
|
||||
void ParamSet(int what, int into);
|
||||
int RouteWish(TTrack *tr); // zapytanie do AI, po którym segmencie skrzyżowania
|
||||
// jechać
|
||||
void DestinationSet(AnsiString to);
|
||||
void DestinationSet(AnsiString to, AnsiString numer);
|
||||
AnsiString TextureTest(AnsiString &name);
|
||||
void OverheadTrack(float o);
|
||||
double MED[9][8]; // lista zmiennych do debugowania hamulca ED
|
||||
|
||||
23
EU07.bpr
23
EU07.bpr
@@ -3,7 +3,7 @@
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="E:\Gry\MaSzyna_15_04\EU07.exe"/>
|
||||
<PROJECT value="EU07.exe"/>
|
||||
<OBJFILES value="QueryParserComp.obj McZapkie\mtable.obj McZapkie\_mover.obj
|
||||
McZapkie\hamulce.obj McZapkie\Oerlikon_ESt.obj EU07.obj dumb3d.obj
|
||||
Camera.obj Texture.obj World.obj Model3d.obj MdlMngr.obj Train.obj
|
||||
@@ -59,8 +59,8 @@ IncludeVerInfo=1
|
||||
AutoIncBuild=0
|
||||
MajorVer=16
|
||||
MinorVer=0
|
||||
Release=1172
|
||||
Build=475
|
||||
Release=1173
|
||||
Build=481
|
||||
Debug=1
|
||||
PreRelease=0
|
||||
Special=0
|
||||
@@ -72,8 +72,8 @@ CodePage=1250
|
||||
[Version Info Keys]
|
||||
CompanyName=EU07 Team
|
||||
FileDescription=MaSzyna EU07-424
|
||||
FileVersion=16.0.1172.475
|
||||
InternalName=10th exe + SPKS + asynch + python
|
||||
FileVersion=16.0.1173.481
|
||||
InternalName=DP+SPKS+asynch+python
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=eu07.exe
|
||||
@@ -84,7 +84,7 @@ Comments=
|
||||
[Excluded Packages]
|
||||
$(BCB)\Bin\bcbsmp50.bpl=Borland C++ Sample Components
|
||||
$(BCB)\Bin\dclqrt50.bpl=QuickReport Components
|
||||
C:\Windows\system32\ibsmp50.bpl=Borland C++ InterBase Alerter Component
|
||||
C:\WINDOWS\system32\ibsmp50.bpl=Borland C++ InterBase Alerter Component
|
||||
$(BCB)\Bin\dcltee50.bpl=TeeChart 5.0 Components
|
||||
$(BCB)\Bin\applet50.bpl=Borland Control Panel Applet Package
|
||||
|
||||
@@ -115,11 +115,12 @@ Item6=GLEW_STATIC;_DEBUG;USE_VERTEX_ARRAYS
|
||||
Item7=_DEBUG
|
||||
|
||||
[HistoryLists\hlFinalOutputDir]
|
||||
Count=4
|
||||
Item0=E:\Gry\MaSzyna_15_04\
|
||||
Item1=E:\Gry\MaSzyna_15_04
|
||||
Item2=D:\EU07\
|
||||
Item3=E:\EU07\
|
||||
Count=5
|
||||
Item0=D:\Maszyna
|
||||
Item1=E:\Gry\MaSzyna_15_04\
|
||||
Item2=E:\Gry\MaSzyna_15_04
|
||||
Item3=D:\EU07\
|
||||
Item4=E:\EU07\
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=McZapkie\
|
||||
|
||||
2
EU07.cpp
2
EU07.cpp
@@ -14,7 +14,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
/*
|
||||
Authors:
|
||||
MarcinW, McZapkie, Shaxbee, ABu, nbmx, youBy, Ra, winger, mamut, Q424,
|
||||
Stele, firleju, szociu, hunter, ZiomalCl and others
|
||||
Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
||||
*/
|
||||
#include "opengl/glew.h"
|
||||
#include "opengl/glut.h"
|
||||
|
||||
21
Globals.cpp
21
Globals.cpp
@@ -49,9 +49,9 @@ double Global::fLuminance = 1.0; // jasno
|
||||
int Global::iReCompile = 0; // zwiêkszany, gdy trzeba odœwie¿yæ siatki
|
||||
HWND Global::hWnd = NULL; // uchwyt okna
|
||||
int Global::iCameraLast = -1;
|
||||
AnsiString Global::asRelease = "16.0.1172.475";
|
||||
AnsiString Global::asRelease = "16.0.1172.481";
|
||||
AnsiString Global::asVersion =
|
||||
"Compilation 2016-05-25, release " + Global::asRelease + "."; // tutaj, bo wysy³any
|
||||
"Compilation 2016-08-24, release " + Global::asRelease + "."; // tutaj, bo wysy³any
|
||||
int Global::iViewMode = 0; // co aktualnie widaæ: 0-kabina, 1-latanie, 2-sprzêgi, 3-dokumenty
|
||||
int Global::iTextMode = 0; // tryb pracy wyœwietlacza tekstowego
|
||||
int Global::iScreenMode[12] = {0, 0, 0, 0, 0, 0,
|
||||
@@ -151,6 +151,7 @@ double Global::fFpsMax = 0.0; // g
|
||||
double Global::fFpsRadiusMax = 3000.0; // maksymalny promieñ renderowania
|
||||
int Global::iFpsRadiusMax = 225; // maksymalny promieñ renderowania
|
||||
double Global::fRadiusFactor = 1.1; // wspó³czynnik jednorazowej zmiany promienia scenerii
|
||||
bool Global::bOldSmudge = false; // U¿ywanie starej smugi
|
||||
|
||||
// parametry testowe (do testowania scenerii i obiektów)
|
||||
bool Global::bWireFrame = false;
|
||||
@@ -176,6 +177,7 @@ double Global::fCalibrateOut[7][6] = {{0, 1, 0, 0, 0, 0},
|
||||
{0, 1, 0, 0, 0, 0}};
|
||||
double Global::fCalibrateOutMax[7] = {0, 0, 0, 0, 0, 0, 0};
|
||||
int Global::iCalibrateOutDebugInfo = -1;
|
||||
int Global::iPoKeysPWM[7] = {0, 1, 2, 3, 4, 5, 6};
|
||||
// parametry przejœciowe (do usuniêcia)
|
||||
// bool Global::bTimeChange=false; //Ra: ZiomalCl wy³¹czy³ star¹ wersjê nocy
|
||||
// bool Global::bRenderAlpha=true; //Ra: wywali³am tê flagê
|
||||
@@ -428,6 +430,8 @@ void Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
iModifyTGA = GetNextSymbol().ToIntDef(0); // domyœlnie 0
|
||||
else if (str == AnsiString("hideconsole")) // hunter-271211: ukrywanie konsoli
|
||||
bHideConsole = (GetNextSymbol().LowerCase() == AnsiString("yes"));
|
||||
else if (str == AnsiString("oldsmudge"))
|
||||
bOldSmudge = (GetNextSymbol().LowerCase() == AnsiString("yes"));
|
||||
else if (str ==
|
||||
AnsiString(
|
||||
"rollfix")) // Ra: poprawianie przechy³ki, aby wewnêtrzna szyna by³a "pozioma"
|
||||
@@ -498,6 +502,12 @@ void Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
}
|
||||
else if (str == AnsiString("calibrateoutdebuginfo")) // wyjœcie z info o przebiegu kalibracji
|
||||
iCalibrateOutDebugInfo = GetNextSymbol().ToInt();
|
||||
else if (str == AnsiString("pwm")) // zmiana numerów wyjœæ PWM
|
||||
{
|
||||
int pwm_out = GetNextSymbol().ToInt();
|
||||
int pwm_no = GetNextSymbol().ToInt();
|
||||
iPoKeysPWM[pwm_out] = pwm_no;
|
||||
}
|
||||
else if (str == AnsiString("brakestep")) // krok zmiany hamulca dla klawiszy [Num3] i [Num9]
|
||||
fBrakeStep = GetNextSymbol().ToDouble();
|
||||
else if (str ==
|
||||
@@ -511,10 +521,8 @@ void Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
asLang = GetNextSymbol(); // domyœlny jêzyk - http://tools.ietf.org/html/bcp47
|
||||
else if (str == AnsiString("opengl")) // deklarowana wersja OpenGL, ¿eby powstrzymaæ b³êdy
|
||||
fOpenGL = GetNextSymbol().ToDouble(); // wymuszenie wersji OpenGL
|
||||
else if (str == AnsiString("pyscreenrendererpriority")) // priority of python screen
|
||||
// renderer
|
||||
TPythonInterpreter::getInstance()->setScreenRendererPriority(
|
||||
GetNextSymbol().LowerCase().c_str());
|
||||
else if (str == AnsiString("pyscreenrendererpriority")) // priority of python screen renderer
|
||||
TPythonInterpreter::getInstance()->setScreenRendererPriority(GetNextSymbol().LowerCase().c_str());
|
||||
else if (str == AnsiString("background"))
|
||||
{
|
||||
Background[0] = GetNextSymbol().ToDouble(); // r
|
||||
@@ -911,5 +919,4 @@ double Global::CutValueToRange(double min, double value, double max)
|
||||
return value;
|
||||
};
|
||||
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
@@ -280,6 +280,8 @@ class Global
|
||||
static int iSlowMotionMask; // maska wy³¹czanych w³aœciwoœci
|
||||
static int iModifyTGA; // czy korygowaæ pliki TGA dla szybszego wczytywania
|
||||
static bool bHideConsole; // hunter-271211: ukrywanie konsoli
|
||||
static bool bOldSmudge; // U¿ywanie starej smugi
|
||||
|
||||
static TWorld *pWorld; // wskaŸnik na œwiat do usuwania pojazdów
|
||||
static TAnimModel *pTerrainCompact; // obiekt terenu do ewentualnego zapisania w pliku
|
||||
static AnsiString asTerrainModel; // nazwa obiektu terenu do zapisania w pliku
|
||||
@@ -309,7 +311,9 @@ class Global
|
||||
static AnsiString asLang; // domyœlny jêzyk - http://tools.ietf.org/html/bcp47
|
||||
static int iHiddenEvents; // czy ³¹czyæ eventy z torami poprzez nazwê toru
|
||||
static TTextSound *tsRadioBusy[10]; // zajêtoœæ kana³ów radiowych (wskaŸnik na odgrywany dŸwiêk)
|
||||
// metody
|
||||
static int iPoKeysPWM[7]; // numery wejϾ dla PWM
|
||||
|
||||
// metody
|
||||
static void TrainDelete(TDynamicObject *d);
|
||||
static void ConfigParse(Queryparsercomp::TQueryParserComp *qp, cParser *cp = NULL);
|
||||
static AnsiString GetNextSymbol();
|
||||
@@ -320,6 +324,7 @@ class Global
|
||||
static AnsiString Bezogonkow(AnsiString str, bool _ = false);
|
||||
static double Min0RSpeed(double vel1, double vel2);
|
||||
static double CutValueToRange(double min, double value, double max);
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
30
Ground.cpp
30
Ground.cpp
@@ -3785,13 +3785,13 @@ bool TGround::AddToQuery(TEvent *Event, TDynamicObject *Node)
|
||||
Event->Params[5].asMemCell->PutCommand(
|
||||
Event->Params[6].asTrack->Dynamics[i]->Mechanik,
|
||||
&Event->Params[4].nGroundNode->pCenter);
|
||||
if (DebugModeFlag)
|
||||
//if (DebugModeFlag)
|
||||
WriteLog("EVENT EXECUTED: AddValues & Track command - " +
|
||||
AnsiString(Event->Params[0].asText) + " " +
|
||||
AnsiString(Event->Params[1].asdouble) + " " +
|
||||
AnsiString(Event->Params[2].asdouble));
|
||||
}
|
||||
else if (DebugModeFlag)
|
||||
//else if (DebugModeFlag)
|
||||
WriteLog("EVENT EXECUTED: AddValues - " +
|
||||
AnsiString(Event->Params[0].asText) + " " +
|
||||
AnsiString(Event->Params[1].asdouble) + " " +
|
||||
@@ -3842,8 +3842,28 @@ bool TGround::EventConditon(TEvent *e)
|
||||
{ // porównanie wartoœci
|
||||
if (tmpEvent->Params[9].asMemCell->Compare(e->Params[10].asText, e->Params[11].asdouble,
|
||||
e->Params[12].asdouble, e->iFlags))
|
||||
{ //logowanie spe³nionych warunków
|
||||
LogComment = e->Params[9].asMemCell->Text() + AnsiString(" ") +
|
||||
FloatToStrF(e->Params[9].asMemCell->Value1(), ffFixed, 8, 2) + " " +
|
||||
FloatToStrF(tmpEvent->Params[9].asMemCell->Value2(), ffFixed, 8, 2) +
|
||||
" = ";
|
||||
if (TestFlag(e->iFlags, conditional_memstring))
|
||||
LogComment += AnsiString(tmpEvent->Params[10].asText);
|
||||
else
|
||||
LogComment += "*";
|
||||
if (TestFlag(tmpEvent->iFlags, conditional_memval1))
|
||||
LogComment += " " + FloatToStrF(tmpEvent->Params[11].asdouble, ffFixed, 8, 2);
|
||||
else
|
||||
LogComment += " *";
|
||||
if (TestFlag(tmpEvent->iFlags, conditional_memval2))
|
||||
LogComment += " " + FloatToStrF(tmpEvent->Params[12].asdouble, ffFixed, 8, 2);
|
||||
else
|
||||
LogComment += " *";
|
||||
WriteLog(LogComment.c_str());
|
||||
return true;
|
||||
else if (Global::iWriteLogEnabled && DebugModeFlag)
|
||||
}
|
||||
//else if (Global::iWriteLogEnabled && DebugModeFlag) //zawsze bo to bardzo istotne w debugowaniu scenariuszy
|
||||
else
|
||||
{ // nie zgadza siê, wiêc sprawdzmy, co
|
||||
LogComment = e->Params[9].asMemCell->Text() + AnsiString(" ") +
|
||||
FloatToStrF(e->Params[9].asMemCell->Value1(), ffFixed, 8, 2) + " " +
|
||||
@@ -3957,13 +3977,13 @@ bool TGround::CheckQuery()
|
||||
tmpEvent->Params[5].asMemCell->PutCommand(
|
||||
tmpEvent->Params[6].asTrack->Dynamics[i]->Mechanik,
|
||||
&tmpEvent->Params[4].nGroundNode->pCenter);
|
||||
if (DebugModeFlag)
|
||||
//if (DebugModeFlag)
|
||||
WriteLog("Type: UpdateValues & Track command - " +
|
||||
AnsiString(tmpEvent->Params[0].asText) + " " +
|
||||
AnsiString(tmpEvent->Params[1].asdouble) + " " +
|
||||
AnsiString(tmpEvent->Params[2].asdouble));
|
||||
}
|
||||
else if (DebugModeFlag)
|
||||
else //if (DebugModeFlag)
|
||||
WriteLog("Type: UpdateValues - " + AnsiString(tmpEvent->Params[0].asText) +
|
||||
" " + AnsiString(tmpEvent->Params[1].asdouble) + " " +
|
||||
AnsiString(tmpEvent->Params[2].asdouble));
|
||||
|
||||
@@ -4981,7 +4981,7 @@ var b:byte;
|
||||
const Vepsilon=1e-5; Aepsilon=1e-3; //ASBSpeed=0.8;
|
||||
begin
|
||||
TotalCurrent:=0;
|
||||
hvc:=Max0R(Max0R(PantFrontVolt,PantRearVolt),ElectricTraction.TractionVoltage);
|
||||
hvc:=Max0R(Max0R(PantFrontVolt,PantRearVolt),ElectricTraction.TractionVoltage*0.9);
|
||||
for b:=0 to 1 do //przekazywanie napiec
|
||||
if ((Couplers[b].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[b].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then
|
||||
begin
|
||||
|
||||
@@ -100,7 +100,7 @@ end;
|
||||
|
||||
function TTrainParameters.CheckTrainLatency: real;
|
||||
begin
|
||||
if (LastStationLatency>1.0) or (LastStationLatency<-1.0) then
|
||||
if (LastStationLatency>1.0) or (LastStationLatency<0) then
|
||||
CheckTrainLatency:=LastStationLatency {spoznienie + lub do przodu - z tolerancja 1 min}
|
||||
else
|
||||
CheckTrainLatency:=0
|
||||
|
||||
@@ -187,11 +187,11 @@ void TMoverParameters::BrakeLevelSet(double b)
|
||||
if (fBrakeCtrlPos == b)
|
||||
return; // nie przeliczaæ, jak nie ma zmiany
|
||||
fBrakeCtrlPos = b;
|
||||
BrakeCtrlPosR = b;
|
||||
if (fBrakeCtrlPos < Handle->GetPos(bh_MIN))
|
||||
fBrakeCtrlPos = Handle->GetPos(bh_MIN); // odciêcie
|
||||
else if (fBrakeCtrlPos > Handle->GetPos(bh_MAX))
|
||||
fBrakeCtrlPos = Handle->GetPos(bh_MAX);
|
||||
BrakeCtrlPosR = fBrakeCtrlPos;
|
||||
int x = floor(fBrakeCtrlPos); // jeœli odwo³ujemy siê do BrakeCtrlPos w poœrednich, to musi byæ
|
||||
// obciête a nie zaokr¹gone
|
||||
while ((x > BrakeCtrlPos) && (BrakeCtrlPos < BrakeCtrlPosNo)) // jeœli zwiêkszy³o siê o 1
|
||||
|
||||
16
PyInt.cpp
16
PyInt.cpp
@@ -208,30 +208,30 @@ void TPythonInterpreter::setScreenRendererPriority(const char *priority)
|
||||
if (strncmp(priority, "normal", 6) == 0)
|
||||
{
|
||||
_screenRendererPriority = THREAD_PRIORITY_NORMAL;
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
//#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog("Python screen renderer priority: Normal");
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
//#endif // _PY_INT_MORE_LOG
|
||||
}
|
||||
else if (strncmp(priority, "lower", 5) == 0)
|
||||
{
|
||||
_screenRendererPriority = THREAD_PRIORITY_BELOW_NORMAL;
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
//#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog("Python screen renderer priority: Lower");
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
//#endif // _PY_INT_MORE_LOG
|
||||
}
|
||||
else if (strncmp(priority, "lowest", 6) == 0)
|
||||
{
|
||||
_screenRendererPriority = THREAD_PRIORITY_LOWEST;
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
//#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog("Python screen renderer priority: Lowest");
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
//#endif // _PY_INT_MORE_LOG
|
||||
}
|
||||
else if (strncmp(priority, "idle", 4) == 0)
|
||||
{
|
||||
_screenRendererPriority = THREAD_PRIORITY_IDLE;
|
||||
#ifdef _PY_INT_MORE_LOG
|
||||
//#ifdef _PY_INT_MORE_LOG
|
||||
WriteLog("Python screen renderer priority: Idle");
|
||||
#endif // _PY_INT_MORE_LOG
|
||||
//#endif // _PY_INT_MORE_LOG
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
37
Train.cpp
37
Train.cpp
@@ -459,7 +459,10 @@ void TTrain::OnKeyDown(int cKey)
|
||||
if (mvOccupied->BatterySwitch(true)) // bateria potrzebna np. do zapalenia œwiate³
|
||||
{
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
SetLights();
|
||||
if (mvOccupied->LightsPosNo > 0)
|
||||
{
|
||||
SetLights();
|
||||
}
|
||||
if (TestFlag(mvOccupied->SecuritySystem.SystemType,
|
||||
2)) // Ra: znowu w kabinie jest coœ, co byæ nie powinno!
|
||||
{
|
||||
@@ -2797,7 +2800,6 @@ bool TTrain::Update()
|
||||
fHCurrent[(mvControlled->TrainType & dt_EZT) ? 0 : 1]); // pierwszy amperomierz; dla
|
||||
// EZT pr¹d ca³kowity
|
||||
Console::ValueSet(6, fTachoVelocity); ////Ra: prêdkoœæ na pin 43 - wyjœcie
|
||||
Console::ValueSet(7, mvControlled->MainCtrlActualPos + mvControlled->ScndCtrlActualPos); //nbmx: Wal kulakowy
|
||||
/// analogowe (to nie jest PWM);
|
||||
/// skakanie zapewnia mechanika
|
||||
/// napêdu
|
||||
@@ -3137,7 +3139,7 @@ bool TTrain::Update()
|
||||
dsbWejscie_na_drugi_uklad->Play(0, 0, 0);
|
||||
}
|
||||
}
|
||||
// potem dorobic bufory, sprzegi jako RealSound.
|
||||
|
||||
if (TestFlag(mvOccupied->SoundFlag, sound_bufferclamp)) // zderzaki uderzaja o siebie
|
||||
{
|
||||
if (TestFlag(mvOccupied->SoundFlag, sound_loud))
|
||||
@@ -4094,33 +4096,42 @@ bool TTrain::Update()
|
||||
if (TestFlag(mvOccupied->SecuritySystem.Status, s_CAalarm) ||
|
||||
TestFlag(mvOccupied->SecuritySystem.Status, s_SHPalarm))
|
||||
{
|
||||
if(dsbBuzzer)
|
||||
{
|
||||
dsbBuzzer->GetStatus(&stat);
|
||||
if (!(stat & DSBSTATUS_PLAYING))
|
||||
{
|
||||
dsbBuzzer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
Console::BitsSet(1 << 14); // ustawienie bitu 16 na PoKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dsbBuzzer)
|
||||
{
|
||||
dsbBuzzer->GetStatus(&stat);
|
||||
if (stat & DSBSTATUS_PLAYING)
|
||||
{
|
||||
dsbBuzzer->Stop();
|
||||
Console::BitsClear(1 << 14); // ustawienie bitu 16 na PoKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // wylaczone
|
||||
{
|
||||
btLampkaCzuwaka.TurnOff();
|
||||
btLampkaSHP.TurnOff();
|
||||
if(dsbBuzzer)
|
||||
{
|
||||
dsbBuzzer->GetStatus(&stat);
|
||||
if (stat & DSBSTATUS_PLAYING)
|
||||
{
|
||||
dsbBuzzer->Stop();
|
||||
Console::BitsClear(1 << 14); // ustawienie bitu 16 na PoKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************
|
||||
@@ -5012,7 +5023,12 @@ bool TTrain::LoadMMediaFile(AnsiString asFileName)
|
||||
// Parser->LoadStringToParse(asFile);
|
||||
Parser->First();
|
||||
str = "";
|
||||
//Wartoœci domyœlne by nie wysypywa³o przy wybrakowanych mmd @240816 Stele
|
||||
dsbPneumaticSwitch = TSoundsManager::GetFromName("silence1.wav", true);
|
||||
dsbBufferClamp = TSoundsManager::GetFromName("en57_bufferclamp.wav", true);
|
||||
dsbCouplerDetach = TSoundsManager::GetFromName("couplerdetach.wav", true);
|
||||
dsbCouplerStretch = TSoundsManager::GetFromName("en57_couplerstretch.wav", true);
|
||||
dsbCouplerAttach = TSoundsManager::GetFromName("couplerattach.wav", true);
|
||||
while ((!Parser->EndOfFile) && (str != AnsiString("internaldata:")))
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
@@ -5107,16 +5123,23 @@ bool TTrain::LoadMMediaFile(AnsiString asFileName)
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
dsbCouplerAttach = TSoundsManager::GetFromName(str.c_str(), true);
|
||||
dsbCouplerStretch = TSoundsManager::GetFromName(
|
||||
"en57_couplerstretch.wav", true); // McZapkie-090503: PROWIZORKA!!!
|
||||
}
|
||||
else if (str == AnsiString("couplerstretch:")) // laczenie:
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
dsbCouplerStretch = TSoundsManager::GetFromName(str.c_str(), true); // McZapkie-090503: PROWIZORKA!!! "en57_couplerstretch.wav"
|
||||
}
|
||||
else if (str == AnsiString("couplerdetach:")) // rozlaczanie:
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
dsbCouplerDetach = TSoundsManager::GetFromName(str.c_str(), true);
|
||||
dsbBufferClamp = TSoundsManager::GetFromName(
|
||||
"en57_bufferclamp.wav", true); // McZapkie-090503: PROWIZORKA!!!
|
||||
|
||||
}
|
||||
else if (str == AnsiString("bufferclamp:")) // laczenie:
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
dsbBufferClamp = TSoundsManager::GetFromName(str.c_str(), true); // McZapkie-090503: PROWIZORKA!!! "en57_bufferclamp.wav"
|
||||
}
|
||||
else if (str == AnsiString("ignition:"))
|
||||
{ // odpalanie silnika
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
|
||||
@@ -26,6 +26,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "DynObj.h"
|
||||
#include "Ground.h"
|
||||
#include "Event.h"
|
||||
#include "Driver.h"
|
||||
|
||||
TTrackFollower::TTrackFollower()
|
||||
{
|
||||
@@ -132,7 +133,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
{
|
||||
if (iSetFlag(iEventFlag, -1)) // zawsze zeruje flagę sprawdzenia, jak mechanik
|
||||
// dosiądzie, to się nie wykona
|
||||
if (Owner->Mechanik) // tylko dla jednego członu
|
||||
if (Owner->Mechanik->Primary()) // tylko dla jednego członu
|
||||
// if (TestFlag(iEventFlag,1)) //McZapkie-280503: wyzwalanie event tylko dla
|
||||
// pojazdow z obsada
|
||||
if (bPrimary && pCurrentTrack->evEvent1 &&
|
||||
@@ -154,7 +155,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
{
|
||||
if (iSetFlag(iEventFlag, -2)) // zawsze ustawia flagę sprawdzenia, jak mechanik
|
||||
// dosiądzie, to się nie wykona
|
||||
if (Owner->Mechanik) // tylko dla jednego członu
|
||||
if (Owner->Mechanik->Primary()) // tylko dla jednego członu
|
||||
// if (TestFlag(iEventFlag,2)) //sprawdzanie jest od razu w pierwszym
|
||||
// warunku
|
||||
if (bPrimary && pCurrentTrack->evEvent2 &&
|
||||
@@ -173,7 +174,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
}
|
||||
else // if (fDistance==0) //McZapkie-140602: wyzwalanie zdarzenia gdy pojazd stoi
|
||||
{
|
||||
if (Owner->Mechanik) // tylko dla jednego członu
|
||||
if (Owner->Mechanik->Primary()) // tylko dla jednego członu
|
||||
if (pCurrentTrack->evEvent0)
|
||||
if (!pCurrentTrack->evEvent0->iQueued)
|
||||
Global::AddToQuery(pCurrentTrack->evEvent0, Owner);
|
||||
|
||||
119
World.cpp
119
World.cpp
@@ -180,8 +180,8 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
return false;
|
||||
#endif
|
||||
WriteLog("Online documentation and additional files on http://eu07.pl");
|
||||
WriteLog("Authors: Marcin_EU, McZapkie, ABu, Winger, Tolaris, nbmx_EU, OLO_EU, Bart, Quark-t, "
|
||||
"ShaXbee, Oli_EU, youBy, KURS90, Ra, hunter and others");
|
||||
WriteLog("Authors: Marcin_EU, McZapkie, ABu, Winger, Tolaris, nbmx, OLO_EU, Bart, Quark-t, "
|
||||
"ShaXbee, Oli_EU, youBy, KURS90, Ra, hunter, szociu, Stele, Q, firleju and others");
|
||||
WriteLog("Renderer:");
|
||||
WriteLog((char *)glGetString(GL_RENDERER));
|
||||
WriteLog("Vendor:");
|
||||
@@ -664,6 +664,9 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
}
|
||||
// glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //{Texture blends with object
|
||||
// background}
|
||||
if (Global::bOldSmudge == true)
|
||||
light = TTexturesManager::GetTextureID(szTexturePath, szSceneryPath, "smuga.tga");
|
||||
else
|
||||
light = TTexturesManager::GetTextureID(szTexturePath, szSceneryPath, "smuga2.tga");
|
||||
// Camera.Reset();
|
||||
ResetTimers();
|
||||
@@ -1497,53 +1500,97 @@ bool TWorld::Update()
|
||||
// 3. jeœli smuga w³aczona, wyrenderowaæ pojazd u¿ytkownia po dodaniu smugi do sceny
|
||||
if (Train->Controlled()->Battery)
|
||||
{ // trochê na skróty z t¹ bateri¹
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE);
|
||||
// glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_DST_COLOR);
|
||||
if (Global::bOldSmudge == true)
|
||||
{
|
||||
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_DST_COLOR);
|
||||
// glBlendFunc(GL_SRC_ALPHA_SATURATE,GL_ONE);
|
||||
glDepthFunc(GL_GEQUAL);
|
||||
glAlphaFunc(GL_GREATER, 0.004);
|
||||
// glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glColor4f(0.15f, 0.15f, 0.15f, 0.25f);
|
||||
glBindTexture(GL_TEXTURE_2D, light); // Select our texture
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glBindTexture(GL_TEXTURE_2D, light); // Select our texture
|
||||
glBegin(GL_QUADS);
|
||||
float fSmudge =
|
||||
Train->Dynamic()->MoverParameters->DimHalf.y + 7; // gdzie zaczynaæ smugê
|
||||
if (Train->Controlled()->iLights[0] & 21)
|
||||
{ // wystarczy jeden zapalony z przodu
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
float C = (36 - i*0.5)*0.05*0.1;
|
||||
glColor4f(C, C, C, 0.25f);
|
||||
glTexCoord2f(0, 0); glVertex3f(-10 / 2 - 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(10 / 2 + 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(10 / 2 + 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(-10 / 2 - 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(15.0, 0.0, +fSmudge); // rysowanie wzglêdem po³o¿enia modelu
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(-15.0, 0.0, +fSmudge);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(-15.0, 2.5, 250.0);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(15.0, 2.5, 250.0);
|
||||
}
|
||||
if (Train->Controlled()->iLights[1] & 21)
|
||||
{ // wystarczy jeden zapalony z ty³u
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
glTexCoord2f(0, 0); glVertex3f(10 / 2 + 3 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(-10 / 2 - 3 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(-10 / 2 - 3 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(10 / 2 + 3 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(-15.0, 0.0, -fSmudge);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(15.0, 0.0, -fSmudge);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(15.0, 2.5, -250.0);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(-15.0, 2.5, -250.0);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// glEnable(GL_DEPTH_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.04);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glEnable(GL_LIGHTING); //i tak siê w³¹czy potem
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// glEnable(GL_LIGHTING); //i tak siê w³¹czy potem
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE);
|
||||
glDepthFunc(GL_GEQUAL);
|
||||
glAlphaFunc(GL_GREATER, 0.004);
|
||||
// glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
//glColor4f(0.15f, 0.15f, 0.15f, 0.25f);
|
||||
glBindTexture(GL_TEXTURE_2D, light); // Select our texture
|
||||
//float ddl = (0.15*Global::diffuseDayLight[0]+0.295*Global::diffuseDayLight[1]+0.055*Global::diffuseDayLight[2]); //0.24:0
|
||||
glBegin(GL_QUADS);
|
||||
float fSmudge = Train->Dynamic()->MoverParameters->DimHalf.y + 7; // gdzie zaczynaæ smugê
|
||||
if (Train->Controlled()->iLights[0] & 21)
|
||||
{ // wystarczy jeden zapalony z przodu
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
//float C = (36 - i*0.5)*0.005*(1.5 - sqrt(ddl));
|
||||
float C = (36 - i*0.5)*0.005*sqrt((1/sqrt(Global::fLuminance+0.015))-1);
|
||||
glColor4f(C, C, C, 0.25f);
|
||||
glTexCoord2f(0, 0); glVertex3f(-10 / 2 - 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(10 / 2 + 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(10 / 2 + 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(-10 / 2 - 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
if (Train->Controlled()->iLights[1] & 21)
|
||||
{ // wystarczy jeden zapalony z ty³u
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
float C = (36 - i*0.5)*0.005*sqrt((1/sqrt(Global::fLuminance+0.015))-1);
|
||||
glColor4f(C, C, C, 0.25f);
|
||||
glTexCoord2f(0, 0); glVertex3f(10 / 2 + 2 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(-10 / 2 - 2 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(-10 / 2 - 2 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(10 / 2 + 2 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// glEnable(GL_DEPTH_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.04);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glEnable(GL_LIGHTING); //i tak siê w³¹czy potem
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
}
|
||||
glEnable(GL_LIGHTING); // po renderowaniu smugi jest to wy³¹czone
|
||||
// Ra: pojazd u¿ytkownika nale¿a³o by renderowaæ po smudze, aby go nie rozœwietla³a
|
||||
|
||||
Reference in New Issue
Block a user