Format source code using clang-format

This commit is contained in:
Zbigniew Mandziejewicz
2015-04-03 22:00:22 +08:00
parent 91470458b4
commit cb19354db4
99 changed files with 40728 additions and 36059 deletions

View File

@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------
#include "system.hpp"
#include "classes.hpp"
#include "system.hpp"
#include "classes.hpp"
#pragma hdrstop
#include "Timer.h"
@@ -11,171 +11,166 @@
__fastcall TAdvancedSound::TAdvancedSound()
{
// SoundStart=SoundCommencing=SoundShut= NULL;
State=ss_Off;
fTime=0;
fStartLength=0;
fShutLength=0;
// SoundStart=SoundCommencing=SoundShut= NULL;
State = ss_Off;
fTime = 0;
fStartLength = 0;
fShutLength = 0;
}
__fastcall TAdvancedSound::~TAdvancedSound()
{//Ra: stopowanie siê sypie
//SoundStart.Stop();
//SoundCommencing.Stop();
//SoundShut.Stop();
{ // Ra: stopowanie siê sypie
// SoundStart.Stop();
// SoundCommencing.Stop();
// SoundShut.Stop();
}
void __fastcall TAdvancedSound::Free()
{
}
void __fastcall TAdvancedSound::Free() {}
void __fastcall TAdvancedSound::Init(char *NameOn, char *Name, char *NameOff, double DistanceAttenuation, vector3 pPosition)
void __fastcall 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);
SoundShut.Init(NameOff,DistanceAttenuation,pPosition.x,pPosition.y,pPosition.z,true);
fStartLength=SoundStart.GetWaveTime();
fShutLength=SoundShut.GetWaveTime();
SoundStart.AM=1.0;
SoundStart.AA=0.0;
SoundStart.FM=1.0;
SoundStart.FA=0.0;
SoundCommencing.AM=1.0;
SoundCommencing.AA=0.0;
SoundCommencing.FM=1.0;
SoundCommencing.FA=0.0;
defAM=1.0;
defFM=1.0;
SoundShut.AM=1.0;
SoundShut.AA=0.0;
SoundShut.FM=1.0;
SoundShut.FA=0.0;
SoundStart.Init(NameOn, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
SoundCommencing.Init(Name, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
SoundShut.Init(NameOff, DistanceAttenuation, pPosition.x, pPosition.y, pPosition.z, true);
fStartLength = SoundStart.GetWaveTime();
fShutLength = SoundShut.GetWaveTime();
SoundStart.AM = 1.0;
SoundStart.AA = 0.0;
SoundStart.FM = 1.0;
SoundStart.FA = 0.0;
SoundCommencing.AM = 1.0;
SoundCommencing.AA = 0.0;
SoundCommencing.FM = 1.0;
SoundCommencing.FA = 0.0;
defAM = 1.0;
defFM = 1.0;
SoundShut.AM = 1.0;
SoundShut.AA = 0.0;
SoundShut.FM = 1.0;
SoundShut.FA = 0.0;
}
void __fastcall TAdvancedSound::Load(TQueryParserComp *Parser, vector3 pPosition)
{
AnsiString NameOn= Parser->GetNextSymbol().LowerCase();
AnsiString Name= Parser->GetNextSymbol().LowerCase();
AnsiString NameOff= Parser->GetNextSymbol().LowerCase();
double DistanceAttenuation= Parser->GetNextSymbol().ToDouble();
Init(NameOn.c_str(),Name.c_str(),NameOff.c_str(),DistanceAttenuation,pPosition);
AnsiString NameOn = Parser->GetNextSymbol().LowerCase();
AnsiString Name = Parser->GetNextSymbol().LowerCase();
AnsiString NameOff = Parser->GetNextSymbol().LowerCase();
double DistanceAttenuation = Parser->GetNextSymbol().ToDouble();
Init(NameOn.c_str(), Name.c_str(), NameOff.c_str(), DistanceAttenuation, pPosition);
}
void __fastcall TAdvancedSound::TurnOn(bool ListenerInside, vector3 NewPosition)
{
//hunter-311211: nie trzeba czekac na ponowne odtworzenie dzwieku, az sie wylaczy
if ((State==ss_Off || State==ss_ShuttingDown) && (SoundStart.AM>0))
// hunter-311211: nie trzeba czekac na ponowne odtworzenie dzwieku, az sie wylaczy
if ((State == ss_Off || State == ss_ShuttingDown) && (SoundStart.AM > 0))
{
SoundStart.ResetPosition();
SoundCommencing.ResetPosition();
SoundStart.Play(1,0,ListenerInside,NewPosition);
// SoundStart->SetVolume(-10000);
State= ss_Starting;
fTime= 0;
SoundStart.Play(1, 0, ListenerInside, NewPosition);
// SoundStart->SetVolume(-10000);
State = ss_Starting;
fTime = 0;
}
}
void __fastcall TAdvancedSound::TurnOff(bool ListenerInside, vector3 NewPosition)
{
if ((State==ss_Commencing || State==ss_Starting) && (SoundShut.AM>0))
if ((State == ss_Commencing || State == ss_Starting) && (SoundShut.AM > 0))
{
SoundStart.Stop();
SoundCommencing.Stop();
SoundShut.ResetPosition();
SoundShut.Play(1,0,ListenerInside,NewPosition);
State= ss_ShuttingDown;
fTime= fShutLength;
// SoundShut->SetVolume(0);
SoundShut.Play(1, 0, ListenerInside, NewPosition);
State = ss_ShuttingDown;
fTime = fShutLength;
// SoundShut->SetVolume(0);
}
}
void __fastcall TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
{
if ((State==ss_Commencing) && (SoundCommencing.AM>0))
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
{
// SoundCommencing->SetFrequency();
SoundShut.Stop(); //hunter-311211
SoundCommencing.Play(1,DSBPLAY_LOOPING,ListenerInside,NewPosition);
// SoundCommencing->SetFrequency();
SoundShut.Stop(); // hunter-311211
SoundCommencing.Play(1, DSBPLAY_LOOPING, ListenerInside, NewPosition);
}
else
if (State==ss_Starting)
else if (State == ss_Starting)
{
fTime+= Timer::GetDeltaTime();
// SoundStart->SetVolume(-1000*(4-fTime)/4);
if (fTime>=fStartLength)
fTime += Timer::GetDeltaTime();
// SoundStart->SetVolume(-1000*(4-fTime)/4);
if (fTime >= fStartLength)
{
State= ss_Commencing;
State = ss_Commencing;
SoundCommencing.ResetPosition();
SoundCommencing.Play(1,DSBPLAY_LOOPING,ListenerInside,NewPosition);
SoundCommencing.Play(1, DSBPLAY_LOOPING, ListenerInside, NewPosition);
SoundStart.Stop();
}
else
SoundStart.Play(1,0,ListenerInside,NewPosition);
SoundStart.Play(1, 0, ListenerInside, NewPosition);
}
else
if (State==ss_ShuttingDown)
else if (State == ss_ShuttingDown)
{
fTime-= Timer::GetDeltaTime();
// SoundShut->SetVolume(-1000*(4-fTime)/4);
if (fTime<=0)
fTime -= Timer::GetDeltaTime();
// SoundShut->SetVolume(-1000*(4-fTime)/4);
if (fTime <= 0)
{
State= ss_Off;
State = ss_Off;
SoundShut.Stop();
}
else
SoundShut.Play(1,0,ListenerInside,NewPosition);
SoundShut.Play(1, 0, ListenerInside, NewPosition);
}
}
void __fastcall TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition)
{ //update, ale z amplituda i czestotliwoscia
if ((State==ss_Commencing) && (SoundCommencing.AM>0))
void __fastcall TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside,
vector3 NewPosition)
{ // update, ale z amplituda i czestotliwoscia
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
{
SoundShut.Stop(); //hunter-311211
SoundCommencing.Play(A,DSBPLAY_LOOPING,ListenerInside,NewPosition);
SoundShut.Stop(); // hunter-311211
SoundCommencing.Play(A, DSBPLAY_LOOPING, ListenerInside, NewPosition);
}
else
if (State==ss_Starting)
else if (State == ss_Starting)
{
fTime+= Timer::GetDeltaTime();
// SoundStart->SetVolume(-1000*(4-fTime)/4);
if (fTime>=fStartLength)
fTime += Timer::GetDeltaTime();
// SoundStart->SetVolume(-1000*(4-fTime)/4);
if (fTime >= fStartLength)
{
State= ss_Commencing;
State = ss_Commencing;
SoundCommencing.ResetPosition();
SoundCommencing.Play(A,DSBPLAY_LOOPING,ListenerInside,NewPosition);
SoundCommencing.Play(A, DSBPLAY_LOOPING, ListenerInside, NewPosition);
SoundStart.Stop();
}
else
SoundStart.Play(A,0,ListenerInside,NewPosition);
SoundStart.Play(A, 0, ListenerInside, NewPosition);
}
else
if (State==ss_ShuttingDown)
else if (State == ss_ShuttingDown)
{
fTime-= Timer::GetDeltaTime();
// SoundShut->SetVolume(-1000*(4-fTime)/4);
if (fTime<=0)
fTime -= Timer::GetDeltaTime();
// SoundShut->SetVolume(-1000*(4-fTime)/4);
if (fTime <= 0)
{
State= ss_Off;
State = ss_Off;
SoundShut.Stop();
}
else
SoundShut.Play(A,0,ListenerInside,NewPosition);
SoundShut.Play(A, 0, ListenerInside, NewPosition);
}
SoundCommencing.AdjFreq(F,Timer::GetDeltaTime());
SoundCommencing.AdjFreq(F, Timer::GetDeltaTime());
}
void __fastcall TAdvancedSound::CopyIfEmpty(TAdvancedSound &s)
{//skopiowanie, gdyby by³ potrzebny, a nie zosta³ wczytany
if ((fStartLength>0.0)||(fShutLength>0.0)) return; //coœ jest
SoundStart=s.SoundStart;
SoundCommencing=s.SoundCommencing;
SoundShut=s.SoundShut;
State=s.State;
fStartLength=s.fStartLength;
fShutLength=s.fShutLength;
defAM=s.defAM;
defFM=s.defFM;
{ // skopiowanie, gdyby by³ potrzebny, a nie zosta³ wczytany
if ((fStartLength > 0.0) || (fShutLength > 0.0))
return; // coœ jest
SoundStart = s.SoundStart;
SoundCommencing = s.SoundCommencing;
SoundShut = s.SoundShut;
State = s.State;
fStartLength = s.fStartLength;
fShutLength = s.fShutLength;
defAM = s.defAM;
defFM = s.defFM;
};