mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
42
Driver.cpp
42
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
|
||||
}
|
||||
@@ -1052,12 +1071,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 +1092,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 +1164,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 +1178,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 +1197,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 +1376,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 +1396,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 +1421,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");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
19
EU07.bpr
19
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
|
||||
@@ -60,7 +60,7 @@ AutoIncBuild=0
|
||||
MajorVer=16
|
||||
MinorVer=0
|
||||
Release=1173
|
||||
Build=475
|
||||
Build=477
|
||||
Debug=1
|
||||
PreRelease=0
|
||||
Special=0
|
||||
@@ -72,7 +72,7 @@ CodePage=1250
|
||||
[Version Info Keys]
|
||||
CompanyName=EU07 Team
|
||||
FileDescription=MaSzyna EU07-424
|
||||
FileVersion=16.0.1173.475
|
||||
FileVersion=16.0.1173.477
|
||||
InternalName=DP+SPKS+asynch+python
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
@@ -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\
|
||||
|
||||
13
Globals.cpp
13
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.476";
|
||||
AnsiString Global::asRelease = "16.0.1172.477";
|
||||
AnsiString Global::asVersion =
|
||||
"Compilation 2016-05-25, release " + Global::asRelease + "."; // tutaj, bo wysy³any
|
||||
"Compilation 2016-06-10, 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;
|
||||
@@ -428,6 +429,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"
|
||||
@@ -511,10 +514,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
|
||||
|
||||
@@ -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
|
||||
|
||||
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));
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
115
World.cpp
115
World.cpp
@@ -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(ddl+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(ddl+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