Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge remote-tracking branch 'upstream/master'
  • Loading branch information
Nick007J committed Sep 26, 2020
2 parents 375c7df + 3f0a80f commit eefb0c817f1c86cb24d3a730da848e1f98277948
@@ -0,0 +1,2 @@
sdk/* linguist-vendored
vendor/* linguist-vendored
@@ -14,7 +14,7 @@ such that we have a working game at all times.

## How can I try it?

- re3 requires game assets to work, so you **must** own a copy of GTA III.
- re3 requires game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
- Build re3 or download it from one of the above links (Debug or Release).
- (Optional) If you want to use optional features like Russian language or menu map, copy the files in /gamefiles folder to your game root folder.
- Move re3.exe to GTA 3 directory and run it.
@@ -165,7 +165,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
if(m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nLoopCount = 0;
@@ -306,7 +306,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 11;
m_sQueueSample.m_nLoopCount = 1;

Large diffs are not rendered by default.

@@ -86,7 +86,7 @@ cAudioManager::Terminate()
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();

for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) {
for (uint32 i = 0; i < MAX_SFX_BANKS; i++) {
if (SampleManager.IsSampleBankLoaded(i))
SampleManager.UnloadSampleBank(i);
}
@@ -917,7 +917,7 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
m_asActiveSamples[i].m_nCounter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID;
m_asActiveSamples[i].m_nBankIndex = INVALID_SFX_BANK;
m_asActiveSamples[i].m_bIs2D = false;
m_asActiveSamples[i].m_nReleasingVolumeModificator = 5;
m_asActiveSamples[i].m_nFrequency = 0;
@@ -213,7 +213,7 @@ class cAudioManager
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
bool ShouldDuckMissionAudio() const { return m_sMissionAudio.m_nPlayStatus == 1; }

// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample);
@@ -26,12 +26,12 @@ cMusicManager::cMusicManager()
m_bIsInitialised = false;
m_bDisabled = false;
m_nMusicMode = MUSICMODE_DISABLED;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
m_nAnnouncement = NO_STREAMED_SOUND;
m_nAnnouncement = NO_TRACK;
m_bPreviousPlayerInCar = false;
m_bPlayerInCar = false;
m_bAnnouncementInProgress = false;
@@ -224,7 +224,7 @@ cMusicManager::Initialise()
m_bRadioSetByScript = false;
m_nRadioStation = HEAD_RADIO;
m_nRadioPosition = -1;
m_nRadioInCar = NO_STREAMED_SOUND;
m_nRadioInCar = NO_TRACK;
gNumRetunePresses = 0;
gRetuneCounter = 0;
m_bIsInitialised = true;
@@ -239,8 +239,8 @@ cMusicManager::Terminate()

if (SampleManager.IsStreamPlaying(0)) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
}
m_bIsInitialised = false;
}
@@ -274,8 +274,8 @@ cMusicManager::ChangeMusicMode(uint8 mode)
}
SampleManager.StopStreamedFile(0);
}
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
@@ -301,14 +301,14 @@ cMusicManager::GetRadioInCar(void)
CVehicle *veh = FindPlayerVehicle();
if (veh != nil){
if (UsesPoliceRadio(veh)) {
if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return POLICE_RADIO;
return m_nRadioInCar;
} else return veh->m_nRadioStation;
}
}

if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return RADIO_OFF;
return m_nRadioInCar;
}
@@ -347,7 +347,7 @@ cMusicManager::ResetMusicAfterReload()
m_bRadioSetByScript = false;
m_nRadioStation = 0;
m_nRadioPosition = -1;
m_nAnnouncement = NO_STREAMED_SOUND;
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
m_bSetNextStation = false;
gRetuneCounter = 0;
@@ -384,7 +384,7 @@ cMusicManager::Service()
m_nLastTrackServiceTime = m_nTimer;
} else m_bDoTrackService = false;

if (m_nCurrentStreamedSound == NO_STREAMED_SOUND && SampleManager.IsStreamPlaying(0))
if (m_nCurrentStreamedSound == NO_TRACK && SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0);
else switch (m_nMusicMode) {
case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break;
@@ -410,8 +410,8 @@ cMusicManager::ServiceFrontEndMode()
default:
break;
}
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
}
} else if (bHasStarted) {
if (!SampleManager.IsStreamPlaying(0))
@@ -434,6 +434,7 @@ cMusicManager::ServiceGameMode()
{
bool bRadioOff = false;
static int8 nFramesSinceCutsceneEnded = -1;
uint8 volume;

m_bPreviousPlayerInCar = m_bPlayerInCar;
m_bPlayerInCar = PlayerInCar();
@@ -516,56 +517,54 @@ cMusicManager::ServiceGameMode()
m_bPlayerInCar = false;
if (FindPlayerVehicle())
FindPlayerVehicle()->m_nRadioStation = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
}
if (CTimer::GetIsSlowMotionActive()) {
if (TheCamera.pTargetEntity != nil) {
float dist = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr();
if (dist >= 3025.0f) {
float DistToTargetSq = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr();
if (DistToTargetSq >= SQR(55.0f)) {
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
} else if (dist >= 100.0f) {
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
int8 pan;
if (AudioManager.IsMissionAudioSamplePlaying())
} else if (DistToTargetSq >= SQR(10.0f)) {
volume = ((45.0f - (Sqrt(DistToTargetSq) - 10.0f)) / 45.0f * 100.0f);
uint8 pan;
if (AudioManager.ShouldDuckMissionAudio())
volume /= 4;
if (volume != 0) {
CVector trVec;
AudioManager.TranslateEntity(&TheCamera.pTargetEntity->GetPosition(), &trVec);
pan = AudioManager.ComputePan(55.0f, &trVec);
if (volume > 0) {
CVector panVec;
AudioManager.TranslateEntity(&TheCamera.pTargetEntity->GetPosition(), &panVec);
pan = AudioManager.ComputePan(55.0f, &panVec);
} else {
pan = 0;
}
if (gRetuneCounter)
volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
} else if (AudioManager.IsMissionAudioSamplePlaying()) {
} else if (AudioManager.ShouldDuckMissionAudio()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else if (gRetuneCounter) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else {
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
}
}
} else if (AudioManager.IsMissionAudioSamplePlaying()) {
} else if (AudioManager.ShouldDuckMissionAudio()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
nFramesSinceCutsceneEnded = 0;
} else {
int8 volume;
if (nFramesSinceCutsceneEnded == -1) {
volume = 100;
} else if (nFramesSinceCutsceneEnded >= 20) {
if (nFramesSinceCutsceneEnded >= 40) {
nFramesSinceCutsceneEnded = -1;
volume = 100;
} else {
volume = 3 * (nFramesSinceCutsceneEnded - 20) + 25;
nFramesSinceCutsceneEnded++;
}
} else {
} else if (nFramesSinceCutsceneEnded < 20) {
nFramesSinceCutsceneEnded++;
volume = 25;
} else if (nFramesSinceCutsceneEnded < 40) {
volume = 3 * (nFramesSinceCutsceneEnded - 20) + 25;
nFramesSinceCutsceneEnded++;
} else {
nFramesSinceCutsceneEnded = -1;
volume = 100;
}
if (gRetuneCounter) volume /= 4;
if (gRetuneCounter != 0)
volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, 63, 0, 0);
}
return;
@@ -585,7 +584,7 @@ cMusicManager::ServiceGameMode()
} else {
m_nCurrentStreamedSound = m_nRadioStation;
if (FindPlayerVehicle()->m_nRadioStation == m_nCurrentStreamedSound) {
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_TRACK;
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
SampleManager.StopStreamedFile(0);
}
@@ -608,19 +607,19 @@ cMusicManager::ServiceGameMode()
}
} else {
m_bPlayerInCar = false;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
}
}

void
cMusicManager::StopFrontEndTrack()
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_FRONTEND && m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_FRONTEND && m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_TRACK;
m_nCurrentStreamedSound = NO_TRACK;
}
}

@@ -636,17 +635,17 @@ cMusicManager::PlayFrontEndTrack(uint8 track, uint8 bPlayInFrontend)
{
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS) {
if (m_nMusicMode == MUSICMODE_GAME) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
if (m_nCurrentStreamedSound != NO_TRACK) {
if (m_bAnnouncementInProgress) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
}
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
} else if (m_nMusicMode == MUSICMODE_FRONTEND) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
if (m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
@@ -691,23 +690,22 @@ cMusicManager::StopCutSceneMusic(void)
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
}
}

uint32
cMusicManager::GetTrackStartPos(uint8 track)
{
uint32 result;
uint32 timer = m_aTracks[track].m_nLastPosCheckTimer;
if (CTimer::GetTimeInMillisecondsPauseMode() <= timer) {
result = m_aTracks[track].m_nPosition;
uint32 pos = m_aTracks[track].m_nPosition;
if (CTimer::GetTimeInMillisecondsPauseMode() > m_aTracks[track].m_nLastPosCheckTimer)
pos += Min(CTimer::GetTimeInMillisecondsPauseMode() - m_aTracks[track].m_nLastPosCheckTimer, 90000);
else
m_aTracks[track].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
} else
result = Min(CTimer::GetTimeInMillisecondsPauseMode() - timer, 90000) + m_aTracks[track].m_nPosition;

if (result > m_aTracks[track].m_nLength) result %= m_aTracks[track].m_nLength;
return result;
if (pos > m_aTracks[track].m_nLength)
pos %= m_aTracks[track].m_nLength;
return pos;
}


@@ -733,21 +731,21 @@ cMusicManager::ServiceAmbience()
uint8 volume;

if (m_bAnnouncementInProgress) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
}
if (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT) {
if (SampleManager.IsStreamPlaying(0)) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
return;
}
m_nCurrentStreamedSound = STREAMED_SOUND_CITY_AMBIENT;
}
if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING && !SampleManager.IsStreamPlaying(0)) {
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
return;
}

@@ -774,7 +772,7 @@ cMusicManager::ServiceAmbience()
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
m_bDontServiceAmbienceTrack = true;
} else
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_TRACK;
}
}

@@ -813,7 +811,7 @@ cMusicManager::ServiceAnnouncement()
static int8 cCheck = 0;
if (m_bAnnouncementInProgress) {
if (!SampleManager.IsStreamPlaying(0)) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
}
return true;
@@ -823,7 +821,7 @@ cMusicManager::ServiceAnnouncement()
cCheck = 0;
int pos = SampleManager.GetStreamedFilePosition(0);
if (SampleManager.IsStreamPlaying(0)) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
if (m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = pos;
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
@@ -832,7 +830,7 @@ cMusicManager::ServiceAnnouncement()

SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
SampleManager.SetStreamedVolumeAndPan(AudioManager.ShouldDuckMissionAudio() ? 25 : 100, 63, 0, 0);
m_bAnnouncementInProgress = true;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = m_nAnnouncement;
@@ -905,7 +903,7 @@ cMusicManager::ChangeRadioChannel()
return false;
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
return false;
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
SampleManager.SetStreamedVolumeAndPan(AudioManager.ShouldDuckMissionAudio() ? 25 : 100, 63, 0, 0);
}
return true;
}

0 comments on commit eefb0c8

Please sign in to comment.