mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 14:52:30 +01:00
Bicycle on fire fix - SA 1.0
This commit is contained in:
parent
55a788025a
commit
6c6700bcef
4
SilentPatchSA/FireManagerSA.cpp
Normal file
4
SilentPatchSA/FireManagerSA.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "StdAfxSA.h"
|
||||||
|
#include "FireManagerSA.h"
|
||||||
|
|
||||||
|
void (CFireManager::*CFireManager::orgStartFire)( CEntity* entity, CEntity* attacker, float a3, uint8_t a4, uint32_t a5, int8_t a6 );
|
22
SilentPatchSA/FireManagerSA.h
Normal file
22
SilentPatchSA/FireManagerSA.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GeneralSA.h"
|
||||||
|
|
||||||
|
class CFireManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void (CFireManager::*orgStartFire)( CEntity* entity, CEntity* attacker, float a3, uint8_t a4, uint32_t a5, int8_t a6 );
|
||||||
|
|
||||||
|
void StartFire( CEntity* entity, CEntity* attacker, float a3, uint8_t a4, uint32_t a5, int8_t a6 )
|
||||||
|
{
|
||||||
|
(this->*orgStartFire)( entity, attacker, a3, a4, a5, a6 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartFire_NullEntityCheck( CEntity* entity, CEntity* attacker, float a3, uint8_t a4, uint32_t a5, int8_t a6 )
|
||||||
|
{
|
||||||
|
if ( entity != nullptr )
|
||||||
|
{
|
||||||
|
StartFire( entity, attacker, a3, a4, a5, a6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@ -14,6 +14,7 @@ static void* varRenderJetPack = AddressByVersion<void*>(0x67F6A0, 0x67FEC0, 0x6A
|
|||||||
WRAPPER void CTaskSimpleJetPack::RenderJetPack(CPed* pPed) { WRAPARG(pPed); VARJMP(varRenderJetPack); }
|
WRAPPER void CTaskSimpleJetPack::RenderJetPack(CPed* pPed) { WRAPARG(pPed); VARJMP(varRenderJetPack); }
|
||||||
|
|
||||||
void (CPed::*CPed::orgGiveWeapon)(uint32_t weapon, uint32_t ammo, bool flag);
|
void (CPed::*CPed::orgGiveWeapon)(uint32_t weapon, uint32_t ammo, bool flag);
|
||||||
|
void (CPlayerPed::*CPlayerPed::orgDoStuffToGoOnFire)();
|
||||||
|
|
||||||
RwObject* GetFirstObject(RwFrame* pFrame)
|
RwObject* GetFirstObject(RwFrame* pFrame)
|
||||||
{
|
{
|
||||||
|
@ -306,6 +306,9 @@ public:
|
|||||||
inline void SetTargetHeading(float fVal)
|
inline void SetTargetHeading(float fVal)
|
||||||
{ m_fTargetRotation = fVal; }
|
{ m_fTargetRotation = fVal; }
|
||||||
|
|
||||||
|
bool IsPlayer() const
|
||||||
|
{ return pedType == 0 || pedType == 1; }
|
||||||
|
|
||||||
unsigned char GetWeaponSkill();
|
unsigned char GetWeaponSkill();
|
||||||
void ResetGunFlashAlpha();
|
void ResetGunFlashAlpha();
|
||||||
void SetGunFlashAlpha(bool bSecondWeapon);
|
void SetGunFlashAlpha(bool bSecondWeapon);
|
||||||
@ -322,6 +325,14 @@ class NOVMT CPlayerPed : public CPed
|
|||||||
private:
|
private:
|
||||||
CPed* m_pMouseLockOnRecruitPed;
|
CPed* m_pMouseLockOnRecruitPed;
|
||||||
int m_iMouseLockOnRecruitTimer;
|
int m_iMouseLockOnRecruitTimer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void (CPlayerPed::*orgDoStuffToGoOnFire)();
|
||||||
|
|
||||||
|
void DoStuffToGoOnFire()
|
||||||
|
{
|
||||||
|
(this->*orgDoStuffToGoOnFire)();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPed) == 0x79C, "Wrong size: CPed");
|
static_assert(sizeof(CPed) == 0x79C, "Wrong size: CPed");
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "LinkListSA.h"
|
#include "LinkListSA.h"
|
||||||
#include "PNGFile.h"
|
#include "PNGFile.h"
|
||||||
#include "PlayerInfoSA.h"
|
#include "PlayerInfoSA.h"
|
||||||
|
#include "FireManagerSA.h"
|
||||||
|
|
||||||
#include "WaveDecoderSA.h"
|
#include "WaveDecoderSA.h"
|
||||||
#include "FLACDecoderSA.h"
|
#include "FLACDecoderSA.h"
|
||||||
@ -1394,6 +1395,23 @@ namespace Credits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============= Bicycle fire fix =============
|
||||||
|
namespace BicycleFire
|
||||||
|
{
|
||||||
|
CPed* GetVehicleDriver( const CVehicle* vehicle )
|
||||||
|
{
|
||||||
|
return vehicle->GetDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
void __fastcall DoStuffToGoOnFire_NullAndPlayerCheck( CPed* ped )
|
||||||
|
{
|
||||||
|
if ( ped != nullptr && ped->IsPlayer() )
|
||||||
|
{
|
||||||
|
static_cast<CPlayerPed*>(ped)->DoStuffToGoOnFire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
||||||
@ -3515,6 +3533,25 @@ void Patch_SA_10()
|
|||||||
CPed::orgGiveWeapon = *(decltype(CPed::orgGiveWeapon)*)&pGiveWeapon;
|
CPed::orgGiveWeapon = *(decltype(CPed::orgGiveWeapon)*)&pGiveWeapon;
|
||||||
InjectHook( 0x47D335, &CPed::GiveWeapon_SP );
|
InjectHook( 0x47D335, &CPed::GiveWeapon_SP );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixed bicycle on fire - instead of CJ being set on fire, bicycle's driver is
|
||||||
|
{
|
||||||
|
using namespace BicycleFire;
|
||||||
|
|
||||||
|
Patch( 0x53A984, { 0x90, 0x57 } );
|
||||||
|
Patch( 0x53A9A7, { 0x90, 0x57 } );
|
||||||
|
InjectHook( 0x53A986, GetVehicleDriver );
|
||||||
|
InjectHook( 0x53A9A9, GetVehicleDriver );
|
||||||
|
|
||||||
|
void* func;
|
||||||
|
ReadCall( 0x53A990, func );
|
||||||
|
CPlayerPed::orgDoStuffToGoOnFire = *(decltype(CPlayerPed::orgDoStuffToGoOnFire)*)&func;
|
||||||
|
InjectHook( 0x53A990, DoStuffToGoOnFire_NullAndPlayerCheck );
|
||||||
|
|
||||||
|
ReadCall( 0x53A9B7, func );
|
||||||
|
CFireManager::orgStartFire = *(decltype(CFireManager::orgStartFire)*)&func;
|
||||||
|
InjectHook( 0x53A9B7, &CFireManager::StartFire_NullEntityCheck );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_SA_11()
|
void Patch_SA_11()
|
||||||
|
@ -200,6 +200,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="AudioHardwareSA.cpp" />
|
<ClCompile Include="AudioHardwareSA.cpp" />
|
||||||
|
<ClCompile Include="FireManagerSA.cpp" />
|
||||||
<ClCompile Include="FLACDecoderSA.cpp" />
|
<ClCompile Include="FLACDecoderSA.cpp" />
|
||||||
<ClCompile Include="GeneralSA.cpp" />
|
<ClCompile Include="GeneralSA.cpp" />
|
||||||
<ClCompile Include="ModelInfoSA.cpp" />
|
<ClCompile Include="ModelInfoSA.cpp" />
|
||||||
@ -233,6 +234,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
|
|||||||
<ClInclude Include="..\SilentPatch\resource1.h" />
|
<ClInclude Include="..\SilentPatch\resource1.h" />
|
||||||
<ClInclude Include="..\SilentPatch\TheFLAUtils.h" />
|
<ClInclude Include="..\SilentPatch\TheFLAUtils.h" />
|
||||||
<ClInclude Include="AudioHardwareSA.h" />
|
<ClInclude Include="AudioHardwareSA.h" />
|
||||||
|
<ClInclude Include="FireManagerSA.h" />
|
||||||
<ClInclude Include="FLACDecoderSA.h" />
|
<ClInclude Include="FLACDecoderSA.h" />
|
||||||
<ClInclude Include="GeneralSA.h" />
|
<ClInclude Include="GeneralSA.h" />
|
||||||
<ClInclude Include="LinkListSA.h" />
|
<ClInclude Include="LinkListSA.h" />
|
||||||
|
@ -69,6 +69,9 @@
|
|||||||
<ClCompile Include="PlayerInfoSA.cpp">
|
<ClCompile Include="PlayerInfoSA.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="FireManagerSA.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
|
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
|
||||||
@ -161,6 +164,9 @@
|
|||||||
<ClInclude Include="PlayerInfoSA.h">
|
<ClInclude Include="PlayerInfoSA.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="FireManagerSA.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "GeneralSA.h"
|
#include "GeneralSA.h"
|
||||||
#include "ModelInfoSA.h"
|
#include "ModelInfoSA.h"
|
||||||
|
#include "PedSA.h"
|
||||||
|
|
||||||
enum eVehicleType
|
enum eVehicleType
|
||||||
{
|
{
|
||||||
@ -124,7 +125,10 @@ class NOVMT CVehicle : public CPhysical
|
|||||||
protected:
|
protected:
|
||||||
BYTE __pad1[752];
|
BYTE __pad1[752];
|
||||||
CVehicleFlags m_nVehicleFlags;
|
CVehicleFlags m_nVehicleFlags;
|
||||||
BYTE __pad2[108];
|
BYTE __pad2[48];
|
||||||
|
CPed* m_pDriver;
|
||||||
|
CPed* m_apPassengers[8];
|
||||||
|
BYTE __pad8[24];
|
||||||
float m_fGasPedal;
|
float m_fGasPedal;
|
||||||
float m_fBrakePedal;
|
float m_fBrakePedal;
|
||||||
uint8_t m_VehicleCreatedBy;
|
uint8_t m_VehicleCreatedBy;
|
||||||
@ -150,6 +154,8 @@ public:
|
|||||||
{ return pDamagingEntity; }
|
{ return pDamagingEntity; }
|
||||||
uint32_t GetClass() const
|
uint32_t GetClass() const
|
||||||
{ return m_dwVehicleClass; }
|
{ return m_dwVehicleClass; }
|
||||||
|
CPed* GetDriver() const
|
||||||
|
{ return m_pDriver;}
|
||||||
|
|
||||||
void SetBombOnBoard( uint32_t bombOnBoard )
|
void SetBombOnBoard( uint32_t bombOnBoard )
|
||||||
{ m_BombOnBoard = bombOnBoard; }
|
{ m_BombOnBoard = bombOnBoard; }
|
||||||
|
Loading…
Reference in New Issue
Block a user