This commit is contained in:
Nikolay Korolev 2021-07-24 00:47:04 +03:00
parent a4b92fe9be
commit a7e673c2ec
75 changed files with 277 additions and 66 deletions

View File

@ -13,7 +13,7 @@
"src/modelinfo", "src/modelinfo",
"src/objects", "src/objects",
"src/peds", "src/peds",
"src/render", "src/renderer",
"src/rw", "src/rw",
"src/save", "src/save",
"src/skel", "src/skel",

View File

@ -187,7 +187,7 @@
</SETTING> </SETTING>
<SETTING> <SETTING>
<SETTING><NAME>SearchPath</NAME> <SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>..\src\render</VALUE></SETTING> <SETTING><NAME>Path</NAME><VALUE>..\src\renderer</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING> <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING> <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING> </SETTING>
@ -6424,7 +6424,7 @@
</SETTING> </SETTING>
<SETTING> <SETTING>
<SETTING><NAME>SearchPath</NAME> <SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>..\src\render</VALUE></SETTING> <SETTING><NAME>Path</NAME><VALUE>..\src\renderer</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING> <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING> <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING> </SETTING>
@ -14281,7 +14281,7 @@
<PATHFORMAT>Windows</PATHFORMAT> <PATHFORMAT>Windows</PATHFORMAT>
</FILEREF> </FILEREF>
</GROUP> </GROUP>
<GROUP><NAME>render</NAME> <GROUP><NAME>renderer</NAME>
<FILEREF> <FILEREF>
<TARGETNAME>Debug</TARGETNAME> <TARGETNAME>Debug</TARGETNAME>
<PATHTYPE>Name</PATHTYPE> <PATHTYPE>Name</PATHTYPE>

View File

@ -264,7 +264,7 @@ project "re3"
files { addSrcFiles("src/modelinfo") } files { addSrcFiles("src/modelinfo") }
files { addSrcFiles("src/objects") } files { addSrcFiles("src/objects") }
files { addSrcFiles("src/peds") } files { addSrcFiles("src/peds") }
files { addSrcFiles("src/render") } files { addSrcFiles("src/renderer") }
files { addSrcFiles("src/rw") } files { addSrcFiles("src/rw") }
files { addSrcFiles("src/save") } files { addSrcFiles("src/save") }
files { addSrcFiles("src/skel") } files { addSrcFiles("src/skel") }
@ -293,7 +293,7 @@ project "re3"
includedirs { "src/modelinfo" } includedirs { "src/modelinfo" }
includedirs { "src/objects" } includedirs { "src/objects" }
includedirs { "src/peds" } includedirs { "src/peds" }
includedirs { "src/render" } includedirs { "src/renderer" }
includedirs { "src/rw" } includedirs { "src/rw" }
includedirs { "src/save/" } includedirs { "src/save/" }
includedirs { "src/skel/" } includedirs { "src/skel/" }

View File

