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

cAudioManager::ProcessPedOneShots + fixes

This commit is contained in:
Sergeanur 2020-11-23 00:00:53 +02:00
parent a259b6b8ab
commit 43d5831394
7 changed files with 692 additions and 440 deletions

File diff suppressed because it is too large Load diff

View file

@ -167,7 +167,7 @@ cAudioManager::SetEntityStatus(int32 id, uint8 status)
} }
void void
cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
{ {
static const uint8 OneShotPriority[] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 2, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 1, 4, 4, 4, 3, 1, 1, 1, 1, 1, static const uint8 OneShotPriority[] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 2, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 1, 4, 4, 4, 3, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 3, 4, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 3, 4, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0,

View file

@ -390,7 +390,7 @@ public:
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; //done bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; //done
void PlayLoadedMissionAudio(uint8 slot); // done void PlayLoadedMissionAudio(uint8 slot); // done
void PlayOneShot(int32 index, int16 sound, float vol); // done void PlayOneShot(int32 index, uint16 sound, float vol); // done
void PlaySuspectLastSeen(float x, float y, float z); // done void PlaySuspectLastSeen(float x, float y, float z); // done
void PlayerJustGotInCar() const; // done void PlayerJustGotInCar() const; // done
void PlayerJustLeftCar() const; // done void PlayerJustLeftCar() const; // done
@ -435,7 +435,7 @@ public:
void ProcessModelVehicle(cVehicleParams& params); // done void ProcessModelVehicle(cVehicleParams& params); // done
void ProcessOneShotScriptObject(uint8 sound); // void ProcessOneShotScriptObject(uint8 sound); //
void ProcessPed(CPhysical *ped); // done void ProcessPed(CPhysical *ped); // done
void ProcessPedOneShots(cPedParams *params); // void ProcessPedOneShots(cPedParams &params); //
void ProcessPhysical(int32 id); // done void ProcessPhysical(int32 id); // done
void ProcessPlane(cVehicleParams& params); // done void ProcessPlane(cVehicleParams& params); // done
void ProcessPlayerMood(); // done void ProcessPlayerMood(); // done
@ -500,7 +500,7 @@ public:
bool SetupJumboRumbleSound(uint8 emittingVol); bool SetupJumboRumbleSound(uint8 emittingVol);
bool SetupJumboTaxiSound(uint8 vol); bool SetupJumboTaxiSound(uint8 vol);
bool SetupJumboWhineSound(uint8 emittingVol, uint32 freq); bool SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
void SetupPedComments(cPedParams *params, uint32 sound); // done void SetupPedComments(cPedParams &params, uint16 sound); // done
void SetupSuspectLastSeenReport(); void SetupSuspectLastSeenReport();
void Terminate(); //done void Terminate(); //done

View file

@ -201,7 +201,7 @@ enum eSound : uint16
SOUND_FRONTEND_AUDIO_TEST, SOUND_FRONTEND_AUDIO_TEST,
SOUND_INJURED_PED_MALE_OUCH, SOUND_INJURED_PED_MALE_OUCH,
SOUND_INJURED_PED_FEMALE, SOUND_INJURED_PED_FEMALE,
SOUND_SET_202, SOUND_SHIRT_WIND_FLAP,
SOUND_SET_203, SOUND_SET_203,
SOUND_TOTAL_SOUNDS = 204, SOUND_TOTAL_SOUNDS = 204,
SOUND_NO_SOUND = 205, SOUND_NO_SOUND = 205,

View file

@ -4887,7 +4887,7 @@ CPed::PreRender(void)
fWindMult = DotProduct(m_pMyVehicle->m_vecMoveSpeed, GetForward()); fWindMult = DotProduct(m_pMyVehicle->m_vecMoveSpeed, GetForward());
if (fWindMult > 0.4f) { if (fWindMult > 0.4f) {
float volume = (fWindMult - 0.4f) / 0.6f; float volume = (fWindMult - 0.4f) / 0.6f;
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SET_202, volume); //TODO(MIAMI): revise when audio is done DMAudio.PlayOneShot(m_audioEntityId, SOUND_SHIRT_WIND_FLAP, volume);
} }
} }

View file

