Skip to content

Commit

Permalink
Change clang format
Browse files Browse the repository at this point in the history
Add AlignTrailingComments: false
Add AllowShortFunctionsOnASingleLine: Empty
  • Loading branch information
firleju committed Apr 29, 2015
1 parent ef4e168 commit cd571c7
Show file tree
Hide file tree
Showing 71 changed files with 1,580 additions and 1,106 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 6 additions & 5 deletions AdvSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion AdvSound.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TAdvancedSound
TAdvancedSound();
~TAdvancedSound();
void Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation,
vector3 pPosition);
vector3 pPosition);
void Load(TQueryParserComp *Parser, vector3 pPosition);
void TurnOn(bool ListenerInside, vector3 NewPosition);
void TurnOff(bool ListenerInside, vector3 NewPosition);
Expand Down
9 changes: 7 additions & 2 deletions AirCoupler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ obtain one at
#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
Expand Down
28 changes: 15 additions & 13 deletions AnimModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void TAnimContainer::SetRotateAnim(vector3 vNewRotateAngles, double fNewRotateSp
*/
if (evDone)
{ // dołączyć model do listy aniomowania, żeby animacje były przeliczane również bez
// wyświetlania
// wyświetlania
if (iAnim >= 0)
{ // jeśli nie jest jeszcze na liście animacyjnej
acAnimNext = TAnimModel::acAnimList; // pozostałe doklić sobie jako ogon
Expand All @@ -138,7 +138,7 @@ void TAnimContainer::SetTranslateAnim(vector3 vNewTranslate, double fNewSpeed)
*/
if (evDone)
{ // dołączyć model do listy aniomowania, żeby animacje były przeliczane również bez
// wyświetlania
// wyświetlania
if (iAnim >= 0)
{ // jeśli nie jest jeszcze na liście animacyjnej
acAnimNext = TAnimModel::acAnimList; // pozostałe doklić sobie jako ogon
Expand Down Expand Up @@ -179,7 +179,7 @@ void TAnimContainer::AnimSetVMD(double fNewSpeed)
//-+-+ - dłoń ma w górze zamiast na pasie w pozycji początkowej
//+--+ - głowa do tyłu (broda w górę) w pozycji początkowej
//--++ - pozycja początkowa dobra, trąca u góry, ale z rękami jakoś nie tak, kółko w
//przeciwną stronę
// przeciwną stronę
//++++ - kładzie się brzuchem do góry
//-+++ - ręce w górze na początku, zamiast w dół, łokieć jakby w przeciwną stronę
//+-++ - nie podnosi ręki do głowy
Expand Down Expand Up @@ -223,7 +223,7 @@ void TAnimContainer::UpdateModel()
vTranslation += s;
else
vTranslation = vTranslateTo; // koniec animacji, "koniec animowania" uruchomi
// się w następnej klatce
// się w następnej klatce
}
else
{ // koniec animowania
Expand All @@ -233,7 +233,7 @@ void TAnimContainer::UpdateModel()
iAnim &= ~2; // wyłączyć zmianę pozycji submodelu
if (evDone)
Global::AddToQuery(evDone, NULL); // wykonanie eventu informującego o
// zakończeniu
// zakończeniu
}
}
if (fRotateSpeed != 0)
Expand Down Expand Up @@ -300,7 +300,7 @@ void TAnimContainer::UpdateModel()
fRotateSpeed = 0.0;
if (evDone)
Global::AddToQuery(evDone, NULL); // wykonanie eventu informującego o
// zakończeniu
// zakończeniu
}
}
if (fAngleSpeed != 0.0)
Expand Down Expand Up @@ -364,7 +364,7 @@ void TAnimContainer::UpdateModelIK()
{
case at_IK11: // stopa: ustawić w kierunku czubka (pierwszy potomny)
d = ch->Translation1Get(); // wektor względem aktualnego układu (nie uwzględnia
// obrotu)
// obrotu)
k = float3(RadToDeg(atan2(d.z, hypot(d.x, d.y))), 0.0,
-RadToDeg(atan2(d.y, d.x))); // proste skierowanie na punkt
pSubModel->SetRotateIK1(k);
Expand All @@ -378,7 +378,7 @@ void TAnimContainer::UpdateModelIK()
// potem wyliczyć ewentualne odchylenie w tej i następnej
// w sumie to proste, jak wyznaczenie kątów w trójkącie o znanej długości boków...
d = ch->Translation2Get(); // wektor względem aktualnego układu (nie uwzględnia
// obrotu)
// obrotu)
// if ()
{ // kość IK jest dalej niż pozycja spoczynkowa
k = float3(RadToDeg(atan2(d.z, hypot(d.x, d.y))), 0.0,
Expand Down Expand Up @@ -456,7 +456,7 @@ bool TAnimModel::Init(AnsiString asName, AnsiString asReplacableTexture)
0x31310031; // tekstura z kanałem alfa - nie renderować w cyklu nieprzezroczystych
else
iTexAlpha = 0x30300030; // tekstura nieprzezroczysta - nie renderować w cyklu
// przezroczystych
// przezroczystych
return (Init(TModelsManager::GetModel(asName.c_str())));
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -721,7 +723,7 @@ void TAnimModel::Advanced()
if (!strcmp(pCurrent->pMovementData->cBone,
(pCurrent->pMovementData + 1)->cBone))
{ // jak kolejna ramka dotyczy tego samego submodelu, ustawić animację do
// kolejnej ramki
// kolejnej ramki
++pCurrent->pMovementData; // kolejna klatka
pCurrent->AnimSetVMD(
pAdvanced->fFrequency /
Expand Down Expand Up @@ -773,7 +775,7 @@ void TAnimModel::AnimationVND(void *pData, double a, double b, double c, double
{
pSub->pMovementData = pAdvanced->pMovementData + i; // gotów do animowania
pSub->AnimSetVMD(0.0); // usuawienie pozycji początkowej (powinna być zerowa,
// inaczej będzie skok)
// inaczej będzie skok)
}
name = AnsiString(pAdvanced->pMovementData[i].cBone); // nowa nazwa do pomijania
}
Expand Down
19 changes: 14 additions & 5 deletions AnimModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ class TAnimContainer
public:
TAnimContainer *pNext;
TAnimContainer *acAnimNext; // lista animacji z eventem, które musz¹ byæ przeliczane równie¿ bez
// wyœwietlania
// wyœwietlania
TAnimContainer();
~TAnimContainer();
bool Init(TSubModel *pNewSubModel);
// std::string inline GetName() { return
// 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);
Expand All @@ -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);
Expand All @@ -101,7 +107,10 @@ class TAnimContainer
pSubModel->WillBeAnimated();
};
void EventAssign(TEvent *ev);
TEvent *__fastcall Event() { return evDone; };
TEvent *__fastcall Event()
{
return evDone;
};
};

class TAnimAdvanced
Expand Down Expand Up @@ -141,7 +150,7 @@ class TAnimModel
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
// równie¿ bez wyœwietlania
TAnimModel();
~TAnimModel();
bool Init(TModel3d *pNewModel);
Expand Down
10 changes: 8 additions & 2 deletions Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
};
Expand Down
2 changes: 1 addition & 1 deletion Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ vector3 TCamera::GetDirection()
bool TCamera::SetMatrix()
{
glRotated(-Roll * 180.0f / M_PI, 0, 0, 1); // po wy³¹czeniu tego krêci siê pojazd, a sceneria
// nie
// nie
glRotated(-Pitch * 180.0f / M_PI, 1, 0, 0);
glRotated(-Yaw * 180.0f / M_PI, 0, 1, 0); // w zewnêtrznym widoku: kierunek patrzenia

Expand Down
5 changes: 4 additions & 1 deletion Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 12 additions & 3 deletions Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
};
5 changes: 4 additions & 1 deletion Console/LPT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions Console/PoKeys55.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ TPoKeys55::TPoKeys55()
bNoError = true;
};
//---------------------------------------------------------------------------
TPoKeys55::~TPoKeys55() { Close(); };
TPoKeys55::~TPoKeys55()
{
Close();
};
//---------------------------------------------------------------------------
bool TPoKeys55::Close()
{ // roz³¹czenie komunikacji
Expand Down Expand Up @@ -86,7 +89,7 @@ bool TPoKeys55::Connect()
{
ErrorStatus = GetLastError();
if (ERROR_NO_MORE_ITEMS == ErrorStatus) // Did we reach the end of the list of matching
// devices in the DeviceInfoTable?
// devices in the DeviceInfoTable?
{ // Cound not find the device. Must not have been attached.
SetupDiDestroyDeviceInfoList(
DeviceInfoTable); // Clean up the old structure we no longer need.
Expand Down Expand Up @@ -138,7 +141,7 @@ bool TPoKeys55::Connect()
// free(PropertyValueBuffer); //No longer need the PropertyValueBuffer,free the memory to
// prevent potential memory leaks
delete PropertyValueBuffer; // No longer need the PropertyValueBuffer,free the memory to
// prevent potential memory leaks
// prevent potential memory leaks
// Convert both strings to lower case. This makes the code more robust/portable accross OS
// Versions
DeviceIDFromRegistry = DeviceIDFromRegistry.LowerCase();
Expand Down Expand Up @@ -202,12 +205,11 @@ 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
// USB bus. Always set=0.
// USB bus. Always set=0.
OutputBuffer[1] = 0xBB; // 0xBB - bajt rozpoznawczy dla PoKeys55
OutputBuffer[2] = iLastCommand = c; // operacja: 0x31: blokowy odczyt wejϾ
OutputBuffer[3] = b3; // np. numer pinu (o 1 mniej ni¿ numer na p³ytce)
Expand All @@ -233,7 +235,7 @@ bool TPoKeys55::Read()
{
DWORD BytesRead = 0;
InputBuffer[0] = 0; // The first byte is the "Report ID" and does not get transmitted over the
// USB bus. Always set=0.
// USB bus. Always set=0.
// Now get the response packet from the firmware.
// The following call to ReadFIle() retrieves 64 bytes of data from the USB device.
ReadFile(ReadHandle, &InputBuffer, 65, &BytesRead,
Expand Down Expand Up @@ -361,7 +363,7 @@ bool TPoKeys55::Update(bool pause)
if (!iRepeats)
bNoError = true; // jest OK
else if (iRepeats >= 10) // youBy 2014-07: przy 5 powtórzeniach sieje mi pauz¹ po 2 razy na
// sekundê, a przy 10 jest ok
// sekundê, a przy 10 jest ok
{ // przekroczenie liczby prób wymusza kolejn¹ fazê
++iFaza;
iRepeats = 1; // w nowej fazie nowe szanse, ale nie od 0!
Expand Down
3 changes: 1 addition & 2 deletions Console/PoKeys55.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit cd571c7

Please sign in to comment.