mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 05:29:17 +02:00
Format source code using clang-format
This commit is contained in:
@@ -5,101 +5,86 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "system.hpp"
|
||||
#include "classes.hpp"
|
||||
#include "system.hpp"
|
||||
#include "classes.hpp"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "Timer.h"
|
||||
#include "FadeSound.h"
|
||||
|
||||
|
||||
__fastcall TFadeSound::TFadeSound()
|
||||
{
|
||||
Sound= NULL;
|
||||
fFade= 0;
|
||||
dt= 0;
|
||||
fTime= 0;
|
||||
Sound = NULL;
|
||||
fFade = 0;
|
||||
dt = 0;
|
||||
fTime = 0;
|
||||
}
|
||||
|
||||
__fastcall TFadeSound::~TFadeSound() { Free(); }
|
||||
|
||||
__fastcall TFadeSound::~TFadeSound()
|
||||
{
|
||||
Free();
|
||||
}
|
||||
|
||||
void __fastcall TFadeSound::Free()
|
||||
{
|
||||
}
|
||||
void __fastcall TFadeSound::Free() {}
|
||||
|
||||
void __fastcall TFadeSound::Init(char *Name, float fNewFade)
|
||||
{
|
||||
Sound= TSoundsManager::GetFromName(Name,false);
|
||||
Sound = TSoundsManager::GetFromName(Name, false);
|
||||
if (Sound)
|
||||
Sound->SetVolume(0);
|
||||
fFade= fNewFade;
|
||||
fTime= 0;
|
||||
fFade = fNewFade;
|
||||
fTime = 0;
|
||||
}
|
||||
|
||||
void __fastcall TFadeSound::TurnOn()
|
||||
{
|
||||
State= ss_Starting;
|
||||
Sound->Play(0,0,DSBPLAY_LOOPING);
|
||||
fTime= fFade;
|
||||
|
||||
State = ss_Starting;
|
||||
Sound->Play(0, 0, DSBPLAY_LOOPING);
|
||||
fTime = fFade;
|
||||
}
|
||||
|
||||
void __fastcall TFadeSound::TurnOff()
|
||||
{
|
||||
State= ss_ShuttingDown;
|
||||
}
|
||||
void __fastcall TFadeSound::TurnOff() { State = ss_ShuttingDown; }
|
||||
|
||||
void __fastcall TFadeSound::Update()
|
||||
{
|
||||
|
||||
if (State==ss_Starting)
|
||||
if (State == ss_Starting)
|
||||
{
|
||||
fTime+= Timer::GetDeltaTime();
|
||||
// SoundStart->SetVolume(-1000*(4-fTime)/4);
|
||||
if (fTime>=fFade)
|
||||
fTime += Timer::GetDeltaTime();
|
||||
// SoundStart->SetVolume(-1000*(4-fTime)/4);
|
||||
if (fTime >= fFade)
|
||||
{
|
||||
fTime= fFade;
|
||||
State= ss_Commencing;
|
||||
Sound->SetVolume(-2000*(fFade-fTime)/fFade);
|
||||
Sound->SetFrequency(44100-500+500*(fTime)/fFade);
|
||||
fTime = fFade;
|
||||
State = ss_Commencing;
|
||||
Sound->SetVolume(-2000 * (fFade - fTime) / fFade);
|
||||
Sound->SetFrequency(44100 - 500 + 500 * (fTime) / fFade);
|
||||
}
|
||||
else
|
||||
if (Timer::GetSoundTimer())
|
||||
else if (Timer::GetSoundTimer())
|
||||
{
|
||||
Sound->SetVolume(-2000*(fFade-fTime)/fFade);
|
||||
Sound->SetFrequency(44100-500+500*(fTime)/fFade);
|
||||
Sound->SetVolume(-2000 * (fFade - fTime) / fFade);
|
||||
Sound->SetFrequency(44100 - 500 + 500 * (fTime) / fFade);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (State==ss_ShuttingDown)
|
||||
else if (State == ss_ShuttingDown)
|
||||
{
|
||||
fTime-= Timer::GetDeltaTime();
|
||||
fTime -= Timer::GetDeltaTime();
|
||||
|
||||
if (fTime<=0)
|
||||
if (fTime <= 0)
|
||||
{
|
||||
State= ss_Off;
|
||||
fTime= 0;
|
||||
State = ss_Off;
|
||||
fTime = 0;
|
||||
Sound->Stop();
|
||||
}
|
||||
if (Timer::GetSoundTimer())
|
||||
{ //DSBVOLUME_MIN
|
||||
Sound->SetVolume(-2000*(fFade-fTime)/fFade);
|
||||
Sound->SetFrequency(44100-500+500*fTime/fFade);
|
||||
{ // DSBVOLUME_MIN
|
||||
Sound->SetVolume(-2000 * (fFade - fTime) / fFade);
|
||||
Sound->SetFrequency(44100 - 500 + 500 * fTime / fFade);
|
||||
}
|
||||
}
|
||||
}
|
||||
void __fastcall TFadeSound::Volume(long vol)
|
||||
{
|
||||
float glos= 1;
|
||||
Sound->SetVolume(vol*glos);
|
||||
float glos = 1;
|
||||
Sound->SetVolume(vol * glos);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user