@ -28,9 +28,6 @@
//--MIAMI: file done except TODOs //--MIAMI: file done except TODOs
// TODO(Miami)
#define AUDIO_NOT_READY
uint16 nPlayerInComboMove; uint16 nPlayerInComboMove;
RpClump* flyingClumpTemp; RpClump* flyingClumpTemp;
@ -875,23 +872,14 @@ CPed::Attack(void)
} }
switch (ourWeapon->m_AnimToPlay) { switch (ourWeapon->m_AnimToPlay) {
case ASSOCGRP_UNARMED: case ASSOCGRP_UNARMED:
if (weaponAnimAssoc->animId == ANIM_MELEE_ATTACK || weaponAnimAssoc->animId == ANIM_MELEE_ATTACK_START) { if (weaponAnimAssoc->animId == ANIM_MELEE_ATTACK || weaponAnimAssoc->animId == ANIM_MELEE_ATTACK_START)
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_46, 0.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_46, (damagerType | (ourWeaponType << 8))); DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_46, (damagerType | (ourWeaponType << 8)));
#endif
}
break; break;
case ASSOCGRP_KNIFE: case ASSOCGRP_KNIFE:
case ASSOCGRP_BASEBALLBAT: case ASSOCGRP_BASEBALLBAT:
case ASSOCGRP_GOLFCLUB: case ASSOCGRP_GOLFCLUB:
case ASSOCGRP_CHAINSAW: case ASSOCGRP_CHAINSAW:
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, (damagerType | (ourWeaponType << 8))); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, (damagerType | (ourWeaponType << 8)));
#endif
break; break;
default: default:
break; break;
@ -1003,11 +991,7 @@ CPed::Attack(void)
bIsAttacking = false; bIsAttacking = false;
bIsPointingGunAt = false; bIsPointingGunAt = false;
m_shootTimer = CTimer::GetTimeInMilliseconds(); m_shootTimer = CTimer::GetTimeInMilliseconds();
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
#endif
return; return;
} }
} }
@ -1052,14 +1036,8 @@ CPed::Attack(void)
ClearAimFlag(); ClearAimFlag();
// Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading) // Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd) { if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd)
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, ourWeaponType); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, ourWeaponType);
#endif
}
// Fun fact: removing this part leds to reloading flamethrower // Fun fact: removing this part leds to reloading flamethrower
if (ourWeaponType == WEAPONTYPE_FLAMETHROWER && weaponAnimAssoc->IsRunning()) { if (ourWeaponType == WEAPONTYPE_FLAMETHROWER && weaponAnimAssoc->IsRunning()) {

View file

@ -36,9 +36,6 @@
#include "Sprite.h" #include "Sprite.h"
#include "Pickups.h" #include "Pickups.h"
// TODO(Miami)
#define AUDIO_NOT_READY
float fReloadAnimSampleFraction[5] = { 0.5f, 0.7f, 0.75f, 0.75f, 0.7f }; float fReloadAnimSampleFraction[5] = { 0.5f, 0.7f, 0.75f, 0.75f, 0.7f };
float fSeaSparrowAimingAngle = 10.0f; float fSeaSparrowAimingAngle = 10.0f;
float fHunterAimingAngle = 30.0f; float fHunterAimingAngle = 30.0f;
@ -2899,26 +2896,15 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound)
default: default:
break; break;
} }
if (reloadAssoc->GetProgress() >= soundStart && (reloadAssoc->currentTime - reloadAssoc->timeStep) / reloadAssoc->hierarchy->totalLength < soundStart) { if (reloadAssoc->GetProgress() >= soundStart && (reloadAssoc->currentTime - reloadAssoc->timeStep) / reloadAssoc->hierarchy->totalLength < soundStart)
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f);
#else
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, m_eWeaponType); DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, m_eWeaponType);
#endif
}
if (CTimer::GetTimeInMilliseconds() > m_nTimer && reloadAssoc->GetProgress() < 0.9f) { if (CTimer::GetTimeInMilliseconds() > m_nTimer && reloadAssoc->GetProgress() < 0.9f) {
m_nTimer = CTimer::GetTimeInMilliseconds(); m_nTimer = CTimer::GetTimeInMilliseconds();
} }
} else { } else {
uint32 timePassed = m_nTimer - CWeaponInfo::ms_aReloadSampleTime[m_eWeaponType]; uint32 timePassed = m_nTimer - CWeaponInfo::ms_aReloadSampleTime[m_eWeaponType];
if (CTimer::GetPreviousTimeInMilliseconds() < timePassed && CTimer::GetTimeInMilliseconds() >= timePassed) if (CTimer::GetPreviousTimeInMilliseconds() < timePassed && CTimer::GetTimeInMilliseconds() >= timePassed)
{
#ifdef AUDIO_NOT_READY
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f);
#else
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, m_eWeaponType); DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, m_eWeaponType);
#endif
}
} }
} }