Merge branch 'master' of github.com:GTAmodding/re3 into master

This commit is contained in:
Filip Gawin 2020-10-18 15:14:03 +02:00
commit 747fe7ab67
5 changed files with 38 additions and 16 deletions

View File

@ -813,7 +813,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int32 emittingVol; int32 emittingVol;
uint32 freq; uint32 freq;
float modificator; float multiplier;
int sampleFreq; int sampleFreq;
float velocity; float velocity;
@ -836,9 +836,9 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
freq = 6050 * emittingVol / 30 + 16000; freq = 6050 * emittingVol / 30 + 16000;
} else { } else {
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
modificator = m_sQueueSample.m_fDistance / 190.f; multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4); freq = (sampleFreq * multiplier) + ((3 * sampleFreq) / 4);
} }
m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
@ -866,7 +866,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
float relativeVelocity; float relativeVelocity;
int32 emittingVol; int32 emittingVol;
float modificator; float multiplier;
int freq; int freq;
float velChange; float velChange;
@ -886,9 +886,13 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeModificator = 3;
modificator = m_sQueueSample.m_fDistance / 6.f; #ifdef FIX_BUGS
multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
#else
multiplier = (m_sQueueSample.m_fDistance / 3.0f) * 0.5f;
#endif
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
m_sQueueSample.m_nFrequency = freq + freq * modificator; m_sQueueSample.m_nFrequency = freq + freq * multiplier;
m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@ -6459,17 +6463,25 @@ cAudioManager::ProcessFires(int32)
void void
cAudioManager::ProcessWaterCannon(int32) cAudioManager::ProcessWaterCannon(int32)
{ {
const float SOUND_INTENSITY = 900.0f; const float SOUND_INTENSITY = 30.0f;
for (int32 i = 0; i < NUM_WATERCANNONS; i++) { for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
if (CWaterCannons::aCannons[i].m_nId) { if (CWaterCannons::aCannons[i].m_nId) {
m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur]; m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SOUND_INTENSITY) { if (distSquared < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
#ifdef FIX_BUGS
m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
#else
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
#endif
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
#ifdef FIX_BUGS
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
#else
m_sQueueSample.m_fSoundIntensity = SQR(SOUND_INTENSITY);
#endif
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = 15591; m_sQueueSample.m_nFrequency = 15591;

View File

@ -628,7 +628,7 @@ CPickups::Update()
#ifdef CAMERA_PICKUP #ifdef CAMERA_PICKUP
if ( bPickUpcamActivated ) // taken from PS2 if ( bPickUpcamActivated ) // taken from PS2
{ {
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D(); float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
float mult; float mult;
if ( dist < 10.0f ) if ( dist < 10.0f )
mult = 1.0f - (dist / 10.0f ); mult = 1.0f - (dist / 10.0f );
@ -644,8 +644,7 @@ CPickups::Update()
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT); TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
} }
if ( FindPlayerVehicle() != pPlayerVehicle if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) ) || ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
{ {
TheCamera.RestoreWithJumpCut(); TheCamera.RestoreWithJumpCut();
@ -715,7 +714,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
CObject *object = (CObject*)entity; CObject *object = (CObject*)entity;
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) { if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance2D(pos, TheCamera.GetPosition());
const float MAXDIST = 12.0f; const float MAXDIST = 12.0f;
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) { if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
@ -746,7 +745,7 @@ void
CPickups::DoMineEffects(CEntity *entity) CPickups::DoMineEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f; const float MAXDIST = 20.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {
@ -765,7 +764,7 @@ void
CPickups::DoMoneyEffects(CEntity *entity) CPickups::DoMoneyEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f; const float MAXDIST = 20.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {
@ -784,7 +783,7 @@ void
CPickups::DoCollectableEffects(CEntity *entity) CPickups::DoCollectableEffects(CEntity *entity)
{ {
const CVector &pos = entity->GetPosition(); const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 14.0f; const float MAXDIST = 14.0f;
if (dist < MAXDIST) { if (dist < MAXDIST) {

View File

@ -2002,9 +2002,11 @@ void CTheScripts::Process()
case 4: case 4:
AllowMissionReplay = 5; AllowMissionReplay = 5;
RetryMission(0, 0); RetryMission(0, 0);
break;
case 6: case 6:
AllowMissionReplay = 7; AllowMissionReplay = 7;
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
break;
case 7: case 7:
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
AllowMissionReplay = 0; AllowMissionReplay = 0;

View File

@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
return (v2 - v1).Magnitude(); return (v2 - v1).Magnitude();
} }
inline float
Distance2D(const CVector &v1, const CVector &v2)
{
float x = v2.x - v1.x;
float y = v2.y - v1.y;
return Sqrt(x*x + y*y);
}
class CMatrix; class CMatrix;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec); CVector Multiply3x3(const CMatrix &mat, const CVector &vec);

View File

@ -847,7 +847,8 @@ bool IsThisJoystickBlacklisted(int i)
const char* joyname = glfwGetJoystickName(i); const char* joyname = glfwGetJoystickName(i);
if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0) if (gSelectedJoystickName[0] != '\0' &&
strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
return false; return false;
return true; return true;