mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 14:29:18 +02:00
Remove __fastcall calling convention
This commit is contained in:
16
AdvSound.cpp
16
AdvSound.cpp
@@ -25,9 +25,9 @@ __fastcall TAdvancedSound::~TAdvancedSound()
|
||||
// SoundShut.Stop();
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::Free() {}
|
||||
void TAdvancedSound::Free() {}
|
||||
|
||||
void __fastcall TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff,
|
||||
void TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff,
|
||||
double DistanceAttenuation, vector3 pPosition)
|
||||
{
|
||||
SoundStart.Init(NameOn, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
||||
@@ -51,7 +51,7 @@ void __fastcall TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff,
|
||||
SoundShut.FA = 0.0;
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::Load(TQueryParserComp *Parser, vector3 pPosition)
|
||||
void TAdvancedSound::Load(TQueryParserComp *Parser, vector3 pPosition)
|
||||
{
|
||||
AnsiString NameOn = Parser->GetNextSymbol().LowerCase();
|
||||
AnsiString Name = Parser->GetNextSymbol().LowerCase();
|
||||
@@ -60,7 +60,7 @@ void __fastcall TAdvancedSound::Load(TQueryParserComp *Parser, vector3 pPosition
|
||||
Init(NameOn.c_str(), Name.c_str(), NameOff.c_str(), DistanceAttenuation, pPosition);
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::TurnOn(bool ListenerInside, vector3 NewPosition)
|
||||
void TAdvancedSound::TurnOn(bool ListenerInside, vector3 NewPosition)
|
||||
{
|
||||
// hunter-311211: nie trzeba czekac na ponowne odtworzenie dzwieku, az sie wylaczy
|
||||
if ((State == ss_Off || State == ss_ShuttingDown) && (SoundStart.AM > 0))
|
||||
@@ -74,7 +74,7 @@ void __fastcall TAdvancedSound::TurnOn(bool ListenerInside, vector3 NewPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::TurnOff(bool ListenerInside, vector3 NewPosition)
|
||||
void TAdvancedSound::TurnOff(bool ListenerInside, vector3 NewPosition)
|
||||
{
|
||||
if ((State == ss_Commencing || State == ss_Starting) && (SoundShut.AM > 0))
|
||||
{
|
||||
@@ -88,7 +88,7 @@ void __fastcall TAdvancedSound::TurnOff(bool ListenerInside, vector3 NewPosition
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
|
||||
void TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
|
||||
{
|
||||
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
|
||||
{
|
||||
@@ -124,7 +124,7 @@ void __fastcall TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside,
|
||||
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
{ // update, ale z amplituda i czestotliwoscia
|
||||
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
|
||||
@@ -161,7 +161,7 @@ void __fastcall TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside
|
||||
SoundCommencing.AdjFreq(F, Timer::GetDeltaTime());
|
||||
}
|
||||
|
||||
void __fastcall TAdvancedSound::CopyIfEmpty(TAdvancedSound &s)
|
||||
void TAdvancedSound::CopyIfEmpty(TAdvancedSound &s)
|
||||
{ // skopiowanie, gdyby by³ potrzebny, a nie zosta³ wczytany
|
||||
if ((fStartLength > 0.0) || (fShutLength > 0.0))
|
||||
return; // coœ jest
|
||||
|
||||
20
AdvSound.h
20
AdvSound.h
@@ -27,17 +27,17 @@ class TAdvancedSound
|
||||
double defFM;
|
||||
|
||||
public:
|
||||
__fastcall TAdvancedSound();
|
||||
__fastcall ~TAdvancedSound();
|
||||
void __fastcall Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation,
|
||||
TAdvancedSound();
|
||||
~TAdvancedSound();
|
||||
void Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation,
|
||||
vector3 pPosition);
|
||||
void __fastcall Load(TQueryParserComp *Parser, vector3 pPosition);
|
||||
void __fastcall TurnOn(bool ListenerInside, vector3 NewPosition);
|
||||
void __fastcall TurnOff(bool ListenerInside, vector3 NewPosition);
|
||||
void __fastcall Free();
|
||||
void __fastcall Update(bool ListenerInside, vector3 NewPosition);
|
||||
void __fastcall UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition);
|
||||
void __fastcall CopyIfEmpty(TAdvancedSound &s);
|
||||
void Load(TQueryParserComp *Parser, vector3 pPosition);
|
||||
void TurnOn(bool ListenerInside, vector3 NewPosition);
|
||||
void TurnOff(bool ListenerInside, vector3 NewPosition);
|
||||
void Free();
|
||||
void Update(bool ListenerInside, vector3 NewPosition);
|
||||
void UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition);
|
||||
void CopyIfEmpty(TAdvancedSound &s);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -11,7 +11,7 @@ __fastcall TAirCoupler::TAirCoupler() { Clear(); }
|
||||
|
||||
__fastcall TAirCoupler::~TAirCoupler() {}
|
||||
|
||||
int __fastcall TAirCoupler::GetStatus()
|
||||
int TAirCoupler::GetStatus()
|
||||
{ // zwraca 1, jeœli istnieje model prosty, 2 gdy skoœny
|
||||
int x = 0;
|
||||
if (pModelOn)
|
||||
@@ -21,7 +21,7 @@ int __fastcall TAirCoupler::GetStatus()
|
||||
return x;
|
||||
}
|
||||
|
||||
void __fastcall TAirCoupler::Clear()
|
||||
void TAirCoupler::Clear()
|
||||
{ // zerowanie wskaŸników
|
||||
pModelOn = NULL;
|
||||
pModelOff = NULL;
|
||||
@@ -30,7 +30,7 @@ void __fastcall TAirCoupler::Clear()
|
||||
bxOn = false;
|
||||
}
|
||||
|
||||
void __fastcall TAirCoupler::Init(AnsiString asName, TModel3d *pModel)
|
||||
void TAirCoupler::Init(AnsiString asName, TModel3d *pModel)
|
||||
{ // wyszukanie submodeli
|
||||
if (!pModel)
|
||||
return; // nie ma w czym szukaæ
|
||||
@@ -39,7 +39,7 @@ void __fastcall TAirCoupler::Init(AnsiString asName, TModel3d *pModel)
|
||||
pModelxOn = pModel->GetFromName(AnsiString(asName + "_xon").c_str()); // po³¹czony na skos
|
||||
}
|
||||
|
||||
void __fastcall TAirCoupler::Load(TQueryParserComp *Parser, TModel3d *pModel)
|
||||
void TAirCoupler::Load(TQueryParserComp *Parser, TModel3d *pModel)
|
||||
{
|
||||
AnsiString str = Parser->GetNextSymbol().LowerCase();
|
||||
if (pModel)
|
||||
@@ -52,7 +52,7 @@ void __fastcall TAirCoupler::Load(TQueryParserComp *Parser, TModel3d *pModel)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAirCoupler::Update()
|
||||
void TAirCoupler::Update()
|
||||
{
|
||||
// if ((pModelOn!=NULL) && (pModelOn!=NULL))
|
||||
{
|
||||
|
||||
16
AirCoupler.h
16
AirCoupler.h
@@ -13,12 +13,12 @@ class TAirCoupler
|
||||
TSubModel *pModelOn, *pModelOff, *pModelxOn;
|
||||
bool bOn;
|
||||
bool bxOn;
|
||||
void __fastcall Update();
|
||||
void Update();
|
||||
|
||||
public:
|
||||
__fastcall TAirCoupler();
|
||||
__fastcall ~TAirCoupler();
|
||||
void __fastcall Clear();
|
||||
TAirCoupler();
|
||||
~TAirCoupler();
|
||||
void Clear();
|
||||
inline void TurnOn()
|
||||
{
|
||||
bOn = true;
|
||||
@@ -38,10 +38,10 @@ class TAirCoupler
|
||||
Update();
|
||||
};
|
||||
// inline bool Active() { if ((pModelOn)||(pModelOff)) return true; return false;};
|
||||
int __fastcall GetStatus();
|
||||
void __fastcall Init(AnsiString asName, TModel3d *pModel);
|
||||
void __fastcall Load(TQueryParserComp *Parser, TModel3d *pModel);
|
||||
// bool __fastcall Render();
|
||||
int GetStatus();
|
||||
void Init(AnsiString asName, TModel3d *pModel);
|
||||
void Load(TQueryParserComp *Parser, TModel3d *pModel);
|
||||
// bool Render();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@ __fastcall TAnimAdvanced::~TAnimAdvanced(){
|
||||
// delete[] pVocaloidMotionData; //plik został zmodyfikowany
|
||||
};
|
||||
|
||||
int __fastcall TAnimAdvanced::SortByBone()
|
||||
int TAnimAdvanced::SortByBone()
|
||||
{ // sortowanie pliku animacji w celu optymalniejszego wykonania
|
||||
// rekordy zostają ułożone wg kolejnych ramek dla każdej kości
|
||||
// ułożenie kości alfabetycznie nie jest niezbędne, ale upraszcza sortowanie bąbelkowe
|
||||
@@ -88,14 +88,14 @@ __fastcall TAnimContainer::~TAnimContainer()
|
||||
delete mAnim; // AnimContainer jest właścicielem takich macierzy
|
||||
}
|
||||
|
||||
bool __fastcall TAnimContainer::Init(TSubModel *pNewSubModel)
|
||||
bool TAnimContainer::Init(TSubModel *pNewSubModel)
|
||||
{
|
||||
fRotateSpeed = 0.0f;
|
||||
pSubModel = pNewSubModel;
|
||||
return (pSubModel != NULL);
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed)
|
||||
void TAnimContainer::SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed)
|
||||
{
|
||||
if (!this)
|
||||
return; // wywoływane z eventu, gdy brak modelu
|
||||
@@ -118,7 +118,7 @@ void __fastcall TAnimContainer::SetRotateAnim(vector3 vNewRotateAngles, double f
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::SetTranslateAnim(vector3 vNewTranslate, double fNewSpeed)
|
||||
void TAnimContainer::SetTranslateAnim(vector3 vNewTranslate, double fNewSpeed)
|
||||
{
|
||||
if (!this)
|
||||
return; // wywoływane z eventu, gdy brak modelu
|
||||
@@ -141,7 +141,7 @@ void __fastcall TAnimContainer::SetTranslateAnim(vector3 vNewTranslate, double f
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::AnimSetVMD(double fNewSpeed)
|
||||
void TAnimContainer::AnimSetVMD(double fNewSpeed)
|
||||
{
|
||||
if (!this)
|
||||
return; // wywoływane z eventu, gdy brak modelu
|
||||
@@ -198,7 +198,7 @@ void __fastcall TAnimContainer::AnimSetVMD(double fNewSpeed)
|
||||
// "+AnsiString(pMovementData->f3Vector.y)+" "+AnsiString(pMovementData->f3Vector.z));
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::UpdateModel()
|
||||
void TAnimContainer::UpdateModel()
|
||||
{ // przeliczanie animacji wykonać tylko raz na model
|
||||
if (pSubModel) // pozbyć się tego - sprawdzać wcześniej
|
||||
{
|
||||
@@ -302,7 +302,7 @@ void __fastcall TAnimContainer::UpdateModel()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TAnimContainer::PrepareModel()
|
||||
void TAnimContainer::PrepareModel()
|
||||
{ // tutaj zostawić tylko ustawienie submodelu, przeliczanie ma być w UpdateModel()
|
||||
if (pSubModel) // pozbyć się tego - sprawdzać wcześniej
|
||||
{
|
||||
@@ -345,7 +345,7 @@ void __fastcall TAnimContainer::PrepareModel()
|
||||
// "+AnsiString(vTranslation.x)+" "+AnsiString(vTranslation.y)+" "+AnsiString(vTranslation.z));
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::UpdateModelIK()
|
||||
void TAnimContainer::UpdateModelIK()
|
||||
{ // odwrotna kinematyka wyliczana dopiero po ustawieniu macierzy w submodelach
|
||||
if (pSubModel) // pozbyć się tego - sprawdzać wcześniej
|
||||
{
|
||||
@@ -384,12 +384,12 @@ void __fastcall TAnimContainer::UpdateModelIK()
|
||||
}
|
||||
}
|
||||
|
||||
bool __fastcall TAnimContainer::InMovement()
|
||||
bool TAnimContainer::InMovement()
|
||||
{ // czy trwa animacja - informacja dla obrotnicy
|
||||
return (fRotateSpeed != 0.0) || (fTranslateSpeed != 0.0);
|
||||
}
|
||||
|
||||
void __fastcall TAnimContainer::EventAssign(TEvent *ev)
|
||||
void TAnimContainer::EventAssign(TEvent *ev)
|
||||
{ // przypisanie eventu wykonywanego po zakończeniu animacji evDone = ev; };
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -425,7 +425,7 @@ __fastcall TAnimModel::~TAnimModel()
|
||||
SafeDelete(pRoot);
|
||||
}
|
||||
|
||||
bool __fastcall TAnimModel::Init(TModel3d *pNewModel)
|
||||
bool TAnimModel::Init(TModel3d *pNewModel)
|
||||
{
|
||||
fBlinkTimer = double(random(1000 * fOffTime)) / (1000 * fOffTime);
|
||||
;
|
||||
@@ -433,7 +433,7 @@ bool __fastcall TAnimModel::Init(TModel3d *pNewModel)
|
||||
return (pModel != NULL);
|
||||
}
|
||||
|
||||
bool __fastcall TAnimModel::Init(AnsiString asName, AnsiString asReplacableTexture)
|
||||
bool TAnimModel::Init(AnsiString asName, AnsiString asReplacableTexture)
|
||||
{
|
||||
if (asReplacableTexture.SubString(1, 1) ==
|
||||
"*") // od gwiazdki zaczynają się teksty na wyświetlaczach
|
||||
@@ -451,7 +451,7 @@ bool __fastcall TAnimModel::Init(AnsiString asName, AnsiString asReplacableTextu
|
||||
return (Init(TModelsManager::GetModel(asName.c_str())));
|
||||
}
|
||||
|
||||
bool __fastcall TAnimModel::Load(cParser *parser, bool ter)
|
||||
bool TAnimModel::Load(cParser *parser, bool ter)
|
||||
{ // rozpoznanie wpisu modelu i ustawienie świateł
|
||||
AnsiString str;
|
||||
std::string token;
|
||||
@@ -549,7 +549,7 @@ TAnimContainer *__fastcall TAnimModel::GetContainer(char *pName)
|
||||
return AddContainer(pName);
|
||||
}
|
||||
|
||||
void __fastcall TAnimModel::RaAnimate()
|
||||
void TAnimModel::RaAnimate()
|
||||
{ // przeliczenie animacji - jednorazowo na klatkę
|
||||
// Ra 2F1I: to by można pomijać dla modeli bez animacji, których jest większość
|
||||
TAnimContainer *pCurrent;
|
||||
@@ -561,7 +561,7 @@ void __fastcall TAnimModel::RaAnimate()
|
||||
pCurrent->UpdateModelIK(); // przeliczenie odwrotnej kinematyki
|
||||
};
|
||||
|
||||
void __fastcall TAnimModel::RaPrepare()
|
||||
void TAnimModel::RaPrepare()
|
||||
{ // ustawia światła i animacje we wzorcu modelu przed renderowaniem egzemplarza
|
||||
fBlinkTimer -= Timer::GetDeltaTime();
|
||||
if (fBlinkTimer <= 0)
|
||||
@@ -597,7 +597,7 @@ void __fastcall TAnimModel::RaPrepare()
|
||||
// pCurrent->UpdateModelIK(); //przeliczenie odwrotnej kinematyki
|
||||
}
|
||||
|
||||
void __fastcall TAnimModel::RenderVBO(vector3 pPosition, double fAngle)
|
||||
void TAnimModel::RenderVBO(vector3 pPosition, double fAngle)
|
||||
{ // sprawdza światła i rekurencyjnie renderuje TModel3d
|
||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||
RaPrepare();
|
||||
@@ -605,14 +605,14 @@ void __fastcall TAnimModel::RenderVBO(vector3 pPosition, double fAngle)
|
||||
pModel->RaRender(pPosition, fAngle, ReplacableSkinId, iTexAlpha);
|
||||
}
|
||||
|
||||
void __fastcall TAnimModel::RenderAlphaVBO(vector3 pPosition, double fAngle)
|
||||
void TAnimModel::RenderAlphaVBO(vector3 pPosition, double fAngle)
|
||||
{
|
||||
RaPrepare();
|
||||
if (pModel) // renderowanie rekurencyjne submodeli
|
||||
pModel->RaRenderAlpha(pPosition, fAngle, ReplacableSkinId, iTexAlpha);
|
||||
};
|
||||
|
||||
void __fastcall TAnimModel::RenderDL(vector3 pPosition, double fAngle)
|
||||
void TAnimModel::RenderDL(vector3 pPosition, double fAngle)
|
||||
{
|
||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||
RaPrepare();
|
||||
@@ -620,14 +620,14 @@ void __fastcall TAnimModel::RenderDL(vector3 pPosition, double fAngle)
|
||||
pModel->Render(pPosition, fAngle, ReplacableSkinId, iTexAlpha);
|
||||
}
|
||||
|
||||
void __fastcall TAnimModel::RenderAlphaDL(vector3 pPosition, double fAngle)
|
||||
void TAnimModel::RenderAlphaDL(vector3 pPosition, double fAngle)
|
||||
{
|
||||
RaPrepare();
|
||||
if (pModel)
|
||||
pModel->RenderAlpha(pPosition, fAngle, ReplacableSkinId, iTexAlpha);
|
||||
};
|
||||
|
||||
int __fastcall TAnimModel::Flags()
|
||||
int TAnimModel::Flags()
|
||||
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
|
||||
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu
|
||||
if (ReplacableSkinId[1] > 0) // jeśli ma wymienną teksturę 0
|
||||
@@ -645,27 +645,27 @@ int __fastcall TAnimModel::Flags()
|
||||
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAnimModel::RenderDL(vector3 *vPosition)
|
||||
void TAnimModel::RenderDL(vector3 *vPosition)
|
||||
{
|
||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||
RaPrepare();
|
||||
if (pModel) // renderowanie rekurencyjne submodeli
|
||||
pModel->Render(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
||||
};
|
||||
void __fastcall TAnimModel::RenderAlphaDL(vector3 *vPosition)
|
||||
void TAnimModel::RenderAlphaDL(vector3 *vPosition)
|
||||
{
|
||||
RaPrepare();
|
||||
if (pModel) // renderowanie rekurencyjne submodeli
|
||||
pModel->RenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
||||
};
|
||||
void __fastcall TAnimModel::RenderVBO(vector3 *vPosition)
|
||||
void TAnimModel::RenderVBO(vector3 *vPosition)
|
||||
{
|
||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||
RaPrepare();
|
||||
if (pModel) // renderowanie rekurencyjne submodeli
|
||||
pModel->RaRender(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
||||
};
|
||||
void __fastcall TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
||||
void TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
||||
{
|
||||
RaPrepare();
|
||||
if (pModel) // renderowanie rekurencyjne submodeli
|
||||
@@ -673,24 +673,24 @@ void __fastcall TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TAnimModel::TerrainLoaded()
|
||||
bool TAnimModel::TerrainLoaded()
|
||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||
return (this ? pModel != NULL : false); };
|
||||
int __fastcall TAnimModel::TerrainCount()
|
||||
int TAnimModel::TerrainCount()
|
||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||
return pModel ? pModel->TerrainCount() : 0; };
|
||||
TSubModel *__fastcall TAnimModel::TerrainSquare(int n)
|
||||
{ // pobieranie wskaźników do pierwszego submodelu
|
||||
return pModel ? pModel->TerrainSquare(n) : 0;
|
||||
};
|
||||
void __fastcall TAnimModel::TerrainRenderVBO(int n)
|
||||
void TAnimModel::TerrainRenderVBO(int n)
|
||||
{ // renderowanie terenu z VBO
|
||||
if (pModel)
|
||||
pModel->TerrainRenderVBO(n);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAnimModel::Advanced()
|
||||
void TAnimModel::Advanced()
|
||||
{ // wykonanie zaawansowanych animacji na submodelach
|
||||
pAdvanced->fCurrent +=
|
||||
pAdvanced->fFrequency * Timer::GetDeltaTime(); // aktualna ramka zmiennoprzecinkowo
|
||||
@@ -724,7 +724,7 @@ void __fastcall TAnimModel::Advanced()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TAnimModel::AnimationVND(void *pData, double a, double b, double c, double d)
|
||||
void TAnimModel::AnimationVND(void *pData, double a, double b, double c, double d)
|
||||
{ // rozpoczęcie wykonywania animacji z podanego pliku
|
||||
// tabela w pliku musi być posortowana wg klatek dla kolejnych kości!
|
||||
// skrócone nagranie ma 3:42 = 222 sekundy, animacja kończy się na klatce 6518
|
||||
@@ -818,7 +818,7 @@ void __fastcall TAnimModel::AnimationVND(void *pData, double a, double b, double
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAnimModel::LightSet(int n, float v)
|
||||
void TAnimModel::LightSet(int n, float v)
|
||||
{ // ustawienie światła (n) na wartość (v)
|
||||
if (n >= iMaxNumLights)
|
||||
return; // przekroczony zakres
|
||||
@@ -840,7 +840,7 @@ void __fastcall TAnimModel::LightSet(int n, float v)
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAnimModel::AnimUpdate(double dt)
|
||||
void TAnimModel::AnimUpdate(double dt)
|
||||
{ // wykonanie zakolejkowanych animacji, nawet gdy modele nie są aktualnie wyświetlane
|
||||
TAnimContainer *p = TAnimModel::acAnimList;
|
||||
while (p)
|
||||
|
||||
84
AnimModel.h
84
AnimModel.h
@@ -61,34 +61,34 @@ class TAnimContainer
|
||||
TAnimContainer *pNext;
|
||||
TAnimContainer *acAnimNext; // lista animacji z eventem, które musz¹ byæ przeliczane równie¿ bez
|
||||
// wyœwietlania
|
||||
__fastcall TAnimContainer();
|
||||
__fastcall ~TAnimContainer();
|
||||
bool __fastcall Init(TSubModel *pNewSubModel);
|
||||
// std::string inline __fastcall GetName() { return
|
||||
TAnimContainer();
|
||||
~TAnimContainer();
|
||||
bool Init(TSubModel *pNewSubModel);
|
||||
// std::string inline GetName() { return
|
||||
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
||||
// std::string inline __fastcall 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); };
|
||||
// void __fastcall SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
||||
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
||||
// fNewRotateSpeed, bool bResetAngle=false);
|
||||
void __fastcall SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed);
|
||||
void __fastcall SetTranslateAnim(vector3 vNewTranslate, double fNewSpeed);
|
||||
void __fastcall AnimSetVMD(double fNewSpeed);
|
||||
void __fastcall PrepareModel();
|
||||
void __fastcall UpdateModel();
|
||||
void __fastcall UpdateModelIK();
|
||||
bool __fastcall InMovement(); // czy w trakcie animacji?
|
||||
void SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed);
|
||||
void SetTranslateAnim(vector3 vNewTranslate, double fNewSpeed);
|
||||
void AnimSetVMD(double fNewSpeed);
|
||||
void PrepareModel();
|
||||
void UpdateModel();
|
||||
void UpdateModelIK();
|
||||
bool InMovement(); // czy w trakcie animacji?
|
||||
double _fastcall AngleGet() { return vRotateAngles.z; }; // jednak ostatnia, T3D ma inny uk³ad
|
||||
vector3 _fastcall TransGet()
|
||||
{
|
||||
return vector3(-vTranslation.x, vTranslation.z, vTranslation.y);
|
||||
}; // zmiana, bo T3D ma inny uk³ad
|
||||
void __fastcall WillBeAnimated()
|
||||
void WillBeAnimated()
|
||||
{
|
||||
if (pSubModel)
|
||||
pSubModel->WillBeAnimated();
|
||||
};
|
||||
void __fastcall EventAssign(TEvent *ev);
|
||||
void EventAssign(TEvent *ev);
|
||||
TEvent *__fastcall Event() { return evDone; };
|
||||
};
|
||||
|
||||
@@ -101,9 +101,9 @@ class TAnimAdvanced
|
||||
double fCurrent; // klatka animacji wyœwietlona w poprzedniej klatce renderingu
|
||||
double fLast; // klatka koñcz¹ca animacjê
|
||||
int iMovements;
|
||||
__fastcall TAnimAdvanced();
|
||||
__fastcall ~TAnimAdvanced();
|
||||
int __fastcall SortByBone();
|
||||
TAnimAdvanced();
|
||||
~TAnimAdvanced();
|
||||
int SortByBone();
|
||||
};
|
||||
|
||||
class TAnimModel
|
||||
@@ -119,46 +119,46 @@ class TAnimModel
|
||||
int iTexAlpha; //¿eby nie sprawdzaæ za ka¿dym razem, dla 4 wymiennych tekstur
|
||||
AnsiString asText; // tekst dla wyœwietlacza znakowego
|
||||
TAnimAdvanced *pAdvanced;
|
||||
void __fastcall Advanced();
|
||||
void Advanced();
|
||||
TLightState lsLights[iMaxNumLights];
|
||||
float fDark; // poziom zapalanie œwiat³a (powinno byæ chyba powi¹zane z danym œwiat³em?)
|
||||
float fOnTime, fOffTime; // by³y sta³ymi, teraz mog¹ byæ zmienne dla ka¿dego egzemplarza
|
||||
private:
|
||||
void __fastcall RaAnimate(); // przeliczenie animacji egzemplarza
|
||||
void __fastcall RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
|
||||
void RaAnimate(); // przeliczenie animacji egzemplarza
|
||||
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
|
||||
public:
|
||||
GLuint ReplacableSkinId[5]; // McZapkie-020802: zmienialne skory
|
||||
static TAnimContainer *acAnimList; // lista animacji z eventem, które musz¹ byæ przeliczane
|
||||
// równie¿ bez wyœwietlania
|
||||
__fastcall TAnimModel();
|
||||
__fastcall ~TAnimModel();
|
||||
bool __fastcall Init(TModel3d *pNewModel);
|
||||
bool __fastcall Init(AnsiString asName, AnsiString asReplacableTexture);
|
||||
bool __fastcall Load(cParser *parser, bool ter = false);
|
||||
TAnimModel();
|
||||
~TAnimModel();
|
||||
bool Init(TModel3d *pNewModel);
|
||||
bool Init(AnsiString asName, AnsiString asReplacableTexture);
|
||||
bool Load(cParser *parser, bool ter = false);
|
||||
TAnimContainer *__fastcall AddContainer(char *pName);
|
||||
TAnimContainer *__fastcall GetContainer(char *pName);
|
||||
void __fastcall RenderDL(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void __fastcall RenderAlphaDL(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void __fastcall RenderVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void __fastcall RenderAlphaVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void __fastcall RenderDL(vector3 *vPosition);
|
||||
void __fastcall RenderAlphaDL(vector3 *vPosition);
|
||||
void __fastcall RenderVBO(vector3 *vPosition);
|
||||
void __fastcall RenderAlphaVBO(vector3 *vPosition);
|
||||
int __fastcall Flags();
|
||||
void __fastcall RaAnglesSet(double a, double b, double c)
|
||||
void RenderDL(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void RenderAlphaDL(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void RenderVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void RenderAlphaVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||
void RenderDL(vector3 *vPosition);
|
||||
void RenderAlphaDL(vector3 *vPosition);
|
||||
void RenderVBO(vector3 *vPosition);
|
||||
void RenderAlphaVBO(vector3 *vPosition);
|
||||
int Flags();
|
||||
void RaAnglesSet(double a, double b, double c)
|
||||
{
|
||||
vAngle.x = a;
|
||||
vAngle.y = b;
|
||||
vAngle.z = c;
|
||||
};
|
||||
bool __fastcall TerrainLoaded();
|
||||
int __fastcall TerrainCount();
|
||||
bool TerrainLoaded();
|
||||
int TerrainCount();
|
||||
TSubModel *__fastcall TerrainSquare(int n);
|
||||
void __fastcall TerrainRenderVBO(int n);
|
||||
void __fastcall AnimationVND(void *pData, double a, double b, double c, double d);
|
||||
void __fastcall LightSet(int n, float v);
|
||||
static void __fastcall AnimUpdate(double dt);
|
||||
void TerrainRenderVBO(int n);
|
||||
void AnimationVND(void *pData, double a, double b, double c, double d);
|
||||
void LightSet(int n, float v);
|
||||
static void AnimUpdate(double dt);
|
||||
};
|
||||
TAnimContainer *TAnimModel::acAnimList = NULL;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ __fastcall TButton::TButton()
|
||||
|
||||
__fastcall TButton::~TButton(){};
|
||||
|
||||
void __fastcall TButton::Clear(int i)
|
||||
void TButton::Clear(int i)
|
||||
{
|
||||
pModelOn = NULL;
|
||||
pModelOff = NULL;
|
||||
@@ -29,7 +29,7 @@ void __fastcall TButton::Clear(int i)
|
||||
Update(); // kasowanie bitu Feedback, o ile jakiœ ustawiony
|
||||
};
|
||||
|
||||
void __fastcall TButton::Init(AnsiString asName, TModel3d *pModel, bool bNewOn)
|
||||
void TButton::Init(AnsiString asName, TModel3d *pModel, bool bNewOn)
|
||||
{
|
||||
if (!pModel)
|
||||
return; // nie ma w czym szukaæ
|
||||
@@ -39,7 +39,7 @@ void __fastcall TButton::Init(AnsiString asName, TModel3d *pModel, bool bNewOn)
|
||||
Update();
|
||||
};
|
||||
|
||||
void __fastcall TButton::Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2)
|
||||
void TButton::Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2)
|
||||
{
|
||||
AnsiString str = Parser->GetNextSymbol().LowerCase();
|
||||
if (pModel1)
|
||||
@@ -57,7 +57,7 @@ void __fastcall TButton::Load(TQueryParserComp *Parser, TModel3d *pModel1, TMode
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TButton::Update()
|
||||
void TButton::Update()
|
||||
{
|
||||
if (pModelOn)
|
||||
pModelOn->iVisible = bOn;
|
||||
|
||||
12
Button.h
12
Button.h
@@ -12,12 +12,12 @@ class TButton
|
||||
TSubModel *pModelOn, *pModelOff; // submodel dla stanu za³¹czonego i wy³¹czonego
|
||||
bool bOn;
|
||||
int iFeedbackBit; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit
|
||||
void __fastcall Update();
|
||||
void Update();
|
||||
|
||||
public:
|
||||
__fastcall TButton();
|
||||
__fastcall ~TButton();
|
||||
void __fastcall Clear(int i = -1);
|
||||
TButton();
|
||||
~TButton();
|
||||
void Clear(int i = -1);
|
||||
inline void FeedbackBitSet(int i) { iFeedbackBit = 1 << i; };
|
||||
inline void Turn(bool to)
|
||||
{
|
||||
@@ -40,8 +40,8 @@ class TButton
|
||||
Update();
|
||||
};
|
||||
inline bool Active() { return (pModelOn) || (pModelOff); };
|
||||
void __fastcall Init(AnsiString asName, TModel3d *pModel, bool bNewOn = false);
|
||||
void __fastcall Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
||||
void Init(AnsiString asName, TModel3d *pModel, bool bNewOn = false);
|
||||
void Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
18
Camera.cpp
18
Camera.cpp
@@ -21,7 +21,7 @@
|
||||
|
||||
const vector3 OrgCrossPos = vector3(0, -10, 0);
|
||||
|
||||
void __fastcall TCamera::Init(vector3 NPos, vector3 NAngle)
|
||||
void TCamera::Init(vector3 NPos, vector3 NAngle)
|
||||
{
|
||||
|
||||
pOffset = vector3(-0.0, 0, 0);
|
||||
@@ -41,7 +41,7 @@ void __fastcall TCamera::Init(vector3 NPos, vector3 NAngle)
|
||||
// Type= tp_Free;
|
||||
};
|
||||
|
||||
void __fastcall TCamera::OnCursorMove(double x, double y)
|
||||
void TCamera::OnCursorMove(double x, double y)
|
||||
{
|
||||
// McZapkie-170402: zeby mysz dzialala zawsze if (Type==tp_Follow)
|
||||
Pitch += y;
|
||||
@@ -57,7 +57,7 @@ void __fastcall TCamera::OnCursorMove(double x, double y)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TCamera::Update()
|
||||
void TCamera::Update()
|
||||
{
|
||||
// ABu: zmiana i uniezaleznienie predkosci od FPS
|
||||
double a = (Console::Pressed(VK_SHIFT) ? 5.00 : 1.00);
|
||||
@@ -135,7 +135,7 @@ void __fastcall TCamera::Update()
|
||||
}
|
||||
}
|
||||
|
||||
vector3 __fastcall TCamera::GetDirection()
|
||||
vector3 TCamera::GetDirection()
|
||||
{
|
||||
matrix4x4 mat;
|
||||
vector3 Vec;
|
||||
@@ -145,8 +145,8 @@ vector3 __fastcall TCamera::GetDirection()
|
||||
return (Normalize(Vec));
|
||||
}
|
||||
|
||||
// bool __fastcall TCamera::GetMatrix(matrix4x4 &Matrix)
|
||||
bool __fastcall TCamera::SetMatrix()
|
||||
// bool TCamera::GetMatrix(matrix4x4 &Matrix)
|
||||
bool TCamera::SetMatrix()
|
||||
{
|
||||
glRotated(-Roll * 180.0f / M_PI, 0, 0, 1); // po wy³¹czeniu tego krêci siê pojazd, a sceneria
|
||||
// nie
|
||||
@@ -177,7 +177,7 @@ bool __fastcall TCamera::SetMatrix()
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TCamera::SetCabMatrix(vector3 &p)
|
||||
void TCamera::SetCabMatrix(vector3 &p)
|
||||
{ // ustawienie widoku z kamery bez przesuniêcia robionego przez OpenGL - nie powinno tak trz¹œæ
|
||||
glRotated(-Roll * 180.0f / M_PI, 0, 0, 1);
|
||||
glRotated(-Pitch * 180.0f / M_PI, 1, 0, 0);
|
||||
@@ -187,7 +187,7 @@ void __fastcall TCamera::SetCabMatrix(vector3 &p)
|
||||
LookAt.z - p.z, vUp.x, vUp.y, vUp.z); // Ra: pOffset is zero
|
||||
}
|
||||
|
||||
void __fastcall TCamera::RaLook()
|
||||
void TCamera::RaLook()
|
||||
{ // zmiana kierunku patrzenia - przelicza Yaw
|
||||
vector3 where = LookAt - Pos + vector3(0, 3, 0); // trochê w górê od szyn
|
||||
if ((where.x != 0.0) || (where.z != 0.0))
|
||||
@@ -197,7 +197,7 @@ void __fastcall TCamera::RaLook()
|
||||
Pitch = asin(where.y / l); // k¹t w pionie
|
||||
};
|
||||
|
||||
void __fastcall TCamera::Stop()
|
||||
void TCamera::Stop()
|
||||
{ // wy³¹cznie bezw³adnego ruchu po powrocie do kabiny
|
||||
Type = tp_Follow;
|
||||
Velocity = vector3(0, 0, 0);
|
||||
|
||||
22
Camera.h
22
Camera.h
@@ -29,18 +29,18 @@ class TCamera
|
||||
vector3 OldVelocity; // lepiej usredniac zeby nie bylo rozbiezne przy malym FPS
|
||||
vector3 CrossPos;
|
||||
double CrossDist;
|
||||
void __fastcall Init(vector3 NPos, vector3 NAngle);
|
||||
void __fastcall Reset() { Pitch = Yaw = Roll = 0; };
|
||||
void __fastcall OnCursorMove(double x, double y);
|
||||
void __fastcall Update();
|
||||
vector3 __fastcall GetDirection();
|
||||
// vector3 inline __fastcall GetCrossPos() { return Pos+GetDirection()*CrossDist+CrossPos; };
|
||||
void Init(vector3 NPos, vector3 NAngle);
|
||||
void Reset() { Pitch = Yaw = Roll = 0; };
|
||||
void OnCursorMove(double x, double y);
|
||||
void Update();
|
||||
vector3 GetDirection();
|
||||
// vector3 inline GetCrossPos() { return Pos+GetDirection()*CrossDist+CrossPos; };
|
||||
|
||||
bool __fastcall SetMatrix();
|
||||
void __fastcall SetCabMatrix(vector3 &p);
|
||||
void __fastcall RaLook();
|
||||
void __fastcall Stop();
|
||||
// bool __fastcall GetMatrix(matrix4x4 &Matrix);
|
||||
bool SetMatrix();
|
||||
void SetCabMatrix(vector3 &p);
|
||||
void RaLook();
|
||||
void Stop();
|
||||
// bool GetMatrix(matrix4x4 &Matrix);
|
||||
vector3 PtNext, PtPrev;
|
||||
};
|
||||
#endif
|
||||
|
||||
30
Console.cpp
30
Console.cpp
@@ -120,13 +120,13 @@ __fastcall Console::~Console()
|
||||
delete PoKeys55[1];
|
||||
};
|
||||
|
||||
void __fastcall Console::ModeSet(int m, int h)
|
||||
void Console::ModeSet(int m, int h)
|
||||
{ // ustawienie trybu pracy
|
||||
iMode = m;
|
||||
iConfig = h;
|
||||
};
|
||||
|
||||
int __fastcall Console::On()
|
||||
int Console::On()
|
||||
{ // załączenie konsoli (np. nawiązanie komunikacji)
|
||||
iSwitch[0] = iSwitch[1] = iSwitch[2] = iSwitch[3] = 0; // bity 0..127 - bez [Ctrl]
|
||||
iSwitch[4] = iSwitch[5] = iSwitch[6] = iSwitch[7] = 0; // bity 128..255 - z [Ctrl]
|
||||
@@ -166,7 +166,7 @@ int __fastcall Console::On()
|
||||
return 0;
|
||||
};
|
||||
|
||||
void __fastcall Console::Off()
|
||||
void Console::Off()
|
||||
{ // wyłączenie informacji zwrotnych (reset pulpitu)
|
||||
BitsClear(-1);
|
||||
if ((iMode == 1) || (iMode == 2))
|
||||
@@ -183,7 +183,7 @@ void __fastcall Console::Off()
|
||||
LPT = NULL;
|
||||
};
|
||||
|
||||
void __fastcall Console::BitsSet(int mask, int entry)
|
||||
void Console::BitsSet(int mask, int entry)
|
||||
{ // ustawienie bitów o podanej masce (mask) na wejściu (entry)
|
||||
if ((iBits & mask) != mask) // jeżeli zmiana
|
||||
{
|
||||
@@ -193,7 +193,7 @@ void __fastcall Console::BitsSet(int mask, int entry)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall Console::BitsClear(int mask, int entry)
|
||||
void Console::BitsClear(int mask, int entry)
|
||||
{ // zerowanie bitów o podanej masce (mask) na wejściu (entry)
|
||||
if (iBits & mask) // jeżeli zmiana
|
||||
{
|
||||
@@ -203,7 +203,7 @@ void __fastcall Console::BitsClear(int mask, int entry)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall Console::BitsUpdate(int mask)
|
||||
void Console::BitsUpdate(int mask)
|
||||
{ // aktualizacja stanu interfejsu informacji zwrotnej; (mask) - zakres zmienianych bitów
|
||||
switch (iMode)
|
||||
{
|
||||
@@ -267,9 +267,9 @@ void __fastcall Console::BitsUpdate(int mask)
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall Console::Pressed(int x) { // na razie tak - czyta się tylko klawiatura return Global::bActive && (GetKeyState(x) < 0); };
|
||||
bool Console::Pressed(int x) { // na razie tak - czyta się tylko klawiatura return Global::bActive && (GetKeyState(x) < 0); };
|
||||
|
||||
void __fastcall Console::ValueSet(int x, double y)
|
||||
void Console::ValueSet(int x, double y)
|
||||
{ // ustawienie wartości (y) na kanale analogowym (x)
|
||||
if (iMode == 4)
|
||||
if (PoKeys55[0])
|
||||
@@ -282,7 +282,7 @@ void __fastcall Console::ValueSet(int x, double y)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall Console::Update()
|
||||
void Console::Update()
|
||||
{ // funkcja powinna być wywoływana regularnie, np. raz w każdej ramce ekranowej
|
||||
if (iMode == 4)
|
||||
if (PoKeys55[0])
|
||||
@@ -299,7 +299,7 @@ void __fastcall Console::Update()
|
||||
}
|
||||
};
|
||||
|
||||
float __fastcall Console::AnalogGet(int x)
|
||||
float Console::AnalogGet(int x)
|
||||
{ // pobranie wartości analogowej
|
||||
if (iMode == 4)
|
||||
if (PoKeys55[0])
|
||||
@@ -307,7 +307,7 @@ float __fastcall Console::AnalogGet(int x)
|
||||
return -1.0;
|
||||
};
|
||||
|
||||
unsigned char __fastcall Console::DigitalGet(int x)
|
||||
unsigned char Console::DigitalGet(int x)
|
||||
{ // pobranie wartości cyfrowej
|
||||
if (iMode == 4)
|
||||
if (PoKeys55[0])
|
||||
@@ -315,7 +315,7 @@ unsigned char __fastcall Console::DigitalGet(int x)
|
||||
return 0;
|
||||
};
|
||||
|
||||
void __fastcall Console::OnKeyDown(int k)
|
||||
void Console::OnKeyDown(int k)
|
||||
{ // naciśnięcie klawisza z powoduje wyłączenie, a
|
||||
if (k & 0x10000) // jeśli [Shift]
|
||||
{ // ustawienie bitu w tabeli przełączników bistabilnych
|
||||
@@ -338,7 +338,7 @@ void __fastcall Console::OnKeyDown(int k)
|
||||
}
|
||||
}
|
||||
};
|
||||
void __fastcall Console::OnKeyUp(int k)
|
||||
void Console::OnKeyUp(int k)
|
||||
{ // puszczenie klawisza w zasadzie nie ma znaczenia dla iSwitch, ale zeruje iButton
|
||||
if ((k & 0x20000) == 0) // monostabilne tylko bez [Ctrl]
|
||||
if (k & 0x10000) // jeśli [Shift]
|
||||
@@ -346,5 +346,5 @@ void __fastcall Console::OnKeyUp(int k)
|
||||
else
|
||||
iButton[char(k) >> 5] &= ~(1 << (k & 31)); // wyłącz monostabilny podstawowy
|
||||
};
|
||||
int __fastcall Console::KeyDownConvert(int k) { return int(ktTable[k & 0x3FF].iDown); };
|
||||
int __fastcall Console::KeyUpConvert(int k) { return int(ktTable[k & 0x3FF].iUp); };
|
||||
int Console::KeyDownConvert(int k) { return int(ktTable[k & 0x3FF].iDown); };
|
||||
int Console::KeyUpConvert(int k) { return int(ktTable[k & 0x3FF].iUp); };
|
||||
|
||||
34
Console.h
34
Console.h
@@ -24,7 +24,7 @@ class Console
|
||||
static int iBits; // podstawowy zestaw lampek
|
||||
static TPoKeys55 *PoKeys55[2]; // może ich być kilka
|
||||
static TLPT *LPT;
|
||||
static void __fastcall BitsUpdate(int mask);
|
||||
static void BitsUpdate(int mask);
|
||||
// zmienne dla trybu "jednokabinowego", potrzebne do współpracy z pulpitem (PoKeys)
|
||||
// używając klawiatury, każdy pojazd powinien mieć własny stan przełączników
|
||||
// bazowym sterowaniem jest wirtualny strumień klawiatury
|
||||
@@ -33,22 +33,22 @@ class Console
|
||||
static int iButton[8]; // monostabilne w kabinie, załączane podczas trzymania klawisza
|
||||
static TKeyTrans ktTable[4 * 256]; // tabela wczesnej konwersji klawiatury
|
||||
public:
|
||||
__fastcall Console();
|
||||
__fastcall ~Console();
|
||||
static void __fastcall ModeSet(int m, int h = 0);
|
||||
static void __fastcall BitsSet(int mask, int entry = 0);
|
||||
static void __fastcall BitsClear(int mask, int entry = 0);
|
||||
static int __fastcall On();
|
||||
static void __fastcall Off();
|
||||
static bool __fastcall Pressed(int x);
|
||||
static void __fastcall ValueSet(int x, double y);
|
||||
static void __fastcall Update();
|
||||
static float __fastcall AnalogGet(int x);
|
||||
static unsigned char __fastcall DigitalGet(int x);
|
||||
static void __fastcall OnKeyDown(int k);
|
||||
static void __fastcall OnKeyUp(int k);
|
||||
static int __fastcall KeyDownConvert(int k);
|
||||
static int __fastcall KeyUpConvert(int k);
|
||||
Console();
|
||||
~Console();
|
||||
static void ModeSet(int m, int h = 0);
|
||||
static void BitsSet(int mask, int entry = 0);
|
||||
static void BitsClear(int mask, int entry = 0);
|
||||
static int On();
|
||||
static void Off();
|
||||
static bool Pressed(int x);
|
||||
static void ValueSet(int x, double y);
|
||||
static void Update();
|
||||
static float AnalogGet(int x);
|
||||
static unsigned char DigitalGet(int x);
|
||||
static void OnKeyDown(int k);
|
||||
static void OnKeyUp(int k);
|
||||
static int KeyDownConvert(int k);
|
||||
static int KeyUpConvert(int k);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef void(__stdcall *OutPortType)(USHORT BasePort, USHORT value);
|
||||
InPortType InPort;
|
||||
OutPortType OutPort;
|
||||
|
||||
bool __fastcall TLPT::Connect(int port)
|
||||
bool TLPT::Connect(int port)
|
||||
{
|
||||
// ladowanie dll-ki
|
||||
hDLL = LoadLibrary("inpout32.dll");
|
||||
@@ -41,4 +41,4 @@ bool __fastcall TLPT::Connect(int port)
|
||||
return bool(OutPort);
|
||||
};
|
||||
|
||||
void __fastcall TLPT::Out(int x) { // wys³anie bajtu do portu OutPort(address, x); };
|
||||
void TLPT::Out(int x) { // wys³anie bajtu do portu OutPort(address, x); };
|
||||
|
||||
@@ -10,7 +10,7 @@ class TLPT
|
||||
int address;
|
||||
|
||||
public:
|
||||
bool __fastcall Connect(int port);
|
||||
void __fastcall Out(int x);
|
||||
bool Connect(int port);
|
||||
void Out(int x);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@ __fastcall TPoKeys55::TPoKeys55()
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TPoKeys55::~TPoKeys55() { Close(); };
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TPoKeys55::Close()
|
||||
bool TPoKeys55::Close()
|
||||
{ // roz³¹czenie komunikacji
|
||||
if (WriteHandle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(WriteHandle);
|
||||
@@ -43,7 +43,7 @@ bool __fastcall TPoKeys55::Close()
|
||||
ReadHandle = INVALID_HANDLE_VALUE;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TPoKeys55::Connect()
|
||||
bool TPoKeys55::Connect()
|
||||
{ // Ra: to jest do wyczyszcznia z niepotrzebnych zmiennych i komunikatów
|
||||
Close();
|
||||
GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, 0x88, 0xcb, 0x00,
|
||||
@@ -194,7 +194,7 @@ bool __fastcall TPoKeys55::Connect()
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall 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)
|
||||
{
|
||||
DWORD BytesWritten = 0;
|
||||
@@ -221,7 +221,7 @@ bool __fastcall TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned cha
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall TPoKeys55::Read()
|
||||
bool TPoKeys55::Read()
|
||||
{
|
||||
DWORD BytesRead = 0;
|
||||
InputBuffer[0] = 0; // The first byte is the "Report ID" and does not get transmitted over the
|
||||
@@ -236,7 +236,7 @@ bool __fastcall TPoKeys55::Read()
|
||||
return (BytesRead == 65) ? InputBuffer[7] == cRequest : false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TPoKeys55::ReadLoop(int i)
|
||||
bool TPoKeys55::ReadLoop(int i)
|
||||
{ // próbuje odczytaæ (i) razy
|
||||
do
|
||||
{
|
||||
@@ -247,7 +247,7 @@ bool __fastcall TPoKeys55::ReadLoop(int i)
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
AnsiString __fastcall TPoKeys55::Version()
|
||||
AnsiString TPoKeys55::Version()
|
||||
{ // zwraca numer wersji, funkcja nieoptymalna czasowo (czeka na odpowiedŸ)
|
||||
if (!WriteHandle)
|
||||
return "";
|
||||
@@ -280,14 +280,14 @@ AnsiString __fastcall TPoKeys55::Version()
|
||||
return "";
|
||||
};
|
||||
|
||||
bool __fastcall TPoKeys55::PWM(int x, float y)
|
||||
bool TPoKeys55::PWM(int x, float y)
|
||||
{ // ustawienie wskazanego PWM (@12Mhz: 12000=1ms=1000Hz)
|
||||
// iPWM[7]=1024; //1024==85333.3333333333ns=11718.75Hz
|
||||
iPWM[x] = int(0.5f + 0x0FFF * y) & 0x0FFF; // 0x0FFF=4095
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TPoKeys55::Update(bool pause)
|
||||
bool TPoKeys55::Update(bool pause)
|
||||
{ // funkcja powinna byæ wywo³ywana regularnie, np. raz w ka¿dej ramce ekranowej
|
||||
if (pause)
|
||||
{ // specjalna procedura, jeœli utracone po³¹czenie spowodowa³o pauzê
|
||||
|
||||
@@ -16,17 +16,17 @@ class TPoKeys55
|
||||
public:
|
||||
float fAnalog[7]; // wejœcia analogowe, stan <0.0,1.0>
|
||||
int iInputs[8];
|
||||
__fastcall TPoKeys55();
|
||||
__fastcall ~TPoKeys55();
|
||||
bool __fastcall Connect();
|
||||
bool __fastcall Close();
|
||||
bool __fastcall Write(unsigned char c, unsigned char b3, unsigned char b4 = 0,
|
||||
TPoKeys55();
|
||||
~TPoKeys55();
|
||||
bool Connect();
|
||||
bool Close();
|
||||
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0,
|
||||
unsigned char b5 = 0);
|
||||
bool __fastcall Read();
|
||||
bool __fastcall ReadLoop(int i);
|
||||
AnsiString __fastcall Version();
|
||||
bool __fastcall PWM(int x, float y);
|
||||
bool __fastcall Update(bool pause);
|
||||
bool Read();
|
||||
bool ReadLoop(int i);
|
||||
AnsiString Version();
|
||||
bool PWM(int x, float y);
|
||||
bool Update(bool pause);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
12
Curve.cpp
12
Curve.cpp
@@ -20,7 +20,7 @@ __fastcall TCurve::~TCurve()
|
||||
SafeDelete(Values);
|
||||
}
|
||||
|
||||
bool __fastcall TCurve::Init(int n, int c)
|
||||
bool TCurve::Init(int n, int c)
|
||||
{
|
||||
for (int i = 0; i < iNumValues; i++)
|
||||
SafeDelete(Values[i]);
|
||||
@@ -37,7 +37,7 @@ bool __fastcall TCurve::Init(int n, int c)
|
||||
Values[i][j] = 0;
|
||||
}
|
||||
|
||||
float __fastcall TCurve::GetValue(int c, float p)
|
||||
float TCurve::GetValue(int c, float p)
|
||||
{
|
||||
int a = floor(p);
|
||||
int b = ceil(p);
|
||||
@@ -49,7 +49,7 @@ float __fastcall TCurve::GetValue(int c, float p)
|
||||
return Values[a][c] * (1.0f - p) + Values[b][c] * (p);
|
||||
}
|
||||
|
||||
bool __fastcall TCurve::SetValue(int c, float p, float v)
|
||||
bool TCurve::SetValue(int c, float p, float v)
|
||||
{
|
||||
int a = floor(p);
|
||||
int b = ceil(p);
|
||||
@@ -65,7 +65,7 @@ bool __fastcall TCurve::SetValue(int c, float p, float v)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TCurve::Load(TQueryParserComp *Parser)
|
||||
bool TCurve::Load(TQueryParserComp *Parser)
|
||||
{
|
||||
DecimalSeparator = '.';
|
||||
AnsiString Token;
|
||||
@@ -85,7 +85,7 @@ bool __fastcall TCurve::Load(TQueryParserComp *Parser)
|
||||
DecimalSeparator = ',';
|
||||
}
|
||||
|
||||
bool __fastcall TCurve::LoadFromFile(AnsiString asName)
|
||||
bool TCurve::LoadFromFile(AnsiString asName)
|
||||
{
|
||||
DecimalSeparator = '.';
|
||||
TFileStream *fs;
|
||||
@@ -108,7 +108,7 @@ bool __fastcall TCurve::LoadFromFile(AnsiString asName)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
bool __fastcall TCurve::SaveToFile(AnsiString asName)
|
||||
bool TCurve::SaveToFile(AnsiString asName)
|
||||
{
|
||||
|
||||
DecimalSeparator = '.';
|
||||
|
||||
16
Curve.h
16
Curve.h
@@ -9,14 +9,14 @@
|
||||
class TCurve
|
||||
{
|
||||
public:
|
||||
__fastcall TCurve();
|
||||
__fastcall ~TCurve();
|
||||
bool __fastcall Init(int n, int c);
|
||||
float __fastcall GetValue(int c, float p);
|
||||
bool __fastcall SetValue(int c, float p, float v);
|
||||
bool __fastcall Load(TQueryParserComp *Parser);
|
||||
bool __fastcall LoadFromFile(AnsiString asName);
|
||||
bool __fastcall SaveToFile(AnsiString asName);
|
||||
TCurve();
|
||||
~TCurve();
|
||||
bool Init(int n, int c);
|
||||
float GetValue(int c, float p);
|
||||
bool SetValue(int c, float p, float v);
|
||||
bool Load(TQueryParserComp *Parser);
|
||||
bool LoadFromFile(AnsiString asName);
|
||||
bool SaveToFile(AnsiString asName);
|
||||
|
||||
int iNumValues;
|
||||
int iNumCols;
|
||||
|
||||
136
Driver.cpp
136
Driver.cpp
@@ -100,7 +100,7 @@ AnsiString StopReasonTable[] = { // przyczyny zatrzymania ruchu AI
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TSpeedPos::Clear()
|
||||
void TSpeedPos::Clear()
|
||||
{
|
||||
iFlags = 0; // brak flag to brak reakcji
|
||||
fVelNext = -1.0; // prędkość bez ograniczeń
|
||||
@@ -109,7 +109,7 @@ void __fastcall TSpeedPos::Clear()
|
||||
trTrack = NULL; // brak wskaźnika
|
||||
};
|
||||
|
||||
void __fastcall TSpeedPos::CommandCheck()
|
||||
void TSpeedPos::CommandCheck()
|
||||
{ // sprawdzenie typu komendy w evencie i określenie prędkości
|
||||
TCommandType command = evEvent->Command();
|
||||
double value1 = evEvent->ValueGet(1);
|
||||
@@ -158,7 +158,7 @@ void __fastcall TSpeedPos::CommandCheck()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
{ // przeliczenie odległości od punktu (*p), w kierunku (*dir), zaczynając od pojazdu
|
||||
// dla kolejnych pozycji podawane są współrzędne poprzedniego obiektu w (*p)
|
||||
vector3 v = vPos - *p; // wektor od poprzedniego obiektu (albo pojazdu) do punktu zmiany
|
||||
@@ -248,7 +248,7 @@ bool __fastcall TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
||||
return false;
|
||||
};
|
||||
|
||||
AnsiString __fastcall TSpeedPos::TableText()
|
||||
AnsiString TSpeedPos::TableText()
|
||||
{ // pozycja tabelki prędkości
|
||||
if (iFlags & 0x1)
|
||||
{ // o ile pozycja istotna
|
||||
@@ -262,7 +262,7 @@ AnsiString __fastcall TSpeedPos::TableText()
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
bool __fastcall TSpeedPos::Set(TEvent *e, double d)
|
||||
bool TSpeedPos::Set(TEvent *e, double d)
|
||||
{ // zapamiętanie zdarzenia
|
||||
fDist = d;
|
||||
iFlags = 0x101; // event+istotny
|
||||
@@ -272,7 +272,7 @@ bool __fastcall TSpeedPos::Set(TEvent *e, double d)
|
||||
return fVelNext == 0.0; // true gdy zatrzymanie, wtedy nie ma po co skanować dalej
|
||||
};
|
||||
|
||||
void __fastcall TSpeedPos::Set(TTrack *t, double d, int f)
|
||||
void TSpeedPos::Set(TTrack *t, double d, int f)
|
||||
{ // zapamiętanie zmiany prędkości w torze
|
||||
fDist = d; // odległość do początku toru
|
||||
trTrack = t; // TODO: (t) może być NULL i nie odczytamy końca poprzedniego :/
|
||||
@@ -299,7 +299,7 @@ void __fastcall TSpeedPos::Set(TTrack *t, double d, int f)
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TController::TableClear()
|
||||
void TController::TableClear()
|
||||
{ // wyczyszczenie tablicy
|
||||
iFirst = iLast = 0;
|
||||
iTableDirection = 0; // nieznany
|
||||
@@ -321,7 +321,7 @@ TEvent *__fastcall TController::CheckTrackEvent(double fDirection, TTrack *Track
|
||||
return e;
|
||||
}
|
||||
|
||||
bool __fastcall TController::TableAddNew()
|
||||
bool TController::TableAddNew()
|
||||
{ // zwiększenie użytej tabelki o jeden rekord
|
||||
iLast = (iLast + 1) % iSpeedTableSize;
|
||||
// TODO: jeszcze sprawdzić, czy się na iFirst nie nałoży
|
||||
@@ -332,7 +332,7 @@ bool __fastcall TController::TableAddNew()
|
||||
return true; // false gdy się nałoży
|
||||
};
|
||||
|
||||
bool __fastcall TController::TableNotFound(TEvent *e)
|
||||
bool TController::TableNotFound(TEvent *e)
|
||||
{ // sprawdzenie, czy nie został już dodany do tabelki (np. podwójne W4 robi problemy)
|
||||
int i, j = (iLast + 1) % iSpeedTableSize; // j, aby sprawdzić też ostatnią pozycję
|
||||
for (i = iFirst; i != j; i = (i + 1) % iSpeedTableSize)
|
||||
@@ -342,7 +342,7 @@ bool __fastcall TController::TableNotFound(TEvent *e)
|
||||
return true; // nie ma, czyli można dodać
|
||||
};
|
||||
|
||||
void __fastcall TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
{ // skanowanie trajektorii na odległość (fDistance) od (pVehicle) w kierunku przodu składu i
|
||||
// uzupełnianie tabelki
|
||||
if (!iDirection) // kierunek pojazdu z napędem
|
||||
@@ -543,7 +543,7 @@ void __fastcall TController::TableTraceRoute(double fDistance, TDynamicObject *p
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TController::TableCheck(double fDistance)
|
||||
void TController::TableCheck(double fDistance)
|
||||
{ // przeliczenie odległości w tabelce, ewentualnie doskanowanie (bez analizy prędkości itp.)
|
||||
if (iTableDirection != iDirection)
|
||||
TableTraceRoute(fDistance,
|
||||
@@ -617,7 +617,7 @@ void __fastcall TController::TableCheck(double fDistance)
|
||||
}
|
||||
};
|
||||
|
||||
TCommandType __fastcall TController::TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
double &fAcc)
|
||||
{ // ustalenie parametrów, zwraca typ komendy, jeśli sygnał podaje prędkość do jazdy
|
||||
// fVelDes - prędkość zadana
|
||||
@@ -1087,7 +1087,7 @@ TCommandType __fastcall TController::TableUpdate(double &fVelDes, double &fDist,
|
||||
return go;
|
||||
};
|
||||
|
||||
void __fastcall TController::TablePurger()
|
||||
void TController::TablePurger()
|
||||
{ // odtykacz: usuwa mniej istotne pozycje ze środka tabelki, aby uniknąć zatkania
|
||||
//(np. brak ograniczenia pomiędzy zwrotnicami, usunięte sygnały, minięte odcinki łuku)
|
||||
int i, j, k = iLast - iFirst; // może być 15 albo 16 pozycji, ostatniej nie ma co sprawdzać
|
||||
@@ -1277,7 +1277,7 @@ __fastcall TController::TController(bool AI, TDynamicObject *NewControll, bool I
|
||||
// rozruch o losowy czas
|
||||
};
|
||||
|
||||
void __fastcall TController::CloseLog()
|
||||
void TController::CloseLog()
|
||||
{
|
||||
if (WriteLogFlag)
|
||||
{
|
||||
@@ -1298,7 +1298,7 @@ __fastcall TController::~TController()
|
||||
CloseLog();
|
||||
};
|
||||
|
||||
AnsiString __fastcall TController::Order2Str(TOrders Order)
|
||||
AnsiString TController::Order2Str(TOrders Order)
|
||||
{ // zamiana kodu rozkazu na opis
|
||||
if (Order & Change_direction)
|
||||
return "Change_direction"; // może być nałożona na inną i wtedy ma priorytet
|
||||
@@ -1333,12 +1333,12 @@ AnsiString __fastcall TController::Order2Str(TOrders Order)
|
||||
return "Undefined!";
|
||||
}
|
||||
|
||||
AnsiString __fastcall TController::OrderCurrent()
|
||||
AnsiString TController::OrderCurrent()
|
||||
{ // pobranie aktualnego rozkazu celem wyświetlenia
|
||||
return AnsiString(OrderPos) + ". " + Order2Str(OrderList[OrderPos]);
|
||||
};
|
||||
|
||||
void __fastcall TController::OrdersClear()
|
||||
void TController::OrdersClear()
|
||||
{ // czyszczenie tabeli rozkazów na starcie albo po dojściu do końca
|
||||
OrderPos = 0;
|
||||
OrderTop = 1; // szczyt stosu rozkazów
|
||||
@@ -1349,7 +1349,7 @@ void __fastcall TController::OrdersClear()
|
||||
#endif
|
||||
};
|
||||
|
||||
void __fastcall TController::Activation()
|
||||
void TController::Activation()
|
||||
{ // umieszczenie obsady w odpowiednim członie, wykonywane wyłącznie gdy steruje AI
|
||||
iDirection = iDirectionOrder; // kierunek (względem sprzęgów pojazdu z AI) właśnie został
|
||||
// ustalony (zmieniony)
|
||||
@@ -1428,7 +1428,7 @@ void __fastcall TController::Activation()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TController::AutoRewident()
|
||||
void TController::AutoRewident()
|
||||
{ // autorewident: nastawianie hamulców w składzie
|
||||
int r = 0, g = 0, p = 0; // ilości wagonów poszczególnych typów
|
||||
TDynamicObject *d = pVehicles[0]; // pojazd na czele składu
|
||||
@@ -1510,7 +1510,7 @@ void __fastcall TController::AutoRewident()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TController::CheckVehicles(TOrders user)
|
||||
bool TController::CheckVehicles(TOrders user)
|
||||
{ // sprawdzenie stanu posiadanych pojazdów w składzie i zapalenie świateł
|
||||
TDynamicObject *p; // roboczy wskaźnik na pojazd
|
||||
iVehicles = 0; // ilość pojazdów w składzie
|
||||
@@ -1655,13 +1655,13 @@ bool __fastcall TController::CheckVehicles(TOrders user)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TController::Lights(int head, int rear)
|
||||
void TController::Lights(int head, int rear)
|
||||
{ // zapalenie świateł w skłądzie
|
||||
pVehicles[0]->RaLightsSet(head, -1); // zapalenie przednich w pierwszym
|
||||
pVehicles[1]->RaLightsSet(-1, rear); // zapalenie końcówek w ostatnim
|
||||
}
|
||||
|
||||
void __fastcall TController::DirectionInitial()
|
||||
void TController::DirectionInitial()
|
||||
{ // ustawienie kierunku po wczytaniu trainset (może jechać na wstecznym
|
||||
mvOccupied->CabActivisation(); // załączenie rozrządu (wirtualne kabiny)
|
||||
if (mvOccupied->Vel > 0.0)
|
||||
@@ -1673,7 +1673,7 @@ void __fastcall TController::DirectionInitial()
|
||||
CheckVehicles(); // sprawdzenie świateł oraz skrajnych pojazdów do skanowania
|
||||
};
|
||||
|
||||
int __fastcall TController::OrderDirectionChange(int newdir, TMoverParameters *Vehicle)
|
||||
int TController::OrderDirectionChange(int newdir, TMoverParameters *Vehicle)
|
||||
{ // zmiana kierunku jazdy, niezależnie od kabiny
|
||||
int testd = newdir;
|
||||
if (Vehicle->Vel < 0.5)
|
||||
@@ -1704,12 +1704,12 @@ int __fastcall TController::OrderDirectionChange(int newdir, TMoverParameters *V
|
||||
return (int)VelforDriver; // zwraca prędkość mechanika
|
||||
}
|
||||
|
||||
void __fastcall TController::WaitingSet(double Seconds)
|
||||
void TController::WaitingSet(double Seconds)
|
||||
{ // ustawienie odczekania po zatrzymaniu (ustawienie w trakcie jazdy zatrzyma)
|
||||
fStopTime = -Seconds; // ujemna wartość oznacza oczekiwanie (potem >=0.0)
|
||||
}
|
||||
|
||||
void __fastcall TController::SetVelocity(double NewVel, double NewVelNext, TStopReason r)
|
||||
void TController::SetVelocity(double NewVel, double NewVelNext, TStopReason r)
|
||||
{ // ustawienie nowej prędkości
|
||||
WaitingTime = -WaitingExpireTime; // przypisujemy -WaitingExpireTime, a potem porównujemy z
|
||||
// zerem
|
||||
@@ -1757,7 +1757,7 @@ void __fastcall TController::SetVelocity(double NewVel, double NewVelNext, TStop
|
||||
}
|
||||
|
||||
/* //funkcja do niczego nie potrzebna (ew. do przesunięcia pojazdu o odległość NewDist)
|
||||
bool __fastcall TController::SetProximityVelocity(double NewDist,double NewVelNext)
|
||||
bool TController::SetProximityVelocity(double NewDist,double NewVelNext)
|
||||
{//informacja o prędkości w pewnej odległości
|
||||
#if 0
|
||||
if (NewVelNext==0.0)
|
||||
@@ -1774,7 +1774,7 @@ bool __fastcall TController::SetProximityVelocity(double NewDist,double NewVelNe
|
||||
}
|
||||
*/
|
||||
|
||||
void __fastcall TController::SetDriverPsyche()
|
||||
void TController::SetDriverPsyche()
|
||||
{
|
||||
// double maxdist=0.5; //skalowanie dystansu od innego pojazdu, zmienic to!!!
|
||||
if ((Psyche == Aggressive) && (OrderList[OrderPos] == Obey_train))
|
||||
@@ -1857,7 +1857,7 @@ void __fastcall TController::SetDriverPsyche()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TController::PrepareEngine()
|
||||
bool TController::PrepareEngine()
|
||||
{ // odpalanie silnika
|
||||
bool OK;
|
||||
bool voltfront, voltrear;
|
||||
@@ -2017,7 +2017,7 @@ bool __fastcall TController::PrepareEngine()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TController::ReleaseEngine()
|
||||
bool TController::ReleaseEngine()
|
||||
{ // wyłączanie silnika (test wyłączenia, a część wykonawcza tylko jeśli steruje komputer)
|
||||
bool OK = false;
|
||||
LastReactionTime = 0.0;
|
||||
@@ -2077,7 +2077,7 @@ bool __fastcall TController::ReleaseEngine()
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool __fastcall TController::IncBrake()
|
||||
bool TController::IncBrake()
|
||||
{ // zwiększenie hamowania
|
||||
bool OK = false;
|
||||
switch (mvOccupied->BrakeSystem)
|
||||
@@ -2146,7 +2146,7 @@ bool __fastcall TController::IncBrake()
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool __fastcall TController::DecBrake()
|
||||
bool TController::DecBrake()
|
||||
{ // zmniejszenie siły hamowania
|
||||
bool OK = false;
|
||||
switch (mvOccupied->BrakeSystem)
|
||||
@@ -2179,7 +2179,7 @@ bool __fastcall TController::DecBrake()
|
||||
return OK;
|
||||
};
|
||||
|
||||
bool __fastcall TController::IncSpeed()
|
||||
bool TController::IncSpeed()
|
||||
{ // zwiększenie prędkości; zwraca false, jeśli dalej się nie da zwiększać
|
||||
if (tsGuardSignal) // jeśli jest dźwięk kierownika
|
||||
if (tsGuardSignal->GetStatus() & DSBSTATUS_PLAYING) // jeśli gada, to nie jedziemy
|
||||
@@ -2297,7 +2297,7 @@ bool __fastcall TController::IncSpeed()
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool __fastcall TController::DecSpeed(bool force)
|
||||
bool TController::DecSpeed(bool force)
|
||||
{ // zmniejszenie prędkości (ale nie hamowanie)
|
||||
bool OK = false; // domyślnie false, aby wyszło z pętli while
|
||||
switch (mvOccupied->EngineType)
|
||||
@@ -2346,7 +2346,7 @@ bool __fastcall TController::DecSpeed(bool force)
|
||||
return OK;
|
||||
};
|
||||
|
||||
void __fastcall TController::SpeedSet()
|
||||
void TController::SpeedSet()
|
||||
{ // Ra: regulacja prędkości, wykonywana w każdym przebłysku świadomości AI
|
||||
// ma dokręcać do bezoporowych i zdejmować pozycje w przypadku przekroczenia prądu
|
||||
switch (mvOccupied->EngineType)
|
||||
@@ -2515,7 +2515,7 @@ void __fastcall TController::SpeedSet()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TController::Doors(bool what)
|
||||
void TController::Doors(bool what)
|
||||
{ // otwieranie/zamykanie drzwi w składzie albo (tylko AI) EZT
|
||||
if (what)
|
||||
{ // otwarcie
|
||||
@@ -2552,14 +2552,14 @@ void __fastcall TController::Doors(bool what)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TController::RecognizeCommand()
|
||||
void TController::RecognizeCommand()
|
||||
{ // odczytuje i wykonuje komendę przekazaną lokomotywie
|
||||
TCommand *c = &mvOccupied->CommandIn;
|
||||
PutCommand(c->Command, c->Value1, c->Value2, c->Location, stopComm);
|
||||
c->Command = ""; // usunięcie obsłużonej komendy
|
||||
}
|
||||
|
||||
void __fastcall TController::PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
void TController::PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
const TLocation &NewLocation, TStopReason reason)
|
||||
{ // wysłanie komendy przez event PutValues, jak pojazd ma obsadę, to wysyła tutaj, a nie do pojazdu
|
||||
// bezpośrednio
|
||||
@@ -2571,7 +2571,7 @@ void __fastcall TController::PutCommand(AnsiString NewCommand, double NewValue1,
|
||||
mvOccupied->PutCommand(NewCommand, NewValue1, NewValue2, NewLocation);
|
||||
}
|
||||
|
||||
bool __fastcall TController::PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
bool TController::PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
const vector3 *NewLocation, TStopReason reason)
|
||||
{ // analiza komendy
|
||||
if (NewCommand == "CabSignal")
|
||||
@@ -2955,7 +2955,7 @@ bool __fastcall TController::PutCommand(AnsiString NewCommand, double NewValue1,
|
||||
return true; // komenda została przetworzona
|
||||
};
|
||||
|
||||
void __fastcall TController::PhysicsLog()
|
||||
void TController::PhysicsLog()
|
||||
{ // zapis logu - na razie tylko wypisanie parametrów
|
||||
if (LogFile.is_open())
|
||||
{
|
||||
@@ -2987,7 +2987,7 @@ void __fastcall TController::PhysicsLog()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TController::UpdateSituation(double dt)
|
||||
bool TController::UpdateSituation(double dt)
|
||||
{ // uruchamiać przynajmniej raz na sekundę
|
||||
if ((iDrivigFlags & movePrimary) == 0)
|
||||
return true; // pasywny nic nie robi
|
||||
@@ -4450,7 +4450,7 @@ bool __fastcall TController::UpdateSituation(double dt)
|
||||
return false; // AI nie obsługuje
|
||||
}
|
||||
|
||||
void __fastcall TController::JumpToNextOrder()
|
||||
void TController::JumpToNextOrder()
|
||||
{ // wykonanie kolejnej komendy z tablicy rozkazów
|
||||
if (OrderList[OrderPos] != Wait_for_orders)
|
||||
{
|
||||
@@ -4475,7 +4475,7 @@ void __fastcall TController::JumpToNextOrder()
|
||||
#endif
|
||||
};
|
||||
|
||||
void __fastcall TController::JumpToFirstOrder()
|
||||
void TController::JumpToFirstOrder()
|
||||
{ // taki relikt
|
||||
OrderPos = 1;
|
||||
if (OrderTop == 0)
|
||||
@@ -4487,7 +4487,7 @@ void __fastcall TController::JumpToFirstOrder()
|
||||
#endif
|
||||
};
|
||||
|
||||
void __fastcall TController::OrderCheck()
|
||||
void TController::OrderCheck()
|
||||
{ // reakcja na zmianę rozkazu
|
||||
if (OrderList[OrderPos] & (Shunt | Connect | Obey_train))
|
||||
CheckVehicles(); // sprawdzić światła
|
||||
@@ -4503,7 +4503,7 @@ void __fastcall TController::OrderCheck()
|
||||
OrdersClear(); // czyszczenie rozkazów i przeskok do zerowej pozycji
|
||||
}
|
||||
|
||||
void __fastcall TController::OrderNext(TOrders NewOrder)
|
||||
void TController::OrderNext(TOrders NewOrder)
|
||||
{ // ustawienie rozkazu do wykonania jako następny
|
||||
if (OrderList[OrderPos] == NewOrder)
|
||||
return; // jeśli robi to, co trzeba, to koniec
|
||||
@@ -4529,7 +4529,7 @@ void __fastcall TController::OrderNext(TOrders NewOrder)
|
||||
#endif
|
||||
}
|
||||
|
||||
void __fastcall TController::OrderPush(TOrders NewOrder)
|
||||
void TController::OrderPush(TOrders NewOrder)
|
||||
{ // zapisanie na stosie kolejnego rozkazu do wykonania
|
||||
if (OrderPos == OrderTop) // jeśli miałby być zapis na aktalnej pozycji
|
||||
if (OrderList[OrderPos] < Shunt) // ale nie jedzie
|
||||
@@ -4545,7 +4545,7 @@ void __fastcall TController::OrderPush(TOrders NewOrder)
|
||||
#endif
|
||||
}
|
||||
|
||||
void __fastcall TController::OrdersDump()
|
||||
void TController::OrdersDump()
|
||||
{ // wypisanie kolejnych rozkazów do logu
|
||||
WriteLog("Orders for " + pVehicle->asName + ":");
|
||||
for (int b = 0; b < maxorders; ++b)
|
||||
@@ -4557,11 +4557,11 @@ void __fastcall TController::OrdersDump()
|
||||
}
|
||||
};
|
||||
|
||||
TOrders __fastcall TController::OrderCurrentGet() { return OrderList[OrderPos]; }
|
||||
TOrders TController::OrderCurrentGet() { return OrderList[OrderPos]; }
|
||||
|
||||
TOrders __fastcall TController::OrderNextGet() { return OrderList[OrderPos + 1]; }
|
||||
TOrders TController::OrderNextGet() { return OrderList[OrderPos + 1]; }
|
||||
|
||||
void __fastcall TController::OrdersInit(double fVel)
|
||||
void TController::OrdersInit(double fVel)
|
||||
{ // wypełnianie tabelki rozkazów na podstawie rozkładu
|
||||
// ustawienie kolejności komend, niezależnie kto prowadzi
|
||||
// Mechanik->OrderPush(Wait_for_orders); //czekanie na lepsze czasy
|
||||
@@ -4653,7 +4653,7 @@ void __fastcall TController::OrdersInit(double fVel)
|
||||
// Ale mozna by je zapodac ze scenerii
|
||||
};
|
||||
|
||||
AnsiString __fastcall TController::StopReasonText()
|
||||
AnsiString TController::StopReasonText()
|
||||
{ // informacja tekstowa o przyczynie zatrzymania
|
||||
if (eStopReason != 7) // zawalidroga będzie inaczej
|
||||
return StopReasonTable[eStopReason];
|
||||
@@ -4669,14 +4669,14 @@ AnsiString __fastcall TController::StopReasonText()
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/* //nie używane
|
||||
double __fastcall TController::Distance(vector3 &p1,vector3 &n,vector3 &p2)
|
||||
double TController::Distance(vector3 &p1,vector3 &n,vector3 &p2)
|
||||
{//Ra:obliczenie odległości punktu (p1) od płaszczyzny o wektorze normalnym (n) przechodzącej przez
|
||||
(p2)
|
||||
return n.x*(p1.x-p2.x)+n.y*(p1.y-p2.y)+n.z*(p1.z-p2.z); //ax1+by1+cz1+d, gdzie d=-(ax2+by2+cz2)
|
||||
};
|
||||
*/
|
||||
|
||||
bool __fastcall TController::BackwardTrackBusy(TTrack *Track)
|
||||
bool TController::BackwardTrackBusy(TTrack *Track)
|
||||
{ // najpierw sprawdzamy, czy na danym torze są pojazdy z innego składu
|
||||
if (Track->iNumDynamics)
|
||||
{ // jeśli tylko z własnego składu, to tor jest wolny
|
||||
@@ -4767,7 +4767,7 @@ TTrack *__fastcall TController::BackwardTraceRoute(double &fDistance, double &fD
|
||||
}
|
||||
|
||||
// sprawdzanie zdarzeń semaforów i ograniczeń szlakowych
|
||||
void __fastcall TController::SetProximityVelocity(double dist, double vel, const vector3 *pos)
|
||||
void TController::SetProximityVelocity(double dist, double vel, const vector3 *pos)
|
||||
{ // Ra:przeslanie do AI prędkości
|
||||
/*
|
||||
//!!!! zastąpić prawidłową reakcją AI na SetProximityVelocity !!!!
|
||||
@@ -4789,7 +4789,7 @@ void __fastcall TController::SetProximityVelocity(double dist, double vel, const
|
||||
*/
|
||||
}
|
||||
|
||||
TCommandType __fastcall TController::BackwardScan()
|
||||
TCommandType TController::BackwardScan()
|
||||
{ // sprawdzanie zdarzeń semaforów z tyłu pojazdu, zwraca komendę
|
||||
// dzięki temu będzie można stawać za wskazanym sygnalizatorem, a zwłaszcza jeśli będzie jazda
|
||||
// na kozioł
|
||||
@@ -4956,7 +4956,7 @@ TCommandType __fastcall TController::BackwardScan()
|
||||
return cm_Unknown; // nic
|
||||
};
|
||||
|
||||
AnsiString __fastcall TController::NextStop()
|
||||
AnsiString TController::NextStop()
|
||||
{ // informacja o następnym zatrzymaniu, wyświetlane pod [F1]
|
||||
if (asNextStop.Length() < 20)
|
||||
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
||||
@@ -4976,7 +4976,7 @@ AnsiString __fastcall TController::NextStop()
|
||||
|
||||
//-----------koniec skanowania semaforow
|
||||
|
||||
void __fastcall TController::TakeControl(bool yes)
|
||||
void TController::TakeControl(bool yes)
|
||||
{ // przejęcie kontroli przez AI albo oddanie
|
||||
if (AIControllFlag == yes)
|
||||
return; // już jest jak ma być
|
||||
@@ -5031,7 +5031,7 @@ void __fastcall TController::TakeControl(bool yes)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TController::DirectionForward(bool forward)
|
||||
void TController::DirectionForward(bool forward)
|
||||
{ // ustawienie jazdy do przodu dla true i do tyłu dla false (zależy od kabiny)
|
||||
while (mvControlling->MainCtrlPos) // samo zapętlenie DecSpeed() nie wystarcza
|
||||
DecSpeed(true); // wymuszenie zerowania nastawnika jazdy, inaczej się może zawiesić
|
||||
@@ -5047,17 +5047,17 @@ void __fastcall TController::DirectionForward(bool forward)
|
||||
mvControlling->IncMainCtrl(1); //żeby nie zgasł
|
||||
};
|
||||
|
||||
AnsiString __fastcall TController::Relation() { // zwraca relację pociągu return TrainParams->ShowRelation(); };
|
||||
AnsiString TController::Relation() { // zwraca relację pociągu return TrainParams->ShowRelation(); };
|
||||
|
||||
AnsiString __fastcall TController::TrainName() { // zwraca relację pociągu return TrainParams->TrainName; };
|
||||
AnsiString TController::TrainName() { // zwraca relację pociągu return TrainParams->TrainName; };
|
||||
|
||||
int __fastcall TController::StationCount() { // zwraca ilość stacji (miejsc zatrzymania) return TrainParams->StationCount; };
|
||||
int TController::StationCount() { // zwraca ilość stacji (miejsc zatrzymania) return TrainParams->StationCount; };
|
||||
|
||||
int __fastcall TController::StationIndex() { // zwraca indeks aktualnej stacji (miejsca zatrzymania) return TrainParams->StationIndex; };
|
||||
int TController::StationIndex() { // zwraca indeks aktualnej stacji (miejsca zatrzymania) return TrainParams->StationIndex; };
|
||||
|
||||
bool __fastcall TController::IsStop() { // informuje, czy jest zatrzymanie na najbliższej stacji return TrainParams->IsStop(); };
|
||||
bool TController::IsStop() { // informuje, czy jest zatrzymanie na najbliższej stacji return TrainParams->IsStop(); };
|
||||
|
||||
void __fastcall TController::MoveTo(TDynamicObject *to)
|
||||
void TController::MoveTo(TDynamicObject *to)
|
||||
{ // przesunięcie AI do innego pojazdu (przy zmianie kabiny)
|
||||
// mvOccupied->CabDeactivisation(); //wyłączenie kabiny w opuszczanym
|
||||
pVehicle->Mechanik = to->Mechanik; //żeby się zamieniły, jak jest jakieś drugie
|
||||
@@ -5067,7 +5067,7 @@ void __fastcall TController::MoveTo(TDynamicObject *to)
|
||||
// iDirection=0; //kierunek jazdy trzeba dopiero zgadnąć
|
||||
};
|
||||
|
||||
void __fastcall TController::ControllingSet()
|
||||
void TController::ControllingSet()
|
||||
{ // znajduje człon do sterowania w EZT będzie to silnikowy
|
||||
// problematyczne jest sterowanie z członu biernego, dlatego damy AI silnikowy
|
||||
// dzięki temu będzie wirtualna kabina w silnikowym, działająca w rozrządczym
|
||||
@@ -5076,7 +5076,7 @@ void __fastcall TController::ControllingSet()
|
||||
mvControlling = pVehicle->ControlledFind()->MoverParameters; // poszukiwanie członu sterowanego
|
||||
};
|
||||
|
||||
AnsiString __fastcall TController::TableText(int i)
|
||||
AnsiString TController::TableText(int i)
|
||||
{ // pozycja tabelki prędkości
|
||||
i = (iFirst + i) % iSpeedTableSize; // numer pozycji
|
||||
if (i != iLast) // w (iLast) znajduje się kolejny tor do przeskanowania, ale nie jest ona
|
||||
@@ -5085,7 +5085,7 @@ AnsiString __fastcall TController::TableText(int i)
|
||||
return ""; // wskaźnik końca
|
||||
};
|
||||
|
||||
int __fastcall TController::CrossRoute(TTrack *tr)
|
||||
int TController::CrossRoute(TTrack *tr)
|
||||
{ // zwraca numer segmentu dla skrzyżowania (tr)
|
||||
// pożądany numer segmentu jest określany podczas skanowania drogi
|
||||
// droga powinna być określona sposobem przejazdu przez skrzyżowania albo współrzędnymi miejsca
|
||||
@@ -5101,7 +5101,7 @@ int __fastcall TController::CrossRoute(TTrack *tr)
|
||||
return 0; // nic nie znaleziono?
|
||||
};
|
||||
|
||||
void __fastcall TController::RouteSwitch(int d)
|
||||
void TController::RouteSwitch(int d)
|
||||
{ // ustawienie kierunku jazdy z kabiny
|
||||
d &= 3;
|
||||
if (d)
|
||||
@@ -5126,7 +5126,7 @@ void __fastcall TController::RouteSwitch(int d)
|
||||
}
|
||||
}
|
||||
};
|
||||
AnsiString __fastcall TController::OwnerName()
|
||||
AnsiString TController::OwnerName()
|
||||
{
|
||||
return pVehicle ? pVehicle->MoverParameters->Name : AnsiString("none");
|
||||
};
|
||||
|
||||
146
Driver.h
146
Driver.h
@@ -102,14 +102,14 @@ class TSpeedPos
|
||||
TTrack *trTrack; // wskaźnik na tor o zmiennej prędkości (zwrotnica, obrotnica)
|
||||
TEvent *evEvent; // połączenie z eventem albo komórką pamięci
|
||||
};
|
||||
void __fastcall CommandCheck();
|
||||
void CommandCheck();
|
||||
|
||||
public:
|
||||
void __fastcall Clear();
|
||||
bool __fastcall Update(vector3 *p, vector3 *dir, double &len);
|
||||
bool __fastcall Set(TEvent *e, double d);
|
||||
void __fastcall Set(TTrack *t, double d, int f);
|
||||
AnsiString __fastcall TableText();
|
||||
void Clear();
|
||||
bool Update(vector3 *p, vector3 *dir, double &len);
|
||||
bool Set(TEvent *e, double d);
|
||||
void Set(TTrack *t, double d, int f);
|
||||
AnsiString TableText();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -247,102 +247,102 @@ class TController
|
||||
double WaitingExpireTime; // maksymlany czas oczekiwania do samoistnego ruszenia
|
||||
// TEvent* eSignLast; //ostatnio znaleziony sygnał, o ile nie minięty
|
||||
private: //---//---//---//---// koniec zmiennych, poniżej metody //---//---//---//---//
|
||||
void __fastcall SetDriverPsyche();
|
||||
bool __fastcall PrepareEngine();
|
||||
bool __fastcall ReleaseEngine();
|
||||
bool __fastcall IncBrake();
|
||||
bool __fastcall DecBrake();
|
||||
bool __fastcall IncSpeed();
|
||||
bool __fastcall DecSpeed(bool force = false);
|
||||
void __fastcall SpeedSet();
|
||||
void __fastcall Doors(bool what);
|
||||
void __fastcall RecognizeCommand(); // odczytuje komende przekazana lokomotywie
|
||||
void __fastcall Activation(); // umieszczenie obsady w odpowiednim członie
|
||||
void __fastcall ControllingSet(); // znajduje człon do sterowania
|
||||
void __fastcall AutoRewident(); // ustawia hamulce w składzie
|
||||
void SetDriverPsyche();
|
||||
bool PrepareEngine();
|
||||
bool ReleaseEngine();
|
||||
bool IncBrake();
|
||||
bool DecBrake();
|
||||
bool IncSpeed();
|
||||
bool DecSpeed(bool force = false);
|
||||
void SpeedSet();
|
||||
void Doors(bool what);
|
||||
void RecognizeCommand(); // odczytuje komende przekazana lokomotywie
|
||||
void Activation(); // umieszczenie obsady w odpowiednim członie
|
||||
void ControllingSet(); // znajduje człon do sterowania
|
||||
void AutoRewident(); // ustawia hamulce w składzie
|
||||
public:
|
||||
Mtable::TTrainParameters *__fastcall Timetable() { return TrainParams; };
|
||||
void __fastcall PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
void PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
const _mover::TLocation &NewLocation, TStopReason reason = stopComm);
|
||||
bool __fastcall PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
bool PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
const vector3 *NewLocation, TStopReason reason = stopComm);
|
||||
bool __fastcall UpdateSituation(double dt); // uruchamiac przynajmniej raz na sekundę
|
||||
bool UpdateSituation(double dt); // uruchamiac przynajmniej raz na sekundę
|
||||
// procedury dotyczace rozkazow dla maszynisty
|
||||
void __fastcall SetVelocity(double NewVel, double NewVelNext,
|
||||
void SetVelocity(double NewVel, double NewVelNext,
|
||||
TStopReason r = stopNone); // uaktualnia informacje o prędkości
|
||||
bool __fastcall SetProximityVelocity(
|
||||
bool SetProximityVelocity(
|
||||
double NewDist,
|
||||
double NewVelNext); // uaktualnia informacje o prędkości przy nastepnym semaforze
|
||||
public:
|
||||
void __fastcall JumpToNextOrder();
|
||||
void __fastcall JumpToFirstOrder();
|
||||
void __fastcall OrderPush(TOrders NewOrder);
|
||||
void __fastcall OrderNext(TOrders NewOrder);
|
||||
TOrders __fastcall OrderCurrentGet();
|
||||
TOrders __fastcall OrderNextGet();
|
||||
bool __fastcall CheckVehicles(TOrders user = Wait_for_orders);
|
||||
void JumpToNextOrder();
|
||||
void JumpToFirstOrder();
|
||||
void OrderPush(TOrders NewOrder);
|
||||
void OrderNext(TOrders NewOrder);
|
||||
TOrders OrderCurrentGet();
|
||||
TOrders OrderNextGet();
|
||||
bool CheckVehicles(TOrders user = Wait_for_orders);
|
||||
|
||||
private:
|
||||
void __fastcall CloseLog();
|
||||
void __fastcall OrderCheck();
|
||||
void CloseLog();
|
||||
void OrderCheck();
|
||||
|
||||
public:
|
||||
void __fastcall OrdersInit(double fVel);
|
||||
void __fastcall OrdersClear();
|
||||
void __fastcall OrdersDump();
|
||||
__fastcall TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
void OrdersInit(double fVel);
|
||||
void OrdersClear();
|
||||
void OrdersDump();
|
||||
TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
bool primary = true // czy ma aktywnie prowadzić?
|
||||
);
|
||||
AnsiString __fastcall OrderCurrent();
|
||||
void __fastcall WaitingSet(double Seconds);
|
||||
AnsiString OrderCurrent();
|
||||
void WaitingSet(double Seconds);
|
||||
|
||||
private:
|
||||
AnsiString __fastcall Order2Str(TOrders Order);
|
||||
void __fastcall DirectionForward(bool forward);
|
||||
int __fastcall OrderDirectionChange(int newdir, TMoverParameters *Vehicle);
|
||||
void __fastcall Lights(int head, int rear);
|
||||
double __fastcall Distance(vector3 &p1, vector3 &n, vector3 &p2);
|
||||
AnsiString Order2Str(TOrders Order);
|
||||
void DirectionForward(bool forward);
|
||||
int OrderDirectionChange(int newdir, TMoverParameters *Vehicle);
|
||||
void Lights(int head, int rear);
|
||||
double Distance(vector3 &p1, vector3 &n, vector3 &p2);
|
||||
|
||||
private: // Ra: metody obsługujące skanowanie toru
|
||||
TEvent *__fastcall CheckTrackEvent(double fDirection, TTrack *Track);
|
||||
bool __fastcall TableCheckEvent(TEvent *e);
|
||||
bool __fastcall TableAddNew();
|
||||
bool __fastcall TableNotFound(TEvent *e);
|
||||
void __fastcall TableClear();
|
||||
bool TableCheckEvent(TEvent *e);
|
||||
bool TableAddNew();
|
||||
bool TableNotFound(TEvent *e);
|
||||
void TableClear();
|
||||
TEvent *__fastcall TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||
void __fastcall TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||
void __fastcall TableCheck(double fDistance);
|
||||
TCommandType __fastcall TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||
void TableCheck(double fDistance);
|
||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
double &fAcc);
|
||||
void __fastcall TablePurger();
|
||||
void TablePurger();
|
||||
|
||||
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||
bool __fastcall BackwardTrackBusy(TTrack *Track);
|
||||
bool BackwardTrackBusy(TTrack *Track);
|
||||
TEvent *__fastcall CheckTrackEventBackward(double fDirection, TTrack *Track);
|
||||
TTrack *__fastcall BackwardTraceRoute(double &fDistance, double &fDirection, TTrack *Track,
|
||||
TEvent *&Event);
|
||||
void __fastcall SetProximityVelocity(double dist, double vel, const vector3 *pos);
|
||||
TCommandType __fastcall BackwardScan();
|
||||
void SetProximityVelocity(double dist, double vel, const vector3 *pos);
|
||||
TCommandType BackwardScan();
|
||||
|
||||
public:
|
||||
void __fastcall PhysicsLog();
|
||||
AnsiString __fastcall StopReasonText();
|
||||
__fastcall ~TController();
|
||||
AnsiString __fastcall NextStop();
|
||||
void __fastcall TakeControl(bool yes);
|
||||
AnsiString __fastcall Relation();
|
||||
AnsiString __fastcall TrainName();
|
||||
int __fastcall StationCount();
|
||||
int __fastcall StationIndex();
|
||||
bool __fastcall IsStop();
|
||||
bool __fastcall Primary() { return this ? bool(iDrivigFlags & movePrimary) : false; };
|
||||
int inline __fastcall DrivigFlags() { return iDrivigFlags; };
|
||||
void __fastcall MoveTo(TDynamicObject *to);
|
||||
void __fastcall DirectionInitial();
|
||||
AnsiString __fastcall TableText(int i);
|
||||
int __fastcall CrossRoute(TTrack *tr);
|
||||
void __fastcall RouteSwitch(int d);
|
||||
AnsiString __fastcall OwnerName();
|
||||
void PhysicsLog();
|
||||
AnsiString StopReasonText();
|
||||
~TController();
|
||||
AnsiString NextStop();
|
||||
void TakeControl(bool yes);
|
||||
AnsiString Relation();
|
||||
AnsiString TrainName();
|
||||
int StationCount();
|
||||
int StationIndex();
|
||||
bool IsStop();
|
||||
bool Primary() { return this ? bool(iDrivigFlags & movePrimary) : false; };
|
||||
int inline DrivigFlags() { return iDrivigFlags; };
|
||||
void MoveTo(TDynamicObject *to);
|
||||
void DirectionInitial();
|
||||
AnsiString TableText(int i);
|
||||
int CrossRoute(TTrack *tr);
|
||||
void RouteSwitch(int d);
|
||||
AnsiString OwnerName();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
78
DynObj.cpp
78
DynObj.cpp
@@ -41,7 +41,7 @@
|
||||
const float maxrot = (M_PI / 3.0); // 60°
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAnimPant::AKP_4E()
|
||||
void TAnimPant::AKP_4E()
|
||||
{ // ustawienie wymiarów dla pantografu AKP-4E
|
||||
vPos = vector3(0, 0, 0); // przypisanie domyśnych współczynników do pantografów
|
||||
fLenL1 = 1.22; // 1.176289 w modelach
|
||||
@@ -68,7 +68,7 @@ void __fastcall TAnimPant::AKP_4E()
|
||||
fHeightExtra[4] = -0.15; //+0.3810
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TAnim::TypeSet(int i, int fl)
|
||||
int TAnim::TypeSet(int i, int fl)
|
||||
{ // ustawienie typu animacji i zależnej od niego ilości animowanych submodeli
|
||||
fMaxDist = -1.0; // normalnie nie pokazywać
|
||||
switch (i)
|
||||
@@ -124,7 +124,7 @@ __fastcall TAnim::~TAnim()
|
||||
break;
|
||||
}
|
||||
};
|
||||
void __fastcall 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)
|
||||
@@ -164,7 +164,7 @@ TDynamicObject *__fastcall TDynamicObject::FirstFind(int &coupler_nr)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
float __fastcall TDynamicObject::GetEPP()
|
||||
float TDynamicObject::GetEPP()
|
||||
{ // szukanie skrajnego połączonego pojazdu w pociagu
|
||||
// od strony sprzegu (coupler_nr) obiektu (start)
|
||||
TDynamicObject *temp = this;
|
||||
@@ -250,7 +250,7 @@ TDynamicObject *__fastcall TDynamicObject::GetFirstDynamic(int cpl_type)
|
||||
};
|
||||
|
||||
/*
|
||||
TDynamicObject* __fastcall TDynamicObject::GetFirstCabDynamic(int cpl_type)
|
||||
TDynamicObject* TDynamicObject::GetFirstCabDynamic(int cpl_type)
|
||||
{//ZiomalCl: szukanie skrajnego obiektu z kabiną
|
||||
TDynamicObject* temp=this;
|
||||
int coupler_nr=cpl_type;
|
||||
@@ -283,7 +283,7 @@ TDynamicObject* __fastcall TDynamicObject::GetFirstCabDynamic(int cpl_type)
|
||||
|
||||
void TDynamicObject::ABuSetModelShake(vector3 mShake) { modelShake = mShake; };
|
||||
|
||||
int __fastcall TDynamicObject::GetPneumatic(bool front, bool red)
|
||||
int TDynamicObject::GetPneumatic(bool front, bool red)
|
||||
{
|
||||
int x, y, z; // 1=prosty, 2=skośny
|
||||
if (red)
|
||||
@@ -320,7 +320,7 @@ int __fastcall TDynamicObject::GetPneumatic(bool front, bool red)
|
||||
return z;
|
||||
}
|
||||
|
||||
void __fastcall TDynamicObject::SetPneumatic(bool front, bool red)
|
||||
void TDynamicObject::SetPneumatic(bool front, bool red)
|
||||
{
|
||||
int x = 0, ten, tamten;
|
||||
ten = GetPneumatic(front, red); // 1=lewy skos,2=prawy skos,3=dwa proste
|
||||
@@ -883,7 +883,7 @@ void __inline TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
}
|
||||
// ABu 29.01.05 koniec przeklejenia *************************************
|
||||
|
||||
double __fastcall ABuAcos(const vector3 &calc_temp)
|
||||
double ABuAcos(const vector3 &calc_temp)
|
||||
{ // Odpowiednik funkcji Arccos, bo cos mi tam nie dzialalo.
|
||||
return atan2(-calc_temp.x, calc_temp.z); // Ra: tak prościej
|
||||
}
|
||||
@@ -1006,14 +1006,14 @@ TDynamicObject *__fastcall TDynamicObject::ABuScanNearestObject(TTrack *Track, d
|
||||
}
|
||||
|
||||
// ABu 01.11.04 poczatek wyliczania przechylow pudla **********************
|
||||
void __fastcall TDynamicObject::ABuModelRoll()
|
||||
void TDynamicObject::ABuModelRoll()
|
||||
{ // ustawienie przechyłki pojazdu i jego zawartości
|
||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||
}
|
||||
|
||||
// ABu 06.05.04 poczatek wyliczania obrotow wozkow **********************
|
||||
|
||||
void __fastcall TDynamicObject::ABuBogies()
|
||||
void TDynamicObject::ABuBogies()
|
||||
{ // Obracanie wozkow na zakretach. Na razie uwzględnia tylko zakręty,
|
||||
// bez zadnych gorek i innych przeszkod.
|
||||
if ((smBogie[0] != NULL) && (smBogie[1] != NULL))
|
||||
@@ -1032,7 +1032,7 @@ void __fastcall TDynamicObject::ABuBogies()
|
||||
// ABu 06.05.04 koniec wyliczania obrotow wozkow ************************
|
||||
|
||||
// ABu 16.03.03 sledzenie toru przed obiektem: **************************
|
||||
void __fastcall TDynamicObject::ABuCheckMyTrack()
|
||||
void TDynamicObject::ABuCheckMyTrack()
|
||||
{ // Funkcja przypisujaca obiekt prawidlowej tablicy Dynamics,
|
||||
// bo gdzies jest jakis blad i wszystkie obiekty z danego
|
||||
// pociagu na poczatku stawiane sa na jednym torze i wpisywane
|
||||
@@ -1557,7 +1557,7 @@ __fastcall TDynamicObject::~TDynamicObject()
|
||||
delete[] pAnimated; // lista animowanych submodeli
|
||||
}
|
||||
|
||||
double __fastcall TDynamicObject::Init(
|
||||
double TDynamicObject::Init(
|
||||
AnsiString Name, // nazwa pojazdu, np. "EU07-424"
|
||||
AnsiString BaseDir, // z którego katalogu wczytany, np. "PKP/EU07"
|
||||
AnsiString asReplacableSkin, // nazwa wymiennej tekstury
|
||||
@@ -1975,12 +1975,12 @@ double __fastcall TDynamicObject::Init(
|
||||
return MoverParameters->Dim.L; // długość większa od zera oznacza OK; 2mm docisku?
|
||||
}
|
||||
|
||||
void __fastcall TDynamicObject::FastMove(double fDistance)
|
||||
void TDynamicObject::FastMove(double fDistance)
|
||||
{
|
||||
MoverParameters->dMoveLen = MoverParameters->dMoveLen + fDistance;
|
||||
}
|
||||
|
||||
void __fastcall TDynamicObject::Move(double fDistance)
|
||||
void TDynamicObject::Move(double fDistance)
|
||||
{ // przesuwanie pojazdu po trajektorii polega na przesuwaniu poszczególnych osi
|
||||
// Ra: wartość prędkości 2km/h ma ograniczyć aktywację eventów w przypadku drgań
|
||||
if (Axle0.GetTrack() == Axle1.GetTrack()) // przed przesunięciem
|
||||
@@ -2112,7 +2112,7 @@ void __fastcall TDynamicObject::Move(double fDistance)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::AttachPrev(TDynamicObject *Object, int iType)
|
||||
void TDynamicObject::AttachPrev(TDynamicObject *Object, int iType)
|
||||
{ // Ra: doczepia Object na końcu składu (nazwa funkcji może być myląca)
|
||||
// Ra: używane tylko przy wczytywaniu scenerii
|
||||
/*
|
||||
@@ -2173,7 +2173,7 @@ void __fastcall TDynamicObject::AttachPrev(TDynamicObject *Object, int iType)
|
||||
// SetPneumatic(0,0);
|
||||
}
|
||||
|
||||
bool __fastcall TDynamicObject::UpdateForce(double dt, double dt1, bool FullVer)
|
||||
bool TDynamicObject::UpdateForce(double dt, double dt1, bool FullVer)
|
||||
{
|
||||
if (!bEnabled)
|
||||
return false;
|
||||
@@ -2183,7 +2183,7 @@ bool __fastcall TDynamicObject::UpdateForce(double dt, double dt1, bool FullVer)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TDynamicObject::LoadUpdate()
|
||||
void TDynamicObject::LoadUpdate()
|
||||
{ // przeładowanie modelu ładunku
|
||||
// Ra: nie próbujemy wczytywać modeli miliony razy podczas renderowania!!!
|
||||
if ((mdLoad == NULL) && (MoverParameters->Load > 0))
|
||||
@@ -2209,7 +2209,7 @@ void __fastcall TDynamicObject::LoadUpdate()
|
||||
};
|
||||
|
||||
/*
|
||||
double __fastcall ComputeRadius(double p1x, double p1z, double p2x, double p2z,
|
||||
double ComputeRadius(double p1x, double p1z, double p2x, double p2z,
|
||||
double p3x, double p3z, double p4x, double p4z)
|
||||
{
|
||||
|
||||
@@ -2227,7 +2227,7 @@ double __fastcall ComputeRadius(double p1x, double p1z, double p2x, double p2z,
|
||||
double x= (-B2*y-C2)/A2;
|
||||
}
|
||||
*/
|
||||
double __fastcall TDynamicObject::ComputeRadius(vector3 p1, vector3 p2, vector3 p3, vector3 p4)
|
||||
double TDynamicObject::ComputeRadius(vector3 p1, vector3 p2, vector3 p3, vector3 p4)
|
||||
{
|
||||
// vector3 v1
|
||||
|
||||
@@ -2257,7 +2257,7 @@ double __fastcall TDynamicObject::ComputeRadius(vector3 p1, vector3 p2, vector3
|
||||
}
|
||||
|
||||
/*
|
||||
double __fastcall TDynamicObject::ComputeRadius()
|
||||
double TDynamicObject::ComputeRadius()
|
||||
{
|
||||
double L=0;
|
||||
double d=0;
|
||||
@@ -2280,7 +2280,7 @@ double __fastcall TDynamicObject::ComputeRadius()
|
||||
*/
|
||||
|
||||
/* Ra: na razie nie potrzebne
|
||||
void __fastcall TDynamicObject::UpdatePos()
|
||||
void TDynamicObject::UpdatePos()
|
||||
{
|
||||
MoverParameters->Loc.X= -vPosition.x;
|
||||
MoverParameters->Loc.Y= vPosition.z;
|
||||
@@ -2299,7 +2299,7 @@ na sprz
|
||||
histerezę czasową, aby te tryby pracy nie przełączały się zbyt szybko.
|
||||
*/
|
||||
|
||||
bool __fastcall TDynamicObject::Update(double dt, double dt1)
|
||||
bool TDynamicObject::Update(double dt, double dt1)
|
||||
{
|
||||
if (dt == 0)
|
||||
return true; // Ra: pauza
|
||||
@@ -3029,7 +3029,7 @@ bool __fastcall TDynamicObject::Update(double dt, double dt1)
|
||||
return true; // Ra: chyba tak?
|
||||
}
|
||||
|
||||
bool __fastcall TDynamicObject::FastUpdate(double dt)
|
||||
bool TDynamicObject::FastUpdate(double dt)
|
||||
{
|
||||
if (dt == 0.0)
|
||||
return true; // Ra: pauza
|
||||
@@ -3069,12 +3069,12 @@ bool __fastcall TDynamicObject::FastUpdate(double dt)
|
||||
}
|
||||
|
||||
// McZapkie-040402: liczenie pozycji uwzgledniajac wysokosc szyn itp.
|
||||
// vector3 __fastcall TDynamicObject::GetPosition()
|
||||
// vector3 TDynamicObject::GetPosition()
|
||||
//{//Ra: pozycja pojazdu jest liczona zaraz po przesunięciu
|
||||
// return vPosition;
|
||||
//};
|
||||
|
||||
void __fastcall TDynamicObject::TurnOff()
|
||||
void TDynamicObject::TurnOff()
|
||||
{ // wyłączenie rysowania submodeli zmiennych dla egemplarza pojazdu
|
||||
btnOn = false;
|
||||
btCoupler1.TurnOff();
|
||||
@@ -3107,7 +3107,7 @@ void __fastcall TDynamicObject::TurnOff()
|
||||
btHeadSignals23.TurnOff();
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::Render()
|
||||
void TDynamicObject::Render()
|
||||
{ // rysowanie elementów nieprzezroczystych
|
||||
// youBy - sprawdzamy, czy jest sens renderowac
|
||||
double modelrotate;
|
||||
@@ -3278,7 +3278,7 @@ void __fastcall TDynamicObject::Render()
|
||||
} // yB - koniec mieszania z grafika
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::RenderSounds()
|
||||
void TDynamicObject::RenderSounds()
|
||||
{ // przeliczanie dźwięków, bo będzie słychać bez wyświetlania sektora z pojazdem
|
||||
// McZapkie-010302: ulepszony dzwiek silnika
|
||||
double freq;
|
||||
@@ -3618,7 +3618,7 @@ void __fastcall TDynamicObject::RenderSounds()
|
||||
*/
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::RenderAlpha()
|
||||
void TDynamicObject::RenderAlpha()
|
||||
{ // rysowanie elementów półprzezroczystych
|
||||
if (renderme)
|
||||
{
|
||||
@@ -3744,7 +3744,7 @@ void __fastcall TDynamicObject::RenderAlpha()
|
||||
|
||||
// McZapkie-250202
|
||||
// wczytywanie pliku z danymi multimedialnymi (dzwieki)
|
||||
void __fastcall TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
AnsiString ReplacableSkin)
|
||||
{
|
||||
double dSDist;
|
||||
@@ -4755,7 +4755,7 @@ void __fastcall TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString Ty
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TDynamicObject::RadioStop()
|
||||
void TDynamicObject::RadioStop()
|
||||
{ // zatrzymanie pojazdu
|
||||
if (Mechanik) // o ile ktoś go prowadzi
|
||||
if (MoverParameters->SecuritySystem.RadioStop) // jeśli pojazd ma RadioStop i jest on
|
||||
@@ -4763,7 +4763,7 @@ void __fastcall TDynamicObject::RadioStop()
|
||||
Mechanik->PutCommand("Emergency_brake", 1.0, 1.0, &vPosition, stopRadio);
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::RaLightsSet(int head, int rear)
|
||||
void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
{ // zapalenie świateł z przodu i z tyłu, zależne od kierunku pojazdu
|
||||
if (!MoverParameters)
|
||||
return; // może tego nie być na początku
|
||||
@@ -4800,7 +4800,7 @@ void __fastcall TDynamicObject::RaLightsSet(int head, int rear)
|
||||
}
|
||||
};
|
||||
|
||||
int __fastcall TDynamicObject::DirectionSet(int d)
|
||||
int TDynamicObject::DirectionSet(int d)
|
||||
{ // ustawienie kierunku w składzie (wykonuje AI)
|
||||
iDirection = d > 0 ? 1 : 0; // d:1=zgodny,-1=przeciwny; iDirection:1=zgodny,0=przeciwny;
|
||||
CouplCounter = 20; //żeby normalnie skanować kolizje, to musi ruszyć z miejsca
|
||||
@@ -4843,7 +4843,7 @@ TDynamicObject *__fastcall TDynamicObject::NextC(int C)
|
||||
return iDirection ? NextConnected : PrevConnected;
|
||||
return NULL; // gdy sprzęg inny, to jakby nic nie było
|
||||
};
|
||||
double __fastcall TDynamicObject::NextDistance(double d)
|
||||
double TDynamicObject::NextDistance(double d)
|
||||
{ // ustalenie odległości do następnego pojazdu, potrzebne do wstecznego skanowania
|
||||
if (!MoverParameters->Couplers[iDirection].Connected)
|
||||
return d; // jeśli nic nie ma, zwrócenie domyślnej wartości
|
||||
@@ -4862,7 +4862,7 @@ TDynamicObject *__fastcall TDynamicObject::Neightbour(int &dir)
|
||||
(MoverParameters->Couplers[0].CouplingFlag ? PrevConnected : NULL));
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::CoupleDist()
|
||||
void TDynamicObject::CoupleDist()
|
||||
{ // obliczenie odległości sprzęgów
|
||||
if (MyTrack ? (MyTrack->iCategoryFlag & 1) :
|
||||
true) // jeśli nie ma przypisanego toru, to liczyć jak dla kolei
|
||||
@@ -4955,7 +4955,7 @@ TDynamicObject *__fastcall TDynamicObject::ControlledFind()
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TDynamicObject::ParamSet(int what, int into)
|
||||
void TDynamicObject::ParamSet(int what, int into)
|
||||
{ // ustawienie lokalnego parametru (what) na stan (into)
|
||||
switch (what & 0xFF00)
|
||||
{
|
||||
@@ -4995,12 +4995,12 @@ void __fastcall TDynamicObject::ParamSet(int what, int into)
|
||||
}
|
||||
};
|
||||
|
||||
int __fastcall TDynamicObject::RouteWish(TTrack *tr)
|
||||
int TDynamicObject::RouteWish(TTrack *tr)
|
||||
{ // zapytanie do AI, po którym segmencie (-6..6) jechać na skrzyżowaniu (tr)
|
||||
return Mechanik ? Mechanik->CrossRoute(tr) : 0; // wg AI albo prosto
|
||||
};
|
||||
|
||||
AnsiString __fastcall TDynamicObject::TextureTest(AnsiString &name)
|
||||
AnsiString TDynamicObject::TextureTest(AnsiString &name)
|
||||
{ // Ra 2015-01: sprawdzenie dostępności tekstury o podanej nazwie
|
||||
AnsiString x = name + ".dds"; // na razie prymitywnie
|
||||
if (FileExists(x))
|
||||
@@ -5020,7 +5020,7 @@ AnsiString __fastcall TDynamicObject::TextureTest(AnsiString &name)
|
||||
return ""; // nie znaleziona
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::DestinationSet(AnsiString to)
|
||||
void TDynamicObject::DestinationSet(AnsiString to)
|
||||
{ // ustawienie stacji docelowej oraz wymiennej tekstury 4, jeśli istnieje plik
|
||||
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową
|
||||
// zwłaszcza w towarowych, pod kątem zautomatyzowania maewrów albo pracy górki
|
||||
@@ -5049,7 +5049,7 @@ void __fastcall TDynamicObject::DestinationSet(AnsiString to)
|
||||
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa tekstury nr 4
|
||||
};
|
||||
|
||||
void __fastcall TDynamicObject::OverheadTrack(float o)
|
||||
void TDynamicObject::OverheadTrack(float o)
|
||||
{ // ewentualne wymuszanie jazdy bezprądowej z powodu informacji w torze
|
||||
if (ctOwner) // jeśli ma obiekt nadzorujący
|
||||
{ // trzeba zaktualizować mapę flag bitowych jazdy bezprądowej
|
||||
|
||||
118
DynObj.h
118
DynObj.h
@@ -90,7 +90,7 @@ class TAnimPant
|
||||
float fWidthExtra; // dodatkowy rozmiar poziomy poza część roboczą (fWidth)
|
||||
float fHeightExtra[5]; //łamana symulująca kształt nabieżnika
|
||||
// double fHorizontal; //Ra 2015-01: położenie drutu względem osi pantografu
|
||||
void __fastcall AKP_4E();
|
||||
void AKP_4E();
|
||||
};
|
||||
|
||||
class TAnim
|
||||
@@ -123,11 +123,11 @@ class TAnim
|
||||
float fSpeed; // parametr szybkości animacji
|
||||
int iNumber; // numer kolejny obiektu
|
||||
public:
|
||||
__fastcall TAnim();
|
||||
__fastcall ~TAnim();
|
||||
TAnim();
|
||||
~TAnim();
|
||||
TUpdate yUpdate; // metoda TDynamicObject aktualizująca animację
|
||||
int __fastcall TypeSet(int i, int fl = 0); // ustawienie typu
|
||||
void __fastcall Parovoz(); // wykonanie obliczeń animacji
|
||||
int TypeSet(int i, int fl = 0); // ustawienie typu
|
||||
void Parovoz(); // wykonanie obliczeń animacji
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -224,7 +224,7 @@ class TDynamicObject
|
||||
void ABuLittleUpdate(double ObjSqrDist);
|
||||
bool btnOn; // ABu: czy byly uzywane buttony, jesli tak, to po renderingu wylacz
|
||||
// bo ten sam model moze byc jeszcze wykorzystany przez inny obiekt!
|
||||
double __fastcall ComputeRadius(vector3 p1, vector3 p2, vector3 p3, vector3 p4);
|
||||
double ComputeRadius(vector3 p1, vector3 p2, vector3 p3, vector3 p4);
|
||||
|
||||
TButton btCoupler1; // sprzegi
|
||||
TButton btCoupler2;
|
||||
@@ -291,8 +291,8 @@ class TDynamicObject
|
||||
double eng_frq_act;
|
||||
double eng_dfrq;
|
||||
double eng_turbo;
|
||||
void __fastcall ABuBogies();
|
||||
void __fastcall ABuModelRoll();
|
||||
void ABuBogies();
|
||||
void ABuModelRoll();
|
||||
vector3 modelShake;
|
||||
|
||||
bool renderme; // yB - czy renderowac
|
||||
@@ -302,7 +302,7 @@ class TDynamicObject
|
||||
TRealSound rsUnbrake; // yB - odglos luzowania
|
||||
float ModCamRot;
|
||||
int iInventory; // flagi bitowe posiadanych submodeli (np. świateł)
|
||||
void __fastcall TurnOff();
|
||||
void TurnOff();
|
||||
|
||||
public:
|
||||
int iHornWarning; // numer syreny do użycia po otrzymaniu sygnału do jazdy
|
||||
@@ -320,7 +320,7 @@ class TDynamicObject
|
||||
protected:
|
||||
TDynamicObject *__fastcall ABuFindObject(TTrack *Track, int ScanDir, Byte &CouplFound,
|
||||
double &dist);
|
||||
void __fastcall ABuCheckMyTrack();
|
||||
void ABuCheckMyTrack();
|
||||
|
||||
public:
|
||||
int *iLights; // wskaźnik na bity zapalonych świateł (własne albo innego członu)
|
||||
@@ -330,15 +330,15 @@ class TDynamicObject
|
||||
TDynamicObject *__fastcall Prev();
|
||||
TDynamicObject *__fastcall Next();
|
||||
TDynamicObject *__fastcall NextC(int C);
|
||||
double __fastcall NextDistance(double d = -1.0);
|
||||
void __fastcall SetdMoveLen(double dMoveLen) { MoverParameters->dMoveLen = dMoveLen; }
|
||||
void __fastcall ResetdMoveLen() { MoverParameters->dMoveLen = 0; }
|
||||
double __fastcall GetdMoveLen() { return MoverParameters->dMoveLen; }
|
||||
double NextDistance(double d = -1.0);
|
||||
void SetdMoveLen(double dMoveLen) { MoverParameters->dMoveLen = dMoveLen; }
|
||||
void ResetdMoveLen() { MoverParameters->dMoveLen = 0; }
|
||||
double GetdMoveLen() { return MoverParameters->dMoveLen; }
|
||||
|
||||
int __fastcall GetPneumatic(bool front, bool red);
|
||||
void __fastcall SetPneumatic(bool front, bool red);
|
||||
int GetPneumatic(bool front, bool red);
|
||||
void SetPneumatic(bool front, bool red);
|
||||
AnsiString asName;
|
||||
AnsiString __fastcall GetName() { return this ? asName : AnsiString(""); };
|
||||
AnsiString GetName() { return this ? asName : AnsiString(""); };
|
||||
|
||||
TRealSound rsDiesielInc; // youBy
|
||||
TRealSound rscurve; // youBy
|
||||
@@ -351,7 +351,7 @@ class TDynamicObject
|
||||
TDynamicObject *__fastcall ABuScanNearestObject(TTrack *Track, double ScanDir, double ScanDist,
|
||||
int &CouplNr);
|
||||
TDynamicObject *__fastcall GetFirstDynamic(int cpl_type);
|
||||
// TDynamicObject* __fastcall GetFirstCabDynamic(int cpl_type);
|
||||
// TDynamicObject* GetFirstCabDynamic(int cpl_type);
|
||||
void ABuSetModelShake(vector3 mShake);
|
||||
|
||||
// McZapkie-010302
|
||||
@@ -372,65 +372,65 @@ class TDynamicObject
|
||||
TTractionParam tmpTraction;
|
||||
double fAdjustment; // korekcja - docelowo przenieść do TrkFoll.cpp wraz z odległością od
|
||||
// poprzedniego
|
||||
__fastcall TDynamicObject();
|
||||
__fastcall ~TDynamicObject();
|
||||
double __fastcall TDynamicObject::Init( // zwraca długość pojazdu albo 0, jeśli błąd
|
||||
TDynamicObject();
|
||||
~TDynamicObject();
|
||||
double TDynamicObject::Init( // zwraca długość pojazdu albo 0, jeśli błąd
|
||||
AnsiString Name, AnsiString BaseDir, AnsiString asReplacableSkin, AnsiString Type_Name,
|
||||
TTrack *Track, double fDist, AnsiString DriverType, double fVel, AnsiString TrainName,
|
||||
float Load, AnsiString LoadType, bool Reversed, AnsiString);
|
||||
void __fastcall AttachPrev(TDynamicObject *Object, int iType = 1);
|
||||
bool __fastcall UpdateForce(double dt, double dt1, bool FullVer);
|
||||
void __fastcall LoadUpdate();
|
||||
bool __fastcall Update(double dt, double dt1);
|
||||
bool __fastcall FastUpdate(double dt);
|
||||
void __fastcall Move(double fDistance);
|
||||
void __fastcall FastMove(double fDistance);
|
||||
void __fastcall Render();
|
||||
void __fastcall RenderAlpha();
|
||||
void __fastcall RenderSounds();
|
||||
inline vector3 __fastcall GetPosition() { return vPosition; };
|
||||
inline vector3 __fastcall HeadPosition()
|
||||
void AttachPrev(TDynamicObject *Object, int iType = 1);
|
||||
bool UpdateForce(double dt, double dt1, bool FullVer);
|
||||
void LoadUpdate();
|
||||
bool Update(double dt, double dt1);
|
||||
bool FastUpdate(double dt);
|
||||
void Move(double fDistance);
|
||||
void FastMove(double fDistance);
|
||||
void Render();
|
||||
void RenderAlpha();
|
||||
void RenderSounds();
|
||||
inline vector3 GetPosition() { return vPosition; };
|
||||
inline vector3 HeadPosition()
|
||||
{
|
||||
return vCoulpler[iDirection ^ 1];
|
||||
}; // pobranie współrzędnych czoła
|
||||
inline vector3 __fastcall RearPosition()
|
||||
inline vector3 RearPosition()
|
||||
{
|
||||
return vCoulpler[iDirection];
|
||||
}; // pobranie współrzędnych tyłu
|
||||
inline vector3 __fastcall AxlePositionGet()
|
||||
inline vector3 AxlePositionGet()
|
||||
{
|
||||
return iAxleFirst ? Axle1.pPosition : Axle0.pPosition;
|
||||
};
|
||||
inline vector3 __fastcall VectorFront() { return vFront; };
|
||||
inline vector3 __fastcall VectorUp() { return vUp; };
|
||||
inline vector3 __fastcall VectorLeft() { return vLeft; };
|
||||
inline vector3 VectorFront() { return vFront; };
|
||||
inline vector3 VectorUp() { return vUp; };
|
||||
inline vector3 VectorLeft() { return vLeft; };
|
||||
inline double *__fastcall Matrix() { return mMatrix.getArray(); };
|
||||
inline double __fastcall GetVelocity() { return MoverParameters->Vel; };
|
||||
inline double __fastcall GetLength() { return MoverParameters->Dim.L; };
|
||||
inline double __fastcall GetWidth() { return MoverParameters->Dim.W; };
|
||||
inline double GetVelocity() { return MoverParameters->Vel; };
|
||||
inline double GetLength() { return MoverParameters->Dim.L; };
|
||||
inline double GetWidth() { return MoverParameters->Dim.W; };
|
||||
inline TTrack *__fastcall GetTrack()
|
||||
{
|
||||
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack());
|
||||
};
|
||||
// void __fastcall UpdatePos();
|
||||
// void UpdatePos();
|
||||
|
||||
// McZapkie-260202
|
||||
void __fastcall LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
void LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
AnsiString ReplacableSkin);
|
||||
|
||||
inline double __fastcall ABuGetDirection() // ABu.
|
||||
inline double ABuGetDirection() // ABu.
|
||||
{
|
||||
return (Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection());
|
||||
};
|
||||
// inline double __fastcall ABuGetTranslation() //ABu.
|
||||
// inline double ABuGetTranslation() //ABu.
|
||||
// {//zwraca przesunięcie wózka względem Point1 toru
|
||||
// return (Axle1.GetTrack()==MyTrack?Axle1.GetTranslation():Axle0.GetTranslation());
|
||||
// };
|
||||
inline double __fastcall RaDirectionGet()
|
||||
inline double RaDirectionGet()
|
||||
{ // zwraca kierunek pojazdu na torze z aktywną osą
|
||||
return iAxleFirst ? Axle1.GetDirection() : Axle0.GetDirection();
|
||||
};
|
||||
inline double __fastcall RaTranslationGet()
|
||||
inline double RaTranslationGet()
|
||||
{ // zwraca przesunięcie wózka względem Point1 toru z aktywną osią
|
||||
return iAxleFirst ? Axle1.GetTranslation() : Axle0.GetTranslation();
|
||||
};
|
||||
@@ -439,27 +439,27 @@ class TDynamicObject
|
||||
return iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack();
|
||||
};
|
||||
void CouplersDettach(double MinDist, int MyScanDir);
|
||||
void __fastcall RadioStop();
|
||||
void __fastcall RaLightsSet(int head, int rear);
|
||||
// void __fastcall RaAxleEvent(TEvent *e);
|
||||
void RadioStop();
|
||||
void RaLightsSet(int head, int rear);
|
||||
// void RaAxleEvent(TEvent *e);
|
||||
TDynamicObject *__fastcall FirstFind(int &coupler_nr);
|
||||
float __fastcall GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||
int __fastcall DirectionSet(int d); // ustawienie kierunku w składzie
|
||||
int __fastcall DirectionGet()
|
||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||
int DirectionGet()
|
||||
{
|
||||
return iDirection + iDirection - 1;
|
||||
}; // odczyt kierunku w składzie
|
||||
int DettachStatus(int dir);
|
||||
int Dettach(int dir);
|
||||
TDynamicObject *__fastcall Neightbour(int &dir);
|
||||
void __fastcall CoupleDist();
|
||||
void CoupleDist();
|
||||
TDynamicObject *__fastcall ControlledFind();
|
||||
void __fastcall ParamSet(int what, int into);
|
||||
int __fastcall RouteWish(TTrack *tr); // zapytanie do AI, po którym segmencie skrzyżowania
|
||||
void ParamSet(int what, int into);
|
||||
int RouteWish(TTrack *tr); // zapytanie do AI, po którym segmencie skrzyżowania
|
||||
// jechać
|
||||
void __fastcall DestinationSet(AnsiString to);
|
||||
AnsiString __fastcall TextureTest(AnsiString &name);
|
||||
void __fastcall OverheadTrack(float o);
|
||||
void DestinationSet(AnsiString to);
|
||||
AnsiString TextureTest(AnsiString &name);
|
||||
void OverheadTrack(float o);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -38,9 +38,9 @@ __fastcall TEventLauncher::TEventLauncher()
|
||||
|
||||
__fastcall TEventLauncher::~TEventLauncher() { SafeDeleteArray(szText); }
|
||||
|
||||
void __fastcall TEventLauncher::Init() {}
|
||||
void TEventLauncher::Init() {}
|
||||
|
||||
bool __fastcall TEventLauncher::Load(cParser *parser)
|
||||
bool TEventLauncher::Load(cParser *parser)
|
||||
{ // wczytanie wyzwalacza zdarzeñ
|
||||
AnsiString str;
|
||||
std::string token;
|
||||
@@ -125,7 +125,7 @@ bool __fastcall TEventLauncher::Load(cParser *parser)
|
||||
return true;
|
||||
};
|
||||
|
||||
bool __fastcall TEventLauncher::Render()
|
||||
bool TEventLauncher::Render()
|
||||
{ //"renderowanie" wyzwalacza
|
||||
bool bCond = false;
|
||||
if (iKey != 0)
|
||||
@@ -167,7 +167,7 @@ bool __fastcall TEventLauncher::Render()
|
||||
return bCond; // sprawdzanie dRadius w Ground.cpp
|
||||
}
|
||||
|
||||
bool __fastcall TEventLauncher::IsGlobal()
|
||||
bool TEventLauncher::IsGlobal()
|
||||
{ // sprawdzenie, czy jest globalnym wyzwalaczem czasu
|
||||
if (DeltaTime == 0)
|
||||
if (iHour >= 0)
|
||||
|
||||
12
EvLaunch.h
12
EvLaunch.h
@@ -24,12 +24,12 @@ class TEventLauncher
|
||||
TEvent *Event2;
|
||||
TMemCell *MemCell;
|
||||
int iCheckMask;
|
||||
__fastcall TEventLauncher();
|
||||
__fastcall ~TEventLauncher();
|
||||
void __fastcall Init();
|
||||
bool __fastcall Load(cParser *parser);
|
||||
bool __fastcall Render();
|
||||
bool __fastcall IsGlobal();
|
||||
TEventLauncher();
|
||||
~TEventLauncher();
|
||||
void Init();
|
||||
bool Load(cParser *parser);
|
||||
bool Render();
|
||||
bool IsGlobal();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
22
Event.cpp
22
Event.cpp
@@ -71,11 +71,11 @@ __fastcall TEvent::~TEvent()
|
||||
evJoined = NULL; // nie usuwaæ podczepionych tutaj
|
||||
};
|
||||
|
||||
void __fastcall TEvent::Init(){
|
||||
void TEvent::Init(){
|
||||
|
||||
};
|
||||
|
||||
void __fastcall TEvent::Conditions(cParser *parser, AnsiString s)
|
||||
void TEvent::Conditions(cParser *parser, AnsiString s)
|
||||
{ // przetwarzanie warunków, wspólne dla Multiple i UpdateValues
|
||||
if (s == "condition")
|
||||
{ // jesli nie "endevent"
|
||||
@@ -143,7 +143,7 @@ void __fastcall TEvent::Conditions(cParser *parser, AnsiString s)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TEvent::Load(cParser *parser, vector3 *org)
|
||||
void TEvent::Load(cParser *parser, vector3 *org)
|
||||
{
|
||||
int i;
|
||||
int ti;
|
||||
@@ -589,7 +589,7 @@ void __fastcall TEvent::Load(cParser *parser, vector3 *org)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TEvent::AddToQuery(TEvent *e)
|
||||
void TEvent::AddToQuery(TEvent *e)
|
||||
{ // dodanie eventu do kolejki
|
||||
if (evNext ? (e->fStartTime >= evNext->fStartTime) : false)
|
||||
evNext->AddToQuery(e); // sortowanie wg czasu
|
||||
@@ -602,7 +602,7 @@ void __fastcall TEvent::AddToQuery(TEvent *e)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
AnsiString __fastcall TEvent::CommandGet()
|
||||
AnsiString TEvent::CommandGet()
|
||||
{ // odczytanie komendy z eventu
|
||||
switch (Type)
|
||||
{ // to siê wykonuje równie¿ sk³adu jad¹cego bez obs³ugi
|
||||
@@ -614,7 +614,7 @@ AnsiString __fastcall TEvent::CommandGet()
|
||||
return ""; // inne eventy siê nie licz¹
|
||||
};
|
||||
|
||||
TCommandType __fastcall TEvent::Command()
|
||||
TCommandType TEvent::Command()
|
||||
{ // odczytanie komendy z eventu
|
||||
switch (Type)
|
||||
{ // to siê wykonuje równie¿ dla sk³adu jad¹cego bez obs³ugi
|
||||
@@ -626,7 +626,7 @@ TCommandType __fastcall TEvent::Command()
|
||||
return cm_Unknown; // inne eventy siê nie licz¹
|
||||
};
|
||||
|
||||
double __fastcall TEvent::ValueGet(int n)
|
||||
double TEvent::ValueGet(int n)
|
||||
{ // odczytanie komendy z eventu
|
||||
n &= 1; // tylko 1 albo 2 jest prawid³owy
|
||||
switch (Type)
|
||||
@@ -639,7 +639,7 @@ double __fastcall TEvent::ValueGet(int n)
|
||||
return 0.0; // inne eventy siê nie licz¹
|
||||
};
|
||||
|
||||
vector3 __fastcall TEvent::PositionGet()
|
||||
vector3 TEvent::PositionGet()
|
||||
{ // pobranie wspó³rzêdnych eventu
|
||||
switch (Type)
|
||||
{ //
|
||||
@@ -651,20 +651,20 @@ vector3 __fastcall TEvent::PositionGet()
|
||||
return vector3(0, 0, 0); // inne eventy siê nie licz¹
|
||||
};
|
||||
|
||||
bool __fastcall TEvent::StopCommand()
|
||||
bool TEvent::StopCommand()
|
||||
{ //
|
||||
if (Type == tp_GetValues)
|
||||
return Params[9].asMemCell->StopCommand(); // info o komendzie z komórki
|
||||
return false;
|
||||
};
|
||||
|
||||
void __fastcall TEvent::StopCommandSent()
|
||||
void TEvent::StopCommandSent()
|
||||
{
|
||||
if (Type == tp_GetValues)
|
||||
Params[9].asMemCell->StopCommandSent(); // komenda z komórki zosta³a wys³ana
|
||||
};
|
||||
|
||||
void __fastcall TEvent::Append(TEvent *e)
|
||||
void TEvent::Append(TEvent *e)
|
||||
{ // doczepienie kolejnych z t¹ sam¹ nazw¹
|
||||
if (evJoined)
|
||||
evJoined->Append(e); // rekurencja! - góra kilkanaœcie eventów bêdzie potrzebne
|
||||
|
||||
26
Event.h
26
Event.h
@@ -74,7 +74,7 @@ union TParam
|
||||
class TEvent // zmienne: ev*
|
||||
{ // zdarzenie
|
||||
private:
|
||||
void __fastcall Conditions(cParser *parser, AnsiString s);
|
||||
void Conditions(cParser *parser, AnsiString s);
|
||||
|
||||
public:
|
||||
AnsiString asName;
|
||||
@@ -93,18 +93,18 @@ class TEvent // zmienne: ev*
|
||||
TEvent *evJoined; // kolejny event z t¹ sam¹ nazw¹ - od wersji 378
|
||||
double fRandomDelay; // zakres dodatkowego opóŸnienia
|
||||
public: // metody
|
||||
__fastcall TEvent(AnsiString m = "");
|
||||
__fastcall ~TEvent();
|
||||
void __fastcall Init();
|
||||
void __fastcall Load(cParser *parser, vector3 *org);
|
||||
void __fastcall AddToQuery(TEvent *e);
|
||||
AnsiString __fastcall CommandGet();
|
||||
TCommandType __fastcall Command();
|
||||
double __fastcall ValueGet(int n);
|
||||
vector3 __fastcall PositionGet();
|
||||
bool __fastcall StopCommand();
|
||||
void __fastcall StopCommandSent();
|
||||
void __fastcall Append(TEvent *e);
|
||||
TEvent(AnsiString m = "");
|
||||
~TEvent();
|
||||
void Init();
|
||||
void Load(cParser *parser, vector3 *org);
|
||||
void AddToQuery(TEvent *e);
|
||||
AnsiString CommandGet();
|
||||
TCommandType Command();
|
||||
double ValueGet(int n);
|
||||
vector3 PositionGet();
|
||||
bool StopCommand();
|
||||
void StopCommandSent();
|
||||
void Append(TEvent *e);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -22,9 +22,9 @@ __fastcall TFadeSound::TFadeSound()
|
||||
|
||||
__fastcall TFadeSound::~TFadeSound() { Free(); }
|
||||
|
||||
void __fastcall TFadeSound::Free() {}
|
||||
void TFadeSound::Free() {}
|
||||
|
||||
void __fastcall TFadeSound::Init(char *Name, float fNewFade)
|
||||
void TFadeSound::Init(char *Name, float fNewFade)
|
||||
{
|
||||
Sound = TSoundsManager::GetFromName(Name, false);
|
||||
if (Sound)
|
||||
@@ -33,16 +33,16 @@ void __fastcall TFadeSound::Init(char *Name, float fNewFade)
|
||||
fTime = 0;
|
||||
}
|
||||
|
||||
void __fastcall TFadeSound::TurnOn()
|
||||
void TFadeSound::TurnOn()
|
||||
{
|
||||
State = ss_Starting;
|
||||
Sound->Play(0, 0, DSBPLAY_LOOPING);
|
||||
fTime = fFade;
|
||||
}
|
||||
|
||||
void __fastcall TFadeSound::TurnOff() { State = ss_ShuttingDown; }
|
||||
void TFadeSound::TurnOff() { State = ss_ShuttingDown; }
|
||||
|
||||
void __fastcall TFadeSound::Update()
|
||||
void TFadeSound::Update()
|
||||
{
|
||||
|
||||
if (State == ss_Starting)
|
||||
@@ -79,7 +79,7 @@ void __fastcall TFadeSound::Update()
|
||||
}
|
||||
}
|
||||
}
|
||||
void __fastcall TFadeSound::Volume(long vol)
|
||||
void TFadeSound::Volume(long vol)
|
||||
{
|
||||
float glos = 1;
|
||||
Sound->SetVolume(vol * glos);
|
||||
|
||||
18
FadeSound.h
18
FadeSound.h
@@ -14,15 +14,15 @@ class TFadeSound
|
||||
TSoundState State;
|
||||
|
||||
public:
|
||||
__fastcall TFadeSound();
|
||||
__fastcall ~TFadeSound();
|
||||
void __fastcall Init(char *Name, float fNewFade);
|
||||
void __fastcall TurnOn();
|
||||
void __fastcall TurnOff();
|
||||
bool __fastcall Playing() { return (State == ss_Commencing || State == ss_Starting); };
|
||||
void __fastcall Free();
|
||||
void __fastcall Update();
|
||||
void __fastcall Volume(long vol);
|
||||
TFadeSound();
|
||||
~TFadeSound();
|
||||
void Init(char *Name, float fNewFade);
|
||||
void TurnOn();
|
||||
void TurnOff();
|
||||
bool Playing() { return (State == ss_Commencing || State == ss_Starting); };
|
||||
void Free();
|
||||
void Update();
|
||||
void Volume(long vol);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
void __fastcall float4x4::Quaternion(float4 *q)
|
||||
void float4x4::Quaternion(float4 *q)
|
||||
{ // konwersja kwaternionu obrotu na macierz obrotu
|
||||
float xx = q->x * q->x, yy = q->y * q->y, zz = q->z * q->z;
|
||||
float xy = q->x * q->y, xz = q->x * q->z, yz = q->y * q->z;
|
||||
|
||||
16
Float3d.h
16
Float3d.h
@@ -10,13 +10,13 @@ class float3
|
||||
public:
|
||||
float x, y, z;
|
||||
float3(void){};
|
||||
__fastcall float3(float a, float b, float c)
|
||||
float3(float a, float b, float c)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
z = c;
|
||||
};
|
||||
double inline __fastcall Length() const;
|
||||
double inline Length() const;
|
||||
};
|
||||
|
||||
inline bool operator==(const float3 &v1, const float3 &v2)
|
||||
@@ -39,7 +39,7 @@ inline float3 operator+(const float3 &v1, const float3 &v2)
|
||||
{
|
||||
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
||||
};
|
||||
double inline __fastcall float3::Length() const { return sqrt(x * x + y * y + z * z); };
|
||||
double inline float3::Length() const { 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)
|
||||
{ // bezpieczna normalizacja (wektor d³ugoœci 1.0)
|
||||
@@ -60,12 +60,12 @@ class float4
|
||||
{ // kwaternion obrotu
|
||||
public:
|
||||
float x, y, z, w;
|
||||
__fastcall float4()
|
||||
float4()
|
||||
{
|
||||
x = y = z = 0.f;
|
||||
w = 1.f;
|
||||
};
|
||||
__fastcall float4(float a, float b, float c, float d)
|
||||
float4(float a, float b, float c, float d)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
@@ -169,14 +169,14 @@ class float4x4
|
||||
};
|
||||
float *__fastcall operator()(int i) { return &e[i << 2]; }
|
||||
const float *__fastcall readArray(void) { return e; }
|
||||
void __fastcall Identity()
|
||||
void Identity()
|
||||
{
|
||||
for (int i = 0; i < 16; ++i)
|
||||
e[i] = 0;
|
||||
e[0] = e[5] = e[10] = e[15] = 1.0f;
|
||||
}
|
||||
const float *operator[](int i) const { return &e[i << 2]; };
|
||||
void __fastcall InitialRotate()
|
||||
void InitialRotate()
|
||||
{ // taka specjalna rotacja, nie ma co ci¹gaæ trygonometrii
|
||||
float f;
|
||||
for (int i = 0; i < 16; i += 4)
|
||||
@@ -195,7 +195,7 @@ class float4x4
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void __fastcall Quaternion(float4 *q);
|
||||
void Quaternion(float4 *q);
|
||||
inline float3 *TranslationGet() { return (float3 *)(e + 12); }
|
||||
};
|
||||
|
||||
|
||||
28
Gauge.cpp
28
Gauge.cpp
@@ -31,7 +31,7 @@ __fastcall TGauge::TGauge()
|
||||
|
||||
__fastcall TGauge::~TGauge(){};
|
||||
|
||||
void __fastcall TGauge::Clear()
|
||||
void TGauge::Clear()
|
||||
{
|
||||
SubModel = NULL;
|
||||
eType = gt_Unknown;
|
||||
@@ -39,7 +39,7 @@ void __fastcall TGauge::Clear()
|
||||
fDesiredValue = 0;
|
||||
};
|
||||
|
||||
void __fastcall TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale,
|
||||
void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale,
|
||||
double fNewOffset, double fNewFriction, double fNewValue)
|
||||
{ // ustawienie parametrów animacji submodelu
|
||||
if (NewSubModel)
|
||||
@@ -69,7 +69,7 @@ void __fastcall TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TGauge::Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2, double mul)
|
||||
bool TGauge::Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2, double mul)
|
||||
{
|
||||
AnsiString str1 = Parser->GetNextSymbol();
|
||||
AnsiString str2 = Parser->GetNextSymbol().LowerCase();
|
||||
@@ -92,7 +92,7 @@ bool __fastcall TGauge::Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *
|
||||
return (md2); // true, gdy podany model zewnêtrzny, a w kabinie nie by³o
|
||||
};
|
||||
|
||||
void __fastcall TGauge::PermIncValue(double fNewDesired)
|
||||
void TGauge::PermIncValue(double fNewDesired)
|
||||
{
|
||||
fDesiredValue = fDesiredValue + fNewDesired * fScale + fOffset;
|
||||
if (fDesiredValue - fOffset > 360 / fScale)
|
||||
@@ -102,32 +102,32 @@ void __fastcall TGauge::PermIncValue(double fNewDesired)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TGauge::IncValue(double fNewDesired)
|
||||
void TGauge::IncValue(double fNewDesired)
|
||||
{ // u¿ywane tylko dla uniwersali
|
||||
fDesiredValue = fDesiredValue + fNewDesired * fScale + fOffset;
|
||||
if (fDesiredValue > fScale + fOffset)
|
||||
fDesiredValue = fScale + fOffset;
|
||||
};
|
||||
|
||||
void __fastcall TGauge::DecValue(double fNewDesired)
|
||||
void TGauge::DecValue(double fNewDesired)
|
||||
{ // u¿ywane tylko dla uniwersali
|
||||
fDesiredValue = fDesiredValue - fNewDesired * fScale + fOffset;
|
||||
if (fDesiredValue < 0)
|
||||
fDesiredValue = 0;
|
||||
};
|
||||
|
||||
void __fastcall TGauge::UpdateValue(double fNewDesired)
|
||||
void TGauge::UpdateValue(double fNewDesired)
|
||||
{ // ustawienie wartoœci docelowej
|
||||
fDesiredValue = fNewDesired * fScale + fOffset;
|
||||
};
|
||||
|
||||
void __fastcall TGauge::PutValue(double fNewDesired)
|
||||
void TGauge::PutValue(double fNewDesired)
|
||||
{ // McZapkie-281102: natychmiastowe wpisanie wartosci
|
||||
fDesiredValue = fNewDesired * fScale + fOffset;
|
||||
fValue = fDesiredValue;
|
||||
};
|
||||
|
||||
void __fastcall TGauge::Update()
|
||||
void TGauge::Update()
|
||||
{
|
||||
float dt = Timer::GetDeltaTime();
|
||||
if ((fFriction > 0) &&
|
||||
@@ -178,24 +178,24 @@ void __fastcall TGauge::Update()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TGauge::Render(){};
|
||||
void TGauge::Render(){};
|
||||
|
||||
void __fastcall TGauge::AssignFloat(float *fValue)
|
||||
void TGauge::AssignFloat(float *fValue)
|
||||
{
|
||||
cDataType = 'f';
|
||||
fData = fValue;
|
||||
};
|
||||
void __fastcall TGauge::AssignDouble(double *dValue)
|
||||
void TGauge::AssignDouble(double *dValue)
|
||||
{
|
||||
cDataType = 'd';
|
||||
dData = dValue;
|
||||
};
|
||||
void __fastcall TGauge::AssignInt(int *iValue)
|
||||
void TGauge::AssignInt(int *iValue)
|
||||
{
|
||||
cDataType = 'i';
|
||||
iData = iValue;
|
||||
};
|
||||
void __fastcall TGauge::UpdateValue()
|
||||
void TGauge::UpdateValue()
|
||||
{ // ustawienie wartoœci docelowej z parametru
|
||||
switch (cDataType)
|
||||
{ // to nie jest zbyt optymalne, mo¿na by zrobiæ osobne funkcje
|
||||
|
||||
32
Gauge.h
32
Gauge.h
@@ -38,25 +38,25 @@ class TGauge // zmienne "gg"
|
||||
};
|
||||
|
||||
public:
|
||||
__fastcall TGauge();
|
||||
__fastcall ~TGauge();
|
||||
void __fastcall Clear();
|
||||
void __fastcall Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
||||
TGauge();
|
||||
~TGauge();
|
||||
void Clear();
|
||||
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
||||
double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
||||
bool __fastcall Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL,
|
||||
bool Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL,
|
||||
double mul = 1.0);
|
||||
void __fastcall PermIncValue(double fNewDesired);
|
||||
void __fastcall IncValue(double fNewDesired);
|
||||
void __fastcall DecValue(double fNewDesired);
|
||||
void __fastcall UpdateValue(double fNewDesired);
|
||||
void __fastcall PutValue(double fNewDesired);
|
||||
void PermIncValue(double fNewDesired);
|
||||
void IncValue(double fNewDesired);
|
||||
void DecValue(double fNewDesired);
|
||||
void UpdateValue(double fNewDesired);
|
||||
void PutValue(double fNewDesired);
|
||||
float GetValue() { return fValue; };
|
||||
void __fastcall Update();
|
||||
void __fastcall Render();
|
||||
void __fastcall AssignFloat(float *fValue);
|
||||
void __fastcall AssignDouble(double *dValue);
|
||||
void __fastcall AssignInt(int *iValue);
|
||||
void __fastcall UpdateValue();
|
||||
void Update();
|
||||
void Render();
|
||||
void AssignFloat(float *fValue);
|
||||
void AssignDouble(double *dValue);
|
||||
void AssignInt(int *iValue);
|
||||
void UpdateValue();
|
||||
TSubModel *SubModel; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
|
||||
};
|
||||
|
||||
|
||||
6
Geom.cpp
6
Geom.cpp
@@ -16,9 +16,9 @@ __fastcall TGeometry::TGeometry() {}
|
||||
|
||||
__fastcall TGeometry::~TGeometry() {}
|
||||
|
||||
bool __fastcall TGeometry::Init() {}
|
||||
bool TGeometry::Init() {}
|
||||
|
||||
vector3 __fastcall TGeometry::Load(TQueryParserComp *Parser)
|
||||
vector3 TGeometry::Load(TQueryParserComp *Parser)
|
||||
{
|
||||
str = Parser->GetNextSymbol().LowerCase();
|
||||
tmp->TextureID = TTexturesManager::GetTextureID(str.c_str());
|
||||
@@ -106,7 +106,7 @@ vector3 __fastcall TGeometry::Load(TQueryParserComp *Parser)
|
||||
tmp->fSquareRadius += r;
|
||||
}
|
||||
|
||||
bool __fastcall TGeometry::Render() {}
|
||||
bool TGeometry::Render() {}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
10
Geom.h
10
Geom.h
@@ -28,11 +28,11 @@ class TGeometry
|
||||
TMaterialColor Specular;
|
||||
|
||||
public:
|
||||
__fastcall TGeometry();
|
||||
__fastcall ~TGeometry();
|
||||
bool __fastcall Init();
|
||||
vector3 __fastcall Load(TQueryParserComp *Parser);
|
||||
bool __fastcall Render();
|
||||
TGeometry();
|
||||
~TGeometry();
|
||||
bool Init();
|
||||
vector3 Load(TQueryParserComp *Parser);
|
||||
bool Render();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
30
Globals.cpp
30
Globals.cpp
@@ -176,7 +176,7 @@ int Global::iBpp = 32; // chyba ju
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
AnsiString __fastcall Global::GetNextSymbol()
|
||||
AnsiString Global::GetNextSymbol()
|
||||
{ // pobranie tokenu z aktualnego parsera
|
||||
if (qParser)
|
||||
return qParser->EndOfFile ? AnsiString("endconfig") : qParser->GetNextSymbol();
|
||||
@@ -190,7 +190,7 @@ AnsiString __fastcall Global::GetNextSymbol()
|
||||
return "";
|
||||
};
|
||||
|
||||
void __fastcall Global::LoadIniFile(AnsiString asFileName)
|
||||
void Global::LoadIniFile(AnsiString asFileName)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; ++i)
|
||||
@@ -217,7 +217,7 @@ void __fastcall Global::LoadIniFile(AnsiString asFileName)
|
||||
delete Parser; // Ra: tego jak zwykle nie by³o wczeœniej :]
|
||||
};
|
||||
|
||||
void __fastcall Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
void Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
{ // Ra: trzeba by przerobiæ na cParser, ¿eby to dzia³a³o w scenerii
|
||||
pParser = cp;
|
||||
qParser = qp;
|
||||
@@ -502,7 +502,7 @@ void __fastcall Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall Global::InitKeys(AnsiString asFileName)
|
||||
void Global::InitKeys(AnsiString asFileName)
|
||||
{
|
||||
// if (FileExists(asFileName))
|
||||
// {
|
||||
@@ -628,17 +628,17 @@ void __fastcall Global::InitKeys(AnsiString asFileName)
|
||||
}
|
||||
}
|
||||
/*
|
||||
vector3 __fastcall Global::GetCameraPosition()
|
||||
vector3 Global::GetCameraPosition()
|
||||
{
|
||||
return pCameraPosition;
|
||||
}
|
||||
*/
|
||||
void __fastcall Global::SetCameraPosition(vector3 pNewCameraPosition)
|
||||
void Global::SetCameraPosition(vector3 pNewCameraPosition)
|
||||
{
|
||||
pCameraPosition = pNewCameraPosition;
|
||||
}
|
||||
|
||||
void __fastcall Global::SetCameraRotation(double Yaw)
|
||||
void Global::SetCameraRotation(double Yaw)
|
||||
{ // ustawienie bezwzglêdnego kierunku kamery z korekcj¹ do przedzia³u <-M_PI,M_PI>
|
||||
pCameraRotation = Yaw;
|
||||
while (pCameraRotation < -M_PI)
|
||||
@@ -648,7 +648,7 @@ void __fastcall Global::SetCameraRotation(double Yaw)
|
||||
pCameraRotationDeg = pCameraRotation * 180.0 / M_PI;
|
||||
}
|
||||
|
||||
void __fastcall Global::BindTexture(GLuint t)
|
||||
void Global::BindTexture(GLuint t)
|
||||
{ // ustawienie aktualnej tekstury, tylko gdy siê zmienia
|
||||
if (t != iTextureId)
|
||||
{
|
||||
@@ -656,7 +656,7 @@ void __fastcall Global::BindTexture(GLuint t)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall Global::TrainDelete(TDynamicObject *d)
|
||||
void Global::TrainDelete(TDynamicObject *d)
|
||||
{ // usuniêcie pojazdu prowadzonego przez u¿ytkownika
|
||||
if (pWorld)
|
||||
pWorld->TrainDelete(d);
|
||||
@@ -672,13 +672,13 @@ TDynamicObject *__fastcall Global::CouplerNearest()
|
||||
return pGround->CouplerNearest(pCamera->Pos);
|
||||
};
|
||||
|
||||
bool __fastcall Global::AddToQuery(TEvent *event, TDynamicObject *who)
|
||||
bool Global::AddToQuery(TEvent *event, TDynamicObject *who)
|
||||
{
|
||||
return pGround->AddToQuery(event, who);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall Global::DoEvents()
|
||||
bool Global::DoEvents()
|
||||
{ // wywo³ywaæ czasem, ¿eby nie robi³ wra¿enia zawieszonego
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
@@ -704,7 +704,7 @@ __fastcall TTranscripts::TTranscripts()
|
||||
fRefreshTime = 360.0; // wartoœc zaporowa
|
||||
};
|
||||
__fastcall TTranscripts::~TTranscripts(){};
|
||||
void __fastcall TTranscripts::AddLine(char *txt, float show, float hide, bool it)
|
||||
void TTranscripts::AddLine(char *txt, float show, float hide, bool it)
|
||||
{ // dodanie linii do tabeli, (show) i (hide) w [s] od aktualnego czasu
|
||||
if (show == hide)
|
||||
return; // komentarz jest ignorowany
|
||||
@@ -741,7 +741,7 @@ void __fastcall TTranscripts::AddLine(char *txt, float show, float hide, bool it
|
||||
break; // wiêcej ju¿ nic
|
||||
}
|
||||
};
|
||||
void __fastcall TTranscripts::Add(char *txt, float len, bool backgorund)
|
||||
void TTranscripts::Add(char *txt, float len, bool backgorund)
|
||||
{ // dodanie tekstów, d³ugoœæ dŸwiêku, czy istotne
|
||||
if (!txt)
|
||||
return; // pusty tekst
|
||||
@@ -763,7 +763,7 @@ void __fastcall TTranscripts::Add(char *txt, float len, bool backgorund)
|
||||
}
|
||||
AddLine(txt, 0.1 * i, 0.1 * j, false);
|
||||
};
|
||||
void __fastcall TTranscripts::Update()
|
||||
void TTranscripts::Update()
|
||||
{ // usuwanie niepotrzebnych (nie czêœciej ni¿ 10 razy na sekundê)
|
||||
if (fRefreshTime > Global::fTimeAngleDeg)
|
||||
return; // nie czas jeszcze na zmiany
|
||||
@@ -819,7 +819,7 @@ char bezogonkowo[128] = "E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
|
||||
"RAAAALCCCEEEEIIDDNNOOOOxRUUUUYTB"
|
||||
"raaaalccceeeeiiddnnoooo-ruuuuyt?";
|
||||
|
||||
AnsiString __fastcall Global::Bezogonkow(AnsiString str, bool _)
|
||||
AnsiString Global::Bezogonkow(AnsiString str, bool _)
|
||||
{ // wyciêcie liter z ogonkami, bo OpenGL nie umie wyœwietliæ
|
||||
for (int i = 1; i <= str.Length(); ++i)
|
||||
if (str[i] & 0x80)
|
||||
|
||||
34
Globals.h
34
Globals.h
@@ -140,12 +140,12 @@ class TTranscripts
|
||||
float fRefreshTime;
|
||||
|
||||
public:
|
||||
__fastcall TTranscripts();
|
||||
__fastcall ~TTranscripts();
|
||||
void __fastcall AddLine(char *txt, float show, float hide, bool it);
|
||||
void __fastcall Add(char *txt, float len,
|
||||
TTranscripts();
|
||||
~TTranscripts();
|
||||
void AddLine(char *txt, float show, float hide, bool it);
|
||||
void Add(char *txt, float len,
|
||||
bool backgorund = false); // dodanie tekstów, d³ugoœæ dŸwiêku, czy istotne
|
||||
void __fastcall Update(); // usuwanie niepotrzebnych (ok. 10 razy na sekundê)
|
||||
void Update(); // usuwanie niepotrzebnych (ok. 10 razy na sekundê)
|
||||
};
|
||||
|
||||
class Global
|
||||
@@ -197,11 +197,11 @@ class Global
|
||||
static AnsiString asCurrentDynamicPath;
|
||||
// McZapkie-170602: zewnetrzna definicja pojazdu uzytkownika
|
||||
static AnsiString asHumanCtrlVehicle;
|
||||
static void __fastcall LoadIniFile(AnsiString asFileName);
|
||||
static void __fastcall InitKeys(AnsiString asFileName);
|
||||
inline static vector3 __fastcall GetCameraPosition() { return pCameraPosition; };
|
||||
static void __fastcall SetCameraPosition(vector3 pNewCameraPosition);
|
||||
static void __fastcall SetCameraRotation(double Yaw);
|
||||
static void LoadIniFile(AnsiString asFileName);
|
||||
static void InitKeys(AnsiString asFileName);
|
||||
inline static vector3 GetCameraPosition() { return pCameraPosition; };
|
||||
static void SetCameraPosition(vector3 pNewCameraPosition);
|
||||
static void SetCameraRotation(double Yaw);
|
||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||
// McZapkie-221002: definicja swiatla dziennego
|
||||
static GLfloat AtmoColor[];
|
||||
@@ -260,7 +260,7 @@ class Global
|
||||
static int iKeyLast; // ostatnio naciœniêty klawisz w celu logowania
|
||||
static int iPause; // globalna pauza ruchu: b0=start,b1=klawisz,b2=t³o,b3=lagi,b4=wczytywanie
|
||||
static bool bActive; // czy jest aktywnym oknem
|
||||
static void __fastcall BindTexture(GLuint t);
|
||||
static void BindTexture(GLuint t);
|
||||
static int iConvertModels; // tworzenie plików binarnych
|
||||
static int iErorrCounter; // licznik sprawdzañ do œledzenia b³êdów OpenGL
|
||||
static bool bInactivePause; // automatyczna pauza, gdy okno nieaktywne
|
||||
@@ -295,14 +295,14 @@ class Global
|
||||
static int iHiddenEvents; // czy ³¹czyæ eventy z torami poprzez nazwê toru
|
||||
static TTextSound *tsRadioBusy[10]; // zajêtoœæ kana³ów radiowych (wskaŸnik na odgrywany dŸwiêk)
|
||||
// metody
|
||||
static void __fastcall TrainDelete(TDynamicObject *d);
|
||||
static void __fastcall ConfigParse(Queryparsercomp::TQueryParserComp *qp, cParser *cp = NULL);
|
||||
static AnsiString __fastcall GetNextSymbol();
|
||||
static void TrainDelete(TDynamicObject *d);
|
||||
static void ConfigParse(Queryparsercomp::TQueryParserComp *qp, cParser *cp = NULL);
|
||||
static AnsiString GetNextSymbol();
|
||||
static TDynamicObject *__fastcall DynamicNearest();
|
||||
static TDynamicObject *__fastcall CouplerNearest();
|
||||
static bool __fastcall AddToQuery(TEvent *event, TDynamicObject *who);
|
||||
static bool __fastcall DoEvents();
|
||||
static AnsiString __fastcall Bezogonkow(AnsiString str, bool _ = false);
|
||||
static bool AddToQuery(TEvent *event, TDynamicObject *who);
|
||||
static bool DoEvents();
|
||||
static AnsiString Bezogonkow(AnsiString str, bool _ = false);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
124
Ground.cpp
124
Ground.cpp
@@ -133,7 +133,7 @@ __fastcall TGroundNode::~TGroundNode()
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::Init(int n)
|
||||
void TGroundNode::Init(int n)
|
||||
{ // utworzenie tablicy wierzcho³ków
|
||||
bVisible = false;
|
||||
iNumVerts = n;
|
||||
@@ -155,14 +155,14 @@ __fastcall TGroundNode::TGroundNode(TGroundNodeType t, int n)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::InitCenter()
|
||||
void TGroundNode::InitCenter()
|
||||
{ // obliczenie œrodka ciê¿koœci obiektu
|
||||
for (int i = 0; i < iNumVerts; i++)
|
||||
pCenter += Vertices[i].Point;
|
||||
pCenter /= iNumVerts;
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::InitNormals()
|
||||
void TGroundNode::InitNormals()
|
||||
{ // obliczenie wektorów normalnych
|
||||
vector3 v1, v2, v3, v4, v5, n1, n2, n3, n4;
|
||||
int i;
|
||||
@@ -227,7 +227,7 @@ void __fastcall TGroundNode::InitNormals()
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::MoveMe(vector3 pPosition)
|
||||
void TGroundNode::MoveMe(vector3 pPosition)
|
||||
{ // przesuwanie obiektów scenerii o wektor w celu redukcji trzêsienia
|
||||
pCenter += pPosition;
|
||||
switch (iType)
|
||||
@@ -264,7 +264,7 @@ void __fastcall TGroundNode::MoveMe(vector3 pPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::RaRenderVBO()
|
||||
void TGroundNode::RaRenderVBO()
|
||||
{ // renderowanie z domyslnego bufora VBO
|
||||
glColor3ub(Diffuse[0], Diffuse[1], Diffuse[2]);
|
||||
if (TextureID)
|
||||
@@ -272,7 +272,7 @@ void __fastcall TGroundNode::RaRenderVBO()
|
||||
glDrawArrays(iType, iVboPtr, iNumVerts); // Narysuj naraz wszystkie trójk¹ty
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::RenderVBO()
|
||||
void TGroundNode::RenderVBO()
|
||||
{ // renderowanie obiektu z VBO - faza nieprzezroczystych
|
||||
double mgn = SquareMagnitude(pCenter - Global::pCameraPosition);
|
||||
if ((mgn > fSquareRadius || (mgn < fSquareMinRadius)) &&
|
||||
@@ -335,7 +335,7 @@ void __fastcall TGroundNode::RenderVBO()
|
||||
return;
|
||||
};
|
||||
|
||||
void __fastcall TGroundNode::RenderAlphaVBO()
|
||||
void TGroundNode::RenderAlphaVBO()
|
||||
{ // renderowanie obiektu z VBO - faza przezroczystych
|
||||
double mgn = SquareMagnitude(pCenter - Global::pCameraPosition);
|
||||
float r, g, b;
|
||||
@@ -419,7 +419,7 @@ void __fastcall TGroundNode::RenderAlphaVBO()
|
||||
return;
|
||||
}
|
||||
|
||||
void __fastcall TGroundNode::Compile(bool many)
|
||||
void TGroundNode::Compile(bool many)
|
||||
{ // tworzenie skompilowanej listy w wyœwietlaniu DL
|
||||
if (!many)
|
||||
{ // obs³uga pojedynczej listy
|
||||
@@ -512,7 +512,7 @@ void TGroundNode::Release()
|
||||
DisplayListID = 0;
|
||||
};
|
||||
|
||||
void __fastcall TGroundNode::RenderHidden()
|
||||
void TGroundNode::RenderHidden()
|
||||
{ // renderowanie obiektów niewidocznych
|
||||
double mgn = SquareMagnitude(pCenter - Global::pCameraPosition);
|
||||
switch (iType)
|
||||
@@ -538,7 +538,7 @@ void __fastcall TGroundNode::RenderHidden()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TGroundNode::RenderDL()
|
||||
void TGroundNode::RenderDL()
|
||||
{ // wyœwietlanie obiektu przez Display List
|
||||
switch (iType)
|
||||
{ // obiekty renderowane niezale¿nie od odleg³oœci
|
||||
@@ -590,7 +590,7 @@ void __fastcall TGroundNode::RenderDL()
|
||||
};
|
||||
};
|
||||
|
||||
void __fastcall TGroundNode::RenderAlphaDL()
|
||||
void TGroundNode::RenderAlphaDL()
|
||||
{
|
||||
// SPOSOB NA POZBYCIE SIE RAMKI DOOKOLA TEXTURY ALPHA DLA OBIEKTOW ZAGNIEZDZONYCH W SCN JAKO
|
||||
// NODE
|
||||
@@ -600,7 +600,7 @@ void __fastcall TGroundNode::RenderAlphaDL()
|
||||
// sprawdzamy czy w nazwie jest @ i wg tego
|
||||
// ustawiamy PROBLEND na true dla wlasnie wczytywanego trojkata (kazdy trojkat jest osobnym
|
||||
// nodem)
|
||||
// nastepnie podczas renderowania w bool __fastcall TGroundNode::RenderAlpha()
|
||||
// nastepnie podczas renderowania w bool TGroundNode::RenderAlpha()
|
||||
// na poczatku ustawiamy standardowe GL_GREATER = 0.04
|
||||
// pozniej sprawdzamy czy jest wlaczony PROBLEND dla aktualnie renderowanego noda TRIANGLE,
|
||||
// wlasciwie dla kazdego node'a
|
||||
@@ -693,7 +693,7 @@ __fastcall TSubRect::~TSubRect()
|
||||
// TODO: usun¹æ obiekty z listy (nRootMesh), bo s¹ one tworzone dla sektora
|
||||
}
|
||||
|
||||
void __fastcall TSubRect::NodeAdd(TGroundNode *Node)
|
||||
void TSubRect::NodeAdd(TGroundNode *Node)
|
||||
{ // przyczepienie obiektu do sektora, wstêpna kwalifikacja na listy renderowania
|
||||
if (!this)
|
||||
return; // zabezpiecznie przed obiektami przekraczaj¹cymi obszar roboczy
|
||||
@@ -828,7 +828,7 @@ void __fastcall TSubRect::NodeAdd(TGroundNode *Node)
|
||||
++iNodeCount; // licznik obiektów
|
||||
}
|
||||
|
||||
void __fastcall TSubRect::RaNodeAdd(TGroundNode *Node)
|
||||
void TSubRect::RaNodeAdd(TGroundNode *Node)
|
||||
{ // finalna kwalifikacja na listy renderowania, jeœli nie obs³ugiwane grupowo
|
||||
switch (Node->iType)
|
||||
{
|
||||
@@ -896,7 +896,7 @@ void __fastcall TSubRect::RaNodeAdd(TGroundNode *Node)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TSubRect::Sort()
|
||||
void TSubRect::Sort()
|
||||
{ // przygotowanie sektora do renderowania
|
||||
TGroundNode **n0, *n1, *n2; // wskaŸniki robocze
|
||||
delete[] tTracks; // usuniêcie listy
|
||||
@@ -990,7 +990,7 @@ TTrack *__fastcall TSubRect::FindTrack(vector3 *Point, int &iConnection, TTrack
|
||||
return NULL;
|
||||
};
|
||||
|
||||
bool __fastcall TSubRect::RaTrackAnimAdd(TTrack *t)
|
||||
bool TSubRect::RaTrackAnimAdd(TTrack *t)
|
||||
{ // aktywacja animacji torów w VBO (zwrotnica, obrotnica)
|
||||
if (m_nVertexCount < 0)
|
||||
return true; // nie ma animacji, gdy nie widaæ
|
||||
@@ -1001,7 +1001,7 @@ bool __fastcall TSubRect::RaTrackAnimAdd(TTrack *t)
|
||||
return false; // bêdzie animowane...
|
||||
}
|
||||
|
||||
void __fastcall TSubRect::RaAnimate()
|
||||
void TSubRect::RaAnimate()
|
||||
{ // wykonanie animacji
|
||||
if (!tTrackAnim)
|
||||
return; // nie ma nic do animowania
|
||||
@@ -1028,7 +1028,7 @@ TTraction *__fastcall TSubRect::FindTraction(vector3 *Point, int &iConnection, T
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::LoadNodes()
|
||||
void TSubRect::LoadNodes()
|
||||
{ // utworzenie siatek VBO dla wszystkich node w sektorze
|
||||
if (m_nVertexCount >= 0)
|
||||
return; // obiekty by³y ju¿ sprawdzone
|
||||
@@ -1121,7 +1121,7 @@ void __fastcall TSubRect::LoadNodes()
|
||||
ResourceManager::Register(this); // dodanie do automatu zwalniaj¹cego pamiêæ
|
||||
}
|
||||
|
||||
bool __fastcall TSubRect::StartVBO()
|
||||
bool TSubRect::StartVBO()
|
||||
{ // pocz¹tek rysowania elementów z VBO w sektorze
|
||||
SetLastUsage(Timer::GetSimulationTime()); // te z ty³u bêd¹ niepotrzebnie zwalniane
|
||||
return CMesh::StartVBO();
|
||||
@@ -1133,7 +1133,7 @@ void TSubRect::Release()
|
||||
CMesh::Clear(); // usuwanie buforów
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::RenderDL()
|
||||
void TSubRect::RenderDL()
|
||||
{ // renderowanie nieprzezroczystych (DL)
|
||||
TGroundNode *node;
|
||||
RaAnimate(); // przeliczenia animacji torów w sektorze
|
||||
@@ -1145,7 +1145,7 @@ void __fastcall TSubRect::RenderDL()
|
||||
tTracks[j]->RenderDyn(); // nieprzezroczyste fragmenty pojazdów na torach
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::RenderAlphaDL()
|
||||
void TSubRect::RenderAlphaDL()
|
||||
{ // renderowanie przezroczystych modeli oraz pojazdów (DL)
|
||||
TGroundNode *node;
|
||||
for (node = nRenderMixed; node; node = node->nNext3)
|
||||
@@ -1159,7 +1159,7 @@ void __fastcall TSubRect::RenderAlphaDL()
|
||||
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::RenderVBO()
|
||||
void TSubRect::RenderVBO()
|
||||
{ // renderowanie nieprzezroczystych (VBO)
|
||||
TGroundNode *node;
|
||||
RaAnimate(); // przeliczenia animacji torów w sektorze
|
||||
@@ -1179,7 +1179,7 @@ void __fastcall TSubRect::RenderVBO()
|
||||
tTracks[j]->RenderDyn(); // nieprzezroczyste fragmenty pojazdów na torach
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::RenderAlphaVBO()
|
||||
void TSubRect::RenderAlphaVBO()
|
||||
{ // renderowanie przezroczystych modeli oraz pojazdów (VBO)
|
||||
TGroundNode *node;
|
||||
for (node = nRenderMixed; node; node = node->nNext3)
|
||||
@@ -1193,7 +1193,7 @@ void __fastcall TSubRect::RenderAlphaVBO()
|
||||
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
||||
};
|
||||
|
||||
void __fastcall TSubRect::RenderSounds()
|
||||
void TSubRect::RenderSounds()
|
||||
{ // aktualizacja dŸwiêków w pojazdach sektora (sektor mo¿e nie byæ wyœwietlany)
|
||||
for (int j = 0; j < iTracks; ++j)
|
||||
tTracks[j]->RenderDynSounds(); // dŸwiêki pojazdów id¹ niezale¿nie od wyœwietlania
|
||||
@@ -1211,7 +1211,7 @@ __fastcall TGroundRect::TGroundRect()
|
||||
|
||||
__fastcall TGroundRect::~TGroundRect() { SafeDeleteArray(pSubRects); };
|
||||
|
||||
void __fastcall TGroundRect::RenderDL()
|
||||
void TGroundRect::RenderDL()
|
||||
{ // renderowanie kwadratu kilometrowego (DL), jeœli jeszcze nie zrobione
|
||||
if (iLastDisplay != iFrameNumber)
|
||||
{ // tylko jezeli dany kwadrat nie by³ jeszcze renderowany
|
||||
@@ -1237,7 +1237,7 @@ void __fastcall TGroundRect::RenderDL()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TGroundRect::RenderVBO()
|
||||
void TGroundRect::RenderVBO()
|
||||
{ // renderowanie kwadratu kilometrowego (VBO), jeœli jeszcze nie zrobione
|
||||
if (iLastDisplay != iFrameNumber)
|
||||
{ // tylko jezeli dany kwadrat nie by³ jeszcze renderowany
|
||||
@@ -1258,7 +1258,7 @@ void __fastcall TGroundRect::RenderVBO()
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TGround::MoveGroundNode(vector3 pPosition)
|
||||
void TGround::MoveGroundNode(vector3 pPosition)
|
||||
{ // Ra: to wymaga gruntownej reformy
|
||||
/*
|
||||
TGroundNode *Current;
|
||||
@@ -1315,7 +1315,7 @@ __fastcall TGround::TGround()
|
||||
|
||||
__fastcall TGround::~TGround() { Free(); }
|
||||
|
||||
void __fastcall TGround::Free()
|
||||
void TGround::Free()
|
||||
{
|
||||
TEvent *tmp;
|
||||
for (TEvent *Current = RootEvent; Current;)
|
||||
@@ -1364,7 +1364,7 @@ TGroundNode *__fastcall TGround::DynamicFind(AnsiString asNameToFind)
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void __fastcall TGround::DynamicList(bool all)
|
||||
void TGround::DynamicList(bool all)
|
||||
{ // odes³anie nazw pojazdów dostêpnych na scenerii (nazwy, szczególnie wagonów, mog¹ siê
|
||||
// powtarzaæ!)
|
||||
for (TGroundNode *Current = nRootDynamic; Current; Current = Current->nNext)
|
||||
@@ -1401,7 +1401,7 @@ TGroundNode *nTrainSetDriver = NULL; // pojazd, kt
|
||||
TGroundVertex TempVerts[10000]; // tu wczytywane s¹ trójk¹ty
|
||||
Byte TempConnectionType[200]; // Ra: sprzêgi w sk³adzie; ujemne, gdy odwrotnie
|
||||
|
||||
void __fastcall TGround::RaTriangleDivider(TGroundNode *node)
|
||||
void TGround::RaTriangleDivider(TGroundNode *node)
|
||||
{ // tworzy dodatkowe trójk¹ty i zmiejsza podany
|
||||
// to jest wywo³ywane przy wczytywaniu trójk¹tów
|
||||
// dodatkowe trójk¹ty s¹ dodawane do g³ównej listy trójk¹tów
|
||||
@@ -2241,7 +2241,7 @@ TEvent *__fastcall TGround::FindEventScan(const AnsiString &asEventName)
|
||||
return e; // utworzony albo siê nie uda³o
|
||||
}
|
||||
|
||||
void __fastcall TGround::FirstInit()
|
||||
void TGround::FirstInit()
|
||||
{ // ustalanie zale¿noœci na scenerii przed wczytaniem pojazdów
|
||||
if (bInitDone)
|
||||
return; // Ra: ¿eby nie robi³o siê dwa razy
|
||||
@@ -2352,7 +2352,7 @@ void __fastcall TGround::FirstInit()
|
||||
WriteLog("FirstInit is done");
|
||||
};
|
||||
|
||||
bool __fastcall TGround::Init(AnsiString asFile, HDC hDC)
|
||||
bool TGround::Init(AnsiString asFile, HDC hDC)
|
||||
{ // g³ówne wczytywanie scenerii
|
||||
if (asFile.LowerCase().SubString(1, 7) == "scenery")
|
||||
asFile.Delete(1, 8); // Ra: usuniêcie niepotrzebnych znaków - zgodnoœæ wstecz z 2003
|
||||
@@ -2865,7 +2865,7 @@ bool __fastcall TGround::Init(AnsiString asFile, HDC hDC)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TGround::InitEvents()
|
||||
bool TGround::InitEvents()
|
||||
{ //³¹czenie eventów z pozosta³ymi obiektami
|
||||
TGroundNode *tmp, *trk;
|
||||
char buff[255];
|
||||
@@ -3164,7 +3164,7 @@ bool __fastcall TGround::InitEvents()
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TGround::InitTracks()
|
||||
void TGround::InitTracks()
|
||||
{ //³¹czenie torów ze sob¹ i z eventami
|
||||
TGroundNode *Current, *Model;
|
||||
TTrack *tmp; // znaleziony tor
|
||||
@@ -3325,7 +3325,7 @@ void __fastcall TGround::InitTracks()
|
||||
// Current->pTrack->ConnectionsLog(); //zalogowanie informacji o po³¹czeniach
|
||||
}
|
||||
|
||||
void __fastcall TGround::InitTraction()
|
||||
void TGround::InitTraction()
|
||||
{ //³¹czenie drutów ze sob¹ oraz z torami i eventami
|
||||
TGroundNode *nCurrent, *nTemp;
|
||||
TTraction *tmp; // znalezione przês³o
|
||||
@@ -3532,7 +3532,7 @@ void __fastcall TGround::InitTraction()
|
||||
delete[] nEnds; // nie potrzebne ju¿
|
||||
};
|
||||
|
||||
void __fastcall TGround::TrackJoin(TGroundNode *Current)
|
||||
void TGround::TrackJoin(TGroundNode *Current)
|
||||
{ // wyszukiwanie s¹siednich torów do pod³¹czenia (wydzielone na u¿ytek obrotnicy)
|
||||
TTrack *Track = Current->pTrack;
|
||||
TTrack *tmp;
|
||||
@@ -3567,7 +3567,7 @@ void __fastcall TGround::TrackJoin(TGroundNode *Current)
|
||||
}
|
||||
|
||||
// McZapkie-070602: wyzwalacze zdarzen
|
||||
bool __fastcall TGround::InitLaunchers()
|
||||
bool TGround::InitLaunchers()
|
||||
{
|
||||
TGroundNode *Current, *tmp;
|
||||
TEventLauncher *EventLauncher;
|
||||
@@ -3739,7 +3739,7 @@ TTraction *__fastcall TGround::TractionNearestFind(vector3 &p, int dir, TGroundN
|
||||
return (nBest ? nBest->hvTraction : NULL);
|
||||
};
|
||||
|
||||
bool __fastcall TGround::AddToQuery(TEvent *Event, TDynamicObject *Node)
|
||||
bool TGround::AddToQuery(TEvent *Event, TDynamicObject *Node)
|
||||
{
|
||||
if (Event->bEnabled) // jeœli mo¿e byæ dodany do kolejki (nie u¿ywany w skanowaniu)
|
||||
if (!Event->iQueued) // jeœli nie dodany jeszcze do kolejki
|
||||
@@ -3800,7 +3800,7 @@ bool __fastcall TGround::AddToQuery(TEvent *Event, TDynamicObject *Node)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TGround::EventConditon(TEvent *e)
|
||||
bool TGround::EventConditon(TEvent *e)
|
||||
{ // sprawdzenie spelnienia warunków dla eventu
|
||||
if (e->iFlags <= update_only)
|
||||
return true; // bezwarunkowo
|
||||
@@ -3844,7 +3844,7 @@ bool __fastcall TGround::EventConditon(TEvent *e)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool __fastcall TGround::CheckQuery()
|
||||
bool TGround::CheckQuery()
|
||||
{ // sprawdzenie kolejki eventów oraz wykonanie tych, którym czas min¹³
|
||||
TLocation loc;
|
||||
int i;
|
||||
@@ -4195,19 +4195,19 @@ bool __fastcall TGround::CheckQuery()
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TGround::OpenGLUpdate(HDC hDC)
|
||||
void TGround::OpenGLUpdate(HDC hDC)
|
||||
{
|
||||
SwapBuffers(hDC); // swap buffers (double buffering)
|
||||
};
|
||||
|
||||
void __fastcall TGround::UpdatePhys(double dt, int iter)
|
||||
void TGround::UpdatePhys(double dt, int iter)
|
||||
{ // aktualizacja fizyki sta³ym krokiem: dt=krok czasu [s], dt*iter=czas od ostatnich przeliczeñ
|
||||
for (TGroundNode *Current = nRootOfType[TP_TRACTIONPOWERSOURCE]; Current;
|
||||
Current = Current->nNext)
|
||||
Current->psTractionPowerSource->Update(dt * iter); // zerowanie sumy pr¹dów
|
||||
};
|
||||
|
||||
bool __fastcall TGround::Update(double dt, int iter)
|
||||
bool TGround::Update(double dt, int iter)
|
||||
{ // aktualizacja animacji krokiem FPS: dt=krok czasu [s], dt*iter=czas od ostatnich przeliczeñ
|
||||
if (dt == 0.0)
|
||||
{ // jeœli za³¹czona jest pauza, to tylko obs³u¿yæ ruch w kabinie trzeba
|
||||
@@ -4282,7 +4282,7 @@ bool __fastcall TGround::Update(double dt, int iter)
|
||||
};
|
||||
|
||||
// Winger 170204 - szukanie trakcji nad pantografami
|
||||
bool __fastcall TGround::GetTraction(TDynamicObject *model)
|
||||
bool TGround::GetTraction(TDynamicObject *model)
|
||||
{ // aktualizacja drutu zasilaj¹cego dla ka¿dego pantografu, ¿eby odczytaæ napiêcie
|
||||
// jeœli pojazd siê nie porusza, to nie ma sensu przeliczaæ tego wiêcej ni¿ raz
|
||||
double fRaParam; // parametr równania parametrycznego odcinka drutu
|
||||
@@ -4530,7 +4530,7 @@ bool __fastcall TGround::GetTraction(TDynamicObject *model)
|
||||
return true;
|
||||
};
|
||||
|
||||
bool __fastcall TGround::RenderDL(vector3 pPosition)
|
||||
bool TGround::RenderDL(vector3 pPosition)
|
||||
{ // renderowanie scenerii z Display List - faza nieprzezroczystych
|
||||
glDisable(GL_BLEND);
|
||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartoœæ, tym wiêksza ramka, domyœlnie 0.1f
|
||||
@@ -4591,7 +4591,7 @@ bool __fastcall TGround::RenderDL(vector3 pPosition)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TGround::RenderAlphaDL(vector3 pPosition)
|
||||
bool TGround::RenderAlphaDL(vector3 pPosition)
|
||||
{ // renderowanie scenerii z Display List - faza przezroczystych
|
||||
glEnable(GL_BLEND);
|
||||
glAlphaFunc(GL_GREATER, 0.04); // im mniejsza wartoœæ, tym wiêksza ramka, domyœlnie 0.1f
|
||||
@@ -4620,7 +4620,7 @@ bool __fastcall TGround::RenderAlphaDL(vector3 pPosition)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TGround::RenderVBO(vector3 pPosition)
|
||||
bool TGround::RenderVBO(vector3 pPosition)
|
||||
{ // renderowanie scenerii z VBO - faza nieprzezroczystych
|
||||
glDisable(GL_BLEND);
|
||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartoœæ, tym wiêksza ramka, domyœlnie 0.1f
|
||||
@@ -4688,7 +4688,7 @@ bool __fastcall TGround::RenderVBO(vector3 pPosition)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool __fastcall TGround::RenderAlphaVBO(vector3 pPosition)
|
||||
bool TGround::RenderAlphaVBO(vector3 pPosition)
|
||||
{ // renderowanie scenerii z VBO - faza przezroczystych
|
||||
glEnable(GL_BLEND);
|
||||
glAlphaFunc(GL_GREATER, 0.04); // im mniejsza wartoœæ, tym wiêksza ramka, domyœlnie 0.1f
|
||||
@@ -4725,7 +4725,7 @@ bool __fastcall TGround::RenderAlphaVBO(vector3 pPosition)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::Navigate(String ClassName, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
void TGround::Navigate(String ClassName, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{ // wys³anie komunikatu do steruj¹cego
|
||||
HWND h = FindWindow(ClassName.c_str(), 0); // mo¿na by to zapamiêtaæ
|
||||
if (h == 0)
|
||||
@@ -4733,7 +4733,7 @@ void __fastcall TGround::Navigate(String ClassName, UINT Msg, WPARAM wParam, LPA
|
||||
SendMessage(h, Msg, wParam, lParam);
|
||||
};
|
||||
//--------------------------------
|
||||
void __fastcall TGround::WyslijEvent(const AnsiString &e, const AnsiString &d)
|
||||
void TGround::WyslijEvent(const AnsiString &e, const AnsiString &d)
|
||||
{ // Ra: jeszcze do wyczyszczenia
|
||||
DaneRozkaz r;
|
||||
r.iSygn = 'EU07';
|
||||
@@ -4750,7 +4750,7 @@ void __fastcall TGround::WyslijEvent(const AnsiString &e, const AnsiString &d)
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::WyslijString(const AnsiString &t, int n)
|
||||
void TGround::WyslijString(const AnsiString &t, int n)
|
||||
{ // wys³anie informacji w postaci pojedynczego tekstu
|
||||
DaneRozkaz r;
|
||||
r.iSygn = 'EU07';
|
||||
@@ -4765,12 +4765,12 @@ void __fastcall TGround::WyslijString(const AnsiString &t, int n)
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::WyslijWolny(const AnsiString &t)
|
||||
void TGround::WyslijWolny(const AnsiString &t)
|
||||
{ // Ra: jeszcze do wyczyszczenia
|
||||
WyslijString(t, 4); // tor wolny
|
||||
};
|
||||
//--------------------------------
|
||||
void __fastcall TGround::WyslijNamiary(TGroundNode *t)
|
||||
void TGround::WyslijNamiary(TGroundNode *t)
|
||||
{ // wys³anie informacji o pojeŸdzie - (float), d³ugoœæ ramki bêdzie zwiêkszana w miarê potrzeby
|
||||
// WriteLog("Wysylam pojazd");
|
||||
DaneRozkaz r;
|
||||
@@ -4844,7 +4844,7 @@ void __fastcall TGround::WyslijNamiary(TGroundNode *t)
|
||||
// WriteLog("Ramka poszla!");
|
||||
};
|
||||
//--------------------------------
|
||||
void __fastcall TGround::WyslijParam(int nr, int fl)
|
||||
void TGround::WyslijParam(int nr, int fl)
|
||||
{ // wys³anie parametrów symulacji w ramce (nr) z flagami (fl)
|
||||
DaneRozkaz r;
|
||||
r.iSygn = 'EU07';
|
||||
@@ -4868,7 +4868,7 @@ void __fastcall TGround::WyslijParam(int nr, int fl)
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::RadioStop(vector3 pPosition)
|
||||
void TGround::RadioStop(vector3 pPosition)
|
||||
{ // zatrzymanie poci¹gów w okolicy
|
||||
TGroundNode *node;
|
||||
TSubRect *tmp;
|
||||
@@ -4946,7 +4946,7 @@ TDynamicObject *__fastcall TGround::CouplerNearest(vector3 pPosition, double dis
|
||||
return dyn;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::DynamicRemove(TDynamicObject *dyn)
|
||||
void TGround::DynamicRemove(TDynamicObject *dyn)
|
||||
{ // Ra: usuniêcie pojazdów ze scenerii (gdy dojad¹ na koniec i nie sa potrzebne)
|
||||
TDynamicObject *d = dyn->Prev();
|
||||
if (d) // jeœli coœ jest z przodu
|
||||
@@ -4980,12 +4980,12 @@ void __fastcall TGround::DynamicRemove(TDynamicObject *dyn)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::TerrainRead(const AnsiString &f){
|
||||
void TGround::TerrainRead(const AnsiString &f){
|
||||
// Ra: wczytanie trójk¹tów terenu z pliku E3D
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TGround::TerrainWrite()
|
||||
void TGround::TerrainWrite()
|
||||
{ // Ra: zapisywanie trójk¹tów terenu do pliku E3D
|
||||
if (Global::pTerrainCompact->TerrainLoaded())
|
||||
return; // jeœli zosta³o wczytane, to nie ma co dalej robiæ
|
||||
@@ -5076,7 +5076,7 @@ void __fastcall TGround::TerrainWrite()
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TGround::TrackBusyList()
|
||||
void TGround::TrackBusyList()
|
||||
{ // wys³anie informacji o wszystkich zajêtych odcinkach
|
||||
TGroundNode *Current;
|
||||
TTrack *Track;
|
||||
@@ -5088,7 +5088,7 @@ void __fastcall TGround::TrackBusyList()
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TGround::IsolatedBusyList()
|
||||
void TGround::IsolatedBusyList()
|
||||
{ // wys³anie informacji o wszystkich odcinkach izolowanych
|
||||
TIsolated *Current;
|
||||
for (Current = TIsolated::Root(); Current; Current = Current->Next())
|
||||
@@ -5100,7 +5100,7 @@ void __fastcall TGround::IsolatedBusyList()
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TGround::IsolatedBusy(const AnsiString t)
|
||||
void TGround::IsolatedBusy(const AnsiString t)
|
||||
{ // wys³anie informacji o odcinku izolowanym (t)
|
||||
// Ra 2014-06: do wyszukania u¿yæ drzewka nazw
|
||||
TIsolated *Current;
|
||||
@@ -5115,7 +5115,7 @@ void __fastcall TGround::IsolatedBusy(const AnsiString t)
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TGround::Silence(vector3 gdzie)
|
||||
void TGround::Silence(vector3 gdzie)
|
||||
{ // wyciszenie wszystkiego w sektorach przed przeniesieniem kamery z (gdzie)
|
||||
int tr, tc;
|
||||
TGroundNode *node;
|
||||
|
||||
174
Ground.h
174
Ground.h
@@ -127,16 +127,16 @@ class TGroundNode : public Resource
|
||||
TGroundNode *nNext; // lista wszystkich w scenerii, ostatni na początku
|
||||
TGroundNode *nNext2; // lista obiektów w sektorze
|
||||
TGroundNode *nNext3; // lista obiektów renderowanych we wspólnym cyklu
|
||||
__fastcall TGroundNode();
|
||||
__fastcall TGroundNode(TGroundNodeType t, int n = 0);
|
||||
__fastcall ~TGroundNode();
|
||||
void __fastcall Init(int n);
|
||||
void __fastcall InitCenter(); // obliczenie współrzędnych środka
|
||||
void __fastcall InitNormals();
|
||||
TGroundNode();
|
||||
TGroundNode(TGroundNodeType t, int n = 0);
|
||||
~TGroundNode();
|
||||
void Init(int n);
|
||||
void InitCenter(); // obliczenie współrzędnych środka
|
||||
void InitNormals();
|
||||
|
||||
void __fastcall MoveMe(vector3 pPosition); // przesuwanie (nie działa)
|
||||
void MoveMe(vector3 pPosition); // przesuwanie (nie działa)
|
||||
|
||||
// bool __fastcall Disable();
|
||||
// bool Disable();
|
||||
inline TGroundNode *__fastcall Find(const AnsiString &asNameToFind, TGroundNodeType iNodeType)
|
||||
{ // wyszukiwanie czołgowe z typem
|
||||
if ((iNodeType == iType) && (asNameToFind == asName))
|
||||
@@ -146,17 +146,17 @@ class TGroundNode : public Resource
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void __fastcall Compile(bool many = false);
|
||||
void Compile(bool many = false);
|
||||
void Release();
|
||||
bool __fastcall GetTraction();
|
||||
bool GetTraction();
|
||||
|
||||
void __fastcall RenderHidden(); // obsługa dźwięków i wyzwalaczy zdarzeń
|
||||
void __fastcall RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||
void __fastcall RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||
void RenderHidden(); // obsługa dźwięków i wyzwalaczy zdarzeń
|
||||
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||
// (McZapkie-131202)
|
||||
void __fastcall RaRenderVBO(); // renderowanie (nieprzezroczystych) ze wspólnego VBO
|
||||
void __fastcall RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||
void __fastcall RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||
void RaRenderVBO(); // renderowanie (nieprzezroczystych) ze wspólnego VBO
|
||||
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||
};
|
||||
|
||||
class TSubRect : public Resource, public CMesh
|
||||
@@ -181,27 +181,27 @@ class TSubRect : public Resource, public CMesh
|
||||
TGroundNode *nRenderAlpha; // indywidualnie - przezroczyste (nNext3)
|
||||
int iNodeCount; // licznik obiektów, do pomijania pustych sektorów
|
||||
public:
|
||||
void __fastcall LoadNodes(); // utworzenie VBO sektora
|
||||
void LoadNodes(); // utworzenie VBO sektora
|
||||
public:
|
||||
__fastcall TSubRect();
|
||||
virtual __fastcall ~TSubRect();
|
||||
TSubRect();
|
||||
virtual ~TSubRect();
|
||||
virtual void Release(); // zwalnianie VBO sektora
|
||||
void __fastcall NodeAdd(
|
||||
void NodeAdd(
|
||||
TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory
|
||||
void __fastcall RaNodeAdd(TGroundNode *Node); // dodanie obiektu do listy renderowania
|
||||
void __fastcall Sort(); // optymalizacja obiektów w sektorze (sortowanie wg tekstur)
|
||||
void RaNodeAdd(TGroundNode *Node); // dodanie obiektu do listy renderowania
|
||||
void Sort(); // optymalizacja obiektów w sektorze (sortowanie wg tekstur)
|
||||
TTrack *__fastcall FindTrack(vector3 *Point, int &iConnection, TTrack *Exclude);
|
||||
TTraction *__fastcall FindTraction(vector3 *Point, int &iConnection, TTraction *Exclude);
|
||||
bool __fastcall StartVBO(); // ustwienie VBO sektora dla (nRenderRect), (nRenderRectAlpha) i
|
||||
bool StartVBO(); // ustwienie VBO sektora dla (nRenderRect), (nRenderRectAlpha) i
|
||||
// (nRenderWires)
|
||||
bool __fastcall RaTrackAnimAdd(TTrack *t); // zgłoszenie toru do animacji
|
||||
void __fastcall RaAnimate(); // przeliczenie animacji torów
|
||||
void __fastcall RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||
void __fastcall RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||
bool RaTrackAnimAdd(TTrack *t); // zgłoszenie toru do animacji
|
||||
void RaAnimate(); // przeliczenie animacji torów
|
||||
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||
// (McZapkie-131202)
|
||||
void __fastcall RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||
void __fastcall RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||
void __fastcall RenderSounds(); // dźwięki pojazdów z niewidocznych sektorów
|
||||
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||
void RenderSounds(); // dźwięki pojazdów z niewidocznych sektorów
|
||||
};
|
||||
|
||||
// Ra: trzeba sprawdzić wydajność siatki
|
||||
@@ -220,13 +220,13 @@ class TGroundRect : public TSubRect
|
||||
private:
|
||||
int iLastDisplay; // numer klatki w której był ostatnio wyświetlany
|
||||
TSubRect *pSubRects;
|
||||
void __fastcall Init() { pSubRects = new TSubRect[iNumSubRects * iNumSubRects]; };
|
||||
void Init() { pSubRects = new TSubRect[iNumSubRects * iNumSubRects]; };
|
||||
|
||||
public:
|
||||
static int iFrameNumber; // numer kolejny wyświetlanej klatki
|
||||
TGroundNode *nTerrain; // model terenu z E3D - użyć nRootMesh?
|
||||
__fastcall TGroundRect();
|
||||
virtual __fastcall ~TGroundRect();
|
||||
TGroundRect();
|
||||
virtual ~TGroundRect();
|
||||
|
||||
TSubRect *__fastcall SafeGetRect(int iCol, int iRow)
|
||||
{ // pobranie wskaźnika do małego kwadratu, utworzenie jeśli trzeba
|
||||
@@ -238,14 +238,14 @@ class TGroundRect : public TSubRect
|
||||
{ // pobranie wskaźnika do małego kwadratu, bez tworzenia jeśli nie ma
|
||||
return (pSubRects ? pSubRects + iRow * iNumSubRects + iCol : NULL);
|
||||
};
|
||||
void __fastcall Optimize()
|
||||
void Optimize()
|
||||
{ // optymalizacja obiektów w sektorach
|
||||
if (pSubRects)
|
||||
for (int i = iNumSubRects * iNumSubRects - 1; i >= 0; --i)
|
||||
pSubRects[i].Sort(); // optymalizacja obiektów w sektorach
|
||||
};
|
||||
void __fastcall RenderDL();
|
||||
void __fastcall RenderVBO();
|
||||
void RenderDL();
|
||||
void RenderVBO();
|
||||
};
|
||||
|
||||
class TGround
|
||||
@@ -269,7 +269,7 @@ class TGround
|
||||
// int tracks,tracksfar; //liczniki torów
|
||||
TNames *sTracks; // posortowane nazwy torów i eventów
|
||||
private: // metody prywatne
|
||||
bool __fastcall EventConditon(TEvent *e);
|
||||
bool EventConditon(TEvent *e);
|
||||
|
||||
public:
|
||||
bool bDynamicRemove; // czy uruchomić procedurę usuwania pojazdów
|
||||
@@ -278,21 +278,21 @@ class TGround
|
||||
// double fVDozwolona;
|
||||
// bool bTrabil;
|
||||
|
||||
__fastcall TGround();
|
||||
__fastcall ~TGround();
|
||||
void __fastcall Free();
|
||||
bool __fastcall Init(AnsiString asFile, HDC hDC);
|
||||
void __fastcall FirstInit();
|
||||
void __fastcall InitTracks();
|
||||
void __fastcall InitTraction();
|
||||
bool __fastcall InitEvents();
|
||||
bool __fastcall InitLaunchers();
|
||||
TGround();
|
||||
~TGround();
|
||||
void Free();
|
||||
bool Init(AnsiString asFile, HDC hDC);
|
||||
void FirstInit();
|
||||
void InitTracks();
|
||||
void InitTraction();
|
||||
bool InitEvents();
|
||||
bool InitLaunchers();
|
||||
TTrack *__fastcall FindTrack(vector3 Point, int &iConnection, TGroundNode *Exclude);
|
||||
TTraction *__fastcall FindTraction(vector3 *Point, int &iConnection, TGroundNode *Exclude);
|
||||
TTraction *__fastcall TractionNearestFind(vector3 &p, int dir, TGroundNode *n);
|
||||
// TGroundNode* __fastcall CreateGroundNode();
|
||||
// TGroundNode* CreateGroundNode();
|
||||
TGroundNode *__fastcall AddGroundNode(cParser *parser);
|
||||
bool __fastcall AddGroundNode(double x, double z, TGroundNode *Node)
|
||||
bool AddGroundNode(double x, double z, TGroundNode *Node)
|
||||
{
|
||||
TSubRect *tmp = GetSubRect(x, z);
|
||||
if (tmp)
|
||||
@@ -303,30 +303,30 @@ class TGround
|
||||
else
|
||||
return false;
|
||||
};
|
||||
// bool __fastcall Include(TQueryParserComp *Parser);
|
||||
// TGroundNode* __fastcall GetVisible(AnsiString asName);
|
||||
// bool Include(TQueryParserComp *Parser);
|
||||
// TGroundNode* GetVisible(AnsiString asName);
|
||||
TGroundNode *__fastcall GetNode(AnsiString asName);
|
||||
bool __fastcall AddDynamic(TGroundNode *Node);
|
||||
void __fastcall MoveGroundNode(vector3 pPosition);
|
||||
void __fastcall UpdatePhys(double dt, int iter); // aktualizacja fizyki stałym krokiem
|
||||
bool __fastcall Update(double dt, int iter); // aktualizacja przesunięć zgodna z FPS
|
||||
bool __fastcall AddToQuery(TEvent *Event, TDynamicObject *Node);
|
||||
bool __fastcall GetTraction(TDynamicObject *model);
|
||||
bool __fastcall RenderDL(vector3 pPosition);
|
||||
bool __fastcall RenderAlphaDL(vector3 pPosition);
|
||||
bool __fastcall RenderVBO(vector3 pPosition);
|
||||
bool __fastcall RenderAlphaVBO(vector3 pPosition);
|
||||
bool __fastcall CheckQuery();
|
||||
// __fastcall GetRect(double x, double z) { return
|
||||
bool AddDynamic(TGroundNode *Node);
|
||||
void MoveGroundNode(vector3 pPosition);
|
||||
void UpdatePhys(double dt, int iter); // aktualizacja fizyki stałym krokiem
|
||||
bool Update(double dt, int iter); // aktualizacja przesunięć zgodna z FPS
|
||||
bool AddToQuery(TEvent *Event, TDynamicObject *Node);
|
||||
bool GetTraction(TDynamicObject *model);
|
||||
bool RenderDL(vector3 pPosition);
|
||||
bool RenderAlphaDL(vector3 pPosition);
|
||||
bool RenderVBO(vector3 pPosition);
|
||||
bool RenderAlphaVBO(vector3 pPosition);
|
||||
bool CheckQuery();
|
||||
// GetRect(double x, double z) { return
|
||||
// &(Rects[int(x/fSubRectSize+fHalfNumRects)][int(z/fSubRectSize+fHalfNumRects)]); };
|
||||
/*
|
||||
int __fastcall GetRowFromZ(double z) { return (z/fRectSize+fHalfNumRects); };
|
||||
int __fastcall GetColFromX(double x) { return (x/fRectSize+fHalfNumRects); };
|
||||
int __fastcall GetSubRowFromZ(double z) { return (z/fSubRectSize+fHalfNumSubRects); };
|
||||
int __fastcall GetSubColFromX(double x) { return (x/fSubRectSize+fHalfNumSubRects); };
|
||||
int GetRowFromZ(double z) { return (z/fRectSize+fHalfNumRects); };
|
||||
int GetColFromX(double x) { return (x/fRectSize+fHalfNumRects); };
|
||||
int GetSubRowFromZ(double z) { return (z/fSubRectSize+fHalfNumSubRects); };
|
||||
int GetSubColFromX(double x) { return (x/fSubRectSize+fHalfNumSubRects); };
|
||||
*/
|
||||
/*
|
||||
inline TGroundNode* __fastcall FindGroundNode(const AnsiString &asNameToFind )
|
||||
inline TGroundNode* FindGroundNode(const AnsiString &asNameToFind )
|
||||
{
|
||||
if (RootNode)
|
||||
return (RootNode->Find( asNameToFind ));
|
||||
@@ -336,7 +336,7 @@ class TGround
|
||||
*/
|
||||
TGroundNode *__fastcall DynamicFindAny(AnsiString asNameToFind);
|
||||
TGroundNode *__fastcall DynamicFind(AnsiString asNameToFind);
|
||||
void __fastcall DynamicList(bool all = false);
|
||||
void DynamicList(bool all = false);
|
||||
TGroundNode *__fastcall FindGroundNode(AnsiString asNameToFind, TGroundNodeType iNodeType);
|
||||
TGroundRect *__fastcall GetRect(double x, double z)
|
||||
{
|
||||
@@ -352,37 +352,37 @@ class TGround
|
||||
};
|
||||
TSubRect *__fastcall GetSubRect(int iCol, int iRow);
|
||||
TSubRect *__fastcall FastGetSubRect(int iCol, int iRow);
|
||||
int __fastcall GetRowFromZ(double z) { return (z / fSubRectSize + fHalfTotalNumSubRects); };
|
||||
int __fastcall GetColFromX(double x) { return (x / fSubRectSize + fHalfTotalNumSubRects); };
|
||||
int GetRowFromZ(double z) { return (z / fSubRectSize + fHalfTotalNumSubRects); };
|
||||
int GetColFromX(double x) { return (x / fSubRectSize + fHalfTotalNumSubRects); };
|
||||
TEvent *__fastcall FindEvent(const AnsiString &asEventName);
|
||||
TEvent *__fastcall FindEventScan(const AnsiString &asEventName);
|
||||
void __fastcall TrackJoin(TGroundNode *Current);
|
||||
void TrackJoin(TGroundNode *Current);
|
||||
|
||||
private:
|
||||
void __fastcall OpenGLUpdate(HDC hDC);
|
||||
void __fastcall RaTriangleDivider(TGroundNode *node);
|
||||
void __fastcall Navigate(String ClassName, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
void OpenGLUpdate(HDC hDC);
|
||||
void RaTriangleDivider(TGroundNode *node);
|
||||
void Navigate(String ClassName, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
bool PROBLEND;
|
||||
|
||||
public:
|
||||
void __fastcall WyslijEvent(const AnsiString &e, const AnsiString &d);
|
||||
void WyslijEvent(const AnsiString &e, const AnsiString &d);
|
||||
int iRendered; // ilość renderowanych sektorów, pobierana przy pokazywniu FPS
|
||||
void __fastcall WyslijString(const AnsiString &t, int n);
|
||||
void __fastcall WyslijWolny(const AnsiString &t);
|
||||
void __fastcall WyslijNamiary(TGroundNode *t);
|
||||
void __fastcall WyslijParam(int nr, int fl);
|
||||
void __fastcall RadioStop(vector3 pPosition);
|
||||
void WyslijString(const AnsiString &t, int n);
|
||||
void WyslijWolny(const AnsiString &t);
|
||||
void WyslijNamiary(TGroundNode *t);
|
||||
void WyslijParam(int nr, int fl);
|
||||
void RadioStop(vector3 pPosition);
|
||||
TDynamicObject *__fastcall DynamicNearest(vector3 pPosition, double distance = 20.0,
|
||||
bool mech = false);
|
||||
TDynamicObject *__fastcall CouplerNearest(vector3 pPosition, double distance = 20.0,
|
||||
bool mech = false);
|
||||
void __fastcall DynamicRemove(TDynamicObject *dyn);
|
||||
void __fastcall TerrainRead(const AnsiString &f);
|
||||
void __fastcall TerrainWrite();
|
||||
void __fastcall TrackBusyList();
|
||||
void __fastcall IsolatedBusyList();
|
||||
void __fastcall IsolatedBusy(const AnsiString t);
|
||||
void __fastcall Silence(vector3 gdzie);
|
||||
void DynamicRemove(TDynamicObject *dyn);
|
||||
void TerrainRead(const AnsiString &f);
|
||||
void TerrainWrite();
|
||||
void TrackBusyList();
|
||||
void IsolatedBusyList();
|
||||
void IsolatedBusy(const AnsiString t);
|
||||
void Silence(vector3 gdzie);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
16
Logs.cpp
16
Logs.cpp
@@ -16,7 +16,7 @@ std::ofstream errors; // lista b
|
||||
|
||||
char endstring[10] = "\n";
|
||||
|
||||
void __fastcall WriteConsoleOnly(const char *str, double value)
|
||||
void WriteConsoleOnly(const char *str, double value)
|
||||
{
|
||||
char buf[255];
|
||||
sprintf(buf, "%s %f \n", str, value);
|
||||
@@ -26,7 +26,7 @@ void __fastcall WriteConsoleOnly(const char *str, double value)
|
||||
// WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),endstring,strlen(endstring),&wr,NULL);
|
||||
}
|
||||
|
||||
void __fastcall WriteConsoleOnly(const char *str)
|
||||
void WriteConsoleOnly(const char *str)
|
||||
{
|
||||
// printf("%n ffafaf /n",str);
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
@@ -36,7 +36,7 @@ void __fastcall WriteConsoleOnly(const char *str)
|
||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, strlen(endstring), &wr, NULL);
|
||||
}
|
||||
|
||||
void __fastcall WriteLog(const char *str, double value)
|
||||
void WriteLog(const char *str, double value)
|
||||
{
|
||||
if (Global::iWriteLogEnabled)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ void __fastcall WriteLog(const char *str, double value)
|
||||
}
|
||||
}
|
||||
};
|
||||
void __fastcall WriteLog(const char *str)
|
||||
void WriteLog(const char *str)
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ void __fastcall WriteLog(const char *str)
|
||||
WriteConsoleOnly(str);
|
||||
}
|
||||
};
|
||||
void __fastcall ErrorLog(const char *str)
|
||||
void ErrorLog(const char *str)
|
||||
{ // Ra: bezwarunkowa rejestracja powa¿nych b³êdów
|
||||
if (!errors.is_open())
|
||||
{
|
||||
@@ -77,19 +77,19 @@ void __fastcall ErrorLog(const char *str)
|
||||
errors.flush();
|
||||
};
|
||||
|
||||
void __fastcall Error(const AnsiString &asMessage, bool box)
|
||||
void Error(const AnsiString &asMessage, bool box)
|
||||
{
|
||||
if (box)
|
||||
MessageBox(NULL, asMessage.c_str(), AnsiString("EU07 " + Global::asRelease).c_str(), MB_OK);
|
||||
WriteLog(asMessage.c_str());
|
||||
}
|
||||
void __fastcall ErrorLog(const AnsiString &asMessage)
|
||||
void ErrorLog(const AnsiString &asMessage)
|
||||
{ // zapisywanie b³êdów "errors.txt"
|
||||
ErrorLog(asMessage.c_str());
|
||||
WriteLog(asMessage.c_str()); // do "log.txt" ewentualnie te¿
|
||||
}
|
||||
|
||||
void __fastcall WriteLog(const AnsiString &str) { // Ra: wersja z AnsiString jest zamienna z Error() WriteLog(str.c_str()); };
|
||||
void WriteLog(const AnsiString &str) { // Ra: wersja z AnsiString jest zamienna z Error() WriteLog(str.c_str()); };
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
14
Logs.h
14
Logs.h
@@ -4,12 +4,12 @@
|
||||
#define LogsH
|
||||
#include <system.hpp>
|
||||
|
||||
void __fastcall WriteConsoleOnly(const char *str, double value);
|
||||
void __fastcall WriteConsoleOnly(const char *str);
|
||||
void __fastcall WriteLog(const char *str, double value);
|
||||
void __fastcall WriteLog(const char *str);
|
||||
void __fastcall Error(const AnsiString &asMessage, bool box = true);
|
||||
void __fastcall ErrorLog(const AnsiString &asMessage);
|
||||
void __fastcall WriteLog(const AnsiString &str);
|
||||
void WriteConsoleOnly(const char *str, double value);
|
||||
void WriteConsoleOnly(const char *str);
|
||||
void WriteLog(const char *str, double value);
|
||||
void WriteLog(const char *str);
|
||||
void Error(const AnsiString &asMessage, bool box = true);
|
||||
void ErrorLog(const AnsiString &asMessage);
|
||||
void WriteLog(const AnsiString &str);
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
10
Machajka.cpp
10
Machajka.cpp
@@ -12,13 +12,13 @@ __fastcall TMachajka::TMachajka() : TTrain() { TTrain::TTrain(); }
|
||||
|
||||
__fastcall TMachajka::~TMachajka() {}
|
||||
|
||||
bool __fastcall TMachajka::Init(TDynamicObject *NewDynamicObject)
|
||||
bool TMachajka::Init(TDynamicObject *NewDynamicObject)
|
||||
{
|
||||
TTrain::Init(NewDynamicObject);
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TMachajka::OnKeyPress(int cKey)
|
||||
void TMachajka::OnKeyPress(int cKey)
|
||||
{
|
||||
if (!GetAsyncKeyState(VK_SHIFT) < 0) // bez shifta
|
||||
{
|
||||
@@ -56,11 +56,11 @@ void __fastcall TMachajka::OnKeyPress(int cKey)
|
||||
}
|
||||
}
|
||||
|
||||
bool __fastcall TMachajka::Update(double dt) { TTrain::Update(dt); }
|
||||
bool TMachajka::Update(double dt) { TTrain::Update(dt); }
|
||||
|
||||
bool __fastcall TMachajka::UpdateMechPosition() { TTrain::UpdateMechPosition(); }
|
||||
bool TMachajka::UpdateMechPosition() { TTrain::UpdateMechPosition(); }
|
||||
|
||||
bool __fastcall TMachajka::Render() { TTrain::Render(); }
|
||||
bool TMachajka::Render() { TTrain::Render(); }
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
14
Machajka.h
14
Machajka.h
@@ -16,13 +16,13 @@ class TMachajka : public TTrain
|
||||
// bool enter;
|
||||
// bool space;
|
||||
// double wa,wv;
|
||||
__fastcall TMachajka();
|
||||
virtual __fastcall ~TMachajka();
|
||||
virtual bool __fastcall Init(TDynamicObject *NewDynamicObject);
|
||||
virtual void __fastcall OnKeyPress(int cKey);
|
||||
virtual bool __fastcall Update(double dt);
|
||||
virtual bool __fastcall UpdateMechPosition();
|
||||
virtual bool __fastcall Render();
|
||||
TMachajka();
|
||||
virtual ~TMachajka();
|
||||
virtual bool Init(TDynamicObject *NewDynamicObject);
|
||||
virtual void OnKeyPress(int cKey);
|
||||
virtual bool Update(double dt);
|
||||
virtual bool UpdateMechPosition();
|
||||
virtual bool Render();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -32,7 +32,7 @@ TMdlContainer *TModelsManager::Models;
|
||||
int TModelsManager::Count;
|
||||
const MAX_MODELS = 1000;
|
||||
|
||||
void __fastcall TModelsManager::Init()
|
||||
void TModelsManager::Init()
|
||||
{
|
||||
Models = new TMdlContainer[MAX_MODELS];
|
||||
Count = 0;
|
||||
@@ -50,7 +50,7 @@ __fastcall TModelsManager::~TModelsManager()
|
||||
Free();
|
||||
};
|
||||
*/
|
||||
void __fastcall TModelsManager::Free() { SafeDeleteArray(Models); }
|
||||
void TModelsManager::Free() { SafeDeleteArray(Models); }
|
||||
|
||||
TModel3d *__fastcall TModelsManager::LoadModel(char *Name, bool dynamic)
|
||||
{ // wczytanie modelu do tablicy
|
||||
@@ -169,7 +169,7 @@ TModel3d *__fastcall TModelsManager::GetModel(const char *Name, bool dynamic)
|
||||
};
|
||||
|
||||
/*
|
||||
TModel3d __fastcall TModelsManager::GetModel(char *Name, AnsiString asReplacableTexture)
|
||||
TModel3d TModelsManager::GetModel(char *Name, AnsiString asReplacableTexture)
|
||||
{
|
||||
GLuint ReplacableTextureID= 0;
|
||||
TModel3d NewModel;
|
||||
|
||||
12
MdlMngr.h
12
MdlMngr.h
@@ -8,12 +8,12 @@
|
||||
class TMdlContainer
|
||||
{
|
||||
friend class TModelsManager;
|
||||
__fastcall TMdlContainer()
|
||||
TMdlContainer()
|
||||
{
|
||||
Name = NULL;
|
||||
Model = NULL;
|
||||
};
|
||||
__fastcall ~TMdlContainer()
|
||||
~TMdlContainer()
|
||||
{
|
||||
SafeDeleteArray(Name);
|
||||
SafeDelete(Model);
|
||||
@@ -31,10 +31,10 @@ class TModelsManager
|
||||
static TModel3d *__fastcall LoadModel(char *Name, bool dynamic);
|
||||
|
||||
public:
|
||||
// __fastcall TModelsManager();
|
||||
// __fastcall ~TModelsManager();
|
||||
static void __fastcall Init();
|
||||
static void __fastcall Free();
|
||||
// TModelsManager();
|
||||
// ~TModelsManager();
|
||||
static void Init();
|
||||
static void Free();
|
||||
// McZapkie: dodalem sciezke, notabene Path!=Patch :)
|
||||
static TModel3d *__fastcall GetModel(const char *Name, bool dynamic = false);
|
||||
};
|
||||
|
||||
20
MemCell.cpp
20
MemCell.cpp
@@ -36,9 +36,9 @@ __fastcall TMemCell::TMemCell(vector3 *p)
|
||||
|
||||
__fastcall TMemCell::~TMemCell() { SafeDeleteArray(szText); }
|
||||
|
||||
void __fastcall TMemCell::Init() {}
|
||||
void TMemCell::Init() {}
|
||||
|
||||
void __fastcall TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
void TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
int CheckMask)
|
||||
{
|
||||
if (CheckMask & update_memadd)
|
||||
@@ -63,7 +63,7 @@ void __fastcall TMemCell::UpdateValues(char *szNewText, double fNewValue1, doubl
|
||||
CommandCheck(); // jeœli zmieniony tekst, próbujemy rozpoznaæ komendê
|
||||
}
|
||||
|
||||
TCommandType __fastcall TMemCell::CommandCheck()
|
||||
TCommandType TMemCell::CommandCheck()
|
||||
{ // rozpoznanie komendy
|
||||
if (strcmp(szText, "SetVelocity") == 0) // najpopularniejsze
|
||||
{
|
||||
@@ -103,7 +103,7 @@ TCommandType __fastcall TMemCell::CommandCheck()
|
||||
return eCommand;
|
||||
}
|
||||
|
||||
bool __fastcall TMemCell::Load(cParser *parser)
|
||||
bool TMemCell::Load(cParser *parser)
|
||||
{
|
||||
std::string token;
|
||||
parser->getTokens(1, false); // case sensitive
|
||||
@@ -127,13 +127,13 @@ bool __fastcall TMemCell::Load(cParser *parser)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TMemCell::PutCommand(TController *Mech, vector3 *Loc)
|
||||
void TMemCell::PutCommand(TController *Mech, vector3 *Loc)
|
||||
{ // wys³anie zawartoœci komórki do AI
|
||||
if (Mech)
|
||||
Mech->PutCommand(szText, fValue1, fValue2, Loc);
|
||||
}
|
||||
|
||||
bool __fastcall TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
int CheckMask)
|
||||
{ // porównanie zawartoœci komórki pamiêci z podanymi wartoœciami
|
||||
if (TestFlag(CheckMask, conditional_memstring))
|
||||
@@ -154,9 +154,9 @@ bool __fastcall TMemCell::Compare(char *szTestText, double fTestValue1, double f
|
||||
(!TestFlag(CheckMask, conditional_memval2) || (fValue2 == fTestValue2)));
|
||||
};
|
||||
|
||||
bool __fastcall TMemCell::Render() { return true; }
|
||||
bool TMemCell::Render() { return true; }
|
||||
|
||||
bool __fastcall TMemCell::IsVelocity()
|
||||
bool TMemCell::IsVelocity()
|
||||
{ // sprawdzenie, czy event odczytu tej komórki ma byæ do skanowania, czy do kolejkowania
|
||||
if (eCommand == cm_SetVelocity)
|
||||
return true;
|
||||
@@ -165,7 +165,7 @@ bool __fastcall TMemCell::IsVelocity()
|
||||
return (eCommand == cm_SetProximityVelocity);
|
||||
};
|
||||
|
||||
void __fastcall TMemCell::StopCommandSent()
|
||||
void TMemCell::StopCommandSent()
|
||||
{ //
|
||||
if (!bCommand)
|
||||
return;
|
||||
@@ -174,4 +174,4 @@ void __fastcall TMemCell::StopCommandSent()
|
||||
Global::AddToQuery(OnSent, NULL);
|
||||
};
|
||||
|
||||
void __fastcall TMemCell::AssignEvents(TEvent *e) { // powi¹zanie eventu OnSent = e; };
|
||||
void TMemCell::AssignEvents(TEvent *e) { // powi¹zanie eventu OnSent = e; };
|
||||
|
||||
34
MemCell.h
34
MemCell.h
@@ -20,26 +20,26 @@ class TMemCell
|
||||
public:
|
||||
AnsiString
|
||||
asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
||||
__fastcall TMemCell(vector3 *p);
|
||||
__fastcall ~TMemCell();
|
||||
void __fastcall Init();
|
||||
void __fastcall UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
TMemCell(vector3 *p);
|
||||
~TMemCell();
|
||||
void Init();
|
||||
void UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
int CheckMask);
|
||||
bool __fastcall Load(cParser *parser);
|
||||
void __fastcall PutCommand(TController *Mech, vector3 *Loc);
|
||||
bool __fastcall Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
bool Load(cParser *parser);
|
||||
void PutCommand(TController *Mech, vector3 *Loc);
|
||||
bool Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
int CheckMask);
|
||||
bool __fastcall Render();
|
||||
bool Render();
|
||||
inline char *__fastcall Text() { return szText; };
|
||||
inline double __fastcall Value1() { return fValue1; };
|
||||
inline double __fastcall Value2() { return fValue2; };
|
||||
inline vector3 __fastcall Position() { return vPosition; };
|
||||
inline TCommandType __fastcall Command() { return eCommand; };
|
||||
inline bool __fastcall StopCommand() { return bCommand; };
|
||||
void __fastcall StopCommandSent();
|
||||
TCommandType __fastcall CommandCheck();
|
||||
bool __fastcall IsVelocity();
|
||||
void __fastcall AssignEvents(TEvent *e);
|
||||
inline double Value1() { return fValue1; };
|
||||
inline double Value2() { return fValue2; };
|
||||
inline vector3 Position() { return vPosition; };
|
||||
inline TCommandType Command() { return eCommand; };
|
||||
inline bool StopCommand() { return bCommand; };
|
||||
void StopCommandSent();
|
||||
TCommandType CommandCheck();
|
||||
bool IsVelocity();
|
||||
void AssignEvents(TEvent *e);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
104
Model3d.cpp
104
Model3d.cpp
@@ -64,7 +64,7 @@ __fastcall TSubModel::TSubModel()
|
||||
FirstInit();
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::FirstInit()
|
||||
void TSubModel::FirstInit()
|
||||
{
|
||||
eType = TP_ROTATOR;
|
||||
Vertices = NULL;
|
||||
@@ -137,7 +137,7 @@ __fastcall TSubModel::~TSubModel()
|
||||
delete[] smLetter; // u¿ywany tylko roboczo dla TP_TEXT, do przyspieszenia wyœwietlania
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::TextureNameSet(const char *n)
|
||||
void TSubModel::TextureNameSet(const char *n)
|
||||
{ // ustawienie nazwy submodelu, o ile nie jest wczytany z E3D
|
||||
if (iFlags & 0x0200)
|
||||
{ // tylko je¿eli submodel zosta utworzony przez new
|
||||
@@ -153,7 +153,7 @@ void __fastcall TSubModel::TextureNameSet(const char *n)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::NameSet(const char *n)
|
||||
void TSubModel::NameSet(const char *n)
|
||||
{ // ustawienie nazwy submodelu, o ile nie jest wczytany z E3D
|
||||
if (iFlags & 0x0200)
|
||||
{ // tylko je¿eli submodel zosta utworzony przez new
|
||||
@@ -169,9 +169,9 @@ void __fastcall TSubModel::NameSet(const char *n)
|
||||
}
|
||||
};
|
||||
|
||||
// int __fastcall TSubModel::SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||
// int TSubModel::SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||
// *Vertices)
|
||||
int __fastcall TSubModel::SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt,
|
||||
int TSubModel::SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt,
|
||||
float8 *Vertices)
|
||||
{ // 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
|
||||
@@ -233,7 +233,7 @@ inline void readMatrix(cParser &parser, float4x4 &matrix)
|
||||
parser.getToken(matrix(x)[y]);
|
||||
};
|
||||
|
||||
int __fastcall TSubModel::Load(cParser &parser, TModel3d *Model, int Pos, bool dynamic)
|
||||
int TSubModel::Load(cParser &parser, TModel3d *Model, int Pos, bool dynamic)
|
||||
{ // Ra: VBO tworzone na poziomie modelu, a nie submodeli
|
||||
iNumVerts = 0;
|
||||
iVboPtr = Pos; // pozycja w VBO
|
||||
@@ -597,7 +597,7 @@ int __fastcall TSubModel::Load(cParser &parser, TModel3d *Model, int Pos, bool d
|
||||
return iNumVerts; // do okreœlenia wielkoœci VBO
|
||||
};
|
||||
|
||||
int __fastcall TSubModel::TriangleAdd(TModel3d *m, int tex, int tri)
|
||||
int TSubModel::TriangleAdd(TModel3d *m, int tex, int tri)
|
||||
{ // dodanie trójk¹tów do submodelu, u¿ywane przy tworzeniu E3D terenu
|
||||
TSubModel *s = this;
|
||||
while (s ? (s->TextureID != tex) : false)
|
||||
@@ -653,7 +653,7 @@ float8 *__fastcall TSubModel::TrianglePtr(int tex, int pos, int *la, int *ld, in
|
||||
return s->Vertices + pos; // wskaŸnik na wolne miejsce w tabeli wierzcho³ków
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::DisplayLists()
|
||||
void TSubModel::DisplayLists()
|
||||
{ // utworznie po jednej skompilowanej liœcie dla ka¿dego submodelu
|
||||
if (Global::bUseVBO)
|
||||
return; // Ra: przy VBO to siê nie przyda
|
||||
@@ -739,7 +739,7 @@ void __fastcall TSubModel::DisplayLists()
|
||||
Next->DisplayLists();
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::InitialRotate(bool doit)
|
||||
void TSubModel::InitialRotate(bool doit)
|
||||
{ // konwersja uk³adu wspó³rzêdnych na zgodny ze sceneri¹
|
||||
if (iFlags & 0xC000) // jeœli jest animacja albo niejednostkowy transform
|
||||
{ // niejednostkowy transform jest mno¿ony i wystarczy zabawy
|
||||
@@ -801,7 +801,7 @@ void __fastcall TSubModel::InitialRotate(bool doit)
|
||||
Next->InitialRotate(doit);
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::ChildAdd(TSubModel *SubModel)
|
||||
void TSubModel::ChildAdd(TSubModel *SubModel)
|
||||
{ // dodanie submodelu potemnego (uzale¿nionego)
|
||||
// Ra: zmiana kolejnoœci, ¿eby kolejne móc renderowaæ po aktualnym (by³o przed)
|
||||
if (SubModel)
|
||||
@@ -809,7 +809,7 @@ void __fastcall TSubModel::ChildAdd(TSubModel *SubModel)
|
||||
Child = SubModel;
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::NextAdd(TSubModel *SubModel)
|
||||
void TSubModel::NextAdd(TSubModel *SubModel)
|
||||
{ // dodanie submodelu kolejnego (wspólny przodek)
|
||||
if (Next)
|
||||
Next->NextAdd(SubModel);
|
||||
@@ -817,7 +817,7 @@ void __fastcall TSubModel::NextAdd(TSubModel *SubModel)
|
||||
Next = SubModel;
|
||||
};
|
||||
|
||||
int __fastcall TSubModel::FlagsCheck()
|
||||
int TSubModel::FlagsCheck()
|
||||
{ // analiza koniecznych zmian pomiêdzy submodelami
|
||||
// samo pomijanie glBindTexture() nie poprawi wydajnoœci
|
||||
// ale mo¿na sprawdziæ, czy mo¿na w ogóle pomin¹æ kod do tekstur (sprawdzanie replaceskin)
|
||||
@@ -853,7 +853,7 @@ int __fastcall TSubModel::FlagsCheck()
|
||||
return iFlags;
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
|
||||
void TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
|
||||
{ // obrócenie submodelu wg podanej osi (np. wskazówki w kabinie)
|
||||
v_RotateAxis = vNewRotateAxis;
|
||||
f_Angle = fNewAngle;
|
||||
@@ -865,7 +865,7 @@ void __fastcall TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
}
|
||||
|
||||
void __fastcall TSubModel::SetRotateXYZ(float3 vNewAngles)
|
||||
void TSubModel::SetRotateXYZ(float3 vNewAngles)
|
||||
{ // obrócenie submodelu o podane k¹ty wokó³ osi lokalnego uk³adu
|
||||
v_Angles = vNewAngles;
|
||||
b_Anim = at_RotateXYZ;
|
||||
@@ -873,7 +873,7 @@ void __fastcall TSubModel::SetRotateXYZ(float3 vNewAngles)
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
}
|
||||
|
||||
void __fastcall TSubModel::SetRotateXYZ(vector3 vNewAngles)
|
||||
void TSubModel::SetRotateXYZ(vector3 vNewAngles)
|
||||
{ // obrócenie submodelu o podane k¹ty wokó³ osi lokalnego uk³adu
|
||||
v_Angles.x = vNewAngles.x;
|
||||
v_Angles.y = vNewAngles.y;
|
||||
@@ -883,7 +883,7 @@ void __fastcall TSubModel::SetRotateXYZ(vector3 vNewAngles)
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
}
|
||||
|
||||
void __fastcall TSubModel::SetTranslate(float3 vNewTransVector)
|
||||
void TSubModel::SetTranslate(float3 vNewTransVector)
|
||||
{ // przesuniêcie submodelu (np. w kabinie)
|
||||
v_TransVector = vNewTransVector;
|
||||
b_Anim = at_Translate;
|
||||
@@ -891,7 +891,7 @@ void __fastcall TSubModel::SetTranslate(float3 vNewTransVector)
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
}
|
||||
|
||||
void __fastcall TSubModel::SetTranslate(vector3 vNewTransVector)
|
||||
void TSubModel::SetTranslate(vector3 vNewTransVector)
|
||||
{ // przesuniêcie submodelu (np. w kabinie)
|
||||
v_TransVector.x = vNewTransVector.x;
|
||||
v_TransVector.y = vNewTransVector.y;
|
||||
@@ -901,7 +901,7 @@ void __fastcall TSubModel::SetTranslate(vector3 vNewTransVector)
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
}
|
||||
|
||||
void __fastcall TSubModel::SetRotateIK1(float3 vNewAngles)
|
||||
void TSubModel::SetRotateIK1(float3 vNewAngles)
|
||||
{ // obrócenie submodelu o podane k¹ty wokó³ osi lokalnego uk³adu
|
||||
v_Angles = vNewAngles;
|
||||
iAnimOwner = iInstance; // zapamiêtanie czyja jest animacja
|
||||
@@ -945,7 +945,7 @@ TSubModel *__fastcall TSubModel::GetFromName(char *search, bool i)
|
||||
|
||||
// WORD hbIndices[18]={3,0,1,5,4,2,1,0,4,1,5,3,2,3,5,2,4,0};
|
||||
|
||||
void __fastcall TSubModel::RaAnimation(TAnimType a)
|
||||
void TSubModel::RaAnimation(TAnimType a)
|
||||
{ // wykonanie animacji niezale¿nie od renderowania
|
||||
switch (a)
|
||||
{ // korekcja po³o¿enia, jeœli submodel jest animowany
|
||||
@@ -1041,7 +1041,7 @@ void __fastcall TSubModel::RaAnimation(TAnimType a)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::RenderDL()
|
||||
void TSubModel::RenderDL()
|
||||
{ // g³ówna procedura renderowania przez DL
|
||||
if (iVisible && (fSquareDist >= fSquareMinDist) && (fSquareDist < fSquareMaxDist))
|
||||
{
|
||||
@@ -1136,7 +1136,7 @@ void __fastcall TSubModel::RenderDL()
|
||||
Next->RenderDL(); // dalsze rekurencyjnie
|
||||
}; // Render
|
||||
|
||||
void __fastcall TSubModel::RenderAlphaDL()
|
||||
void TSubModel::RenderAlphaDL()
|
||||
{ // renderowanie przezroczystych przez DL
|
||||
if (iVisible && (fSquareDist >= fSquareMinDist) && (fSquareDist < fSquareMaxDist))
|
||||
{
|
||||
@@ -1215,7 +1215,7 @@ void __fastcall TSubModel::RenderAlphaDL()
|
||||
Next->RenderAlphaDL();
|
||||
}; // RenderAlpha
|
||||
|
||||
void __fastcall TSubModel::RenderVBO()
|
||||
void TSubModel::RenderVBO()
|
||||
{ // g³ówna procedura renderowania przez VBO
|
||||
if (iVisible && (fSquareDist >= fSquareMinDist) && (fSquareDist < fSquareMaxDist))
|
||||
{
|
||||
@@ -1372,7 +1372,7 @@ void __fastcall TSubModel::RenderVBO()
|
||||
Next->RenderVBO(); // dalsze rekurencyjnie
|
||||
}; // RaRender
|
||||
|
||||
void __fastcall TSubModel::RenderAlphaVBO()
|
||||
void TSubModel::RenderAlphaVBO()
|
||||
{ // renderowanie przezroczystych przez VBO
|
||||
if (iVisible && (fSquareDist >= fSquareMinDist) && (fSquareDist < fSquareMaxDist))
|
||||
{
|
||||
@@ -1427,7 +1427,7 @@ void __fastcall TSubModel::RenderAlphaVBO()
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TSubModel::RaArrayFill(CVertNormTex *Vert)
|
||||
void TSubModel::RaArrayFill(CVertNormTex *Vert)
|
||||
{ // wype³nianie tablic VBO
|
||||
if (Child)
|
||||
Child->RaArrayFill(Vert);
|
||||
@@ -1449,7 +1449,7 @@ void __fastcall TSubModel::RaArrayFill(CVertNormTex *Vert)
|
||||
Next->RaArrayFill(Vert);
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::Info()
|
||||
void TSubModel::Info()
|
||||
{ // zapisanie informacji o submodelu do obiektu pomocniczego
|
||||
TSubModelInfo *info = TSubModelInfo::pTable + TSubModelInfo::iCurrent;
|
||||
info->pSubModel = this;
|
||||
@@ -1500,7 +1500,7 @@ void __fastcall TSubModel::Info()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::InfoSet(TSubModelInfo *info)
|
||||
void TSubModel::InfoSet(TSubModelInfo *info)
|
||||
{ // ustawienie danych wg obiektu pomocniczego do zapisania w pliku
|
||||
int ile = (char *)&uiDisplayList - (char *)&eType; // iloœæ bajtów pomiêdzy tymi zmiennymi
|
||||
ZeroMemory(this, sizeof(TSubModel)); // zerowaie ca³oœci
|
||||
@@ -1516,7 +1516,7 @@ void __fastcall TSubModel::InfoSet(TSubModelInfo *info)
|
||||
pTexture = pName = NULL;
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
||||
void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
||||
TStringPack *n, bool dynamic)
|
||||
{ // ustawienie wskaŸników w submodelu
|
||||
iVisible = 1; // tymczasowo u¿ywane
|
||||
@@ -1567,7 +1567,7 @@ void __fastcall TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TString
|
||||
Vertices = v + iVboPtr;
|
||||
// if (!iNumVerts) eType=-1; //tymczasowo zmiana typu, ¿eby siê nie renderowa³o na si³ê
|
||||
};
|
||||
void __fastcall TSubModel::AdjustDist()
|
||||
void TSubModel::AdjustDist()
|
||||
{ // aktualizacja odleg³oœci faz LoD, zale¿na od rozdzielczoœci pionowej oraz multisamplingu
|
||||
if (fSquareMaxDist > 0.0)
|
||||
fSquareMaxDist *= Global::fDistanceFactor;
|
||||
@@ -1581,7 +1581,7 @@ void __fastcall TSubModel::AdjustDist()
|
||||
Next->AdjustDist();
|
||||
};
|
||||
|
||||
void __fastcall TSubModel::ColorsSet(int *a, int *d, int *s)
|
||||
void TSubModel::ColorsSet(int *a, int *d, int *s)
|
||||
{ // ustawienie kolorów dla modelu terenu
|
||||
int i;
|
||||
if (a)
|
||||
@@ -1594,7 +1594,7 @@ void __fastcall TSubModel::ColorsSet(int *a, int *d, int *s)
|
||||
for (i = 0; i < 4; ++i)
|
||||
f4Specular[i] = s[i] / 255.0;
|
||||
};
|
||||
void __fastcall TSubModel::ParentMatrix(float4x4 *m)
|
||||
void TSubModel::ParentMatrix(float4x4 *m)
|
||||
{ // pobranie transformacji wzglêdem wstawienia modelu
|
||||
// jeœli nie zosta³o wykonane Init() (tzn. zaraz po wczytaniu T3D), to dodatkowy obrót
|
||||
// obrót T3D jest wymagany np. do policzenia wysokoœci pantografów
|
||||
@@ -1610,7 +1610,7 @@ void __fastcall TSubModel::ParentMatrix(float4x4 *m)
|
||||
// dla ostatniego mo¿e byæ potrzebny dodatkowy obrót, jeœli wczytano z T3D, a nie obrócono
|
||||
// jeszcze
|
||||
};
|
||||
float __fastcall TSubModel::MaxY(const float4x4 &m)
|
||||
float TSubModel::MaxY(const float4x4 &m)
|
||||
{ // obliczenie maksymalnej wysokoœci, na pocz¹tek œlizgu w pantografie
|
||||
if (eType != 4)
|
||||
return 0; // tylko dla trójk¹tów liczymy
|
||||
@@ -1676,7 +1676,7 @@ TSubModel *__fastcall TModel3d::AddToNamed(const char *Name, TSubModel *SubModel
|
||||
return sm; // zwracamy wskaŸnik do nadrzêdnego submodelu
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::AddTo(TSubModel *tmp, TSubModel *SubModel)
|
||||
void TModel3d::AddTo(TSubModel *tmp, TSubModel *SubModel)
|
||||
{ // jedyny poprawny sposób dodawania submodeli, inaczej mog¹ zgin¹æ przy zapisie E3D
|
||||
if (tmp)
|
||||
{ // jeœli znaleziony, pod³¹czamy mu jako potomny
|
||||
@@ -1705,7 +1705,7 @@ TSubModel *__fastcall TModel3d::GetFromName(const char *sName)
|
||||
};
|
||||
|
||||
/*
|
||||
TMaterial* __fastcall TModel3d::GetMaterialFromName(char *sName)
|
||||
TMaterial* TModel3d::GetMaterialFromName(char *sName)
|
||||
{
|
||||
AnsiString tmp=AnsiString(sName).Trim();
|
||||
for (int i=0; i<MaterialsCount; i++)
|
||||
@@ -1716,7 +1716,7 @@ TMaterial* __fastcall TModel3d::GetMaterialFromName(char *sName)
|
||||
}
|
||||
*/
|
||||
|
||||
bool __fastcall TModel3d::LoadFromFile(char *FileName, bool dynamic)
|
||||
bool TModel3d::LoadFromFile(char *FileName, bool dynamic)
|
||||
{ // wczytanie modelu z pliku
|
||||
AnsiString name = AnsiString(FileName).LowerCase();
|
||||
int i = name.LastDelimiter(".");
|
||||
@@ -1742,7 +1742,7 @@ bool __fastcall TModel3d::LoadFromFile(char *FileName, bool dynamic)
|
||||
return Root ? (iSubModelsCount > 0) : false; // brak pliku albo problem z wczytaniem
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::LoadFromBinFile(char *FileName, bool dynamic)
|
||||
void TModel3d::LoadFromBinFile(char *FileName, bool dynamic)
|
||||
{ // wczytanie modelu z pliku binarnego
|
||||
WriteLog("Loading - binary model: " + AnsiString(FileName));
|
||||
int i = 0, j, k, ch, size;
|
||||
@@ -1831,7 +1831,7 @@ void __fastcall TModel3d::LoadFromBinFile(char *FileName, bool dynamic)
|
||||
return;
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::LoadFromTextFile(char *FileName, bool dynamic)
|
||||
void TModel3d::LoadFromTextFile(char *FileName, bool dynamic)
|
||||
{ // wczytanie submodelu z pliku tekstowego
|
||||
WriteLog("Loading - text model: " + AnsiString(FileName));
|
||||
iFlags |= 0x0200; // wczytano z pliku tekstowego (w³aœcicielami tablic s¹ submodle)
|
||||
@@ -1873,7 +1873,7 @@ void __fastcall TModel3d::LoadFromTextFile(char *FileName, bool dynamic)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TModel3d::Init()
|
||||
void TModel3d::Init()
|
||||
{ // obrócenie pocz¹tkowe uk³adu wspó³rzêdnych, dla pojazdów wykonywane po analizie animacji
|
||||
if (iFlags & 0x8000)
|
||||
return; // operacje zosta³y ju¿ wykonane
|
||||
@@ -1924,7 +1924,7 @@ void __fastcall TModel3d::Init()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::SaveToBinFile(char *FileName)
|
||||
void TModel3d::SaveToBinFile(char *FileName)
|
||||
{ // zapis modelu binarnego
|
||||
WriteLog("Saving E3D binary model.");
|
||||
int i, zero = 0;
|
||||
@@ -2012,10 +2012,10 @@ void __fastcall TModel3d::SaveToBinFile(char *FileName)
|
||||
delete[] info;
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::BreakHierarhy() { Error("Not implemented yet :("); };
|
||||
void TModel3d::BreakHierarhy() { Error("Not implemented yet :("); };
|
||||
|
||||
/*
|
||||
void __fastcall TModel3d::Render(vector3 pPosition,double fAngle,GLuint ReplacableSkinId,int iAlpha)
|
||||
void TModel3d::Render(vector3 pPosition,double fAngle,GLuint ReplacableSkinId,int iAlpha)
|
||||
{
|
||||
// glColor3f(1.0f,1.0f,1.0f);
|
||||
// glColor3f(0.0f,0.0f,0.0f);
|
||||
@@ -2046,7 +2046,7 @@ void __fastcall TModel3d::Render(vector3 pPosition,double fAngle,GLuint Replacab
|
||||
};
|
||||
*/
|
||||
|
||||
void __fastcall TModel3d::Render(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
void TModel3d::Render(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
{
|
||||
iAlpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wy³apaæ nieprzezroczyste
|
||||
if (iAlpha & iFlags & 0x1F1F001F) // czy w ogóle jest co robiæ w tym cyklu?
|
||||
@@ -2057,7 +2057,7 @@ void __fastcall TModel3d::Render(double fSquareDistance, GLuint *ReplacableSkinI
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
void TModel3d::RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
{
|
||||
if (iAlpha & iFlags & 0x2F2F002F)
|
||||
{
|
||||
@@ -2068,7 +2068,7 @@ void __fastcall TModel3d::RenderAlpha(double fSquareDistance, GLuint *Replacable
|
||||
};
|
||||
|
||||
/*
|
||||
void __fastcall TModel3d::RaRender(vector3 pPosition,double fAngle,GLuint *ReplacableSkinId,int
|
||||
void TModel3d::RaRender(vector3 pPosition,double fAngle,GLuint *ReplacableSkinId,int
|
||||
iAlpha)
|
||||
{
|
||||
// glColor3f(1.0f,1.0f,1.0f);
|
||||
@@ -2099,7 +2099,7 @@ iAlpha)
|
||||
};
|
||||
*/
|
||||
|
||||
void __fastcall TModel3d::RaRender(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
void TModel3d::RaRender(double fSquareDistance, GLuint *ReplacableSkinId, int iAlpha)
|
||||
{ // renderowanie specjalne, np. kabiny
|
||||
iAlpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wy³apaæ nieprzezroczyste
|
||||
if (iAlpha & iFlags & 0x1F1F001F) // czy w ogóle jest co robiæ w tym cyklu?
|
||||
@@ -2115,7 +2115,7 @@ void __fastcall TModel3d::RaRender(double fSquareDistance, GLuint *ReplacableSki
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId,
|
||||
void TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
{ // renderowanie specjalne, np. kabiny
|
||||
if (iAlpha & iFlags & 0x2F2F002F) // czy w ogóle jest co robiæ w tym cyklu?
|
||||
@@ -2131,7 +2131,7 @@ void __fastcall TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *Replacab
|
||||
};
|
||||
|
||||
/*
|
||||
void __fastcall TModel3d::RaRenderAlpha(vector3 pPosition,double fAngle,GLuint *ReplacableSkinId,int
|
||||
void TModel3d::RaRenderAlpha(vector3 pPosition,double fAngle,GLuint *ReplacableSkinId,int
|
||||
iAlpha)
|
||||
{
|
||||
glPushMatrix();
|
||||
@@ -2152,7 +2152,7 @@ iAlpha)
|
||||
// 2011-03-16 cztery nowe funkcje renderowania z mo¿liwoœci¹ pochylania obiektów
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
{ // nieprzezroczyste, Display List
|
||||
glPushMatrix();
|
||||
@@ -2170,7 +2170,7 @@ void __fastcall TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *Re
|
||||
Root->RenderDL();
|
||||
glPopMatrix();
|
||||
};
|
||||
void __fastcall TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
{ // przezroczyste, Display List
|
||||
glPushMatrix();
|
||||
@@ -2187,7 +2187,7 @@ void __fastcall TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuin
|
||||
Root->RenderAlphaDL();
|
||||
glPopMatrix();
|
||||
};
|
||||
void __fastcall TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
{ // nieprzezroczyste, VBO
|
||||
glPushMatrix();
|
||||
@@ -2208,7 +2208,7 @@ void __fastcall TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *
|
||||
}
|
||||
glPopMatrix();
|
||||
};
|
||||
void __fastcall TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId, int iAlpha)
|
||||
{ // przezroczyste, VBO
|
||||
glPushMatrix();
|
||||
@@ -2234,7 +2234,7 @@ void __fastcall TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
// 2012-02 funkcje do tworzenia terenu z E3D
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int __fastcall TModel3d::TerrainCount()
|
||||
int TModel3d::TerrainCount()
|
||||
{ // zliczanie kwadratów kilometrowych (g³ówna linia po Next) do tworznia tablicy
|
||||
int i = 0;
|
||||
TSubModel *r = Root;
|
||||
@@ -2257,7 +2257,7 @@ TSubModel *__fastcall TModel3d::TerrainSquare(int n)
|
||||
r->UnFlagNext(); // blokowanie wyœwietlania po Next g³ównej listy
|
||||
return r;
|
||||
};
|
||||
void __fastcall TModel3d::TerrainRenderVBO(int n)
|
||||
void TModel3d::TerrainRenderVBO(int n)
|
||||
{ // renderowanie terenu z VBO
|
||||
glPushMatrix();
|
||||
// glTranslated(vPosition->x,vPosition->y,vPosition->z);
|
||||
|
||||
164
Model3d.h
164
Model3d.h
@@ -29,22 +29,22 @@ class TStringPack
|
||||
public:
|
||||
char *String(int n);
|
||||
char *StringAt(int n) { return data + 9 + n; };
|
||||
__fastcall TStringPack()
|
||||
TStringPack()
|
||||
{
|
||||
data = NULL;
|
||||
index = NULL;
|
||||
};
|
||||
void __fastcall Init(char *d) { data = d; };
|
||||
void __fastcall InitIndex(int *i) { index = i; };
|
||||
void Init(char *d) { data = d; };
|
||||
void InitIndex(int *i) { index = i; };
|
||||
};
|
||||
|
||||
class TMaterialColor
|
||||
{
|
||||
public:
|
||||
__fastcall TMaterialColor(){};
|
||||
__fastcall TMaterialColor(char V) { r = g = b = V; };
|
||||
// __fastcall TMaterialColor(double R, double G, double B)
|
||||
__fastcall TMaterialColor(char R, char G, char B)
|
||||
TMaterialColor(){};
|
||||
TMaterialColor(char V) { r = g = b = V; };
|
||||
// TMaterialColor(double R, double G, double B)
|
||||
TMaterialColor(char R, char G, char B)
|
||||
{
|
||||
r = R;
|
||||
g = G;
|
||||
@@ -73,8 +73,8 @@ struct THitBoxContainer
|
||||
{
|
||||
TPlane Planes[6];
|
||||
int Index;
|
||||
inline void __fastcall Reset() { Planes[0]= TPlane(vector3(0,0,0),0.0f); };
|
||||
inline bool __fastcall Inside(vector3 Point)
|
||||
inline void Reset() { Planes[0]= TPlane(vector3(0,0,0),0.0f); };
|
||||
inline bool Inside(vector3 Point)
|
||||
{
|
||||
bool Hit= true;
|
||||
|
||||
@@ -224,10 +224,10 @@ class TSubModel
|
||||
char *pTexture; // robocza nazwa tekstury do zapisania w pliku binarnym
|
||||
char *pName; // robocza nazwa
|
||||
private:
|
||||
// int __fastcall SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||
// int SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||
// *Vertices);
|
||||
int __fastcall SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt, float8 *Vertices);
|
||||
void __fastcall RaAnimation(TAnimType a);
|
||||
int SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt, float8 *Vertices);
|
||||
void RaAnimation(TAnimType a);
|
||||
|
||||
public:
|
||||
static int iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
||||
@@ -236,59 +236,59 @@ class TSubModel
|
||||
static double fSquareDist;
|
||||
static TModel3d *pRoot;
|
||||
static AnsiString *pasText; // tekst dla wyświetlacza (!!!! do przemyślenia)
|
||||
__fastcall TSubModel();
|
||||
__fastcall ~TSubModel();
|
||||
void __fastcall FirstInit();
|
||||
int __fastcall Load(cParser &Parser, TModel3d *Model, int Pos, bool dynamic);
|
||||
void __fastcall ChildAdd(TSubModel *SubModel);
|
||||
void __fastcall NextAdd(TSubModel *SubModel);
|
||||
TSubModel();
|
||||
~TSubModel();
|
||||
void FirstInit();
|
||||
int Load(cParser &Parser, TModel3d *Model, int Pos, bool dynamic);
|
||||
void ChildAdd(TSubModel *SubModel);
|
||||
void NextAdd(TSubModel *SubModel);
|
||||
TSubModel *__fastcall NextGet() { return Next; };
|
||||
TSubModel *__fastcall ChildGet() { return Child; };
|
||||
int __fastcall 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(const char *tex,int tri);
|
||||
// void __fastcall SetRotate(vector3 vNewRotateAxis,float fNewAngle);
|
||||
void __fastcall SetRotate(float3 vNewRotateAxis, float fNewAngle);
|
||||
void __fastcall SetRotateXYZ(vector3 vNewAngles);
|
||||
void __fastcall SetRotateXYZ(float3 vNewAngles);
|
||||
void __fastcall SetTranslate(vector3 vNewTransVector);
|
||||
void __fastcall SetTranslate(float3 vNewTransVector);
|
||||
void __fastcall SetRotateIK1(float3 vNewAngles);
|
||||
// float8* TrianglePtr(const char *tex,int tri);
|
||||
// void SetRotate(vector3 vNewRotateAxis,float fNewAngle);
|
||||
void SetRotate(float3 vNewRotateAxis, float fNewAngle);
|
||||
void SetRotateXYZ(vector3 vNewAngles);
|
||||
void SetRotateXYZ(float3 vNewAngles);
|
||||
void SetTranslate(vector3 vNewTransVector);
|
||||
void SetTranslate(float3 vNewTransVector);
|
||||
void SetRotateIK1(float3 vNewAngles);
|
||||
TSubModel *__fastcall GetFromName(AnsiString search, bool i = true);
|
||||
TSubModel *__fastcall GetFromName(char *search, bool i = true);
|
||||
void __fastcall RenderDL();
|
||||
void __fastcall RenderAlphaDL();
|
||||
void __fastcall RenderVBO();
|
||||
void __fastcall RenderAlphaVBO();
|
||||
// inline matrix4x4* __fastcall GetMatrix() {return dMatrix;};
|
||||
void RenderDL();
|
||||
void RenderAlphaDL();
|
||||
void RenderVBO();
|
||||
void RenderAlphaVBO();
|
||||
// inline matrix4x4* GetMatrix() {return dMatrix;};
|
||||
inline float4x4 *__fastcall GetMatrix() { return fMatrix; };
|
||||
// matrix4x4* __fastcall GetTransform() {return Matrix;};
|
||||
inline void __fastcall Hide() { iVisible = 0; };
|
||||
void __fastcall RaArrayFill(CVertNormTex *Vert);
|
||||
// void __fastcall Render();
|
||||
int __fastcall FlagsCheck();
|
||||
void __fastcall WillBeAnimated()
|
||||
// matrix4x4* GetTransform() {return Matrix;};
|
||||
inline void Hide() { iVisible = 0; };
|
||||
void RaArrayFill(CVertNormTex *Vert);
|
||||
// void Render();
|
||||
int FlagsCheck();
|
||||
void WillBeAnimated()
|
||||
{
|
||||
if (this)
|
||||
iFlags |= 0x4000;
|
||||
};
|
||||
void __fastcall InitialRotate(bool doit);
|
||||
void __fastcall DisplayLists();
|
||||
void __fastcall Info();
|
||||
void __fastcall InfoSet(TSubModelInfo *info);
|
||||
void __fastcall BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
||||
void InitialRotate(bool doit);
|
||||
void DisplayLists();
|
||||
void Info();
|
||||
void InfoSet(TSubModelInfo *info);
|
||||
void BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
||||
TStringPack *n = NULL, bool dynamic = false);
|
||||
void __fastcall ReplacableSet(GLuint *r, int a)
|
||||
void ReplacableSet(GLuint *r, int a)
|
||||
{
|
||||
ReplacableSkinId = r;
|
||||
iAlpha = a;
|
||||
};
|
||||
void __fastcall TextureNameSet(const char *n);
|
||||
void __fastcall NameSet(const char *n);
|
||||
void TextureNameSet(const char *n);
|
||||
void NameSet(const char *n);
|
||||
// Ra: funkcje do budowania terenu z E3D
|
||||
int __fastcall Flags() { return iFlags; };
|
||||
void __fastcall UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
void __fastcall ColorsSet(int *a, int *d, int *s);
|
||||
int Flags() { return iFlags; };
|
||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
void ColorsSet(int *a, int *d, int *s);
|
||||
inline float3 Translation1Get()
|
||||
{
|
||||
return fMatrix ? *(fMatrix->TranslationGet()) + v_TransVector : v_TransVector;
|
||||
@@ -297,9 +297,9 @@ class TSubModel
|
||||
{
|
||||
return *(fMatrix->TranslationGet()) + Child->Translation1Get();
|
||||
}
|
||||
void __fastcall ParentMatrix(float4x4 *m);
|
||||
float __fastcall MaxY(const float4x4 &m);
|
||||
void __fastcall AdjustDist();
|
||||
void ParentMatrix(float4x4 *m);
|
||||
float MaxY(const float4x4 &m);
|
||||
void AdjustDist();
|
||||
};
|
||||
|
||||
class TSubModelInfo
|
||||
@@ -317,18 +317,18 @@ class TSubModelInfo
|
||||
static int iTotalTextures; // ilość tekstur
|
||||
static int iCurrent; // aktualny obiekt
|
||||
static TSubModelInfo *pTable; // tabele obiektów pomocniczych
|
||||
__fastcall TSubModelInfo()
|
||||
TSubModelInfo()
|
||||
{
|
||||
pSubModel = NULL;
|
||||
iTransform = iName = iTexture = iNext = iChild = -1; // nie ma
|
||||
iNameLen = iTextureLen = 0;
|
||||
}
|
||||
void __fastcall Reset()
|
||||
void Reset()
|
||||
{
|
||||
pTable = this; // ustawienie wskaźnika tabeli obiektów
|
||||
iTotalTransforms = iTotalNames = iTotalTextures = iCurrent = 0; // zerowanie liczników
|
||||
}
|
||||
__fastcall ~TSubModelInfo(){};
|
||||
~TSubModelInfo(){};
|
||||
};
|
||||
|
||||
class TModel3d : public CMesh
|
||||
@@ -350,52 +350,52 @@ class TModel3d : public CMesh
|
||||
public:
|
||||
inline TSubModel *__fastcall GetSMRoot() { return (Root); };
|
||||
// double Radius; //Ra: nie używane
|
||||
__fastcall TModel3d();
|
||||
__fastcall TModel3d(char *FileName);
|
||||
__fastcall ~TModel3d();
|
||||
TModel3d();
|
||||
TModel3d(char *FileName);
|
||||
~TModel3d();
|
||||
TSubModel *__fastcall GetFromName(const char *sName);
|
||||
// TMaterial* __fastcall GetMaterialFromName(char *sName);
|
||||
// TMaterial* GetMaterialFromName(char *sName);
|
||||
TSubModel *__fastcall AddToNamed(const char *Name, TSubModel *SubModel);
|
||||
void __fastcall AddTo(TSubModel *tmp, TSubModel *SubModel);
|
||||
void __fastcall LoadFromTextFile(char *FileName, bool dynamic);
|
||||
void __fastcall LoadFromBinFile(char *FileName, bool dynamic);
|
||||
bool __fastcall LoadFromFile(char *FileName, bool dynamic);
|
||||
void __fastcall SaveToBinFile(char *FileName);
|
||||
void __fastcall BreakHierarhy();
|
||||
void AddTo(TSubModel *tmp, TSubModel *SubModel);
|
||||
void LoadFromTextFile(char *FileName, bool dynamic);
|
||||
void LoadFromBinFile(char *FileName, bool dynamic);
|
||||
bool LoadFromFile(char *FileName, bool dynamic);
|
||||
void SaveToBinFile(char *FileName);
|
||||
void BreakHierarhy();
|
||||
// renderowanie specjalne
|
||||
void __fastcall Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
void Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
void RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
void RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
void RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
// jeden kąt obrotu
|
||||
void __fastcall Render(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
void Render(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
void RenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void __fastcall RaRender(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
void RaRender(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RaRenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
void RaRenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
// trzy kąty obrotu
|
||||
void __fastcall Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
void Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
void RenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void __fastcall RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
void RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void __fastcall RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
// inline int __fastcall GetSubModelsCount() { return (SubModelsCount); };
|
||||
int __fastcall Flags() { return iFlags; };
|
||||
void __fastcall Init();
|
||||
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
||||
int Flags() { return iFlags; };
|
||||
void Init();
|
||||
char *__fastcall NameGet() { return Root ? Root->pName : NULL; };
|
||||
int __fastcall TerrainCount();
|
||||
int TerrainCount();
|
||||
TSubModel *__fastcall TerrainSquare(int n);
|
||||
void __fastcall TerrainRenderVBO(int n);
|
||||
void TerrainRenderVBO(int n);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
44
Mover.cpp
44
Mover.cpp
@@ -24,26 +24,26 @@ __fastcall TMoverParameters::TMoverParameters(double VelInitial, AnsiString Type
|
||||
iLights[0] = iLights[1] = 0; //œwiat³a zgaszone
|
||||
};
|
||||
|
||||
double __fastcall TMoverParameters::Distance(const TLocation &Loc1, const TLocation &Loc2,
|
||||
double TMoverParameters::Distance(const TLocation &Loc1, const TLocation &Loc2,
|
||||
const TDimension &Dim1, const TDimension &Dim2)
|
||||
{ // zwraca odleg³oœæ pomiêdzy pojazdami (Loc1) i (Loc2) z uwzglêdnieneim ich d³ugoœci (kule!)
|
||||
return hypot(Loc2.X - Loc1.X, Loc1.Y - Loc2.Y) - 0.5 * (Dim2.L + Dim1.L);
|
||||
};
|
||||
|
||||
double __fastcall TMoverParameters::Distance(const vector3 &s1, const vector3 &s2,
|
||||
double TMoverParameters::Distance(const vector3 &s1, const vector3 &s2,
|
||||
const vector3 &d1, const vector3 &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...
|
||||
};
|
||||
|
||||
double __fastcall TMoverParameters::CouplerDist(Byte Coupler)
|
||||
double TMoverParameters::CouplerDist(Byte Coupler)
|
||||
{ // obliczenie odleg³oœci pomiêdzy sprzêgami (kula!)
|
||||
return Couplers[Coupler].CoupleDist =
|
||||
Distance(Loc, Couplers[Coupler].Connected->Loc, Dim,
|
||||
Couplers[Coupler].Connected->Dim); // odleg³oœæ pomiêdzy sprzêgami (kula!)
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
TMoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced)
|
||||
{ //³¹czenie do swojego sprzêgu (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
||||
@@ -87,14 +87,14 @@ bool __fastcall TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
// sprzêgu, brak haka
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
T_MoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced)
|
||||
{ //³¹czenie do (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
||||
return Attach(ConnectNo, ConnectToNr, (TMoverParameters *)ConnectTo, CouplingType, Forced);
|
||||
};
|
||||
|
||||
int __fastcall TMoverParameters::DettachStatus(Byte ConnectNo)
|
||||
int TMoverParameters::DettachStatus(Byte ConnectNo)
|
||||
{ // Ra: sprawdzenie, czy odleg³oœæ jest dobra do roz³¹czania
|
||||
// powinny byæ 3 informacje: =0 sprzêg ju¿ roz³¹czony, <0 da siê roz³¹czyæ. >0 nie da siê
|
||||
// roz³¹czyæ
|
||||
@@ -115,7 +115,7 @@ int __fastcall TMoverParameters::DettachStatus(Byte ConnectNo)
|
||||
Couplers[ConnectNo].CouplingFlag;
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::Dettach(Byte ConnectNo)
|
||||
bool TMoverParameters::Dettach(Byte ConnectNo)
|
||||
{ // rozlaczanie
|
||||
if (!Couplers[ConnectNo].Connected)
|
||||
return true; // nie ma nic, to odczepiono
|
||||
@@ -140,7 +140,7 @@ bool __fastcall TMoverParameters::Dettach(Byte ConnectNo)
|
||||
return false; // jeszcze nie roz³¹czony
|
||||
};
|
||||
|
||||
void __fastcall TMoverParameters::SetCoupleDist()
|
||||
void TMoverParameters::SetCoupleDist()
|
||||
{ // przeliczenie odleg³oœci sprzêgów
|
||||
if (Couplers[0].Connected)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ void __fastcall TMoverParameters::SetCoupleDist()
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::DirectionForward()
|
||||
bool TMoverParameters::DirectionForward()
|
||||
{
|
||||
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (MainCtrlPos == 0))
|
||||
{
|
||||
@@ -177,7 +177,7 @@ bool __fastcall TMoverParameters::DirectionForward()
|
||||
|
||||
// Nastawianie hamulców
|
||||
|
||||
void __fastcall TMoverParameters::BrakeLevelSet(double b)
|
||||
void TMoverParameters::BrakeLevelSet(double b)
|
||||
{ // ustawienie pozycji hamulca na wartoϾ (b) w zakresie od -2 do BrakeCtrlPosNo
|
||||
// jedyny dopuszczalny sposób przestawienia hamulca zasadniczego
|
||||
if (fBrakeCtrlPos == b)
|
||||
@@ -217,7 +217,7 @@ void __fastcall TMoverParameters::BrakeLevelSet(double b)
|
||||
*/
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::BrakeLevelAdd(double b)
|
||||
bool TMoverParameters::BrakeLevelAdd(double b)
|
||||
{ // dodanie wartoœci (b) do pozycji hamulca (w tym ujemnej)
|
||||
// zwraca false, gdy po dodaniu by³o by poza zakresem
|
||||
BrakeLevelSet(fBrakeCtrlPos + b);
|
||||
@@ -225,14 +225,14 @@ bool __fastcall TMoverParameters::BrakeLevelAdd(double b)
|
||||
(BrakeCtrlPos > -1.0); // true, jeœli mo¿na kontynuowaæ
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::IncBrakeLevel()
|
||||
bool TMoverParameters::IncBrakeLevel()
|
||||
{ // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê BrakeCtrlPosNo
|
||||
return BrakeLevelAdd(1.0); };
|
||||
|
||||
bool __fastcall TMoverParameters::DecBrakeLevel()
|
||||
bool TMoverParameters::DecBrakeLevel()
|
||||
{ // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê -1 return BrakeLevelAdd(-1.0); };
|
||||
|
||||
bool __fastcall TMoverParameters::ChangeCab(int direction)
|
||||
bool TMoverParameters::ChangeCab(int direction)
|
||||
{ // zmiana kabiny i resetowanie ustawien
|
||||
if (abs(ActiveCab + direction) < 2)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ bool __fastcall TMoverParameters::ChangeCab(int direction)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool __fastcall TMoverParameters::CurrentSwitch(int direction)
|
||||
bool TMoverParameters::CurrentSwitch(int direction)
|
||||
{ // rozruch wysoki (true) albo niski (false)
|
||||
// Ra: przenios³em z Train.cpp, nie wiem czy ma to sens
|
||||
if (MaxCurrentSwitch(direction))
|
||||
@@ -289,7 +289,7 @@ bool __fastcall TMoverParameters::CurrentSwitch(int direction)
|
||||
return false;
|
||||
};
|
||||
|
||||
void __fastcall TMoverParameters::UpdatePantVolume(double dt)
|
||||
void TMoverParameters::UpdatePantVolume(double dt)
|
||||
{ // KURS90 - sprê¿arka pantografów; Ra 2014-07: teraz jest to zbiornik rozrz¹du, chocia¿ to jeszcze
|
||||
// nie tak
|
||||
if (EnginePowerSource.SourceType == CurrentCollector) // tylko jeœli pantografuj¹cy
|
||||
@@ -349,7 +349,7 @@ void __fastcall TMoverParameters::UpdatePantVolume(double dt)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
void TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
{ // przeliczenie obci¹¿enia baterii
|
||||
double sn1, sn2, sn3, sn4, sn5; // Ra: zrobiæ z tego amperomierz NN
|
||||
if ((BatteryVoltage > 0) && (EngineType != DieselEngine) && (EngineType != WheelsDriven) &&
|
||||
@@ -467,7 +467,7 @@ void __fastcall TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
ZN //masa
|
||||
*/
|
||||
|
||||
double __fastcall TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
TTrackParam &Track,
|
||||
TTractionParam &ElectricTraction,
|
||||
const TLocation &NewLoc, TRotation &NewRot)
|
||||
@@ -546,7 +546,7 @@ double __fastcall TMoverParameters::ComputeMovement(double dt, double dt1, const
|
||||
return d;
|
||||
};
|
||||
|
||||
double __fastcall TMoverParameters::FastComputeMovement(double dt, const TTrackShape &Shape,
|
||||
double TMoverParameters::FastComputeMovement(double dt, const TTrackShape &Shape,
|
||||
TTrackParam &Track, const TLocation &NewLoc,
|
||||
TRotation &NewRot)
|
||||
{ // trzeba po ma³u przenosiæ tu tê funkcjê
|
||||
@@ -592,7 +592,7 @@ double __fastcall TMoverParameters::FastComputeMovement(double dt, const TTrackS
|
||||
return d;
|
||||
};
|
||||
|
||||
double __fastcall TMoverParameters::ShowEngineRotation(int VehN)
|
||||
double TMoverParameters::ShowEngineRotation(int VehN)
|
||||
{ // pokazywanie obrotów silnika, równie¿ dwóch dalszych pojazdów (3×SN61)
|
||||
int b;
|
||||
switch (VehN)
|
||||
@@ -617,7 +617,7 @@ double __fastcall TMoverParameters::ShowEngineRotation(int VehN)
|
||||
return 0.0;
|
||||
};
|
||||
|
||||
void __fastcall TMoverParameters::ConverterCheck()
|
||||
void TMoverParameters::ConverterCheck()
|
||||
{ // sprawdzanie przetwornicy
|
||||
if (ConverterAllow && Mains)
|
||||
ConverterFlag = true;
|
||||
@@ -625,7 +625,7 @@ void __fastcall TMoverParameters::ConverterCheck()
|
||||
ConverterFlag = false;
|
||||
};
|
||||
|
||||
int __fastcall TMoverParameters::ShowCurrent(Byte AmpN)
|
||||
int TMoverParameters::ShowCurrent(Byte AmpN)
|
||||
{ // odczyt ampera¿u
|
||||
switch (EngineType)
|
||||
{
|
||||
|
||||
238
Mover.h
238
Mover.h
@@ -33,146 +33,146 @@ class TMoverParameters : public T_MoverParameters
|
||||
int iProblem; // flagi problemów z taborem, aby AI nie musia³o porównywaæ; 0=mo¿e jechaæ
|
||||
int iLights[2]; // bity zapalonych œwiate³ tutaj, ¿eby da³o siê liczyæ pobór pr¹du
|
||||
private:
|
||||
double __fastcall CouplerDist(Byte Coupler);
|
||||
double CouplerDist(Byte Coupler);
|
||||
|
||||
public:
|
||||
__fastcall TMoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||
TMoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||
int LoadInitial, AnsiString LoadTypeInitial, int Cab);
|
||||
// obs³uga sprzêgów
|
||||
double __fastcall Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1,
|
||||
double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1,
|
||||
const TDimension &Dim2);
|
||||
double __fastcall Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1,
|
||||
double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1,
|
||||
const vector3 &Dim2);
|
||||
bool __fastcall Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
||||
Byte CouplingType, bool Forced = false);
|
||||
bool __fastcall Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo,
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo,
|
||||
Byte CouplingType, bool Forced = false);
|
||||
int __fastcall DettachStatus(Byte ConnectNo);
|
||||
bool __fastcall Dettach(Byte ConnectNo);
|
||||
void __fastcall SetCoupleDist();
|
||||
bool __fastcall DirectionForward();
|
||||
void __fastcall BrakeLevelSet(double b);
|
||||
bool __fastcall BrakeLevelAdd(double b);
|
||||
bool __fastcall IncBrakeLevel(); // wersja na u¿ytek AI
|
||||
bool __fastcall DecBrakeLevel();
|
||||
bool __fastcall ChangeCab(int direction);
|
||||
bool __fastcall CurrentSwitch(int direction);
|
||||
void __fastcall UpdateBatteryVoltage(double dt);
|
||||
double __fastcall ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
int DettachStatus(Byte ConnectNo);
|
||||
bool Dettach(Byte ConnectNo);
|
||||
void SetCoupleDist();
|
||||
bool DirectionForward();
|
||||
void BrakeLevelSet(double b);
|
||||
bool BrakeLevelAdd(double b);
|
||||
bool IncBrakeLevel(); // wersja na u¿ytek AI
|
||||
bool DecBrakeLevel();
|
||||
bool ChangeCab(int direction);
|
||||
bool CurrentSwitch(int direction);
|
||||
void UpdateBatteryVoltage(double dt);
|
||||
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
TTrackParam &Track, TTractionParam &ElectricTraction,
|
||||
const TLocation &NewLoc, TRotation &NewRot);
|
||||
double __fastcall FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track,
|
||||
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track,
|
||||
const TLocation &NewLoc, TRotation &NewRot);
|
||||
double __fastcall ShowEngineRotation(int VehN);
|
||||
// double __fastcall GetTrainsetVoltage(void);
|
||||
// bool __fastcall Physic_ReActivation(void);
|
||||
// double __fastcall LocalBrakeRatio(void);
|
||||
// double __fastcall ManualBrakeRatio(void);
|
||||
// double __fastcall PipeRatio(void);
|
||||
// double __fastcall RealPipeRatio(void);
|
||||
// double __fastcall BrakeVP(void);
|
||||
// bool __fastcall DynamicBrakeSwitch(bool Switch);
|
||||
// bool __fastcall SendCtrlBroadcast(AnsiString CtrlCommand, double ctrlvalue);
|
||||
// bool __fastcall SendCtrlToNext(AnsiString CtrlCommand, double ctrlvalue, double dir);
|
||||
// bool __fastcall CabActivisation(void);
|
||||
// bool __fastcall CabDeactivisation(void);
|
||||
// bool __fastcall IncMainCtrl(int CtrlSpeed);
|
||||
// bool __fastcall DecMainCtrl(int CtrlSpeed);
|
||||
// bool __fastcall IncScndCtrl(int CtrlSpeed);
|
||||
// bool __fastcall DecScndCtrl(int CtrlSpeed);
|
||||
// bool __fastcall AddPulseForce(int Multipler);
|
||||
// bool __fastcall SandDoseOn(void);
|
||||
// bool __fastcall SecuritySystemReset(void);
|
||||
// void __fastcall SecuritySystemCheck(double dt);
|
||||
// bool __fastcall BatterySwitch(bool State);
|
||||
// bool __fastcall EpFuseSwitch(bool State);
|
||||
// bool __fastcall IncBrakeLevelOld(void);
|
||||
// bool __fastcall DecBrakeLevelOld(void);
|
||||
// bool __fastcall IncLocalBrakeLevel(Byte CtrlSpeed);
|
||||
// bool __fastcall DecLocalBrakeLevel(Byte CtrlSpeed);
|
||||
// bool __fastcall IncLocalBrakeLevelFAST(void);
|
||||
// bool __fastcall DecLocalBrakeLevelFAST(void);
|
||||
// bool __fastcall IncManualBrakeLevel(Byte CtrlSpeed);
|
||||
// bool __fastcall DecManualBrakeLevel(Byte CtrlSpeed);
|
||||
// bool __fastcall EmergencyBrakeSwitch(bool Switch);
|
||||
// bool __fastcall AntiSlippingBrake(void);
|
||||
// bool __fastcall BrakeReleaser(Byte state);
|
||||
// bool __fastcall SwitchEPBrake(Byte state);
|
||||
// bool __fastcall AntiSlippingButton(void);
|
||||
// bool __fastcall IncBrakePress(double &brake, double PressLimit, double dp);
|
||||
// bool __fastcall DecBrakePress(double &brake, double PressLimit, double dp);
|
||||
// bool __fastcall BrakeDelaySwitch(Byte BDS);
|
||||
// bool __fastcall IncBrakeMult(void);
|
||||
// bool __fastcall DecBrakeMult(void);
|
||||
// void __fastcall UpdateBrakePressure(double dt);
|
||||
// void __fastcall UpdatePipePressure(double dt);
|
||||
// void __fastcall CompressorCheck(double dt);
|
||||
void __fastcall UpdatePantVolume(double dt);
|
||||
// void __fastcall UpdateScndPipePressure(double dt);
|
||||
// void __fastcall UpdateBatteryVoltage(double dt);
|
||||
// double __fastcall GetDVc(double dt);
|
||||
// void __fastcall ComputeConstans(void);
|
||||
// double __fastcall ComputeMass(void);
|
||||
// double __fastcall Adhesive(double staticfriction);
|
||||
// double __fastcall TractionForce(double dt);
|
||||
// double __fastcall FrictionForce(double R, Byte TDamage);
|
||||
// double __fastcall BrakeForce(const TTrackParam &Track);
|
||||
// double __fastcall CouplerForce(Byte CouplerN, double dt);
|
||||
// void __fastcall CollisionDetect(Byte CouplerN, double dt);
|
||||
// double __fastcall ComputeRotatingWheel(double WForce, double dt, double n);
|
||||
// bool __fastcall SetInternalCommand(AnsiString NewCommand, double NewValue1, double
|
||||
double ShowEngineRotation(int VehN);
|
||||
// double GetTrainsetVoltage(void);
|
||||
// bool Physic_ReActivation(void);
|
||||
// double LocalBrakeRatio(void);
|
||||
// double ManualBrakeRatio(void);
|
||||
// double PipeRatio(void);
|
||||
// double RealPipeRatio(void);
|
||||
// double BrakeVP(void);
|
||||
// bool DynamicBrakeSwitch(bool Switch);
|
||||
// bool SendCtrlBroadcast(AnsiString CtrlCommand, double ctrlvalue);
|
||||
// bool SendCtrlToNext(AnsiString CtrlCommand, double ctrlvalue, double dir);
|
||||
// bool CabActivisation(void);
|
||||
// bool CabDeactivisation(void);
|
||||
// bool IncMainCtrl(int CtrlSpeed);
|
||||
// bool DecMainCtrl(int CtrlSpeed);
|
||||
// bool IncScndCtrl(int CtrlSpeed);
|
||||
// bool DecScndCtrl(int CtrlSpeed);
|
||||
// bool AddPulseForce(int Multipler);
|
||||
// bool SandDoseOn(void);
|
||||
// bool SecuritySystemReset(void);
|
||||
// void SecuritySystemCheck(double dt);
|
||||
// bool BatterySwitch(bool State);
|
||||
// bool EpFuseSwitch(bool State);
|
||||
// bool IncBrakeLevelOld(void);
|
||||
// bool DecBrakeLevelOld(void);
|
||||
// bool IncLocalBrakeLevel(Byte CtrlSpeed);
|
||||
// bool DecLocalBrakeLevel(Byte CtrlSpeed);
|
||||
// bool IncLocalBrakeLevelFAST(void);
|
||||
// bool DecLocalBrakeLevelFAST(void);
|
||||
// bool IncManualBrakeLevel(Byte CtrlSpeed);
|
||||
// bool DecManualBrakeLevel(Byte CtrlSpeed);
|
||||
// bool EmergencyBrakeSwitch(bool Switch);
|
||||
// bool AntiSlippingBrake(void);
|
||||
// bool BrakeReleaser(Byte state);
|
||||
// bool SwitchEPBrake(Byte state);
|
||||
// bool AntiSlippingButton(void);
|
||||
// bool IncBrakePress(double &brake, double PressLimit, double dp);
|
||||
// bool DecBrakePress(double &brake, double PressLimit, double dp);
|
||||
// bool BrakeDelaySwitch(Byte BDS);
|
||||
// bool IncBrakeMult(void);
|
||||
// bool DecBrakeMult(void);
|
||||
// void UpdateBrakePressure(double dt);
|
||||
// void UpdatePipePressure(double dt);
|
||||
// void CompressorCheck(double dt);
|
||||
void UpdatePantVolume(double dt);
|
||||
// void UpdateScndPipePressure(double dt);
|
||||
// void UpdateBatteryVoltage(double dt);
|
||||
// double GetDVc(double dt);
|
||||
// void ComputeConstans(void);
|
||||
// double ComputeMass(void);
|
||||
// double Adhesive(double staticfriction);
|
||||
// double TractionForce(double dt);
|
||||
// double FrictionForce(double R, Byte TDamage);
|
||||
// double BrakeForce(const TTrackParam &Track);
|
||||
// double CouplerForce(Byte CouplerN, double dt);
|
||||
// void CollisionDetect(Byte CouplerN, double dt);
|
||||
// double ComputeRotatingWheel(double WForce, double dt, double n);
|
||||
// bool SetInternalCommand(AnsiString NewCommand, double NewValue1, double
|
||||
// NewValue2);
|
||||
// double __fastcall GetExternalCommand(AnsiString &Command);
|
||||
// bool __fastcall RunCommand(AnsiString command, double CValue1, double CValue2);
|
||||
// bool __fastcall RunInternalCommand(void);
|
||||
// void __fastcall PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2, const
|
||||
// double GetExternalCommand(AnsiString &Command);
|
||||
// bool RunCommand(AnsiString command, double CValue1, double CValue2);
|
||||
// bool RunInternalCommand(void);
|
||||
// void PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2, const
|
||||
// TLocation
|
||||
// &NewLocation);
|
||||
// bool __fastcall DirectionBackward(void);
|
||||
// bool __fastcall MainSwitch(bool State);
|
||||
// bool __fastcall ConverterSwitch(bool State);
|
||||
// bool __fastcall CompressorSwitch(bool State);
|
||||
void __fastcall ConverterCheck();
|
||||
// bool __fastcall FuseOn(void);
|
||||
// bool __fastcall FuseFlagCheck(void);
|
||||
// void __fastcall FuseOff(void);
|
||||
int __fastcall ShowCurrent(Byte AmpN);
|
||||
// double __fastcall v2n(void);
|
||||
// double __fastcall current(double n, double U);
|
||||
// double __fastcall Momentum(double I);
|
||||
// double __fastcall MomentumF(double I, double Iw, Byte SCP);
|
||||
// bool __fastcall CutOffEngine(void);
|
||||
// bool __fastcall MaxCurrentSwitch(bool State);
|
||||
// bool __fastcall ResistorsFlagCheck(void);
|
||||
// bool __fastcall MinCurrentSwitch(bool State);
|
||||
// bool __fastcall AutoRelaySwitch(bool State);
|
||||
// bool __fastcall AutoRelayCheck(void);
|
||||
// bool __fastcall dizel_EngageSwitch(double state);
|
||||
// bool __fastcall dizel_EngageChange(double dt);
|
||||
// bool __fastcall dizel_AutoGearCheck(void);
|
||||
// double __fastcall dizel_fillcheck(Byte mcp);
|
||||
// double __fastcall dizel_Momentum(double dizel_fill, double n, double dt);
|
||||
// bool __fastcall dizel_Update(double dt);
|
||||
// bool __fastcall LoadingDone(double LSpeed, AnsiString LoadInit);
|
||||
// void __fastcall ComputeTotalForce(double dt, double dt1, bool FullVer);
|
||||
// double __fastcall ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
// bool DirectionBackward(void);
|
||||
// bool MainSwitch(bool State);
|
||||
// bool ConverterSwitch(bool State);
|
||||
// bool CompressorSwitch(bool State);
|
||||
void ConverterCheck();
|
||||
// bool FuseOn(void);
|
||||
// bool FuseFlagCheck(void);
|
||||
// void FuseOff(void);
|
||||
int ShowCurrent(Byte AmpN);
|
||||
// double v2n(void);
|
||||
// double current(double n, double U);
|
||||
// double Momentum(double I);
|
||||
// double MomentumF(double I, double Iw, Byte SCP);
|
||||
// bool CutOffEngine(void);
|
||||
// bool MaxCurrentSwitch(bool State);
|
||||
// bool ResistorsFlagCheck(void);
|
||||
// bool MinCurrentSwitch(bool State);
|
||||
// bool AutoRelaySwitch(bool State);
|
||||
// bool AutoRelayCheck(void);
|
||||
// bool dizel_EngageSwitch(double state);
|
||||
// bool dizel_EngageChange(double dt);
|
||||
// bool dizel_AutoGearCheck(void);
|
||||
// double dizel_fillcheck(Byte mcp);
|
||||
// double dizel_Momentum(double dizel_fill, double n, double dt);
|
||||
// bool dizel_Update(double dt);
|
||||
// bool LoadingDone(double LSpeed, AnsiString LoadInit);
|
||||
// void ComputeTotalForce(double dt, double dt1, bool FullVer);
|
||||
// double ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
// TTrackParam &Track
|
||||
// , TTractionParam &ElectricTraction, const TLocation &NewLoc, TRotation &NewRot);
|
||||
// double __fastcall FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam
|
||||
// double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam
|
||||
// &Track, const
|
||||
// TLocation &NewLoc, TRotation &NewRot);
|
||||
// bool __fastcall ChangeOffsetH(double DeltaOffset);
|
||||
// bool ChangeOffsetH(double DeltaOffset);
|
||||
//__fastcall T_MoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||
//int LoadInitial
|
||||
// , AnsiString LoadTypeInitial, int Cab);
|
||||
// bool __fastcall LoadChkFile(AnsiString chkpath);
|
||||
// bool __fastcall CheckLocomotiveParameters(bool ReadyFlag, int Dir);
|
||||
// AnsiString __fastcall EngineDescription(int what);
|
||||
// bool __fastcall DoorLeft(bool State);
|
||||
// bool __fastcall DoorRight(bool State);
|
||||
// bool __fastcall DoorBlockedFlag(void);
|
||||
// bool __fastcall PantFront(bool State);
|
||||
// bool __fastcall PantRear(bool State);
|
||||
// bool LoadChkFile(AnsiString chkpath);
|
||||
// bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
|
||||
// AnsiString EngineDescription(int what);
|
||||
// bool DoorLeft(bool State);
|
||||
// bool DoorRight(bool State);
|
||||
// bool DoorBlockedFlag(void);
|
||||
// bool PantFront(bool State);
|
||||
// bool PantRear(bool State);
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
12
Names.cpp
12
Names.cpp
@@ -31,7 +31,7 @@ Obiekty sortowane wg nazw, mo
|
||||
|
||||
*/
|
||||
|
||||
void __fastcall ItemRecord::TreeAdd(ItemRecord *r, int c)
|
||||
void ItemRecord::TreeAdd(ItemRecord *r, int c)
|
||||
{ // dodanie rekordu do drzewa - ustalenie w której gałęzi
|
||||
// zapisać w (iFlags) ile znaków jest zgodnych z nadrzędnym, żeby nie sprawdzać wszystkich od
|
||||
// zera
|
||||
@@ -53,7 +53,7 @@ void __fastcall ItemRecord::TreeAdd(ItemRecord *r, int c)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall ItemRecord::ListGet(ItemRecord *r, int *&n)
|
||||
void ItemRecord::ListGet(ItemRecord *r, int *&n)
|
||||
{ // rekurencyjne wypełnianie posortowanej listy na podstawie drzewa
|
||||
if (rPrev)
|
||||
rPrev->ListGet(r, n); // dodanie wszystkich wcześniejszych
|
||||
@@ -104,7 +104,7 @@ __fastcall TNames::TNames()
|
||||
ZeroMemory(rTypes, 20 * sizeof(ItemRecord *));
|
||||
};
|
||||
|
||||
int __fastcall TNames::Add(int t, const char *n)
|
||||
int TNames::Add(int t, const char *n)
|
||||
{ // dodanie obiektu typu (t) o nazwie (n)
|
||||
int len = strlen(n) + 1; // ze znacznikiem końca
|
||||
cLast -= len; // rezerwacja miejsca
|
||||
@@ -121,14 +121,14 @@ int __fastcall TNames::Add(int t, const char *n)
|
||||
Sort(t); // optymalizacja drzewa co jakiś czas
|
||||
return iLast;
|
||||
}
|
||||
int __fastcall TNames::Add(int t, const char *n, void *d)
|
||||
int TNames::Add(int t, const char *n, void *d)
|
||||
{
|
||||
int i = Add(t, n);
|
||||
rRecords[iLast].pData = d;
|
||||
return i;
|
||||
};
|
||||
|
||||
bool __fastcall TNames::Update(int t, const char *n, void *d)
|
||||
bool TNames::Update(int t, const char *n, void *d)
|
||||
{ // dodanie jeśli nie ma, wymiana (d), gdy jest
|
||||
ItemRecord *r = FindRecord(t, n); // najpierw sprawdzić, czy już jest
|
||||
if (r)
|
||||
@@ -155,7 +155,7 @@ ItemRecord *__fastcall TNames::TreeSet(int *n, int d, int u)
|
||||
return rRecords + n[p];
|
||||
};
|
||||
|
||||
void __fastcall TNames::Sort(int t)
|
||||
void TNames::Sort(int t)
|
||||
{ // przebudowa drzewa typu (t), zwraca wierzchołek drzewa
|
||||
if (iLast < 3)
|
||||
return; // jak jest mało, to nie ma sensu sortować
|
||||
|
||||
18
Names.h
18
Names.h
@@ -17,8 +17,8 @@ class ItemRecord
|
||||
unsigned int uData;
|
||||
};
|
||||
// typedef
|
||||
void __fastcall ListGet(ItemRecord *r, int *&n);
|
||||
void __fastcall TreeAdd(ItemRecord *r, int c);
|
||||
void ListGet(ItemRecord *r, int *&n);
|
||||
void TreeAdd(ItemRecord *r, int c);
|
||||
template <typename TOut> inline TOut *DataGet() { return (TOut *)pData; };
|
||||
template <typename TOut> inline void DataSet(TOut *x) { pData = (void *)x; };
|
||||
void *__fastcall TreeFind(const char *n);
|
||||
@@ -35,15 +35,15 @@ class TNames
|
||||
ItemRecord *rTypes[20]; // ro¿ne typy obiektów (pocz¹tek drzewa)
|
||||
int iLast; // ostatnio u¿yty rekord
|
||||
public:
|
||||
__fastcall TNames();
|
||||
int __fastcall Add(int t, const char *n); // dodanie obiektu typu (t)
|
||||
int __fastcall Add(int t, const char *n, void *d); // dodanie obiektu z wskaŸnikiem
|
||||
int __fastcall Add(int t, const char *n, int d); // dodanie obiektu z numerem
|
||||
bool __fastcall Update(int t, const char *n,
|
||||
TNames();
|
||||
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, int d); // dodanie obiektu z numerem
|
||||
bool Update(int t, const char *n,
|
||||
void *d); // dodanie jeœli nie ma, wymiana (d), gdy jest
|
||||
void __fastcall TreeSet();
|
||||
void TreeSet();
|
||||
ItemRecord *__fastcall TreeSet(int *n, int d, int u);
|
||||
void __fastcall Sort(int t); // przebudowa drzewa typu (t)
|
||||
void Sort(int t); // przebudowa drzewa typu (t)
|
||||
ItemRecord *__fastcall Item(int n); // rekord o numerze (n)
|
||||
inline void *Find(const int t, const char *n)
|
||||
{
|
||||
|
||||
@@ -38,9 +38,9 @@ __fastcall TRealSound::~TRealSound()
|
||||
// if (this) if (pSound) pSound->Stop();
|
||||
}
|
||||
|
||||
void __fastcall TRealSound::Free() {}
|
||||
void TRealSound::Free() {}
|
||||
|
||||
void __fastcall TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y,
|
||||
void TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y,
|
||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
||||
{
|
||||
// Nazwa=SoundName; //to tak raczej nie zadziała, (SoundName) jest tymczasowe
|
||||
@@ -76,7 +76,7 @@ void __fastcall TRealSound::Init(char *SoundName, double DistanceAttenuation, do
|
||||
dSoundAtt = -1;
|
||||
};
|
||||
|
||||
double __fastcall TRealSound::ListenerDistance(vector3 ListenerPosition)
|
||||
double TRealSound::ListenerDistance(vector3 ListenerPosition)
|
||||
{
|
||||
if (dSoundAtt == -1)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ double __fastcall TRealSound::ListenerDistance(vector3 ListenerPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
void TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
{
|
||||
if (!pSound)
|
||||
@@ -161,11 +161,11 @@ void __fastcall TRealSound::Play(double Volume, int Looping, bool ListenerInside
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TRealSound::Start(){// włączenie dźwięku
|
||||
void TRealSound::Start(){// włączenie dźwięku
|
||||
|
||||
};
|
||||
|
||||
void __fastcall TRealSound::Stop()
|
||||
void TRealSound::Stop()
|
||||
{
|
||||
DWORD stat;
|
||||
if (pSound)
|
||||
@@ -178,7 +178,7 @@ void __fastcall TRealSound::Stop()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TRealSound::AdjFreq(double Freq,
|
||||
void TRealSound::AdjFreq(double Freq,
|
||||
double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
||||
// Freq moze byc liczba dodatnia mniejsza od 1 lub wieksza od 1
|
||||
{
|
||||
@@ -216,7 +216,7 @@ double TRealSound::GetWaveTime() // McZapkie: na razie tylko dla 22KHz/8bps
|
||||
fFrequency; //(pSound->); // wielkosc w bajtach przez czestotliwosc probkowania
|
||||
}
|
||||
|
||||
void __fastcall TRealSound::SetPan(int Pan) { pSound->SetPan(Pan); }
|
||||
void TRealSound::SetPan(int Pan) { pSound->SetPan(Pan); }
|
||||
|
||||
int TRealSound::GetStatus()
|
||||
{
|
||||
@@ -230,13 +230,13 @@ int TRealSound::GetStatus()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __fastcall TRealSound::ResetPosition()
|
||||
void TRealSound::ResetPosition()
|
||||
{
|
||||
if (pSound) // Ra: znowu jakiś badziew!
|
||||
pSound->SetCurrentPosition(0);
|
||||
}
|
||||
|
||||
void __fastcall TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y,
|
||||
void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y,
|
||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
||||
{ // dodatkowo doczytuje plik tekstowy
|
||||
TRealSound::Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
|
||||
@@ -257,7 +257,7 @@ void __fastcall TTextSound::Init(char *SoundName, double SoundAttenuation, doubl
|
||||
delete ts;
|
||||
}
|
||||
};
|
||||
void __fastcall TTextSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
void TTextSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
{
|
||||
if (!asText.IsEmpty())
|
||||
|
||||
28
RealSound.h
28
RealSound.h
@@ -21,21 +21,21 @@ class TRealSound
|
||||
double FM; // mnoznik czestotliwosci
|
||||
double FA; // offset czestotliwosci
|
||||
bool bLoopPlay; // czy zapętlony dźwięk jest odtwarzany
|
||||
__fastcall TRealSound();
|
||||
__fastcall ~TRealSound();
|
||||
void __fastcall Free();
|
||||
void __fastcall Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
TRealSound();
|
||||
~TRealSound();
|
||||
void Free();
|
||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
||||
double __fastcall ListenerDistance(vector3 ListenerPosition);
|
||||
void __fastcall Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
void __fastcall Start();
|
||||
void __fastcall Stop();
|
||||
void __fastcall AdjFreq(double Freq, double dt);
|
||||
void __fastcall SetPan(int Pan);
|
||||
double ListenerDistance(vector3 ListenerPosition);
|
||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
void Start();
|
||||
void Stop();
|
||||
void AdjFreq(double Freq, double dt);
|
||||
void SetPan(int Pan);
|
||||
double GetWaveTime(); // McZapkie TODO: dorobic dla roznych bps
|
||||
int GetStatus();
|
||||
void __fastcall ResetPosition();
|
||||
// void __fastcall FreqReset(float f=22050.0) {fFrequency=f;};
|
||||
void ResetPosition();
|
||||
// void FreqReset(float f=22050.0) {fFrequency=f;};
|
||||
};
|
||||
|
||||
class TTextSound : public TRealSound
|
||||
@@ -43,9 +43,9 @@ class TTextSound : public TRealSound
|
||||
AnsiString asText;
|
||||
float fTime; // czas trwania
|
||||
public:
|
||||
void __fastcall 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 freqmod = false, double rmin = 0.0);
|
||||
void __fastcall Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
};
|
||||
|
||||
class TSynthSound
|
||||
|
||||
38
Segment.cpp
38
Segment.cpp
@@ -18,7 +18,7 @@
|
||||
// 101206 Ra: trapezoidalne drogi
|
||||
// 110806 Ra: odwrócone mapowanie wzdłuż - Point1 == 1.0
|
||||
|
||||
AnsiString __fastcall Where(vector3 p)
|
||||
AnsiString Where(vector3 p)
|
||||
{ // zamiana współrzędnych na tekst, używana w błędach
|
||||
return AnsiString(p.x) + " " + AnsiString(p.y) + " " + AnsiString(p.z);
|
||||
};
|
||||
@@ -36,7 +36,7 @@ __fastcall TSegment::TSegment(TTrack *owner)
|
||||
|
||||
__fastcall TSegment::~TSegment() { SafeDeleteArray(fTsBuffer); };
|
||||
|
||||
bool __fastcall TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
double fNewRoll1, double fNewRoll2)
|
||||
{ // wersja dla prostego - wyliczanie punktów kontrolnych
|
||||
vector3 dir;
|
||||
@@ -54,7 +54,7 @@ bool __fastcall TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNew
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
bool TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1,
|
||||
double fNewRoll2, bool bIsCurve)
|
||||
{ // wersja uniwersalna (dla krzywej i prostego)
|
||||
@@ -140,7 +140,7 @@ bool __fastcall TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3
|
||||
return true;
|
||||
}
|
||||
|
||||
vector3 __fastcall TSegment::GetFirstDerivative(double fTime)
|
||||
vector3 TSegment::GetFirstDerivative(double fTime)
|
||||
{
|
||||
|
||||
double fOmTime = 1.0 - fTime;
|
||||
@@ -159,7 +159,7 @@ vector3 __fastcall TSegment::GetFirstDerivative(double fTime)
|
||||
return kResult;
|
||||
}
|
||||
|
||||
double __fastcall TSegment::RombergIntegral(double fA, double fB)
|
||||
double TSegment::RombergIntegral(double fA, double fB)
|
||||
{
|
||||
double fH = fB - fA;
|
||||
|
||||
@@ -191,7 +191,7 @@ double __fastcall TSegment::RombergIntegral(double fA, double fB)
|
||||
return ms_apfRom[0][ms_iOrder - 1];
|
||||
}
|
||||
|
||||
double __fastcall TSegment::GetTFromS(double s)
|
||||
double TSegment::GetTFromS(double s)
|
||||
{
|
||||
// initial guess for Newton's method
|
||||
int it = 0;
|
||||
@@ -223,17 +223,17 @@ double __fastcall TSegment::GetTFromS(double s)
|
||||
// return -1; //Ra: tu nigdy nie dojdzie
|
||||
};
|
||||
|
||||
vector3 __fastcall TSegment::RaInterpolate(double t)
|
||||
vector3 TSegment::RaInterpolate(double t)
|
||||
{ // wyliczenie XYZ na krzywej Beziera z użyciem współczynników
|
||||
return t * (t * (t * vA + vB) + vC) + Point1; // 9 mnożeń, 9 dodawań
|
||||
};
|
||||
|
||||
vector3 __fastcall TSegment::RaInterpolate0(double t)
|
||||
vector3 TSegment::RaInterpolate0(double t)
|
||||
{ // wyliczenie XYZ na krzywej Beziera, na użytek liczenia długości nie jest dodawane Point1
|
||||
return t * (t * (t * vA + vB) + vC); // 9 mnożeń, 6 dodawań
|
||||
};
|
||||
|
||||
double __fastcall TSegment::ComputeLength() // McZapkie-150503: dlugosc miedzy punktami krzywej
|
||||
double TSegment::ComputeLength() // McZapkie-150503: dlugosc miedzy punktami krzywej
|
||||
{ // obliczenie długości krzywej Beziera za pomocą interpolacji odcinkami
|
||||
// Ra: zamienić na liczenie rekurencyjne średniej z cięciwy i łamanej po kontrolnych
|
||||
// Ra: koniec rekurencji jeśli po podziale suma długości nie różni się więcej niż 0.5mm od
|
||||
@@ -257,7 +257,7 @@ double __fastcall TSegment::ComputeLength() // McZapkie-150503: dlugosc miedzy p
|
||||
|
||||
const double fDirectionOffset = 0.1; // długość wektora do wyliczenia kierunku
|
||||
|
||||
vector3 __fastcall TSegment::GetDirection(double fDistance)
|
||||
vector3 TSegment::GetDirection(double fDistance)
|
||||
{ // takie toporne liczenie pochodnej dla podanego dystansu od Point1
|
||||
double t1 = GetTFromS(fDistance - fDirectionOffset);
|
||||
if (t1 <= 0.0)
|
||||
@@ -268,7 +268,7 @@ vector3 __fastcall TSegment::GetDirection(double fDistance)
|
||||
return (FastGetPoint(t2) - FastGetPoint(t1));
|
||||
}
|
||||
|
||||
vector3 __fastcall TSegment::FastGetDirection(double fDistance, double fOffset)
|
||||
vector3 TSegment::FastGetDirection(double fDistance, double fOffset)
|
||||
{ // takie toporne liczenie pochodnej dla parametru 0.0÷1.0
|
||||
double t1 = fDistance - fOffset;
|
||||
if (t1 <= 0.0)
|
||||
@@ -279,7 +279,7 @@ vector3 __fastcall TSegment::FastGetDirection(double fDistance, double fOffset)
|
||||
return (FastGetPoint(t2) - FastGetPoint(t1));
|
||||
}
|
||||
|
||||
vector3 __fastcall TSegment::GetPoint(double fDistance)
|
||||
vector3 TSegment::GetPoint(double fDistance)
|
||||
{ // wyliczenie współrzędnych XYZ na torze w odległości (fDistance) od Point1
|
||||
if (bCurve)
|
||||
{ // można by wprowadzić uproszczony wzór dla okręgów płaskich
|
||||
@@ -294,7 +294,7 @@ vector3 __fastcall TSegment::GetPoint(double fDistance)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSegment::RaPositionGet(double fDistance, vector3 &p, vector3 &a)
|
||||
void TSegment::RaPositionGet(double fDistance, vector3 &p, vector3 &a)
|
||||
{ // ustalenie pozycji osi na torze, przechyłki, pochylenia i kierunku jazdy
|
||||
if (bCurve)
|
||||
{ // można by wprowadzić uproszczony wzór dla okręgów płaskich
|
||||
@@ -316,13 +316,13 @@ void __fastcall TSegment::RaPositionGet(double fDistance, vector3 &p, vector3 &a
|
||||
}
|
||||
};
|
||||
|
||||
vector3 __fastcall TSegment::FastGetPoint(double t)
|
||||
vector3 TSegment::FastGetPoint(double t)
|
||||
{
|
||||
// return (bCurve?Interpolate(t,Point1,CPointOut,CPointIn,Point2):((1.0-t)*Point1+(t)*Point2));
|
||||
return (bCurve ? RaInterpolate(t) : ((1.0 - t) * Point1 + (t)*Point2));
|
||||
}
|
||||
|
||||
void __fastcall TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
void TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
double fTextureLength, int iSkip, int iQualityFactor,
|
||||
vector3 **p, bool bRender)
|
||||
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
||||
@@ -503,7 +503,7 @@ void __fastcall TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePo
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSegment::RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||
void TSegment::RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip,
|
||||
double fOffsetX)
|
||||
{ // tworzenie siatki trójkątów dla iglicy
|
||||
@@ -641,7 +641,7 @@ void __fastcall TSegment::RenderSwitchRail(const vector6 *ShapePoints1, const ve
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSegment::Render()
|
||||
void TSegment::Render()
|
||||
{
|
||||
vector3 pt;
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
@@ -689,7 +689,7 @@ void __fastcall TSegment::Render()
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip,
|
||||
int iEnd, double fOffsetX)
|
||||
{ // generowanie trójkątów dla odcinka trajektorii ruchu
|
||||
@@ -889,7 +889,7 @@ void __fastcall TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *Shape
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TSegment::RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
void TSegment::RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip, int iEnd,
|
||||
double fOffsetX)
|
||||
{ // jak wyżej, tylko z pominięciem mapowania i braku trapezowania
|
||||
|
||||
70
Segment.h
70
Segment.h
@@ -15,12 +15,12 @@ class vector6 : public vector3
|
||||
{ // punkt przekroju wraz z wektorem normalnym
|
||||
public:
|
||||
vector3 n;
|
||||
__fastcall vector6()
|
||||
vector6()
|
||||
{
|
||||
x = y = z = n.x = n.z = 0.0;
|
||||
n.y = 1.0;
|
||||
};
|
||||
__fastcall vector6(double a, double b, double c, double d, double e, double f)
|
||||
vector6(double a, double b, double c, double d, double e, double f)
|
||||
//{x=a; y=b; z=c; n.x=d; n.y=e; n.z=f;};
|
||||
{
|
||||
x = a;
|
||||
@@ -30,7 +30,7 @@ class vector6 : public vector3
|
||||
n.y = 1.0;
|
||||
n.z = 0.0;
|
||||
}; // Ra: bo na razie s¹ z tym problemy
|
||||
__fastcall vector6(double a, double b, double c)
|
||||
vector6(double a, double b, double c)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
@@ -57,54 +57,54 @@ class TSegment
|
||||
// TSegment *pNext; //odcinek od strony punktu 2
|
||||
TTrack *pOwner; // wskaŸnik na w³aœciciela
|
||||
double fAngle[2]; // k¹ty zakoñczenia drogi na przejazdach
|
||||
vector3 __fastcall GetFirstDerivative(double fTime);
|
||||
double __fastcall RombergIntegral(double fA, double fB);
|
||||
double __fastcall GetTFromS(double s);
|
||||
vector3 __fastcall RaInterpolate(double t);
|
||||
vector3 __fastcall RaInterpolate0(double t);
|
||||
vector3 GetFirstDerivative(double fTime);
|
||||
double RombergIntegral(double fA, double fB);
|
||||
double GetTFromS(double s);
|
||||
vector3 RaInterpolate(double t);
|
||||
vector3 RaInterpolate0(double t);
|
||||
// TSegment *segNeightbour[2]; //s¹siednie odcinki - musi byæ przeniesione z Track
|
||||
// int iNeightbour[2]; //do którego koñca doczepiony
|
||||
public:
|
||||
bool bCurve;
|
||||
// int iShape; //Ra: flagi kszta³tu dadz¹ wiêcej mo¿liwoœci optymalizacji
|
||||
// (0-Bezier,1-prosty,2/3-³uk w lewo/prawo,6/7-przejœciowa w lewo/prawo)
|
||||
__fastcall TSegment(TTrack *owner);
|
||||
__fastcall ~TSegment();
|
||||
bool __fastcall Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
TSegment(TTrack *owner);
|
||||
~TSegment();
|
||||
bool Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
double fNewRoll1 = 0, double fNewRoll2 = 0);
|
||||
bool __fastcall Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
bool Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1 = 0,
|
||||
double fNewRoll2 = 0, bool bIsCurve = true);
|
||||
inline double __fastcall ComputeLength(); // McZapkie-150503
|
||||
inline vector3 __fastcall GetDirection1() { return bCurve ? CPointOut - Point1 : CPointOut; };
|
||||
inline vector3 __fastcall GetDirection2() { return bCurve ? CPointIn - Point2 : CPointIn; };
|
||||
vector3 __fastcall GetDirection(double fDistance);
|
||||
vector3 __fastcall GetDirection() { return CPointOut; };
|
||||
vector3 __fastcall FastGetDirection(double fDistance, double fOffset);
|
||||
vector3 __fastcall GetPoint(double fDistance);
|
||||
void __fastcall RaPositionGet(double fDistance, vector3 &p, vector3 &a);
|
||||
vector3 __fastcall FastGetPoint(double t);
|
||||
inline vector3 __fastcall FastGetPoint_0() { return Point1; };
|
||||
inline vector3 __fastcall FastGetPoint_1() { return Point2; };
|
||||
inline double __fastcall GetRoll(double s)
|
||||
inline double ComputeLength(); // McZapkie-150503
|
||||
inline vector3 GetDirection1() { return bCurve ? CPointOut - Point1 : CPointOut; };
|
||||
inline vector3 GetDirection2() { return bCurve ? CPointIn - Point2 : CPointIn; };
|
||||
vector3 GetDirection(double fDistance);
|
||||
vector3 GetDirection() { return CPointOut; };
|
||||
vector3 FastGetDirection(double fDistance, double fOffset);
|
||||
vector3 GetPoint(double fDistance);
|
||||
void RaPositionGet(double fDistance, vector3 &p, vector3 &a);
|
||||
vector3 FastGetPoint(double t);
|
||||
inline vector3 FastGetPoint_0() { return Point1; };
|
||||
inline vector3 FastGetPoint_1() { return Point2; };
|
||||
inline double GetRoll(double s)
|
||||
{
|
||||
s /= fLength;
|
||||
return ((1.0 - s) * fRoll1 + s * fRoll2);
|
||||
}
|
||||
void __fastcall GetRolls(double &r1, double &r2)
|
||||
void GetRolls(double &r1, double &r2)
|
||||
{ // pobranie przechy³ek (do generowania trójk¹tów)
|
||||
r1 = fRoll1;
|
||||
r2 = fRoll2;
|
||||
}
|
||||
void __fastcall RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
void RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
double fTextureLength, int iSkip = 0, int iQualityFactor = 1,
|
||||
vector3 **p = NULL, bool bRender = true);
|
||||
void __fastcall RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||
void RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
||||
double fOffsetX = 0.0f);
|
||||
void __fastcall Render();
|
||||
inline double __fastcall GetLength() { return fLength; };
|
||||
void __fastcall MoveMe(vector3 pPosition)
|
||||
void Render();
|
||||
inline double GetLength() { return fLength; };
|
||||
void MoveMe(vector3 pPosition)
|
||||
{
|
||||
Point1 += pPosition;
|
||||
Point2 += pPosition;
|
||||
@@ -114,15 +114,15 @@ class TSegment
|
||||
CPointOut += pPosition;
|
||||
}
|
||||
}
|
||||
int __fastcall RaSegCount() { return fTsBuffer ? iSegCount : 1; };
|
||||
void __fastcall RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int RaSegCount() { return fTsBuffer ? iSegCount : 1; };
|
||||
void RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
||||
int iEnd = 0, double fOffsetX = 0.0);
|
||||
void __fastcall 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 fOffsetX = 0.0);
|
||||
void __fastcall AngleSet(int i, double a) { fAngle[i] = a; };
|
||||
void __fastcall Rollment(double w1, double w2); // poprawianie przechy³ki
|
||||
void AngleSet(int i, double a) { fAngle[i] = a; };
|
||||
void Rollment(double w1, double w2); // poprawianie przechy³ki
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
16
Sound.cpp
16
Sound.cpp
@@ -152,7 +152,7 @@ __fastcall TSoundContainer::~TSoundContainer()
|
||||
SafeDelete(Next);
|
||||
};
|
||||
|
||||
LPDIRECTSOUNDBUFFER __fastcall TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
|
||||
LPDIRECTSOUNDBUFFER TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
|
||||
{
|
||||
if (!DSBuffer)
|
||||
return NULL;
|
||||
@@ -166,7 +166,7 @@ LPDIRECTSOUNDBUFFER __fastcall TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
|
||||
|
||||
__fastcall TSoundsManager::~TSoundsManager() { Free(); };
|
||||
|
||||
void __fastcall TSoundsManager::Free()
|
||||
void TSoundsManager::Free()
|
||||
{
|
||||
SafeDelete(First);
|
||||
SAFE_RELEASE(pDS);
|
||||
@@ -181,7 +181,7 @@ TSoundContainer *__fastcall TSoundsManager::LoadFromFile(char *Dir, char *Name,
|
||||
return First; // albo NULL, jak nie wyjdzie (na razie zawsze wychodzi)
|
||||
};
|
||||
|
||||
void __fastcall TSoundsManager::LoadSounds(char *Directory)
|
||||
void TSoundsManager::LoadSounds(char *Directory)
|
||||
{ // wczytanie wszystkich plików z katalogu - ma³o elastyczne
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE handle = FindFirstFile("sounds\\*.wav", &FindFileData);
|
||||
@@ -193,7 +193,7 @@ void __fastcall TSoundsManager::LoadSounds(char *Directory)
|
||||
FindClose(handle);
|
||||
};
|
||||
|
||||
LPDIRECTSOUNDBUFFER __fastcall TSoundsManager::GetFromName(char *Name, bool Dynamic,
|
||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic,
|
||||
float *fSamplingRate)
|
||||
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
|
||||
AnsiString file;
|
||||
@@ -254,7 +254,7 @@ LPDIRECTSOUNDBUFFER __fastcall TSoundsManager::GetFromName(char *Name, bool Dyna
|
||||
return (NULL);
|
||||
};
|
||||
|
||||
void __fastcall TSoundsManager::RestoreAll()
|
||||
void TSoundsManager::RestoreAll()
|
||||
{
|
||||
TSoundContainer *Next = First;
|
||||
|
||||
@@ -293,11 +293,11 @@ void __fastcall TSoundsManager::RestoreAll()
|
||||
};
|
||||
};
|
||||
|
||||
// void __fastcall TSoundsManager::Init(char *Name, int Concurrent)
|
||||
// void TSoundsManager::Init(char *Name, int Concurrent)
|
||||
//__fastcall TSoundsManager::TSoundsManager(HWND hWnd)
|
||||
// void __fastcall TSoundsManager::Init(HWND hWnd, char *NDirectory)
|
||||
// void TSoundsManager::Init(HWND hWnd, char *NDirectory)
|
||||
|
||||
void __fastcall TSoundsManager::Init(HWND hWnd)
|
||||
void TSoundsManager::Init(HWND hWnd)
|
||||
{
|
||||
|
||||
First = NULL;
|
||||
|
||||
26
Sound.h
26
Sound.h
@@ -14,7 +14,7 @@
|
||||
|
||||
typedef LPDIRECTSOUNDBUFFER PSound;
|
||||
|
||||
// inline __fastcall Playing(PSound Sound)
|
||||
// inline Playing(PSound Sound)
|
||||
//{
|
||||
|
||||
//}
|
||||
@@ -30,10 +30,10 @@ class TSoundContainer
|
||||
int iBitsPerSample; // ile bitów na próbkê
|
||||
TSoundContainer *Next;
|
||||
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
|
||||
LPDIRECTSOUNDBUFFER __fastcall GetUnique(LPDIRECTSOUND pDS);
|
||||
__fastcall TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName,
|
||||
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
|
||||
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName,
|
||||
int NConcurrent);
|
||||
__fastcall ~TSoundContainer();
|
||||
~TSoundContainer();
|
||||
};
|
||||
|
||||
class TSoundsManager
|
||||
@@ -47,16 +47,16 @@ class TSoundsManager
|
||||
static TSoundContainer *__fastcall LoadFromFile(char *Dir, char *Name, int Concurrent);
|
||||
|
||||
public:
|
||||
// __fastcall TSoundsManager(HWND hWnd);
|
||||
// static void __fastcall Init(HWND hWnd, char *NDirectory);
|
||||
static void __fastcall Init(HWND hWnd);
|
||||
__fastcall ~TSoundsManager();
|
||||
static void __fastcall Free();
|
||||
static void __fastcall Init(char *Name, int Concurrent);
|
||||
static void __fastcall LoadSounds(char *Directory);
|
||||
static LPDIRECTSOUNDBUFFER __fastcall GetFromName(char *Name, bool Dynamic,
|
||||
// TSoundsManager(HWND hWnd);
|
||||
// static void Init(HWND hWnd, char *NDirectory);
|
||||
static void Init(HWND hWnd);
|
||||
~TSoundsManager();
|
||||
static void Free();
|
||||
static void Init(char *Name, int Concurrent);
|
||||
static void LoadSounds(char *Directory);
|
||||
static LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic,
|
||||
float *fSamplingRate = NULL);
|
||||
static void __fastcall RestoreAll();
|
||||
static void RestoreAll();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
28
Spline.cpp
28
Spline.cpp
@@ -11,7 +11,7 @@
|
||||
|
||||
//#define asSplinesPatch AnsiString("Scenery\\")
|
||||
|
||||
bool __fastcall Connect(TKnot *k1, TKnot *k2)
|
||||
bool Connect(TKnot *k1, TKnot *k2)
|
||||
{
|
||||
if (k1 && k2)
|
||||
{
|
||||
@@ -25,7 +25,7 @@ bool __fastcall Connect(TKnot *k1, TKnot *k2)
|
||||
}
|
||||
|
||||
#define Precision 10000
|
||||
float __fastcall CurveLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||
float CurveLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||
{
|
||||
float t, l = 0;
|
||||
vector3 tmp, last = p1;
|
||||
@@ -68,7 +68,7 @@ __fastcall TKnot::TKnot(int n)
|
||||
|
||||
__fastcall TKnot::~TKnot() {}
|
||||
|
||||
vector3 __fastcall TKnot::GetDirection(float t)
|
||||
vector3 TKnot::GetDirection(float t)
|
||||
{
|
||||
if (IsCurve)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ vector3 __fastcall TKnot::GetDirection(float t)
|
||||
Point); // Spline->Knots[KnotIndex].Point-Spline->Knots[KnotIndex].Point);
|
||||
}
|
||||
|
||||
float __fastcall TKnot::GetTFromS(float s)
|
||||
float TKnot::GetTFromS(float s)
|
||||
{
|
||||
// initial guess for Newton's method
|
||||
int it = 0;
|
||||
@@ -109,7 +109,7 @@ float __fastcall TKnot::GetTFromS(float s)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool __fastcall TKnot::Init(TKnot *NNext, TKnot *NPrev)
|
||||
bool TKnot::Init(TKnot *NNext, TKnot *NPrev)
|
||||
{
|
||||
if (NNext != NULL)
|
||||
{
|
||||
@@ -123,7 +123,7 @@ bool __fastcall TKnot::Init(TKnot *NNext, TKnot *NPrev)
|
||||
}
|
||||
}
|
||||
|
||||
bool __fastcall TKnot::InitCPoints()
|
||||
bool TKnot::InitCPoints()
|
||||
{
|
||||
if (Prev != NULL)
|
||||
if (Prev->IsCurve)
|
||||
@@ -165,7 +165,7 @@ bool __fastcall TKnot::InitCPoints()
|
||||
CPointOut = Point - fLengthOut * Normalize(Prev->Point - Point);
|
||||
}
|
||||
|
||||
bool __fastcall TKnot::InitLength()
|
||||
bool TKnot::InitLength()
|
||||
{
|
||||
|
||||
if (IsCurve)
|
||||
@@ -272,7 +272,7 @@ __fastcall TSpline::~TSpline()
|
||||
}
|
||||
}
|
||||
|
||||
bool __fastcall TSpline::Create(int n, AnsiString asNName)
|
||||
bool TSpline::Create(int n, AnsiString asNName)
|
||||
{
|
||||
/*
|
||||
// asName= asNName;
|
||||
@@ -286,14 +286,14 @@ bool __fastcall TSpline::Create(int n, AnsiString asNName)
|
||||
*/
|
||||
}
|
||||
|
||||
bool __fastcall TSpline::AssignKnots(TKnot *FirstKnot, int n)
|
||||
bool TSpline::AssignKnots(TKnot *FirstKnot, int n)
|
||||
{
|
||||
// iNumKnots= n;
|
||||
// Knots= FirstKnot;
|
||||
// KnotsAllocated= false;
|
||||
}
|
||||
|
||||
int __fastcall TSpline::LoadFromFile(AnsiString FileName, TKnot *FirstKnot)
|
||||
int TSpline::LoadFromFile(AnsiString FileName, TKnot *FirstKnot)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
@@ -376,7 +376,7 @@ int __fastcall TSpline::LoadFromFile(AnsiString FileName, TKnot *FirstKnot)
|
||||
*/
|
||||
}
|
||||
|
||||
int __fastcall TSpline::Load(TQueryParserComp *Parser, AnsiString asEndString)
|
||||
int TSpline::Load(TQueryParserComp *Parser, AnsiString asEndString)
|
||||
{
|
||||
TKnot *LastKnot = NULL;
|
||||
;
|
||||
@@ -436,7 +436,7 @@ int __fastcall TSpline::Load(TQueryParserComp *Parser, AnsiString asEndString)
|
||||
LastKnot->InitLength();
|
||||
}
|
||||
|
||||
float __fastcall TSpline::GetLength()
|
||||
float TSpline::GetLength()
|
||||
{
|
||||
TKnot *tmp = RootKnot;
|
||||
float l = 0;
|
||||
@@ -449,7 +449,7 @@ float __fastcall TSpline::GetLength()
|
||||
return l;
|
||||
}
|
||||
|
||||
vector3 __fastcall TSpline::GetCenter()
|
||||
vector3 TSpline::GetCenter()
|
||||
{
|
||||
TKnot *ck, *tk;
|
||||
ck = RootKnot;
|
||||
@@ -476,7 +476,7 @@ TKnot *__fastcall TSpline::GetLastKnot()
|
||||
return ck;
|
||||
}
|
||||
|
||||
bool __fastcall TSpline::Render()
|
||||
bool TSpline::Render()
|
||||
{
|
||||
TKnot *LastKnot = NULL;
|
||||
;
|
||||
|
||||
46
Spline.h
46
Spline.h
@@ -15,12 +15,12 @@ using namespace Math3D;
|
||||
class TKnot
|
||||
{
|
||||
public:
|
||||
// inline bool __fastcall IsCurve() { return (!(Point==CPointIn)); };
|
||||
// inline vector3 __fastcall GetDirection() { return (CPointOut-Point); };
|
||||
__fastcall TKnot();
|
||||
__fastcall TKnot(int n);
|
||||
__fastcall ~TKnot();
|
||||
inline float __fastcall GetRoll(float s)
|
||||
// inline bool IsCurve() { return (!(Point==CPointIn)); };
|
||||
// inline vector3 GetDirection() { return (CPointOut-Point); };
|
||||
TKnot();
|
||||
TKnot(int n);
|
||||
~TKnot();
|
||||
inline float GetRoll(float s)
|
||||
{
|
||||
if (Next)
|
||||
{
|
||||
@@ -31,15 +31,15 @@ class TKnot
|
||||
return fRoll;
|
||||
// (Length-s) (s-Length)
|
||||
}
|
||||
vector3 __fastcall GetDirection(float t = 0);
|
||||
inline vector3 __fastcall InterpolateSegm(float t)
|
||||
vector3 GetDirection(float t = 0);
|
||||
inline vector3 InterpolateSegm(float t)
|
||||
{
|
||||
return (Interpolate(t, Point, CPointOut, Next->CPointIn, Next->Point));
|
||||
};
|
||||
float __fastcall GetTFromS(float s);
|
||||
bool __fastcall Init(TKnot *NNext, TKnot *NPrev);
|
||||
bool __fastcall InitCPoints();
|
||||
bool __fastcall InitLength();
|
||||
float GetTFromS(float s);
|
||||
bool Init(TKnot *NNext, TKnot *NPrev);
|
||||
bool InitCPoints();
|
||||
bool InitLength();
|
||||
vector3 Point, CPointIn, CPointOut;
|
||||
float fRoll;
|
||||
bool IsCurve;
|
||||
@@ -57,17 +57,17 @@ class TKnot
|
||||
class TSpline
|
||||
{
|
||||
public:
|
||||
__fastcall TSpline();
|
||||
__fastcall TSpline(AnsiString asNName);
|
||||
__fastcall ~TSpline();
|
||||
bool __fastcall Create(int n, AnsiString asNName = "foo");
|
||||
bool __fastcall AssignKnots(TKnot *FirstKnot, int n);
|
||||
int __fastcall LoadFromFile(AnsiString FileName, TKnot *FirstKnot = NULL);
|
||||
int __fastcall Load(TQueryParserComp *Parser, AnsiString asEndString = "endspline");
|
||||
float __fastcall GetLength();
|
||||
vector3 __fastcall GetCenter();
|
||||
TSpline();
|
||||
TSpline(AnsiString asNName);
|
||||
~TSpline();
|
||||
bool Create(int n, AnsiString asNName = "foo");
|
||||
bool AssignKnots(TKnot *FirstKnot, int n);
|
||||
int LoadFromFile(AnsiString FileName, TKnot *FirstKnot = NULL);
|
||||
int Load(TQueryParserComp *Parser, AnsiString asEndString = "endspline");
|
||||
float GetLength();
|
||||
vector3 GetCenter();
|
||||
TKnot *__fastcall GetLastKnot();
|
||||
bool __fastcall Render();
|
||||
bool Render();
|
||||
|
||||
// inline int NextIndex(int n) { return (n<KnotsCount-1 ? n+1 : 0); };
|
||||
|
||||
@@ -89,7 +89,7 @@ class TSpline
|
||||
private:
|
||||
};
|
||||
|
||||
bool __fastcall Connect(TKnot *k1, TKnot *k2);
|
||||
bool Connect(TKnot *k1, TKnot *k2);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -19,14 +19,14 @@ __fastcall TSpring::TSpring()
|
||||
|
||||
__fastcall TSpring::~TSpring() {}
|
||||
|
||||
void __fastcall TSpring::Init(double nrestLen, double nKs, double nKd)
|
||||
void TSpring::Init(double nrestLen, double nKs, double nKd)
|
||||
{
|
||||
Ks = nKs;
|
||||
Kd = nKd;
|
||||
restLen = nrestLen;
|
||||
}
|
||||
|
||||
bool __fastcall TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
||||
bool TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
||||
{
|
||||
|
||||
double dist, Hterm, Dterm;
|
||||
@@ -65,7 +65,7 @@ bool __fastcall TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TSpring::Render() {}
|
||||
void TSpring::Render() {}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
12
Spring.h
12
Spring.h
@@ -19,13 +19,13 @@ using namespace Math3D;
|
||||
class TSpring
|
||||
{
|
||||
public:
|
||||
__fastcall TSpring();
|
||||
__fastcall ~TSpring();
|
||||
// void __fastcall Init(TParticnp1, TParticle *np2, double nKs= 0.5f, double nKd= 0.002f,
|
||||
TSpring();
|
||||
~TSpring();
|
||||
// void Init(TParticnp1, TParticle *np2, double nKs= 0.5f, double nKd= 0.002f,
|
||||
// double nrestLen= -1.0f);
|
||||
void __fastcall Init(double nrestLen, double nKs = 0.5f, double nKd = 0.002f);
|
||||
bool __fastcall ComputateForces(vector3 pPosition1, vector3 pPosition2);
|
||||
void __fastcall Render();
|
||||
void Init(double nrestLen, double nKs = 0.5f, double nKd = 0.002f);
|
||||
bool ComputateForces(vector3 pPosition1, vector3 pPosition2);
|
||||
void Render();
|
||||
vector3 vForce1, vForce2;
|
||||
double restLen; // LENGTH OF SPRING AT REST
|
||||
double Ks; // SPRING CONSTANT
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/*
|
||||
//Ra: miejsce umieszczenia tego jest deczko bezsensowne
|
||||
void __fastcall glDebug()
|
||||
void glDebug()
|
||||
{//logowanie b³êdów OpenGL
|
||||
GLenum err;
|
||||
if (Global::iErorrCounter==326) //tu wpisz o 1 mniej niz wartoœæ, przy której siê wy³o¿y³o
|
||||
|
||||
22
Timer.cpp
22
Timer.cpp
@@ -18,27 +18,27 @@ double fSimulationTime = 0;
|
||||
double fSoundTimer = 0;
|
||||
double fSinceStart = 0;
|
||||
|
||||
double __fastcall GetTime() { return fSimulationTime; }
|
||||
double GetTime() { return fSimulationTime; }
|
||||
|
||||
double __fastcall GetDeltaTime() { // czas symulacji (stoi gdy pauza) return DeltaTime; }
|
||||
double GetDeltaTime() { // czas symulacji (stoi gdy pauza) return DeltaTime; }
|
||||
|
||||
double __fastcall GetDeltaRenderTime() { // czas renderowania (do poruszania siê) return DeltaRenderTime; }
|
||||
double GetDeltaRenderTime() { // czas renderowania (do poruszania siê) return DeltaRenderTime; }
|
||||
|
||||
double __fastcall GetfSinceStart() { return fSinceStart; }
|
||||
double GetfSinceStart() { return fSinceStart; }
|
||||
|
||||
void __fastcall SetDeltaTime(double t) { DeltaTime = t; }
|
||||
void SetDeltaTime(double t) { DeltaTime = t; }
|
||||
|
||||
double __fastcall GetSimulationTime() { return fSimulationTime; }
|
||||
double GetSimulationTime() { return fSimulationTime; }
|
||||
|
||||
void __fastcall SetSimulationTime(double t) { fSimulationTime = t; }
|
||||
void SetSimulationTime(double t) { fSimulationTime = t; }
|
||||
|
||||
bool __fastcall 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
|
||||
return (fSoundTimer == 0.0f); }
|
||||
|
||||
double __fastcall GetFPS() { return fFPS; }
|
||||
double GetFPS() { return fFPS; }
|
||||
|
||||
void __fastcall ResetTimers()
|
||||
void ResetTimers()
|
||||
{
|
||||
// double CurrentTime=
|
||||
GetTickCount();
|
||||
@@ -49,7 +49,7 @@ void __fastcall ResetTimers()
|
||||
|
||||
LONGLONG fr, count, oldCount;
|
||||
// LARGE_INTEGER fr,count;
|
||||
void __fastcall UpdateTimers(bool pause)
|
||||
void UpdateTimers(bool pause)
|
||||
{
|
||||
QueryPerformanceFrequency((LARGE_INTEGER *)&fr);
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&count);
|
||||
|
||||
22
Timer.h
22
Timer.h
@@ -6,26 +6,26 @@
|
||||
namespace Timer
|
||||
{
|
||||
|
||||
double __fastcall GetTime();
|
||||
double GetTime();
|
||||
|
||||
double __fastcall GetDeltaTime();
|
||||
double __fastcall GetDeltaRenderTime();
|
||||
double GetDeltaTime();
|
||||
double GetDeltaRenderTime();
|
||||
|
||||
double __fastcall GetfSinceStart();
|
||||
double GetfSinceStart();
|
||||
|
||||
void __fastcall SetDeltaTime(double v);
|
||||
void SetDeltaTime(double v);
|
||||
|
||||
double __fastcall GetSimulationTime();
|
||||
double GetSimulationTime();
|
||||
|
||||
void __fastcall SetSimulationTime(double v);
|
||||
void SetSimulationTime(double v);
|
||||
|
||||
bool __fastcall GetSoundTimer();
|
||||
bool GetSoundTimer();
|
||||
|
||||
double __fastcall GetFPS();
|
||||
double GetFPS();
|
||||
|
||||
void __fastcall ResetTimers();
|
||||
void ResetTimers();
|
||||
|
||||
void __fastcall UpdateTimers(bool pause);
|
||||
void UpdateTimers(bool pause);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
92
Track.cpp
92
Track.cpp
@@ -116,7 +116,7 @@ TIsolated *__fastcall TIsolated::Find(const AnsiString &n)
|
||||
return pRoot;
|
||||
};
|
||||
|
||||
void __fastcall TIsolated::Modify(int i, TDynamicObject *o)
|
||||
void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
{ // dodanie lub odjęcie osi
|
||||
if (iAxles)
|
||||
{ // grupa zajęta
|
||||
@@ -212,7 +212,7 @@ __fastcall TTrack::~TTrack()
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TTrack::Init()
|
||||
void TTrack::Init()
|
||||
{ // tworzenie pomocniczych danych
|
||||
switch (eType)
|
||||
{
|
||||
@@ -362,7 +362,7 @@ TTrack *__fastcall TTrack::NullCreate(int dir)
|
||||
return trk;
|
||||
};
|
||||
|
||||
void __fastcall TTrack::ConnectPrevPrev(TTrack *pTrack, int typ)
|
||||
void TTrack::ConnectPrevPrev(TTrack *pTrack, int typ)
|
||||
{ //łączenie torów - Point1 własny do Point1 cudzego
|
||||
if (pTrack)
|
||||
{ //(pTrack) może być zwrotnicą, a (this) tylko zwykłym odcinkiem
|
||||
@@ -372,7 +372,7 @@ void __fastcall TTrack::ConnectPrevPrev(TTrack *pTrack, int typ)
|
||||
pTrack->iPrevDirection = 0;
|
||||
}
|
||||
}
|
||||
void __fastcall TTrack::ConnectPrevNext(TTrack *pTrack, int typ)
|
||||
void TTrack::ConnectPrevNext(TTrack *pTrack, int typ)
|
||||
{ //łaczenie torów - Point1 własny do Point2 cudzego
|
||||
if (pTrack)
|
||||
{
|
||||
@@ -392,7 +392,7 @@ void __fastcall TTrack::ConnectPrevNext(TTrack *pTrack, int typ)
|
||||
pTrack->iTrapezoid |= 2; // to rysujemy potworka
|
||||
}
|
||||
}
|
||||
void __fastcall TTrack::ConnectNextPrev(TTrack *pTrack, int typ)
|
||||
void TTrack::ConnectNextPrev(TTrack *pTrack, int typ)
|
||||
{ //łaczenie torów - Point2 własny do Point1 cudzego
|
||||
if (pTrack)
|
||||
{
|
||||
@@ -412,7 +412,7 @@ void __fastcall TTrack::ConnectNextPrev(TTrack *pTrack, int typ)
|
||||
iTrapezoid |= 2; // to rysujemy potworka
|
||||
}
|
||||
}
|
||||
void __fastcall TTrack::ConnectNextNext(TTrack *pTrack, int typ)
|
||||
void TTrack::ConnectNextNext(TTrack *pTrack, int typ)
|
||||
{ //łaczenie torów - Point2 własny do Point2 cudzego
|
||||
if (pTrack)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ void __fastcall TTrack::ConnectNextNext(TTrack *pTrack, int typ)
|
||||
}
|
||||
}
|
||||
|
||||
vector3 __fastcall MakeCPoint(vector3 p, double d, double a1, double a2)
|
||||
vector3 MakeCPoint(vector3 p, double d, double a1, double a2)
|
||||
{
|
||||
vector3 cp = vector3(0, 0, 1);
|
||||
cp.RotateX(DegToRad(a2));
|
||||
@@ -432,7 +432,7 @@ vector3 __fastcall MakeCPoint(vector3 p, double d, double a1, double a2)
|
||||
return cp;
|
||||
}
|
||||
|
||||
vector3 __fastcall LoadPoint(cParser *parser)
|
||||
vector3 LoadPoint(cParser *parser)
|
||||
{ // pobranie współrzędnych punktu
|
||||
vector3 p;
|
||||
std::string token;
|
||||
@@ -441,7 +441,7 @@ vector3 __fastcall LoadPoint(cParser *parser)
|
||||
return p;
|
||||
}
|
||||
|
||||
void __fastcall TTrack::Load(cParser *parser, vector3 pOrigin, AnsiString name)
|
||||
void TTrack::Load(cParser *parser, vector3 pOrigin, AnsiString name)
|
||||
{ // pobranie obiektu trajektorii ruchu
|
||||
vector3 pt, vec, p1, p2, cp1, cp2, p3, p4, cp3, cp4; // dodatkowe punkty potrzebne do skrzyżowań
|
||||
double a1, a2, r1, r2, r3, r4, d1, d2, a;
|
||||
@@ -849,7 +849,7 @@ void __fastcall TTrack::Load(cParser *parser, vector3 pOrigin, AnsiString name)
|
||||
}
|
||||
}
|
||||
|
||||
bool __fastcall TTrack::AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2)
|
||||
bool TTrack::AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2)
|
||||
{
|
||||
bool bError = false;
|
||||
if (!evEvent0)
|
||||
@@ -921,7 +921,7 @@ bool __fastcall TTrack::AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEven
|
||||
return !bError;
|
||||
}
|
||||
|
||||
bool __fastcall TTrack::AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2)
|
||||
bool TTrack::AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2)
|
||||
{
|
||||
bool bError = false;
|
||||
if (!evEventall0)
|
||||
@@ -996,7 +996,7 @@ bool __fastcall TTrack::AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TE
|
||||
return !bError;
|
||||
}
|
||||
|
||||
bool __fastcall TTrack::AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus)
|
||||
bool TTrack::AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus)
|
||||
{ // ustawienie eventów sygnalizacji rozprucia
|
||||
if (SwitchExtension)
|
||||
{
|
||||
@@ -1009,7 +1009,7 @@ bool __fastcall TTrack::AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEven
|
||||
return false;
|
||||
};
|
||||
|
||||
AnsiString __fastcall TTrack::IsolatedName()
|
||||
AnsiString TTrack::IsolatedName()
|
||||
{ // podaje nazwę odcinka izolowanego, jesli nie ma on jeszcze przypisanych zdarzeń
|
||||
if (pIsolated)
|
||||
if (!pIsolated->evBusy && !pIsolated->evFree)
|
||||
@@ -1017,7 +1017,7 @@ AnsiString __fastcall TTrack::IsolatedName()
|
||||
return "";
|
||||
};
|
||||
|
||||
bool __fastcall TTrack::IsolatedEventsAssign(TEvent *busy, TEvent *free)
|
||||
bool TTrack::IsolatedEventsAssign(TEvent *busy, TEvent *free)
|
||||
{ // ustawia zdarzenia dla odcinka izolowanego
|
||||
if (pIsolated)
|
||||
{
|
||||
@@ -1031,7 +1031,7 @@ bool __fastcall TTrack::IsolatedEventsAssign(TEvent *busy, TEvent *free)
|
||||
};
|
||||
|
||||
// ABu: przeniesione z Track.h i poprawione!!!
|
||||
bool __fastcall TTrack::AddDynamicObject(TDynamicObject *Dynamic)
|
||||
bool TTrack::AddDynamicObject(TDynamicObject *Dynamic)
|
||||
{ // dodanie pojazdu do trajektorii
|
||||
// Ra: tymczasowo wysyłanie informacji o zajętości konkretnego toru
|
||||
// Ra: usunąć po upowszechnieniu się odcinków izolowanych
|
||||
@@ -1061,7 +1061,7 @@ bool __fastcall TTrack::AddDynamicObject(TDynamicObject *Dynamic)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrack::MoveMe(vector3 pPosition)
|
||||
void TTrack::MoveMe(vector3 pPosition)
|
||||
{ // to nie jest używane
|
||||
if (SwitchExtension)
|
||||
{
|
||||
@@ -1128,7 +1128,7 @@ const vector6 iglica[nnumPts] = // iglica - vextor3(x,y,mapowanie tekstury)
|
||||
0.000) // 1mm więcej, żeby nie nachodziły tekstury?
|
||||
};
|
||||
|
||||
void __fastcall TTrack::Compile(GLuint tex)
|
||||
void TTrack::Compile(GLuint tex)
|
||||
{ // generowanie treści dla Display Lists - model proceduralny
|
||||
if (!tex)
|
||||
{ // jeśli nie podana tekstura, to każdy tor ma wlasne DL
|
||||
@@ -1829,7 +1829,7 @@ void TTrack::Release()
|
||||
DisplayListID = 0;
|
||||
};
|
||||
|
||||
void __fastcall TTrack::Render()
|
||||
void TTrack::Render()
|
||||
{
|
||||
if (bVisible) // Ra: tory są renderowane sektorami i nie ma sensu każdorazowo liczyć odległości
|
||||
{
|
||||
@@ -1874,7 +1874,7 @@ void __fastcall TTrack::Render()
|
||||
// glLightfv(GL_LIGHT0,GL_SPECULAR,Global::specularDayLight);
|
||||
};
|
||||
|
||||
bool __fastcall TTrack::CheckDynamicObject(TDynamicObject *Dynamic)
|
||||
bool TTrack::CheckDynamicObject(TDynamicObject *Dynamic)
|
||||
{ // sprawdzenie, czy pojazd jest przypisany do toru
|
||||
for (int i = 0; i < iNumDynamics; i++)
|
||||
if (Dynamic == Dynamics[i])
|
||||
@@ -1882,7 +1882,7 @@ bool __fastcall TTrack::CheckDynamicObject(TDynamicObject *Dynamic)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool __fastcall TTrack::RemoveDynamicObject(TDynamicObject *Dynamic)
|
||||
bool TTrack::RemoveDynamicObject(TDynamicObject *Dynamic)
|
||||
{ // usunięcie pojazdu z listy przypisanych do toru
|
||||
for (int i = 0; i < iNumDynamics; i++)
|
||||
{ // sprawdzanie wszystkich po kolei
|
||||
@@ -1903,7 +1903,7 @@ bool __fastcall TTrack::RemoveDynamicObject(TDynamicObject *Dynamic)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall TTrack::InMovement()
|
||||
bool TTrack::InMovement()
|
||||
{ // tory animowane (zwrotnica, obrotnica) mają SwitchExtension
|
||||
if (SwitchExtension)
|
||||
{
|
||||
@@ -1926,11 +1926,11 @@ bool __fastcall TTrack::InMovement()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
void __fastcall TTrack::RaAssign(TGroundNode *gn, TAnimContainer *ac){
|
||||
void TTrack::RaAssign(TGroundNode *gn, TAnimContainer *ac){
|
||||
// Ra: wiązanie toru z modelem obrotnicy
|
||||
// if (eType==tt_Table) SwitchExtension->pAnim=p;
|
||||
};
|
||||
void __fastcall TTrack::RaAssign(TGroundNode *gn, TAnimModel *am, TEvent *done, TEvent *joined)
|
||||
void TTrack::RaAssign(TGroundNode *gn, TAnimModel *am, TEvent *done, TEvent *joined)
|
||||
{ // Ra: wiązanie toru z modelem obrotnicy
|
||||
if (eType == tt_Table)
|
||||
{
|
||||
@@ -1945,7 +1945,7 @@ void __fastcall TTrack::RaAssign(TGroundNode *gn, TAnimModel *am, TEvent *done,
|
||||
}
|
||||
};
|
||||
|
||||
int __fastcall TTrack::RaArrayPrepare()
|
||||
int TTrack::RaArrayPrepare()
|
||||
{ // przygotowanie tablic do skopiowania do VBO (zliczanie wierzchołków)
|
||||
if (bVisible) // o ile w ogóle widać
|
||||
switch (iCategoryFlag & 15)
|
||||
@@ -1985,7 +1985,7 @@ int __fastcall TTrack::RaArrayPrepare()
|
||||
return 0;
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RaArrayFill(CVertNormTex *Vert, const CVertNormTex *Start)
|
||||
void TTrack::RaArrayFill(CVertNormTex *Vert, const CVertNormTex *Start)
|
||||
{ // wypełnianie tablic VBO
|
||||
// Ra: trzeba rozdzielić szyny od podsypki, aby móc grupować wg tekstur
|
||||
double fHTW = 0.5 * fabs(fTrackWidth);
|
||||
@@ -2422,7 +2422,7 @@ void __fastcall TTrack::RaArrayFill(CVertNormTex *Vert, const CVertNormTex *Star
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RaRenderVBO(int iPtr)
|
||||
void TTrack::RaRenderVBO(int iPtr)
|
||||
{ // renderowanie z użyciem VBO
|
||||
// Ra 2014-07: trzeba wymienić GL_TRIANGLE_STRIP na GL_TRIANGLES i renderować trójkąty sektora
|
||||
// dla kolejnych tekstur!
|
||||
@@ -2544,7 +2544,7 @@ void __fastcall TTrack::RaRenderVBO(int iPtr)
|
||||
EnvironmentReset();
|
||||
};
|
||||
|
||||
void __fastcall TTrack::EnvironmentSet()
|
||||
void TTrack::EnvironmentSet()
|
||||
{ // ustawienie zmienionego światła
|
||||
glColor3f(1.0f, 1.0f, 1.0f); // Ra: potrzebne to?
|
||||
if (eEnvironment)
|
||||
@@ -2580,7 +2580,7 @@ void __fastcall TTrack::EnvironmentSet()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrack::EnvironmentReset()
|
||||
void TTrack::EnvironmentReset()
|
||||
{ // przywrócenie domyślnego światła
|
||||
switch (eEnvironment)
|
||||
{ // przywrócenie globalnych ustawień światła, o ile było zmienione
|
||||
@@ -2592,7 +2592,7 @@ void __fastcall TTrack::EnvironmentReset()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RenderDyn()
|
||||
void TTrack::RenderDyn()
|
||||
{ // renderowanie nieprzezroczystych fragmentów pojazdów
|
||||
if (!iNumDynamics)
|
||||
return; // po co kombinować, jeśli nie ma pojazdów?
|
||||
@@ -2602,7 +2602,7 @@ void __fastcall TTrack::RenderDyn()
|
||||
// EnvironmentReset();
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RenderDynAlpha()
|
||||
void TTrack::RenderDynAlpha()
|
||||
{ // renderowanie przezroczystych fragmentów pojazdów
|
||||
if (!iNumDynamics)
|
||||
return; // po co kombinować, jeśli nie ma pojazdów?
|
||||
@@ -2612,13 +2612,13 @@ void __fastcall TTrack::RenderDynAlpha()
|
||||
// EnvironmentReset();
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RenderDynSounds()
|
||||
void TTrack::RenderDynSounds()
|
||||
{ // odtwarzanie dźwięków pojazdów jest niezależne od ich wyświetlania
|
||||
for (int i = 0; i < iNumDynamics; i++)
|
||||
Dynamics[i]->RenderSounds();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TTrack::SetConnections(int i)
|
||||
bool TTrack::SetConnections(int i)
|
||||
{ // przepisanie aktualnych połączeń toru do odpowiedniego segmentu
|
||||
if (SwitchExtension)
|
||||
{
|
||||
@@ -2643,7 +2643,7 @@ bool __fastcall TTrack::SetConnections(int i)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __fastcall TTrack::Switch(int i, double t, double d)
|
||||
bool TTrack::Switch(int i, double t, double d)
|
||||
{ // przełączenie torów z uruchomieniem animacji
|
||||
if (SwitchExtension) // tory przełączalne mają doklejkę
|
||||
if (eType == tt_Switch)
|
||||
@@ -2735,7 +2735,7 @@ bool __fastcall TTrack::Switch(int i, double t, double d)
|
||||
return false;
|
||||
};
|
||||
|
||||
bool __fastcall TTrack::SwitchForced(int i, TDynamicObject *o)
|
||||
bool TTrack::SwitchForced(int i, TDynamicObject *o)
|
||||
{ // rozprucie rozjazdu
|
||||
if (SwitchExtension)
|
||||
if (eType == tt_Switch)
|
||||
@@ -2763,7 +2763,7 @@ bool __fastcall TTrack::SwitchForced(int i, TDynamicObject *o)
|
||||
return true;
|
||||
};
|
||||
|
||||
int __fastcall TTrack::CrossSegment(int from, int into)
|
||||
int TTrack::CrossSegment(int from, int into)
|
||||
{ // ustawienie wskaźnika na segement w pożądanym kierunku (into) od strony (from)
|
||||
// zwraca kod segmentu, z kierunkiem jazdy jako znakiem ±
|
||||
int i = 0;
|
||||
@@ -2793,7 +2793,7 @@ int __fastcall TTrack::CrossSegment(int from, int into)
|
||||
return i;
|
||||
};
|
||||
|
||||
void __fastcall TTrack::RaAnimListAdd(TTrack *t)
|
||||
void TTrack::RaAnimListAdd(TTrack *t)
|
||||
{ // dodanie toru do listy animacyjnej
|
||||
if (SwitchExtension)
|
||||
{
|
||||
@@ -2980,13 +2980,13 @@ TTrack *__fastcall TTrack::RaAnimate()
|
||||
return m ? this : SwitchExtension->pNextAnim; // zwraca obiekt do dalszej animacji
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TTrack::RadioStop()
|
||||
void TTrack::RadioStop()
|
||||
{ // przekazanie pojazdom rozkazu zatrzymania
|
||||
for (int i = 0; i < iNumDynamics; i++)
|
||||
Dynamics[i]->RadioStop();
|
||||
};
|
||||
|
||||
double __fastcall TTrack::WidthTotal()
|
||||
double TTrack::WidthTotal()
|
||||
{ // szerokość z poboczem
|
||||
if (iCategoryFlag & 2) // jesli droga
|
||||
if (fTexHeight1 >= 0.0) // i ma boki zagięte w dół (chodnik jest w górę)
|
||||
@@ -2995,7 +2995,7 @@ double __fastcall TTrack::WidthTotal()
|
||||
return 0.5 * fabs(fTrackWidth + fTrackWidth2); // a tak tylko zwykła średnia szerokość
|
||||
};
|
||||
|
||||
bool __fastcall TTrack::IsGroupable()
|
||||
bool TTrack::IsGroupable()
|
||||
{ // czy wyświetlanie toru może być zgrupwane z innymi
|
||||
if ((eType == tt_Switch) || (eType == tt_Table))
|
||||
return false; // tory ruchome nie są grupowane
|
||||
@@ -3004,7 +3004,7 @@ bool __fastcall TTrack::IsGroupable()
|
||||
return true;
|
||||
};
|
||||
|
||||
bool __fastcall Equal(vector3 v1, vector3 *v2)
|
||||
bool Equal(vector3 v1, vector3 *v2)
|
||||
{ // sprawdzenie odległości punktów
|
||||
// Ra: powinno być do 100cm wzdłuż toru i ze 2cm w poprzek (na prostej może nie być długiego
|
||||
// kawałka)
|
||||
@@ -3019,7 +3019,7 @@ bool __fastcall Equal(vector3 v1, vector3 *v2)
|
||||
// return (SquareMagnitude(v1-*v2)<0.00012); //0.011^2=0.00012
|
||||
};
|
||||
|
||||
int __fastcall TTrack::TestPoint(vector3 *Point)
|
||||
int TTrack::TestPoint(vector3 *Point)
|
||||
{ // sprawdzanie, czy tory można połączyć
|
||||
switch (eType)
|
||||
{
|
||||
@@ -3087,9 +3087,9 @@ int __fastcall TTrack::TestPoint(vector3 *Point)
|
||||
return -1;
|
||||
};
|
||||
|
||||
void __fastcall TTrack::MovedUp1(double dh) { // poprawienie przechyłki wymaga wydłużenia podsypki fTexHeight1 += dh; };
|
||||
void TTrack::MovedUp1(double dh) { // poprawienie przechyłki wymaga wydłużenia podsypki fTexHeight1 += dh; };
|
||||
|
||||
AnsiString __fastcall TTrack::NameGet()
|
||||
AnsiString TTrack::NameGet()
|
||||
{ // ustalenie nazwy toru
|
||||
if (this)
|
||||
if (pMyNode)
|
||||
@@ -3097,7 +3097,7 @@ AnsiString __fastcall TTrack::NameGet()
|
||||
return "none";
|
||||
};
|
||||
|
||||
void __fastcall TTrack::VelocitySet(float v)
|
||||
void TTrack::VelocitySet(float v)
|
||||
{ // ustawienie prędkości z ograniczeniem do pierwotnej wartości (zapisanej w scenerii)
|
||||
if (SwitchExtension ? SwitchExtension->fVelocity >= 0.0 : false)
|
||||
{ // zwrotnica może mieć odgórne ograniczenie, nieprzeskakiwalne eventem
|
||||
@@ -3108,12 +3108,12 @@ void __fastcall TTrack::VelocitySet(float v)
|
||||
fVelocity = v; // nie ma ograniczenia
|
||||
};
|
||||
|
||||
float __fastcall TTrack::VelocityGet()
|
||||
float TTrack::VelocityGet()
|
||||
{ // pobranie dozwolonej prędkości podczas skanowania
|
||||
return ((iDamageFlag & 128) ? 0.0f : fVelocity); // tor uszkodzony = prędkość zerowa
|
||||
};
|
||||
|
||||
void __fastcall TTrack::ConnectionsLog()
|
||||
void TTrack::ConnectionsLog()
|
||||
{ // wypisanie informacji o połączeniach
|
||||
int i;
|
||||
WriteLog("--> tt_Cross named " + pMyNode->asName);
|
||||
|
||||
112
Track.h
112
Track.h
@@ -41,8 +41,8 @@ class TTraction;
|
||||
class TSwitchExtension
|
||||
{ // dodatkowe dane do toru, który jest zwrotnicą
|
||||
public:
|
||||
__fastcall TSwitchExtension(TTrack *owner, int what);
|
||||
__fastcall ~TSwitchExtension();
|
||||
TSwitchExtension(TTrack *owner, int what);
|
||||
~TSwitchExtension();
|
||||
TSegment *Segments[6]; // dwa tory od punktu 1, pozostałe dwa od 2? Ra 140101: 6 połączeń dla
|
||||
// skrzyżowań
|
||||
// TTrack *trNear[4]; //tory dołączone do punktów 1, 2, 3 i 4
|
||||
@@ -98,13 +98,13 @@ class TIsolated
|
||||
TEvent *evBusy; // zdarzenie wyzwalane po zajęciu grupy
|
||||
TEvent *evFree; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
TMemCell *pMemCell; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
__fastcall TIsolated();
|
||||
__fastcall TIsolated(const AnsiString &n, TIsolated *i);
|
||||
__fastcall ~TIsolated();
|
||||
TIsolated();
|
||||
TIsolated(const AnsiString &n, TIsolated *i);
|
||||
~TIsolated();
|
||||
static TIsolated *__fastcall Find(
|
||||
const AnsiString &n); // znalezienie obiektu albo utworzenie nowego
|
||||
void __fastcall Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
bool __fastcall Busy() { return (iAxles > 0); };
|
||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
bool Busy() { return (iAxles > 0); };
|
||||
static TIsolated *__fastcall Root() { return (pRoot); };
|
||||
TIsolated *__fastcall Next() { return (pNext); };
|
||||
};
|
||||
@@ -173,82 +173,82 @@ class TTrack : public Resource
|
||||
TGroundNode *nFouling[2]; // współrzędne ukresu albo oporu kozła
|
||||
TTrack *trColides; // tor kolizyjny, na którym trzeba sprawdzać pojazdy pod kątem zderzenia
|
||||
|
||||
__fastcall TTrack(TGroundNode *g);
|
||||
__fastcall ~TTrack();
|
||||
void __fastcall Init();
|
||||
TTrack(TGroundNode *g);
|
||||
~TTrack();
|
||||
void Init();
|
||||
static TTrack *__fastcall Create400m(int what, double dx);
|
||||
TTrack *__fastcall NullCreate(int dir);
|
||||
inline bool __fastcall IsEmpty() { return (iNumDynamics <= 0); };
|
||||
void __fastcall ConnectPrevPrev(TTrack *pNewPrev, int typ);
|
||||
void __fastcall ConnectPrevNext(TTrack *pNewPrev, int typ);
|
||||
void __fastcall ConnectNextPrev(TTrack *pNewNext, int typ);
|
||||
void __fastcall ConnectNextNext(TTrack *pNewNext, int typ);
|
||||
inline double __fastcall Length() { return Segment->GetLength(); };
|
||||
inline bool IsEmpty() { return (iNumDynamics <= 0); };
|
||||
void ConnectPrevPrev(TTrack *pNewPrev, int typ);
|
||||
void ConnectPrevNext(TTrack *pNewPrev, int typ);
|
||||
void ConnectNextPrev(TTrack *pNewNext, int typ);
|
||||
void ConnectNextNext(TTrack *pNewNext, int typ);
|
||||
inline double Length() { return Segment->GetLength(); };
|
||||
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);
|
||||
bool __fastcall SetConnections(int i);
|
||||
bool __fastcall Switch(int i, double t = -1.0, double d = -1.0);
|
||||
bool __fastcall SwitchForced(int i, TDynamicObject *o);
|
||||
int __fastcall CrossSegment(int from, int into);
|
||||
inline int __fastcall GetSwitchState()
|
||||
bool SetConnections(int i);
|
||||
bool Switch(int i, double t = -1.0, double d = -1.0);
|
||||
bool SwitchForced(int i, TDynamicObject *o);
|
||||
int CrossSegment(int from, int into);
|
||||
inline int GetSwitchState()
|
||||
{
|
||||
return (SwitchExtension ? SwitchExtension->CurrentIndex : -1);
|
||||
};
|
||||
void __fastcall Load(cParser *parser, vector3 pOrigin, AnsiString name);
|
||||
bool __fastcall AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2);
|
||||
bool __fastcall AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2);
|
||||
bool __fastcall AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus);
|
||||
bool __fastcall CheckDynamicObject(TDynamicObject *Dynamic);
|
||||
bool __fastcall AddDynamicObject(TDynamicObject *Dynamic);
|
||||
bool __fastcall RemoveDynamicObject(TDynamicObject *Dynamic);
|
||||
void __fastcall MoveMe(vector3 pPosition);
|
||||
void Load(cParser *parser, vector3 pOrigin, AnsiString name);
|
||||
bool AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2);
|
||||
bool AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2);
|
||||
bool AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus);
|
||||
bool CheckDynamicObject(TDynamicObject *Dynamic);
|
||||
bool AddDynamicObject(TDynamicObject *Dynamic);
|
||||
bool RemoveDynamicObject(TDynamicObject *Dynamic);
|
||||
void MoveMe(vector3 pPosition);
|
||||
|
||||
void Release();
|
||||
void __fastcall Compile(GLuint tex = 0);
|
||||
void Compile(GLuint tex = 0);
|
||||
|
||||
void __fastcall Render(); // renderowanie z Display Lists
|
||||
int __fastcall RaArrayPrepare(); // zliczanie rozmiaru dla VBO sektroa
|
||||
void __fastcall RaArrayFill(CVertNormTex *Vert, const CVertNormTex *Start); // wypełnianie VBO
|
||||
void __fastcall RaRenderVBO(int iPtr); // renderowanie z VBO sektora
|
||||
void __fastcall RenderDyn(); // renderowanie nieprzezroczystych pojazdów (oba tryby)
|
||||
void __fastcall RenderDynAlpha(); // renderowanie przezroczystych pojazdów (oba tryby)
|
||||
void __fastcall RenderDynSounds(); // odtwarzanie dźwięków pojazdów jest niezależne od ich
|
||||
void Render(); // renderowanie z Display Lists
|
||||
int RaArrayPrepare(); // zliczanie rozmiaru dla VBO sektroa
|
||||
void RaArrayFill(CVertNormTex *Vert, const CVertNormTex *Start); // wypełnianie VBO
|
||||
void RaRenderVBO(int iPtr); // renderowanie z VBO sektora
|
||||
void RenderDyn(); // renderowanie nieprzezroczystych pojazdów (oba tryby)
|
||||
void RenderDynAlpha(); // renderowanie przezroczystych pojazdów (oba tryby)
|
||||
void RenderDynSounds(); // odtwarzanie dźwięków pojazdów jest niezależne od ich
|
||||
// wyświetlania
|
||||
|
||||
void __fastcall RaOwnerSet(TSubRect *o)
|
||||
void RaOwnerSet(TSubRect *o)
|
||||
{
|
||||
if (SwitchExtension)
|
||||
SwitchExtension->pOwner = o;
|
||||
};
|
||||
bool __fastcall InMovement(); // czy w trakcie animacji?
|
||||
void __fastcall RaAssign(TGroundNode *gn, TAnimContainer *ac);
|
||||
void __fastcall RaAssign(TGroundNode *gn, TAnimModel *am, TEvent *done, TEvent *joined);
|
||||
void __fastcall RaAnimListAdd(TTrack *t);
|
||||
bool InMovement(); // czy w trakcie animacji?
|
||||
void RaAssign(TGroundNode *gn, TAnimContainer *ac);
|
||||
void RaAssign(TGroundNode *gn, TAnimModel *am, TEvent *done, TEvent *joined);
|
||||
void RaAnimListAdd(TTrack *t);
|
||||
TTrack *__fastcall RaAnimate();
|
||||
|
||||
void __fastcall RadioStop();
|
||||
void __fastcall AxleCounter(int i, TDynamicObject *o)
|
||||
void RadioStop();
|
||||
void AxleCounter(int i, TDynamicObject *o)
|
||||
{
|
||||
if (pIsolated)
|
||||
pIsolated->Modify(i, o);
|
||||
}; // dodanie lub odjęcie osi
|
||||
AnsiString __fastcall IsolatedName();
|
||||
bool __fastcall IsolatedEventsAssign(TEvent *busy, TEvent *free);
|
||||
double __fastcall WidthTotal();
|
||||
AnsiString IsolatedName();
|
||||
bool IsolatedEventsAssign(TEvent *busy, TEvent *free);
|
||||
double WidthTotal();
|
||||
GLuint TextureGet(int i) { return i ? TextureID1 : TextureID2; };
|
||||
bool __fastcall IsGroupable();
|
||||
int __fastcall TestPoint(vector3 *Point);
|
||||
void __fastcall MovedUp1(double dh);
|
||||
AnsiString __fastcall NameGet();
|
||||
void __fastcall VelocitySet(float v);
|
||||
float __fastcall VelocityGet();
|
||||
void __fastcall ConnectionsLog();
|
||||
bool IsGroupable();
|
||||
int TestPoint(vector3 *Point);
|
||||
void MovedUp1(double dh);
|
||||
AnsiString NameGet();
|
||||
void VelocitySet(float v);
|
||||
float VelocityGet();
|
||||
void ConnectionsLog();
|
||||
|
||||
private:
|
||||
void __fastcall EnvironmentSet();
|
||||
void __fastcall EnvironmentReset();
|
||||
void EnvironmentSet();
|
||||
void EnvironmentReset();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
26
Traction.cpp
26
Traction.cpp
@@ -119,7 +119,7 @@ TTraction::~TTraction()
|
||||
glDeleteLists(uiDisplayList, 1);
|
||||
}
|
||||
|
||||
void __fastcall TTraction::Optimize()
|
||||
void TTraction::Optimize()
|
||||
{
|
||||
if (Global::bUseVBO)
|
||||
return;
|
||||
@@ -250,13 +250,13 @@ void __fastcall TTraction::Optimize()
|
||||
}
|
||||
}
|
||||
/*
|
||||
void __fastcall TTraction::InitCenter(vector3 Angles, vector3 pOrigin)
|
||||
void TTraction::InitCenter(vector3 Angles, vector3 pOrigin)
|
||||
{
|
||||
pPosition= (pPoint2+pPoint1)*0.5f;
|
||||
fSquaredRadius= SquareMagnitude((pPoint2-pPoint1)*0.5f);
|
||||
} */
|
||||
|
||||
void __fastcall TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od obserwatora
|
||||
void TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od obserwatora
|
||||
{
|
||||
// McZapkie: ustalanie przezroczystosci i koloru linii:
|
||||
if (Wires != 0 && !TestFlag(DamageFlag, 128)) // rysuj jesli sa druty i nie zerwana
|
||||
@@ -348,7 +348,7 @@ void __fastcall TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od
|
||||
}
|
||||
}
|
||||
|
||||
int __fastcall TTraction::RaArrayPrepare()
|
||||
int TTraction::RaArrayPrepare()
|
||||
{ // przygotowanie tablic do skopiowania do VBO (zliczanie wierzchołków)
|
||||
// if (bVisible) //o ile w ogóle widać
|
||||
switch (Wires)
|
||||
@@ -372,7 +372,7 @@ int __fastcall TTraction::RaArrayPrepare()
|
||||
return iLines;
|
||||
};
|
||||
|
||||
void __fastcall TTraction::RaArrayFill(CVertNormTex *Vert)
|
||||
void TTraction::RaArrayFill(CVertNormTex *Vert)
|
||||
{ // wypełnianie tablic VBO
|
||||
CVertNormTex *old = Vert;
|
||||
double ddp = hypot(pPoint2.x - pPoint1.x, pPoint2.z - pPoint1.z);
|
||||
@@ -469,7 +469,7 @@ void __fastcall TTraction::RaArrayFill(CVertNormTex *Vert)
|
||||
AnsiString(iLines));
|
||||
};
|
||||
|
||||
void __fastcall TTraction::RenderVBO(float mgn, int iPtr)
|
||||
void TTraction::RenderVBO(float mgn, int iPtr)
|
||||
{ // renderowanie z użyciem VBO
|
||||
if (Wires != 0 && !TestFlag(DamageFlag, 128)) // rysuj jesli sa druty i nie zerwana
|
||||
{
|
||||
@@ -550,7 +550,7 @@ void __fastcall TTraction::RenderVBO(float mgn, int iPtr)
|
||||
}
|
||||
};
|
||||
|
||||
int __fastcall TTraction::TestPoint(vector3 *Point)
|
||||
int TTraction::TestPoint(vector3 *Point)
|
||||
{ // sprawdzanie, czy przęsła można połączyć
|
||||
if (!hvNext[0])
|
||||
if (pPoint1.Equal(Point))
|
||||
@@ -561,7 +561,7 @@ int __fastcall TTraction::TestPoint(vector3 *Point)
|
||||
return -1;
|
||||
};
|
||||
|
||||
void __fastcall TTraction::Connect(int my, TTraction *with, int to)
|
||||
void TTraction::Connect(int my, TTraction *with, int to)
|
||||
{ //łączenie segmentu (with) od strony (my) do jego (to)
|
||||
if (my)
|
||||
{ // do mojego Point2
|
||||
@@ -591,7 +591,7 @@ void __fastcall TTraction::Connect(int my, TTraction *with, int to)
|
||||
with->iLast = 0; // to nie jest ostatnim
|
||||
};
|
||||
|
||||
bool __fastcall TTraction::WhereIs()
|
||||
bool TTraction::WhereIs()
|
||||
{ // ustalenie przedostatnich przęseł
|
||||
if (iLast)
|
||||
return (iLast == 1); // ma już ustaloną informację o położeniu
|
||||
@@ -602,12 +602,12 @@ bool __fastcall TTraction::WhereIs()
|
||||
return (iLast == 1); // ostatnie będą dostawać zasilanie
|
||||
};
|
||||
|
||||
void __fastcall TTraction::Init()
|
||||
void TTraction::Init()
|
||||
{ // przeliczenie parametrów
|
||||
vParametric = pPoint2 - pPoint1; // wektor mnożników parametru dla równania parametrycznego
|
||||
};
|
||||
|
||||
void __fastcall TTraction::ResistanceCalc(int d, double r, TTractionPowerSource *ps)
|
||||
void TTraction::ResistanceCalc(int d, double r, TTractionPowerSource *ps)
|
||||
{ //(this) jest przęsłem zasilanym, o rezystancji (r), policzyć rezystancję zastępczą sąsiednich
|
||||
if (d >= 0)
|
||||
{ // podążanie we wskazanym kierunku
|
||||
@@ -649,7 +649,7 @@ void __fastcall TTraction::ResistanceCalc(int d, double r, TTractionPowerSource
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTraction::PowerSet(TTractionPowerSource *ps)
|
||||
void TTraction::PowerSet(TTractionPowerSource *ps)
|
||||
{ // podłączenie przęsła do zasilacza
|
||||
if (ps->bSection)
|
||||
psSection = ps; // ustalenie sekcji zasilania
|
||||
@@ -662,7 +662,7 @@ void __fastcall TTraction::PowerSet(TTractionPowerSource *ps)
|
||||
}
|
||||
};
|
||||
|
||||
double __fastcall TTraction::VoltageGet(double u, double i)
|
||||
double TTraction::VoltageGet(double u, double i)
|
||||
{ // pobranie napięcia na przęśle po podłączeniu do niego rezystancji (res) - na razie jest to prąd
|
||||
if (!psSection)
|
||||
if (!psPowered)
|
||||
|
||||
32
Traction.h
32
Traction.h
@@ -54,27 +54,27 @@ class TTraction
|
||||
// bool bVisible;
|
||||
// DWORD dwFlags;
|
||||
|
||||
void __fastcall Optimize();
|
||||
void Optimize();
|
||||
|
||||
TTraction();
|
||||
~TTraction();
|
||||
|
||||
// virtual void __fastcall InitCenter(vector3 Angles, vector3 pOrigin);
|
||||
// virtual bool __fastcall Hit(double x, double z, vector3 &hitPoint, vector3 &hitDirection)
|
||||
// virtual void InitCenter(vector3 Angles, vector3 pOrigin);
|
||||
// virtual bool Hit(double x, double z, vector3 &hitPoint, vector3 &hitDirection)
|
||||
// { return TNode::Hit(x,z,hitPoint,hitDirection); };
|
||||
// virtual bool __fastcall Move(double dx, double dy, double dz) { return false; };
|
||||
// virtual void __fastcall SelectedRender();
|
||||
void __fastcall RenderDL(float mgn);
|
||||
int __fastcall RaArrayPrepare();
|
||||
void __fastcall RaArrayFill(CVertNormTex *Vert);
|
||||
void __fastcall RenderVBO(float mgn, int iPtr);
|
||||
int __fastcall TestPoint(vector3 *Point);
|
||||
void __fastcall Connect(int my, TTraction *with, int to);
|
||||
void __fastcall Init();
|
||||
bool __fastcall WhereIs();
|
||||
void __fastcall ResistanceCalc(int d = -1, double r = 0, TTractionPowerSource *ps = NULL);
|
||||
void __fastcall PowerSet(TTractionPowerSource *ps);
|
||||
double __fastcall VoltageGet(double u, double i);
|
||||
// virtual bool Move(double dx, double dy, double dz) { return false; };
|
||||
// virtual void SelectedRender();
|
||||
void RenderDL(float mgn);
|
||||
int RaArrayPrepare();
|
||||
void RaArrayFill(CVertNormTex *Vert);
|
||||
void RenderVBO(float mgn, int iPtr);
|
||||
int TestPoint(vector3 *Point);
|
||||
void Connect(int my, TTraction *with, int to);
|
||||
void Init();
|
||||
bool WhereIs();
|
||||
void ResistanceCalc(int d = -1, double r = 0, TTractionPowerSource *ps = NULL);
|
||||
void PowerSet(TTractionPowerSource *ps);
|
||||
double VoltageGet(double u, double i);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -46,14 +46,14 @@ __fastcall TTractionPowerSource::TTractionPowerSource()
|
||||
|
||||
__fastcall TTractionPowerSource::~TTractionPowerSource(){};
|
||||
|
||||
void __fastcall TTractionPowerSource::Init(double u, double i)
|
||||
void TTractionPowerSource::Init(double u, double i)
|
||||
{ // ustawianie zasilacza przy braku w scenerii
|
||||
NominalVoltage = u;
|
||||
VoltageFrequency = 0;
|
||||
MaxOutputCurrent = i;
|
||||
};
|
||||
|
||||
bool __fastcall TTractionPowerSource::Load(cParser *parser)
|
||||
bool TTractionPowerSource::Load(cParser *parser)
|
||||
{
|
||||
std::string token;
|
||||
// AnsiString str;
|
||||
@@ -85,9 +85,9 @@ bool __fastcall TTractionPowerSource::Load(cParser *parser)
|
||||
return true;
|
||||
};
|
||||
|
||||
bool __fastcall TTractionPowerSource::Render() { return true; };
|
||||
bool TTractionPowerSource::Render() { return true; };
|
||||
|
||||
bool __fastcall TTractionPowerSource::Update(double dt)
|
||||
bool TTractionPowerSource::Update(double dt)
|
||||
{ // powinno byæ wykonane raz na krok fizyki
|
||||
if (NominalVoltage * TotalPreviousAdmitance >
|
||||
MaxOutputCurrent) // iloczyn napiêcia i admitancji daje pr¹d
|
||||
@@ -127,7 +127,7 @@ bool __fastcall TTractionPowerSource::Update(double dt)
|
||||
return true;
|
||||
};
|
||||
|
||||
double __fastcall TTractionPowerSource::CurrentGet(double res)
|
||||
double TTractionPowerSource::CurrentGet(double res)
|
||||
{ // pobranie wartoœci pr¹du przypadaj¹cego na rezystancjê (res)
|
||||
// niech pamiêta poprzedni¹ admitancjê i wg niej przydziela pr¹d
|
||||
if (SlowFuse || FastFuse)
|
||||
@@ -147,7 +147,7 @@ double __fastcall TTractionPowerSource::CurrentGet(double res)
|
||||
// w ca³kowitej admitancji
|
||||
};
|
||||
|
||||
void __fastcall TTractionPowerSource::PowerSet(TTractionPowerSource *ps)
|
||||
void TTractionPowerSource::PowerSet(TTractionPowerSource *ps)
|
||||
{ // wskazanie zasilacza w obiekcie sekcji
|
||||
if (!psNode[0])
|
||||
psNode[0] = ps;
|
||||
|
||||
@@ -34,15 +34,15 @@ class TTractionPowerSource
|
||||
TGroundNode *gMyNode; // Ra 2015-03: znowu prowizorka, aby mieæ nazwê do logowania
|
||||
public:
|
||||
// AnsiString asName;
|
||||
__fastcall TTractionPowerSource();
|
||||
__fastcall ~TTractionPowerSource();
|
||||
void __fastcall Init(double u, double i);
|
||||
bool __fastcall Load(cParser *parser);
|
||||
bool __fastcall Render();
|
||||
bool __fastcall Update(double dt);
|
||||
double __fastcall CurrentGet(double res);
|
||||
void __fastcall VoltageSet(double v) { NominalVoltage = v; };
|
||||
void __fastcall PowerSet(TTractionPowerSource *ps);
|
||||
TTractionPowerSource();
|
||||
~TTractionPowerSource();
|
||||
void Init(double u, double i);
|
||||
bool Load(cParser *parser);
|
||||
bool Render();
|
||||
bool Update(double dt);
|
||||
double CurrentGet(double res);
|
||||
void VoltageSet(double v) { NominalVoltage = v; };
|
||||
void PowerSet(TTractionPowerSource *ps);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
26
Train.cpp
26
Train.cpp
@@ -42,7 +42,7 @@ __fastcall TCab::TCab()
|
||||
iButtons = 0;
|
||||
}
|
||||
|
||||
void __fastcall TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2,
|
||||
void TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2,
|
||||
double Inity2, double Initz2, bool InitEnabled, bool InitOccupied)
|
||||
{
|
||||
CabPos1.x = Initx1;
|
||||
@@ -55,7 +55,7 @@ void __fastcall TCab::Init(double Initx1, double Inity1, double Initz1, double I
|
||||
bOccupied = InitOccupied;
|
||||
}
|
||||
|
||||
void __fastcall TCab::Load(TQueryParserComp *Parser)
|
||||
void TCab::Load(TQueryParserComp *Parser)
|
||||
{
|
||||
AnsiString str = Parser->GetNextSymbol().LowerCase();
|
||||
if (str == AnsiString("cablight"))
|
||||
@@ -110,7 +110,7 @@ TButton *__fastcall TCab::Button(int n)
|
||||
return NULL;
|
||||
};
|
||||
|
||||
void __fastcall TCab::Update()
|
||||
void TCab::Update()
|
||||
{ // odczyt parametrów i ustawienie animacji submodelom
|
||||
int i;
|
||||
for (i = 0; i < iGauges; ++i)
|
||||
@@ -183,7 +183,7 @@ __fastcall TTrain::~TTrain()
|
||||
true); // likwidacja kabiny wymaga przejêcia przez AI
|
||||
}
|
||||
|
||||
bool __fastcall TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
|
||||
bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
|
||||
{ // powi¹zanie rêcznego sterowania kabin¹ z pojazdem
|
||||
// Global::pUserDynamic=NewDynamicObject; //pojazd renderowany bez trzêsienia
|
||||
DynamicSet(NewDynamicObject);
|
||||
@@ -253,7 +253,7 @@ bool __fastcall TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __fastcall TTrain::OnKeyDown(int cKey)
|
||||
void TTrain::OnKeyDown(int cKey)
|
||||
{ // naciœniêcie klawisza
|
||||
bool isEztOer;
|
||||
isEztOer = ((mvControlled->TrainType == dt_EZT) && (mvControlled->Battery == true) &&
|
||||
@@ -2253,7 +2253,7 @@ void __fastcall TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TTrain::OnKeyUp(int cKey)
|
||||
void TTrain::OnKeyUp(int cKey)
|
||||
{ // zwolnienie klawisza
|
||||
if (GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
{ // wciœniêty [Shift]
|
||||
@@ -2269,7 +2269,7 @@ void __fastcall TTrain::OnKeyUp(int cKey)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrain::UpdateMechPosition(double dt)
|
||||
void TTrain::UpdateMechPosition(double dt)
|
||||
{ // Ra: mechanik powinien byæ telepany niezale¿nie od pozycji pojazdu
|
||||
// Ra: trzeba zrobiæ model bujania g³ow¹ i wczepiæ go do pojazdu
|
||||
|
||||
@@ -2378,7 +2378,7 @@ void __fastcall TTrain::UpdateMechPosition(double dt)
|
||||
pMechPosition += DynamicObject->GetPosition();
|
||||
};
|
||||
|
||||
bool __fastcall TTrain::Update()
|
||||
bool TTrain::Update()
|
||||
{
|
||||
DWORD stat;
|
||||
double dt = Timer::GetDeltaTime();
|
||||
@@ -4619,7 +4619,7 @@ bool TTrain::CabChange(int iDirection)
|
||||
|
||||
// McZapkie-310302
|
||||
// wczytywanie pliku z danymi multimedialnymi (dzwieki, kontrolki, kabiny)
|
||||
bool __fastcall TTrain::LoadMMediaFile(AnsiString asFileName)
|
||||
bool TTrain::LoadMMediaFile(AnsiString asFileName)
|
||||
{
|
||||
double dSDist;
|
||||
TFileStream *fs;
|
||||
@@ -5520,7 +5520,7 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
||||
return AnsiCompareStr(str, AnsiString("none"));
|
||||
}
|
||||
|
||||
void __fastcall TTrain::MechStop()
|
||||
void TTrain::MechStop()
|
||||
{ // likwidacja ruchu kamery w kabinie (po powrocie przez [F4])
|
||||
pMechPosition = vector3(0, 0, 0);
|
||||
pMechShake = vector3(0, 0, 0);
|
||||
@@ -5528,7 +5528,7 @@ void __fastcall TTrain::MechStop()
|
||||
vMechVelocity = vector3(0, 0, 0); // tu zostawa³y jakieœ u³amki, powoduj¹ce uciekanie kamery
|
||||
};
|
||||
|
||||
vector3 __fastcall TTrain::MirrorPosition(bool lewe)
|
||||
vector3 TTrain::MirrorPosition(bool lewe)
|
||||
{ // zwraca wspó³rzêdne widoku kamery z lusterka
|
||||
switch (iCabn)
|
||||
{
|
||||
@@ -5544,7 +5544,7 @@ vector3 __fastcall TTrain::MirrorPosition(bool lewe)
|
||||
return DynamicObject->GetPosition(); // wspó³rzêdne œrodka pojazdu
|
||||
};
|
||||
|
||||
void __fastcall TTrain::DynamicSet(TDynamicObject *d)
|
||||
void TTrain::DynamicSet(TDynamicObject *d)
|
||||
{ // taka proteza: chcê pod³¹czyæ kabinê EN57 bezpoœrednio z silnikowym, aby nie robiæ tego przez
|
||||
// ukrotnienie
|
||||
// drugi silnikowy i tak musi byæ ukrotniony, podobnie jak kolejna jednostka
|
||||
@@ -5597,7 +5597,7 @@ void __fastcall TTrain::DynamicSet(TDynamicObject *d)
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TTrain::Silence()
|
||||
void TTrain::Silence()
|
||||
{ // wyciszenie dŸwiêków przy wychodzeniu
|
||||
if (dsbNastawnikJazdy)
|
||||
dsbNastawnikJazdy->Stop();
|
||||
|
||||
46
Train.h
46
Train.h
@@ -34,11 +34,11 @@ const float fHaslerTime = 1.2;
|
||||
class TCab
|
||||
{
|
||||
public:
|
||||
__fastcall TCab();
|
||||
__fastcall ~TCab();
|
||||
void __fastcall Init(double Initx1, double Inity1, double Initz1, double Initx2, double Inity2,
|
||||
TCab();
|
||||
~TCab();
|
||||
void Init(double Initx1, double Inity1, double Initz1, double Initx2, double Inity2,
|
||||
double Initz2, bool InitEnabled, bool InitOccupied);
|
||||
void __fastcall Load(TQueryParserComp *Parser);
|
||||
void Load(TQueryParserComp *Parser);
|
||||
vector3 CabPos1;
|
||||
vector3 CabPos2;
|
||||
bool bEnabled;
|
||||
@@ -56,7 +56,7 @@ class TCab
|
||||
public:
|
||||
TGauge *__fastcall Gauge(int n = -1); // pobranie adresu obiektu
|
||||
TButton *__fastcall Button(int n = -1); // pobranie adresu obiektu
|
||||
void __fastcall Update();
|
||||
void Update();
|
||||
};
|
||||
|
||||
class TTrain
|
||||
@@ -66,24 +66,24 @@ class TTrain
|
||||
bool ActiveUniversal4;
|
||||
bool ShowNextCurrent; // pokaz przd w podlaczonej lokomotywie (ET41)
|
||||
bool InitializeCab(int NewCabNo, AnsiString asFileName);
|
||||
__fastcall TTrain();
|
||||
__fastcall ~TTrain();
|
||||
// bool __fastcall Init(TTrack *Track);
|
||||
TTrain();
|
||||
~TTrain();
|
||||
// bool Init(TTrack *Track);
|
||||
// McZapkie-010302
|
||||
bool __fastcall Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
||||
void __fastcall OnKeyDown(int cKey);
|
||||
void __fastcall OnKeyUp(int cKey);
|
||||
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
||||
void OnKeyDown(int cKey);
|
||||
void OnKeyUp(int cKey);
|
||||
|
||||
// bool __fastcall SHP() { fShpTimer= 0; };
|
||||
// bool SHP() { fShpTimer= 0; };
|
||||
|
||||
inline vector3 __fastcall GetDirection() { return DynamicObject->VectorFront(); };
|
||||
inline vector3 __fastcall GetUp() { return DynamicObject->VectorUp(); };
|
||||
void __fastcall UpdateMechPosition(double dt);
|
||||
bool __fastcall Update();
|
||||
void __fastcall MechStop();
|
||||
// virtual bool __fastcall RenderAlpha();
|
||||
inline vector3 GetDirection() { return DynamicObject->VectorFront(); };
|
||||
inline vector3 GetUp() { return DynamicObject->VectorUp(); };
|
||||
void UpdateMechPosition(double dt);
|
||||
bool Update();
|
||||
void MechStop();
|
||||
// virtual bool RenderAlpha();
|
||||
// McZapkie-310302: ladowanie parametrow z pliku
|
||||
bool __fastcall LoadMMediaFile(AnsiString asFileName);
|
||||
bool LoadMMediaFile(AnsiString asFileName);
|
||||
|
||||
private: //¿eby go nic z zewn¹trz nie przestawia³o
|
||||
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
|
||||
@@ -324,7 +324,7 @@ class TTrain
|
||||
bool bCabLightDim; // hunter-091012: czy przyciemnienie kabiny jest zapalone?
|
||||
|
||||
vector3 pMechSittingPosition; // ABu 180404
|
||||
vector3 __fastcall MirrorPosition(bool lewe);
|
||||
vector3 MirrorPosition(bool lewe);
|
||||
|
||||
private:
|
||||
// PSound dsbBuzzer;
|
||||
@@ -366,11 +366,11 @@ class TTrain
|
||||
int iSekunda; // Ra: sekunda aktualizacji prêdkoœci
|
||||
int iRadioChannel; // numer aktualnego kana³u radiowego
|
||||
public:
|
||||
int __fastcall RadioChannel() { return iRadioChannel; };
|
||||
int RadioChannel() { return iRadioChannel; };
|
||||
inline TDynamicObject *__fastcall Dynamic() { return DynamicObject; };
|
||||
inline TMoverParameters *__fastcall Controlled() { return mvControlled; };
|
||||
void __fastcall DynamicSet(TDynamicObject *d);
|
||||
void __fastcall Silence();
|
||||
void DynamicSet(TDynamicObject *d);
|
||||
void Silence();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@ __fastcall TTrackFollower::TTrackFollower()
|
||||
|
||||
__fastcall TTrackFollower::~TTrackFollower() {}
|
||||
|
||||
bool __fastcall TTrackFollower::Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir)
|
||||
bool TTrackFollower::Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir)
|
||||
{
|
||||
fDirection = fDir;
|
||||
Owner = NewOwner;
|
||||
@@ -105,7 +105,7 @@ TTrack *__fastcall TTrackFollower::SetCurrentTrack(TTrack *pTrack, int end)
|
||||
return pCurrentTrack;
|
||||
};
|
||||
|
||||
bool __fastcall TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
{ // przesuwanie wózka po torach o odległość (fDistance), z wyzwoleniem eventów
|
||||
// bPrimary=true - jest pierwszą osią w pojeździe, czyli generuje eventy i przepisuje pojazd
|
||||
// Ra: zwraca false, jeśli pojazd ma być usunięty
|
||||
@@ -290,7 +290,7 @@ bool __fastcall TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
}
|
||||
};
|
||||
|
||||
bool __fastcall TTrackFollower::ComputatePosition()
|
||||
bool TTrackFollower::ComputatePosition()
|
||||
{ // ustalenie współrzędnych XYZ
|
||||
if (pCurrentSegment) // o ile jest tor
|
||||
{
|
||||
@@ -312,7 +312,7 @@ bool __fastcall TTrackFollower::ComputatePosition()
|
||||
#if RENDER_CONE
|
||||
#include "opengl/glew.h"
|
||||
#include "opengl/glut.h"
|
||||
void __fastcall TTrackFollower::Render(float fNr)
|
||||
void TTrackFollower::Render(float fNr)
|
||||
{ // funkcja rysująca stożek w miejscu osi
|
||||
glPushMatrix(); // matryca kamery
|
||||
glTranslatef(pPosition.x, pPosition.y + 6, pPosition.z); // 6m ponad
|
||||
|
||||
22
TrkFoll.h
22
TrkFoll.h
@@ -14,7 +14,7 @@ class TTrackFollower
|
||||
TSegment *pCurrentSegment; // zwrotnice mogą mieć dwa segmenty
|
||||
double fCurrentDistance; // przesunięcie względem Point1 w stronę Point2
|
||||
double fDirection; // ustawienie względem toru: -1.0 albo 1.0, mnożone przez dystans
|
||||
bool __fastcall ComputatePosition(); // przeliczenie pozycji na torze
|
||||
bool ComputatePosition(); // przeliczenie pozycji na torze
|
||||
TDynamicObject *Owner; // pojazd posiadający
|
||||
int iEventFlag; // McZapkie-020602: informacja o tym czy wyzwalac zdarzenie: 0,1,2,3
|
||||
int iEventallFlag;
|
||||
@@ -24,23 +24,23 @@ class TTrackFollower
|
||||
double fOffsetH; // Ra: odległość środka osi od osi toru (dla samochodów) - użyć do wężykowania
|
||||
vector3 pPosition; // współrzędne XYZ w układzie scenerii
|
||||
vector3 vAngles; // x:przechyłka, y:pochylenie, z:kierunek w planie (w radianach)
|
||||
__fastcall TTrackFollower();
|
||||
__fastcall ~TTrackFollower();
|
||||
TTrackFollower();
|
||||
~TTrackFollower();
|
||||
TTrack *__fastcall SetCurrentTrack(TTrack *pTrack, int end);
|
||||
bool __fastcall Move(double fDistance, bool bPrimary);
|
||||
bool Move(double fDistance, bool bPrimary);
|
||||
inline TTrack *__fastcall GetTrack() { return pCurrentTrack; };
|
||||
inline double __fastcall GetRoll()
|
||||
inline double GetRoll()
|
||||
{
|
||||
return vAngles.x;
|
||||
}; // przechyłka policzona przy ustalaniu pozycji
|
||||
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyć można pobrać
|
||||
inline double __fastcall GetDirection() { return fDirection; }; // zwrot na torze
|
||||
inline double __fastcall GetTranslation() { return fCurrentDistance; }; // ABu-030403
|
||||
// inline double __fastcall GetLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||
inline double GetDirection() { return fDirection; }; // zwrot na torze
|
||||
inline double GetTranslation() { return fCurrentDistance; }; // ABu-030403
|
||||
// inline double GetLength(vector3 p1, vector3 cp1, vector3 cp2, vector3 p2)
|
||||
//{ return pCurrentSegment->ComputeLength(p1,cp1,cp2,p2); };
|
||||
// inline double __fastcall GetRadius(double L, double d); //McZapkie-150503
|
||||
bool __fastcall Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir);
|
||||
void __fastcall Render(float fNr);
|
||||
// inline double GetRadius(double L, double d); //McZapkie-150503
|
||||
bool Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir);
|
||||
void Render(float fNr);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
12
VBO.cpp
12
VBO.cpp
@@ -22,13 +22,13 @@ __fastcall CMesh::~CMesh()
|
||||
Clear(); // zwolnienie zasobów
|
||||
};
|
||||
|
||||
void __fastcall CMesh::MakeArray(int n)
|
||||
void CMesh::MakeArray(int n)
|
||||
{ // tworzenie tablic
|
||||
m_nVertexCount = n;
|
||||
m_pVNT = new CVertNormTex[m_nVertexCount]; // przydzielenie pamięci dla tablicy
|
||||
};
|
||||
|
||||
void __fastcall CMesh::BuildVBOs(bool del)
|
||||
void CMesh::BuildVBOs(bool del)
|
||||
{ // tworzenie VBO i kasowanie już niepotrzebnych tablic
|
||||
// pobierz numer VBO oraz ustaw go jako aktywny
|
||||
glGenBuffersARB(1, &m_nVBOVertices); // pobierz numer
|
||||
@@ -41,7 +41,7 @@ void __fastcall CMesh::BuildVBOs(bool del)
|
||||
SafeDeleteArray(m_pVNT); // wierzchołki już się nie przydadzą
|
||||
};
|
||||
|
||||
void __fastcall CMesh::Clear()
|
||||
void CMesh::Clear()
|
||||
{ // niewirtualne zwolnienie zasobów przez sprzątacz albo destruktor
|
||||
// inna nazwa, żeby nie mieszało się z funkcją wirtualną sprzątacza
|
||||
if (m_nVBOVertices) // jeśli było coś rezerwowane
|
||||
@@ -54,7 +54,7 @@ void __fastcall CMesh::Clear()
|
||||
SafeDeleteArray(m_pVNT); // usuwanie tablic, gdy były użyte do Vertex Array
|
||||
};
|
||||
|
||||
bool __fastcall CMesh::StartVBO()
|
||||
bool CMesh::StartVBO()
|
||||
{ // początek rysowania elementów z VBO
|
||||
if (m_nVertexCount <= 0)
|
||||
return false; // nie ma nic do rysowania w ten sposób
|
||||
@@ -71,7 +71,7 @@ bool __fastcall CMesh::StartVBO()
|
||||
return true; // można rysować z VBO
|
||||
};
|
||||
|
||||
bool __fastcall CMesh::StartColorVBO()
|
||||
bool CMesh::StartColorVBO()
|
||||
{ // początek rysowania punktów świecących z VBO
|
||||
if (m_nVertexCount <= 0)
|
||||
return false; // nie ma nic do rysowania w ten sposób
|
||||
@@ -87,7 +87,7 @@ bool __fastcall CMesh::StartColorVBO()
|
||||
return true; // można rysować z VBO
|
||||
};
|
||||
|
||||
void __fastcall CMesh::EndVBO()
|
||||
void CMesh::EndVBO()
|
||||
{ // koniec użycia VBO
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
16
VBO.h
16
VBO.h
@@ -22,14 +22,14 @@ class CMesh
|
||||
int m_nVertexCount; // liczba wierzchołków
|
||||
CVertNormTex *m_pVNT;
|
||||
unsigned int m_nVBOVertices; // numer VBO z wierzchołkami
|
||||
__fastcall CMesh();
|
||||
__fastcall ~CMesh();
|
||||
void __fastcall MakeArray(int n); // tworzenie tablicy z elementami VNT
|
||||
void __fastcall BuildVBOs(bool del = true); // zamiana tablic na VBO
|
||||
void __fastcall Clear(); // zwolnienie zasobów
|
||||
bool __fastcall StartVBO();
|
||||
void __fastcall EndVBO();
|
||||
bool __fastcall StartColorVBO();
|
||||
CMesh();
|
||||
~CMesh();
|
||||
void MakeArray(int n); // tworzenie tablicy z elementami VNT
|
||||
void BuildVBOs(bool del = true); // zamiana tablic na VBO
|
||||
void Clear(); // zwolnienie zasobów
|
||||
bool StartVBO();
|
||||
void EndVBO();
|
||||
bool StartColorVBO();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
30
World.cpp
30
World.cpp
@@ -73,7 +73,7 @@ __fastcall TWorld::~TWorld()
|
||||
FreeLibrary(hinstGLUT32);
|
||||
}
|
||||
|
||||
void __fastcall TWorld::TrainDelete(TDynamicObject *d)
|
||||
void TWorld::TrainDelete(TDynamicObject *d)
|
||||
{ // usuniêcie pojazdu prowadzonego przez u¿ytkownika
|
||||
if (d)
|
||||
if (Train)
|
||||
@@ -86,7 +86,7 @@ void __fastcall TWorld::TrainDelete(TDynamicObject *d)
|
||||
Global::pUserDynamic = NULL; // tego te¿ nie ma
|
||||
};
|
||||
|
||||
GLvoid __fastcall TWorld::glPrint(const char *txt) // custom GL "Print" routine
|
||||
GLvoid TWorld::glPrint(const char *txt) // custom GL "Print" routine
|
||||
{ // wypisywanie tekstu 2D na ekranie
|
||||
if (!txt)
|
||||
return;
|
||||
@@ -160,7 +160,7 @@ BOOL GetDisplayMonitorInfo(int nDeviceIndex, LPSTR lpszMonitorInfo)
|
||||
}
|
||||
*/
|
||||
|
||||
bool __fastcall TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
{
|
||||
double time = (double)Now();
|
||||
Global::hWnd = NhWnd; // do WM_COPYDATA
|
||||
@@ -668,7 +668,7 @@ bool __fastcall TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
return true;
|
||||
};
|
||||
|
||||
void __fastcall TWorld::OnKeyDown(int cKey)
|
||||
void TWorld::OnKeyDown(int cKey)
|
||||
{ //(cKey) to kod klawisza, cyfrowe i literowe siê zgadzaj¹
|
||||
// Ra 2014-09: tu by mo¿na dodaæ tabelê konwersji: 256 wirtualnych kodów w kontekœcie dwóch
|
||||
// prze³¹czników [Shift] i [Ctrl]
|
||||
@@ -957,7 +957,7 @@ void __fastcall TWorld::OnKeyDown(int cKey)
|
||||
//}
|
||||
}
|
||||
|
||||
void __fastcall TWorld::OnKeyUp(int cKey)
|
||||
void TWorld::OnKeyUp(int cKey)
|
||||
{ // zwolnienie klawisza; (cKey) to kod klawisza, cyfrowe i literowe siê zgadzaj¹
|
||||
if (!Global::iPause) // podczas pauzy sterownaie nie dzia³a
|
||||
if (Train)
|
||||
@@ -966,12 +966,12 @@ void __fastcall TWorld::OnKeyUp(int cKey)
|
||||
Train->OnKeyUp(cKey); // przekazanie zwolnienia klawisza do kabiny
|
||||
};
|
||||
|
||||
void __fastcall TWorld::OnMouseMove(double x, double y)
|
||||
void TWorld::OnMouseMove(double x, double y)
|
||||
{ // McZapkie:060503-definicja obracania myszy
|
||||
Camera.OnCursorMove(x * Global::fMouseXScale, -y * Global::fMouseYScale);
|
||||
}
|
||||
|
||||
void __fastcall TWorld::InOutKey()
|
||||
void TWorld::InOutKey()
|
||||
{ // prze³¹czenie widoku z kabiny na zewnêtrzny i odwrotnie
|
||||
FreeFlyModeFlag = !FreeFlyModeFlag; // zmiana widoku
|
||||
if (FreeFlyModeFlag)
|
||||
@@ -1001,7 +1001,7 @@ void __fastcall TWorld::InOutKey()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TWorld::DistantView()
|
||||
void TWorld::DistantView()
|
||||
{ // ustawienie widoku pojazdu z zewn¹trz
|
||||
if (Controlled) // jest pojazd do prowadzenia?
|
||||
{ // na prowadzony
|
||||
@@ -1023,7 +1023,7 @@ void __fastcall TWorld::DistantView()
|
||||
}
|
||||
};
|
||||
|
||||
void __fastcall TWorld::FollowView(bool wycisz)
|
||||
void TWorld::FollowView(bool wycisz)
|
||||
{ // ustawienie œledzenia pojazdu
|
||||
// ABu 180404 powrot mechanika na siedzenie albo w okolicê pojazdu
|
||||
// if (Console::Pressed(VK_F4)) Global::iViewMode=VK_F4;
|
||||
@@ -1075,7 +1075,7 @@ void __fastcall TWorld::FollowView(bool wycisz)
|
||||
DistantView();
|
||||
};
|
||||
|
||||
bool __fastcall TWorld::Update()
|
||||
bool TWorld::Update()
|
||||
{
|
||||
#ifdef USE_SCENERY_MOVING
|
||||
vector3 tmpvector = Global::GetCameraPosition();
|
||||
@@ -2492,7 +2492,7 @@ bool __fastcall TWorld::Update()
|
||||
return (true);
|
||||
};
|
||||
|
||||
bool __fastcall TWorld::Render()
|
||||
bool TWorld::Render()
|
||||
{
|
||||
glColor3b(255, 255, 255);
|
||||
// glColor3b(255, 0, 255);
|
||||
@@ -2672,7 +2672,7 @@ void TWorld::ShowHints(void)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
{ // odebranie komunikatu z serwera
|
||||
if (pRozkaz->iSygn == 'EU07')
|
||||
switch (pRozkaz->iComm)
|
||||
@@ -2781,7 +2781,7 @@ void __fastcall TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TWorld::ModifyTGA(const AnsiString &dir)
|
||||
void TWorld::ModifyTGA(const AnsiString &dir)
|
||||
{ // rekurencyjna modyfikacje plików TGA
|
||||
TSearchRec sr;
|
||||
if (FindFirst(dir + "*.*", faDirectory | faArchive, sr) == 0)
|
||||
@@ -2800,7 +2800,7 @@ void __fastcall TWorld::ModifyTGA(const AnsiString &dir)
|
||||
//---------------------------------------------------------------------------
|
||||
AnsiString last; // zmienne u¿ywane w rekurencji
|
||||
double shift = 0;
|
||||
void __fastcall TWorld::CreateE3D(const AnsiString &dir, bool dyn)
|
||||
void TWorld::CreateE3D(const AnsiString &dir, bool dyn)
|
||||
{ // rekurencyjna generowanie plików E3D
|
||||
TTrack *trk;
|
||||
double at;
|
||||
@@ -2892,7 +2892,7 @@ void __fastcall TWorld::CreateE3D(const AnsiString &dir, bool dyn)
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TWorld::CabChange(TDynamicObject *old, TDynamicObject *now)
|
||||
void TWorld::CabChange(TDynamicObject *old, TDynamicObject *now)
|
||||
{ // ewentualna zmiana kabiny u¿ytkownikowi
|
||||
if (Train)
|
||||
if (Train->Dynamic() == old)
|
||||
|
||||
36
World.h
36
World.h
@@ -15,23 +15,23 @@
|
||||
|
||||
class TWorld
|
||||
{
|
||||
void __fastcall InOutKey();
|
||||
void __fastcall FollowView(bool wycisz = true);
|
||||
void __fastcall DistantView();
|
||||
void InOutKey();
|
||||
void FollowView(bool wycisz = true);
|
||||
void DistantView();
|
||||
|
||||
public:
|
||||
bool __fastcall Init(HWND NhWnd, HDC hDC);
|
||||
bool Init(HWND NhWnd, HDC hDC);
|
||||
HWND hWnd;
|
||||
GLvoid __fastcall glPrint(const char *fmt);
|
||||
void __fastcall OnKeyDown(int cKey);
|
||||
void __fastcall OnKeyUp(int cKey);
|
||||
// void __fastcall UpdateWindow();
|
||||
void __fastcall OnMouseMove(double x, double y);
|
||||
void __fastcall OnCommandGet(DaneRozkaz *pRozkaz);
|
||||
bool __fastcall Update();
|
||||
void __fastcall TrainDelete(TDynamicObject *d = NULL);
|
||||
__fastcall TWorld();
|
||||
__fastcall ~TWorld();
|
||||
GLvoid glPrint(const char *fmt);
|
||||
void OnKeyDown(int cKey);
|
||||
void OnKeyUp(int cKey);
|
||||
// void UpdateWindow();
|
||||
void OnMouseMove(double x, double y);
|
||||
void OnCommandGet(DaneRozkaz *pRozkaz);
|
||||
bool Update();
|
||||
void TrainDelete(TDynamicObject *d = NULL);
|
||||
TWorld();
|
||||
~TWorld();
|
||||
// double Aspect;
|
||||
private:
|
||||
AnsiString OutText1; // teksty na ekranie
|
||||
@@ -39,7 +39,7 @@ class TWorld
|
||||
AnsiString OutText3;
|
||||
AnsiString OutText4;
|
||||
void ShowHints();
|
||||
bool __fastcall Render();
|
||||
bool Render();
|
||||
TCamera Camera;
|
||||
TGround Ground;
|
||||
TTrain *Train;
|
||||
@@ -56,9 +56,9 @@ class TWorld
|
||||
double fMaxDt; //[s] krok czasowy fizyki (0.01 dla normalnych warunków)
|
||||
int iPause; // wykrywanie zmian w zapauzowaniu
|
||||
public:
|
||||
void __fastcall ModifyTGA(const AnsiString &dir = "");
|
||||
void __fastcall CreateE3D(const AnsiString &dir = "", bool dyn = false);
|
||||
void __fastcall CabChange(TDynamicObject *old, TDynamicObject *now);
|
||||
void ModifyTGA(const AnsiString &dir = "");
|
||||
void CreateE3D(const AnsiString &dir = "", bool dyn = false);
|
||||
void CabChange(TDynamicObject *old, TDynamicObject *now);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -5,26 +5,26 @@
|
||||
namespace Math3D
|
||||
{
|
||||
|
||||
void __fastcall vector3::RotateX(double angle)
|
||||
void vector3::RotateX(double angle)
|
||||
{
|
||||
double ty = y;
|
||||
y = (cos(angle) * y - z * sin(angle));
|
||||
z = (z * cos(angle) + sin(angle) * ty);
|
||||
};
|
||||
void __fastcall vector3::RotateY(double angle)
|
||||
void vector3::RotateY(double angle)
|
||||
{
|
||||
double tx = x;
|
||||
x = (cos(angle) * x + z * sin(angle));
|
||||
z = (z * cos(angle) - sin(angle) * tx);
|
||||
};
|
||||
void __fastcall vector3::RotateZ(double angle)
|
||||
void vector3::RotateZ(double angle)
|
||||
{
|
||||
double ty = y;
|
||||
y = (cos(angle) * y + x * sin(angle));
|
||||
x = (x * cos(angle) - sin(angle) * ty);
|
||||
};
|
||||
|
||||
void inline __fastcall vector3::SafeNormalize()
|
||||
void inline vector3::SafeNormalize()
|
||||
{
|
||||
double l = Length();
|
||||
if (l == 0)
|
||||
|
||||
26
dumb3d.h
26
dumb3d.h
@@ -27,7 +27,7 @@ class vector2
|
||||
{
|
||||
public:
|
||||
vector2(void) {}
|
||||
__fastcall vector2(scalar_t a, scalar_t b)
|
||||
vector2(scalar_t a, scalar_t b)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
@@ -44,7 +44,7 @@ class vector3
|
||||
{
|
||||
public:
|
||||
vector3(void) {}
|
||||
__fastcall vector3(scalar_t a, scalar_t b, scalar_t c)
|
||||
vector3(scalar_t a, scalar_t b, scalar_t c)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
@@ -55,14 +55,14 @@ class vector3
|
||||
// explicit vector3(scalar_t* initArray, int arraySize = 3)
|
||||
// { for (int i = 0;i<arraySize;++i) e[i] = initArray[i]; }
|
||||
|
||||
void __fastcall RotateX(double angle);
|
||||
void __fastcall RotateY(double angle);
|
||||
void __fastcall RotateZ(double angle);
|
||||
void RotateX(double angle);
|
||||
void RotateY(double angle);
|
||||
void RotateZ(double angle);
|
||||
|
||||
void inline __fastcall Normalize();
|
||||
void inline __fastcall SafeNormalize();
|
||||
double inline __fastcall Length();
|
||||
void inline __fastcall Zero() { x = y = z = 0.0; };
|
||||
void inline Normalize();
|
||||
void inline SafeNormalize();
|
||||
double inline Length();
|
||||
void inline Zero() { x = y = z = 0.0; };
|
||||
|
||||
// [] is to read, () is to write (const correctness)
|
||||
// const scalar_t& operator[] (int i) const { return e[i]; }
|
||||
@@ -80,7 +80,7 @@ class vector3
|
||||
// };
|
||||
// scalar_t e[3];
|
||||
// };
|
||||
bool inline __fastcall Equal(vector3 *v)
|
||||
bool inline Equal(vector3 *v)
|
||||
{ // sprawdzenie odleg³oœci punktów
|
||||
if (fabs(x - v->x) > 0.02)
|
||||
return false; // szeœcian zamiast kuli
|
||||
@@ -355,7 +355,7 @@ inline vector3 operator*(const matrix4x4 &m, const vector3 &v)
|
||||
v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2] + m[3][2]);
|
||||
}
|
||||
|
||||
void inline __fastcall vector3::Normalize()
|
||||
void inline vector3::Normalize()
|
||||
{
|
||||
double il = 1 / Length();
|
||||
x *= il;
|
||||
@@ -363,7 +363,7 @@ void inline __fastcall vector3::Normalize()
|
||||
z *= il;
|
||||
}
|
||||
|
||||
double inline __fastcall 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)
|
||||
{
|
||||
@@ -531,7 +531,7 @@ inline matrix4x4 &matrix4x4::ProjectionMatrix(bool perspective, scalar_t left_pl
|
||||
return *this;
|
||||
}
|
||||
|
||||
double inline __fastcall SquareMagnitude(const vector3 &v)
|
||||
double inline SquareMagnitude(const vector3 &v)
|
||||
{
|
||||
return v.x * v.x + v.y * v.y + v.z * v.z;
|
||||
}
|
||||
|
||||
22
geometry.cpp
22
geometry.cpp
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Geometry.h"
|
||||
|
||||
inline double __fastcall sqr(double a) { return (a * a); };
|
||||
inline double sqr(double a) { return (a * a); };
|
||||
|
||||
__fastcall TLine::TLine(){};
|
||||
|
||||
@@ -16,9 +16,9 @@ __fastcall TLine::TLine(vector3 NPoint, vector3 NVector)
|
||||
|
||||
__fastcall TLine::~TLine(){};
|
||||
|
||||
TPlane __fastcall TLine::GetPlane() { return (TPlane(Point, Vector)); };
|
||||
TPlane TLine::GetPlane() { return (TPlane(Point, Vector)); };
|
||||
|
||||
double __fastcall TLine::GetDistance(vector3 Point1)
|
||||
double TLine::GetDistance(vector3 Point1)
|
||||
{
|
||||
return ((sqr((Point1.x - Point.x) * Vector.x - (Point1.y - Point.y) * Vector.y) -
|
||||
sqr((Point1.y - Point.y) * Vector.y - (Point1.z - Point.z) * Vector.z) -
|
||||
@@ -55,31 +55,31 @@ __fastcall TPlane::TPlane(vector3 Point1, vector3 Vector1, vector3 Vector2)
|
||||
|
||||
__fastcall TPlane::~TPlane(){};
|
||||
|
||||
void __fastcall TPlane::Normalize()
|
||||
void TPlane::Normalize()
|
||||
{
|
||||
double mgn = Vector.Length();
|
||||
Vector = Vector / mgn;
|
||||
d /= mgn;
|
||||
};
|
||||
|
||||
double __fastcall TPlane::GetSide(vector3 Point)
|
||||
double TPlane::GetSide(vector3 Point)
|
||||
{
|
||||
return (Vector.x * Point.x + Vector.y * Point.y + Vector.z * Point.z + d);
|
||||
};
|
||||
|
||||
// void __fastcall TPlane::Transform(D3DMATRIX &Transformations)
|
||||
// void TPlane::Transform(D3DMATRIX &Transformations)
|
||||
//{
|
||||
// vector3 src= Vector;
|
||||
// D3DMath_VectorMatrixMultiply(Vector,src,Transformations);
|
||||
//};
|
||||
|
||||
bool __fastcall TPlane::Defined() { return !(Vector == vector3(0, 0, 0)); };
|
||||
bool TPlane::Defined() { return !(Vector == vector3(0, 0, 0)); };
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline double __fastcall Sum(vector3 &Vector) { return (Vector.x + Vector.y + Vector.z); };
|
||||
inline double Sum(vector3 &Vector) { return (Vector.x + Vector.y + Vector.z); };
|
||||
|
||||
bool __fastcall CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||
bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||
{
|
||||
double ro = DotProduct(Plane.Vector, Line.Vector);
|
||||
if (ro == 0)
|
||||
@@ -89,9 +89,9 @@ bool __fastcall CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||
return (true);
|
||||
};
|
||||
|
||||
inline double __fastcall GetLength(vector3 &Vector) { return (Vector.Length()); };
|
||||
inline double GetLength(vector3 &Vector) { return (Vector.Length()); };
|
||||
|
||||
inline vector3 __fastcall SetLength(vector3 &Vector, double Length)
|
||||
inline vector3 SetLength(vector3 &Vector, double Length)
|
||||
{
|
||||
Vector.Normalize();
|
||||
return (Vector * Length);
|
||||
|
||||
32
geometry.h
32
geometry.h
@@ -13,11 +13,11 @@ class TLine
|
||||
{
|
||||
public:
|
||||
vector3 Vector, Point;
|
||||
__fastcall TLine();
|
||||
__fastcall TLine(vector3 NPoint, vector3 NVector);
|
||||
__fastcall ~TLine();
|
||||
TPlane __fastcall GetPlane();
|
||||
double __fastcall GetDistance(vector3 Point1);
|
||||
TLine();
|
||||
TLine(vector3 NPoint, vector3 NVector);
|
||||
~TLine();
|
||||
TPlane GetPlane();
|
||||
double GetDistance(vector3 Point1);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -27,21 +27,21 @@ class TPlane
|
||||
public:
|
||||
vector3 Vector;
|
||||
double d;
|
||||
__fastcall TPlane();
|
||||
__fastcall TPlane(vector3 NVector, double nd);
|
||||
__fastcall TPlane(vector3 NPoint, vector3 NVector);
|
||||
__fastcall TPlane(vector3 Point1, vector3 Vector1, vector3 Vector2);
|
||||
__fastcall ~TPlane();
|
||||
void __fastcall Normalize();
|
||||
double __fastcall GetSide(vector3 Point);
|
||||
// void __fastcall Transform(D3DMATRIX &Transformations);
|
||||
bool __fastcall Defined();
|
||||
TPlane();
|
||||
TPlane(vector3 NVector, double nd);
|
||||
TPlane(vector3 NPoint, vector3 NVector);
|
||||
TPlane(vector3 Point1, vector3 Vector1, vector3 Vector2);
|
||||
~TPlane();
|
||||
void Normalize();
|
||||
double GetSide(vector3 Point);
|
||||
// void Transform(D3DMATRIX &Transformations);
|
||||
bool Defined();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline double __fastcall Sum(vector3 &Vector);
|
||||
bool __fastcall CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane);
|
||||
inline double Sum(vector3 &Vector);
|
||||
bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
4
sky.cpp
4
sky.cpp
@@ -14,7 +14,7 @@ __fastcall TSky::~TSky(){};
|
||||
|
||||
__fastcall TSky::TSky(){};
|
||||
|
||||
void __fastcall TSky::Init()
|
||||
void TSky::Init()
|
||||
{
|
||||
WriteLog(Global::asSky.c_str());
|
||||
WriteLog("init");
|
||||
@@ -26,7 +26,7 @@ void __fastcall TSky::Init()
|
||||
// }
|
||||
};
|
||||
|
||||
void __fastcall TSky::Render()
|
||||
void TSky::Render()
|
||||
{
|
||||
if (mdCloud)
|
||||
{ // jeœli jest model nieba
|
||||
|
||||
Reference in New Issue
Block a user