1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 17:20:00 +00:00

Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-12-25 12:12:09 +03:00
commit 5f98b4fdca
10 changed files with 63 additions and 51 deletions

View file

@ -123,39 +123,39 @@ cAudioManager::PostInitialiseGameSpecificSetup()
{ {
m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager);
if (m_nFireAudioEntity >= 0) if (m_nFireAudioEntity >= 0)
SetEntityStatus(m_nFireAudioEntity, 1); SetEntityStatus(m_nFireAudioEntity, true);
m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1);
if (m_nCollisionEntity >= 0) if (m_nCollisionEntity >= 0)
SetEntityStatus(m_nCollisionEntity, 1); SetEntityStatus(m_nCollisionEntity, true);
m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1);
if (m_nFrontEndEntity >= 0) if (m_nFrontEndEntity >= 0)
SetEntityStatus(m_nFrontEndEntity, 1); SetEntityStatus(m_nFrontEndEntity, true);
m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1);
if (m_nProjectileEntity >= 0) if (m_nProjectileEntity >= 0)
SetEntityStatus(m_nProjectileEntity, 1); SetEntityStatus(m_nProjectileEntity, true);
m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1);
if (m_nWaterCannonEntity >= 0) if (m_nWaterCannonEntity >= 0)
SetEntityStatus(m_nWaterCannonEntity, 1); SetEntityStatus(m_nWaterCannonEntity, true);
m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
if (m_nPoliceChannelEntity >= 0) if (m_nPoliceChannelEntity >= 0)
SetEntityStatus(m_nPoliceChannelEntity, 1); SetEntityStatus(m_nPoliceChannelEntity, true);
#ifdef GTA_BRIDGE #ifdef GTA_BRIDGE
m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1); m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1);
if (m_nBridgeEntity >= 0) if (m_nBridgeEntity >= 0)
SetEntityStatus(m_nBridgeEntity, 1); SetEntityStatus(m_nBridgeEntity, true);
#endif // GTA_BRIDGE #endif // GTA_BRIDGE
m_nEscalatorEntity = CreateEntity(AUDIOTYPE_ESCALATOR, (void*)1); m_nEscalatorEntity = CreateEntity(AUDIOTYPE_ESCALATOR, (void*)1);
if (m_nEscalatorEntity >= 0) if (m_nEscalatorEntity >= 0)
SetEntityStatus(m_nEscalatorEntity, 1); SetEntityStatus(m_nEscalatorEntity, true);
m_nExtraSoundsEntity = CreateEntity(AUDIOTYPE_EXTRA_SOUNDS, (void*)1); m_nExtraSoundsEntity = CreateEntity(AUDIOTYPE_EXTRA_SOUNDS, (void*)1);
if (m_nExtraSoundsEntity >= 0) if (m_nExtraSoundsEntity >= 0)
SetEntityStatus(m_nExtraSoundsEntity, 1); SetEntityStatus(m_nExtraSoundsEntity, true);
m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE;
@ -261,7 +261,7 @@ cAudioManager::ProcessReverb() const
if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
for (uint32 i = 0; i < numChannels; i++) { for (uint32 i = 0; i < numChannels; i++) {
if (m_asActiveSamples[i].m_bReverbFlag) if (m_asActiveSamples[i].m_bReverbFlag)
SampleManager.SetChannelReverbFlag(i, 1); SampleManager.SetChannelReverbFlag(i, true);
} }
} }
} }
@ -350,7 +350,7 @@ cAudioManager::ProcessSpecial()
if (playerPed != nil) { if (playerPed != nil) {
if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) { if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) {
if (playerPed->EnteringCar()) { if (playerPed->EnteringCar()) {
if(!playerPed->bInVehicle&& CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) if(!playerPed->bInVehicle && CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil)
SampleManager.StopChannel(m_nActiveSamples); SampleManager.StopChannel(m_nActiveSamples);
} }
} }
@ -361,7 +361,7 @@ cAudioManager::ProcessSpecial()
void void
cAudioManager::ProcessEntity(int32 id) cAudioManager::ProcessEntity(int32 id)
{ {
if (m_asAudioEntities[id].m_nStatus != STATUS_PLAYER) { if (m_asAudioEntities[id].m_bStatus) {
m_sQueueSample.m_nEntityIndex = id; m_sQueueSample.m_nEntityIndex = id;
switch (m_asAudioEntities[id].m_nType) { switch (m_asAudioEntities[id].m_nType) {
case AUDIOTYPE_PHYSICAL: case AUDIOTYPE_PHYSICAL:
@ -2002,7 +2002,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
} }
} else { } else {
nCruising = 1; nCruising = 1;
params.m_pVehicle->bAudioChangingGear = true; goto PlayCruising;
}
}
} else {
PlayCruising:
bAccelSampleStopped = true; bAccelSampleStopped = true;
SampleManager.StopChannel(m_nActiveSamples); SampleManager.StopChannel(m_nActiveSamples);
if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn
@ -2016,27 +2020,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
freq = 27 * nCruising + freqModifier + 22050; freq = 27 * nCruising + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK) if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2; freq /= 2;
AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true);
} else {
nCruising = 0;
}
}
}
} else {
bAccelSampleStopped = true;
SampleManager.StopChannel(m_nActiveSamples);
if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn
&& !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) {
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) {
if (nCruising < 800)
++nCruising;
} else if (nCruising > 3) {
--nCruising;
}
freq = 27 * nCruising + freqModifier + 22050;
if (engineSoundType == SFX_BANK_TRUCK)
freq /= 2;
AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true);
} else { } else {
nCruising = 0; nCruising = 0;
} }
@ -2232,7 +2216,6 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
if (veh->m_modelIndex == MI_MRWHOOP) if (veh->m_modelIndex == MI_MRWHOOP)
return true; return true;
veh->m_nAlarmState;
if (veh->IsAlarmOn()) if (veh->IsAlarmOn())
return true; return true;
@ -4455,8 +4438,6 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_bRequireReflection = true; m_sQueueSample.m_bRequireReflection = true;
break; break;
} }
// TODO: breaks the game right now, probably needs AudioManager.cpp to be done first
/*
case SOUND_WEAPON_CHAINSAW_ATTACK: case SOUND_WEAPON_CHAINSAW_ATTACK:
if (FindVehicleOfPlayer()) if (FindVehicleOfPlayer())
continue; continue;
@ -4491,7 +4472,7 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
emittingVol = 100; emittingVol = 100;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_AFTER_ACCEL_13);
m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_nEmittingVolume = 100;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_bReleasingSoundFlag = false;
@ -4513,13 +4494,12 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
emittingVol = 100; emittingVol = 100;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopStartOffset(SFX_CAR_AFTER_ACCEL_13); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_AFTER_ACCEL_13);
m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_nEmittingVolume = 100;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_nReleasingVolumeDivider = 5;
break; break;
*/
case SOUND_WEAPON_SHOT_FIRED: case SOUND_WEAPON_SHOT_FIRED:
weapon = ped->GetWeapon(); weapon = ped->GetWeapon();
if (!weapon) if (!weapon)

