From daed13485ef47d9c8992e53e1a976fba237fca50 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 15 Apr 2020 08:03:53 +0300 Subject: CWeapon done, ps2 cheats fix --- src/audio/AudioManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio') diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 910ffcaf..40aabcfc 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -117,7 +117,7 @@ enum eScriptSounds : int16 SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106, SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107, SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108, - SCRIPT_SOUND_109 = 109, + SCRIPT_SOUND_BULLET_HIT_WATER = 109, //no sound SCRIPT_SOUND_110 = 110, SCRIPT_SOUND_111 = 111, SCRIPT_SOUND_PAYPHONE_RINGING = 112, -- cgit v1.2.3 From 90be379bede299aa53bca5027ecc19c356e50f86 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 15 Apr 2020 14:05:24 +0200 Subject: implemented most of librw wrapper --- src/audio/AudioManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/audio') diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 1d2835cf..f99891ec 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "common.h" #include "patcher.h" #include "audio_enums.h" @@ -6269,7 +6269,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) emittingVol = 10; veh = (CAutomobile *)ped->m_pMyVehicle; if(veh && veh->IsCar()) { - for(int32 i = 2; i < ARRAYSIZE(veh->Doors); i++) { + for(int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) { if(!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { emittingVol = 42; -- cgit v1.2.3 From c22e59abab331376cdc8557a863eb2584b4bef4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 16 Apr 2020 05:07:32 +0300 Subject: Various fixes --- src/audio/AudioManager.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/audio') diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 1d2835cf..246b1bda 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -9132,6 +9132,9 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) CVehicle *veh = params->m_pVehicle; if(veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) return; +#ifdef FIX_BUGS + if (params->m_pVehicle->m_status == STATUS_WRECKED) return; +#endif CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_bVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_bVolume) { -- cgit v1.2.3 From c1fcb7bd43fc1fd7e867e1e76f63d28e0ad7b8f1 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 16 Apr 2020 08:28:17 +0300 Subject: Removed refs from sampman --- src/audio/sampman.cpp | 98 ++++++++++++++++----------------------------------- src/audio/sampman.h | 4 +-- 2 files changed, 33 insertions(+), 69 deletions(-) (limited to 'src/audio') diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index 6edb6028..6dd744c3 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -17,9 +17,8 @@ #pragma comment( lib, "mss32.lib" ) -cSampleManager &SampleManager = *(cSampleManager *)0x7341E0; -extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS] = *(int32 (*)[MAX_SAMPLEBANKS])*(int *)0x6FAB70; - +cSampleManager SampleManager; +int32 BankStartOffset[MAX_SAMPLEBANKS]; /////////////////////////////////////////////////////////////// char SampleBankDescFilename[] = "AUDIO\\SFX.SDT"; @@ -116,7 +115,7 @@ typedef struct provider_stuff static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2) { - return(strcasecmp(s1->name, s2->name)); + return( _stricmp(s1->name,s2->name) ); } static void @@ -435,21 +434,17 @@ _FindMP3s(void) OutputDebugString("Resolving Link"); OutputDebugString(filepath); - if ( f ) - fprintf(f, " - shortcut to \"%s\"", filepath); + if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath); } else { - if ( f ) - fprintf(f, " - couldn't resolve shortcut"); + if ( f ) fprintf(f, " - couldn't resolve shortcut"); } bShortcut = true; } else - { bShortcut = false; - } } mp3Stream[0] = AIL_open_stream(DIG, filepath, 0); @@ -494,8 +489,7 @@ _FindMP3s(void) _pMP3List->pLinkPath = NULL; } - if ( f ) - fprintf(f, " - OK\n"); + if ( f ) fprintf(f, " - OK\n"); bInitFirstEntry = false; } @@ -505,8 +499,7 @@ _FindMP3s(void) OutputDebugString(filepath); - if ( f ) - fprintf(f, " - not an MP3 or supported MP3 type\n"); + if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n"); bInitFirstEntry = true; } @@ -514,17 +507,7 @@ _FindMP3s(void) while ( true ) { if ( !FindNextFile(hFind, &fd) ) - { - if ( f ) - { - fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s); - fclose(f); - } - - FindClose(hFind); - - return; - } + break; if ( bInitFirstEntry ) { @@ -533,8 +516,7 @@ _FindMP3s(void) int32 filepathlen = strlen(filepath); - if ( f ) - fprintf(f, "\"%s\"", fd.cFileName); + if ( f ) fprintf(f, "\"%s\"", fd.cFileName); if ( filepathlen > 0 ) { @@ -547,13 +529,11 @@ _FindMP3s(void) OutputDebugString("Resolving Link"); OutputDebugString(filepath); - if ( f ) - fprintf(f, " - shortcut to \"%s\"", filepath); + if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath); } else { - if ( f ) - fprintf(f, " - couldn't resolve shortcut"); + if ( f ) fprintf(f, " - couldn't resolve shortcut"); } bShortcut = true; @@ -564,8 +544,7 @@ _FindMP3s(void) if ( filepathlen > MAX_PATH ) { - if ( f ) - fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath); + if ( f ) fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath); continue; } @@ -585,15 +564,7 @@ _FindMP3s(void) _pMP3List = new tMP3Entry; if ( _pMP3List == NULL) - { - if ( f ) - { - fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s); - fclose(f); - } - FindClose(hFind); - return; - } + break; nNumMP3s = 1; @@ -614,8 +585,7 @@ _FindMP3s(void) pList = _pMP3List; - if ( f ) - fprintf(f, " - OK\n"); + if ( f ) fprintf(f, " - OK\n"); bInitFirstEntry = false; } @@ -624,8 +594,7 @@ _FindMP3s(void) strcat(filepath, " - NOT A VALID MP3"); OutputDebugString(filepath); - if ( f ) - fprintf(f, " - not an MP3 or supported MP3 type\n"); + if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n"); } } } @@ -638,8 +607,7 @@ _FindMP3s(void) if ( filepathlen > 0 ) { - if ( f ) - fprintf(f, "\"%s\"", fd.cFileName); + if ( f ) fprintf(f, "\"%s\"", fd.cFileName); if ( filepathlen > 4 ) { @@ -650,13 +618,11 @@ _FindMP3s(void) OutputDebugString("Resolving Link"); OutputDebugString(filepath); - if ( f ) - fprintf(f, " - shortcut to \"%s\"", filepath); + if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath); } else { - if ( f ) - fprintf(f, " - couldn't resolve shortcut"); + if ( f ) fprintf(f, " - couldn't resolve shortcut"); } bShortcut = true; @@ -679,16 +645,8 @@ _FindMP3s(void) tMP3Entry *e = pList->pNext; - if ( e == NULL) - { - if ( f ) - { - fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s); - fclose(f); - } - FindClose(hFind); - return; - } + if ( e == NULL ) + break; pList = pList->pNext; @@ -710,20 +668,26 @@ _FindMP3s(void) OutputDebugString(fd.cFileName); - if ( f ) - fprintf(f, " - OK\n"); + 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, " - not an MP3 or supported MP3 type\n"); } } } } + + if ( f ) + { + fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s); + fclose(f); + } + + FindClose(hFind); } static void @@ -2257,7 +2221,7 @@ cSampleManager::InitialiseSampleBanks(void) for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ ) { - if ( BankStartOffset[nBank] == BankStartOffset[0] + i ) + if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i ) { nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset; nBank++; diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 4b546911..4f3c3eeb 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -135,8 +135,8 @@ public: bool InitialiseSampleBanks(void); }; -extern cSampleManager &SampleManager; -extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS]; +extern cSampleManager SampleManager; +extern int32 BankStartOffset[MAX_SAMPLEBANKS]; static char StreamedNameTable[][25]= { -- cgit v1.2.3 From b1fc7bc533dc7d603daafbf8a158a92f710c1e60 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 16 Apr 2020 11:50:45 +0300 Subject: More refs removed --- src/audio/MusicManager.cpp | 8 ++++---- src/audio/MusicManager.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/audio') diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index d840c57b..d4b60d9b 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -15,10 +15,10 @@ #include "sampman.h" #include "patcher.h" -cMusicManager &MusicManager = *(cMusicManager *)0x8F3964; -int32 &gNumRetunePresses = *(int32 *)0x650B80; -int32 &gRetuneCounter = *(int32*)0x650B84; -bool& bHasStarted = *(bool*)0x650B7C; +cMusicManager MusicManager; +int32 gNumRetunePresses; +int32 gRetuneCounter; +bool bHasStarted; const int maxVolume = 127; diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 5c255069..5d6f41cf 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -86,4 +86,4 @@ public: static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error"); -extern cMusicManager &MusicManager; +extern cMusicManager MusicManager; -- cgit v1.2.3