mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 02:49:19 +02:00
Change clang format
Add AlignTrailingComments: false Add AllowShortFunctionsOnASingleLine: Empty
This commit is contained in:
@@ -4,9 +4,11 @@ IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignTrailingComments: false
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
ColumnLimit: 100
|
||||
---
|
||||
|
||||
11
AdvSound.cpp
11
AdvSound.cpp
@@ -32,10 +32,12 @@ TAdvancedSound::~TAdvancedSound()
|
||||
// SoundShut.Stop();
|
||||
}
|
||||
|
||||
void TAdvancedSound::Free() {}
|
||||
void TAdvancedSound::Free()
|
||||
{
|
||||
}
|
||||
|
||||
void TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff,
|
||||
double DistanceAttenuation, vector3 pPosition)
|
||||
void TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation,
|
||||
vector3 pPosition)
|
||||
{
|
||||
SoundStart.Init(NameOn, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
||||
SoundCommencing.Init(Name, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
|
||||
@@ -131,8 +133,7 @@ void TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition)
|
||||
{ // update, ale z amplituda i czestotliwoscia
|
||||
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
|
||||
{
|
||||
|
||||
@@ -14,9 +14,14 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "AirCoupler.h"
|
||||
#include "Timer.h"
|
||||
|
||||
TAirCoupler::TAirCoupler() { Clear(); }
|
||||
TAirCoupler::TAirCoupler()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
TAirCoupler::~TAirCoupler() {}
|
||||
TAirCoupler::~TAirCoupler()
|
||||
{
|
||||
}
|
||||
|
||||
int TAirCoupler::GetStatus()
|
||||
{ // zwraca 1, jeœli istnieje model prosty, 2 gdy skoœny
|
||||
|
||||
@@ -684,10 +684,12 @@ void TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
||||
//---------------------------------------------------------------------------
|
||||
bool TAnimModel::TerrainLoaded()
|
||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||
return (this ? pModel != NULL : false); };
|
||||
return (this ? pModel != NULL : false);
|
||||
};
|
||||
int TAnimModel::TerrainCount()
|
||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||
return pModel ? pModel->TerrainCount() : 0; };
|
||||
return pModel ? pModel->TerrainCount() : 0;
|
||||
};
|
||||
TSubModel *__fastcall TAnimModel::TerrainSquare(int n)
|
||||
{ // pobieranie wskaźników do pierwszego submodelu
|
||||
return pModel ? pModel->TerrainSquare(n) : 0;
|
||||
|
||||
15
AnimModel.h
15
AnimModel.h
@@ -80,7 +80,10 @@ class TAnimContainer
|
||||
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
||||
// std::string inline GetName() { return std::string(pSubModel?pSubModel->pName:"");
|
||||
// };
|
||||
char *__fastcall NameGet() { return (pSubModel ? pSubModel->pName : NULL); };
|
||||
char *__fastcall NameGet()
|
||||
{
|
||||
return (pSubModel ? pSubModel->pName : NULL);
|
||||
};
|
||||
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
||||
// fNewRotateSpeed, bool bResetAngle=false);
|
||||
void SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSpeed);
|
||||
@@ -90,7 +93,10 @@ class TAnimContainer
|
||||
void UpdateModel();
|
||||
void UpdateModelIK();
|
||||
bool InMovement(); // czy w trakcie animacji?
|
||||
double _fastcall AngleGet() { return vRotateAngles.z; }; // jednak ostatnia, T3D ma inny uk³ad
|
||||
double _fastcall AngleGet()
|
||||
{
|
||||
return vRotateAngles.z;
|
||||
}; // jednak ostatnia, T3D ma inny uk³ad
|
||||
vector3 _fastcall TransGet()
|
||||
{
|
||||
return vector3(-vTranslation.x, vTranslation.z, vTranslation.y);
|
||||
@@ -101,7 +107,10 @@ class TAnimContainer
|
||||
pSubModel->WillBeAnimated();
|
||||
};
|
||||
void EventAssign(TEvent *ev);
|
||||
TEvent *__fastcall Event() { return evDone; };
|
||||
TEvent *__fastcall Event()
|
||||
{
|
||||
return evDone;
|
||||
};
|
||||
};
|
||||
|
||||
class TAnimAdvanced
|
||||
|
||||
10
Button.h
10
Button.h
@@ -25,7 +25,10 @@ class TButton
|
||||
TButton();
|
||||
~TButton();
|
||||
void Clear(int i = -1);
|
||||
inline void FeedbackBitSet(int i) { iFeedbackBit = 1 << i; };
|
||||
inline void FeedbackBitSet(int i)
|
||||
{
|
||||
iFeedbackBit = 1 << i;
|
||||
};
|
||||
inline void Turn(bool to)
|
||||
{
|
||||
bOn = to;
|
||||
@@ -46,7 +49,10 @@ class TButton
|
||||
bOn = !bOn;
|
||||
Update();
|
||||
};
|
||||
inline bool Active() { return (pModelOn) || (pModelOff); };
|
||||
inline bool Active()
|
||||
{
|
||||
return (pModelOn) || (pModelOff);
|
||||
};
|
||||
void Init(AnsiString asName, TModel3d *pModel, bool bNewOn = false);
|
||||
void Load(TQueryParserComp *Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
||||
};
|
||||
|
||||
5
Camera.h
5
Camera.h
@@ -38,7 +38,10 @@ class TCamera
|
||||
vector3 CrossPos;
|
||||
double CrossDist;
|
||||
void Init(vector3 NPos, vector3 NAngle);
|
||||
void Reset() { Pitch = Yaw = Roll = 0; };
|
||||
void Reset()
|
||||
{
|
||||
Pitch = Yaw = Roll = 0;
|
||||
};
|
||||
void OnCursorMove(double x, double y);
|
||||
void Update();
|
||||
vector3 GetDirection();
|
||||
|
||||
15
Console.cpp
15
Console.cpp
@@ -274,7 +274,10 @@ void Console::BitsUpdate(int mask)
|
||||
}
|
||||
};
|
||||
|
||||
bool Console::Pressed(int x) { return Global::bActive && (GetKeyState(x) < 0); }; // na razie tak - czyta się tylko klawiatura
|
||||
bool Console::Pressed(int x)
|
||||
{
|
||||
return Global::bActive && (GetKeyState(x) < 0);
|
||||
}; // na razie tak - czyta się tylko klawiatura
|
||||
|
||||
void Console::ValueSet(int x, double y)
|
||||
{ // ustawienie wartości (y) na kanale analogowym (x)
|
||||
@@ -353,5 +356,11 @@ void Console::OnKeyUp(int k)
|
||||
else
|
||||
iButton[char(k) >> 5] &= ~(1 << (k & 31)); // wyłącz monostabilny podstawowy
|
||||
};
|
||||
int Console::KeyDownConvert(int k) { return int(ktTable[k & 0x3FF].iDown); };
|
||||
int 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);
|
||||
};
|
||||
|
||||
@@ -48,4 +48,7 @@ bool TLPT::Connect(int port)
|
||||
return bool(OutPort);
|
||||
};
|
||||
|
||||
void TLPT::Out(int x) { OutPort(address, x); }; // wys³anie bajtu do portu
|
||||
void TLPT::Out(int x)
|
||||
{
|
||||
OutPort(address, x);
|
||||
}; // wys³anie bajtu do portu
|
||||
|
||||
@@ -39,7 +39,10 @@ TPoKeys55::TPoKeys55()
|
||||
bNoError = true;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
TPoKeys55::~TPoKeys55() { Close(); };
|
||||
TPoKeys55::~TPoKeys55()
|
||||
{
|
||||
Close();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
bool TPoKeys55::Close()
|
||||
{ // roz³¹czenie komunikacji
|
||||
@@ -202,8 +205,7 @@ bool TPoKeys55::Connect()
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned char b4,
|
||||
unsigned char b5)
|
||||
bool TPoKeys55::Write(unsigned char c, unsigned char b3, unsigned char b4, unsigned char b5)
|
||||
{
|
||||
DWORD BytesWritten = 0;
|
||||
OutputBuffer[0] = 0; // The first byte is the "Report ID" and does not get transmitted over the
|
||||
|
||||
@@ -28,8 +28,7 @@ class TPoKeys55
|
||||
~TPoKeys55();
|
||||
bool Connect();
|
||||
bool Close();
|
||||
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0,
|
||||
unsigned char b5 = 0);
|
||||
bool Write(unsigned char c, unsigned char b3, unsigned char b4 = 0, unsigned char b5 = 0);
|
||||
bool Read();
|
||||
bool ReadLoop(int i);
|
||||
AnsiString Version();
|
||||
|
||||
3
Data.h
3
Data.h
@@ -17,7 +17,8 @@ struct TDist
|
||||
{
|
||||
int x, y;
|
||||
};
|
||||
const TDist SectorOrder[] = { // tabela wspó³rzêdnych sektorów, posortowana wg odleg³oœci
|
||||
const TDist SectorOrder[] = {
|
||||
// tabela wspó³rzêdnych sektorów, posortowana wg odleg³oœci
|
||||
{0, 0}, // 0.00
|
||||
{1, 0}, // 1.00
|
||||
{0, 1}, // 1.00
|
||||
|
||||
41
Driver.cpp
41
Driver.cpp
@@ -87,7 +87,8 @@ const double HardAcceleration = 0.9;
|
||||
const double PrepareTime = 2.0; //[s] przebłyski świadomości przy odpalaniu
|
||||
bool WriteLogFlag = false;
|
||||
|
||||
AnsiString StopReasonTable[] = { // przyczyny zatrzymania ruchu AI
|
||||
AnsiString StopReasonTable[] = {
|
||||
// przyczyny zatrzymania ruchu AI
|
||||
"", // stopNone, //nie ma powodu - powinien jechać
|
||||
"Off", // stopSleep, //nie został odpalony, to nie pojedzie
|
||||
"Semaphore", // stopSem, //semafor zamknięty
|
||||
@@ -624,8 +625,7 @@ void TController::TableCheck(double fDistance)
|
||||
}
|
||||
};
|
||||
|
||||
TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
double &fAcc)
|
||||
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
|
||||
// fDist - dystans w jakim należy rozważyć ruch
|
||||
@@ -4564,9 +4564,15 @@ void TController::OrdersDump()
|
||||
}
|
||||
};
|
||||
|
||||
TOrders TController::OrderCurrentGet() { return OrderList[OrderPos]; }
|
||||
TOrders TController::OrderCurrentGet()
|
||||
{
|
||||
return OrderList[OrderPos];
|
||||
}
|
||||
|
||||
TOrders TController::OrderNextGet() { return OrderList[OrderPos + 1]; }
|
||||
TOrders TController::OrderNextGet()
|
||||
{
|
||||
return OrderList[OrderPos + 1];
|
||||
}
|
||||
|
||||
void TController::OrdersInit(double fVel)
|
||||
{ // wypełnianie tabelki rozkazów na podstawie rozkładu
|
||||
@@ -5054,15 +5060,30 @@ void TController::DirectionForward(bool forward)
|
||||
mvControlling->IncMainCtrl(1); //żeby nie zgasł
|
||||
};
|
||||
|
||||
AnsiString TController::Relation() { return TrainParams->ShowRelation(); }; // zwraca relację pociągu
|
||||
AnsiString TController::Relation()
|
||||
{
|
||||
return TrainParams->ShowRelation();
|
||||
}; // zwraca relację pociągu
|
||||
|
||||
AnsiString TController::TrainName() { return TrainParams->TrainName; }; // zwraca relację pociągu
|
||||
AnsiString TController::TrainName()
|
||||
{
|
||||
return TrainParams->TrainName;
|
||||
}; // zwraca relację pociągu
|
||||
|
||||
int TController::StationCount() { return TrainParams->StationCount; }; // zwraca ilość stacji (miejsc zatrzymania)
|
||||
int TController::StationCount()
|
||||
{
|
||||
return TrainParams->StationCount;
|
||||
}; // zwraca ilość stacji (miejsc zatrzymania)
|
||||
|
||||
int TController::StationIndex() { return TrainParams->StationIndex; }; // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
||||
int TController::StationIndex()
|
||||
{
|
||||
return TrainParams->StationIndex;
|
||||
}; // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
||||
|
||||
bool TController::IsStop() { return TrainParams->IsStop(); }; // informuje, czy jest zatrzymanie na najbliższej stacji
|
||||
bool TController::IsStop()
|
||||
{
|
||||
return TrainParams->IsStop();
|
||||
}; // informuje, czy jest zatrzymanie na najbliższej stacji
|
||||
|
||||
void TController::MoveTo(TDynamicObject *to)
|
||||
{ // przesunięcie AI do innego pojazdu (przy zmianie kabiny)
|
||||
|
||||
18
Driver.h
18
Driver.h
@@ -268,7 +268,10 @@ class TController
|
||||
void ControllingSet(); // znajduje człon do sterowania
|
||||
void AutoRewident(); // ustawia hamulce w składzie
|
||||
public:
|
||||
Mtable::TTrainParameters *__fastcall Timetable() { return TrainParams; };
|
||||
Mtable::TTrainParameters *__fastcall Timetable()
|
||||
{
|
||||
return TrainParams;
|
||||
};
|
||||
void PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
const _mover::TLocation &NewLocation, TStopReason reason = stopComm);
|
||||
bool PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2,
|
||||
@@ -319,8 +322,7 @@ class TController
|
||||
TEvent *__fastcall TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||
void TableCheck(double fDistance);
|
||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext,
|
||||
double &fAcc);
|
||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
||||
void TablePurger();
|
||||
|
||||
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||
@@ -342,8 +344,14 @@ class TController
|
||||
int StationCount();
|
||||
int StationIndex();
|
||||
bool IsStop();
|
||||
bool Primary() { return this ? bool(iDrivigFlags & movePrimary) : false; };
|
||||
int inline DrivigFlags() { return iDrivigFlags; };
|
||||
bool Primary()
|
||||
{
|
||||
return this ? bool(iDrivigFlags & movePrimary) : false;
|
||||
};
|
||||
int inline DrivigFlags()
|
||||
{
|
||||
return iDrivigFlags;
|
||||
};
|
||||
void MoveTo(TDynamicObject *to);
|
||||
void DirectionInitial();
|
||||
AnsiString TableText(int i);
|
||||
|
||||
@@ -131,7 +131,8 @@ TAnim::~TAnim()
|
||||
break;
|
||||
}
|
||||
};
|
||||
void TAnim::Parovoz(){// animowanie tłoka i rozrządu parowozu
|
||||
void TAnim::Parovoz(){
|
||||
// animowanie tłoka i rozrządu parowozu
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
TDynamicObject *__fastcall TDynamicObject::FirstFind(int &coupler_nr)
|
||||
@@ -288,7 +289,10 @@ TDynamicObject* TDynamicObject::GetFirstCabDynamic(int cpl_type)
|
||||
};
|
||||
*/
|
||||
|
||||
void TDynamicObject::ABuSetModelShake(vector3 mShake) { modelShake = mShake; };
|
||||
void TDynamicObject::ABuSetModelShake(vector3 mShake)
|
||||
{
|
||||
modelShake = mShake;
|
||||
};
|
||||
|
||||
int TDynamicObject::GetPneumatic(bool front, bool red)
|
||||
{
|
||||
|
||||
63
DynObj.h
63
DynObj.h
@@ -338,14 +338,26 @@ class TDynamicObject
|
||||
TDynamicObject *__fastcall Next();
|
||||
TDynamicObject *__fastcall NextC(int C);
|
||||
double NextDistance(double d = -1.0);
|
||||
void SetdMoveLen(double dMoveLen) { MoverParameters->dMoveLen = dMoveLen; }
|
||||
void ResetdMoveLen() { MoverParameters->dMoveLen = 0; }
|
||||
double GetdMoveLen() { return MoverParameters->dMoveLen; }
|
||||
void SetdMoveLen(double dMoveLen)
|
||||
{
|
||||
MoverParameters->dMoveLen = dMoveLen;
|
||||
}
|
||||
void ResetdMoveLen()
|
||||
{
|
||||
MoverParameters->dMoveLen = 0;
|
||||
}
|
||||
double GetdMoveLen()
|
||||
{
|
||||
return MoverParameters->dMoveLen;
|
||||
}
|
||||
|
||||
int GetPneumatic(bool front, bool red);
|
||||
void SetPneumatic(bool front, bool red);
|
||||
AnsiString asName;
|
||||
AnsiString GetName() { return this ? asName : AnsiString(""); };
|
||||
AnsiString GetName()
|
||||
{
|
||||
return this ? asName : AnsiString("");
|
||||
};
|
||||
|
||||
TRealSound rsDiesielInc; // youBy
|
||||
TRealSound rscurve; // youBy
|
||||
@@ -395,7 +407,10 @@ class TDynamicObject
|
||||
void Render();
|
||||
void RenderAlpha();
|
||||
void RenderSounds();
|
||||
inline vector3 GetPosition() { return vPosition; };
|
||||
inline vector3 GetPosition()
|
||||
{
|
||||
return vPosition;
|
||||
};
|
||||
inline vector3 HeadPosition()
|
||||
{
|
||||
return vCoulpler[iDirection ^ 1];
|
||||
@@ -408,13 +423,34 @@ class TDynamicObject
|
||||
{
|
||||
return iAxleFirst ? Axle1.pPosition : Axle0.pPosition;
|
||||
};
|
||||
inline vector3 VectorFront() { return vFront; };
|
||||
inline vector3 VectorUp() { return vUp; };
|
||||
inline vector3 VectorLeft() { return vLeft; };
|
||||
inline double *__fastcall Matrix() { return mMatrix.getArray(); };
|
||||
inline double GetVelocity() { return MoverParameters->Vel; };
|
||||
inline double GetLength() { return MoverParameters->Dim.L; };
|
||||
inline double GetWidth() { return MoverParameters->Dim.W; };
|
||||
inline vector3 VectorFront()
|
||||
{
|
||||
return vFront;
|
||||
};
|
||||
inline vector3 VectorUp()
|
||||
{
|
||||
return vUp;
|
||||
};
|
||||
inline vector3 VectorLeft()
|
||||
{
|
||||
return vLeft;
|
||||
};
|
||||
inline double *__fastcall Matrix()
|
||||
{
|
||||
return mMatrix.getArray();
|
||||
};
|
||||
inline double GetVelocity()
|
||||
{
|
||||
return MoverParameters->Vel;
|
||||
};
|
||||
inline double GetLength()
|
||||
{
|
||||
return MoverParameters->Dim.L;
|
||||
};
|
||||
inline double GetWidth()
|
||||
{
|
||||
return MoverParameters->Dim.W;
|
||||
};
|
||||
inline TTrack *__fastcall GetTrack()
|
||||
{
|
||||
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack());
|
||||
@@ -422,8 +458,7 @@ class TDynamicObject
|
||||
// void UpdatePos();
|
||||
|
||||
// McZapkie-260202
|
||||
void LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
AnsiString ReplacableSkin);
|
||||
void LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName, AnsiString ReplacableSkin);
|
||||
|
||||
inline double ABuGetDirection() // ABu.
|
||||
{
|
||||
|
||||
3
EU07.cpp
3
EU07.cpp
@@ -754,6 +754,3 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
|
||||
KillGLWindow(); // kill the window
|
||||
return (msg.wParam); // exit the program
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,9 +43,14 @@ TEventLauncher::TEventLauncher()
|
||||
iCheckMask = 0;
|
||||
}
|
||||
|
||||
TEventLauncher::~TEventLauncher() { SafeDeleteArray(szText); }
|
||||
TEventLauncher::~TEventLauncher()
|
||||
{
|
||||
SafeDeleteArray(szText);
|
||||
}
|
||||
|
||||
void TEventLauncher::Init() {}
|
||||
void TEventLauncher::Init()
|
||||
{
|
||||
}
|
||||
|
||||
bool TEventLauncher::Load(cParser *parser)
|
||||
{ // wczytanie wyzwalacza zdarzeñ
|
||||
|
||||
@@ -27,9 +27,14 @@ TFadeSound::TFadeSound()
|
||||
fTime = 0;
|
||||
}
|
||||
|
||||
TFadeSound::~TFadeSound() { Free(); }
|
||||
TFadeSound::~TFadeSound()
|
||||
{
|
||||
Free();
|
||||
}
|
||||
|
||||
void TFadeSound::Free() {}
|
||||
void TFadeSound::Free()
|
||||
{
|
||||
}
|
||||
|
||||
void TFadeSound::Init(char *Name, float fNewFade)
|
||||
{
|
||||
@@ -47,7 +52,10 @@ void TFadeSound::TurnOn()
|
||||
fTime = fFade;
|
||||
}
|
||||
|
||||
void TFadeSound::TurnOff() { State = ss_ShuttingDown; }
|
||||
void TFadeSound::TurnOff()
|
||||
{
|
||||
State = ss_ShuttingDown;
|
||||
}
|
||||
|
||||
void TFadeSound::Update()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,10 @@ class TFadeSound
|
||||
void Init(char *Name, float fNewFade);
|
||||
void TurnOn();
|
||||
void TurnOff();
|
||||
bool Playing() { return (State == ss_Commencing || State == ss_Starting); };
|
||||
bool Playing()
|
||||
{
|
||||
return (State == ss_Commencing || State == ss_Starting);
|
||||
};
|
||||
void Free();
|
||||
void Update();
|
||||
void Volume(long vol);
|
||||
|
||||
45
Float3d.h
45
Float3d.h
@@ -37,7 +37,10 @@ inline float3 &operator+=(float3 &v1, const float3 &v2)
|
||||
v1.z += v2.z;
|
||||
return v1;
|
||||
};
|
||||
inline float3 operator-(const float3 &v) { return float3(-v.x, -v.y, -v.z); };
|
||||
inline float3 operator-(const float3 &v)
|
||||
{
|
||||
return float3(-v.x, -v.y, -v.z);
|
||||
};
|
||||
inline float3 operator-(const float3 &v1, const float3 &v2)
|
||||
{
|
||||
return float3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
||||
@@ -46,8 +49,14 @@ inline float3 operator+(const float3 &v1, const float3 &v2)
|
||||
{
|
||||
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
||||
};
|
||||
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); };
|
||||
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)
|
||||
double l = v.Length();
|
||||
@@ -79,8 +88,14 @@ class float4
|
||||
z = c;
|
||||
w = d;
|
||||
};
|
||||
double inline float4::LengthSquared() const { return x * x + y * y + z * z + w * w; };
|
||||
double inline float4::Length() const { return sqrt(x * x + y * y + z * z + w * w); };
|
||||
double inline float4::LengthSquared() const
|
||||
{
|
||||
return x * x + y * y + z * z + w * w;
|
||||
};
|
||||
double inline float4::Length() const
|
||||
{
|
||||
return sqrt(x * x + y * y + z * z + w * w);
|
||||
};
|
||||
};
|
||||
inline float4 operator*(const float4 &q1, const float4 &q2)
|
||||
{ // mno¿enie to prawie jak mno¿enie macierzy
|
||||
@@ -177,15 +192,24 @@ class float4x4
|
||||
for (int i = 0; i < 16; ++i)
|
||||
e[i] = f[i];
|
||||
};
|
||||
float *__fastcall operator()(int i) { return &e[i << 2]; }
|
||||
const float *__fastcall readArray(void) { return e; }
|
||||
float *__fastcall operator()(int i)
|
||||
{
|
||||
return &e[i << 2];
|
||||
}
|
||||
const float *__fastcall readArray(void)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
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]; };
|
||||
const float *operator[](int i) const
|
||||
{
|
||||
return &e[i << 2];
|
||||
};
|
||||
void InitialRotate()
|
||||
{ // taka specjalna rotacja, nie ma co ci¹gaæ trygonometrii
|
||||
float f;
|
||||
@@ -206,7 +230,10 @@ class float4x4
|
||||
return true;
|
||||
}
|
||||
void Quaternion(float4 *q);
|
||||
inline float3 *TranslationGet() { return (float3 *)(e + 12); }
|
||||
inline float3 *TranslationGet()
|
||||
{
|
||||
return (float3 *)(e + 12);
|
||||
}
|
||||
};
|
||||
|
||||
inline float3 operator*(const float4x4 &m, const float3 &v)
|
||||
|
||||
@@ -46,8 +46,8 @@ void TGauge::Clear()
|
||||
fDesiredValue = 0;
|
||||
};
|
||||
|
||||
void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale,
|
||||
double fNewOffset, double fNewFriction, double fNewValue)
|
||||
void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale, double fNewOffset,
|
||||
double fNewFriction, double fNewValue)
|
||||
{ // ustawienie parametrów animacji submodelu
|
||||
if (NewSubModel)
|
||||
{ // warunek na wszelki wypadek, gdyby siê submodel nie pod³¹czy³
|
||||
|
||||
8
Gauge.h
8
Gauge.h
@@ -50,14 +50,16 @@ class TGauge // zmienne "gg"
|
||||
void Clear();
|
||||
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
||||
double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
||||
bool Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL,
|
||||
double mul = 1.0);
|
||||
bool Load(TQueryParserComp *Parser, TModel3d *md1, TModel3d *md2 = NULL, double mul = 1.0);
|
||||
void PermIncValue(double fNewDesired);
|
||||
void IncValue(double fNewDesired);
|
||||
void DecValue(double fNewDesired);
|
||||
void UpdateValue(double fNewDesired);
|
||||
void PutValue(double fNewDesired);
|
||||
float GetValue() { return fValue; };
|
||||
float GetValue()
|
||||
{
|
||||
return fValue;
|
||||
};
|
||||
void Update();
|
||||
void Render();
|
||||
void AssignFloat(float *fValue);
|
||||
|
||||
16
Geom.cpp
16
Geom.cpp
@@ -19,11 +19,17 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Globals.h"
|
||||
#include "Geom.h"
|
||||
|
||||
__fastcall TGeometry::TGeometry() {}
|
||||
__fastcall TGeometry::TGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
__fastcall TGeometry::~TGeometry() {}
|
||||
__fastcall TGeometry::~TGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
bool TGeometry::Init() {}
|
||||
bool TGeometry::Init()
|
||||
{
|
||||
}
|
||||
|
||||
vector3 TGeometry::Load(TQueryParserComp *Parser)
|
||||
{
|
||||
@@ -113,7 +119,9 @@ vector3 TGeometry::Load(TQueryParserComp *Parser)
|
||||
tmp->fSquareRadius += r;
|
||||
}
|
||||
|
||||
bool TGeometry::Render() {}
|
||||
bool TGeometry::Render()
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
@@ -206,7 +206,10 @@ class Global
|
||||
static AnsiString asHumanCtrlVehicle;
|
||||
static void LoadIniFile(AnsiString asFileName);
|
||||
static void InitKeys(AnsiString asFileName);
|
||||
inline static vector3 GetCameraPosition() { return pCameraPosition; };
|
||||
inline static vector3 GetCameraPosition()
|
||||
{
|
||||
return pCameraPosition;
|
||||
};
|
||||
static void SetCameraPosition(vector3 pNewCameraPosition);
|
||||
static void SetCameraRotation(double Yaw);
|
||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||
|
||||
@@ -1626,8 +1626,7 @@ TGroundNode *__fastcall TGround::AddGroundNode(cParser *parser)
|
||||
*parser >> tmp->hvTraction->NominalVoltage >> tmp->hvTraction->MaxCurrent >>
|
||||
tmp->hvTraction->fResistivity;
|
||||
if (tmp->hvTraction->fResistivity == 0.01) // tyle jest w sceneriach [om/km]
|
||||
tmp->hvTraction->fResistivity =
|
||||
0.075; // taka sensowniejsza wartoϾ za
|
||||
tmp->hvTraction->fResistivity = 0.075; // taka sensowniejsza wartoϾ za
|
||||
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
||||
tmp->hvTraction->fResistivity *= 0.001; // teraz [om/m]
|
||||
parser->getTokens();
|
||||
@@ -3210,7 +3209,6 @@ void TGround::InitTracks()
|
||||
if (Track->asEventall2Name.IsEmpty())
|
||||
if (FindEvent(Current->asName + ":eventall2"))
|
||||
Track->asEventall2Name = Current->asName + ":eventall2";
|
||||
|
||||
}
|
||||
Track->AssignEvents(
|
||||
Track->asEvent0Name.IsEmpty() ? NULL : FindEvent(Track->asEvent0Name),
|
||||
@@ -4454,7 +4452,8 @@ bool TGround::GetTraction(TDynamicObject *model)
|
||||
false) // jeœli drut jest ni¿ej ni¿ 15cm pod
|
||||
// œlizgiem
|
||||
{ // prze³¹czamy w tryb po³amania, o ile jedzie;
|
||||
// (bEnableTraction) aby da³o siê jeŸdziæ na koœlawych
|
||||
// (bEnableTraction) aby da³o siê jeŸdziæ na
|
||||
// koœlawych
|
||||
// sceneriach
|
||||
fHorizontal = fabs(DotProduct(vGdzie, vLeft)) -
|
||||
p->fWidth; // i do tego jeszcze
|
||||
|
||||
18
Ground.h
18
Ground.h
@@ -193,8 +193,7 @@ class TSubRect : public Resource, public CMesh
|
||||
TSubRect();
|
||||
virtual ~TSubRect();
|
||||
virtual void Release(); // zwalnianie VBO sektora
|
||||
void NodeAdd(
|
||||
TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory
|
||||
void NodeAdd(TGroundNode *Node); // dodanie obiektu do sektora na etapie rozdzielania na sektory
|
||||
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);
|
||||
@@ -227,7 +226,10 @@ class TGroundRect : public TSubRect
|
||||
private:
|
||||
int iLastDisplay; // numer klatki w której był ostatnio wyświetlany
|
||||
TSubRect *pSubRects;
|
||||
void Init() { pSubRects = new TSubRect[iNumSubRects * iNumSubRects]; };
|
||||
void Init()
|
||||
{
|
||||
pSubRects = new TSubRect[iNumSubRects * iNumSubRects];
|
||||
};
|
||||
|
||||
public:
|
||||
static int iFrameNumber; // numer kolejny wyświetlanej klatki
|
||||
@@ -359,8 +361,14 @@ class TGround
|
||||
};
|
||||
TSubRect *__fastcall GetSubRect(int iCol, int iRow);
|
||||
TSubRect *__fastcall FastGetSubRect(int iCol, int iRow);
|
||||
int GetRowFromZ(double z) { return (z / fSubRectSize + fHalfTotalNumSubRects); };
|
||||
int 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 TrackJoin(TGroundNode *Current);
|
||||
|
||||
24
Machajka.cpp
24
Machajka.cpp
@@ -15,9 +15,14 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Timer.h"
|
||||
#include "Globals.h"
|
||||
|
||||
__fastcall TMachajka::TMachajka() : TTrain() { TTrain::TTrain(); }
|
||||
__fastcall TMachajka::TMachajka() : TTrain()
|
||||
{
|
||||
TTrain::TTrain();
|
||||
}
|
||||
|
||||
__fastcall TMachajka::~TMachajka() {}
|
||||
__fastcall TMachajka::~TMachajka()
|
||||
{
|
||||
}
|
||||
|
||||
bool TMachajka::Init(TDynamicObject *NewDynamicObject)
|
||||
{
|
||||
@@ -63,11 +68,20 @@ void TMachajka::OnKeyPress(int cKey)
|
||||
}
|
||||
}
|
||||
|
||||
bool TMachajka::Update(double dt) { TTrain::Update(dt); }
|
||||
bool TMachajka::Update(double dt)
|
||||
{
|
||||
TTrain::Update(dt);
|
||||
}
|
||||
|
||||
bool TMachajka::UpdateMechPosition() { TTrain::UpdateMechPosition(); }
|
||||
bool TMachajka::UpdateMechPosition()
|
||||
{
|
||||
TTrain::UpdateMechPosition();
|
||||
}
|
||||
|
||||
bool TMachajka::Render() { TTrain::Render(); }
|
||||
bool TMachajka::Render()
|
||||
{
|
||||
TTrain::Render();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
@@ -57,7 +57,10 @@ __fastcall TModelsManager::~TModelsManager()
|
||||
Free();
|
||||
};
|
||||
*/
|
||||
void TModelsManager::Free() { SafeDeleteArray(Models); }
|
||||
void TModelsManager::Free()
|
||||
{
|
||||
SafeDeleteArray(Models);
|
||||
}
|
||||
|
||||
TModel3d *__fastcall TModelsManager::LoadModel(char *Name, bool dynamic)
|
||||
{ // wczytanie modelu do tablicy
|
||||
|
||||
20
MemCell.cpp
20
MemCell.cpp
@@ -41,12 +41,16 @@ TMemCell::TMemCell(vector3 *p)
|
||||
OnSent = NULL;
|
||||
}
|
||||
|
||||
TMemCell::~TMemCell() { SafeDeleteArray(szText); }
|
||||
TMemCell::~TMemCell()
|
||||
{
|
||||
SafeDeleteArray(szText);
|
||||
}
|
||||
|
||||
void TMemCell::Init() {}
|
||||
void TMemCell::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
int CheckMask)
|
||||
void TMemCell::UpdateValues(char *szNewText, double fNewValue1, double fNewValue2, int CheckMask)
|
||||
{
|
||||
if (CheckMask & update_memadd)
|
||||
{ // dodawanie wartoœci
|
||||
@@ -140,8 +144,7 @@ void TMemCell::PutCommand(TController *Mech, vector3 *Loc)
|
||||
Mech->PutCommand(szText, fValue1, fValue2, Loc);
|
||||
}
|
||||
|
||||
bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
int CheckMask)
|
||||
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))
|
||||
{ // porównaæ teksty
|
||||
@@ -161,7 +164,10 @@ bool TMemCell::Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
(!TestFlag(CheckMask, conditional_memval2) || (fValue2 == fTestValue2)));
|
||||
};
|
||||
|
||||
bool TMemCell::Render() { return true; }
|
||||
bool TMemCell::Render()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TMemCell::IsVelocity()
|
||||
{ // sprawdzenie, czy event odczytu tej komórki ma byæ do skanowania, czy do kolejkowania
|
||||
|
||||
36
MemCell.h
36
MemCell.h
@@ -30,19 +30,35 @@ class TMemCell
|
||||
TMemCell(vector3 *p);
|
||||
~TMemCell();
|
||||
void Init();
|
||||
void UpdateValues(char *szNewText, double fNewValue1, double fNewValue2,
|
||||
int CheckMask);
|
||||
void UpdateValues(char *szNewText, double fNewValue1, double fNewValue2, int CheckMask);
|
||||
bool Load(cParser *parser);
|
||||
void PutCommand(TController *Mech, vector3 *Loc);
|
||||
bool Compare(char *szTestText, double fTestValue1, double fTestValue2,
|
||||
int CheckMask);
|
||||
bool Compare(char *szTestText, double fTestValue1, double fTestValue2, int CheckMask);
|
||||
bool Render();
|
||||
inline char *__fastcall Text() { return szText; };
|
||||
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; };
|
||||
inline char *__fastcall Text()
|
||||
{
|
||||
return szText;
|
||||
};
|
||||
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();
|
||||
|
||||
30
Model3d.cpp
30
Model3d.cpp
@@ -178,8 +178,7 @@ void TSubModel::NameSet(const char *n)
|
||||
|
||||
// int TSubModel::SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||
// *Vertices)
|
||||
int TSubModel::SeekFaceNormal(DWORD *Masks, int f, DWORD dwMask, float3 *pt,
|
||||
float8 *Vertices)
|
||||
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
|
||||
// GLVERTEX *p; //roboczy wskaŸnik
|
||||
@@ -916,7 +915,10 @@ void TSubModel::SetRotateIK1(float3 vNewAngles)
|
||||
|
||||
struct ToLower
|
||||
{
|
||||
char operator()(char input) { return tolower(input); }
|
||||
char operator()(char input)
|
||||
{
|
||||
return tolower(input);
|
||||
}
|
||||
};
|
||||
|
||||
TSubModel *__fastcall TSubModel::GetFromName(AnsiString search, bool i)
|
||||
@@ -1523,8 +1525,8 @@ void TSubModel::InfoSet(TSubModelInfo *info)
|
||||
pTexture = pName = NULL;
|
||||
};
|
||||
|
||||
void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t,
|
||||
TStringPack *n, bool dynamic)
|
||||
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
|
||||
Child = ((int)Child > 0) ? s + (int)Child : NULL; // zerowy nie mo¿e byæ potomnym
|
||||
@@ -2019,7 +2021,10 @@ void TModel3d::SaveToBinFile(char *FileName)
|
||||
delete[] info;
|
||||
};
|
||||
|
||||
void TModel3d::BreakHierarhy() { Error("Not implemented yet :("); };
|
||||
void TModel3d::BreakHierarhy()
|
||||
{
|
||||
Error("Not implemented yet :(");
|
||||
};
|
||||
|
||||
/*
|
||||
void TModel3d::Render(vector3 pPosition,double fAngle,GLuint ReplacableSkinId,int iAlpha)
|
||||
@@ -2122,8 +2127,7 @@ void TModel3d::RaRender(double fSquareDistance, GLuint *ReplacableSkinId, int iA
|
||||
}
|
||||
};
|
||||
|
||||
void TModel3d::RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
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?
|
||||
{
|
||||
@@ -2159,8 +2163,7 @@ iAlpha)
|
||||
// 2011-03-16 cztery nowe funkcje renderowania z mo¿liwoœci¹ pochylania obiektów
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId, int iAlpha)
|
||||
{ // nieprzezroczyste, Display List
|
||||
glPushMatrix();
|
||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||
@@ -2194,8 +2197,7 @@ void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *Replacab
|
||||
Root->RenderAlphaDL();
|
||||
glPopMatrix();
|
||||
};
|
||||
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId, int iAlpha)
|
||||
{ // nieprzezroczyste, VBO
|
||||
glPushMatrix();
|
||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||
@@ -2215,8 +2217,8 @@ void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableS
|
||||
}
|
||||
glPopMatrix();
|
||||
};
|
||||
void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId, int iAlpha)
|
||||
void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId,
|
||||
int iAlpha)
|
||||
{ // przezroczyste, VBO
|
||||
glPushMatrix();
|
||||
glTranslated(vPosition->x, vPosition->y, vPosition->z);
|
||||
|
||||
91
Model3d.h
91
Model3d.h
@@ -36,21 +36,33 @@ class TStringPack
|
||||
//+8 - tabela indeksów
|
||||
public:
|
||||
char *String(int n);
|
||||
char *StringAt(int n) { return data + 9 + n; };
|
||||
char *StringAt(int n)
|
||||
{
|
||||
return data + 9 + n;
|
||||
};
|
||||
TStringPack()
|
||||
{
|
||||
data = NULL;
|
||||
index = NULL;
|
||||
};
|
||||
void Init(char *d) { data = d; };
|
||||
void InitIndex(int *i) { index = i; };
|
||||
void Init(char *d)
|
||||
{
|
||||
data = d;
|
||||
};
|
||||
void InitIndex(int *i)
|
||||
{
|
||||
index = i;
|
||||
};
|
||||
};
|
||||
|
||||
class TMaterialColor
|
||||
{
|
||||
public:
|
||||
TMaterialColor(){};
|
||||
TMaterialColor(char V) { r = g = b = V; };
|
||||
TMaterialColor(char V)
|
||||
{
|
||||
r = g = b = V;
|
||||
};
|
||||
// TMaterialColor(double R, double G, double B)
|
||||
TMaterialColor(char R, char G, char B)
|
||||
{
|
||||
@@ -250,8 +262,14 @@ class TSubModel
|
||||
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; };
|
||||
TSubModel *__fastcall NextGet()
|
||||
{
|
||||
return Next;
|
||||
};
|
||||
TSubModel *__fastcall ChildGet()
|
||||
{
|
||||
return Child;
|
||||
};
|
||||
int TriangleAdd(TModel3d *m, int tex, int tri);
|
||||
float8 *__fastcall TrianglePtr(int tex, int pos, int *la, int *ld, int *ls);
|
||||
// float8* TrianglePtr(const char *tex,int tri);
|
||||
@@ -269,9 +287,15 @@ class TSubModel
|
||||
void RenderVBO();
|
||||
void RenderAlphaVBO();
|
||||
// inline matrix4x4* GetMatrix() {return dMatrix;};
|
||||
inline float4x4 *__fastcall GetMatrix() { return fMatrix; };
|
||||
inline float4x4 *__fastcall GetMatrix()
|
||||
{
|
||||
return fMatrix;
|
||||
};
|
||||
// matrix4x4* GetTransform() {return Matrix;};
|
||||
inline void Hide() { iVisible = 0; };
|
||||
inline void Hide()
|
||||
{
|
||||
iVisible = 0;
|
||||
};
|
||||
void RaArrayFill(CVertNormTex *Vert);
|
||||
// void Render();
|
||||
int FlagsCheck();
|
||||
@@ -284,8 +308,8 @@ class TSubModel
|
||||
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 BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t, TStringPack *n = NULL,
|
||||
bool dynamic = false);
|
||||
void ReplacableSet(GLuint *r, int a)
|
||||
{
|
||||
ReplacableSkinId = r;
|
||||
@@ -294,8 +318,14 @@ class TSubModel
|
||||
void TextureNameSet(const char *n);
|
||||
void NameSet(const char *n);
|
||||
// Ra: funkcje do budowania terenu z E3D
|
||||
int Flags() { return iFlags; };
|
||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
int Flags()
|
||||
{
|
||||
return iFlags;
|
||||
};
|
||||
void UnFlagNext()
|
||||
{
|
||||
iFlags &= 0x00FFFFFF;
|
||||
};
|
||||
void ColorsSet(int *a, int *d, int *s);
|
||||
inline float3 Translation1Get()
|
||||
{
|
||||
@@ -356,7 +386,10 @@ class TModel3d : public CMesh
|
||||
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
||||
AnsiString asBinary; // nazwa pod którą zapisać model binarny
|
||||
public:
|
||||
inline TSubModel *__fastcall GetSMRoot() { return (Root); };
|
||||
inline TSubModel *__fastcall GetSMRoot()
|
||||
{
|
||||
return (Root);
|
||||
};
|
||||
// double Radius; //Ra: nie używane
|
||||
TModel3d();
|
||||
TModel3d(char *FileName);
|
||||
@@ -371,36 +404,40 @@ class TModel3d : public CMesh
|
||||
void SaveToBinFile(char *FileName);
|
||||
void BreakHierarhy();
|
||||
// renderowanie specjalne
|
||||
void Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void Render(double fSquareDistance, GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRender(double fSquareDistance, GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RaRenderAlpha(double fSquareDistance, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
// jeden kąt obrotu
|
||||
void Render(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RenderAlpha(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRender(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRenderAlpha(vector3 pPosition, double fAngle = 0,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RaRenderAlpha(vector3 pPosition, double fAngle = 0, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
// trzy kąty obrotu
|
||||
void Render(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRender(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle,
|
||||
GLuint *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, GLuint *ReplacableSkinId = NULL,
|
||||
int iAlpha = 0x30300030);
|
||||
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
||||
int Flags() { return iFlags; };
|
||||
int Flags()
|
||||
{
|
||||
return iFlags;
|
||||
};
|
||||
void Init();
|
||||
char *__fastcall NameGet() { return Root ? Root->pName : NULL; };
|
||||
char *__fastcall NameGet()
|
||||
{
|
||||
return Root ? Root->pName : NULL;
|
||||
};
|
||||
int TerrainCount();
|
||||
TSubModel *__fastcall TerrainSquare(int n);
|
||||
void TerrainRenderVBO(int n);
|
||||
|
||||
29
Mover.cpp
29
Mover.cpp
@@ -16,9 +16,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
const dEpsilon = 0.01; // 1cm (zale¿y od typu sprzêgu...)
|
||||
|
||||
TMoverParameters::TMoverParameters(double VelInitial, AnsiString TypeNameInit,
|
||||
AnsiString NameInit, int LoadInitial,
|
||||
AnsiString LoadTypeInitial, int Cab)
|
||||
TMoverParameters::TMoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit,
|
||||
int LoadInitial, AnsiString LoadTypeInitial, int Cab)
|
||||
: T_MoverParameters(VelInitial, TypeNameInit, NameInit, LoadInitial, LoadTypeInitial, Cab)
|
||||
{ // g³ówny konstruktor
|
||||
DimHalf.x = 0.5 * Dim.W; // po³owa szerokoœci, OX jest w bok?
|
||||
@@ -37,8 +36,8 @@ double TMoverParameters::Distance(const TLocation &Loc1, const TLocation &Loc2,
|
||||
return hypot(Loc2.X - Loc1.X, Loc1.Y - Loc2.Y) - 0.5 * (Dim2.L + Dim1.L);
|
||||
};
|
||||
|
||||
double TMoverParameters::Distance(const vector3 &s1, const vector3 &s2,
|
||||
const vector3 &d1, const vector3 &d2){
|
||||
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...
|
||||
};
|
||||
@@ -50,9 +49,8 @@ double TMoverParameters::CouplerDist(Byte Coupler)
|
||||
Couplers[Coupler].Connected->Dim); // odleg³oœæ pomiêdzy sprzêgami (kula!)
|
||||
};
|
||||
|
||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
TMoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced)
|
||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
||||
Byte CouplingType, bool Forced)
|
||||
{ //³¹czenie do swojego sprzêgu (ConnectNo) pojazdu (ConnectTo) stron¹ (ConnectToNr)
|
||||
// Ra: zwykle wykonywane dwukrotnie, dla ka¿dego pojazdu oddzielnie
|
||||
// Ra: trzeba by odró¿niæ wymóg dociœniêcia od uszkodzenia sprzêgu przy podczepianiu AI do
|
||||
@@ -94,9 +92,8 @@ bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
// sprzêgu, brak haka
|
||||
};
|
||||
|
||||
bool TMoverParameters::Attach(Byte ConnectNo, Byte ConnectToNr,
|
||||
T_MoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced)
|
||||
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);
|
||||
};
|
||||
@@ -234,10 +231,13 @@ bool TMoverParameters::BrakeLevelAdd(double b)
|
||||
|
||||
bool TMoverParameters::IncBrakeLevel()
|
||||
{ // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê BrakeCtrlPosNo
|
||||
return BrakeLevelAdd(1.0); };
|
||||
return BrakeLevelAdd(1.0);
|
||||
};
|
||||
|
||||
bool TMoverParameters::DecBrakeLevel()
|
||||
{ return BrakeLevelAdd(-1.0); }; // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê -1
|
||||
{
|
||||
return BrakeLevelAdd(-1.0);
|
||||
}; // nowa wersja na u¿ytek AI, false gdy osi¹gniêto pozycjê -1
|
||||
|
||||
bool TMoverParameters::ChangeCab(int direction)
|
||||
{ // zmiana kabiny i resetowanie ustawien
|
||||
@@ -475,8 +475,7 @@ ZN //masa
|
||||
*/
|
||||
|
||||
double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape,
|
||||
TTrackParam &Track,
|
||||
TTractionParam &ElectricTraction,
|
||||
TTrackParam &Track, TTractionParam &ElectricTraction,
|
||||
const TLocation &NewLoc, TRotation &NewRot)
|
||||
{ // trzeba po ma³u przenosiæ tu tê funkcjê
|
||||
double d;
|
||||
|
||||
14
Mover.h
14
Mover.h
@@ -50,10 +50,10 @@ class TMoverParameters : public T_MoverParameters
|
||||
const TDimension &Dim2);
|
||||
double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1,
|
||||
const vector3 &Dim2);
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo,
|
||||
Byte CouplingType, bool Forced = false);
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo,
|
||||
Byte CouplingType, bool Forced = false);
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, TMoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced = false);
|
||||
bool Attach(Byte ConnectNo, Byte ConnectToNr, T_MoverParameters *ConnectTo, Byte CouplingType,
|
||||
bool Forced = false);
|
||||
int DettachStatus(Byte ConnectNo);
|
||||
bool Dettach(Byte ConnectNo);
|
||||
void SetCoupleDist();
|
||||
@@ -65,9 +65,9 @@ class TMoverParameters : public T_MoverParameters
|
||||
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 ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track,
|
||||
TTractionParam &ElectricTraction, const TLocation &NewLoc,
|
||||
TRotation &NewRot);
|
||||
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track,
|
||||
const TLocation &NewLoc, TRotation &NewRot);
|
||||
double ShowEngineRotation(int VehN);
|
||||
|
||||
13
Names.h
13
Names.h
@@ -26,8 +26,14 @@ class ItemRecord
|
||||
// typedef
|
||||
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; };
|
||||
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);
|
||||
ItemRecord *__fastcall TreeFindRecord(const char *n);
|
||||
};
|
||||
@@ -46,8 +52,7 @@ class TNames
|
||||
int Add(int t, const char *n); // dodanie obiektu typu (t)
|
||||
int Add(int t, const char *n, 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
|
||||
bool Update(int t, const char *n, void *d); // dodanie jeœli nie ma, wymiana (d), gdy jest
|
||||
void TreeSet();
|
||||
ItemRecord *__fastcall TreeSet(int *n, int d, int u);
|
||||
void Sort(int t); // przebudowa drzewa typu (t)
|
||||
|
||||
@@ -45,10 +45,12 @@ TRealSound::~TRealSound()
|
||||
// if (this) if (pSound) pSound->Stop();
|
||||
}
|
||||
|
||||
void TRealSound::Free() {}
|
||||
void TRealSound::Free()
|
||||
{
|
||||
}
|
||||
|
||||
void TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y,
|
||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
||||
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
|
||||
pSound = TSoundsManager::GetFromName(SoundName, Dynamic, &fFrequency);
|
||||
@@ -95,8 +97,7 @@ double TRealSound::ListenerDistance(vector3 ListenerPosition)
|
||||
}
|
||||
}
|
||||
|
||||
void TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
void TRealSound::Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition)
|
||||
{
|
||||
if (!pSound)
|
||||
return;
|
||||
@@ -168,7 +169,8 @@ void TRealSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
}
|
||||
};
|
||||
|
||||
void TRealSound::Start(){// włączenie dźwięku
|
||||
void TRealSound::Start(){
|
||||
// włączenie dźwięku
|
||||
|
||||
};
|
||||
|
||||
@@ -185,8 +187,7 @@ void TRealSound::Stop()
|
||||
}
|
||||
};
|
||||
|
||||
void TRealSound::AdjFreq(double Freq,
|
||||
double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
||||
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
|
||||
{
|
||||
float df, Vlist, Vsrc;
|
||||
@@ -223,7 +224,10 @@ double TRealSound::GetWaveTime() // McZapkie: na razie tylko dla 22KHz/8bps
|
||||
fFrequency; //(pSound->); // wielkosc w bajtach przez czestotliwosc probkowania
|
||||
}
|
||||
|
||||
void TRealSound::SetPan(int Pan) { pSound->SetPan(Pan); }
|
||||
void TRealSound::SetPan(int Pan)
|
||||
{
|
||||
pSound->SetPan(Pan);
|
||||
}
|
||||
|
||||
int TRealSound::GetStatus()
|
||||
{
|
||||
@@ -243,8 +247,8 @@ void TRealSound::ResetPosition()
|
||||
pSound->SetCurrentPosition(0);
|
||||
}
|
||||
|
||||
void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y,
|
||||
double Z, bool Dynamic, bool freqmod, double rmin)
|
||||
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);
|
||||
fTime = GetWaveTime();
|
||||
@@ -264,8 +268,7 @@ void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double
|
||||
delete ts;
|
||||
}
|
||||
};
|
||||
void TTextSound::Play(double Volume, int Looping, bool ListenerInside,
|
||||
vector3 NewPosition)
|
||||
void TTextSound::Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition)
|
||||
{
|
||||
if (!asText.IsEmpty())
|
||||
{ // jeśli ma powiązany tekst
|
||||
|
||||
@@ -32,8 +32,8 @@ class TRealSound
|
||||
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);
|
||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
bool freqmod = false, double rmin = 0.0);
|
||||
double ListenerDistance(vector3 ListenerPosition);
|
||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
void Start();
|
||||
@@ -51,8 +51,8 @@ class TTextSound : public TRealSound
|
||||
AnsiString asText;
|
||||
float fTime; // czas trwania
|
||||
public:
|
||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
|
||||
bool Dynamic, bool freqmod = false, double rmin = 0.0);
|
||||
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
|
||||
bool freqmod = false, double rmin = 0.0);
|
||||
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ double ResourceManager::_expiry = 5.0f;
|
||||
double ResourceManager::_lastUpdate = 0.0f;
|
||||
double ResourceManager::_lastReport = 0.0f;
|
||||
|
||||
void ResourceManager::Register(Resource *resource) { _resources.push_back(resource); };
|
||||
void ResourceManager::Register(Resource *resource)
|
||||
{
|
||||
_resources.push_back(resource);
|
||||
};
|
||||
|
||||
void ResourceManager::Unregister(Resource *resource)
|
||||
{
|
||||
@@ -33,7 +36,10 @@ class ResourceExpired
|
||||
{
|
||||
public:
|
||||
ResourceExpired(double time) : _time(time){};
|
||||
bool operator()(Resource *resource) { return (resource->GetLastUsage() < _time); }
|
||||
bool operator()(Resource *resource)
|
||||
{
|
||||
return (resource->GetLastUsage() < _time);
|
||||
}
|
||||
|
||||
private:
|
||||
double _time;
|
||||
|
||||
@@ -20,10 +20,16 @@ class Resource
|
||||
|
||||
public:
|
||||
virtual void Release() = 0;
|
||||
double GetLastUsage() const { return _lastUsage; }
|
||||
double GetLastUsage() const
|
||||
{
|
||||
return _lastUsage;
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetLastUsage(double lastUsage) { _lastUsage = lastUsage; }
|
||||
void SetLastUsage(double lastUsage)
|
||||
{
|
||||
_lastUsage = lastUsage;
|
||||
}
|
||||
|
||||
private:
|
||||
double _lastUsage;
|
||||
@@ -37,7 +43,10 @@ class ResourceManager
|
||||
static void Unregister(Resource *resource);
|
||||
|
||||
static void Sweep(double currentTime);
|
||||
static void SetExpiry(double expiry) { _expiry = expiry; }
|
||||
static void SetExpiry(double expiry)
|
||||
{
|
||||
_expiry = expiry;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::vector<Resource *> Resources;
|
||||
|
||||
28
Segment.cpp
28
Segment.cpp
@@ -41,10 +41,13 @@ TSegment::TSegment(TTrack *owner)
|
||||
pOwner = owner;
|
||||
};
|
||||
|
||||
TSegment::~TSegment() { SafeDeleteArray(fTsBuffer); };
|
||||
TSegment::~TSegment()
|
||||
{
|
||||
SafeDeleteArray(fTsBuffer);
|
||||
};
|
||||
|
||||
bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
double fNewRoll1, double fNewRoll2)
|
||||
bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep, double fNewRoll1,
|
||||
double fNewRoll2)
|
||||
{ // wersja dla prostego - wyliczanie punktów kontrolnych
|
||||
vector3 dir;
|
||||
if (fNewRoll1 == fNewRoll2)
|
||||
@@ -62,8 +65,8 @@ bool TSegment::Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
};
|
||||
|
||||
bool TSegment::Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1,
|
||||
double fNewRoll2, bool bIsCurve)
|
||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1, double fNewRoll2,
|
||||
bool bIsCurve)
|
||||
{ // wersja uniwersalna (dla krzywej i prostego)
|
||||
Point1 = NewPoint1;
|
||||
CPointOut = NewCPointOut;
|
||||
@@ -329,9 +332,8 @@ vector3 TSegment::FastGetPoint(double t)
|
||||
return (bCurve ? RaInterpolate(t) : ((1.0 - t) * Point1 + (t)*Point2));
|
||||
}
|
||||
|
||||
void TSegment::RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
double fTextureLength, int iSkip, int iQualityFactor,
|
||||
vector3 **p, bool bRender)
|
||||
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
|
||||
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
||||
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
||||
@@ -696,9 +698,8 @@ void TSegment::Render()
|
||||
}
|
||||
}
|
||||
|
||||
void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip,
|
||||
int iEnd, double fOffsetX)
|
||||
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
|
||||
// standardowo tworzy triangle_strip dla prostego albo ich zestaw dla łuku
|
||||
// po modyfikacji - dla ujemnego (iNumShapePoints) w dodatkowych polach tabeli
|
||||
@@ -896,9 +897,8 @@ void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
}
|
||||
};
|
||||
|
||||
void TSegment::RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip, int iEnd,
|
||||
double fOffsetX)
|
||||
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
|
||||
vector3 pos1, pos2, dir, parallel1, parallel2, pt;
|
||||
double s, step, fOffset, t, fEnd;
|
||||
|
||||
62
Segment.h
62
Segment.h
@@ -77,22 +77,36 @@ class TSegment
|
||||
// (0-Bezier,1-prosty,2/3-³uk w lewo/prawo,6/7-przejœciowa w lewo/prawo)
|
||||
TSegment(TTrack *owner);
|
||||
~TSegment();
|
||||
bool Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep,
|
||||
double fNewRoll1 = 0, double fNewRoll2 = 0);
|
||||
bool Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn,
|
||||
vector3 &NewPoint2, double fNewStep, double fNewRoll1 = 0,
|
||||
double fNewRoll2 = 0, bool bIsCurve = true);
|
||||
bool Init(vector3 NewPoint1, vector3 NewPoint2, double fNewStep, double fNewRoll1 = 0,
|
||||
double fNewRoll2 = 0);
|
||||
bool Init(vector3 &NewPoint1, vector3 NewCPointOut, vector3 NewCPointIn, vector3 &NewPoint2,
|
||||
double fNewStep, double fNewRoll1 = 0, double fNewRoll2 = 0, bool bIsCurve = true);
|
||||
inline double ComputeLength(); // McZapkie-150503
|
||||
inline vector3 GetDirection1() { return bCurve ? CPointOut - Point1 : CPointOut; };
|
||||
inline vector3 GetDirection2() { return bCurve ? CPointIn - Point2 : CPointIn; };
|
||||
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 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 vector3 FastGetPoint_0()
|
||||
{
|
||||
return Point1;
|
||||
};
|
||||
inline vector3 FastGetPoint_1()
|
||||
{
|
||||
return Point2;
|
||||
};
|
||||
inline double GetRoll(double s)
|
||||
{
|
||||
s /= fLength;
|
||||
@@ -103,14 +117,16 @@ class TSegment
|
||||
r1 = fRoll1;
|
||||
r2 = fRoll2;
|
||||
}
|
||||
void RenderLoft(const vector6 *ShapePoints, int iNumShapePoints,
|
||||
double fTextureLength, int iSkip = 0, int iQualityFactor = 1,
|
||||
vector3 **p = NULL, bool bRender = true);
|
||||
void RenderLoft(const vector6 *ShapePoints, int iNumShapePoints, double fTextureLength,
|
||||
int iSkip = 0, int iQualityFactor = 1, vector3 **p = NULL, bool bRender = true);
|
||||
void RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *ShapePoints2,
|
||||
int iNumShapePoints, double fTextureLength, int iSkip = 0,
|
||||
double fOffsetX = 0.0f);
|
||||
void Render();
|
||||
inline double GetLength() { return fLength; };
|
||||
inline double GetLength()
|
||||
{
|
||||
return fLength;
|
||||
};
|
||||
void MoveMe(vector3 pPosition)
|
||||
{
|
||||
Point1 += pPosition;
|
||||
@@ -121,14 +137,18 @@ class TSegment
|
||||
CPointOut += pPosition;
|
||||
}
|
||||
}
|
||||
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);
|
||||
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 RaAnimate(CVertNormTex *&Vert, const vector6 *ShapePoints, int iNumShapePoints,
|
||||
double fTextureLength, int iSkip = 0, int iEnd = 0,
|
||||
double fOffsetX = 0.0);
|
||||
void AngleSet(int i, double a) { fAngle[i] = a; };
|
||||
double fTextureLength, int iSkip = 0, int iEnd = 0, double fOffsetX = 0.0);
|
||||
void AngleSet(int i, double a)
|
||||
{
|
||||
fAngle[i] = a;
|
||||
};
|
||||
void Rollment(double w1, double w2); // poprawianie przechy³ki
|
||||
};
|
||||
|
||||
|
||||
@@ -171,7 +171,10 @@ LPDIRECTSOUNDBUFFER TSoundContainer::GetUnique(LPDIRECTSOUND pDS)
|
||||
return DSBuffers.top();
|
||||
};
|
||||
|
||||
TSoundsManager::~TSoundsManager() { Free(); };
|
||||
TSoundsManager::~TSoundsManager()
|
||||
{
|
||||
Free();
|
||||
};
|
||||
|
||||
void TSoundsManager::Free()
|
||||
{
|
||||
@@ -200,8 +203,7 @@ void TSoundsManager::LoadSounds(char *Directory)
|
||||
FindClose(handle);
|
||||
};
|
||||
|
||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic,
|
||||
float *fSamplingRate)
|
||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic, float *fSamplingRate)
|
||||
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
|
||||
AnsiString file;
|
||||
if (Dynamic)
|
||||
|
||||
6
Sound.h
6
Sound.h
@@ -39,8 +39,7 @@ class TSoundContainer
|
||||
TSoundContainer *Next;
|
||||
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
|
||||
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
|
||||
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName,
|
||||
int NConcurrent);
|
||||
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName, int NConcurrent);
|
||||
~TSoundContainer();
|
||||
};
|
||||
|
||||
@@ -62,8 +61,7 @@ class 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 LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic, float *fSamplingRate = NULL);
|
||||
static void RestoreAll();
|
||||
};
|
||||
|
||||
|
||||
@@ -73,7 +73,9 @@ __fastcall TKnot::TKnot(int n)
|
||||
}
|
||||
}
|
||||
|
||||
__fastcall TKnot::~TKnot() {}
|
||||
__fastcall TKnot::~TKnot()
|
||||
{
|
||||
}
|
||||
|
||||
vector3 TKnot::GetDirection(float t)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,9 @@ TSpring::TSpring()
|
||||
restLen = 0;
|
||||
}
|
||||
|
||||
TSpring::~TSpring() {}
|
||||
TSpring::~TSpring()
|
||||
{
|
||||
}
|
||||
|
||||
void TSpring::Init(double nrestLen, double nKs, double nKd)
|
||||
{
|
||||
@@ -72,7 +74,9 @@ bool TSpring::ComputateForces(vector3 pPosition1, vector3 pPosition2)
|
||||
return true;
|
||||
}
|
||||
|
||||
void TSpring::Render() {}
|
||||
void TSpring::Render()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -89,7 +89,10 @@ TTexturesManager::Names::iterator TTexturesManager::LoadFromFile(std::string fil
|
||||
|
||||
struct ReplaceSlash
|
||||
{
|
||||
const char operator()(const char input) { return input == '/' ? '\\' : input; }
|
||||
const char operator()(const char input)
|
||||
{
|
||||
return input == '/' ? '\\' : input;
|
||||
}
|
||||
};
|
||||
|
||||
GLuint TTexturesManager::GetTextureID(char *dir, char *where, std::string fileName, int filter)
|
||||
|
||||
33
Timer.cpp
33
Timer.cpp
@@ -25,7 +25,10 @@ double fSimulationTime = 0;
|
||||
double fSoundTimer = 0;
|
||||
double fSinceStart = 0;
|
||||
|
||||
double GetTime() { return fSimulationTime; }
|
||||
double GetTime()
|
||||
{
|
||||
return fSimulationTime;
|
||||
}
|
||||
|
||||
double GetDeltaTime()
|
||||
{ // czas symulacji (stoi gdy pauza)
|
||||
@@ -37,19 +40,35 @@ double GetDeltaRenderTime()
|
||||
return DeltaRenderTime;
|
||||
}
|
||||
|
||||
double GetfSinceStart() { return fSinceStart; }
|
||||
double GetfSinceStart()
|
||||
{
|
||||
return fSinceStart;
|
||||
}
|
||||
|
||||
void SetDeltaTime(double t) { DeltaTime = t; }
|
||||
void SetDeltaTime(double t)
|
||||
{
|
||||
DeltaTime = t;
|
||||
}
|
||||
|
||||
double GetSimulationTime() { return fSimulationTime; }
|
||||
double GetSimulationTime()
|
||||
{
|
||||
return fSimulationTime;
|
||||
}
|
||||
|
||||
void SetSimulationTime(double t) { fSimulationTime = t; }
|
||||
void SetSimulationTime(double t)
|
||||
{
|
||||
fSimulationTime = t;
|
||||
}
|
||||
|
||||
bool GetSoundTimer()
|
||||
{ // Ra: byæ mo¿e, by dŸwiêki nie modyfikowa³y siê zbyt czêsto, po 0.1s zeruje siê ten licznik
|
||||
return (fSoundTimer == 0.0f); }
|
||||
return (fSoundTimer == 0.0f);
|
||||
}
|
||||
|
||||
double GetFPS() { return fFPS; }
|
||||
double GetFPS()
|
||||
{
|
||||
return fFPS;
|
||||
}
|
||||
|
||||
void ResetTimers()
|
||||
{
|
||||
|
||||
@@ -68,8 +68,8 @@ TSwitchExtension::TSwitchExtension(TTrack *owner, int what)
|
||||
Segments[2] = (what >= 3) ?
|
||||
new TSegment(owner) :
|
||||
NULL; // z punktu 2 do 4 skrzyżowanie od góry: wersja "-1":
|
||||
Segments[3] = (what >= 4) ? new TSegment(owner) :
|
||||
NULL; // z punktu 4 do 1 1 1=4 0 0=3
|
||||
Segments[3] =
|
||||
(what >= 4) ? new TSegment(owner) : NULL; // z punktu 4 do 1 1 1=4 0 0=3
|
||||
Segments[4] =
|
||||
(what >= 5) ? new TSegment(owner) : NULL; // z punktu 1 do 3 4 x 3 3 3 x 2 2
|
||||
Segments[5] = (what >= 6) ? new TSegment(owner) :
|
||||
@@ -102,7 +102,8 @@ TIsolated::TIsolated(const AnsiString &n, TIsolated *i)
|
||||
pMemCell = NULL; // podpiąć istniejącą albo utworzyć pustą
|
||||
};
|
||||
|
||||
TIsolated::~TIsolated(){// usuwanie
|
||||
TIsolated::~TIsolated(){
|
||||
// usuwanie
|
||||
/*
|
||||
TIsolated *p=pRoot;
|
||||
while (pRoot)
|
||||
|
||||
45
Track.h
45
Track.h
@@ -111,9 +111,18 @@ class TIsolated
|
||||
static TIsolated *__fastcall Find(
|
||||
const AnsiString &n); // znalezienie obiektu albo utworzenie nowego
|
||||
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); };
|
||||
bool Busy()
|
||||
{
|
||||
return (iAxles > 0);
|
||||
};
|
||||
static TIsolated *__fastcall Root()
|
||||
{
|
||||
return (pRoot);
|
||||
};
|
||||
TIsolated *__fastcall Next()
|
||||
{
|
||||
return (pNext);
|
||||
};
|
||||
};
|
||||
|
||||
class TTrack : public Resource
|
||||
@@ -185,15 +194,30 @@ class TTrack : public Resource
|
||||
void Init();
|
||||
static TTrack *__fastcall Create400m(int what, double dx);
|
||||
TTrack *__fastcall NullCreate(int dir);
|
||||
inline bool IsEmpty() { return (iNumDynamics <= 0); };
|
||||
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); };
|
||||
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 SetConnections(int i);
|
||||
bool Switch(int i, double t = -1.0, double d = -1.0);
|
||||
@@ -244,7 +268,10 @@ class TTrack : public Resource
|
||||
AnsiString IsolatedName();
|
||||
bool IsolatedEventsAssign(TEvent *busy, TEvent *free);
|
||||
double WidthTotal();
|
||||
GLuint TextureGet(int i) { return i ? TextureID1 : TextureID2; };
|
||||
GLuint TextureGet(int i)
|
||||
{
|
||||
return i ? TextureID1 : TextureID2;
|
||||
};
|
||||
bool IsGroupable();
|
||||
int TestPoint(vector3 *Point);
|
||||
void MovedUp1(double dh);
|
||||
|
||||
@@ -86,13 +86,15 @@ bool TTractionPowerSource::Load(cParser *parser)
|
||||
Error("tractionpowersource end statement missing");
|
||||
// if (!bSection) //od³¹cznik sekcji zasadniczo nie ma impedancji (0.01 jest OK)
|
||||
if (InternalRes < 0.1) // coœ ma³a ta rezystancja by³a...
|
||||
InternalRes =
|
||||
0.2; // tak oko³o 0.2, wg
|
||||
InternalRes = 0.2; // tak oko³o 0.2, wg
|
||||
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
||||
return true;
|
||||
};
|
||||
|
||||
bool TTractionPowerSource::Render() { return true; };
|
||||
bool TTractionPowerSource::Render()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
bool TTractionPowerSource::Update(double dt)
|
||||
{ // powinno byæ wykonane raz na krok fizyki
|
||||
|
||||
@@ -48,7 +48,10 @@ class TTractionPowerSource
|
||||
bool Render();
|
||||
bool Update(double dt);
|
||||
double CurrentGet(double res);
|
||||
void VoltageSet(double v) { NominalVoltage = v; };
|
||||
void VoltageSet(double v)
|
||||
{
|
||||
NominalVoltage = v;
|
||||
};
|
||||
void PowerSet(TTractionPowerSource *ps);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ TCab::TCab()
|
||||
iButtons = 0;
|
||||
}
|
||||
|
||||
void TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2,
|
||||
double Inity2, double Initz2, bool InitEnabled, bool InitOccupied)
|
||||
void TCab::Init(double Initx1, double Inity1, double Initz1, double Initx2, double Inity2,
|
||||
double Initz2, bool InitEnabled, bool InitOccupied)
|
||||
{
|
||||
CabPos1.x = Initx1;
|
||||
CabPos1.y = Inity1;
|
||||
|
||||
25
Train.h
25
Train.h
@@ -83,8 +83,14 @@ class TTrain
|
||||
|
||||
// bool SHP() { fShpTimer= 0; };
|
||||
|
||||
inline vector3 GetDirection() { return DynamicObject->VectorFront(); };
|
||||
inline vector3 GetUp() { return DynamicObject->VectorUp(); };
|
||||
inline vector3 GetDirection()
|
||||
{
|
||||
return DynamicObject->VectorFront();
|
||||
};
|
||||
inline vector3 GetUp()
|
||||
{
|
||||
return DynamicObject->VectorUp();
|
||||
};
|
||||
void UpdateMechPosition(double dt);
|
||||
bool Update();
|
||||
void MechStop();
|
||||
@@ -373,9 +379,18 @@ class TTrain
|
||||
int iSekunda; // Ra: sekunda aktualizacji pr璠ko𦣇i
|
||||
int iRadioChannel; // numer aktualnego kana逝 radiowego
|
||||
public:
|
||||
int RadioChannel() { return iRadioChannel; };
|
||||
inline TDynamicObject *__fastcall Dynamic() { return DynamicObject; };
|
||||
inline TMoverParameters *__fastcall Controlled() { return mvControlled; };
|
||||
int RadioChannel()
|
||||
{
|
||||
return iRadioChannel;
|
||||
};
|
||||
inline TDynamicObject *__fastcall Dynamic()
|
||||
{
|
||||
return DynamicObject;
|
||||
};
|
||||
inline TMoverParameters *__fastcall Controlled()
|
||||
{
|
||||
return mvControlled;
|
||||
};
|
||||
void DynamicSet(TDynamicObject *d);
|
||||
void Silence();
|
||||
};
|
||||
|
||||
@@ -37,7 +37,9 @@ TTrackFollower::TTrackFollower()
|
||||
fOffsetH = 0.0; // na starcie stoi na środku
|
||||
}
|
||||
|
||||
TTrackFollower::~TTrackFollower() {}
|
||||
TTrackFollower::~TTrackFollower()
|
||||
{
|
||||
}
|
||||
|
||||
bool TTrackFollower::Init(TTrack *pTrack, TDynamicObject *NewOwner, double fDir)
|
||||
{
|
||||
|
||||
15
TrkFoll.h
15
TrkFoll.h
@@ -35,14 +35,23 @@ class TTrackFollower
|
||||
~TTrackFollower();
|
||||
TTrack *__fastcall SetCurrentTrack(TTrack *pTrack, int end);
|
||||
bool Move(double fDistance, bool bPrimary);
|
||||
inline TTrack *__fastcall GetTrack() { return pCurrentTrack; };
|
||||
inline TTrack *__fastcall GetTrack()
|
||||
{
|
||||
return pCurrentTrack;
|
||||
};
|
||||
inline double GetRoll()
|
||||
{
|
||||
return vAngles.x;
|
||||
}; // przechy³ka policzona przy ustalaniu pozycji
|
||||
//{return pCurrentSegment->GetRoll(fCurrentDistance)*fDirection;}; //zamiast liczyæ mo¿na pobraæ
|
||||
inline double GetDirection() { return fDirection; }; // zwrot na torze
|
||||
inline double GetTranslation() { return fCurrentDistance; }; // ABu-030403
|
||||
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 GetRadius(double L, double d); //McZapkie-150503
|
||||
|
||||
@@ -404,7 +404,8 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Mode
|
||||
WriteLog("glFogfv(GL_FOG_COLOR, FogColor);");
|
||||
glFogfv(GL_FOG_COLOR, FogColor); // Set Fog Color
|
||||
// glFogf(GL_FOG_DENSITY, 0.594f); // How Dense Will The Fog
|
||||
// glFogf(GL_FOG_DENSITY, 0.594f); // How Dense Will The
|
||||
//Fog
|
||||
// Be
|
||||
// glHint(GL_FOG_HINT, GL_NICEST); // Fog Hint Value
|
||||
WriteLog("glFogf(GL_FOG_START, 1000.0f);");
|
||||
@@ -2430,8 +2431,7 @@ bool TWorld::Update()
|
||||
glColor3f(0.0f, 1.0f, 0.0f); // zielone
|
||||
glRasterPos2f(
|
||||
-0.25f,
|
||||
0.18f -
|
||||
0.02f * (i - tmp->Mechanik->iStationStart)); // dopiero
|
||||
0.18f - 0.02f * (i - tmp->Mechanik->iStationStart)); // dopiero
|
||||
// ustawienie
|
||||
// pozycji
|
||||
// ustala
|
||||
|
||||
@@ -49,7 +49,10 @@ void inline vector3::SafeNormalize()
|
||||
}
|
||||
|
||||
// From code in Graphics Gems; p. 766
|
||||
inline scalar_t det2x2(scalar_t a, scalar_t b, scalar_t c, scalar_t d) { return a * d - b * c; }
|
||||
inline scalar_t det2x2(scalar_t a, scalar_t b, scalar_t c, scalar_t d)
|
||||
{
|
||||
return a * d - b * c;
|
||||
}
|
||||
|
||||
inline scalar_t det3x3(scalar_t a1, scalar_t a2, scalar_t a3, scalar_t b1, scalar_t b2, scalar_t b3,
|
||||
scalar_t c1, scalar_t c2, scalar_t c3)
|
||||
@@ -390,7 +393,8 @@ int main(int, char *[])
|
||||
Testmatrix4x4();
|
||||
matrixFailures = failures;
|
||||
|
||||
cout << endl << "****************************************" << endl;
|
||||
cout << endl
|
||||
<< "****************************************" << endl;
|
||||
cout << "* *" << endl;
|
||||
if (vectorFailures + matrixFailures == 0)
|
||||
cout << "* No failures detected in Math3D *" << endl;
|
||||
|
||||
102
dumb3d.h
102
dumb3d.h
@@ -27,15 +27,26 @@ namespace Math3D
|
||||
typedef double scalar_t;
|
||||
// inline pass-throughs to various basic math functions
|
||||
// written in this style to allow for easy substitution with more efficient versions
|
||||
inline scalar_t SINE_FUNCTION(scalar_t x) { return sin(x); }
|
||||
inline scalar_t COSINE_FUNCTION(scalar_t x) { return cos(x); }
|
||||
inline scalar_t SQRT_FUNCTION(scalar_t x) { return sqrt(x); }
|
||||
inline scalar_t SINE_FUNCTION(scalar_t x)
|
||||
{
|
||||
return sin(x);
|
||||
}
|
||||
inline scalar_t COSINE_FUNCTION(scalar_t x)
|
||||
{
|
||||
return cos(x);
|
||||
}
|
||||
inline scalar_t SQRT_FUNCTION(scalar_t x)
|
||||
{
|
||||
return sqrt(x);
|
||||
}
|
||||
|
||||
// 2 element vector
|
||||
class vector2
|
||||
{
|
||||
public:
|
||||
vector2(void) {}
|
||||
vector2(void)
|
||||
{
|
||||
}
|
||||
vector2(scalar_t a, scalar_t b)
|
||||
{
|
||||
x = a;
|
||||
@@ -52,7 +63,9 @@ class vector2
|
||||
class vector3
|
||||
{
|
||||
public:
|
||||
vector3(void) {}
|
||||
vector3(void)
|
||||
{
|
||||
}
|
||||
vector3(scalar_t a, scalar_t b, scalar_t c)
|
||||
{
|
||||
x = a;
|
||||
@@ -71,15 +84,24 @@ class vector3
|
||||
void inline Normalize();
|
||||
void inline SafeNormalize();
|
||||
double inline Length();
|
||||
void inline Zero() { x = y = z = 0.0; };
|
||||
void inline Zero()
|
||||
{
|
||||
x = y = z = 0.0;
|
||||
};
|
||||
|
||||
// [] is to read, () is to write (const correctness)
|
||||
// const scalar_t& operator[] (int i) const { return e[i]; }
|
||||
// scalar_t& operator() (int i) { return e[i]; }
|
||||
|
||||
// Provides access to the underlying array; useful for passing this class off to C APIs
|
||||
const scalar_t *readArray(void) { return &x; }
|
||||
scalar_t *getArray(void) { return &x; }
|
||||
const scalar_t *readArray(void)
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
scalar_t *getArray(void)
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
|
||||
// union
|
||||
// {
|
||||
@@ -107,7 +129,9 @@ class vector3
|
||||
class matrix4x4
|
||||
{
|
||||
public:
|
||||
matrix4x4(void) {}
|
||||
matrix4x4(void)
|
||||
{
|
||||
}
|
||||
|
||||
// When defining matrices in C arrays, it is easiest to define them with
|
||||
// the column increasing fastest. However, some APIs (OpenGL in particular) do this
|
||||
@@ -130,12 +154,24 @@ class matrix4x4
|
||||
|
||||
// [] is to read, () is to write (const correctness)
|
||||
// m[x][y] or m(x)[y] is the correct form
|
||||
const scalar_t *operator[](int i) const { return &e[i << 2]; }
|
||||
scalar_t *operator()(int i) { return &e[i << 2]; }
|
||||
const scalar_t *operator[](int i) const
|
||||
{
|
||||
return &e[i << 2];
|
||||
}
|
||||
scalar_t *operator()(int i)
|
||||
{
|
||||
return &e[i << 2];
|
||||
}
|
||||
|
||||
// Low-level access to the array.
|
||||
const scalar_t *readArray(void) { return e; }
|
||||
scalar_t *getArray(void) { return e; }
|
||||
const scalar_t *readArray(void)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
scalar_t *getArray(void)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
// Construct various matrices; REPLACES CURRENT CONTENTS OF THE MATRIX!
|
||||
// Written this way to work in-place and hence be somewhat more efficient
|
||||
@@ -263,14 +299,20 @@ inline bool operator<(const vector3 &v1, const vector3 &v2)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline vector3 operator-(const vector3 &v) { return vector3(-v.x, -v.y, -v.z); }
|
||||
inline vector3 operator-(const vector3 &v)
|
||||
{
|
||||
return vector3(-v.x, -v.y, -v.z);
|
||||
}
|
||||
|
||||
inline vector3 operator*(const vector3 &v, scalar_t k)
|
||||
{
|
||||
return vector3(k * v.x, k * v.y, k * v.z);
|
||||
}
|
||||
|
||||
inline vector3 operator*(scalar_t k, const vector3 &v) { return v * k; }
|
||||
inline vector3 operator*(scalar_t k, const vector3 &v)
|
||||
{
|
||||
return v * k;
|
||||
}
|
||||
|
||||
inline vector3 &operator*=(vector3 &v, scalar_t k)
|
||||
{
|
||||
@@ -293,11 +335,23 @@ inline vector3 &operator/=(vector3 &v, scalar_t k)
|
||||
return v;
|
||||
}
|
||||
|
||||
inline scalar_t LengthSquared3(const vector3 &v) { return DotProduct(v, v); }
|
||||
inline scalar_t LengthSquared4(const vector3 &v) { return DotProduct4(v, v); }
|
||||
inline scalar_t LengthSquared3(const vector3 &v)
|
||||
{
|
||||
return DotProduct(v, v);
|
||||
}
|
||||
inline scalar_t LengthSquared4(const vector3 &v)
|
||||
{
|
||||
return DotProduct4(v, v);
|
||||
}
|
||||
|
||||
inline scalar_t Length3(const vector3 &v) { return SQRT_FUNCTION(LengthSquared3(v)); }
|
||||
inline scalar_t Length4(const vector3 &v) { return SQRT_FUNCTION(LengthSquared4(v)); }
|
||||
inline scalar_t Length3(const vector3 &v)
|
||||
{
|
||||
return SQRT_FUNCTION(LengthSquared3(v));
|
||||
}
|
||||
inline scalar_t Length4(const vector3 &v)
|
||||
{
|
||||
return SQRT_FUNCTION(LengthSquared4(v));
|
||||
}
|
||||
|
||||
inline vector3 Normalize(const vector3 &v)
|
||||
{
|
||||
@@ -314,7 +368,10 @@ inline vector3 SafeNormalize(const vector3 &v)
|
||||
retVal = v / l;
|
||||
return retVal;
|
||||
}
|
||||
inline vector3 Normalize4(const vector3 &v) { return v / Length4(v); }
|
||||
inline vector3 Normalize4(const vector3 &v)
|
||||
{
|
||||
return v / Length4(v);
|
||||
}
|
||||
|
||||
inline vector3 operator+(const vector3 &v1, const vector3 &v2)
|
||||
{
|
||||
@@ -372,7 +429,10 @@ void inline vector3::Normalize()
|
||||
z *= il;
|
||||
}
|
||||
|
||||
double inline vector3::Length() { return SQRT_FUNCTION(x * x + y * y + z * z); }
|
||||
double inline vector3::Length()
|
||||
{
|
||||
return SQRT_FUNCTION(x * x + y * y + z * z);
|
||||
}
|
||||
|
||||
inline bool operator==(const matrix4x4 &m1, const matrix4x4 &m2)
|
||||
{
|
||||
|
||||
25
geometry.cpp
25
geometry.cpp
@@ -11,7 +11,10 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "Geometry.h"
|
||||
|
||||
inline double sqr(double a) { return (a * a); };
|
||||
inline double sqr(double a)
|
||||
{
|
||||
return (a * a);
|
||||
};
|
||||
|
||||
__fastcall TLine::TLine(){};
|
||||
|
||||
@@ -23,7 +26,10 @@ __fastcall TLine::TLine(vector3 NPoint, vector3 NVector)
|
||||
|
||||
__fastcall TLine::~TLine(){};
|
||||
|
||||
TPlane TLine::GetPlane() { return (TPlane(Point, Vector)); };
|
||||
TPlane TLine::GetPlane()
|
||||
{
|
||||
return (TPlane(Point, Vector));
|
||||
};
|
||||
|
||||
double TLine::GetDistance(vector3 Point1)
|
||||
{
|
||||
@@ -80,11 +86,17 @@ double TPlane::GetSide(vector3 Point)
|
||||
// D3DMath_VectorMatrixMultiply(Vector,src,Transformations);
|
||||
//};
|
||||
|
||||
bool TPlane::Defined() { return !(Vector == vector3(0, 0, 0)); };
|
||||
bool TPlane::Defined()
|
||||
{
|
||||
return !(Vector == vector3(0, 0, 0));
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline double Sum(vector3 &Vector) { return (Vector.x + Vector.y + Vector.z); };
|
||||
inline double Sum(vector3 &Vector)
|
||||
{
|
||||
return (Vector.x + Vector.y + Vector.z);
|
||||
};
|
||||
|
||||
bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||
{
|
||||
@@ -96,7 +108,10 @@ bool CrossPoint(vector3 &RetPoint, TLine &Line, TPlane &Plane)
|
||||
return (true);
|
||||
};
|
||||
|
||||
inline double GetLength(vector3 &Vector) { return (Vector.Length()); };
|
||||
inline double GetLength(vector3 &Vector)
|
||||
{
|
||||
return (Vector.Length());
|
||||
};
|
||||
|
||||
inline vector3 SetLength(vector3 &Vector, double Length)
|
||||
{
|
||||
|
||||
20
parser.h
20
parser.h
@@ -42,15 +42,27 @@ class cParser : public std::stringstream
|
||||
getTokens();
|
||||
*this >> output;
|
||||
};
|
||||
inline void ignoreToken() { readToken(); };
|
||||
inline void ignoreToken()
|
||||
{
|
||||
readToken();
|
||||
};
|
||||
inline void ignoreTokens(int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
readToken();
|
||||
};
|
||||
inline bool expectToken(std::string value) { return readToken() == value; };
|
||||
bool eof() { return mStream->eof(); };
|
||||
bool ok() { return !mStream->fail(); };
|
||||
inline bool expectToken(std::string value)
|
||||
{
|
||||
return readToken() == value;
|
||||
};
|
||||
bool eof()
|
||||
{
|
||||
return mStream->eof();
|
||||
};
|
||||
bool ok()
|
||||
{
|
||||
return !mStream->fail();
|
||||
};
|
||||
bool getTokens(int Count = 1, bool ToLower = true, const char *Break = "\n\t ;");
|
||||
int getProgress() const; // percentage of file processed.
|
||||
// load traction?
|
||||
|
||||
10
wavread.cpp
10
wavread.cpp
@@ -216,7 +216,10 @@ HRESULT WaveReadFile(HMMIO hmmioIn, UINT cbRead, BYTE *pbDest, MMCKINFO *pckIn,
|
||||
// Name: CWaveSoundRead()
|
||||
// Desc: Constructs the class
|
||||
//-----------------------------------------------------------------------------
|
||||
CWaveSoundRead::CWaveSoundRead() { m_pwfx = NULL; }
|
||||
CWaveSoundRead::CWaveSoundRead()
|
||||
{
|
||||
m_pwfx = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: ~CWaveSoundRead()
|
||||
@@ -252,7 +255,10 @@ HRESULT CWaveSoundRead::Open(CHAR *strFilename)
|
||||
// Desc: Resets the internal m_ckIn pointer so reading starts from the
|
||||
// beginning of the file again
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveSoundRead::Reset() { return WaveStartDataRead(&m_hmmioIn, &m_ckIn, &m_ckInRiff); }
|
||||
HRESULT CWaveSoundRead::Reset()
|
||||
{
|
||||
return WaveStartDataRead(&m_hmmioIn, &m_ckIn, &m_ckInRiff);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Read()
|
||||
|
||||
Reference in New Issue
Block a user