View file

@ -128,7 +128,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
if (!m_asAudioEntities[i].m_bIsUsed) { if (!m_asAudioEntities[i].m_bIsUsed) {
m_asAudioEntities[i].m_bIsUsed = true; m_asAudioEntities[i].m_bIsUsed = true;
m_asAudioEntities[i].m_nStatus = 0; m_asAudioEntities[i].m_bStatus = false;
m_asAudioEntities[i].m_nType = type; m_asAudioEntities[i].m_nType = type;
m_asAudioEntities[i].m_pEntity = entity; m_asAudioEntities[i].m_pEntity = entity;
m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND;
@ -163,7 +163,7 @@ void
cAudioManager::SetEntityStatus(int32 id, uint8 status) cAudioManager::SetEntityStatus(int32 id, uint8 status)
{ {
if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed)
m_asAudioEntities[id].m_nStatus = status; m_asAudioEntities[id].m_bStatus = status;
} }
void void

View file

@ -49,7 +49,7 @@ public:
eAudioType m_nType; eAudioType m_nType;
void *m_pEntity; void *m_pEntity;
bool m_bIsUsed; bool m_bIsUsed;
uint8 m_nStatus; uint8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
float m_afVolume[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents; uint8 m_AudioEvents;

View file

@ -512,7 +512,7 @@ cMusicManager::ServiceGameMode()
gRetuneCounter = 0; gRetuneCounter = 0;
field_2 = false; field_2 = false;
} else if (ped) { } else if (ped) {
if (ped->m_objective != OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN && ped->m_objective != OBJ_55) { if(!ped->DyingOrDead()) {
#ifdef GTA_PC #ifdef GTA_PC
if (SampleManager.IsMP3RadioChannelAvailable() if (SampleManager.IsMP3RadioChannelAvailable()
&& vehicle->m_nRadioStation < USERTRACK && vehicle->m_nRadioStation < USERTRACK

View file

@ -67,7 +67,7 @@ cAudioManager::InitialisePoliceRadio()
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
SampleManager.SetChannelReverbFlag(policeChannel, 0); SampleManager.SetChannelReverbFlag(policeChannel, false);
gSpecialSuspectLastSeenReport = false; gSpecialSuspectLastSeenReport = false;
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
gMinTimeToNextReport[i] = m_FrameCounter; gMinTimeToNextReport[i] = m_FrameCounter;

View file

@ -152,7 +152,7 @@ void CGarages::Init(void)
} }
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1); hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
if (hGarages >= 0) if (hGarages >= 0)
DMAudio.SetEntityStatus(hGarages, 1); DMAudio.SetEntityStatus(hGarages, true);
} }
void CGarages::Shutdown(void) void CGarages::Shutdown(void)

View file

@ -1213,14 +1213,46 @@ void CPad::AddToCheatString(char c)
int Cheat_strncmp(char* sourceStr, char* origCheatStr) int Cheat_strncmp(char* sourceStr, char* origCheatStr)
{ {
char cheatCodeVals[] = { 3,5,7,1,13,27,3,7,1,11,13,8,7,32,13,6,28,19,10,3,3,5,7,1,13,27,3,7 }; #define ccmp(n) if((uint8)sourceStr[i] != (uint8)origCheatStr[i] - n) return 1;
int i = 0;
for (uint32 i = 0; i < strlen(origCheatStr); i++) { while(origCheatStr[i])
if ((sourceStr[i] != origCheatStr[i] - cheatCodeVals[i]) || i >= ARRAY_SIZE(cheatCodeVals)) { {
return 1; switch(i)
{
case 0: ccmp(3); break;
case 1: ccmp(5); break;
case 2: ccmp(7); break;
case 3: ccmp(1); break;
case 4: ccmp(13); break;
case 5: ccmp(27); break;
case 6: ccmp(3); break;
case 7: ccmp(7); break;
case 8: ccmp(1); break;
case 9: ccmp(11); break;
case 10: ccmp(13); break;
case 11: ccmp(8); break;
case 12: ccmp(7); break;
case 13: ccmp(32); break;
case 14: ccmp(13); break;
case 15: ccmp(6); break;
case 16: ccmp(28); break;
case 17: ccmp(19); break;
case 18: ccmp(10); break;
case 19: ccmp(3); break;
case 20: ccmp(3); break;
case 21: ccmp(5); break;
case 22: ccmp(7); break;
case 23: ccmp(1); break;
case 24: ccmp(13); break;
case 25: ccmp(27); break;
case 26: ccmp(3); break;
case 27: ccmp(7); break;
default: return 1;
} }
i++;
} }
return 0; return 0;
#undef ccmp
} }
// TODO(Miami): Mobile has changed some of the cheats to include debugging things // TODO(Miami): Mobile has changed some of the cheats to include debugging things

View file

@ -15,7 +15,7 @@ struct MenuEntry
Menu *menu; Menu *menu;
MenuEntry(const char *name); MenuEntry(const char *name);
virtual ~MenuEntry(void) {} virtual ~MenuEntry(void) { free((void*)name); }
}; };
typedef MenuEntry DebugMenuEntry; typedef MenuEntry DebugMenuEntry;

View file

@ -319,7 +319,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bCanGiveUpSunbathing = true; bCanGiveUpSunbathing = true;
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
DMAudio.SetEntityStatus(m_audioEntityId, 1); DMAudio.SetEntityStatus(m_audioEntityId, true);
m_fearFlags = CPedType::GetThreats(m_nPedType); m_fearFlags = CPedType::GetThreats(m_nPedType);
m_threatEntity = nil; m_threatEntity = nil;
m_eventOrThreat = CVector2D(0.0f, 0.0f); m_eventOrThreat = CVector2D(0.0f, 0.0f);

View file

@ -139,7 +139,7 @@ void CWeather::Init(void)
ForcedWeatherType = WEATHER_RANDOM; ForcedWeatherType = WEATHER_RANDOM;
SoundHandle = DMAudio.CreateEntity(AUDIOTYPE_WEATHER, (void*)1); SoundHandle = DMAudio.CreateEntity(AUDIOTYPE_WEATHER, (void*)1);
if (SoundHandle >= 0) if (SoundHandle >= 0)
DMAudio.SetEntityStatus(SoundHandle, 1); DMAudio.SetEntityStatus(SoundHandle, true);
} }
void CWeather::Update(void) void CWeather::Update(void)