@ -259,8 +259,8 @@ static char StreamedNameTable[][25] = {
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS", "AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"}; "AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
#else #else
#if defined(PS2_AUDIO_PATHS) #ifdef PS2_AUDIO_PATHS
static char StreamedNameTable[][25]= static char PS2StreamedNameTable[][25]=
{ {
"AUDIO\\MUSIC\\HEAD.VB", "AUDIO\\MUSIC\\HEAD.VB",
"AUDIO\\MUSIC\\CLASS.VB", "AUDIO\\MUSIC\\CLASS.VB",
@ -357,7 +357,110 @@ static char StreamedNameTable[][25]=
"AUDIO\\PHONE\\MT_PH4.VB", "AUDIO\\PHONE\\MT_PH4.VB",
"AUDIO\\MUSIC\\MISCOM.VB", "AUDIO\\MUSIC\\MISCOM.VB",
"AUDIO\\MUSIC\\END.VB", "AUDIO\\MUSIC\\END.VB",
#else "AUDIO\\lib_a1.WAV",
"AUDIO\\lib_a2.WAV",
"AUDIO\\lib_a.WAV",
"AUDIO\\lib_b.WAV",
"AUDIO\\lib_c.WAV",
"AUDIO\\lib_d.WAV",
"AUDIO\\l2_a.WAV",
"AUDIO\\j4t_1.WAV",
"AUDIO\\j4t_2.WAV",
"AUDIO\\j4t_3.WAV",
"AUDIO\\j4t_4.WAV",
"AUDIO\\j4_a.WAV",
"AUDIO\\j4_b.WAV",
"AUDIO\\j4_c.WAV",
"AUDIO\\j4_d.WAV",
"AUDIO\\j4_e.WAV",
"AUDIO\\j4_f.WAV",
"AUDIO\\j6_1.WAV",
"AUDIO\\j6_a.WAV",
"AUDIO\\j6_b.WAV",
"AUDIO\\j6_c.WAV",
"AUDIO\\j6_d.WAV",
"AUDIO\\t4_a.WAV",
"AUDIO\\s1_a.WAV",
"AUDIO\\s1_a1.WAV",
"AUDIO\\s1_b.WAV",
"AUDIO\\s1_c.WAV",
"AUDIO\\s1_c1.WAV",
"AUDIO\\s1_d.WAV",
"AUDIO\\s1_e.WAV",
"AUDIO\\s1_f.WAV",
"AUDIO\\s1_g.WAV",
"AUDIO\\s1_h.WAV",
"AUDIO\\s1_i.WAV",
"AUDIO\\s1_j.WAV",
"AUDIO\\s1_k.WAV",
"AUDIO\\s1_l.WAV",
"AUDIO\\s3_a.WAV",
"AUDIO\\s3_b.WAV",
"AUDIO\\el3_a.WAV",
"AUDIO\\mf1_a.WAV",
"AUDIO\\mf2_a.WAV",
"AUDIO\\mf3_a.WAV",
"AUDIO\\mf3_b.WAV",
"AUDIO\\mf3_b1.WAV",
"AUDIO\\mf3_c.WAV",
"AUDIO\\mf4_a.WAV",
"AUDIO\\mf4_b.WAV",
"AUDIO\\mf4_c.WAV",
"AUDIO\\a1_a.WAV",
"AUDIO\\a3_a.WAV",
"AUDIO\\a5_a.WAV",
"AUDIO\\a4_a.WAV",
"AUDIO\\a4_b.WAV",
"AUDIO\\a4_c.WAV",
"AUDIO\\a4_d.WAV",
"AUDIO\\k1_a.WAV",
"AUDIO\\k3_a.WAV",
"AUDIO\\r1_a.WAV",
"AUDIO\\r2_a.WAV",
"AUDIO\\r2_b.WAV",
"AUDIO\\r2_c.WAV",
"AUDIO\\r2_d.WAV",
"AUDIO\\r2_e.WAV",
"AUDIO\\r2_f.WAV",
"AUDIO\\r2_g.WAV",
"AUDIO\\r2_h.WAV",
"AUDIO\\r5_a.WAV",
"AUDIO\\r6_a.WAV",
"AUDIO\\r6_a1.WAV",
"AUDIO\\r6_b.WAV",
"AUDIO\\lo2_a.WAV",
"AUDIO\\lo6_a.WAV",
"AUDIO\\yd2_a.WAV",
"AUDIO\\yd2_b.WAV",
"AUDIO\\yd2_c.WAV",
"AUDIO\\yd2_c1.WAV",
"AUDIO\\yd2_d.WAV",
"AUDIO\\yd2_e.WAV",
"AUDIO\\yd2_f.WAV",
"AUDIO\\yd2_g.WAV",
"AUDIO\\yd2_h.WAV",
"AUDIO\\yd2_ass.WAV",
"AUDIO\\yd2_ok.WAV",
"AUDIO\\h5_a.WAV",
"AUDIO\\h5_b.WAV",
"AUDIO\\h5_c.WAV",
"AUDIO\\ammu_a.WAV",
"AUDIO\\ammu_b.WAV",
"AUDIO\\ammu_c.WAV",
"AUDIO\\door_1.WAV",
"AUDIO\\door_2.WAV",
"AUDIO\\door_3.WAV",
"AUDIO\\door_4.WAV",
"AUDIO\\door_5.WAV",
"AUDIO\\door_6.WAV",
"AUDIO\\t3_a.WAV",
"AUDIO\\t3_b.WAV",
"AUDIO\\t3_c.WAV",
"AUDIO\\k1_b.WAV",
"AUDIO\\cat1.WAV"
};
#endif
static char StreamedNameTable[][25] = static char StreamedNameTable[][25] =
{ {
"AUDIO\\HEAD.WAV", "AUDIO\\HEAD.WAV",
@ -455,7 +558,6 @@ static char StreamedNameTable[][25] =
"AUDIO\\MT_PH4.MP3", "AUDIO\\MT_PH4.MP3",
"AUDIO\\MISCOM.WAV", "AUDIO\\MISCOM.WAV",
"AUDIO\\END.MP3", "AUDIO\\END.MP3",
#endif
"AUDIO\\lib_a1.WAV", "AUDIO\\lib_a1.WAV",
"AUDIO\\lib_a2.WAV", "AUDIO\\lib_a2.WAV",
"AUDIO\\lib_a.WAV", "AUDIO\\lib_a.WAV",

View File

@ -992,11 +992,20 @@ cSampleManager::Initialise(void)
if ( GetDriveType(m_szCDRomRootPath) == DRIVE_CDROM ) if ( GetDriveType(m_szCDRomRootPath) == DRIVE_CDROM )
{ {
FILE *f;
#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[0]); strcat(filepath, PS2StreamedNameTable[0]);
f = fopen(filepath, "rb");
FILE *f = fopen(filepath, "rb");
if ( !f )
#endif
{
strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[0]);
f = fopen(filepath, "rb");
}
if ( f ) if ( f )
{ {
fclose(f); fclose(f);
@ -1005,11 +1014,20 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{ {
#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[i]); strcat(filepath, PS2StreamedNameTable[i]);
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0); mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
if ( !mp3Stream[0] )
#endif
{
strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[i]);
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
}
if ( mp3Stream[0] ) if ( mp3Stream[0] )
{ {
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL); AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
@ -1078,7 +1096,14 @@ cSampleManager::Initialise(void)
strcpy(_aHDDPath, m_szCDRomRootPath); strcpy(_aHDDPath, m_szCDRomRootPath);
rootpath[0] = '\0'; rootpath[0] = '\0';
FILE *f = fopen(StreamedNameTable[0], "rb"); FILE *f;
#ifdef PS2_AUDIO_PATHS
f = fopen(PS2StreamedNameTable[0], "rb");
if (!f)
#endif
f = fopen(StreamedNameTable[0], "rb");
if ( f ) if ( f )
{ {
@ -1086,11 +1111,20 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{ {
#ifdef PS2_AUDIO_PATHS
strcpy(filepath, rootpath); strcpy(filepath, rootpath);
strcat(filepath, StreamedNameTable[i]); strcat(filepath, PS2StreamedNameTable[i]);
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0); mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
if ( !mp3Stream[0] )
#endif
{
strcpy(filepath, rootpath);
strcat(filepath, StreamedNameTable[i]);
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
}
if ( mp3Stream[0] ) if ( mp3Stream[0] )
{ {
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL); AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
@ -1299,9 +1333,11 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
{ {
#if GTA_VERSION < GTA3_PC_STEAM && !defined(NO_CDCHECK) #if GTA_VERSION < GTA3_PC_STEAM && !defined(NO_CDCHECK)
char filepath[MAX_PATH]; char filepath[MAX_PATH];
FILE *f;
#ifdef PS2_AUDIO_PATHS
#if GTA_VERSION >= GTA3_PC_11 #if GTA_VERSION >= GTA3_PC_11
if (_bUseHDDAudio) if(_bUseHDDAudio)
strcpy(filepath, _aHDDPath); strcpy(filepath, _aHDDPath);
else else
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
@ -1309,10 +1345,25 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11 #endif // #if GTA_VERSION >= GTA3_PC_11
strcat(filepath, StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]); strcat(filepath, PS2StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
FILE *f = fopen(filepath, "rb"); f = fopen(filepath, "rb");
if ( !f )
#endif // PS2_AUDIO_PATHS
{
#if GTA_VERSION >= GTA3_PC_11
if (_bUseHDDAudio)
strcpy(filepath, _aHDDPath);
else
strcpy(filepath, m_szCDRomRootPath);
#else
strcpy(filepath, m_szCDRomRootPath);
#endif // #if GTA_VERSION >= GTA3_PC_11
strcat(filepath, StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
f = fopen(filepath, "rb");
}
if ( f ) if ( f )
{ {
fclose(f); fclose(f);
@ -2007,11 +2058,19 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
} }
char filepath[MAX_PATH]; char filepath[MAX_PATH];
#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_szCDRomRootPath); strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[nFile]); strcat(filepath, PS2StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0); mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
if ( !mp3Stream[nStream] )
#endif
{
strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
}
if ( mp3Stream[nStream] ) if ( mp3Stream[nStream] )
{ {
@ -2073,10 +2132,19 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
// Try to continue from previous song, if already started // Try to continue from previous song, if already started
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) { if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0; nFile = 0;
#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_szCDRomRootPath); strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]); strcat(filename, PS2StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0); mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( !mp3Stream[nStream] )
#endif
{
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] ) if ( mp3Stream[nStream] )
{ {
AIL_set_stream_loop_count(mp3Stream[nStream], 1); AIL_set_stream_loop_count(mp3Stream[nStream], 1);
@ -2120,10 +2188,19 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
{ {
nFile = 0; nFile = 0;
_bIsMp3Active = 0; _bIsMp3Active = 0;
#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_szCDRomRootPath); strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]); strcat(filename, PS2StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0); mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( !mp3Stream[nStream] )
#endif
{
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] ) if ( mp3Stream[nStream] )
{ {
AIL_set_stream_loop_count(mp3Stream[nStream], 1); AIL_set_stream_loop_count(mp3Stream[nStream], 1);
@ -2161,10 +2238,19 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
position = 0; position = 0;
nFile = 0; nFile = 0;
} }
#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_szCDRomRootPath); strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]); strcat(filename, PS2StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0); mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( !mp3Stream[nStream] )
#endif
{
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] ) if ( mp3Stream[nStream] )
{ {
AIL_set_stream_loop_count(mp3Stream[nStream], 1); AIL_set_stream_loop_count(mp3Stream[nStream], 1);

View File

@ -894,7 +894,11 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{ {
if ( aStream[0] && aStream[0]->Open(StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000) ) if(aStream[0] && (
#ifdef PS2_AUDIO_PATHS
aStream[0]->Open(PS2StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000) ||
#endif
aStream[0]->Open(StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000)))
{ {
uint32 tatalms = aStream[0]->GetLengthMS(); uint32 tatalms = aStream[0]->GetLengthMS();
aStream[0]->Close(); aStream[0]->Close();
@ -1601,8 +1605,6 @@ cSampleManager::StopChannel(uint32 nChannel)
void void
cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream) cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
{ {
char filename[MAX_PATH];
ASSERT( nStream < MAX_STREAMS ); ASSERT( nStream < MAX_STREAMS );
if ( nFile < TOTAL_STREAMED_SOUNDS ) if ( nFile < TOTAL_STREAMED_SOUNDS )
@ -1611,9 +1613,10 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
stream->Close(); stream->Close();
strcpy(filename, StreamedNameTable[nFile]); #ifdef PS2_AUDIO_PATHS
if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); #endif
stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
if ( !stream->Setup() ) if ( !stream->Setup() )
{ {
stream->Close(); stream->Close();
@ -1673,10 +1676,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
// Try to continue from previous song, if already started // Try to continue from previous song, if already started
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) { if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0; nFile = 0;
strcpy(filename, StreamedNameTable[nFile]);
CStream *stream = aStream[nStream]; CStream *stream = aStream[nStream];
stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); #ifdef PS2_AUDIO_PATHS
if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
#endif
stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
if ( stream->Setup() ) { if ( stream->Setup() ) {
if (position != 0) if (position != 0)
stream->SetPosMS(position); stream->SetPosMS(position);
@ -1725,10 +1729,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
{ {
nFile = 0; nFile = 0;
_bIsMp3Active = 0; _bIsMp3Active = 0;
strcpy(filename, StreamedNameTable[nFile]); CStream *stream = aStream[nStream];
#ifdef PS2_AUDIO_PATHS
CStream* stream = aStream[nStream]; if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); #endif
stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
if (stream->Setup()) { if (stream->Setup()) {
if (position != 0) if (position != 0)
@ -1768,11 +1773,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
position = 0; position = 0;
nFile = 0; nFile = 0;
} }
strcpy(filename, StreamedNameTable[nFile]);
CStream *stream = aStream[nStream]; CStream *stream = aStream[nStream];
#ifdef PS2_AUDIO_PATHS
aStream[nStream]->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
#endif
stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
if ( stream->Setup() ) { if ( stream->Setup() ) {
if (position != 0) if (position != 0)

View File

@ -2305,6 +2305,9 @@ void CGarages::Save(uint8 * buf, uint32 * size)
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); *size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#else #else
* size = 5484; * size = 5484;
#endif
#if !defined THIS_IS_STUPID && !defined FIX_GARAGE_SIZE && defined COMPATIBLE_SAVES
memset(buf + 5240, 0, *size - 5240); // garbage data is written otherwise
#endif #endif
CloseHideOutGaragesBeforeSave(); CloseHideOutGaragesBeforeSave();
WriteSaveBuf(buf, NumGarages); WriteSaveBuf(buf, NumGarages);

View File

@ -1771,20 +1771,12 @@ int scriptToLoad = 0;
int open_script() int open_script()
{ {
// glfwGetKey doesn't work because of CGame::Initialise is blocking
CPad::UpdatePads();
if (CPad::GetPad(0)->GetChar('G'))
scriptToLoad = 0;
if (CPad::GetPad(0)->GetChar('R'))
scriptToLoad = 1;
if (CPad::GetPad(0)->GetChar('D'))
scriptToLoad = 2;
switch (scriptToLoad) { switch (scriptToLoad) {
case 0: return CFileMgr::OpenFile("main.scm", "rb"); case 0: return CFileMgr::OpenFile("data\\main.scm", "rb");
case 1: return CFileMgr::OpenFile("main_freeroam.scm", "rb"); case 1: return CFileMgr::OpenFile("data\\main_freeroam.scm", "rb");
case 2: return CFileMgr::OpenFile("main_d.scm", "rb"); case 2: return CFileMgr::OpenFile("data\\main_d.scm", "rb");
} }
return CFileMgr::OpenFile("main.scm", "rb"); return CFileMgr::OpenFile("data\\main.scm", "rb");
} }
#endif #endif
@ -1800,10 +1792,16 @@ void CTheScripts::Init()
MissionCleanUp.Init(); MissionCleanUp.Init();
UpsideDownCars.Init(); UpsideDownCars.Init();
StuckCars.Init(); StuckCars.Init();
CFileMgr::SetDir("data");
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
// glfwGetKey doesn't work because of CGame::Initialise is blocking
CPad::UpdatePads();
if(CPad::GetPad(0)->GetChar('G')) scriptToLoad = 0;
if(CPad::GetPad(0)->GetChar('R')) scriptToLoad = 1;
if(CPad::GetPad(0)->GetChar('D')) scriptToLoad = 2;
int mainf = open_script(); int mainf = open_script();
#else #else
CFileMgr::SetDir("data");
int mainf = CFileMgr::OpenFile("main.scm", "rb"); int mainf = CFileMgr::OpenFile("main.scm", "rb");
#endif #endif
CFileMgr::Read(mainf, (char*)ScriptSpace, SIZE_MAIN_SCRIPT); CFileMgr::Read(mainf, (char*)ScriptSpace, SIZE_MAIN_SCRIPT);
@ -4392,7 +4390,11 @@ CTheScripts::SwitchToMission(int32 mission)
CTimer::Suspend(); CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[mission]; int offset = CTheScripts::MultiScriptArray[mission];
CFileMgr::ChangeDir("\\"); CFileMgr::ChangeDir("\\");
#ifdef USE_DEBUG_SCRIPT_LOADER
int handle = open_script();
#else
int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif
CFileMgr::Seek(handle, offset, 0); CFileMgr::Seek(handle, offset, 0);
CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT); CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
CFileMgr::CloseFile(handle); CFileMgr::CloseFile(handle);

View File

@ -591,5 +591,6 @@ void RetryMission(int, int);
#endif #endif
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
int open_script();
extern int scriptToLoad; extern int scriptToLoad;
#endif #endif

View File

@ -305,7 +305,11 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CTimer::Suspend(); CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
CFileMgr::ChangeDir("\\"); CFileMgr::ChangeDir("\\");
#ifdef USE_DEBUG_SCRIPT_LOADER
int handle = open_script();
#else
int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif
CFileMgr::Seek(handle, offset, 0); CFileMgr::Seek(handle, offset, 0);
CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT); CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
CFileMgr::CloseFile(handle); CFileMgr::CloseFile(handle);

View File

@ -396,7 +396,7 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
if (target) { if (target) {
if (target->IsPed()) { if (target->IsPed()) {
ped->m_pFire = fire; ped->m_pFire = fire;
if (target != (CVehicle *)FindPlayerPed()) { if (target != FindPlayerPed()) {
CVector2D pos = target->GetPosition(); CVector2D pos = target->GetPosition();
ped->SetFlee(pos, 10000); ped->SetFlee(pos, 10000);
ped->SetMoveAnim(); ped->SetMoveAnim();

View File

@ -259,7 +259,7 @@ enum Config {
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds. #define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
#define MORE_LANGUAGES // Add more translations to the game #define MORE_LANGUAGES // Add more translations to the game
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES #define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
@ -420,7 +420,7 @@ enum Config {
#define RADIO_SCROLL_TO_PREV_STATION #define RADIO_SCROLL_TO_PREV_STATION
#define AUDIO_CACHE #define AUDIO_CACHE
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally) #define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally)
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) #define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused #define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused

View File

@ -320,6 +320,14 @@ CPed::SetAttack(CEntity *victim)
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
} }
} }
#ifdef FIX_BUGS
// fix aiming for flamethrower while using PC controls
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER && TheCamera.Cams[0].Using3rdPersonMouseCam() && this == FindPlayerPed())
{
SetAimFlag(m_fRotationCur);
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
}
#endif
if (m_nPedState == PED_ATTACK) { if (m_nPedState == PED_ATTACK) {
bIsAttacking = true; bIsAttacking = true;
return; return;