Skip to content

Commit 9477487

Browse files
committed
Merge branch 'refactor-play-sound' of github.com:Pirulax/gta-reversed into refactor-play-sound
2 parents 0a5c6ba + 86b9ccc commit 9477487

File tree

11 files changed

+533
-436
lines changed

11 files changed

+533
-436
lines changed

source/game_sa/3dMarkers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include "3dMarkers.h"
44
#include "PostEffects.h"
55

6+
// RwIm3DVertex StreakVertices[4];
7+
RxObjSpace3DVertex* aRenderVertices = (RxObjSpace3DVertex*)0xC278F8;
8+
69
void C3dMarkers::InjectHooks() {
710
RH_ScopedClass(C3dMarkers);
811
RH_ScopedCategoryGlobal();

source/game_sa/Audio/entities/AEVehicleAudioEntity.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,7 +3702,7 @@ void CAEVehicleAudioEntity::ProcessPlayerSeaPlane(tVehicleParams& vp) {
37023702
// 0x4FF5F1
37033703
CalculatePlanePropFreq(vp, GetAircraftAcceleration(vp));
37043704

3705-
const auto propSpeed = veh->m_fPropSpeed / 0.22f;
3705+
const auto propSpeed = veh->m_EngineSpeed / 0.22f;
37063706
const auto camPoVFactor = GetAircraftCameraPoVFactor(veh);
37073707
const auto sf = GetDummyRCRotorSpeedFactor(propSpeed);
37083708
PlayAircraftSound( // 0x4FF74A
@@ -4137,14 +4137,14 @@ void CAEVehicleAudioEntity::ProcessBoatEngine(tVehicleParams& vp) {
41374137
}
41384138

41394139
// Engine speed factor
4140-
const auto es = std::clamp(boat->m_fPropSpeed * 3.f, 0.f, 1.f);
4140+
const auto es = std::clamp(boat->m_EngineSpeed * 3.f, 0.f, 1.f);
41414141

41424142
// 0x5004C7 - Calculate speed
41434143
{
41444144
const auto roll = std::min(1.f, 1.f - boat->GetUp().Dot(CVector::ZAxisVector()));
41454145
const auto speed = cfg->FrqEngineBase
41464146
+ roll * cfg->FrqEngineRollFactor
4147-
+ es * (boat->m_nBoatFlags.bOnWater ? cfg->FrqEngineOnWaterFactor : cfg->FrqEngineInAirFactor);
4147+
+ es * (boat->m_nBoatFlags.bBoatInWater ? cfg->FrqEngineOnWaterFactor : cfg->FrqEngineInAirFactor);
41484148
m_CurrentDummyEngineFrequency = m_CurrentDummyEngineFrequency >= 0.f
41494149
? notsa::step_to(m_CurrentDummyEngineFrequency, speed, 0.02f, notsa::bugfixes::GenericFrameRate)
41504150
: speed;
@@ -4176,7 +4176,7 @@ void CAEVehicleAudioEntity::ProcessBoatMovingOverWater(tVehicleParams& vp) {
41764176

41774177
const auto sf = std::min(0.75f, std::abs(vp.Speed)) / 0.75f;
41784178

4179-
auto volume = boat->m_nBoatFlags.bOnWater && sf >= 0.00001f
4179+
auto volume = boat->m_nBoatFlags.bBoatInWater && sf >= 0.00001f
41804180
? (m_AuSettings.IsSeaplane() ? cfg->VolBaseOfSeaplane : cfg->VolBase) + CAEAudioUtility::AudioLog10(sf) * 20.f
41814181
: -100.f;
41824182
auto speed = cfg->FrqBase + cfg->FrqSpeedFactor * sf;

source/game_sa/Camera.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void CCamera::InjectHooks() {
145145
RH_ScopedOverloadedInstall(ProcessVectorMoveLinear, "0", 0x50D430, void(CCamera::*)(float), { .reversed = false });
146146
RH_ScopedOverloadedInstall(ProcessVectorMoveLinear, "1", 0x5164A0, void(CCamera::*)(), { .reversed = false });
147147
RH_ScopedOverloadedInstall(ProcessFOVLerp, "0", 0x50D510, void(CCamera::*)(float), { .reversed = false });
148-
RH_ScopedOverloadedInstall(ProcessFOVLerp, "1", 0x516500, void(CCamera::*)(), { .reversed = false });
148+
RH_ScopedOverloadedInstall(ProcessFOVLerp, "1", 0x516500, void(CCamera::*)());
149149
//RH_ScopedOverloadedInstall(ProcessJiggle, "0", 0x516560, { .reversed = false });
150150

151151
RH_ScopedGlobalInstall(CamShakeNoPos, 0x50A970);
@@ -1465,7 +1465,11 @@ void CCamera::ProcessVectorMoveLinear(float ratio) {
14651465

14661466
// 0x516500
14671467
void CCamera::ProcessFOVLerp() {
1468-
plugin::CallMethod<0x516500, CCamera*>(this);
1468+
if (const auto now = static_cast<float>(CTimer::GetTimeInMS()); now <= m_fEndZoomTime) { /* Check if still processing */
1469+
ProcessFOVLerp(invLerp(m_fStartZoomTime, m_fEndZoomTime, now));
1470+
} else if (m_bBlockZoom) { /* Finished */
1471+
m_bFOVLerpProcessed = true;
1472+
}
14691473
}
14701474

14711475
// 0x50D510

source/game_sa/Entity/Vehicle/Automobile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ void CAutomobile::GetComponentWorldPosition(int32 componentId, CVector& outPos)
21422142
}
21432143

21442144
// 0x6A2250
2145-
bool CAutomobile::IsComponentPresent(int32 componentId)
2145+
bool CAutomobile::IsComponentPresent(int32 componentId) const
21462146
{
21472147
return m_aCarNodes[componentId] != 0;
21482148
}

source/game_sa/Entity/Vehicle/Automobile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class NOTSA_EXPORT_VTABLE CAutomobile : public CVehicle {
150150
void ProcessControlCollisionCheck(bool applySpeed) override;
151151
void ProcessControlInputs(uint8 playerNum) override;
152152
void GetComponentWorldPosition(int32 componentId, CVector& outPos) override;
153-
bool IsComponentPresent(int32 componentId) override;
153+
bool IsComponentPresent(int32 componentId) const override;
154154
void OpenDoor(CPed* ped, int32 componentId, eDoors door, float doorOpenRatio, bool playSound) override; // eCarNodes = componentId
155155

156156
//!!!!!!!!!!!!!!!!!!!

source/game_sa/Entity/Vehicle/Bike.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ class NOTSA_EXPORT_VTABLE CBike : public CVehicle {
125125
bool IsDoorClosedU32(uint32 door) override { return false; } // 0x6B5940
126126
bool IsDoorMissingU32(uint32 door) override { return true; } // 0x6B5950
127127

128-
bool IsRoomForPedToLeaveCar(uint32 door, CVector* pvecCarJackOffset) override { return true; } // 0x6B7270
129-
inline bool IsComponentPresent(int32 componentId) override { return m_aBikeNodes[componentId] != nullptr; } // 0x6B59E0
130-
CRideAnimData* GetRideAnimData() override { return &m_RideAnimData; } // 0x6B58C0
131-
float GetHeightAboveRoad() override { return m_fHeightAboveRoad; } // 0x6B58B0
132-
int32 GetNumContactWheels() override { return m_nNoOfContactWheels; } // 0x6B58A0
133-
float FindWheelWidth(bool bRear) override { return 0.15f; } // 0x6B8940
128+
bool IsRoomForPedToLeaveCar(uint32 door, CVector* pvecCarJackOffset) override { return true; } // 0x6B7270
129+
inline bool IsComponentPresent(int32 componentId) const override { return m_aBikeNodes[componentId] != nullptr; } // 0x6B59E0
130+
CRideAnimData* GetRideAnimData() override { return &m_RideAnimData; } // 0x6B58C0
131+
float GetHeightAboveRoad() override { return m_fHeightAboveRoad; } // 0x6B58B0
132+
int32 GetNumContactWheels() override { return m_nNoOfContactWheels; } // 0x6B58A0
133+
float FindWheelWidth(bool bRear) override { return 0.15f; } // 0x6B8940
134134

135135
virtual bool ProcessAI(uint32& extraHandlingFlags);
136136

0 commit comments

Comments
 (0)