mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 09:49:19 +02:00
Change clang format
Add AlignTrailingComments: false Add AllowShortFunctionsOnASingleLine: Empty
This commit is contained in:
@@ -4,9 +4,11 @@ IndentWidth: 4
|
|||||||
---
|
---
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
AlignEscapedNewlinesLeft: true
|
AlignEscapedNewlinesLeft: true
|
||||||
|
AlignTrailingComments: false
|
||||||
BreakBeforeBraces: Allman
|
BreakBeforeBraces: Allman
|
||||||
BreakBeforeTernaryOperators: false
|
BreakBeforeTernaryOperators: false
|
||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortBlocksOnASingleLine: false
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
ColumnLimit: 100
|
ColumnLimit: 100
|
||||||
---
|
---
|
||||||
|
|||||||
11
AdvSound.cpp
11
AdvSound.cpp
@@ -32,10 +32,12 @@ TAdvancedSound::~TAdvancedSound()
|
|||||||
// SoundShut.Stop();
|
// SoundShut.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAdvancedSound::Free() {}
|
void TAdvancedSound::Free()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff,
|
void TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation,
|
||||||
double DistanceAttenuation, vector3 pPosition)
|
vector3 pPosition)
|
||||||
{
|
{
|
||||||
SoundStart.Init(NameOn, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
SoundStart.Init(NameOn, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
||||||
SoundCommencing.Init(Name, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
SoundCommencing.Init(Name, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
||||||
@@ -131,8 +133,7 @@ void TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside,
|
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition)
|
||||||
vector3 NewPosition)
|
|
||||||
{ // update, ale z amplituda i czestotliwoscia
|
{ // update, ale z amplituda i czestotliwoscia
|
||||||
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
|
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,9 +14,14 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "AirCoupler.h"
|
#include "AirCoupler.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
TAirCoupler::TAirCoupler() { Clear(); }
|
TAirCoupler::TAirCoupler()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
TAirCoupler::~TAirCoupler() {}
|
TAirCoupler::~TAirCoupler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int TAirCoupler::GetStatus()
|
int TAirCoupler::GetStatus()
|
||||||
{ // zwraca 1, jeœli istnieje model prosty, 2 gdy skoœny
|
{ // zwraca 1, jeœli istnieje model prosty, 2 gdy skoœny
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void TAnimContainer::AnimSetVMD(double fNewSpeed)
|
|||||||
//-+-+ - dłoń ma w górze zamiast na pasie w pozycji początkowej
|
//-+-+ - dłoń ma w górze zamiast na pasie w pozycji początkowej
|
||||||
//+--+ - głowa do tyłu (broda w górę) w pozycji początkowej
|
//+--+ - głowa do tyłu (broda w górę) w pozycji początkowej
|
||||||
//--++ - pozycja początkowa dobra, trąca u góry, ale z rękami jakoś nie tak, kółko w
|
//--++ - pozycja początkowa dobra, trąca u góry, ale z rękami jakoś nie tak, kółko w
|
||||||
//przeciwną stronę
|
// przeciwną stronę
|
||||||
//++++ - kładzie się brzuchem do góry
|
//++++ - kładzie się brzuchem do góry
|
||||||
//-+++ - ręce w górze na początku, zamiast w dół, łokieć jakby w przeciwną stronę
|
//-+++ - ręce w górze na początku, zamiast w dół, łokieć jakby w przeciwną stronę
|
||||||
//+-++ - nie podnosi ręki do głowy
|
//+-++ - nie podnosi ręki do głowy
|
||||||
@@ -684,10 +684,12 @@ void TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool TAnimModel::TerrainLoaded()
|
bool TAnimModel::TerrainLoaded()
|
||||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||||
return (this ? pModel != NULL : false); };
|
return (this ? pModel != NULL : false);
|
||||||
|
};
|
||||||
int TAnimModel::TerrainCount()
|
int TAnimModel::TerrainCount()
|
||||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||||
return pModel ? pModel->TerrainCount() : 0; };
|
return pModel ? pModel->TerrainCount() : 0;
|
||||||
|
};
|
||||||
TSubModel *__fastcall TAnimModel::TerrainSquare(int n)
|
TSubModel *__fastcall TAnimModel::TerrainSquare(int n)
|
||||||
{ // pobieranie wskaźników do pierwszego submodelu
|
{ // pobieranie wskaźników do pierwszego submodelu
|
||||||
return pModel ? pModel->TerrainSquare(n) : 0;
|
return pModel ? pModel->TerrainSquare(n) : 0;
|
||||||
|
|||||||
15
AnimModel.h
15
AnimModel.h
@@ -80,7 +80,10 @@ class TAnimContainer
|
|||||||
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
||||||
// std::string inline GetName() { return std::string(pSubModel?pSubModel->pName:"");
|
// std::string inline GetName() { return std::string(pSubModel?pSubModel->pName:"");
|
||||||
// };
|
// };
|
||||||
char *__fastcall NameGet() { return (pSubModel ? pSubModel->pName : NULL); };
|
char *__fastcall NameGet()
|
||||||
|
{
|
||||||
|
return (pSubModel ? pSubModel->pName : NULL);
|
||||||
|
};
|
||||||
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
||||||
// fNewRotateSpeed, bool bResetAngle=false);
|
// fNewRotateSpeed, bool bResetAngle=false);
|
||||||
void SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed);
|
void SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed);
|
||||||
@@ -90,7 +93,10 @@ class TAnimContainer
|
|||||||
void UpdateModel();
|
void UpdateModel();
|
||||||
void UpdateModelIK();
|
void UpdateModelIK();
|
||||||
bool InMovement(); // czy w trakcie animacji?
|
bool InMovement(); // czy w trakcie animacji?
|
||||||
double _fastcall AngleGet() { return vRotateAngles.z; }; // jednak ostatnia, T3D ma inny uk³ad
|
double _fastcall AngleGet()
|
||||||
|
{
|
||||||
|
return vRotateAngles.z;
|
||||||
|
}; // jednak ostatnia, T3D ma inny uk³ad
|
||||||
vector3 _fastcall TransGet()
|
vector3 _fastcall TransGet()
|
||||||
{
|
{
|
||||||
return vector3(-vTranslation.x, vTranslation.z, vTranslation.y);
|
return vector3(-vTranslation.x, vTranslation.z, vTranslation.y);
|
||||||
@@ -101,7 +107,10 @@ class TAnimContainer
|
|||||||
pSubModel->WillBeAnimated();
|
pSubModel->WillBeAnimated();
|
||||||
};
|
};
|
||||||
void EventAssign(TEvent *ev);
|
void EventAssign(TEvent *ev);
|
||||||
TEvent *__fastcall Event() { return evDone; };
|
TEvent *__fastcall Event()
|
||||||
|
{
|
||||||
|
return evDone;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class TAnimAdvanced
|
class TAnimAdvanced
|
||||||
|
|||||||
10
Button.h
10
Button.h
@@ -25,7 +25,10 @@ class TButton
|
|||||||
TButton();
|
TButton();
|
||||||
~TButton();
|
~TButton();
|
||||||
void Clear(int i = -1);
|
void Clear(int i = -1);
|
||||||
inline void FeedbackBitSet(int i) { iFeedbackBit = 1 << i; };
|
inline void FeedbackBitSet(int i)
|
||||||
|
{
|
||||||
|
iFeedbackBit = 1 << i;
|
||||||
|
};
|
||||||
inline void Turn(bool to)
|
inline void Turn(bool to)
|
||||||
{
|
{
|
||||||
bOn = to;
|
bOn = to;
|
||||||
@@ -46,7 +49,10 @@ class TButton
|
|||||||
bOn = !bOn;
|
bOn = !bOn;
|
||||||
Update();
|
Update();
|
||||||
};
|
};
|
||||||
inline bool Active() { return (pModelOn) || (pModelOff); };
|
inline bool Active()
|
||||||
|
{
|
||||||
|
return (pModelOn) || (pModelOff);
|
||||||
|
};
|
||||||
void Init(AnsiString asName, TModel3d *pModel, bool bNewOn = false);
|
void Init(AnsiString asName, TModel3d *pModel, bool bNewOn = false);
|
||||||
void Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
void Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
||||||
};
|
};
|
||||||
|
|||||||
5
Camera.h
5
Camera.h
@@ -38,7 +38,10 @@ class TCamera
|
|||||||
vector3 CrossPos;
|
vector3 CrossPos;
|
||||||
double CrossDist;
|
double CrossDist;
|
||||||
void Init(vector3 NPos, vector3 NAngle);
|
void Init(vector3 NPos, vector3 NAngle);
|
||||||
void Reset() { Pitch = Yaw = Roll = 0; };
|
void Reset()
|
||||||
|
{
|
||||||
|
Pitch = Yaw = Roll = 0;
|
||||||
|
};
|
||||||
void OnCursorMove(double x, double y);
|
void OnCursorMove(double x, double y);
|
||||||
void Update();
|
void Update();
|
||||||
vector3 GetDirection();
|
vector3 GetDirection();
|
||||||
|
|||||||
15
Console.cpp
15
Console.cpp
@@ -274,7 +274,10 @@ void Console::BitsUpdate(int mask)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Console::Pressed(int x) { return Global::bActive && (GetKeyState(x) < 0); }; // na razie tak - czyta się tylko klawiatura
|
bool Console::Pressed(int x)
|
||||||
|
{
|
||||||
|
return Global::bActive && (GetKeyState(x) < 0);
|
||||||
|
}; // na razie tak - czyta się tylko klawiatura
|
||||||
|
|
||||||
void Console::ValueSet(int x, double y)
|
void Console::ValueSet(int x, double y)
|
||||||
{ // ustawienie wartości (y) na kanale analogowym (x)
|
{ // ustawienie wartości (y) na kanale analogowym (x)
|
||||||
@@ -353,5 +356,11 @@ void Console::OnKeyUp(int k)
|
|||||||
else
|
else
|
||||||
iButton[char(k) >> 5] &= ~(1 << (k & 31)); // wyłącz monostabilny podstawowy
|
iButton[char(k) >> 5] &= ~(1 << (k & 31)); // wyłącz monostabilny podstawowy
|
||||||
};
|
};
|
||||||
int Console::KeyDownConvert(int k) { return int(ktTable[k & 0x3FF].iDown); };
|
int Console::KeyDownConvert(int k)
|
||||||
int Console::KeyUpConvert(int k) { return int(ktTable[k & 0x3FF].iUp); };
|
{
|
||||||
|
return int(ktTable[k & 0x3FF].iDown);
|
||||||
|
};
|
||||||
|
int Console::KeyUpConvert(int k)
|
||||||
|
{
|
||||||
|
return int(ktTable[k & 0x3FF].iUp);
|
||||||
|
};
|
||||||
|
|||||||
@@ -48,4 +48,7 @@ bool TLPT::Connect(int port)
|
|||||||
return bool(OutPort);
|
return bool(OutPort);
|
||||||
};
|
};
|
||||||
|
|
||||||
void TLPT::Out(int x) { OutPort(address, x); }; // wys³anie bajtu do portu
|
void TLPT::Out(int x)
|
||||||
|
{
|
||||||
|
OutPort(address, x);
|
||||||
|
}; // wys³anie bajtu do portu
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ TPoKeys55::TPoKeys55()
|
|||||||
bNoError = true;
|
bNoError = true;
|
||||||
};
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
TPoKeys55::~TPoKeys55() { Close(); };
|
TPoKeys55::~TPoKeys55()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool TPoKeys55::Close()
|
bool TPoKeys55::Close()
|
||||||
{ // roz³¹czenie komunikacji
|
{ // roz³¹czenie komunikacji
|
||||||
@@ -202,8 +205,7 @@ bool TPoKeys55::Connect()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned char b4,
|
bool TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned char b4, unsigned char b5)
|
||||||
unsigned char b5)
|
|
||||||
{
|
{
|
||||||
DWORD BytesWritten = 0;
|
DWORD BytesWritten = 0;
|
||||||
OutputBuffer[0] = 0; // The first byte is the "Report ID" and does not get transmitted over the
|
OutputBuffer[0] = 0; // The first byte is the "Report ID" and does not get transmitted over the
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ class TPoKeys55
|
|||||||
~TPoKeys55();
|
~TPoKeys55();
|
||||||
bool Connect();
|
bool Connect();
|
||||||
bool Close();
|
bool Close();
|
||||||
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0,
|
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0, unsigned char b5 = 0);
|
||||||
unsigned char b5 = 0);
|
|
||||||
bool Read();
|
bool Read();
|
||||||
bool ReadLoop(int i);
|
bool ReadLoop(int i);
|
||||||
AnsiString Version();
|
AnsiString Version();
|
||||||
|
|||||||
3
Data.h
3
Data.h
@@ -17,7 +17,8 @@ struct TDist
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
};
|
};
|
||||||
const TDist SectorOrder[] = { // tabela wspó³rzêdnych sektorów, posortowana wg odleg³oœci
|
const TDist SectorOrder[] = {
|
||||||
|
// tabela wspó³rzêdnych sektorów, posortowana wg odleg³oœci
|
||||||
{0, 0}, // 0.00
|
{0, 0}, // 0.00
|
||||||
{1, 0}, // 1.00
|
{1, 0}, // 1.00
|
||||||
{0, 1}, // 1.00
|
{0, 1}, // 1.00
|
||||||
|
|||||||
79
Driver.cpp
79
Driver.cpp
@@ -87,7 +87,8 @@ const double HardAcceleration = 0.9;
|
|||||||
const double PrepareTime = 2.0; //[s] przebłyski świadomości przy odpalaniu
|
const double PrepareTime = 2.0; //[s] przebłyski świadomości przy odpalaniu
|
||||||
bool WriteLogFlag = false;
|
bool WriteLogFlag = false;
|
||||||
|
|
||||||
AnsiString StopReasonTable[] = { // przyczyny zatrzymania ruchu AI
|
AnsiString StopReasonTable[] = {
|
||||||
|
// przyczyny zatrzymania ruchu AI
|
||||||
"", // stopNone, //nie ma powodu - powinien jechać
|
"", // stopNone, //nie ma powodu - powinien jechać
|
||||||
"Off", // stopSleep, //nie został odpalony, to nie pojedzie
|
"Off", // stopSleep, //nie został odpalony, to nie pojedzie
|
||||||
"Semaphore", // stopSem, //semafor zamknięty
|
"Semaphore", // stopSem, //semafor zamknięty
|
||||||
@@ -217,7 +218,7 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
|||||||
if ((i = iFlags & 0xF0000000) != 0)
|
if ((i = iFlags & 0xF0000000) != 0)
|
||||||
{ // jeśli skrzyżowanie, ograniczyć prędkość przy skręcaniu
|
{ // jeśli skrzyżowanie, ograniczyć prędkość przy skręcaniu
|
||||||
if (abs(i) > 0x10000000) //±1 to jazda na wprost, ±2 nieby też, ale z przecięciem
|
if (abs(i) > 0x10000000) //±1 to jazda na wprost, ±2 nieby też, ale z przecięciem
|
||||||
//głównej drogi - chyba że jest równorzędne...
|
// głównej drogi - chyba że jest równorzędne...
|
||||||
fVelNext = 30.0; // uzależnić prędkość od promienia; albo niech będzie
|
fVelNext = 30.0; // uzależnić prędkość od promienia; albo niech będzie
|
||||||
// ograniczona w skrzyżowaniu (velocity z ujemną wartością)
|
// ograniczona w skrzyżowaniu (velocity z ujemną wartością)
|
||||||
if ((iFlags & 32) == 0) // jeśli nie wjechał
|
if ((iFlags & 32) == 0) // jeśli nie wjechał
|
||||||
@@ -624,8 +625,7 @@ void TController::TableCheck(double fDistance)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc)
|
||||||
double &fAcc)
|
|
||||||
{ // ustalenie parametrów, zwraca typ komendy, jeśli sygnał podaje prędkość do jazdy
|
{ // ustalenie parametrów, zwraca typ komendy, jeśli sygnał podaje prędkość do jazdy
|
||||||
// fVelDes - prędkość zadana
|
// fVelDes - prędkość zadana
|
||||||
// fDist - dystans w jakim należy rozważyć ruch
|
// fDist - dystans w jakim należy rozważyć ruch
|
||||||
@@ -663,7 +663,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
if (sSpeedTable[i].fDist <
|
if (sSpeedTable[i].fDist <
|
||||||
200.0) // przy 160km/h jedzie 44m/s, to da dokładność rzędu 5 sekund
|
200.0) // przy 160km/h jedzie 44m/s, to da dokładność rzędu 5 sekund
|
||||||
{ // zaliczamy posterunek w pewnej odległości przed (choć W4 nie zasłania
|
{ // zaliczamy posterunek w pewnej odległości przed (choć W4 nie zasłania
|
||||||
// już semafora)
|
// już semafora)
|
||||||
#if LOGSTOPS
|
#if LOGSTOPS
|
||||||
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
|
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
|
||||||
AnsiString(GlobalTime->hh) + ":" + AnsiString(GlobalTime->mm) +
|
AnsiString(GlobalTime->hh) + ":" + AnsiString(GlobalTime->mm) +
|
||||||
@@ -912,7 +912,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
if (sSpeedTable[i].fDist < 0.0) // jeśli wskaźnik został minięty
|
if (sSpeedTable[i].fDist < 0.0) // jeśli wskaźnik został minięty
|
||||||
{
|
{
|
||||||
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż wcale,
|
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż wcale,
|
||||||
//ale to jeszcze nie to
|
// ale to jeszcze nie to
|
||||||
// iStationStart=TrainParams->StationIndex; //zaktualizować
|
// iStationStart=TrainParams->StationIndex; //zaktualizować
|
||||||
// wyświetlanie rozkładu
|
// wyświetlanie rozkładu
|
||||||
}
|
}
|
||||||
@@ -977,7 +977,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
if (sSpeedTable[i].fDist < 0.0) // jeśli przejechany
|
if (sSpeedTable[i].fDist < 0.0) // jeśli przejechany
|
||||||
{
|
{
|
||||||
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż
|
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż
|
||||||
//wcale, ale to jeszcze nie to
|
// wcale, ale to jeszcze nie to
|
||||||
sSpeedTable[i].iFlags =
|
sSpeedTable[i].iFlags =
|
||||||
0; // to można usunąć (nie mogą być usuwane w skanowaniu)
|
0; // to można usunąć (nie mogą być usuwane w skanowaniu)
|
||||||
}
|
}
|
||||||
@@ -999,7 +999,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
if (sSpeedTable[i].fDist < 0.0) // jeśli przejechany
|
if (sSpeedTable[i].fDist < 0.0) // jeśli przejechany
|
||||||
{
|
{
|
||||||
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż
|
VelSignal = v; //!!! ustawienie, gdy przejechany jest lepsze niż
|
||||||
//wcale, ale to jeszcze nie to
|
// wcale, ale to jeszcze nie to
|
||||||
if (sSpeedTable[i].iFlags & 0x100) // jeśli semafor
|
if (sSpeedTable[i].iFlags & 0x100) // jeśli semafor
|
||||||
if ((sSpeedTable[i].evEvent != eSignSkip) ?
|
if ((sSpeedTable[i].evEvent != eSignSkip) ?
|
||||||
true :
|
true :
|
||||||
@@ -1612,10 +1612,10 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
else if (OrderCurrentGet() == Disconnect)
|
else if (OrderCurrentGet() == Disconnect)
|
||||||
if (mvOccupied->ActiveDir > 0) // jak ma kierunek do przodu
|
if (mvOccupied->ActiveDir > 0) // jak ma kierunek do przodu
|
||||||
Lights(16, 0); //światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić
|
Lights(16, 0); //światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić
|
||||||
//odczepionego ze światłem
|
// odczepionego ze światłem
|
||||||
else // jak dociska
|
else // jak dociska
|
||||||
Lights(0, 16); //światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić
|
Lights(0, 16); //światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić
|
||||||
//odczepionego ze światłem
|
// odczepionego ze światłem
|
||||||
}
|
}
|
||||||
else // Ra 2014-02: lepiej tu niż w pętli obsługującej komendy, bo tam się zmieni informacja
|
else // Ra 2014-02: lepiej tu niż w pętli obsługującej komendy, bo tam się zmieni informacja
|
||||||
// o składzie
|
// o składzie
|
||||||
@@ -2823,7 +2823,7 @@ bool TController::PutCommand(AnsiString NewCommand, double NewValue1, double New
|
|||||||
else if (NewCommand == "Shunt")
|
else if (NewCommand == "Shunt")
|
||||||
{ // NewValue1 - ilość wagonów (-1=wszystkie); NewValue2: 0=odczep, 1..63=dołącz, -1=bez zmian
|
{ // NewValue1 - ilość wagonów (-1=wszystkie); NewValue2: 0=odczep, 1..63=dołącz, -1=bez zmian
|
||||||
//-3,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1), zmienić kierunek i czekać w
|
//-3,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1), zmienić kierunek i czekać w
|
||||||
//trybie pociągowym
|
// trybie pociągowym
|
||||||
//-2,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1), zmienić kierunek i czekać
|
//-2,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1), zmienić kierunek i czekać
|
||||||
//-2, y - podłączyć do całego stojącego składu (sprzęgiem y>=1) i czekać
|
//-2, y - podłączyć do całego stojącego składu (sprzęgiem y>=1) i czekać
|
||||||
//-1,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1) i jechać w powrotną stronę
|
//-1,-y - podłączyć do całego stojącego składu (sprzęgiem y>=1) i jechać w powrotną stronę
|
||||||
@@ -3962,8 +3962,8 @@ bool TController::UpdateSituation(double dt)
|
|||||||
// składowa styczna grawitacji
|
// składowa styczna grawitacji
|
||||||
else
|
else
|
||||||
AbsAccS = iDirection * mvOccupied->AccS; // przyspieszenie chwilowe, liczone
|
AbsAccS = iDirection * mvOccupied->AccS; // przyspieszenie chwilowe, liczone
|
||||||
// jako różnica skierowanej prędkości w
|
// jako różnica skierowanej prędkości w
|
||||||
// czasie
|
// czasie
|
||||||
// if (mvOccupied->V<0.0) AbsAccS=-AbsAccS; //Ra 2014-03: to trzeba przemyśleć
|
// if (mvOccupied->V<0.0) AbsAccS=-AbsAccS; //Ra 2014-03: to trzeba przemyśleć
|
||||||
// if (vel<0) //jeżeli się stacza w tył; 2014-03: to jest bez sensu, bo vel>=0
|
// if (vel<0) //jeżeli się stacza w tył; 2014-03: to jest bez sensu, bo vel>=0
|
||||||
// AbsAccS=-AbsAccS; //to przyspieszenie też działa wtedy w nieodpowiednią stronę
|
// AbsAccS=-AbsAccS; //to przyspieszenie też działa wtedy w nieodpowiednią stronę
|
||||||
@@ -3977,12 +3977,12 @@ bool TController::UpdateSituation(double dt)
|
|||||||
// ustalanie zadanego przyspieszenia
|
// ustalanie zadanego przyspieszenia
|
||||||
//(ActualProximityDist) - odległość do miejsca zmniejszenia prędkości
|
//(ActualProximityDist) - odległość do miejsca zmniejszenia prędkości
|
||||||
//(AccPreferred) - wynika z psychyki oraz uwzglęnia już ewentualne zderzenie z
|
//(AccPreferred) - wynika z psychyki oraz uwzglęnia już ewentualne zderzenie z
|
||||||
//pojazdem z przodu, ujemne gdy należy hamować
|
// pojazdem z przodu, ujemne gdy należy hamować
|
||||||
//(AccDesired) - uwzględnia sygnały na drodze ruchu, ujemne gdy należy hamować
|
//(AccDesired) - uwzględnia sygnały na drodze ruchu, ujemne gdy należy hamować
|
||||||
//(fAccGravity) - chwilowe przspieszenie grawitacyjne, ujemne działa przeciwnie do
|
//(fAccGravity) - chwilowe przspieszenie grawitacyjne, ujemne działa przeciwnie do
|
||||||
//zadanego kierunku jazdy
|
// zadanego kierunku jazdy
|
||||||
//(AbsAccS) - chwilowe przyspieszenie pojazu (uwzględnia grawitację), ujemne działa
|
//(AbsAccS) - chwilowe przyspieszenie pojazu (uwzględnia grawitację), ujemne działa
|
||||||
//przeciwnie do zadanego kierunku jazdy
|
// przeciwnie do zadanego kierunku jazdy
|
||||||
//(AccDesired) porównujemy z (fAccGravity) albo (AbsAccS)
|
//(AccDesired) porównujemy z (fAccGravity) albo (AbsAccS)
|
||||||
// if ((VelNext>=0.0)&&(ActualProximityDist>=0)&&(mvOccupied->Vel>=VelNext)) //gdy
|
// if ((VelNext>=0.0)&&(ActualProximityDist>=0)&&(mvOccupied->Vel>=VelNext)) //gdy
|
||||||
// zbliza sie i jest za szybko do NOWEGO
|
// zbliza sie i jest za szybko do NOWEGO
|
||||||
@@ -4048,7 +4048,7 @@ bool TController::UpdateSituation(double dt)
|
|||||||
(25.92 * (ActualProximityDist +
|
(25.92 * (ActualProximityDist +
|
||||||
0.1)); //-fMinProximityDist));//-0.1;
|
0.1)); //-fMinProximityDist));//-0.1;
|
||||||
////mniejsze opóźnienie przy
|
////mniejsze opóźnienie przy
|
||||||
//małej różnicy
|
// małej różnicy
|
||||||
ReactionTime = 0.1; // i orientuj się szybciej, jak masz stanąć
|
ReactionTime = 0.1; // i orientuj się szybciej, jak masz stanąć
|
||||||
}
|
}
|
||||||
else if (vel < VelNext + fVelPlus) // jeśli niewielkie
|
else if (vel < VelNext + fVelPlus) // jeśli niewielkie
|
||||||
@@ -4103,7 +4103,7 @@ bool TController::UpdateSituation(double dt)
|
|||||||
AccDesired = AccPreferred; // dociagnij do semafora;
|
AccDesired = AccPreferred; // dociagnij do semafora;
|
||||||
else
|
else
|
||||||
VelDesired = 0.0; //,AccDesired=-fabs(fAccGravity); //stoj (hamuj z siłą
|
VelDesired = 0.0; //,AccDesired=-fabs(fAccGravity); //stoj (hamuj z siłą
|
||||||
//równą składowej stycznej grawitacji)
|
// równą składowej stycznej grawitacji)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VelDesired = 0.0; // VelNext=0 i stoi bliżej niż fMaxProximityDist
|
VelDesired = 0.0; // VelNext=0 i stoi bliżej niż fMaxProximityDist
|
||||||
@@ -4564,9 +4564,15 @@ void TController::OrdersDump()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TOrders TController::OrderCurrentGet() { return OrderList[OrderPos]; }
|
TOrders TController::OrderCurrentGet()
|
||||||
|
{
|
||||||
|
return OrderList[OrderPos];
|
||||||
|
}
|
||||||
|
|
||||||
TOrders TController::OrderNextGet() { return OrderList[OrderPos + 1]; }
|
TOrders TController::OrderNextGet()
|
||||||
|
{
|
||||||
|
return OrderList[OrderPos + 1];
|
||||||
|
}
|
||||||
|
|
||||||
void TController::OrdersInit(double fVel)
|
void TController::OrdersInit(double fVel)
|
||||||
{ // wypełnianie tabelki rozkazów na podstawie rozkładu
|
{ // wypełnianie tabelki rozkazów na podstawie rozkładu
|
||||||
@@ -4876,7 +4882,7 @@ TCommandType TController::BackwardScan()
|
|||||||
(mvOccupied->Vel > 0.0) && (OrderCurrentGet() != Shunt) :
|
(mvOccupied->Vel > 0.0) && (OrderCurrentGet() != Shunt) :
|
||||||
false)
|
false)
|
||||||
{ // jeśli semafor jest daleko, a pojazd jedzie, to informujemy o
|
{ // jeśli semafor jest daleko, a pojazd jedzie, to informujemy o
|
||||||
// zmianie prędkości
|
// zmianie prędkości
|
||||||
// jeśli jedzie manewrowo, musi dostać SetVelocity, żeby sie na pociągowy przełączył
|
// jeśli jedzie manewrowo, musi dostać SetVelocity, żeby sie na pociągowy przełączył
|
||||||
// Mechanik->PutCommand("SetProximityVelocity",scandist,vmechmax,sl);
|
// Mechanik->PutCommand("SetProximityVelocity",scandist,vmechmax,sl);
|
||||||
#if LOGBACKSCAN
|
#if LOGBACKSCAN
|
||||||
@@ -4892,7 +4898,7 @@ TCommandType TController::BackwardScan()
|
|||||||
// if ((MoverParameters->Vel==0.0)||(vmechmax==0.0)) //jeśli stoi lub ma
|
// if ((MoverParameters->Vel==0.0)||(vmechmax==0.0)) //jeśli stoi lub ma
|
||||||
// stanąć/stać
|
// stanąć/stać
|
||||||
{ // semafor na tym torze albo lokomtywa stoi, a ma ruszyć, albo ma
|
{ // semafor na tym torze albo lokomtywa stoi, a ma ruszyć, albo ma
|
||||||
// stanąć, albo nie ruszać
|
// stanąć, albo nie ruszać
|
||||||
// stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam
|
// stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam
|
||||||
// PutCommand("SetVelocity",vmechmax,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
// PutCommand("SetVelocity",vmechmax,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
||||||
#if LOGBACKSCAN
|
#if LOGBACKSCAN
|
||||||
@@ -4913,7 +4919,7 @@ TCommandType TController::BackwardScan()
|
|||||||
{ // jeśli tarcza jest daleko, to:
|
{ // jeśli tarcza jest daleko, to:
|
||||||
//- jesli pojazd jedzie, to informujemy o zmianie prędkości
|
//- jesli pojazd jedzie, to informujemy o zmianie prędkości
|
||||||
//- jeśli stoi, to z własnej inicjatywy może podjechać pod zamkniętą
|
//- jeśli stoi, to z własnej inicjatywy może podjechać pod zamkniętą
|
||||||
//tarczę
|
// tarczę
|
||||||
if (mvOccupied->Vel > 0.0) // tylko jeśli jedzie
|
if (mvOccupied->Vel > 0.0) // tylko jeśli jedzie
|
||||||
{ // Mechanik->PutCommand("SetProximityVelocity",scandist,vmechmax,sl);
|
{ // Mechanik->PutCommand("SetProximityVelocity",scandist,vmechmax,sl);
|
||||||
#if LOGBACKSCAN
|
#if LOGBACKSCAN
|
||||||
@@ -4944,7 +4950,7 @@ TCommandType TController::BackwardScan()
|
|||||||
}
|
}
|
||||||
if ((vmechmax != 0.0) && (scandist < 100.0))
|
if ((vmechmax != 0.0) && (scandist < 100.0))
|
||||||
{ // jeśli Tm w odległości do 100m podaje zezwolenie na jazdę, to od
|
{ // jeśli Tm w odległości do 100m podaje zezwolenie na jazdę, to od
|
||||||
// razu ją ignorujemy, aby móc szukać kolejnej
|
// razu ją ignorujemy, aby móc szukać kolejnej
|
||||||
// eSignSkip=e; //wtedy uznajemy ignorowaną przy poszukiwaniu nowej
|
// eSignSkip=e; //wtedy uznajemy ignorowaną przy poszukiwaniu nowej
|
||||||
#if LOGBACKSCAN
|
#if LOGBACKSCAN
|
||||||
WriteLog(edir + "- will be ignored due to Ms2");
|
WriteLog(edir + "- will be ignored due to Ms2");
|
||||||
@@ -5054,15 +5060,30 @@ void TController::DirectionForward(bool forward)
|
|||||||
mvControlling->IncMainCtrl(1); //żeby nie zgasł
|
mvControlling->IncMainCtrl(1); //żeby nie zgasł
|
||||||
};
|
};
|
||||||
|
|
||||||
AnsiString TController::Relation() { return TrainParams->ShowRelation(); }; // zwraca relację pociągu
|
AnsiString TController::Relation()
|
||||||
|
{
|
||||||
|
return TrainParams->ShowRelation();
|
||||||
|
}; // zwraca relację pociągu
|
||||||
|
|
||||||
AnsiString TController::TrainName() { return TrainParams->TrainName; }; // zwraca relację pociągu
|
AnsiString TController::TrainName()
|
||||||
|
{
|
||||||
|
return TrainParams->TrainName;
|
||||||
|
}; // zwraca relację pociągu
|
||||||
|
|
||||||
int TController::StationCount() { return TrainParams->StationCount; }; // zwraca ilość stacji (miejsc zatrzymania)
|
int TController::StationCount()
|
||||||
|
{
|
||||||
|
return TrainParams->StationCount;
|
||||||
|
}; // zwraca ilość stacji (miejsc zatrzymania)
|
||||||
|
|
||||||
int TController::StationIndex() { return TrainParams->StationIndex; }; // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
int TController::StationIndex()
|
||||||
|
{
|
||||||
|
return TrainParams->StationIndex;
|
||||||
|
}; // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
||||||
|
|
||||||
bool TController::IsStop() { return TrainParams->IsStop(); }; // informuje, czy jest zatrzymanie na najbliższej stacji
|
bool TController::IsStop()
|
||||||
|
{
|
||||||
|
return TrainParams->IsStop();
|
||||||
|
}; // informuje, czy jest zatrzymanie na najbliższej stacji
|
||||||
|
|
||||||
void TController::MoveTo(TDynamicObject *to)
|
void TController::MoveTo(TDynamicObject *to)
|
||||||
{ // przesunięcie AI do innego pojazdu (przy zmianie kabiny)
|
{ // przesunięcie AI do innego pojazdu (przy zmianie kabiny)
|
||||||
|
|||||||
18
Driver.h
18
Driver.h
@@ -268,7 +268,10 @@ class TController
|
|||||||
void ControllingSet(); // znajduje człon do sterowania
|
void ControllingSet(); // znajduje człon do sterowania
|
||||||
void AutoRewident(); // ustawia hamulce w składzie
|
void AutoRewident(); // ustawia hamulce w składzie
|
||||||
public:
|
public:
|
||||||
Mtable::TTrainParameters *__fastcall Timetable() { return TrainParams; };
|
Mtable::TTrainParameters *__fastcall Timetable()
|
||||||
|
{
|
||||||
|
return TrainParams;
|
||||||
|
};
|
||||||
void PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
void PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||||
const _mover::TLocation &NewLocation, TStopReason reason = stopComm);
|
const _mover::TLocation &NewLocation, TStopReason reason = stopComm);
|
||||||
bool PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
bool PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||||
@@ -319,8 +322,7 @@ class TController
|
|||||||
TEvent *__fastcall TableCheckTrackEvent(double fDirection, TTrack *Track);
|
TEvent *__fastcall TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||||
void TableCheck(double fDistance);
|
void TableCheck(double fDistance);
|
||||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
||||||
double &fAcc);
|
|
||||||
void TablePurger();
|
void TablePurger();
|
||||||
|
|
||||||
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||||
@@ -342,8 +344,14 @@ class TController
|
|||||||
int StationCount();
|
int StationCount();
|
||||||
int StationIndex();
|
int StationIndex();
|
||||||
bool IsStop();
|
bool IsStop();
|
||||||
bool Primary() { return this ? bool(iDrivigFlags & movePrimary) : false; };
|
bool Primary()
|
||||||
int inline DrivigFlags() { return iDrivigFlags; };
|
{
|
||||||
|
return this ? bool(iDrivigFlags & movePrimary) : false;
|
||||||
|
};
|
||||||
|
int inline DrivigFlags()
|
||||||
|
{
|
||||||
|
return iDrivigFlags;
|
||||||
|
};
|
||||||
void MoveTo(TDynamicObject *to);
|
void MoveTo(TDynamicObject *to);
|
||||||
void DirectionInitial();
|
void DirectionInitial();
|
||||||
AnsiString TableText(int i);
|
AnsiString TableText(int i);
|
||||||
|
|||||||
22
DynObj.cpp
22
DynObj.cpp
@@ -131,7 +131,8 @@ TAnim::~TAnim()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void TAnim::Parovoz(){// animowanie tłoka i rozrządu parowozu
|
void TAnim::Parovoz(){
|
||||||
|
// animowanie tłoka i rozrządu parowozu
|
||||||
};
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
TDynamicObject *__fastcall TDynamicObject::FirstFind(int &coupler_nr)
|
TDynamicObject *__fastcall TDynamicObject::FirstFind(int &coupler_nr)
|
||||||
@@ -288,7 +289,10 @@ TDynamicObject* TDynamicObject::GetFirstCabDynamic(int cpl_type)
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void TDynamicObject::ABuSetModelShake(vector3 mShake) { modelShake = mShake; };
|
void TDynamicObject::ABuSetModelShake(vector3 mShake)
|
||||||
|
{
|
||||||
|
modelShake = mShake;
|
||||||
|
};
|
||||||
|
|
||||||
int TDynamicObject::GetPneumatic(bool front, bool red)
|
int TDynamicObject::GetPneumatic(bool front, bool red)
|
||||||
{
|
{
|
||||||
@@ -926,7 +930,7 @@ TDynamicObject *__fastcall TDynamicObject::ABuFindNearestObject(TTrack *Track,
|
|||||||
{ // wektor [kamera-sprzeg0], potem [kamera-sprzeg1]
|
{ // wektor [kamera-sprzeg0], potem [kamera-sprzeg1]
|
||||||
// Powinno byc wyliczone, ale nie zaszkodzi drugi raz:
|
// Powinno byc wyliczone, ale nie zaszkodzi drugi raz:
|
||||||
//(bo co, jesli nie wykonuje sie obrotow wozkow?) - Ra: ale zawsze są liczone
|
//(bo co, jesli nie wykonuje sie obrotow wozkow?) - Ra: ale zawsze są liczone
|
||||||
//współrzędne sprzęgów
|
// współrzędne sprzęgów
|
||||||
// Track->Dynamics[i]->modelRot.z=ABuAcos(Track->Dynamics[i]->Axle0.pPosition-Track->Dynamics[i]->Axle1.pPosition);
|
// Track->Dynamics[i]->modelRot.z=ABuAcos(Track->Dynamics[i]->Axle0.pPosition-Track->Dynamics[i]->Axle1.pPosition);
|
||||||
// poz=Track->Dynamics[i]->vPosition; //pozycja środka pojazdu
|
// poz=Track->Dynamics[i]->vPosition; //pozycja środka pojazdu
|
||||||
// kon=vector3( //położenie przodu względem środka
|
// kon=vector3( //położenie przodu względem środka
|
||||||
@@ -2009,10 +2013,10 @@ void TDynamicObject::Move(double fDistance)
|
|||||||
bEnabled &= Axle1.Move(fDistance, iAxleFirst); // oś z tyłu pojazdu prusza się pierwsza
|
bEnabled &= Axle1.Move(fDistance, iAxleFirst); // oś z tyłu pojazdu prusza się pierwsza
|
||||||
bEnabled &= Axle0.Move(fDistance /*-fAdjustment*/, !iAxleFirst); // oś z przodu pojazdu
|
bEnabled &= Axle0.Move(fDistance /*-fAdjustment*/, !iAxleFirst); // oś z przodu pojazdu
|
||||||
}
|
}
|
||||||
else //gf: bez wywolania Move na postoju nie ma event0
|
else // gf: bez wywolania Move na postoju nie ma event0
|
||||||
{
|
{
|
||||||
bEnabled&=Axle1.Move(fDistance,iAxleFirst); //oś z tyłu pojazdu prusza się pierwsza
|
bEnabled &= Axle1.Move(fDistance, iAxleFirst); // oś z tyłu pojazdu prusza się pierwsza
|
||||||
bEnabled&=Axle0.Move(fDistance,!iAxleFirst); //oś z przodu pojazdu
|
bEnabled &= Axle0.Move(fDistance, !iAxleFirst); // oś z przodu pojazdu
|
||||||
}
|
}
|
||||||
if (fDistance != 0.0) // nie liczyć ponownie, jeśli stoi
|
if (fDistance != 0.0) // nie liczyć ponownie, jeśli stoi
|
||||||
{ // liczenie pozycji pojazdu tutaj, bo jest używane w wielu miejscach
|
{ // liczenie pozycji pojazdu tutaj, bo jest używane w wielu miejscach
|
||||||
@@ -2339,8 +2343,8 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if (MoverParameters->PantPress < (MoverParameters->TrainType == dt_EZT ? 2.4 : 3.5))
|
if (MoverParameters->PantPress < (MoverParameters->TrainType == dt_EZT ? 2.4 : 3.5))
|
||||||
{ // 3.5 wg http://www.transportszynowy.pl/eu06-07pneumat.php
|
{ // 3.5 wg http://www.transportszynowy.pl/eu06-07pneumat.php
|
||||||
//"Wyłączniki ciśnieniowe odbieraków prądu wyłączają sterowanie wyłącznika szybkiego
|
//"Wyłączniki ciśnieniowe odbieraków prądu wyłączają sterowanie wyłącznika szybkiego
|
||||||
//oraz uniemożliwiają podniesienie odbieraków prądu, gdy w instalacji rozrządu
|
// oraz uniemożliwiają podniesienie odbieraków prądu, gdy w instalacji rozrządu
|
||||||
//ciśnienie spadnie poniżej wartości 3,5 bara."
|
// ciśnienie spadnie poniżej wartości 3,5 bara."
|
||||||
// Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
// Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||||
// if (!MoverParameters->PantCompFlag)
|
// if (!MoverParameters->PantCompFlag)
|
||||||
// MoverParameters->PantVolume=MoverParameters->CompressedVolume;
|
// MoverParameters->PantVolume=MoverParameters->CompressedVolume;
|
||||||
@@ -4282,7 +4286,7 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
|||||||
if (pants[i].fParamPants->vPos.y == 0.0)
|
if (pants[i].fParamPants->vPos.y == 0.0)
|
||||||
{ // jeśli pierwsze ramię nie ustawiło tej wartości, próbować drugim
|
{ // jeśli pierwsze ramię nie ustawiło tej wartości, próbować drugim
|
||||||
//!!!! docelowo zrobić niezależną animację ramion z każdej
|
//!!!! docelowo zrobić niezależną animację ramion z każdej
|
||||||
//strony
|
// strony
|
||||||
m = float4x4(
|
m = float4x4(
|
||||||
*sm->GetMatrix()); // skopiowanie, bo będziemy mnożyć
|
*sm->GetMatrix()); // skopiowanie, bo będziemy mnożyć
|
||||||
m(3)[1] =
|
m(3)[1] =
|
||||||
|
|||||||
63
DynObj.h
63
DynObj.h
@@ -338,14 +338,26 @@ class TDynamicObject
|
|||||||
TDynamicObject *__fastcall Next();
|
TDynamicObject *__fastcall Next();
|
||||||
TDynamicObject *__fastcall NextC(int C);
|
TDynamicObject *__fastcall NextC(int C);
|
||||||
double NextDistance(double d = -1.0);
|
double NextDistance(double d = -1.0);
|
||||||
void SetdMoveLen(double dMoveLen) { MoverParameters->dMoveLen = dMoveLen; }
|
void SetdMoveLen(double dMoveLen)
|
||||||
void ResetdMoveLen() { MoverParameters->dMoveLen = 0; }
|
{
|
||||||
double GetdMoveLen() { return MoverParameters->dMoveLen; }
|
MoverParameters->dMoveLen = dMoveLen;
|
||||||
|
}
|
||||||
|
void ResetdMoveLen()
|
||||||
|
{
|
||||||
|
MoverParameters->dMoveLen = 0;
|
||||||
|
}
|
||||||
|
double GetdMoveLen()
|
||||||
|
{
|
||||||
|
return MoverParameters->dMoveLen;
|
||||||
|
}
|
||||||
|
|
||||||
int GetPneumatic(bool front, bool red);
|
int GetPneumatic(bool front, bool red);
|
||||||
void SetPneumatic(bool front, bool red);
|
void SetPneumatic(bool front, bool red);
|
||||||
AnsiString asName;
|
AnsiString asName;
|
||||||
AnsiString GetName() { return this ? asName : AnsiString(""); };
|
AnsiString GetName()
|
||||||
|
{
|
||||||
|
return this ? asName : AnsiString("");
|
||||||
|
};
|
||||||
|
|
||||||
TRealSound rsDiesielInc; // youBy
|
TRealSound rsDiesielInc; // youBy
|
||||||
TRealSound rscurve; // youBy
|
TRealSound rscurve; // youBy
|
||||||
@@ -395,7 +407,10 @@ class TDynamicObject
|
|||||||
void Render();
|
void Render();
|
||||||
void RenderAlpha();
|
void RenderAlpha();
|
||||||
void RenderSounds();
|
void RenderSounds();
|
||||||
inline vector3 GetPosition() { return vPosition; };
|
inline vector3 GetPosition()
|
||||||
|
{
|
||||||
|
return vPosition;
|
||||||
|
};
|
||||||
inline vector3 HeadPosition()
|
inline vector3 HeadPosition()
|
||||||
{
|
{
|
||||||
return vCoulpler[iDirection ^ 1];
|
return vCoulpler[iDirection ^ 1];
|
||||||
@@ -408,13 +423,34 @@ class TDynamicObject
|
|||||||
{
|
{
|
||||||
return iAxleFirst ? Axle1.pPosition : Axle0.pPosition;
|
return iAxleFirst ? Axle1.pPosition : Axle0.pPosition;
|
||||||
};
|
};
|
||||||
inline vector3 VectorFront() { return vFront; };
|
inline vector3 VectorFront()
|
||||||
inline vector3 VectorUp() { return vUp; };
|
{
|
||||||
inline vector3 VectorLeft() { return vLeft; };
|
return vFront;
|
||||||
inline double *__fastcall Matrix() { return mMatrix.getArray(); };
|
};
|
||||||
inline double GetVelocity() { return MoverParameters->Vel; };
|
inline vector3 VectorUp()
|
||||||
inline double GetLength() { return MoverParameters->Dim.L; };
|
{
|
||||||
inline double GetWidth() { return MoverParameters->Dim.W; };
|
return vUp;
|
||||||
|
};
|
||||||
|
inline vector3 VectorLeft()
|
||||||
|
{
|
||||||
|
return vLeft;
|
||||||
|
};
|
||||||
|
inline double *__fastcall Matrix()
|
||||||
|
{
|
||||||
|
return mMatrix.getArray();
|
||||||
|
};
|
||||||
|
inline double GetVelocity()
|
||||||
|
{
|
||||||
|
return MoverParameters->Vel;
|
||||||
|
};
|
||||||
|
inline double GetLength()
|
||||||
|
{
|
||||||
|
return MoverParameters->Dim.L;
|
||||||
|
};
|
||||||
|
inline double GetWidth()
|
||||||
|
{
|
||||||
|
return MoverParameters->Dim.W;
|
||||||
|
};
|
||||||
inline TTrack *__fastcall GetTrack()
|
inline TTrack *__fastcall GetTrack()
|
||||||
{
|
{
|
||||||
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack());
|
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack());
|
||||||
@@ -422,8 +458,7 @@ class TDynamicObject
|
|||||||
// void UpdatePos();
|
// void UpdatePos();
|
||||||
|
|
||||||
// McZapkie-260202
|
// McZapkie-260202
|
||||||
void LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
void LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName, AnsiString ReplacableSkin);
|
||||||
AnsiString ReplacableSkin);
|
|
||||||
|
|
||||||
inline double ABuGetDirection() // ABu.
|
inline double ABuGetDirection() // ABu.
|
||||||
{
|
{
|
||||||
|
|||||||
3
EU07.cpp
3
EU07.cpp
@@ -754,6 +754,3 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
|
|||||||
KillGLWindow(); // kill the window
|
KillGLWindow(); // kill the window
|
||||||
return (msg.wParam); // exit the program
|
return (msg.wParam); // exit the program
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,14 @@ TEventLauncher::TEventLauncher()
|
|||||||
iCheckMask = 0;
|
iCheckMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEventLauncher::~TEventLauncher() { SafeDeleteArray(szText); }
|
TEventLauncher::~TEventLauncher()
|
||||||
|
{
|
||||||
|
SafeDeleteArray(szText);
|
||||||
|
}
|
||||||
|
|
||||||
void TEventLauncher::Init() {}
|
void TEventLauncher::Init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool TEventLauncher::Load(cParser *parser)
|
bool TEventLauncher::Load(cParser *parser)
|
||||||
{ // wczytanie wyzwalacza zdarzeñ
|
{ // wczytanie wyzwalacza zdarzeñ
|
||||||
|
|||||||
@@ -27,9 +27,14 @@ TFadeSound::TFadeSound()
|
|||||||
fTime = 0;
|
fTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFadeSound::~TFadeSound() { Free(); }
|
TFadeSound::~TFadeSound()
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
}
|
||||||
|
|
||||||
void TFadeSound::Free() {}
|
void TFadeSound::Free()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TFadeSound::Init(char *Name, float fNewFade)
|
void TFadeSound::Init(char *Name, float fNewFade)
|
||||||
{
|
{
|
||||||
@@ -47,7 +52,10 @@ void TFadeSound::TurnOn()
|
|||||||
fTime = fFade;
|
fTime = fFade;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFadeSound::TurnOff() { State = ss_ShuttingDown; }
|
void TFadeSound::TurnOff()
|
||||||
|
{
|
||||||
|
State = ss_ShuttingDown;
|
||||||
|
}
|
||||||
|
|
||||||
void TFadeSound::Update()
|
void TFadeSound::Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ class TFadeSound
|
|||||||
void Init(char *Name, float fNewFade);
|
void Init(char *Name, float fNewFade);
|
||||||
void TurnOn();
|
void TurnOn();
|
||||||
void TurnOff();
|
void TurnOff();
|
||||||
bool Playing() { return (State == ss_Commencing || State == ss_Starting); };
|
bool Playing()
|
||||||
|
{
|
||||||
|
return (State == ss_Commencing || State == ss_Starting);
|
||||||
|
};
|
||||||
void Free();
|
void Free();
|
||||||
void Update();
|
void Update();
|
||||||
void Volume(long vol);
|
void Volume(long vol);
|
||||||
|
|||||||
45
Float3d.h
45
Float3d.h
@@ -37,7 +37,10 @@ inline float3 &operator+=(float3 &v1, const float3 &v2)
|
|||||||
v1.z += v2.z;
|
v1.z += v2.z;
|
||||||
return v1;
|
return v1;
|
||||||
};
|
};
|
||||||
inline float3 operator-(const float3 &v) { return float3(-v.x, -v.y, -v.z); };
|
inline float3 operator-(const float3 &v)
|
||||||
|
{
|
||||||
|
return float3(-v.x, -v.y, -v.z);
|
||||||
|
};
|
||||||
inline float3 operator-(const float3 &v1, const float3 &v2)
|
inline float3 operator-(const float3 &v1, const float3 &v2)
|
||||||
{
|
{
|
||||||
return float3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
return float3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
||||||
@@ -46,8 +49,14 @@ inline float3 operator+(const float3 &v1, const float3 &v2)
|
|||||||
{
|
{
|
||||||
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
||||||
};
|
};
|
||||||
double inline float3::Length() const { return sqrt(x * x + y * y + z * z); };
|
double inline float3::Length() const
|
||||||
inline float3 operator/(const float3 &v, double k) { return float3(v.x / k, v.y / k, v.z / k); };
|
{
|
||||||
|
return sqrt(x * x + y * y + z * z);
|
||||||
|
};
|
||||||
|
inline float3 operator/(const float3 &v, double k)
|
||||||
|
{
|
||||||
|
return float3(v.x / k, v.y / k, v.z / k);
|
||||||
|
};
|
||||||
inline float3 SafeNormalize(const float3 &v)
|
inline float3 SafeNormalize(const float3 &v)
|
||||||
{ // bezpieczna normalizacja (wektor d³ugoœci 1.0)
|
{ // bezpieczna normalizacja (wektor d³ugoœci 1.0)
|
||||||
double l = v.Length();
|
double l = v.Length();
|
||||||
@@ -79,8 +88,14 @@ class float4
|
|||||||
z = c;
|
z = c;
|
||||||
w = d;
|
w = d;
|
||||||
};
|
};
|
||||||
double inline float4::LengthSquared() const { return x * x + y * y + z * z + w * w; };
|
double inline float4::LengthSquared() const
|
||||||
double inline float4::Length() const { return sqrt(x * x + y * y + z * z + w * w); };
|
{
|
||||||
|
return x * x + y * y + z * z + w * w;
|
||||||
|
};
|
||||||
|
double inline float4::Length() const
|
||||||
|
{
|
||||||
|
return sqrt(x * x + y * y + z * z + w * w);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
inline float4 operator*(const float4 &q1, const float4 &q2)
|
inline float4 operator*(const float4 &q1, const float4 &q2)
|
||||||
{ // mno¿enie to prawie jak mno¿enie macierzy
|
{ // mno¿enie to prawie jak mno¿enie macierzy
|
||||||
@@ -177,15 +192,24 @@ class float4x4
|
|||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
e[i] = f[i];
|
e[i] = f[i];
|
||||||
};
|
};
|
||||||
float *__fastcall operator()(int i) { return &e[i << 2]; }
|
float *__fastcall operator()(int i)
|
||||||
const float *__fastcall readArray(void) { return e; }
|
{
|
||||||
|
return &e[i << 2];
|
||||||
|
}
|
||||||
|
const float *__fastcall readArray(void)
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
void Identity()
|
void Identity()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
e[i] = 0;
|
e[i] = 0;
|
||||||
e[0] = e[5] = e[10] = e[15] = 1.0f;
|
e[0] = e[5] = e[10] = e[15] = 1.0f;
|
||||||
}
|
}
|
||||||
const float *operator[](int i) const { return &e[i << 2]; };
|
const float *operator[](int i) const
|
||||||
|
{
|
||||||
|
return &e[i << 2];
|
||||||
|
};
|
||||||
void InitialRotate()
|
void InitialRotate()
|
||||||
{ // taka specjalna rotacja, nie ma co ci¹gaæ trygonometrii
|
{ // taka specjalna rotacja, nie ma co ci¹gaæ trygonometrii
|
||||||
float f;
|
float f;
|
||||||
@@ -206,7 +230,10 @@ class float4x4
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void Quaternion(float4 *q);
|
void Quaternion(float4 *q);
|
||||||
inline float3 *TranslationGet() { return (float3 *)(e + 12); }
|
inline float3 *TranslationGet()
|
||||||
|
{
|
||||||
|
return (float3 *)(e + 12);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float3 operator*(const float4x4 &m, const float3 &v)
|
inline float3 operator*(const float4x4 &m, const float3 &v)
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ void TGauge::Clear()
|
|||||||
fDesiredValue = 0;
|
fDesiredValue = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale,
|
void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale, double fNewOffset,
|
||||||
double fNewOffset, double fNewFriction, double fNewValue)
|
double fNewFriction, double fNewValue)
|
||||||
{ // ustawienie parametrów animacji submodelu
|
{ // ustawienie parametrów animacji submodelu
|
||||||
if (NewSubModel)
|
if (NewSubModel)
|
||||||
{ // warunek na wszelki wypadek, gdyby siê submodel nie pod³¹czy³
|
{ // warunek na wszelki wypadek, gdyby siê submodel nie pod³¹czy³
|
||||||
|
|||||||
8
Gauge.h
8
Gauge.h
@@ -50,14 +50,16 @@ class TGauge // zmienne "gg"
|
|||||||
void Clear();
|
void Clear();
|
||||||
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
||||||
double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
||||||
bool Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL,
|
bool Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL, double mul = 1.0);
|
||||||
double mul = 1.0);
|
|
||||||
void PermIncValue(double fNewDesired);
|
void PermIncValue(double fNewDesired);
|
||||||
void IncValue(double fNewDesired);
|
void IncValue(double fNewDesired);
|
||||||
void DecValue(double fNewDesired);
|
void DecValue(double fNewDesired);
|
||||||
void UpdateValue(double fNewDesired);
|
void UpdateValue(double fNewDesired);
|
||||||
void PutValue(double fNewDesired);
|
void PutValue(double fNewDesired);
|
||||||
float GetValue() { return fValue; };
|
float GetValue()
|
||||||
|
{
|
||||||
|
return fValue;
|
||||||
|
};
|
||||||
void Update();
|
void Update();
|
||||||
void Render();
|
void Render();
|
||||||
void AssignFloat(float *fValue);
|
void AssignFloat(float *fValue);
|
||||||
|
|||||||
16
Geom.cpp
16
Geom.cpp
@@ -19,11 +19,17 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Geom.h"
|
#include "Geom.h"
|
||||||
|
|
||||||
__fastcall TGeometry::TGeometry() {}
|
__fastcall TGeometry::TGeometry()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
__fastcall TGeometry::~TGeometry() {}
|
__fastcall TGeometry::~TGeometry()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool TGeometry::Init() {}
|
bool TGeometry::Init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
vector3 TGeometry::Load(TQueryParserComp *Parser)
|
vector3 TGeometry::Load(TQueryParserComp *Parser)
|
||||||
{
|
{
|
||||||
@@ -113,7 +119,9 @@ vector3 TGeometry::Load(TQueryParserComp *Parser)
|
|||||||
tmp->fSquareRadius += r;
|
tmp->fSquareRadius += r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TGeometry::Render() {}
|
bool TGeometry::Render()
|
||||||
|
{
|
||||||
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma package(smart_init)
|
#pragma package(smart_init)
|
||||||
|
|||||||
@@ -206,7 +206,10 @@ class Global
|
|||||||
static AnsiString asHumanCtrlVehicle;
|
static AnsiString asHumanCtrlVehicle;
|
||||||
static void LoadIniFile(AnsiString asFileName);
|
static void LoadIniFile(AnsiString asFileName);
|
||||||
static void InitKeys(AnsiString asFileName);
|
static void InitKeys(AnsiString asFileName);
|
||||||
inline static vector3 GetCameraPosition() { return pCameraPosition; };
|
inline static vector3 GetCameraPosition()
|
||||||
|
{
|
||||||
|
return pCameraPosition;
|
||||||
|
};
|
||||||
static void SetCameraPosition(vector3 pNewCameraPosition);
|
static void SetCameraPosition(vector3 pNewCameraPosition);
|
||||||
static void SetCameraRotation(double Yaw);
|
static void SetCameraRotation(double Yaw);
|
||||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||||
|
|||||||
19
Ground.cpp
19
Ground.cpp
@@ -1626,8 +1626,7 @@ TGroundNode *__fastcall TGround::AddGroundNode(cParser *parser)
|
|||||||
*parser >> tmp->hvTraction->NominalVoltage >> tmp->hvTraction->MaxCurrent >>
|
*parser >> tmp->hvTraction->NominalVoltage >> tmp->hvTraction->MaxCurrent >>
|
||||||
tmp->hvTraction->fResistivity;
|
tmp->hvTraction->fResistivity;
|
||||||
if (tmp->hvTraction->fResistivity == 0.01) // tyle jest w sceneriach [om/km]
|
if (tmp->hvTraction->fResistivity == 0.01) // tyle jest w sceneriach [om/km]
|
||||||
tmp->hvTraction->fResistivity =
|
tmp->hvTraction->fResistivity = 0.075; // taka sensowniejsza wartoϾ za
|
||||||
0.075; // taka sensowniejsza wartoϾ za
|
|
||||||
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
||||||
tmp->hvTraction->fResistivity *= 0.001; // teraz [om/m]
|
tmp->hvTraction->fResistivity *= 0.001; // teraz [om/m]
|
||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
@@ -3202,15 +3201,14 @@ void TGround::InitTracks()
|
|||||||
Track->asEvent2Name = Current->asName + ":event2";
|
Track->asEvent2Name = Current->asName + ":event2";
|
||||||
|
|
||||||
if (Track->asEventall0Name.IsEmpty())
|
if (Track->asEventall0Name.IsEmpty())
|
||||||
if (FindEvent(Current->asName+":eventall0"))
|
if (FindEvent(Current->asName + ":eventall0"))
|
||||||
Track->asEventall0Name=Current->asName+":eventall0";
|
Track->asEventall0Name = Current->asName + ":eventall0";
|
||||||
if (Track->asEventall1Name.IsEmpty())
|
if (Track->asEventall1Name.IsEmpty())
|
||||||
if (FindEvent(Current->asName+":eventall1"))
|
if (FindEvent(Current->asName + ":eventall1"))
|
||||||
Track->asEventall1Name=Current->asName+":eventall1";
|
Track->asEventall1Name = Current->asName + ":eventall1";
|
||||||
if (Track->asEventall2Name.IsEmpty())
|
if (Track->asEventall2Name.IsEmpty())
|
||||||
if (FindEvent(Current->asName+":eventall2"))
|
if (FindEvent(Current->asName + ":eventall2"))
|
||||||
Track->asEventall2Name=Current->asName+":eventall2";
|
Track->asEventall2Name = Current->asName + ":eventall2";
|
||||||
|
|
||||||
}
|
}
|
||||||
Track->AssignEvents(
|
Track->AssignEvents(
|
||||||
Track->asEvent0Name.IsEmpty() ? NULL : FindEvent(Track->asEvent0Name),
|
Track->asEvent0Name.IsEmpty() ? NULL : FindEvent(Track->asEvent0Name),
|
||||||
@@ -4454,7 +4452,8 @@ bool TGround::GetTraction(TDynamicObject *model)
|
|||||||
false) // jeœli drut jest ni¿ej ni¿ 15cm pod
|
false) // jeœli drut jest ni¿ej ni¿ 15cm pod
|
||||||
// œlizgiem
|
// œlizgiem
|
||||||
{ // prze³¹czamy w tryb po³amania, o ile jedzie;
|
{ // prze³¹czamy w tryb po³amania, o ile jedzie;
|
||||||
// (bEnableTraction) aby da³o siê jeŸdziæ na koœlawych
|
// (bEnableTraction) aby da³o siê jeŸdziæ na
|
||||||
|
// koœlawych
|
||||||
// sceneriach
|
// sceneriach
|
||||||
fHorizontal = fabs(DotProduct(vGdzie, vLeft)) -
|
fHorizontal = fabs(DotProduct(vGdzie, vLeft)) -
|
||||||
p->fWidth; // i do tego jeszcze
|
p->fWidth; // i do tego jeszcze
|
||||||
|
|||||||
18
Ground.h
18
Ground.h
@@ -193,8 +193,7 @@ class TSubRect : public Resource, public CMesh
|
|||||||
TSubRect();
|
TSubRect();
|
||||||
virtual ~TSubRect();
|
virtual ~TSubRect();
|
||||||
virtual void Release(); // zwalnianie VBO sektora
|
virtual void Release(); // zwalnianie VBO sektora
|
||||||
void NodeAdd(
|
void NodeAdd(TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory
|
||||||
TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory
|
|
||||||
void RaNodeAdd(TGroundNode *Node); // dodanie obiektu do listy renderowania
|
void RaNodeAdd(TGroundNode *Node); // dodanie obiektu do listy renderowania
|
||||||
void Sort(); // optymalizacja obiektów w sektorze (sortowanie wg tekstur)
|
void Sort(); // optymalizacja obiektów w sektorze (sortowanie wg tekstur)
|
||||||
TTrack *__fastcall FindTrack(vector3 *Point, int &iConnection, TTrack *Exclude);
|
TTrack *__fastcall FindTrack(vector3 *Point, int &iConnection, TTrack *Exclude);
|
||||||
@@ -227,7 +226,10 @@ class TGroundRect : public TSubRect
|
|||||||
private:
|
private:
|
||||||
int iLastDisplay; // numer klatki w której był ostatnio wyświetlany
|
int iLastDisplay; // numer klatki w której był ostatnio wyświetlany
|
||||||
TSubRect *pSubRects;
|
TSubRect *pSubRects;
|
||||||
void Init() { pSubRects = new TSubRect[iNumSubRects * iNumSubRects]; };
|
void Init()
|
||||||
|
{
|
||||||
|
pSubRects = new TSubRect[iNumSubRects * iNumSubRects];
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int iFrameNumber; // numer kolejny wyświetlanej klatki
|
static int iFrameNumber; // numer kolejny wyświetlanej klatki
|
||||||
@@ -359,8 +361,14 @@ class TGround
|
|||||||
};
|
};
|
||||||
TSubRect *__fastcall GetSubRect(int iCol, int iRow);
|
TSubRect *__fastcall GetSubRect(int iCol, int iRow);
|
||||||
TSubRect *__fastcall FastGetSubRect(int iCol, int iRow);
|
TSubRect *__fastcall FastGetSubRect(int iCol, int iRow);
|
||||||
int GetRowFromZ(double z) { return (z / fSubRectSize + fHalfTotalNumSubRects); };
|
int GetRowFromZ(double z)
|
||||||
int GetColFromX(double x) { return (x / fSubRectSize + fHalfTotalNumSubRects); };
|
{
|
||||||
|
return (z / fSubRectSize + fHalfTotalNumSubRects);
|
||||||
|
};
|
||||||
|
int GetColFromX(double x)
|
||||||
|
{
|
||||||
|
return (x / fSubRectSize + fHalfTotalNumSubRects);
|
||||||
|
};
|
||||||
TEvent *__fastcall FindEvent(const AnsiString &asEventName);
|
TEvent *__fastcall FindEvent(const AnsiString &asEventName);
|
||||||
TEvent *__fastcall FindEventScan(const AnsiString &asEventName);
|
TEvent *__fastcall FindEventScan(const AnsiString &asEventName);
|
||||||
void TrackJoin(TGroundNode *Current);
|
void TrackJoin(TGroundNode *Current);
|
||||||
|
|||||||
24
Machajka.cpp
24
Machajka.cpp
@@ -15,9 +15,14 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
__fastcall TMachajka::TMachajka() : TTrain() { TTrain::TTrain(); }
|
__fastcall TMachajka::TMachajka() : TTrain()
|
||||||
|
{
|
||||||
|
TTrain::TTrain();
|
||||||
|
}
|
||||||
|
|
||||||
__fastcall TMachajka::~TMachajka() {}
|
__fastcall TMachajka::~TMachajka()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool TMachajka::Init(TDynamicObject *NewDynamicObject)
|
bool TMachajka::Init(TDynamicObject *NewDynamicObject)
|
||||||
{
|
{
|
||||||
@@ -63,11 +68,20 @@ void TMachajka::OnKeyPress(int cKey)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMachajka::Update(double dt) { TTrain::Update(dt); }
|
bool TMachajka::Update(double dt)
|
||||||
|
{
|
||||||
|
TTrain::Update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
bool TMachajka::UpdateMechPosition() { TTrain::UpdateMechPosition(); }
|
bool TMachajka::UpdateMechPosition()
|
||||||
|
{
|
||||||
|
TTrain::UpdateMechPosition();
|
||||||
|
}
|
||||||
|
|
||||||
bool TMachajka::Render() { TTrain::Render(); }
|
bool TMachajka::Render()
|
||||||
|
{
|
||||||
|
TTrain::Render();
|
||||||
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma package(smart_init)
|
#pragma package(smart_init)
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ __fastcall TModelsManager::~TModelsManager()
|
|||||||
Free();
|
Free();
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
void TModelsManager::Free() { SafeDeleteArray(Models); }
|
void TModelsManager::Free()
|
||||||
|
{
|
||||||
|
SafeDeleteArray(Models);
|
||||||
|
}
|
||||||
|
|
||||||
TModel3d *__fastcall TModelsManager::LoadModel(char *Name, bool dynamic)
|
TModel3d *__fastcall TModelsManager::LoadModel(char *Name, bool dynamic)
|
||||||
{ // wczytanie modelu do tablicy
|
{ // wczytanie modelu do tablicy
|
||||||
|
|||||||
20
MemCell.cpp
20
MemCell.cpp
@@ -41,12 +41,16 @@ TMemCell::TMemCell(vector3 *p)
|
|||||||
OnSent = NULL;
|
OnSent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TMemCell::~TMemCell() { SafeDeleteArray(szText); }
|
TMemCell::~TMemCell()
|
||||||
|
{
|
||||||
|
SafeDeleteArray(szText);
|
||||||
|
}
|
||||||
|
|
||||||
void TMemCell::Init() {}
|
void TMemCell::Init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
void TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2, int CheckMask)
|
||||||
int CheckMask)
|
|
||||||
{
|
{
|
||||||
if (CheckMask & update_memadd)
|
if (CheckMask & update_memadd)
|
||||||
{ // dodawanie wartoœci
|
{ // dodawanie wartoœci
|
||||||
@@ -140,8 +144,7 @@ void TMemCell::PutCommand(TController *Mech, vector3 *Loc)
|
|||||||
Mech->PutCommand(szText, fValue1, fValue2, Loc);
|
Mech->PutCommand(szText, fValue1, fValue2, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2, int CheckMask)
|
||||||
int CheckMask)
|
|
||||||
{ // porównanie zawartoœci komórki pamiêci z podanymi wartoœciami
|
{ // porównanie zawartoœci komórki pamiêci z podanymi wartoœciami
|
||||||
if (TestFlag(CheckMask, conditional_memstring))
|
if (TestFlag(CheckMask, conditional_memstring))
|
||||||
{ // porównaæ teksty
|
{ // porównaæ teksty
|
||||||
@@ -161,7 +164,10 @@ bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
|||||||
(!TestFlag(CheckMask, conditional_memval2) || (fValue2 == fTestValue2)));
|
(!TestFlag(CheckMask, conditional_memval2) || (fValue2 == fTestValue2)));
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TMemCell::Render() { return true; }
|
bool TMemCell::Render()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool TMemCell::IsVelocity()
|
bool TMemCell::IsVelocity()
|
||||||
{ // sprawdzenie, czy event odczytu tej komórki ma byæ do skanowania, czy do kolejkowania
|
{ // sprawdzenie, czy event odczytu tej komórki ma byæ do skanowania, czy do kolejkowania
|
||||||
|
|||||||
36
MemCell.h
36
MemCell.h
@@ -30,19 +30,35 @@ class TMemCell
|
|||||||
TMemCell(vector3 *p);
|
TMemCell(vector3 *p);
|
||||||
~TMemCell();
|
~TMemCell();
|
||||||
void Init();
|
void Init();
|
||||||
void UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
void UpdateValues(char *szNewText, double fNewValue1, double fNewValue2, int CheckMask);
|
||||||
int CheckMask);
|
|
||||||
bool Load(cParser *parser);
|
bool Load(cParser *parser);
|
||||||
void PutCommand(TController *Mech, vector3 *Loc);
|
void PutCommand(TController *Mech, vector3 *Loc);
|
||||||
bool Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
bool Compare(char *szTestText, double fTestValue1, double fTestValue2, int CheckMask);
|
||||||
int CheckMask);
|
|
||||||
bool Render();
|
bool Render();
|
||||||
inline char *__fastcall Text() { return szText; };
|
inline char *__fastcall Text()
|
||||||
inline double Value1() { return fValue1; };
|
{
|
||||||
inline double Value2() { return fValue2; };
|
return szText;
|
||||||
inline vector3 Position() { return vPosition; };
|
};
|
||||||
inline TCommandType Command() { return eCommand; };
|
inline double Value1()
|
||||||
inline bool StopCommand() { return bCommand; };
|
{
|
||||||
|
return fValue1;
|
||||||
|
};
|
||||||
|
inline double Value2()
|
||||||
|
{
|
||||||
|
return fValue2;
|
||||||
|
};
|
||||||
|
inline vector3 Position()
|
||||||
|
{
|
||||||
|
return vPosition;
|
||||||
|
};
|
||||||
|
inline TCommandType Command()
|
||||||
|
{
|
||||||
|
return eCommand;
|
||||||
|
};
|
||||||
|
inline bool StopCommand()
|
||||||
|
{
|
||||||
|
return bCommand;
|
||||||
|
};
|
||||||
void StopCommandSent();
|
void StopCommandSent();
|
||||||
TCommandType CommandCheck();
|
TCommandType CommandCheck();
|
||||||
bool IsVelocity();
|
bool IsVelocity();
|
||||||
|
|||||||
30
Model3d.cpp
30
Model3d.cpp
@@ -178,8 +178,7 @@ void TSubModel::NameSet(const char *n)
|
|||||||
|
|
||||||
// int TSubModel::SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
// int TSubModel::SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||||
// *Vertices)
|
// *Vertices)
|
||||||
int TSubModel::SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt,
|
int TSubModel::SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt, float8 *Vertices)
|
||||||
float8 *Vertices)
|
|
||||||
{ // szukanie punktu stycznego do (pt), zwraca numer wierzcho³ka, a nie trójk¹ta
|
{ // szukanie punktu stycznego do (pt), zwraca numer wierzcho³ka, a nie trójk¹ta
|
||||||
int iNumFaces = iNumVerts / 3; // bo maska powierzchni jest jedna na trójk¹t
|
int iNumFaces = iNumVerts / 3; // bo maska powierzchni jest jedna na trójk¹t
|
||||||
// GLVERTEX *p; //roboczy wskaŸnik
|
// GLVERTEX *p; //roboczy wskaŸnik
|
||||||
@@ -916,7 +915,10 @@ void TSubModel::SetRotateIK1(float3 vNewAngles)
|
|||||||
|
|
||||||
struct ToLower
|
struct ToLower
|
||||||
{
|
{
|
||||||
char operator()(char input) { return tolower(input); }
|
char operator()(char input)
|
||||||
|
{
|
||||||
|
return tolower(input);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TSubModel *__fastcall TSubModel::GetFromName(AnsiString search, bool i)
|
TSubModel *__fastcall TSubModel::GetFromName(AnsiString search, bool i)
|
||||||
@@ -1523,8 +1525,8 @@ void TSubModel::InfoSet(TSubModelInfo *info)
|
|||||||
pTexture = pName = NULL;
|
pTexture = pName = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t, TStringPack *n,
|
||||||
TStringPack *n, bool dynamic)
|
bool dynamic)
|
||||||
{ // ustawienie wskaŸników w submodelu
|
{ // ustawienie wskaŸników w submodelu
|
||||||
iVisible = 1; // tymczasowo u¿ywane
|
iVisible = 1; // tymczasowo u¿ywane
|
||||||
Child = ((int)Child > 0) ? s + (int)Child : NULL; // zerowy nie mo¿e byæ potomnym
|
Child = ((int)Child > 0) ? s + (int)Child : NULL; // zerowy nie mo¿e byæ potomnym
|
||||||
@@ -2019,7 +2021,10 @@ void TModel3d::SaveToBinFile(char *FileName)
|
|||||||
delete[] info;
|
delete[] info;
|
||||||
};
|
};
|
||||||
|
|
||||||
void TModel3d::BreakHierarhy() { Error("Not implemented yet :("); };
|
void TModel3d::BreakHierarhy()
|
||||||
|
{
|
||||||
|
Error("Not implemented yet :(");
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void TModel3d::Render(vector3 pPosition,double fAngle,GLuint ReplacableSkinId,int iAlpha)
|
void TModel3d::Render(vector3 pPosition,double fAngle,GLuint ReplacableSkinId,int iAlpha)
|
||||||
@@ -2122,8 +2127,7 @@ void TModel3d::RaRender(double fSquareDistance, GLuint *ReplacableSkinId, int iA
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId,
|
void TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||||
int iAlpha)
|
|
||||||
{ // renderowanie specjalne, np. kabiny
|
{ // renderowanie specjalne, np. kabiny
|
||||||
if (iAlpha & iFlags & 0x2F2F002F) // czy w ogóle jest co robiæ w tym cyklu?
|
if (iAlpha & iFlags & 0x2F2F002F) // czy w ogóle jest co robiæ w tym cyklu?
|
||||||
{
|
{
|
||||||
@@ -2159,8 +2163,7 @@ iAlpha)
|
|||||||
// 2011-03-16 cztery nowe funkcje renderowania z mo¿liwoœci¹ pochylania obiektów
|
// 2011-03-16 cztery nowe funkcje renderowania z mo¿liwoœci¹ pochylania obiektów
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId, int iAlpha)
|
||||||
int iAlpha)
|
|
||||||
{ // nieprzezroczyste, Display List
|
{ // nieprzezroczyste, Display List
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||||
@@ -2194,8 +2197,7 @@ void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *Replacab
|
|||||||
Root->RenderAlphaDL();
|
Root->RenderAlphaDL();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
};
|
};
|
||||||
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId, int iAlpha)
|
||||||
int iAlpha)
|
|
||||||
{ // nieprzezroczyste, VBO
|
{ // nieprzezroczyste, VBO
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||||
@@ -2215,8 +2217,8 @@ void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableS
|
|||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
};
|
};
|
||||||
void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||||
GLuint *ReplacableSkinId, int iAlpha)
|
int iAlpha)
|
||||||
{ // przezroczyste, VBO
|
{ // przezroczyste, VBO
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||||
|
|||||||
91
Model3d.h
91
Model3d.h
@@ -36,21 +36,33 @@ class TStringPack
|
|||||||
//+8 - tabela indeksów
|
//+8 - tabela indeksów
|
||||||
public:
|
public:
|
||||||
char *String(int n);
|
char *String(int n);
|
||||||
char *StringAt(int n) { return data + 9 + n; };
|
char *StringAt(int n)
|
||||||
|
{
|
||||||
|
return data + 9 + n;
|
||||||
|
};
|
||||||
TStringPack()
|
TStringPack()
|
||||||
{
|
{
|
||||||
data = NULL;
|
data = NULL;
|
||||||
index = NULL;
|
index = NULL;
|
||||||
};
|
};
|
||||||
void Init(char *d) { data = d; };
|
void Init(char *d)
|
||||||
void InitIndex(int *i) { index = i; };
|
{
|
||||||
|
data = d;
|
||||||
|
};
|
||||||
|
void InitIndex(int *i)
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMaterialColor
|
class TMaterialColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TMaterialColor(){};
|
TMaterialColor(){};
|
||||||
TMaterialColor(char V) { r = g = b = V; };
|
TMaterialColor(char V)
|
||||||
|
{
|
||||||
|
r = g = b = V;
|
||||||
|
};
|
||||||
// TMaterialColor(double R, double G, double B)
|
// TMaterialColor(double R, double G, double B)
|
||||||
TMaterialColor(char R, char G, char B)
|
TMaterialColor(char R, char G, char B)
|
||||||
{
|
{
|
||||||
@@ -250,8 +262,14 @@ class TSubModel
|
|||||||
int Load(cParser &Parser, TModel3d *Model, int Pos, bool dynamic);
|
int Load(cParser &Parser, TModel3d *Model, int Pos, bool dynamic);
|
||||||
void ChildAdd(TSubModel *SubModel);
|
void ChildAdd(TSubModel *SubModel);
|
||||||
void NextAdd(TSubModel *SubModel);
|
void NextAdd(TSubModel *SubModel);
|
||||||
TSubModel *__fastcall NextGet() { return Next; };
|
TSubModel *__fastcall NextGet()
|
||||||
TSubModel *__fastcall ChildGet() { return Child; };
|
{
|
||||||
|
return Next;
|
||||||
|
};
|
||||||
|
TSubModel *__fastcall ChildGet()
|
||||||
|
{
|
||||||
|
return Child;
|
||||||
|
};
|
||||||
int TriangleAdd(TModel3d *m, int tex, int tri);
|
int TriangleAdd(TModel3d *m, int tex, int tri);
|
||||||
float8 *__fastcall TrianglePtr(int tex, int pos, int *la, int *ld, int *ls);
|
float8 *__fastcall TrianglePtr(int tex, int pos, int *la, int *ld, int *ls);
|
||||||
// float8* TrianglePtr(const char *tex,int tri);
|
// float8* TrianglePtr(const char *tex,int tri);
|
||||||
@@ -269,9 +287,15 @@ class TSubModel
|
|||||||
void RenderVBO();
|
void RenderVBO();
|
||||||
void RenderAlphaVBO();
|
void RenderAlphaVBO();
|
||||||
// inline matrix4x4* GetMatrix() {return dMatrix;};
|
// inline matrix4x4* GetMatrix() {return dMatrix;};
|
||||||
inline float4x4 *__fastcall GetMatrix() { return fMatrix; };
|
inline float4x4 *__fastcall GetMatrix()
|
||||||
|
{
|
||||||
|
return fMatrix;
|
||||||
|
};
|
||||||
// matrix4x4* GetTransform() {return Matrix;};
|
// matrix4x4* GetTransform() {return Matrix;};
|
||||||
inline void Hide() { iVisible = 0; };
|
inline void Hide()
|
||||||
|
{
|
||||||
|
iVisible = 0;
|
||||||
|
};
|
||||||
void RaArrayFill(CVertNormTex *Vert);
|
void RaArrayFill(CVertNormTex *Vert);
|
||||||
// void Render();
|
// void Render();
|
||||||
int FlagsCheck();
|
int FlagsCheck();
|
||||||
@@ -284,8 +308,8 @@ class TSubModel
|
|||||||
void DisplayLists();
|
void DisplayLists();
|
||||||
void Info();
|
void Info();
|
||||||
void InfoSet(TSubModelInfo *info);
|
void InfoSet(TSubModelInfo *info);
|
||||||
void BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
void BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t, TStringPack *n = NULL,
|
||||||
TStringPack *n = NULL, bool dynamic = false);
|
bool dynamic = false);
|
||||||
void ReplacableSet(GLuint *r, int a)
|
void ReplacableSet(GLuint *r, int a)
|
||||||
{
|
{
|
||||||
ReplacableSkinId = r;
|
ReplacableSkinId = r;
|
||||||
@@ -294,8 +318,14 @@ class TSubModel
|
|||||||
void TextureNameSet(const char *n);
|
void TextureNameSet(const char *n);
|
||||||
void NameSet(const char *n);
|
void NameSet(const char *n);
|
||||||
// Ra: funkcje do budowania terenu z E3D
|
// Ra: funkcje do budowania terenu z E3D
|
||||||
int Flags() { return iFlags; };
|
int Flags()
|
||||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
{
|
||||||
|
return iFlags;
|
||||||
|
};
|
||||||
|
void UnFlagNext()
|
||||||
|
{
|
||||||
|
iFlags &= 0x00FFFFFF;
|
||||||
|
};
|
||||||
void ColorsSet(int *a, int *d, int *s);
|
void ColorsSet(int *a, int *d, int *s);
|
||||||
inline float3 Translation1Get()
|
inline float3 Translation1Get()
|
||||||
{
|
{
|
||||||
@@ -356,7 +386,10 @@ class TModel3d : public CMesh
|
|||||||
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
||||||
AnsiString asBinary; // nazwa pod którą zapisać model binarny
|
AnsiString asBinary; // nazwa pod którą zapisać model binarny
|
||||||
public:
|
public:
|
||||||
inline TSubModel *__fastcall GetSMRoot() { return (Root); };
|
inline TSubModel *__fastcall GetSMRoot()
|
||||||
|
{
|
||||||
|
return (Root);
|
||||||
|
};
|
||||||
// double Radius; //Ra: nie używane
|
// double Radius; //Ra: nie używane
|
||||||
TModel3d();
|
TModel3d();
|
||||||
TModel3d(char *FileName);
|
TModel3d(char *FileName);
|
||||||
@@ -371,36 +404,40 @@ class TModel3d : public CMesh
|
|||||||
void SaveToBinFile(char *FileName);
|
void SaveToBinFile(char *FileName);
|
||||||
void BreakHierarhy();
|
void BreakHierarhy();
|
||||||
// renderowanie specjalne
|
// renderowanie specjalne
|
||||||
void Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
void Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
int iAlpha = 0x30300030);
|
|
||||||
void RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
void RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
void RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
int iAlpha = 0x30300030);
|
|
||||||
void RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
void RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
// jeden kąt obrotu
|
// jeden kąt obrotu
|
||||||
void Render(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
void Render(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RenderAlpha(vector3 pPosition, double fAngle = 0,
|
void RenderAlpha(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRender(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
void RaRender(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRenderAlpha(vector3 pPosition, double fAngle = 0,
|
void RaRenderAlpha(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
// trzy kąty obrotu
|
// trzy kąty obrotu
|
||||||
void Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
void Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
void RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
||||||
int Flags() { return iFlags; };
|
int Flags()
|
||||||
|
{
|
||||||
|
return iFlags;
|
||||||
|
};
|
||||||
void Init();
|
void Init();
|
||||||
char *__fastcall NameGet() { return Root ? Root->pName : NULL; };
|
char *__fastcall NameGet()
|
||||||
|
{
|
||||||
|
return Root ? Root->pName : NULL;
|
||||||
|
};
|
||||||
int TerrainCount();
|
int TerrainCount();
|
||||||
TSubModel *__fastcall TerrainSquare(int n);
|
TSubModel *__fastcall TerrainSquare(int n);
|
||||||
void TerrainRenderVBO(int n);
|
void TerrainRenderVBO(int n);
|
||||||
|
|||||||
29
Mover.cpp
29
Mover.cpp
@@ -16,9 +16,8 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
const dEpsilon = 0.01; // 1cm (zale¿y od typu sprzêgu...)
|
const dEpsilon = 0.01; // 1cm (zale¿y od typu sprzêgu...)
|
||||||
|
|
||||||
TMoverParameters::TMoverParameters(double VelInitial, AnsiString TypeNameInit,
|
TMoverParameters::TMoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||||
AnsiString NameInit, int LoadInitial,
|
int LoadInitial, AnsiString LoadTypeInitial, int Cab)
|
||||||
AnsiString LoadTypeInitial, int Cab)
|
|
||||||
: T_MoverParameters(VelInitial, TypeNameInit, NameInit, LoadInitial, LoadTypeInitial, Cab)
|
: T_MoverParameters(VelInitial, TypeNameInit, NameInit, LoadInitial, LoadTypeInitial, Cab)
|
||||||
{ // g³ówny konstruktor
|
{ // g³ówny konstruktor
|
||||||
DimHalf.x = 0.5 * Dim.W; // po³owa szerokoœci, OX jest w bok?
|
DimHalf.x = 0.5 * Dim.W; // po³owa szerokoœci, OX jest w bok?
|
||||||
@@ -37,8 +36,8 @@ double TMoverParameters::Distance(const TLocation &Loc1, const TLocation &Loc2,
|
|||||||
return hypot(Loc2.X - Loc1.X, Loc1.Y - Loc2.Y) - 0.5 * (Dim2.L + Dim1.L);
|
return hypot(Loc2.X - Loc1.X, Loc1.Y - Loc2.Y) - 0.5 * (Dim2.L + Dim1.L);
|
||||||
};
|
};
|
||||||
|
|
||||||
double TMoverParameters::Distance(const vector3 &s1, const vector3 &s2,
|
double TMoverParameters::Distance(const vector3 &s1, const vector3 &s2, const vector3 &d1,
|
||||||
const vector3 &d1, const vector3 &d2){
|
const vector3 &d2){
|
||||||
// obliczenie odleg³oœci prostopad³oœcianów o œrodkach (s1) i (s2) i wymiarach (d1) i (d2)
|
// obliczenie odleg³oœci prostopad³oœcianów o œrodkach (s1) i (s2) i wymiarach (d1) i (d2)
|
||||||
// return 0.0; //bêdzie zg³aszaæ warning - funkcja do usuniêcia, chyba ¿e siê przyda...
|
// return 0.0; //bêdzie zg³aszaæ warning - funkcja do usuniêcia, chyba ¿e siê przyda...
|
||||||
};
|
};
|
||||||
@@ -50,9 +49,8 @@ double TMoverParameters::CouplerDist(Byte Coupler)
|
|||||||
Couplers[Coupler].Connected->Dim); // odleg³oœæ pomiêdzy sprzêgami (kula!)
|
Couplers[Coupler].Connected->Dim); // odleg³oœæ pomiêdzy sprzêgami (kula!)
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
||||||
TMoverParameters *ConnectTo, Byte CouplingType,
|
Byte CouplingType, bool Forced)
|
||||||
bool Forced)
|
|
||||||
{ //³¹czenie do swojego sprzêgu (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
{ //³¹czenie do swojego sprzêgu (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
||||||
// Ra: zwykle wykonywane dwukrotnie, dla ka¿dego pojazdu oddzielnie
|
// Ra: zwykle wykonywane dwukrotnie, dla ka¿dego pojazdu oddzielnie
|
||||||
// Ra: trzeba by odró¿niæ wymóg dociœniêcia od uszkodzenia sprzêgu przy podczepianiu AI do
|
// Ra: trzeba by odró¿niæ wymóg dociœniêcia od uszkodzenia sprzêgu przy podczepianiu AI do
|
||||||
@@ -94,9 +92,8 @@ bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
|||||||
// sprzêgu, brak haka
|
// sprzêgu, brak haka
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo,
|
||||||
T_MoverParameters *ConnectTo, Byte CouplingType,
|
Byte CouplingType, bool Forced)
|
||||||
bool Forced)
|
|
||||||
{ //³¹czenie do (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
{ //³¹czenie do (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
||||||
return Attach(ConnectNo, ConnectToNr, (TMoverParameters *)ConnectTo, CouplingType, Forced);
|
return Attach(ConnectNo, ConnectToNr, (TMoverParameters *)ConnectTo, CouplingType, Forced);
|
||||||
};
|
};
|
||||||
@@ -234,10 +231,13 @@ bool TMoverParameters::BrakeLevelAdd(double b)
|
|||||||
|
|
||||||
bool TMoverParameters::IncBrakeLevel()
|
bool TMoverParameters::IncBrakeLevel()
|
||||||
{ // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê BrakeCtrlPosNo
|
{ // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê BrakeCtrlPosNo
|
||||||
return BrakeLevelAdd(1.0); };
|
return BrakeLevelAdd(1.0);
|
||||||
|
};
|
||||||
|
|
||||||
bool TMoverParameters::DecBrakeLevel()
|
bool TMoverParameters::DecBrakeLevel()
|
||||||
{ return BrakeLevelAdd(-1.0); }; // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê -1
|
{
|
||||||
|
return BrakeLevelAdd(-1.0);
|
||||||
|
}; // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê -1
|
||||||
|
|
||||||
bool TMoverParameters::ChangeCab(int direction)
|
bool TMoverParameters::ChangeCab(int direction)
|
||||||
{ // zmiana kabiny i resetowanie ustawien
|
{ // zmiana kabiny i resetowanie ustawien
|
||||||
@@ -475,8 +475,7 @@ ZN //masa
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||||
TTrackParam &Track,
|
TTrackParam &Track, TTractionParam &ElectricTraction,
|
||||||
TTractionParam &ElectricTraction,
|
|
||||||
const TLocation &NewLoc, TRotation &NewRot)
|
const TLocation &NewLoc, TRotation &NewRot)
|
||||||
{ // trzeba po ma³u przenosiæ tu tê funkcjê
|
{ // trzeba po ma³u przenosiæ tu tê funkcjê
|
||||||
double d;
|
double d;
|
||||||
|
|||||||
16
Mover.h
16
Mover.h
@@ -50,10 +50,10 @@ class TMoverParameters : public T_MoverParameters
|
|||||||
const TDimension &Dim2);
|
const TDimension &Dim2);
|
||||||
double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1,
|
double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1,
|
||||||
const vector3 &Dim2);
|
const vector3 &Dim2);
|
||||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
bool Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo, Byte CouplingType,
|
||||||
Byte CouplingType, bool Forced = false);
|
bool Forced = false);
|
||||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo,
|
bool Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo, Byte CouplingType,
|
||||||
Byte CouplingType, bool Forced = false);
|
bool Forced = false);
|
||||||
int DettachStatus(Byte ConnectNo);
|
int DettachStatus(Byte ConnectNo);
|
||||||
bool Dettach(Byte ConnectNo);
|
bool Dettach(Byte ConnectNo);
|
||||||
void SetCoupleDist();
|
void SetCoupleDist();
|
||||||
@@ -65,9 +65,9 @@ class TMoverParameters : public T_MoverParameters
|
|||||||
bool ChangeCab(int direction);
|
bool ChangeCab(int direction);
|
||||||
bool CurrentSwitch(int direction);
|
bool CurrentSwitch(int direction);
|
||||||
void UpdateBatteryVoltage(double dt);
|
void UpdateBatteryVoltage(double dt);
|
||||||
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track,
|
||||||
TTrackParam &Track, TTractionParam &ElectricTraction,
|
TTractionParam &ElectricTraction, const TLocation &NewLoc,
|
||||||
const TLocation &NewLoc, TRotation &NewRot);
|
TRotation &NewRot);
|
||||||
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track,
|
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track,
|
||||||
const TLocation &NewLoc, TRotation &NewRot);
|
const TLocation &NewLoc, TRotation &NewRot);
|
||||||
double ShowEngineRotation(int VehN);
|
double ShowEngineRotation(int VehN);
|
||||||
@@ -170,7 +170,7 @@ class TMoverParameters : public T_MoverParameters
|
|||||||
// TLocation &NewLoc, TRotation &NewRot);
|
// TLocation &NewLoc, TRotation &NewRot);
|
||||||
// bool ChangeOffsetH(double DeltaOffset);
|
// bool ChangeOffsetH(double DeltaOffset);
|
||||||
//__fastcall T_MoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
//__fastcall T_MoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||||
//int LoadInitial
|
// int LoadInitial
|
||||||
// , AnsiString LoadTypeInitial, int Cab);
|
// , AnsiString LoadTypeInitial, int Cab);
|
||||||
// bool LoadChkFile(AnsiString chkpath);
|
// bool LoadChkFile(AnsiString chkpath);
|
||||||
// bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
|
// bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
|
||||||
|
|||||||
13
Names.h
13
Names.h
@@ -26,8 +26,14 @@ class ItemRecord
|
|||||||
// typedef
|
// typedef
|
||||||
void ListGet(ItemRecord *r, int *&n);
|
void ListGet(ItemRecord *r, int *&n);
|
||||||
void TreeAdd(ItemRecord *r, int c);
|
void TreeAdd(ItemRecord *r, int c);
|
||||||
template <typename TOut> inline TOut *DataGet() { return (TOut *)pData; };
|
template <typename TOut> inline TOut *DataGet()
|
||||||
template <typename TOut> inline void DataSet(TOut *x) { pData = (void *)x; };
|
{
|
||||||
|
return (TOut *)pData;
|
||||||
|
};
|
||||||
|
template <typename TOut> inline void DataSet(TOut *x)
|
||||||
|
{
|
||||||
|
pData = (void *)x;
|
||||||
|
};
|
||||||
void *__fastcall TreeFind(const char *n);
|
void *__fastcall TreeFind(const char *n);
|
||||||
ItemRecord *__fastcall TreeFindRecord(const char *n);
|
ItemRecord *__fastcall TreeFindRecord(const char *n);
|
||||||
};
|
};
|
||||||
@@ -46,8 +52,7 @@ class TNames
|
|||||||
int Add(int t, const char *n); // dodanie obiektu typu (t)
|
int Add(int t, const char *n); // dodanie obiektu typu (t)
|
||||||
int Add(int t, const char *n, void *d); // dodanie obiektu z wskaŸnikiem
|
int Add(int t, const char *n, void *d); // dodanie obiektu z wskaŸnikiem
|
||||||
int Add(int t, const char *n, int d); // dodanie obiektu z numerem
|
int Add(int t, const char *n, int d); // dodanie obiektu z numerem
|
||||||
bool Update(int t, const char *n,
|
bool Update(int t, const char *n, void *d); // dodanie jeœli nie ma, wymiana (d), gdy jest
|
||||||
void *d); // dodanie jeœli nie ma, wymiana (d), gdy jest
|
|
||||||
void TreeSet();
|
void TreeSet();
|
||||||
ItemRecord *__fastcall TreeSet(int *n, int d, int u);
|
ItemRecord *__fastcall TreeSet(int *n, int d, int u);
|
||||||
void Sort(int t); // przebudowa drzewa typu (t)
|
void Sort(int t); // przebudowa drzewa typu (t)
|
||||||
|
|||||||
@@ -45,10 +45,12 @@ TRealSound::~TRealSound()
|
|||||||
// if (this) if (pSound) pSound->Stop();
|
// if (this) if (pSound) pSound->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRealSound::Free() {}
|
void TRealSound::Free()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y,
|
void TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y, double Z,
|
||||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
bool Dynamic, bool freqmod, double rmin)
|
||||||
{
|
{
|
||||||
// Nazwa=SoundName; //to tak raczej nie zadziała, (SoundName) jest tymczasowe
|
// Nazwa=SoundName; //to tak raczej nie zadziała, (SoundName) jest tymczasowe
|
||||||
pSound = TSoundsManager::GetFromName(SoundName, Dynamic, &fFrequency);
|
pSound = TSoundsManager::GetFromName(SoundName, Dynamic, &fFrequency);
|
||||||
@@ -95,8 +97,7 @@ double TRealSound::ListenerDistance(vector3 ListenerPosition)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
void TRealSound::Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition)
|
||||||
vector3 NewPosition)
|
|
||||||
{
|
{
|
||||||
if (!pSound)
|
if (!pSound)
|
||||||
return;
|
return;
|
||||||
@@ -168,7 +169,8 @@ void TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TRealSound::Start(){// włączenie dźwięku
|
void TRealSound::Start(){
|
||||||
|
// włączenie dźwięku
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -185,8 +187,7 @@ void TRealSound::Stop()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TRealSound::AdjFreq(double Freq,
|
void TRealSound::AdjFreq(double Freq, double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
||||||
double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
|
||||||
// Freq moze byc liczba dodatnia mniejsza od 1 lub wieksza od 1
|
// Freq moze byc liczba dodatnia mniejsza od 1 lub wieksza od 1
|
||||||
{
|
{
|
||||||
float df, Vlist, Vsrc;
|
float df, Vlist, Vsrc;
|
||||||
@@ -223,7 +224,10 @@ double TRealSound::GetWaveTime() // McZapkie: na razie tylko dla 22KHz/8bps
|
|||||||
fFrequency; //(pSound->); // wielkosc w bajtach przez czestotliwosc probkowania
|
fFrequency; //(pSound->); // wielkosc w bajtach przez czestotliwosc probkowania
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRealSound::SetPan(int Pan) { pSound->SetPan(Pan); }
|
void TRealSound::SetPan(int Pan)
|
||||||
|
{
|
||||||
|
pSound->SetPan(Pan);
|
||||||
|
}
|
||||||
|
|
||||||
int TRealSound::GetStatus()
|
int TRealSound::GetStatus()
|
||||||
{
|
{
|
||||||
@@ -243,8 +247,8 @@ void TRealSound::ResetPosition()
|
|||||||
pSound->SetCurrentPosition(0);
|
pSound->SetCurrentPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y,
|
void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
bool Dynamic, bool freqmod, double rmin)
|
||||||
{ // dodatkowo doczytuje plik tekstowy
|
{ // dodatkowo doczytuje plik tekstowy
|
||||||
TRealSound::Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
|
TRealSound::Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
|
||||||
fTime = GetWaveTime();
|
fTime = GetWaveTime();
|
||||||
@@ -264,8 +268,7 @@ void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double
|
|||||||
delete ts;
|
delete ts;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void TTextSound::Play(double Volume, int Looping, bool ListenerInside,
|
void TTextSound::Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition)
|
||||||
vector3 NewPosition)
|
|
||||||
{
|
{
|
||||||
if (!asText.IsEmpty())
|
if (!asText.IsEmpty())
|
||||||
{ // jeśli ma powiązany tekst
|
{ // jeśli ma powiązany tekst
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class TRealSound
|
|||||||
TRealSound();
|
TRealSound();
|
||||||
~TRealSound();
|
~TRealSound();
|
||||||
void Free();
|
void Free();
|
||||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
bool freqmod = false, double rmin = 0.0);
|
||||||
double ListenerDistance(vector3 ListenerPosition);
|
double ListenerDistance(vector3 ListenerPosition);
|
||||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||||
void Start();
|
void Start();
|
||||||
@@ -51,8 +51,8 @@ class TTextSound : public TRealSound
|
|||||||
AnsiString asText;
|
AnsiString asText;
|
||||||
float fTime; // czas trwania
|
float fTime; // czas trwania
|
||||||
public:
|
public:
|
||||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
bool freqmod = false, double rmin = 0.0);
|
||||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ double ResourceManager::_expiry = 5.0f;
|
|||||||
double ResourceManager::_lastUpdate = 0.0f;
|
double ResourceManager::_lastUpdate = 0.0f;
|
||||||
double ResourceManager::_lastReport = 0.0f;
|
double ResourceManager::_lastReport = 0.0f;
|
||||||
|
|
||||||
void ResourceManager::Register(Resource *resource) { _resources.push_back(resource); };
|
void ResourceManager::Register(Resource *resource)
|
||||||
|
{
|
||||||
|
_resources.push_back(resource);
|
||||||
|
};
|
||||||
|
|
||||||
void ResourceManager::Unregister(Resource *resource)
|
void ResourceManager::Unregister(Resource *resource)
|
||||||
{
|
{
|
||||||
@@ -33,7 +36,10 @@ class ResourceExpired
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResourceExpired(double time) : _time(time){};
|
ResourceExpired(double time) : _time(time){};
|
||||||
bool operator()(Resource *resource) { return (resource->GetLastUsage() < _time); }
|
bool operator()(Resource *resource)
|
||||||
|
{
|
||||||
|
return (resource->GetLastUsage() < _time);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double _time;
|
double _time;
|
||||||
|
|||||||
@@ -20,10 +20,16 @@ class Resource
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Release() = 0;
|
virtual void Release() = 0;
|
||||||
double GetLastUsage() const { return _lastUsage; }
|
double GetLastUsage() const
|
||||||
|
{
|
||||||
|
return _lastUsage;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetLastUsage(double lastUsage) { _lastUsage = lastUsage; }
|
void SetLastUsage(double lastUsage)
|
||||||
|
{
|
||||||
|
_lastUsage = lastUsage;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double _lastUsage;
|
double _lastUsage;
|
||||||
@@ -37,7 +43,10 @@ class ResourceManager
|
|||||||
static void Unregister(Resource *resource);
|
static void Unregister(Resource *resource);
|
||||||
|
|
||||||
static void Sweep(double currentTime);
|
static void Sweep(double currentTime);
|
||||||
static void SetExpiry(double expiry) { _expiry = expiry; }
|
static void SetExpiry(double expiry)
|
||||||
|
{
|
||||||
|
_expiry = expiry;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<Resource *> Resources;
|
typedef std::vector<Resource *> Resources;
|
||||||
|
|||||||
28
Segment.cpp
28
Segment.cpp
@@ -41,10 +41,13 @@ TSegment::TSegment(TTrack *owner)
|
|||||||
pOwner = owner;
|
pOwner = owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
TSegment::~TSegment() { SafeDeleteArray(fTsBuffer); };
|
TSegment::~TSegment()
|
||||||
|
{
|
||||||
|
SafeDeleteArray(fTsBuffer);
|
||||||
|
};
|
||||||
|
|
||||||
bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep, double fNewRoll1,
|
||||||
double fNewRoll1, double fNewRoll2)
|
double fNewRoll2)
|
||||||
{ // wersja dla prostego - wyliczanie punktów kontrolnych
|
{ // wersja dla prostego - wyliczanie punktów kontrolnych
|
||||||
vector3 dir;
|
vector3 dir;
|
||||||
if (fNewRoll1 == fNewRoll2)
|
if (fNewRoll1 == fNewRoll2)
|
||||||
@@ -62,8 +65,8 @@ bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
bool TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1,
|
vector3 &NewPoint2, double fNewStep, double fNewRoll1, double fNewRoll2,
|
||||||
double fNewRoll2, bool bIsCurve)
|
bool bIsCurve)
|
||||||
{ // wersja uniwersalna (dla krzywej i prostego)
|
{ // wersja uniwersalna (dla krzywej i prostego)
|
||||||
Point1 = NewPoint1;
|
Point1 = NewPoint1;
|
||||||
CPointOut = NewCPointOut;
|
CPointOut = NewCPointOut;
|
||||||
@@ -329,9 +332,8 @@ vector3 TSegment::FastGetPoint(double t)
|
|||||||
return (bCurve ? RaInterpolate(t) : ((1.0 - t) * Point1 + (t)*Point2));
|
return (bCurve ? RaInterpolate(t) : ((1.0 - t) * Point1 + (t)*Point2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
void TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePoints, double fTextureLength,
|
||||||
double fTextureLength, int iSkip, int iQualityFactor,
|
int iSkip, int iQualityFactor, vector3 **p, bool bRender)
|
||||||
vector3 **p, bool bRender)
|
|
||||||
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
||||||
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
||||||
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
||||||
@@ -696,9 +698,8 @@ void TSegment::Render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
||||||
int iNumShapePoints, double fTextureLength, int iSkip,
|
double fTextureLength, int iSkip, int iEnd, double fOffsetX)
|
||||||
int iEnd, double fOffsetX)
|
|
||||||
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
||||||
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
||||||
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
||||||
@@ -896,9 +897,8 @@ void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TSegment::RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
void TSegment::RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
||||||
int iNumShapePoints, double fTextureLength, int iSkip, int iEnd,
|
double fTextureLength, int iSkip, int iEnd, double fOffsetX)
|
||||||
double fOffsetX)
|
|
||||||
{ // jak wyżej, tylko z pominięciem mapowania i braku trapezowania
|
{ // jak wyżej, tylko z pominięciem mapowania i braku trapezowania
|
||||||
vector3 pos1, pos2, dir, parallel1, parallel2, pt;
|
vector3 pos1, pos2, dir, parallel1, parallel2, pt;
|
||||||
double s, step, fOffset, t, fEnd;
|
double s, step, fOffset, t, fEnd;
|
||||||
|
|||||||
62
Segment.h
62
Segment.h
@@ -77,22 +77,36 @@ class TSegment
|
|||||||
// (0-Bezier,1-prosty,2/3-³uk w lewo/prawo,6/7-przejœciowa w lewo/prawo)
|
// (0-Bezier,1-prosty,2/3-³uk w lewo/prawo,6/7-przejœciowa w lewo/prawo)
|
||||||
TSegment(TTrack *owner);
|
TSegment(TTrack *owner);
|
||||||
~TSegment();
|
~TSegment();
|
||||||
bool Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
bool Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep, double fNewRoll1 = 0,
|
||||||
double fNewRoll1 = 0, double fNewRoll2 = 0);
|
double fNewRoll2 = 0);
|
||||||
bool Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
bool Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn, vector3 &NewPoint2,
|
||||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1 = 0,
|
double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
|
||||||
double fNewRoll2 = 0, bool bIsCurve = true);
|
|
||||||
inline double ComputeLength(); // McZapkie-150503
|
inline double ComputeLength(); // McZapkie-150503
|
||||||
inline vector3 GetDirection1() { return bCurve ? CPointOut - Point1 : CPointOut; };
|
inline vector3 GetDirection1()
|
||||||
inline vector3 GetDirection2() { return bCurve ? CPointIn - Point2 : CPointIn; };
|
{
|
||||||
|
return bCurve ? CPointOut - Point1 : CPointOut;
|
||||||
|
};
|
||||||
|
inline vector3 GetDirection2()
|
||||||
|
{
|
||||||
|
return bCurve ? CPointIn - Point2 : CPointIn;
|
||||||
|
};
|
||||||
vector3 GetDirection(double fDistance);
|
vector3 GetDirection(double fDistance);
|
||||||
vector3 GetDirection() { return CPointOut; };
|
vector3 GetDirection()
|
||||||
|
{
|
||||||
|
return CPointOut;
|
||||||
|
};
|
||||||
vector3 FastGetDirection(double fDistance, double fOffset);
|
vector3 FastGetDirection(double fDistance, double fOffset);
|
||||||
vector3 GetPoint(double fDistance);
|
vector3 GetPoint(double fDistance);
|
||||||
void RaPositionGet(double fDistance, vector3 &p, vector3 &a);
|
void RaPositionGet(double fDistance, vector3 &p, vector3 &a);
|
||||||
vector3 FastGetPoint(double t);
|
vector3 FastGetPoint(double t);
|
||||||
inline vector3 FastGetPoint_0() { return Point1; };
|
inline vector3 FastGetPoint_0()
|
||||||
inline vector3 FastGetPoint_1() { return Point2; };
|
{
|
||||||
|
return Point1;
|
||||||
|
};
|
||||||
|
inline vector3 FastGetPoint_1()
|
||||||
|
{
|
||||||
|
return Point2;
|
||||||
|
};
|
||||||
inline double GetRoll(double s)
|
inline double GetRoll(double s)
|
||||||
{
|
{
|
||||||
s /= fLength;
|
s /= fLength;
|
||||||
@@ -103,14 +117,16 @@ class TSegment
|
|||||||
r1 = fRoll1;
|
r1 = fRoll1;
|
||||||
r2 = fRoll2;
|
r2 = fRoll2;
|
||||||
}
|
}
|
||||||
void RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
void RenderLoft(const vector6 *ShapePoints, int iNumShapePoints, double fTextureLength,
|
||||||
double fTextureLength, int iSkip = 0, int iQualityFactor = 1,
|
int iSkip = 0, int iQualityFactor = 1, vector3 **p = NULL, bool bRender = true);
|
||||||
vector3 **p = NULL, bool bRender = true);
|
|
||||||
void RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
void RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||||
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
||||||
double fOffsetX = 0.0f);
|
double fOffsetX = 0.0f);
|
||||||
void Render();
|
void Render();
|
||||||
inline double GetLength() { return fLength; };
|
inline double GetLength()
|
||||||
|
{
|
||||||
|
return fLength;
|
||||||
|
};
|
||||||
void MoveMe(vector3 pPosition)
|
void MoveMe(vector3 pPosition)
|
||||||
{
|
{
|
||||||
Point1 += pPosition;
|
Point1 += pPosition;
|
||||||
@@ -121,14 +137,18 @@ class TSegment
|
|||||||
CPointOut += pPosition;
|
CPointOut += pPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int RaSegCount() { return fTsBuffer ? iSegCount : 1; };
|
int RaSegCount()
|
||||||
void RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
{
|
||||||
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
return fTsBuffer ? iSegCount : 1;
|
||||||
int iEnd = 0, double fOffsetX = 0.0);
|
};
|
||||||
|
void RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
||||||
|
double fTextureLength, int iSkip = 0, int iEnd = 0, double fOffsetX = 0.0);
|
||||||
void RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
void RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
||||||
double fTextureLength, int iSkip = 0, int iEnd = 0,
|
double fTextureLength, int iSkip = 0, int iEnd = 0, double fOffsetX = 0.0);
|
||||||
double fOffsetX = 0.0);
|
void AngleSet(int i, double a)
|
||||||
void AngleSet(int i, double a) { fAngle[i] = a; };
|
{
|
||||||
|
fAngle[i] = a;
|
||||||
|
};
|
||||||
void Rollment(double w1, double w2); // poprawianie przechy³ki
|
void Rollment(double w1, double w2); // poprawianie przechy³ki
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,10 @@ LPDIRECTSOUNDBUFFER TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
|
|||||||
return DSBuffers.top();
|
return DSBuffers.top();
|
||||||
};
|
};
|
||||||
|
|
||||||
TSoundsManager::~TSoundsManager() { Free(); };
|
TSoundsManager::~TSoundsManager()
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
};
|
||||||
|
|
||||||
void TSoundsManager::Free()
|
void TSoundsManager::Free()
|
||||||
{
|
{
|
||||||
@@ -200,8 +203,7 @@ void TSoundsManager::LoadSounds(char *Directory)
|
|||||||
FindClose(handle);
|
FindClose(handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic,
|
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic, float *fSamplingRate)
|
||||||
float *fSamplingRate)
|
|
||||||
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
|
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
|
||||||
AnsiString file;
|
AnsiString file;
|
||||||
if (Dynamic)
|
if (Dynamic)
|
||||||
|
|||||||
6
Sound.h
6
Sound.h
@@ -39,8 +39,7 @@ class TSoundContainer
|
|||||||
TSoundContainer *Next;
|
TSoundContainer *Next;
|
||||||
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
|
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
|
||||||
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
|
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
|
||||||
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName,
|
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName, int NConcurrent);
|
||||||
int NConcurrent);
|
|
||||||
~TSoundContainer();
|
~TSoundContainer();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,8 +61,7 @@ class TSoundsManager
|
|||||||
static void Free();
|
static void Free();
|
||||||
static void Init(char *Name, int Concurrent);
|
static void Init(char *Name, int Concurrent);
|
||||||
static void LoadSounds(char *Directory);
|
static void LoadSounds(char *Directory);
|
||||||
static LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic,
|
static LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic, float *fSamplingRate = NULL);
|
||||||
float *fSamplingRate = NULL);
|
|
||||||
static void RestoreAll();
|
static void RestoreAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ __fastcall TKnot::TKnot(int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__fastcall TKnot::~TKnot() {}
|
__fastcall TKnot::~TKnot()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
vector3 TKnot::GetDirection(float t)
|
vector3 TKnot::GetDirection(float t)
|
||||||
{
|
{
|
||||||
|
|||||||
10
Spring.cpp
10
Spring.cpp
@@ -24,7 +24,9 @@ TSpring::TSpring()
|
|||||||
restLen = 0;
|
restLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSpring::~TSpring() {}
|
TSpring::~TSpring()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TSpring::Init(double nrestLen, double nKs, double nKd)
|
void TSpring::Init(double nrestLen, double nKs, double nKd)
|
||||||
{
|
{
|
||||||
@@ -43,7 +45,7 @@ bool TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
|||||||
// VectorDifference(&p1->pos,&p2->pos,&deltaP); // Vector distance
|
// VectorDifference(&p1->pos,&p2->pos,&deltaP); // Vector distance
|
||||||
deltaP = pPosition1 - pPosition2;
|
deltaP = pPosition1 - pPosition2;
|
||||||
// dist = VectorLength(&deltaP); // Magnitude of
|
// dist = VectorLength(&deltaP); // Magnitude of
|
||||||
//deltaP
|
// deltaP
|
||||||
dist = deltaP.Length();
|
dist = deltaP.Length();
|
||||||
if (dist == 0)
|
if (dist == 0)
|
||||||
{
|
{
|
||||||
@@ -72,7 +74,9 @@ bool TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpring::Render() {}
|
void TSpring::Render()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,10 @@ TTexturesManager::Names::iterator TTexturesManager::LoadFromFile(std::string fil
|
|||||||
|
|
||||||
struct ReplaceSlash
|
struct ReplaceSlash
|
||||||
{
|
{
|
||||||
const char operator()(const char input) { return input == '/' ? '\\' : input; }
|
const char operator()(const char input)
|
||||||
|
{
|
||||||
|
return input == '/' ? '\\' : input;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GLuint TTexturesManager::GetTextureID(char *dir, char *where, std::string fileName, int filter)
|
GLuint TTexturesManager::GetTextureID(char *dir, char *where, std::string fileName, int filter)
|
||||||
|
|||||||
33
Timer.cpp
33
Timer.cpp
@@ -25,7 +25,10 @@ double fSimulationTime = 0;
|
|||||||
double fSoundTimer = 0;
|
double fSoundTimer = 0;
|
||||||
double fSinceStart = 0;
|
double fSinceStart = 0;
|
||||||
|
|
||||||
double GetTime() { return fSimulationTime; }
|
double GetTime()
|
||||||
|
{
|
||||||
|
return fSimulationTime;
|
||||||
|
}
|
||||||
|
|
||||||
double GetDeltaTime()
|
double GetDeltaTime()
|
||||||
{ // czas symulacji (stoi gdy pauza)
|
{ // czas symulacji (stoi gdy pauza)
|
||||||
@@ -37,19 +40,35 @@ double GetDeltaRenderTime()
|
|||||||
return DeltaRenderTime;
|
return DeltaRenderTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetfSinceStart() { return fSinceStart; }
|
double GetfSinceStart()
|
||||||
|
{
|
||||||
|
return fSinceStart;
|
||||||
|
}
|
||||||
|
|
||||||
void SetDeltaTime(double t) { DeltaTime = t; }
|
void SetDeltaTime(double t)
|
||||||
|
{
|
||||||
|
DeltaTime = t;
|
||||||
|
}
|
||||||
|
|
||||||
double GetSimulationTime() { return fSimulationTime; }
|
double GetSimulationTime()
|
||||||
|
{
|
||||||
|
return fSimulationTime;
|
||||||
|
}
|
||||||
|
|
||||||
void SetSimulationTime(double t) { fSimulationTime = t; }
|
void SetSimulationTime(double t)
|
||||||
|
{
|
||||||
|
fSimulationTime = t;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetSoundTimer()
|
bool GetSoundTimer()
|
||||||
{ // Ra: byæ mo¿e, by dŸwiêki nie modyfikowa³y siê zbyt czêsto, po 0.1s zeruje siê ten licznik
|
{ // Ra: byæ mo¿e, by dŸwiêki nie modyfikowa³y siê zbyt czêsto, po 0.1s zeruje siê ten licznik
|
||||||
return (fSoundTimer == 0.0f); }
|
return (fSoundTimer == 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
double GetFPS() { return fFPS; }
|
double GetFPS()
|
||||||
|
{
|
||||||
|
return fFPS;
|
||||||
|
}
|
||||||
|
|
||||||
void ResetTimers()
|
void ResetTimers()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ TSwitchExtension::TSwitchExtension(TTrack *owner, int what)
|
|||||||
Segments[2] = (what >= 3) ?
|
Segments[2] = (what >= 3) ?
|
||||||
new TSegment(owner) :
|
new TSegment(owner) :
|
||||||
NULL; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
|
NULL; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
|
||||||
Segments[3] = (what >= 4) ? new TSegment(owner) :
|
Segments[3] =
|
||||||
NULL; // z punktu 4 do 1 1 1=4 0 0=3
|
(what >= 4) ? new TSegment(owner) : NULL; // z punktu 4 do 1 1 1=4 0 0=3
|
||||||
Segments[4] =
|
Segments[4] =
|
||||||
(what >= 5) ? new TSegment(owner) : NULL; // z punktu 1 do 3 4 x 3 3 3 x 2 2
|
(what >= 5) ? new TSegment(owner) : NULL; // z punktu 1 do 3 4 x 3 3 3 x 2 2
|
||||||
Segments[5] = (what >= 6) ? new TSegment(owner) :
|
Segments[5] = (what >= 6) ? new TSegment(owner) :
|
||||||
@@ -102,7 +102,8 @@ TIsolated::TIsolated(const AnsiString &n, TIsolated *i)
|
|||||||
pMemCell = NULL; // podpiąć istniejącą albo utworzyć pustą
|
pMemCell = NULL; // podpiąć istniejącą albo utworzyć pustą
|
||||||
};
|
};
|
||||||
|
|
||||||
TIsolated::~TIsolated(){// usuwanie
|
TIsolated::~TIsolated(){
|
||||||
|
// usuwanie
|
||||||
/*
|
/*
|
||||||
TIsolated *p=pRoot;
|
TIsolated *p=pRoot;
|
||||||
while (pRoot)
|
while (pRoot)
|
||||||
|
|||||||
45
Track.h
45
Track.h
@@ -111,9 +111,18 @@ class TIsolated
|
|||||||
static TIsolated *__fastcall Find(
|
static TIsolated *__fastcall Find(
|
||||||
const AnsiString &n); // znalezienie obiektu albo utworzenie nowego
|
const AnsiString &n); // znalezienie obiektu albo utworzenie nowego
|
||||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||||
bool Busy() { return (iAxles > 0); };
|
bool Busy()
|
||||||
static TIsolated *__fastcall Root() { return (pRoot); };
|
{
|
||||||
TIsolated *__fastcall Next() { return (pNext); };
|
return (iAxles > 0);
|
||||||
|
};
|
||||||
|
static TIsolated *__fastcall Root()
|
||||||
|
{
|
||||||
|
return (pRoot);
|
||||||
|
};
|
||||||
|
TIsolated *__fastcall Next()
|
||||||
|
{
|
||||||
|
return (pNext);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class TTrack : public Resource
|
class TTrack : public Resource
|
||||||
@@ -185,15 +194,30 @@ class TTrack : public Resource
|
|||||||
void Init();
|
void Init();
|
||||||
static TTrack *__fastcall Create400m(int what, double dx);
|
static TTrack *__fastcall Create400m(int what, double dx);
|
||||||
TTrack *__fastcall NullCreate(int dir);
|
TTrack *__fastcall NullCreate(int dir);
|
||||||
inline bool IsEmpty() { return (iNumDynamics <= 0); };
|
inline bool IsEmpty()
|
||||||
|
{
|
||||||
|
return (iNumDynamics <= 0);
|
||||||
|
};
|
||||||
void ConnectPrevPrev(TTrack *pNewPrev, int typ);
|
void ConnectPrevPrev(TTrack *pNewPrev, int typ);
|
||||||
void ConnectPrevNext(TTrack *pNewPrev, int typ);
|
void ConnectPrevNext(TTrack *pNewPrev, int typ);
|
||||||
void ConnectNextPrev(TTrack *pNewNext, int typ);
|
void ConnectNextPrev(TTrack *pNewNext, int typ);
|
||||||
void ConnectNextNext(TTrack *pNewNext, int typ);
|
void ConnectNextNext(TTrack *pNewNext, int typ);
|
||||||
inline double Length() { return Segment->GetLength(); };
|
inline double Length()
|
||||||
inline TSegment *__fastcall CurrentSegment() { return Segment; };
|
{
|
||||||
inline TTrack *__fastcall CurrentNext() { return (trNext); };
|
return Segment->GetLength();
|
||||||
inline TTrack *__fastcall CurrentPrev() { return (trPrev); };
|
};
|
||||||
|
inline TSegment *__fastcall CurrentSegment()
|
||||||
|
{
|
||||||
|
return Segment;
|
||||||
|
};
|
||||||
|
inline TTrack *__fastcall CurrentNext()
|
||||||
|
{
|
||||||
|
return (trNext);
|
||||||
|
};
|
||||||
|
inline TTrack *__fastcall CurrentPrev()
|
||||||
|
{
|
||||||
|
return (trPrev);
|
||||||
|
};
|
||||||
TTrack *__fastcall Neightbour(int s, double &d);
|
TTrack *__fastcall Neightbour(int s, double &d);
|
||||||
bool SetConnections(int i);
|
bool SetConnections(int i);
|
||||||
bool Switch(int i, double t = -1.0, double d = -1.0);
|
bool Switch(int i, double t = -1.0, double d = -1.0);
|
||||||
@@ -244,7 +268,10 @@ class TTrack : public Resource
|
|||||||
AnsiString IsolatedName();
|
AnsiString IsolatedName();
|
||||||
bool IsolatedEventsAssign(TEvent *busy, TEvent *free);
|
bool IsolatedEventsAssign(TEvent *busy, TEvent *free);
|
||||||
double WidthTotal();
|
double WidthTotal();
|
||||||
GLuint TextureGet(int i) { return i ? TextureID1 : TextureID2; };
|
GLuint TextureGet(int i)
|
||||||
|
{
|
||||||
|
return i ? TextureID1 : TextureID2;
|
||||||
|
};
|
||||||
bool IsGroupable();
|
bool IsGroupable();
|
||||||
int TestPoint(vector3 *Point);
|
int TestPoint(vector3 *Point);
|
||||||
void MovedUp1(double dh);
|
void MovedUp1(double dh);
|
||||||
|
|||||||
@@ -86,13 +86,15 @@ bool TTractionPowerSource::Load(cParser *parser)
|
|||||||
Error("tractionpowersource end statement missing");
|
Error("tractionpowersource end statement missing");
|
||||||
// if (!bSection) //od³¹cznik sekcji zasadniczo nie ma impedancji (0.01 jest OK)
|
// if (!bSection) //od³¹cznik sekcji zasadniczo nie ma impedancji (0.01 jest OK)
|
||||||
if (InternalRes < 0.1) // coœ ma³a ta rezystancja by³a...
|
if (InternalRes < 0.1) // coœ ma³a ta rezystancja by³a...
|
||||||
InternalRes =
|
InternalRes = 0.2; // tak oko³o 0.2, wg
|
||||||
0.2; // tak oko³o 0.2, wg
|
|
||||||
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TTractionPowerSource::Render() { return true; };
|
bool TTractionPowerSource::Render()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
bool TTractionPowerSource::Update(double dt)
|
bool TTractionPowerSource::Update(double dt)
|
||||||
{ // powinno byæ wykonane raz na krok fizyki
|
{ // powinno byæ wykonane raz na krok fizyki
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ class TTractionPowerSource
|
|||||||
bool Render();
|
bool Render();
|
||||||
bool Update(double dt);
|
bool Update(double dt);
|
||||||
double CurrentGet(double res);
|
double CurrentGet(double res);
|
||||||
void VoltageSet(double v) { NominalVoltage = v; };
|
void VoltageSet(double v)
|
||||||
|
{
|
||||||
|
NominalVoltage = v;
|
||||||
|
};
|
||||||
void PowerSet(TTractionPowerSource *ps);
|
void PowerSet(TTractionPowerSource *ps);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
10
Train.cpp
10
Train.cpp
@@ -49,8 +49,8 @@ TCab::TCab()
|
|||||||
iButtons = 0;
|
iButtons = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2,
|
void TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2, double Inity2,
|
||||||
double Inity2, double Initz2, bool InitEnabled, bool InitOccupied)
|
double Initz2, bool InitEnabled, bool InitOccupied)
|
||||||
{
|
{
|
||||||
CabPos1.x = Initx1;
|
CabPos1.x = Initx1;
|
||||||
CabPos1.y = Inity1;
|
CabPos1.y = Inity1;
|
||||||
@@ -2481,8 +2481,8 @@ bool TTrain::Update()
|
|||||||
5, fHCurrent[(mvControlled->TrainType & dt_EZT) ? 0 : 1]); // pierwszy amperomierz;
|
5, fHCurrent[(mvControlled->TrainType & dt_EZT) ? 0 : 1]); // pierwszy amperomierz;
|
||||||
// dla EZT pr¹d ca³kowity
|
// dla EZT pr¹d ca³kowity
|
||||||
Console::ValueSet(6, fTachoVelocity); ////Ra: prêdkoœæ na pin 43 - wyjœcie analogowe (to
|
Console::ValueSet(6, fTachoVelocity); ////Ra: prêdkoœæ na pin 43 - wyjœcie analogowe (to
|
||||||
///nie jest PWM); skakanie zapewnia mechanika
|
/// nie jest PWM); skakanie zapewnia mechanika
|
||||||
///napêdu
|
/// napêdu
|
||||||
}
|
}
|
||||||
|
|
||||||
// hunter-080812: wyrzucanie szybkiego na elektrykach gdy nie ma napiecia przy dowolnym
|
// hunter-080812: wyrzucanie szybkiego na elektrykach gdy nie ma napiecia przy dowolnym
|
||||||
@@ -4998,7 +4998,7 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
|||||||
if (k)
|
if (k)
|
||||||
DynamicObject->mdKabina = k; // nowa kabina
|
DynamicObject->mdKabina = k; // nowa kabina
|
||||||
//(mdKabina) mo¿e zostaæ to samo po przejœciu do innego cz³onu bez zmiany
|
//(mdKabina) mo¿e zostaæ to samo po przejœciu do innego cz³onu bez zmiany
|
||||||
//kabiny, przy powrocie musi byæ wi¹zanie ponowne
|
// kabiny, przy powrocie musi byæ wi¹zanie ponowne
|
||||||
// else
|
// else
|
||||||
// break; //wyjœcie z pêtli, bo model zostaje bez zmian
|
// break; //wyjœcie z pêtli, bo model zostaje bez zmian
|
||||||
}
|
}
|
||||||
|
|||||||
25
Train.h
25
Train.h
@@ -83,8 +83,14 @@ class TTrain
|
|||||||
|
|
||||||
// bool SHP() { fShpTimer= 0; };
|
// bool SHP() { fShpTimer= 0; };
|
||||||
|
|
||||||
inline vector3 GetDirection() { return DynamicObject->VectorFront(); };
|
inline vector3 GetDirection()
|
||||||
inline vector3 GetUp() { return DynamicObject->VectorUp(); };
|
{
|
||||||
|
return DynamicObject->VectorFront();
|
||||||
|
};
|
||||||
|
inline vector3 GetUp()
|
||||||
|
{
|
||||||
|
return DynamicObject->VectorUp();
|
||||||
|
};
|
||||||
void UpdateMechPosition(double dt);
|
void UpdateMechPosition(double dt);
|
||||||
bool Update();
|
bool Update();
|
||||||
void MechStop();
|
void MechStop();
|
||||||
@@ -373,9 +379,18 @@ class TTrain
|
|||||||
int iSekunda; // Ra: sekunda aktualizacji pr璠ko𦣇i
|
int iSekunda; // Ra: sekunda aktualizacji pr璠ko𦣇i
|
||||||
int iRadioChannel; // numer aktualnego kana逝 radiowego
|
int iRadioChannel; // numer aktualnego kana逝 radiowego
|
||||||
public:
|
public:
|
||||||
int RadioChannel() { return iRadioChannel; };
|
int RadioChannel()
|
||||||
inline TDynamicObject *__fastcall Dynamic() { return DynamicObject; };
|
{
|
||||||
inline TMoverParameters *__fastcall Controlled() { return mvControlled; };
|
return iRadioChannel;
|
||||||
|
};
|
||||||
|
inline TDynamicObject *__fastcall Dynamic()
|
||||||
|
{
|
||||||
|
return DynamicObject;
|
||||||
|
};
|
||||||
|
inline TMoverParameters *__fastcall Controlled()
|
||||||
|
{
|
||||||
|
return mvControlled;
|
||||||
|
};
|
||||||
void DynamicSet(TDynamicObject *d);
|
void DynamicSet(TDynamicObject *d);
|
||||||
void Silence();
|
void Silence();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ TTrackFollower::TTrackFollower()
|
|||||||
fOffsetH = 0.0; // na starcie stoi na środku
|
fOffsetH = 0.0; // na starcie stoi na środku
|
||||||
}
|
}
|
||||||
|
|
||||||
TTrackFollower::~TTrackFollower() {}
|
TTrackFollower::~TTrackFollower()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool TTrackFollower::Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir)
|
bool TTrackFollower::Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir)
|
||||||
{
|
{
|
||||||
|
|||||||
15
TrkFoll.h
15
TrkFoll.h
@@ -35,14 +35,23 @@ class TTrackFollower
|
|||||||
~TTrackFollower();
|
~TTrackFollower();
|
||||||
TTrack *__fastcall SetCurrentTrack(TTrack *pTrack, int end);
|
TTrack *__fastcall SetCurrentTrack(TTrack *pTrack, int end);
|
||||||
bool Move(double fDistance, bool bPrimary);
|
bool Move(double fDistance, bool bPrimary);
|
||||||
inline TTrack *__fastcall GetTrack() { return pCurrentTrack; };
|
inline TTrack *__fastcall GetTrack()
|
||||||
|
{
|
||||||
|
return pCurrentTrack;
|
||||||
|
};
|
||||||
inline double GetRoll()
|
inline double GetRoll()
|
||||||
{
|
{
|
||||||
return vAngles.x;
|
return vAngles.x;
|
||||||
}; // przechy³ka policzona przy ustalaniu pozycji
|
}; // przechy³ka policzona przy ustalaniu pozycji
|
||||||
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyæ mo¿na pobraæ
|
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyæ mo¿na pobraæ
|
||||||
inline double GetDirection() { return fDirection; }; // zwrot na torze
|
inline double GetDirection()
|
||||||
inline double GetTranslation() { return fCurrentDistance; }; // ABu-030403
|
{
|
||||||
|
return fDirection;
|
||||||
|
}; // zwrot na torze
|
||||||
|
inline double GetTranslation()
|
||||||
|
{
|
||||||
|
return fCurrentDistance;
|
||||||
|
}; // ABu-030403
|
||||||
// inline double GetLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
// inline double GetLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||||
//{ return pCurrentSegment->ComputeLength(p1,cp1,cp2,p2); };
|
//{ return pCurrentSegment->ComputeLength(p1,cp1,cp2,p2); };
|
||||||
// inline double GetRadius(double L, double d); //McZapkie-150503
|
// inline double GetRadius(double L, double d); //McZapkie-150503
|
||||||
|
|||||||
12
World.cpp
12
World.cpp
@@ -404,8 +404,9 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
|||||||
glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Mode
|
glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Mode
|
||||||
WriteLog("glFogfv(GL_FOG_COLOR, FogColor);");
|
WriteLog("glFogfv(GL_FOG_COLOR, FogColor);");
|
||||||
glFogfv(GL_FOG_COLOR, FogColor); // Set Fog Color
|
glFogfv(GL_FOG_COLOR, FogColor); // Set Fog Color
|
||||||
// glFogf(GL_FOG_DENSITY, 0.594f); // How Dense Will The Fog
|
// glFogf(GL_FOG_DENSITY, 0.594f); // How Dense Will The
|
||||||
//Be
|
//Fog
|
||||||
|
// Be
|
||||||
// glHint(GL_FOG_HINT, GL_NICEST); // Fog Hint Value
|
// glHint(GL_FOG_HINT, GL_NICEST); // Fog Hint Value
|
||||||
WriteLog("glFogf(GL_FOG_START, 1000.0f);");
|
WriteLog("glFogf(GL_FOG_START, 1000.0f);");
|
||||||
glFogf(GL_FOG_START, 10.0f); // Fog Start Depth
|
glFogf(GL_FOG_START, 10.0f); // Fog Start Depth
|
||||||
@@ -1166,7 +1167,7 @@ bool TWorld::Update()
|
|||||||
double a = fmod(Global::fTimeAngleDeg, 360.0) / 180.0 * M_PI -
|
double a = fmod(Global::fTimeAngleDeg, 360.0) / 180.0 * M_PI -
|
||||||
M_PI; // k¹t godzinny w radianach
|
M_PI; // k¹t godzinny w radianach
|
||||||
//(a) jest traktowane jako czas miejscowy, nie uwzglêdniaj¹cy stref czasowych ani czasu
|
//(a) jest traktowane jako czas miejscowy, nie uwzglêdniaj¹cy stref czasowych ani czasu
|
||||||
//letniego
|
// letniego
|
||||||
// aby wyznaczyæ strefê czasow¹, trzeba uwzglêdniæ po³udnik miejscowy
|
// aby wyznaczyæ strefê czasow¹, trzeba uwzglêdniæ po³udnik miejscowy
|
||||||
// aby uwzglêdniæ czas letni, trzeba sprawdziæ dzieñ roku
|
// aby uwzglêdniæ czas letni, trzeba sprawdziæ dzieñ roku
|
||||||
double L = Global::fLatitudeDeg / 180.0 * M_PI; // szerokoϾ geograficzna
|
double L = Global::fLatitudeDeg / 180.0 * M_PI; // szerokoϾ geograficzna
|
||||||
@@ -1319,7 +1320,7 @@ bool TWorld::Update()
|
|||||||
fTimeBuffer -= iter * fMaxDt; // reszta czasu na potem (do bufora)
|
fTimeBuffer -= iter * fMaxDt; // reszta czasu na potem (do bufora)
|
||||||
if (n > 20)
|
if (n > 20)
|
||||||
n = 20; // Ra: je¿eli FPS jest zatrwa¿aj¹co niski, to fizyka nie mo¿e zaj¹æ ca³kowicie
|
n = 20; // Ra: je¿eli FPS jest zatrwa¿aj¹co niski, to fizyka nie mo¿e zaj¹æ ca³kowicie
|
||||||
// procesora
|
// procesora
|
||||||
#if 0
|
#if 0
|
||||||
Ground.UpdatePhys(fMaxDt,n); //Ra: teraz czas kroku jest (wzglêdnie) sta³y
|
Ground.UpdatePhys(fMaxDt,n); //Ra: teraz czas kroku jest (wzglêdnie) sta³y
|
||||||
if (DebugModeFlag)
|
if (DebugModeFlag)
|
||||||
@@ -2430,8 +2431,7 @@ bool TWorld::Update()
|
|||||||
glColor3f(0.0f, 1.0f, 0.0f); // zielone
|
glColor3f(0.0f, 1.0f, 0.0f); // zielone
|
||||||
glRasterPos2f(
|
glRasterPos2f(
|
||||||
-0.25f,
|
-0.25f,
|
||||||
0.18f -
|
0.18f - 0.02f * (i - tmp->Mechanik->iStationStart)); // dopiero
|
||||||
0.02f * (i - tmp->Mechanik->iStationStart)); // dopiero
|
|
||||||
// ustawienie
|
// ustawienie
|
||||||
// pozycji
|
// pozycji
|
||||||
// ustala
|
// ustala
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ void inline vector3::SafeNormalize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From code in Graphics Gems; p. 766
|
// From code in Graphics Gems; p. 766
|
||||||
inline scalar_t det2x2(scalar_t a, scalar_t b, scalar_t c, scalar_t d) { return a * d - b * c; }
|
inline scalar_t det2x2(scalar_t a, scalar_t b, scalar_t c, scalar_t d)
|
||||||
|
{
|
||||||
|
return a * d - b * c;
|
||||||
|
}
|
||||||
|
|
||||||
inline scalar_t det3x3(scalar_t a1, scalar_t a2, scalar_t a3, scalar_t b1, scalar_t b2, scalar_t b3,
|
inline scalar_t det3x3(scalar_t a1, scalar_t a2, scalar_t a3, scalar_t b1, scalar_t b2, scalar_t b3,
|
||||||
scalar_t c1, scalar_t c2, scalar_t c3)
|
scalar_t c1, scalar_t c2, scalar_t c3)
|
||||||
@@ -390,7 +393,8 @@ int main(int, char *[])
|
|||||||
Testmatrix4x4();
|
Testmatrix4x4();
|
||||||
matrixFailures = failures;
|
matrixFailures = failures;
|
||||||
|
|
||||||
cout << endl << "****************************************" << endl;
|
cout << endl
|
||||||
|
<< "****************************************" << endl;
|
||||||
cout << "* *" << endl;
|
cout << "* *" << endl;
|
||||||
if (vectorFailures + matrixFailures == 0)
|
if (vectorFailures + matrixFailures == 0)
|
||||||
cout << "* No failures detected in Math3D *" << endl;
|
cout << "* No failures detected in Math3D *" << endl;
|
||||||
|
|||||||
102
dumb3d.h
102
dumb3d.h
@@ -27,15 +27,26 @@ namespace Math3D
|
|||||||
typedef double scalar_t;
|
typedef double scalar_t;
|
||||||
// inline pass-throughs to various basic math functions
|
// inline pass-throughs to various basic math functions
|
||||||
// written in this style to allow for easy substitution with more efficient versions
|
// written in this style to allow for easy substitution with more efficient versions
|
||||||
inline scalar_t SINE_FUNCTION(scalar_t x) { return sin(x); }
|
inline scalar_t SINE_FUNCTION(scalar_t x)
|
||||||
inline scalar_t COSINE_FUNCTION(scalar_t x) { return cos(x); }
|
{
|
||||||
inline scalar_t SQRT_FUNCTION(scalar_t x) { return sqrt(x); }
|
return sin(x);
|
||||||
|
}
|
||||||
|
inline scalar_t COSINE_FUNCTION(scalar_t x)
|
||||||
|
{
|
||||||
|
return cos(x);
|
||||||
|
}
|
||||||
|
inline scalar_t SQRT_FUNCTION(scalar_t x)
|
||||||
|
{
|
||||||
|
return sqrt(x);
|
||||||
|
}
|
||||||
|
|
||||||
// 2 element vector
|
// 2 element vector
|
||||||
class vector2
|
class vector2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vector2(void) {}
|
vector2(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
vector2(scalar_t a, scalar_t b)
|
vector2(scalar_t a, scalar_t b)
|
||||||
{
|
{
|
||||||
x = a;
|
x = a;
|
||||||
@@ -52,7 +63,9 @@ class vector2
|
|||||||
class vector3
|
class vector3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vector3(void) {}
|
vector3(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
vector3(scalar_t a, scalar_t b, scalar_t c)
|
vector3(scalar_t a, scalar_t b, scalar_t c)
|
||||||
{
|
{
|
||||||
x = a;
|
x = a;
|
||||||
@@ -71,15 +84,24 @@ class vector3
|
|||||||
void inline Normalize();
|
void inline Normalize();
|
||||||
void inline SafeNormalize();
|
void inline SafeNormalize();
|
||||||
double inline Length();
|
double inline Length();
|
||||||
void inline Zero() { x = y = z = 0.0; };
|
void inline Zero()
|
||||||
|
{
|
||||||
|
x = y = z = 0.0;
|
||||||
|
};
|
||||||
|
|
||||||
// [] is to read, () is to write (const correctness)
|
// [] is to read, () is to write (const correctness)
|
||||||
// const scalar_t& operator[] (int i) const { return e[i]; }
|
// const scalar_t& operator[] (int i) const { return e[i]; }
|
||||||
// scalar_t& operator() (int i) { return e[i]; }
|
// scalar_t& operator() (int i) { return e[i]; }
|
||||||
|
|
||||||
// Provides access to the underlying array; useful for passing this class off to C APIs
|
// Provides access to the underlying array; useful for passing this class off to C APIs
|
||||||
const scalar_t *readArray(void) { return &x; }
|
const scalar_t *readArray(void)
|
||||||
scalar_t *getArray(void) { return &x; }
|
{
|
||||||
|
return &x;
|
||||||
|
}
|
||||||
|
scalar_t *getArray(void)
|
||||||
|
{
|
||||||
|
return &x;
|
||||||
|
}
|
||||||
|
|
||||||
// union
|
// union
|
||||||
// {
|
// {
|
||||||
@@ -107,7 +129,9 @@ class vector3
|
|||||||
class matrix4x4
|
class matrix4x4
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
matrix4x4(void) {}
|
matrix4x4(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// When defining matrices in C arrays, it is easiest to define them with
|
// When defining matrices in C arrays, it is easiest to define them with
|
||||||
// the column increasing fastest. However, some APIs (OpenGL in particular) do this
|
// the column increasing fastest. However, some APIs (OpenGL in particular) do this
|
||||||
@@ -130,12 +154,24 @@ class matrix4x4
|
|||||||
|
|
||||||
// [] is to read, () is to write (const correctness)
|
// [] is to read, () is to write (const correctness)
|
||||||
// m[x][y] or m(x)[y] is the correct form
|
// m[x][y] or m(x)[y] is the correct form
|
||||||
const scalar_t *operator[](int i) const { return &e[i << 2]; }
|
const scalar_t *operator[](int i) const
|
||||||
scalar_t *operator()(int i) { return &e[i << 2]; }
|
{
|
||||||
|
return &e[i << 2];
|
||||||
|
}
|
||||||
|
scalar_t *operator()(int i)
|
||||||
|
{
|
||||||
|
return &e[i << 2];
|
||||||
|
}
|
||||||
|
|
||||||
// Low-level access to the array.
|
// Low-level access to the array.
|
||||||
const scalar_t *readArray(void) { return e; }
|
const scalar_t *readArray(void)
|
||||||
scalar_t *getArray(void) { return e; }
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
scalar_t *getArray(void)
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
// Construct various matrices; REPLACES CURRENT CONTENTS OF THE MATRIX!
|
// Construct various matrices; REPLACES CURRENT CONTENTS OF THE MATRIX!
|
||||||
// Written this way to work in-place and hence be somewhat more efficient
|
// Written this way to work in-place and hence be somewhat more efficient
|
||||||
@@ -263,14 +299,20 @@ inline bool operator<(const vector3 &v1, const vector3 &v2)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline vector3 operator-(const vector3 &v) { return vector3(-v.x, -v.y, -v.z); }
|
inline vector3 operator-(const vector3 &v)
|
||||||
|
{
|
||||||
|
return vector3(-v.x, -v.y, -v.z);
|
||||||
|
}
|
||||||
|
|
||||||
inline vector3 operator*(const vector3 &v, scalar_t k)
|
inline vector3 operator*(const vector3 &v, scalar_t k)
|
||||||
{
|
{
|
||||||
return vector3(k * v.x, k * v.y, k * v.z);
|
return vector3(k * v.x, k * v.y, k * v.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline vector3 operator*(scalar_t k, const vector3 &v) { return v * k; }
|
inline vector3 operator*(scalar_t k, const vector3 &v)
|
||||||
|
{
|
||||||
|
return v * k;
|
||||||
|
}
|
||||||
|
|
||||||
inline vector3 &operator*=(vector3 &v, scalar_t k)
|
inline vector3 &operator*=(vector3 &v, scalar_t k)
|
||||||
{
|
{
|
||||||
@@ -293,11 +335,23 @@ inline vector3 &operator/=(vector3 &v, scalar_t k)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scalar_t LengthSquared3(const vector3 &v) { return DotProduct(v, v); }
|
inline scalar_t LengthSquared3(const vector3 &v)
|
||||||
inline scalar_t LengthSquared4(const vector3 &v) { return DotProduct4(v, v); }
|
{
|
||||||
|
return DotProduct(v, v);
|
||||||
|
}
|
||||||
|
inline scalar_t LengthSquared4(const vector3 &v)
|
||||||
|
{
|
||||||
|
return DotProduct4(v, v);
|
||||||
|
}
|
||||||
|
|
||||||
inline scalar_t Length3(const vector3 &v) { return SQRT_FUNCTION(LengthSquared3(v)); }
|
inline scalar_t Length3(const vector3 &v)
|
||||||
inline scalar_t Length4(const vector3 &v) { return SQRT_FUNCTION(LengthSquared4(v)); }
|
{
|
||||||
|
return SQRT_FUNCTION(LengthSquared3(v));
|
||||||
|
}
|
||||||
|
inline scalar_t Length4(const vector3 &v)
|
||||||
|
{
|
||||||
|
return SQRT_FUNCTION(LengthSquared4(v));
|
||||||
|
}
|
||||||
|
|
||||||
inline vector3 Normalize(const vector3 &v)
|
inline vector3 Normalize(const vector3 &v)
|
||||||
{
|
{
|
||||||
@@ -314,7 +368,10 @@ inline vector3 SafeNormalize(const vector3 &v)
|
|||||||
retVal = v / l;
|
retVal = v / l;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
inline vector3 Normalize4(const vector3 &v) { return v / Length4(v); }
|
inline vector3 Normalize4(const vector3 &v)
|
||||||
|
{
|
||||||
|
return v / Length4(v);
|
||||||
|
}
|
||||||
|
|
||||||
inline vector3 operator+(const vector3 &v1, const vector3 &v2)
|
inline vector3 operator+(const vector3 &v1, const vector3 &v2)
|
||||||
{
|
{
|
||||||
@@ -372,7 +429,10 @@ void inline vector3::Normalize()
|
|||||||
z *= il;
|
z *= il;
|
||||||
}
|
}
|
||||||
|
|
||||||
double inline vector3::Length() { return SQRT_FUNCTION(x * x + y * y + z * z); }
|
double inline vector3::Length()
|
||||||
|
{
|
||||||
|
return SQRT_FUNCTION(x * x + y * y + z * z);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool operator==(const matrix4x4 &m1, const matrix4x4 &m2)
|
inline bool operator==(const matrix4x4 &m1, const matrix4x4 &m2)
|
||||||
{
|
{
|
||||||
|
|||||||
25
geometry.cpp
25
geometry.cpp
@@ -11,7 +11,10 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#include "Geometry.h"
|
#include "Geometry.h"
|
||||||
|
|
||||||
inline double sqr(double a) { return (a * a); };
|
inline double sqr(double a)
|
||||||
|
{
|
||||||
|
return (a * a);
|
||||||
|
};
|
||||||
|
|
||||||
__fastcall TLine::TLine(){};
|
__fastcall TLine::TLine(){};
|
||||||
|
|
||||||
@@ -23,7 +26,10 @@ __fastcall TLine::TLine(vector3 NPoint, vector3 NVector)
|
|||||||
|
|
||||||
__fastcall TLine::~TLine(){};
|
__fastcall TLine::~TLine(){};
|
||||||
|
|
||||||
TPlane TLine::GetPlane() { return (TPlane(Point, Vector)); };
|
TPlane TLine::GetPlane()
|
||||||
|
{
|
||||||
|
return (TPlane(Point, Vector));
|
||||||
|
};
|
||||||
|
|
||||||
double TLine::GetDistance(vector3 Point1)
|
double TLine::GetDistance(vector3 Point1)
|
||||||
{
|
{
|
||||||
@@ -80,11 +86,17 @@ double TPlane::GetSide(vector3 Point)
|
|||||||
// D3DMath_VectorMatrixMultiply(Vector,src,Transformations);
|
// D3DMath_VectorMatrixMultiply(Vector,src,Transformations);
|
||||||
//};
|
//};
|
||||||
|
|
||||||
bool TPlane::Defined() { return !(Vector == vector3(0, 0, 0)); };
|
bool TPlane::Defined()
|
||||||
|
{
|
||||||
|
return !(Vector == vector3(0, 0, 0));
|
||||||
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
inline double Sum(vector3 &Vector) { return (Vector.x + Vector.y + Vector.z); };
|
inline double Sum(vector3 &Vector)
|
||||||
|
{
|
||||||
|
return (Vector.x + Vector.y + Vector.z);
|
||||||
|
};
|
||||||
|
|
||||||
bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||||
{
|
{
|
||||||
@@ -96,7 +108,10 @@ bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
|||||||
return (true);
|
return (true);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline double GetLength(vector3 &Vector) { return (Vector.Length()); };
|
inline double GetLength(vector3 &Vector)
|
||||||
|
{
|
||||||
|
return (Vector.Length());
|
||||||
|
};
|
||||||
|
|
||||||
inline vector3 SetLength(vector3 &Vector, double Length)
|
inline vector3 SetLength(vector3 &Vector, double Length)
|
||||||
{
|
{
|
||||||
|
|||||||
20
parser.h
20
parser.h
@@ -42,15 +42,27 @@ class cParser : public std::stringstream
|
|||||||
getTokens();
|
getTokens();
|
||||||
*this >> output;
|
*this >> output;
|
||||||
};
|
};
|
||||||
inline void ignoreToken() { readToken(); };
|
inline void ignoreToken()
|
||||||
|
{
|
||||||
|
readToken();
|
||||||
|
};
|
||||||
inline void ignoreTokens(int count)
|
inline void ignoreTokens(int count)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
readToken();
|
readToken();
|
||||||
};
|
};
|
||||||
inline bool expectToken(std::string value) { return readToken() == value; };
|
inline bool expectToken(std::string value)
|
||||||
bool eof() { return mStream->eof(); };
|
{
|
||||||
bool ok() { return !mStream->fail(); };
|
return readToken() == value;
|
||||||
|
};
|
||||||
|
bool eof()
|
||||||
|
{
|
||||||
|
return mStream->eof();
|
||||||
|
};
|
||||||
|
bool ok()
|
||||||
|
{
|
||||||
|
return !mStream->fail();
|
||||||
|
};
|
||||||
bool getTokens(int Count = 1, bool ToLower = true, const char *Break = "\n\t ;");
|
bool getTokens(int Count = 1, bool ToLower = true, const char *Break = "\n\t ;");
|
||||||
int getProgress() const; // percentage of file processed.
|
int getProgress() const; // percentage of file processed.
|
||||||
// load traction?
|
// load traction?
|
||||||
|
|||||||
10
wavread.cpp
10
wavread.cpp
@@ -216,7 +216,10 @@ HRESULT WaveReadFile(HMMIO hmmioIn, UINT cbRead, BYTE *pbDest, MMCKINFO *pckIn,
|
|||||||
// Name: CWaveSoundRead()
|
// Name: CWaveSoundRead()
|
||||||
// Desc: Constructs the class
|
// Desc: Constructs the class
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
CWaveSoundRead::CWaveSoundRead() { m_pwfx = NULL; }
|
CWaveSoundRead::CWaveSoundRead()
|
||||||
|
{
|
||||||
|
m_pwfx = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Name: ~CWaveSoundRead()
|
// Name: ~CWaveSoundRead()
|
||||||
@@ -252,7 +255,10 @@ HRESULT CWaveSoundRead::Open(CHAR *strFilename)
|
|||||||
// Desc: Resets the internal m_ckIn pointer so reading starts from the
|
// Desc: Resets the internal m_ckIn pointer so reading starts from the
|
||||||
// beginning of the file again
|
// beginning of the file again
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HRESULT CWaveSoundRead::Reset() { return WaveStartDataRead(&m_hmmioIn, &m_ckIn, &m_ckInRiff); }
|
HRESULT CWaveSoundRead::Reset()
|
||||||
|
{
|
||||||
|
return WaveStartDataRead(&m_hmmioIn, &m_ckIn, &m_ckInRiff);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Name: Read()
|
// Name: Read()
|
||||||
|
|||||||
Reference in New Issue
Block a user