Skip to content

Commit 79f247c

Browse files
committed
Fix vehicle radio sometimes won't play
(introduced in 4159728)
1 parent 2916061 commit 79f247c

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Client/game_sa/CAEVehicleAudioEntitySA.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ void CAEVehicleAudioEntitySA::JustGotOutOfVehicleAsDriver ( void )
4040
}
4141
}
4242

43+
void CAEVehicleAudioEntitySA::TurnOnRadioForVehicle ( void )
44+
{
45+
DWORD dwFunc = FUNC_CAEVehicleAudioEntity__TurnOnRadioForVehicle;
46+
DWORD dwThis = (DWORD) m_pInterface;
47+
_asm
48+
{
49+
mov ecx, dwThis
50+
call dwFunc
51+
}
52+
}
53+
4354
void CAEVehicleAudioEntitySA::StopVehicleEngineSound ( unsigned char ucSlot )
4455
{
4556
DWORD dwFunc = FUNC_CAESound__Stop;

Client/game_sa/CAEVehicleAudioEntitySA.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ class CAEVehicleAudioEntitySA : public CAEVehicleAudioEntity
256256
CAEVehicleAudioEntitySA ( CAEVehicleAudioEntitySAInterface * pInterface );
257257
void JustGotInVehicleAsDriver ( void );
258258
void JustGotOutOfVehicleAsDriver ( void );
259+
void TurnOnRadioForVehicle ( void );
259260
void StopVehicleEngineSound ( unsigned char ucSlot );
260261

261262
private:

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,11 @@ void CClientPed::WarpIntoVehicle ( CClientVehicle* pVehicle, unsigned int uiSeat
15151515
// Turn on the radio if local player and it's not already on.
15161516
if ( m_bIsLocalPlayer )
15171517
{
1518+
CVehicle* pGameVehicle = pVehicle->m_pVehicle;
1519+
if ( pGameVehicle )
1520+
{
1521+
pGameVehicle->GetVehicleAudioEntity ()->TurnOnRadioForVehicle ();
1522+
}
15181523
StartRadio ();
15191524
}
15201525

Client/sdk/game/CAEVehicleAudioEntity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ class CAEVehicleAudioEntity
3131
public:
3232
virtual void JustGotInVehicleAsDriver ( void ) = 0;
3333
virtual void JustGotOutOfVehicleAsDriver ( void ) = 0;
34+
virtual void TurnOnRadioForVehicle ( void ) = 0;
3435
};

0 commit comments

Comments
 (0)