From 76558e9313c481c39f40b2c73c4a3f68bf560d4e Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 19 Jul 2021 23:39:56 +0200 Subject: [PATCH 1/5] fix garbage data written in garage save block --- src/control/Garages.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index d7394902..34ed11eb 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2259,6 +2259,9 @@ void CGarages::Save(uint8 * buf, uint32 * size) //INITSAVEBUF *size = 7876; // for some reason it's not actual size again //*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); +#if !defined THIS_IS_STUPID && defined COMPATIBLE_SAVES + memset(buf + 7340, 0, *size - 7340); // garbage data is written otherwise +#endif CloseHideOutGaragesBeforeSave(); WriteSaveBuf(buf, NumGarages); WriteSaveBuf(buf, (uint32)BombsAreFree); From a1444b992f47ef058d0f270716d9b00791e80862 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 22 Jul 2021 07:01:04 +0300 Subject: [PATCH 2/5] Fix Predator shooting sound --- src/audio/AudioLogic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 5ee5ddd1..6c53eb10 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -2955,7 +2955,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) CPed *pPed = params.m_pVehicle->pDriver; if(!pPed) break; - if(!pPed->HasWeaponSlot(WEAPONSLOT_SUBMACHINEGUN)) { + if(!pPed->HasWeaponSlot(WEAPONSLOT_SUBMACHINEGUN) || (params.m_pVehicle->GetModelIndex() == MI_PREDATOR && !pPed->IsPedDoingDriveByShooting())) { sampleIndex = SFX_UZI_LEFT; frequency = SampleManager.GetSampleBaseFrequency(sampleIndex); frequency += RandomDisplacement(frequency / 32); From bbbe9b2632018ded5f455dfb12c3775907c70fc1 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 22 Jul 2021 07:06:54 +0300 Subject: [PATCH 3/5] Fix enum use --- src/weapons/Weapon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 36303c2c..d4cb1cbe 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -3182,7 +3182,7 @@ bool CPed::IsPedDoingDriveByShooting(void) { #ifdef FIX_BUGS - if (FindPlayerPed() == this && CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nWeaponSlot == 5) { + if (FindPlayerPed() == this && CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nWeaponSlot == WEAPONSLOT_SUBMACHINEGUN) { #else if (FindPlayerPed() == this && GetWeapon()->m_eWeaponType == WEAPONTYPE_UZI) { #endif From 953e4fc4ff96e9e2c180f74b36e3b591c979b1e2 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 22 Jul 2021 20:07:51 +0300 Subject: [PATCH 4/5] Fix falling damage --- src/peds/Ped.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index cad10d8a..b52d054c 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -3009,7 +3009,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) lowerSpeedLimit *= 1.5f; } CAnimBlendAssociation *fallAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_STD_FALL); - if (!bWasStanding && speed > upperSpeedLimit && (!bPushedAlongByCar || m_vecMoveSpeed.z < lowerSpeedLimit) + if (!bWasStanding && ((speed > upperSpeedLimit && !bPushedAlongByCar) || (m_vecMoveSpeed.z < lowerSpeedLimit)) && m_pCollidingEntity != collidingEnt) { float damage = 100.0f * Max(speed - 0.25f, 0.0f); From 5e34b1efcf4443124beece5ec97082da776df074 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 22 Jul 2021 07:26:19 +0300 Subject: [PATCH 5/5] Possible fix of RemoveAndAdd crash --- src/peds/Ped.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b52d054c..002cbe3b 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2362,12 +2362,12 @@ CPed::ProcessControl(void) } else { obstacleForFlyingOtherDirZ = 501.0f; } - uint8 flyDir = 0; + int16 flyDir = 0; float feetZ = GetPosition().z - FEET_OFFSET; #ifdef FIX_BUGS - if (obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ < 501.0f) + if (obstacleForFlyingZ > feetZ && obstacleForFlyingZ < 500.0f) flyDir = 1; - else if (obstacleForFlyingOtherDirZ > feetZ && obstacleForFlyingZ < 500.0f) + else if (obstacleForFlyingOtherDirZ > feetZ && obstacleForFlyingOtherDirZ < 501.0f) flyDir = 2; #else if ((obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ < 500.0f) || (obstacleForFlyingZ > feetZ && obstacleForFlyingOtherDirZ > feetZ)) @@ -2376,8 +2376,8 @@ CPed::ProcessControl(void) flyDir = 2; #endif - if (flyDir != 0 && !bHeadStuckInCollision) { - SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point)); + if (flyDir > 0 && !bHeadStuckInCollision) { + GetMatrix().SetTranslateOnly(flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point); GetMatrix().GetPosition().z += FEET_OFFSET; GetMatrix().UpdateRW(); SetLanding();