mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 09:39:16 +01:00
Merge remote-tracking branch 'upstream/miami' into miami
This commit is contained in:
commit
2634d3b427
@ -328,8 +328,13 @@ cAudioManager::Get3DProviderName(uint8 id) const
|
||||
{
|
||||
if (!m_bIsInitialised)
|
||||
return nil;
|
||||
#ifdef AUDIO_OAL
|
||||
id = clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
|
||||
#else
|
||||
// We don't want that either since it will crash the game, but skipping for now
|
||||
if (id >= SampleManager.GetNum3DProvidersAvailable())
|
||||
return nil;
|
||||
#endif
|
||||
return SampleManager.Get3DProviderName(id);
|
||||
}
|
||||
|
||||
@ -618,29 +623,56 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
||||
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
cAudioManager::AddReflectionsToRequestedQueue()
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
uint32 oldFreq = 0;
|
||||
#else
|
||||
uint32 oldFreq;
|
||||
#endif
|
||||
float reflectionDistance;
|
||||
int32 noise;
|
||||
uint8 emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 8);
|
||||
uint8 emittingVolume;
|
||||
|
||||
uint32 oldCounter = m_sQueueSample.m_nCounter;
|
||||
float oldDist = m_sQueueSample.m_fDistance;
|
||||
CVector oldPos = m_sQueueSample.m_vecPos;
|
||||
if ( CTimer::GetIsSlowMotionActive() ) {
|
||||
emittingVolume = m_sQueueSample.m_nVolume;
|
||||
oldFreq = m_sQueueSample.m_nFrequency;
|
||||
} else {
|
||||
emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 16);
|
||||
}
|
||||
m_sQueueSample.m_fSoundIntensity = m_sQueueSample.m_fSoundIntensity / 2.f;
|
||||
|
||||
int halfOldFreq = oldFreq >> 1;
|
||||
|
||||
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
|
||||
if ( CTimer::GetIsSlowMotionActive() )
|
||||
m_afReflectionsDistances[i] = GetRandomNumberInRange(i % 4, 0, 2) * 100.f / 8.f;
|
||||
|
||||
reflectionDistance = m_afReflectionsDistances[i];
|
||||
if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) {
|
||||
m_sQueueSample.m_nLoopsRemaining = (reflectionDistance * 500.f / 1029.f);
|
||||
if (m_sQueueSample.m_nLoopsRemaining > 5) {
|
||||
m_sQueueSample.m_nLoopsRemaining = CTimer::GetIsSlowMotionActive() ? (reflectionDistance * 800.f / 1029.f) : (reflectionDistance * 500.f / 1029.f);
|
||||
if (m_sQueueSample.m_nLoopsRemaining > 3) {
|
||||
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
|
||||
m_sQueueSample.m_nEmittingVolume = emittingVolume;
|
||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
||||
|
||||
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
|
||||
m_sQueueSample.m_nCounter += (i + 1) * 256;
|
||||
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
|
||||
if (m_sQueueSample.m_nLoopCount) {
|
||||
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
||||
if (noise <= 0)
|
||||
m_sQueueSample.m_nFrequency += noise;
|
||||
else
|
||||
m_sQueueSample.m_nFrequency -= noise;
|
||||
if ( CTimer::GetIsSlowMotionActive() ) {
|
||||
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
|
||||
} else {
|
||||
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
||||
if (noise <= 0)
|
||||
m_sQueueSample.m_nFrequency += noise;
|
||||
else
|
||||
m_sQueueSample.m_nFrequency -= noise;
|
||||
}
|
||||
}
|
||||
m_sQueueSample.m_nReleasingVolumeModificator += 20;
|
||||
m_sQueueSample.m_vecPos = m_avecReflectionsPos[i];
|
||||
@ -649,50 +681,85 @@ cAudioManager::AddReflectionsToRequestedQueue()
|
||||
}
|
||||
}
|
||||
}
|
||||
m_sQueueSample.m_vecPos = oldPos;
|
||||
m_sQueueSample.m_fDistance = oldDist;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
cAudioManager::UpdateReflections()
|
||||
{
|
||||
const CVector &camPos = TheCamera.GetPosition();
|
||||
CVector camPos = TheCamera.GetPosition();
|
||||
CColPoint colpoint;
|
||||
CEntity *ent;
|
||||
|
||||
if (m_FrameCounter % 8 == 0) {
|
||||
m_avecReflectionsPos[0] = camPos;
|
||||
m_avecReflectionsPos[0].y += 50.f;
|
||||
m_avecReflectionsPos[0].y += 100.f;
|
||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true))
|
||||
m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
|
||||
else
|
||||
m_afReflectionsDistances[0] = 50.0f;
|
||||
m_afReflectionsDistances[0] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 1) % 8 == 0) {
|
||||
m_avecReflectionsPos[1] = camPos;
|
||||
m_avecReflectionsPos[1].y -= 50.0f;
|
||||
m_avecReflectionsPos[1].y -= 100.0f;
|
||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true))
|
||||
m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
|
||||
else
|
||||
m_afReflectionsDistances[1] = 50.0f;
|
||||
m_afReflectionsDistances[1] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 2) % 8 == 0) {
|
||||
m_avecReflectionsPos[2] = camPos;
|
||||
m_avecReflectionsPos[2].x -= 50.0f;
|
||||
m_avecReflectionsPos[2].x -= 100.0f;
|
||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true))
|
||||
m_afReflectionsDistances[2] = Distance(camPos, colpoint.point);
|
||||
else
|
||||
m_afReflectionsDistances[2] = 50.0f;
|
||||
m_afReflectionsDistances[2] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 3) % 8 == 0) {
|
||||
m_avecReflectionsPos[3] = camPos;
|
||||
m_avecReflectionsPos[3].x += 50.0f;
|
||||
m_avecReflectionsPos[3].x += 100.0f;
|
||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true))
|
||||
m_afReflectionsDistances[3] = Distance(camPos, colpoint.point);
|
||||
else
|
||||
m_afReflectionsDistances[3] = 50.0f;
|
||||
m_afReflectionsDistances[3] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 4) % 8 == 0) {
|
||||
camPos.y += 1.0f;
|
||||
m_avecReflectionsPos[4] = camPos;
|
||||
m_avecReflectionsPos[4].z += 50.0f;
|
||||
m_avecReflectionsPos[4].z += 100.0f;
|
||||
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||
m_afReflectionsDistances[4] = colpoint.point.z - camPos.z;
|
||||
else
|
||||
m_afReflectionsDistances[4] = 50.0f;
|
||||
m_afReflectionsDistances[4] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 5) % 8 == 0) {
|
||||
camPos.y -= 1.0f;
|
||||
m_avecReflectionsPos[5] = camPos;
|
||||
m_avecReflectionsPos[5].z += 100.0f;
|
||||
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[5].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||
m_afReflectionsDistances[5] = colpoint.point.z - camPos.z;
|
||||
else
|
||||
m_afReflectionsDistances[5] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 6) % 8 == 0) {
|
||||
camPos.x -= 1.0f;
|
||||
m_avecReflectionsPos[6] = camPos;
|
||||
m_avecReflectionsPos[6].z += 100.0f;
|
||||
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[6].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||
m_afReflectionsDistances[6] = colpoint.point.z - camPos.z;
|
||||
else
|
||||
m_afReflectionsDistances[6] = 100.0f;
|
||||
|
||||
} else if ((m_FrameCounter + 7) % 8 == 0) {
|
||||
camPos.x += 1.0f;
|
||||
m_avecReflectionsPos[7] = camPos;
|
||||
m_avecReflectionsPos[7].z += 100.0f;
|
||||
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[7].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||
m_afReflectionsDistances[7] = colpoint.point.z - camPos.z;
|
||||
else
|
||||
m_afReflectionsDistances[7] = 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1009,4 +1076,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
|
||||
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
|
||||
return emittingVolume;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -156,19 +156,14 @@ public:
|
||||
VALIDATE_SIZE(cVehicleParams, 0x18);
|
||||
|
||||
enum {
|
||||
/*
|
||||
REFLECTION_YMAX = 0, top
|
||||
REFLECTION_YMIN = 1, bottom
|
||||
REFLECTION_XMIN = 2, left
|
||||
REFLECTION_XMAX = 3, right
|
||||
REFLECTION_ZMAX = 4,
|
||||
*/
|
||||
|
||||
REFLECTION_TOP = 0,
|
||||
REFLECTION_BOTTOM,
|
||||
REFLECTION_LEFT,
|
||||
REFLECTION_RIGHT,
|
||||
REFLECTION_UP,
|
||||
REFLECTION_NORTH = 0,
|
||||
REFLECTION_SOUTH,
|
||||
REFLECTION_WEST,
|
||||
REFLECTION_EAST,
|
||||
REFLECTION_CEIL_NORTH,
|
||||
REFLECTION_CEIL_SOUTH,
|
||||
REFLECTION_CEIL_WEST,
|
||||
REFLECTION_CEIL_EAST,
|
||||
MAX_REFLECTIONS,
|
||||
};
|
||||
|
||||
|
@ -377,8 +377,8 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
|
||||
#endif
|
||||
else
|
||||
m_pSoundFile = nil;
|
||||
ASSERT(m_pSoundFile != nil);
|
||||
if (m_pSoundFile && m_pSoundFile->IsOpened() )
|
||||
|
||||
if ( IsOpened() )
|
||||
{
|
||||
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
|
||||
ASSERT(m_pBuffer!=nil);
|
||||
@ -425,14 +425,14 @@ bool CStream::HasSource()
|
||||
|
||||
bool CStream::IsOpened()
|
||||
{
|
||||
return m_pSoundFile->IsOpened();
|
||||
return m_pSoundFile && m_pSoundFile->IsOpened();
|
||||
}
|
||||
|
||||
bool CStream::IsPlaying()
|
||||
{
|
||||
if ( !HasSource() || !IsOpened() ) return false;
|
||||
|
||||
if ( m_pSoundFile->IsOpened() && !m_bPaused )
|
||||
if ( !m_bPaused )
|
||||
{
|
||||
ALint sourceState;
|
||||
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
|
||||
@ -500,7 +500,7 @@ void CStream::SetPan(uint8 nPan)
|
||||
|
||||
void CStream::SetPosMS(uint32 nPos)
|
||||
{
|
||||
if ( !m_pSoundFile->IsOpened() ) return;
|
||||
if ( !IsOpened() ) return;
|
||||
m_pSoundFile->Seek(nPos);
|
||||
ClearBuffers();
|
||||
}
|
||||
@ -508,7 +508,7 @@ void CStream::SetPosMS(uint32 nPos)
|
||||
uint32 CStream::GetPosMS()
|
||||
{
|
||||
if ( !HasSource() ) return 0;
|
||||
if ( !m_pSoundFile->IsOpened() ) return 0;
|
||||
if ( !IsOpened() ) return 0;
|
||||
|
||||
ALint offset;
|
||||
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
||||
@ -521,7 +521,7 @@ uint32 CStream::GetPosMS()
|
||||
|
||||
uint32 CStream::GetLengthMS()
|
||||
{
|
||||
if ( !m_pSoundFile->IsOpened() ) return 0;
|
||||
if ( !IsOpened() ) return 0;
|
||||
return m_pSoundFile->GetLength();
|
||||
}
|
||||
|
||||
@ -529,7 +529,7 @@ bool CStream::FillBuffer(ALuint alBuffer)
|
||||
{
|
||||
if ( !HasSource() )
|
||||
return false;
|
||||
if ( !m_pSoundFile->IsOpened() )
|
||||
if ( !IsOpened() )
|
||||
return false;
|
||||
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
|
||||
return false;
|
||||
@ -571,7 +571,7 @@ void CStream::ClearBuffers()
|
||||
|
||||
bool CStream::Setup()
|
||||
{
|
||||
if ( m_pSoundFile->IsOpened() )
|
||||
if ( IsOpened() )
|
||||
{
|
||||
m_pSoundFile->Seek(0);
|
||||
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||
|
@ -143,8 +143,8 @@ class cSampleManager
|
||||
char *m_aAudioProviders[MAXPROVIDERS];
|
||||
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
||||
char m_MiscomPath[260];
|
||||
char m_SfxPath[260];
|
||||
char m_StreamedAudioPath[188];
|
||||
char m_WavFilesPath[260];
|
||||
char m_MP3FilesPath[188];
|
||||
void *m_aChannels[18];
|
||||
|
||||
public:
|
||||
|
@ -16,10 +16,12 @@
|
||||
#include "MusicManager.h"
|
||||
#include "Frontend.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include "crossplatform.h"
|
||||
|
||||
#pragma comment( lib, "mss32.lib" )
|
||||
|
||||
// --MIAMI: file done
|
||||
|
||||
cSampleManager SampleManager;
|
||||
uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||
///////////////////////////////////////////////////////////////
|
||||
@ -65,11 +67,6 @@ uint8 nStreamLoopedFlag[MAX_STREAMS];
|
||||
uint32 _CurMP3Index;
|
||||
int32 _CurMP3Pos;
|
||||
bool _bIsMp3Active;
|
||||
|
||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
||||
bool _bUseHDDAudio;
|
||||
char _aHDDPath[MAX_PATH];
|
||||
#endif
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -560,15 +557,6 @@ _FindMP3s(void)
|
||||
FindClose(hFind);
|
||||
return;
|
||||
}
|
||||
|
||||
FILE *f = fopen("MP3\\MP3Report.txt", "w");
|
||||
|
||||
if ( f )
|
||||
{
|
||||
fprintf(f, "MP3 Report File\n\n");
|
||||
fprintf(f, "\"%s\"", fd.cFileName);
|
||||
}
|
||||
|
||||
|
||||
if ( filepathlen > 4 )
|
||||
{
|
||||
@ -578,12 +566,6 @@ _FindMP3s(void)
|
||||
{
|
||||
OutputDebugString("Resolving Link");
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
||||
}
|
||||
|
||||
bShortcut = true;
|
||||
@ -607,10 +589,6 @@ _FindMP3s(void)
|
||||
if ( _pMP3List == NULL )
|
||||
{
|
||||
FindClose(hFind);
|
||||
|
||||
if ( f )
|
||||
fclose(f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -633,9 +611,6 @@ _FindMP3s(void)
|
||||
{
|
||||
_pMP3List->pLinkPath = NULL;
|
||||
}
|
||||
|
||||
if ( f ) fprintf(f, " - OK\n");
|
||||
|
||||
bInitFirstEntry = false;
|
||||
}
|
||||
else
|
||||
@ -644,8 +619,6 @@ _FindMP3s(void)
|
||||
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
||||
|
||||
bInitFirstEntry = true;
|
||||
}
|
||||
|
||||
@ -661,8 +634,6 @@ _FindMP3s(void)
|
||||
|
||||
int32 filepathlen = strlen(filepath);
|
||||
|
||||
if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
|
||||
|
||||
if ( filepathlen > 0 )
|
||||
{
|
||||
if ( filepathlen > 4 )
|
||||
@ -673,12 +644,6 @@ _FindMP3s(void)
|
||||
{
|
||||
OutputDebugString("Resolving Link");
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
||||
}
|
||||
|
||||
bShortcut = true;
|
||||
@ -689,8 +654,6 @@ _FindMP3s(void)
|
||||
|
||||
if ( filepathlen > MAX_PATH )
|
||||
{
|
||||
if ( f ) fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -729,17 +692,13 @@ _FindMP3s(void)
|
||||
}
|
||||
|
||||
pList = _pMP3List;
|
||||
|
||||
if ( f ) fprintf(f, " - OK\n");
|
||||
|
||||
|
||||
bInitFirstEntry = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(filepath, " - NOT A VALID MP3");
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -752,8 +711,6 @@ _FindMP3s(void)
|
||||
|
||||
if ( filepathlen > 0 )
|
||||
{
|
||||
if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
|
||||
|
||||
if ( filepathlen > 4 )
|
||||
{
|
||||
if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
|
||||
@ -762,12 +719,6 @@ _FindMP3s(void)
|
||||
{
|
||||
OutputDebugString("Resolving Link");
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
||||
}
|
||||
|
||||
bShortcut = true;
|
||||
@ -812,26 +763,16 @@ _FindMP3s(void)
|
||||
nNumMP3s++;
|
||||
|
||||
OutputDebugString(fd.cFileName);
|
||||
|
||||
if ( f ) fprintf(f, " - OK\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(filepath, " - NOT A VALID MP3");
|
||||
OutputDebugString(filepath);
|
||||
|
||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( f )
|
||||
{
|
||||
fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
@ -1043,54 +984,37 @@ cSampleManager::Initialise(void)
|
||||
|
||||
AIL_set_preference(DIG_MIXER_CHANNELS, MAX_DIGITAL_MIXER_CHANNELS);
|
||||
|
||||
DIG = AIL_open_digital_driver(DIGITALRATE, DIGITALBITS, DIGITALCHANNELS, 0);
|
||||
if ( DIG == NULL )
|
||||
{
|
||||
OutputDebugString(AIL_last_error());
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
add_providers();
|
||||
|
||||
if ( !InitialiseSampleBanks() )
|
||||
{
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]);
|
||||
if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] )
|
||||
{
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||
DIG = AIL_open_digital_driver(DIGITALRATE, DIGITALBITS, DIGITALCHANNELS, 0);
|
||||
|
||||
}
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
TRACE("cache");
|
||||
FILE *cacheFile = fopen("audio\\sound.cache", "rb");
|
||||
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
|
||||
bool CreateCache = false;
|
||||
if (cacheFile) {
|
||||
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
m_bInitialised = true;
|
||||
}else {
|
||||
}else
|
||||
CreateCache = true;
|
||||
#endif
|
||||
TRACE("cdrom");
|
||||
|
||||
S32 tatalms;
|
||||
char filepath[MAX_PATH];
|
||||
bool bFileNotFound;
|
||||
S32 tatalms;
|
||||
|
||||
TRACE("cdrom");
|
||||
{
|
||||
m_bInitialised = false;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
// Find path of WAVs (originally in HDD)
|
||||
int32 drive = 'C';
|
||||
|
||||
#ifndef NO_CDCHECK
|
||||
do
|
||||
{
|
||||
char latter[2];
|
||||
@ -1111,47 +1035,145 @@ cSampleManager::Initialise(void)
|
||||
if ( f )
|
||||
{
|
||||
fclose(f);
|
||||
|
||||
bool bFileNotFound = false;
|
||||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( mp3Stream[0] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
||||
AIL_close_stream(mp3Stream[0]);
|
||||
mp3Stream[0] = NULL;
|
||||
|
||||
nStreamLength[i] = tatalms;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFileNotFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bFileNotFound )
|
||||
{
|
||||
m_bInitialised = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bInitialised = false;
|
||||
continue;
|
||||
}
|
||||
strcpy(m_MiscomPath, m_szCDRomRootPath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} while ( ++drive <= 'Z' );
|
||||
#else
|
||||
m_MiscomPath[0] = '\0';
|
||||
#endif
|
||||
|
||||
if ( DIG == NULL )
|
||||
{
|
||||
OutputDebugString(AIL_last_error());
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
add_providers();
|
||||
|
||||
m_szCDRomRootPath[0] = '\0';
|
||||
|
||||
strcpy(m_WavFilesPath, m_szCDRomRootPath);
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
if ( CreateCache )
|
||||
#endif
|
||||
for ( int32 i = STREAMED_SOUND_MISSION_MOBR1; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( mp3Stream[0] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
||||
AIL_close_stream(mp3Stream[0]);
|
||||
mp3Stream[0] = NULL;
|
||||
|
||||
nStreamLength[i] = tatalms;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bInitialised = false;
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Find path of MP3s (originally in CD-Rom)
|
||||
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
|
||||
#ifndef NO_CDCHECK
|
||||
int32 drive = 'C';
|
||||
do
|
||||
{
|
||||
latter[0] = drive;
|
||||
latter[1] = '\0';
|
||||
|
||||
strcpy(m_szCDRomRootPath, latter);
|
||||
strcat(m_szCDRomRootPath, ":");
|
||||
strcat(m_MP3FilesPath, m_szCDRomRootPath);
|
||||
#else
|
||||
m_MP3FilesPath[0] = '\0';
|
||||
{
|
||||
#endif
|
||||
|
||||
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
|
||||
{
|
||||
strcpy(filepath, m_MP3FilesPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if (mp3Stream[0])
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
||||
AIL_close_stream(mp3Stream[0]);
|
||||
mp3Stream[0] = NULL;
|
||||
|
||||
bFileNotFound = false;
|
||||
#ifdef AUDIO_CACHE
|
||||
if (!CreateCache)
|
||||
break;
|
||||
else
|
||||
#endif
|
||||
nStreamLength[i] = tatalms;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bFileNotFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_CDCHECK
|
||||
if (!bFileNotFound) // otherwise try next drive
|
||||
break;
|
||||
|
||||
}
|
||||
while (++drive <= 'Z');
|
||||
#else
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !bFileNotFound ) {
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
if ( CreateCache )
|
||||
#endif
|
||||
for ( int32 i = STREAMED_SOUND_MISSION_COMPLETED4; i < STREAMED_SOUND_MISSION_PAGER; i++ )
|
||||
{
|
||||
strcpy(filepath, m_MiscomPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( mp3Stream[0] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
||||
AIL_close_stream(mp3Stream[0]);
|
||||
mp3Stream[0] = NULL;
|
||||
|
||||
nStreamLength[i] = tatalms;
|
||||
bFileNotFound = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFileNotFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_bInitialised = !bFileNotFound;
|
||||
|
||||
if ( !m_bInitialised )
|
||||
{
|
||||
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||
@ -1171,77 +1193,31 @@ cSampleManager::Initialise(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
||||
// hddaudio
|
||||
/**
|
||||
Option for user to play audio files directly from hard disk.
|
||||
Copy the contents of the PLAY discs Audio directory into your installed Grand Theft Auto III Audio directory.
|
||||
Grand Theft Auto III still requires the presence of the PLAY disc when started.
|
||||
This may give better performance on some machines (though worse on others).
|
||||
**/
|
||||
TRACE("hddaudio 1.1 patch");
|
||||
{
|
||||
int32 streamLength[TOTAL_STREAMED_SOUNDS];
|
||||
|
||||
bool bFileNotFound = false;
|
||||
char rootpath[MAX_PATH];
|
||||
|
||||
strcpy(_aHDDPath, m_szCDRomRootPath);
|
||||
rootpath[0] = '\0';
|
||||
|
||||
FILE *f = fopen(StreamedNameTable[0], "rb");
|
||||
|
||||
if ( f )
|
||||
{
|
||||
fclose(f);
|
||||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
strcpy(filepath, rootpath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( mp3Stream[0] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
||||
AIL_close_stream(mp3Stream[0]);
|
||||
mp3Stream[0] = NULL;
|
||||
|
||||
streamLength[i] = tatalms;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFileNotFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
bFileNotFound = true;
|
||||
|
||||
if ( !bFileNotFound )
|
||||
{
|
||||
strcpy(m_szCDRomRootPath, rootpath);
|
||||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
nStreamLength[i] = streamLength[i];
|
||||
|
||||
_bUseHDDAudio = true;
|
||||
}
|
||||
else
|
||||
_bUseHDDAudio = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef AUDIO_CACHE
|
||||
cacheFile = fopen("audio\\sound.cache", "wb");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
if (CreateCache) {
|
||||
cacheFile = fcaseopen("audio\\sound.cache", "wb");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !InitialiseSampleBanks() )
|
||||
{
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]);
|
||||
if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] )
|
||||
{
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||
|
||||
LoadSampleBank(SFX_BANK_0);
|
||||
|
||||
TRACE("stream");
|
||||
{
|
||||
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
||||
@ -1270,7 +1246,7 @@ cSampleManager::Initialise(void)
|
||||
|
||||
while ( n < m_nNumberOfProviders )
|
||||
{
|
||||
if ( !strcmp(providers[n].name, "Miles Fast 2D Positional Audio") )
|
||||
if ( !strcmp(strupr(providers[n].name), "DIRECTSOUND3D SOFTWARE EMULATION") )
|
||||
{
|
||||
set_new_provider(n);
|
||||
break;
|
||||
@ -1285,10 +1261,6 @@ cSampleManager::Initialise(void)
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("bank");
|
||||
|
||||
LoadSampleBank(SFX_BANK_0);
|
||||
|
||||
// mp3
|
||||
TRACE("mp3");
|
||||
{
|
||||
@ -1411,26 +1383,25 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||
char filepath[MAX_PATH];
|
||||
|
||||
#if defined(GTA3_1_1_PATCH)
|
||||
if (_bUseHDDAudio)
|
||||
strcpy(filepath, _aHDDPath);
|
||||
else
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
#else
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
#endif // #if defined(GTA3_1_1_PATCH)
|
||||
strcpy(filepath, m_MiscomPath);
|
||||
strcat(filepath, StreamedNameTable[STREAMED_SOUND_MISSION_COMPLETED4]);
|
||||
|
||||
strcat(filepath, StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
|
||||
|
||||
FILE *f = fopen(filepath, "rb");
|
||||
|
||||
|
||||
if ( f )
|
||||
{
|
||||
fclose(f);
|
||||
DMAudio.SetMusicMasterVolume(FrontEndMenuManager.m_PrefsMusicVolume);
|
||||
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
|
||||
DMAudio.Service();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DMAudio.SetMusicMasterVolume(0);
|
||||
DMAudio.SetEffectsMasterVolume(0);
|
||||
DMAudio.Service();
|
||||
|
||||
return false;
|
||||
|
||||
#else
|
||||
@ -1441,27 +1412,10 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
char
|
||||
cSampleManager::GetCDAudioDriveLetter(void)
|
||||
{
|
||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
||||
if (_bUseHDDAudio)
|
||||
{
|
||||
if ( strlen(_aHDDPath) != 0 )
|
||||
return _aHDDPath[0];
|
||||
else
|
||||
return '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strlen(m_szCDRomRootPath) != 0 )
|
||||
return m_szCDRomRootPath[0];
|
||||
else
|
||||
return '\0';
|
||||
}
|
||||
#else
|
||||
if ( strlen(m_szCDRomRootPath) != 0 )
|
||||
return m_szCDRomRootPath[0];
|
||||
if ( strlen(m_MiscomPath) != 0 )
|
||||
return m_MiscomPath[0];
|
||||
else
|
||||
return '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -1629,14 +1583,6 @@ cSampleManager::LoadPedComment(uint32 nComment)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MUSICMODE_FRONTEND:
|
||||
{
|
||||
if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE )
|
||||
return false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1699,69 +1645,45 @@ cSampleManager::UpdateReverb(void)
|
||||
|
||||
if ( AudioManager.GetFrameCounter() & 15 )
|
||||
return false;
|
||||
|
||||
float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM);
|
||||
float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT);
|
||||
float z = AudioManager.GetReflectionsDistance(REFLECTION_UP);
|
||||
|
||||
float normy = norm(y, 5.0f, 40.0f);
|
||||
float normx = norm(x, 5.0f, 40.0f);
|
||||
float normz = norm(z, 5.0f, 40.0f);
|
||||
|
||||
float fRatio;
|
||||
float fRatio = 0.0f;
|
||||
|
||||
#define MIN_DIST 0.5f
|
||||
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
||||
|
||||
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_NORTH), 10.0f, 1/2.f);
|
||||
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_SOUTH), 10.0f, 1/2.f);
|
||||
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_WEST), 10.0f, 1/2.f);
|
||||
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_EAST), 10.0f, 1/2.f);
|
||||
|
||||
fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_NORTH) + AudioManager.GetReflectionsDistance(REFLECTION_SOUTH)) / 2.f, 4.0f, 1/3.f);
|
||||
fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_WEST) + AudioManager.GetReflectionsDistance(REFLECTION_EAST)) / 2.f, 4.0f, 1/3.f);
|
||||
|
||||
#undef CALCULATE_RATIO
|
||||
#undef MIN_DIST
|
||||
|
||||
if ( normy == 0.0f )
|
||||
{
|
||||
if ( normx == 0.0f )
|
||||
{
|
||||
if ( normz == 0.0f )
|
||||
fRatio = 0.3f;
|
||||
else
|
||||
fRatio = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fRatio = 0.3f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( normx == 0.0f )
|
||||
{
|
||||
if ( normz == 0.0f )
|
||||
fRatio = 0.3f;
|
||||
else
|
||||
fRatio = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( normz == 0.0f )
|
||||
fRatio = 0.3f;
|
||||
else
|
||||
fRatio = (normy+normx+normz) / 3.0f;
|
||||
}
|
||||
}
|
||||
|
||||
fRatio = clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
|
||||
fRatio = clamp(fRatio, 0.0f, 0.6f);
|
||||
|
||||
if ( fRatio == _fPrevEaxRatioDestination )
|
||||
return false;
|
||||
|
||||
if ( usingEAX3 )
|
||||
{
|
||||
fRatio = Min(fRatio * 1.67f, 1.0f);
|
||||
if ( EAX3ListenerInterpolate(&StartEAX3, &FinishEAX3, fRatio, &EAX3Params, false) )
|
||||
{
|
||||
AIL_set_3D_provider_preference(opened_provider, "EAX all parameters", &EAX3Params);
|
||||
_fEffectsLevel = 1.0f - fRatio * 0.5f;
|
||||
_fEffectsLevel = fRatio * 0.75f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _usingMilesFast2D )
|
||||
_fEffectsLevel = (1.0f - fRatio) * 0.4f;
|
||||
_fEffectsLevel = fRatio * 0.8f;
|
||||
else
|
||||
_fEffectsLevel = (1.0f - fRatio) * 0.7f;
|
||||
_fEffectsLevel = fRatio * 0.22f;
|
||||
}
|
||||
_fEffectsLevel = Min(_fEffectsLevel, 1.0f);
|
||||
|
||||
_fPrevEaxRatioDestination = fRatio;
|
||||
|
||||
@ -1870,10 +1792,11 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||
nChannelVolume[nChannel] = vol;
|
||||
|
||||
// increase the volume for JB.MP3 and S4_BDBD.MP3
|
||||
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
|
||||
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_FINALE )
|
||||
{
|
||||
nChannelVolume[nChannel] >>= 2;
|
||||
if (MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE ) {
|
||||
if (MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE)
|
||||
nChannelVolume[nChannel] = 0;
|
||||
else
|
||||
nChannelVolume[nChannel] >>= 2;
|
||||
}
|
||||
|
||||
if ( opened_samples[nChannel] )
|
||||
@ -2123,7 +2046,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
||||
|
||||
char filepath[MAX_PATH];
|
||||
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
|
||||
strcat(filepath, StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
||||
@ -2189,7 +2112,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||
if(mp3 == NULL) {
|
||||
_bIsMp3Active = false;
|
||||
nFile = 0;
|
||||
strcpy(filename, m_szCDRomRootPath);
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] =
|
||||
@ -2239,15 +2162,14 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||
if ( e == NULL )
|
||||
{
|
||||
nFile = 0;
|
||||
strcpy(filename, m_szCDRomRootPath);
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
mp3Stream[nStream] =
|
||||
AIL_open_stream(DIG, filename, 0);
|
||||
if(mp3Stream[nStream]) {
|
||||
AIL_set_stream_loop_count(
|
||||
mp3Stream[nStream], 1);
|
||||
AIL_set_stream_ms_position(
|
||||
mp3Stream[nStream], position);
|
||||
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
nStreamLoopedFlag[nStream] = true;
|
||||
AIL_set_stream_ms_position(mp3Stream[nStream], position);
|
||||
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||
return true;
|
||||
}
|
||||
@ -2285,13 +2207,14 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||
nFile = 0;
|
||||
}
|
||||
|
||||
strcpy(filename, m_szCDRomRootPath);
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||
if ( mp3Stream[nStream] )
|
||||
{
|
||||
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
|
||||
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
nStreamLoopedFlag[nStream] = true;
|
||||
AIL_set_stream_ms_position(mp3Stream[nStream], position);
|
||||
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||
return true;
|
||||
@ -2355,11 +2278,14 @@ void
|
||||
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
|
||||
{
|
||||
uint8 vol = nVolume;
|
||||
float boostMult = 0.0f;
|
||||
|
||||
if ( m_bInitialised )
|
||||
{
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
if ( MusicManager.GetRadioInCar() == USERTRACK && !MusicManager.CheckForMusicInterruptions() )
|
||||
boostMult = m_nMP3BoostVolume / 64.f;
|
||||
|
||||
nStreamVolume[nStream] = vol;
|
||||
nStreamPan[nStream] = nPan;
|
||||
@ -2368,13 +2294,13 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
|
||||
{
|
||||
if ( nEffectFlag )
|
||||
{
|
||||
if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel?
|
||||
if ( nStream == 1 || nStream == 2 )
|
||||
AIL_set_stream_volume(mp3Stream[nStream], 128*vol*m_nEffectsVolume >> 14);
|
||||
else
|
||||
AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
|
||||
}
|
||||
else
|
||||
AIL_set_stream_volume(mp3Stream[nStream], m_nMusicFadeVolume*vol*m_nMusicVolume >> 14);
|
||||
AIL_set_stream_volume(mp3Stream[nStream], (m_nMusicFadeVolume*vol*(uint32)(m_nMusicVolume * boostMult + m_nMusicVolume)) >> 14);
|
||||
|
||||
AIL_set_stream_pan(mp3Stream[nStream], nPan);
|
||||
}
|
||||
@ -2460,4 +2386,4 @@ cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
|
||||
nStreamLoopedFlag[nChannel] = nLoopFlag;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -240,9 +240,8 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||
ASSERT( pChannel != nil );
|
||||
|
||||
|
||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
||||
if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||
if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||
return STREAM_SUCCESS;
|
||||
|
||||
flushStream[channel] = 1;
|
||||
@ -293,7 +292,6 @@ CdStreamGetStatus(int32 channel)
|
||||
if ( pChannel->nStatus != STREAM_NONE )
|
||||
{
|
||||
int32 status = pChannel->nStatus;
|
||||
|
||||
pChannel->nStatus = STREAM_NONE;
|
||||
|
||||
return status;
|
||||
@ -322,15 +320,16 @@ CdStreamSync(int32 channel)
|
||||
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
||||
if (pChannel->bReading) {
|
||||
pChannel->bLocked = true;
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
#else
|
||||
pChannel->nSectorsToRead = 0;
|
||||
if (pChannel->bReading) {
|
||||
pChannel->bLocked = true;
|
||||
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
#endif
|
||||
pChannel->bReading = false;
|
||||
@ -341,8 +340,8 @@ CdStreamSync(int32 channel)
|
||||
if ( pChannel->nSectorsToRead != 0 )
|
||||
{
|
||||
pChannel->bLocked = true;
|
||||
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
while (pChannel->bLocked)
|
||||
sem_wait(pChannel->pDoneSemaphore);
|
||||
}
|
||||
|
||||
pChannel->bReading = false;
|
||||
@ -443,9 +442,9 @@ void *CdStreamThread(void *param)
|
||||
#endif
|
||||
|
||||
pChannel->nSectorsToRead = 0;
|
||||
|
||||
if ( pChannel->bLocked )
|
||||
{
|
||||
pChannel->bLocked = 0;
|
||||
sem_post(pChannel->pDoneSemaphore);
|
||||
}
|
||||
pChannel->bReading = false;
|
||||
|
@ -406,8 +406,8 @@ CFireManager::ExtinguishPointWithWater(CVector point, float range)
|
||||
CFire *fireToExtinguish = &m_aFires[fireI];
|
||||
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
|
||||
CVector steamPos = fireToExtinguish->m_vecPos +
|
||||
CVector((CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
||||
(CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
||||
CVector((CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
|
||||
(CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
|
||||
CGeneral::GetRandomNumber() / 200.f);
|
||||
|
||||
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.2f), nil, 0.5f);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "Messages.h"
|
||||
#include "FileLoader.h"
|
||||
#include "User.h"
|
||||
#include "sampman.h"
|
||||
|
||||
// TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places
|
||||
#define CUSTOM_MAP
|
||||
@ -376,8 +377,7 @@ CMenuManager::CMenuManager()
|
||||
m_bShowMouse = true;
|
||||
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
|
||||
|
||||
// TODO(Miami)
|
||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
m_bMenuActive = false;
|
||||
m_bActivateSaveMenu = false;
|
||||
m_bWantToLoad = false;
|
||||
@ -426,9 +426,7 @@ CMenuManager::Initialise(void)
|
||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||
m_PrefsRadioStation = DMAudio.GetRadioInCar();
|
||||
|
||||
// TODO(Miami)
|
||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
|
||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
|
||||
@ -570,6 +568,7 @@ CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
|
||||
m_nMousePosY > y1 && m_nMousePosY < y2;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CMenuManager::CheckSliderMovement(int value)
|
||||
{
|
||||
@ -587,14 +586,27 @@ CMenuManager::CheckSliderMovement(int value)
|
||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||
break;
|
||||
case MENUACTION_MUSICVOLUME:
|
||||
m_PrefsMusicVolume += value * (128/32);
|
||||
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
|
||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||
m_PrefsMusicVolume += value * (128 / 32);
|
||||
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
|
||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||
}
|
||||
break;
|
||||
case MENUACTION_SFXVOLUME:
|
||||
m_PrefsSfxVolume += value * (128/32);
|
||||
m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
|
||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||
m_PrefsSfxVolume += value * (128 / 32);
|
||||
m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
|
||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||
}
|
||||
break;
|
||||
case MENUACTION_MP3VOLUMEBOOST:
|
||||
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||
m_PrefsMP3BoostVolume += value * (128 / 32);
|
||||
m_PrefsMP3BoostVolume = clamp(m_PrefsMP3BoostVolume, 0, 65);
|
||||
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENUACTION_MOUSESENS:
|
||||
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
|
||||
@ -1065,20 +1077,17 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
|
||||
else if (m_nPrefsAudio3DProviderIndex == -1)
|
||||
rightText = TheText.Get("FEA_ADP");
|
||||
else {
|
||||
char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
||||
if (provider != NULL) {
|
||||
if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
|
||||
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
|
||||
}
|
||||
else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
|
||||
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
|
||||
}
|
||||
AsciiToUnicode(provider, unicodeTemp);
|
||||
rightText = unicodeTemp;
|
||||
}
|
||||
else {
|
||||
rightText = TheText.Get("not defined");
|
||||
char *rawProvider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
||||
AsciiToUnicode(rawProvider, unicodeTemp);
|
||||
char *provider = UnicodeToAscii(unicodeTemp); // genius
|
||||
strupr(provider);
|
||||
if (!strcmp(provider, "DIRECTSOUND3D HARDWARE SUPPORT")) {
|
||||
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
|
||||
} else if (!strcmp(provider, "DIRECTSOUND3D SOFTWARE EMULATION")) {
|
||||
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
|
||||
}
|
||||
AsciiToUnicode(provider, unicodeTemp);
|
||||
rightText = unicodeTemp;
|
||||
}
|
||||
break;
|
||||
case MENUACTION_SPEAKERCONF: {
|
||||
@ -4007,6 +4016,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||
if (selectedProvider != NO_AUDIO_PROVIDER) {
|
||||
if (selectedProvider == -1)
|
||||
selectedProvider = m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders();
|
||||
|
||||
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
|
||||
if (selectedProvider != m_nPrefsAudio3DProviderIndex) {
|
||||
SetHelperText(5);
|
||||
@ -4039,7 +4049,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||
m_PrefsMP3BoostVolume = 0;
|
||||
m_PrefsStereoMono = 1;
|
||||
m_PrefsSpeakers = 0;
|
||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); // TODO(Miami)
|
||||
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||
DMAudio.SetRadioInCar(m_PrefsRadioStation);
|
||||
@ -4180,11 +4190,36 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||
break;
|
||||
#endif
|
||||
case MENUACTION_AUDIOHW:
|
||||
// TODO(Miami): What are the extra things in here??
|
||||
|
||||
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
|
||||
|
||||
bool checkIfForbidden = true;
|
||||
while (checkIfForbidden) {
|
||||
checkIfForbidden = false;
|
||||
|
||||
if (m_nPrefsAudio3DProviderIndex < -1)
|
||||
m_nPrefsAudio3DProviderIndex = DMAudio.GetNum3DProvidersAvailable() - 1;
|
||||
else if (m_nPrefsAudio3DProviderIndex > DMAudio.GetNum3DProvidersAvailable() - 1)
|
||||
m_nPrefsAudio3DProviderIndex = -1;
|
||||
|
||||
// what a retarded move...
|
||||
if (m_nPrefsAudio3DProviderIndex != -1) {
|
||||
char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
||||
strupr(provider);
|
||||
if (!strcmp(provider, "MILES FAST 2D POSITIONAL AUDIO")) {
|
||||
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||
checkIfForbidden = true;
|
||||
|
||||
} else if (!strcmp(provider, "AUREAL A3D 2.0 (TM)")) {
|
||||
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||
checkIfForbidden = true;
|
||||
|
||||
} else if (!strcmp(provider, "AUREAL A3D INTERACTIVE (TM)")) {
|
||||
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||
checkIfForbidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENUACTION_SPEAKERCONF:
|
||||
|
@ -633,14 +633,17 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
INITSAVEBUF
|
||||
int i;
|
||||
|
||||
#define CZONE_SAVE_SIZE (sizeof(char)*8+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(eZoneType)+sizeof(eLevelName)+sizeof(int16)+sizeof(int16)+sizeof(int32)+sizeof(int32)+sizeof(int32))
|
||||
|
||||
*size = SAVE_HEADER_SIZE
|
||||
+ sizeof(m_CurrLevel) + sizeof(FindIndex)
|
||||
+ sizeof(int16) // padding
|
||||
+ sizeof(NavigationZoneArray) + sizeof(InfoZoneArray) + sizeof(ZoneInfoArray)
|
||||
+ CZONE_SAVE_SIZE * ARRAY_SIZE(NavigationZoneArray) + CZONE_SAVE_SIZE * ARRAY_SIZE(InfoZoneArray) + sizeof(ZoneInfoArray)
|
||||
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
|
||||
+ sizeof(int16) // padding
|
||||
+ sizeof(MapZoneArray) + sizeof(AudioZoneArray)
|
||||
+ CZONE_SAVE_SIZE * ARRAY_SIZE(MapZoneArray) + sizeof(AudioZoneArray)
|
||||
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
|
||||
#undef CZONE_SAVE_SIZE
|
||||
|
||||
uint32 length = 0;
|
||||
WriteSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
||||
|
@ -315,9 +315,7 @@ enum Config {
|
||||
#define FREE_CAM // Rotating cam
|
||||
|
||||
// Audio
|
||||
#ifndef AUDIO_OAL // is not working yet for openal
|
||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#endif
|
||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
||||
|
||||
|
||||
|
@ -27,13 +27,28 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
|
||||
#ifndef _WIN32
|
||||
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||
char newpathname[32];
|
||||
|
||||
strncpy(newpathname, pathname, 32);
|
||||
char* path = strtok(newpathname, "\\*");
|
||||
char* path = strtok(newpathname, "*");
|
||||
|
||||
// Case-sensitivity and backslashes...
|
||||
char *real = casepath(path);
|
||||
if (real) {
|
||||
real[strlen(real)] = '*';
|
||||
char *extension = strtok(NULL, "*");
|
||||
if (extension)
|
||||
strcat(real, extension);
|
||||
|
||||
strncpy(newpathname, real, 32);
|
||||
free(real);
|
||||
path = strtok(newpathname, "*");
|
||||
}
|
||||
|
||||
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
||||
|
||||
// Both w/ extension and w/o extension is ok
|
||||
if (strlen(path) + 2 != strlen(pathname))
|
||||
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
|
||||
if (strlen(path) + 1 != strlen(pathname))
|
||||
strncpy(firstfile->extension, strtok(NULL, "*"), sizeof(firstfile->extension));
|
||||
else
|
||||
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
||||
|
||||
@ -52,8 +67,8 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
|
||||
while ((file = readdir((DIR*)d)) != NULL) {
|
||||
|
||||
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG) &&
|
||||
(extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
||||
(extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
|
||||
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
||||
realpath(relativepath, path);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "skeleton.h"
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
// --MIAMI: file done
|
||||
|
||||
static RwBool DefaultVideoMode = TRUE;
|
||||
|
||||
@ -371,8 +371,8 @@ RsRwInitialize(void *displayID)
|
||||
|
||||
psNativeTextureSupport();
|
||||
|
||||
RwTextureSetAutoMipmapping(TRUE);
|
||||
RwTextureSetMipmapping(FALSE);
|
||||
RwTextureSetAutoMipmapping(FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user