mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Extra assertions added
Fixed bomb ownership/bombs saving for bikes - SA 1.0
This commit is contained in:
parent
a66876f85f
commit
258d1cccc9
4 changed files with 68 additions and 2 deletions
|
@ -76,6 +76,7 @@ void CObject::Render()
|
||||||
m_nCarColor[1].Get(), m_nCarColor[2].Get(), m_nCarColor[3].Get() );
|
m_nCarColor[1].Get(), m_nCarColor[2].Get(), m_nCarColor[3].Get() );
|
||||||
|
|
||||||
SetEditableMaterialsCB(reinterpret_cast<RpAtomic*>(m_pRwObject), &pData);
|
SetEditableMaterialsCB(reinterpret_cast<RpAtomic*>(m_pRwObject), &pData);
|
||||||
|
assert( pData >= std::begin(materialRestoreData) && pData < std::end(materialRestoreData) );
|
||||||
pData->first = nullptr;
|
pData->first = nullptr;
|
||||||
|
|
||||||
// Disable backface culling for the part
|
// Disable backface culling for the part
|
||||||
|
|
|
@ -3982,6 +3982,17 @@ void Patch_SA_10()
|
||||||
|
|
||||||
// Car generators placed in interiors visible everywhere
|
// Car generators placed in interiors visible everywhere
|
||||||
InjectHook( 0x6F3B30, &CEntity::SetPositionAndAreaCode );
|
InjectHook( 0x6F3B30, &CEntity::SetPositionAndAreaCode );
|
||||||
|
|
||||||
|
|
||||||
|
// Fixed bomb ownership/bombs saving for bikes
|
||||||
|
{
|
||||||
|
void* pRestoreCar;
|
||||||
|
ReadCall( 0x44856A, pRestoreCar );
|
||||||
|
CStoredCar::orgRestoreCar = *(decltype(CStoredCar::orgRestoreCar)*)&pRestoreCar;
|
||||||
|
InjectHook( 0x44856A, &CStoredCar::RestoreCar_SilentPatch );
|
||||||
|
InjectHook( 0x4485DB, &CStoredCar::RestoreCar_SilentPatch );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_SA_11()
|
void Patch_SA_11()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "VehicleSA.h"
|
#include "VehicleSA.h"
|
||||||
#include "TimerSA.h"
|
#include "TimerSA.h"
|
||||||
|
#include "PedSA.h"
|
||||||
#include "DelimStringReader.h"
|
#include "DelimStringReader.h"
|
||||||
|
|
||||||
static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f;
|
static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f;
|
||||||
|
@ -27,9 +28,12 @@ WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
|
||||||
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
|
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
|
||||||
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
|
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
|
||||||
|
|
||||||
|
auto FindPlayerPed = AddressByVersion<CPed*(*)(int)>( 0x56E210, 0, 0 ); // TODO: DO
|
||||||
|
|
||||||
void (CVehicle::*CVehicle::orgVehiclePreRender)();
|
void (CVehicle::*CVehicle::orgVehiclePreRender)();
|
||||||
void (CAutomobile::*CAutomobile::orgAutomobilePreRender)();
|
void (CAutomobile::*CAutomobile::orgAutomobilePreRender)();
|
||||||
void (CPlane::*CPlane::orgPlanePreRender)();
|
void (CPlane::*CPlane::orgPlanePreRender)();
|
||||||
|
CVehicle* (CStoredCar::*CStoredCar::orgRestoreCar)();
|
||||||
|
|
||||||
static int32_t random(int32_t from, int32_t to)
|
static int32_t random(int32_t from, int32_t to)
|
||||||
{
|
{
|
||||||
|
@ -457,4 +461,18 @@ void CAutomobile::ProcessNewsvan()
|
||||||
if ( m_fGunOrientation > 2.0f * PI ) m_fGunOrientation -= 2.0f * PI;
|
if ( m_fGunOrientation > 2.0f * PI ) m_fGunOrientation -= 2.0f * PI;
|
||||||
SetComponentRotation( m_pCarNode[20], ROT_AXIS_Z, m_fGunOrientation );
|
SetComponentRotation( m_pCarNode[20], ROT_AXIS_Z, m_fGunOrientation );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle* CStoredCar::RestoreCar_SilentPatch()
|
||||||
|
{
|
||||||
|
CVehicle* vehicle = (this->*(orgRestoreCar))();
|
||||||
|
|
||||||
|
// Fixup bomb stuff
|
||||||
|
if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
|
||||||
|
{
|
||||||
|
vehicle->SetBombOnBoard( m_bombType );
|
||||||
|
vehicle->SetBombOwner( FindPlayerPed(-1) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return vehicle;
|
||||||
}
|
}
|
|
@ -127,7 +127,10 @@ protected:
|
||||||
BYTE __pad2[108];
|
BYTE __pad2[108];
|
||||||
float m_fGasPedal;
|
float m_fGasPedal;
|
||||||
float m_fBrakePedal;
|
float m_fBrakePedal;
|
||||||
BYTE __pad6[44];
|
uint8_t m_VehicleCreatedBy;
|
||||||
|
uint32_t m_BombOnBoard : 3;
|
||||||
|
BYTE __pad6[32];
|
||||||
|
CEntity* m_pBombOwner;
|
||||||
signed int m_nTimeTillWeNeedThisCar;
|
signed int m_nTimeTillWeNeedThisCar;
|
||||||
BYTE __pad4[56];
|
BYTE __pad4[56];
|
||||||
CEntity* pDamagingEntity;
|
CEntity* pDamagingEntity;
|
||||||
|
@ -135,13 +138,23 @@ protected:
|
||||||
char padpad, padpad2, padpad3;
|
char padpad, padpad2, padpad3;
|
||||||
int8_t PlateDesign;
|
int8_t PlateDesign;
|
||||||
RwTexture* PlateTexture;
|
RwTexture* PlateTexture;
|
||||||
BYTE __pad5[20];
|
BYTE __pad78[4];
|
||||||
|
uint32_t m_dwVehicleClass;
|
||||||
|
uint32_t m_dwVehicleSubClass;
|
||||||
|
BYTE __pad5[8];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CVehicleFlags& GetVehicleFlags()
|
CVehicleFlags& GetVehicleFlags()
|
||||||
{ return m_nVehicleFlags; }
|
{ return m_nVehicleFlags; }
|
||||||
CEntity* GetDamagingEntity()
|
CEntity* GetDamagingEntity()
|
||||||
{ return pDamagingEntity; }
|
{ return pDamagingEntity; }
|
||||||
|
uint32_t GetClass() const
|
||||||
|
{ return m_dwVehicleClass; }
|
||||||
|
|
||||||
|
void SetBombOnBoard( uint32_t bombOnBoard )
|
||||||
|
{ m_BombOnBoard = bombOnBoard; }
|
||||||
|
void SetBombOwner( CEntity* owner )
|
||||||
|
{ m_pBombOwner = owner; }
|
||||||
|
|
||||||
virtual void Render() override;
|
virtual void Render() override;
|
||||||
virtual void PreRender() override;
|
virtual void PreRender() override;
|
||||||
|
@ -229,10 +242,33 @@ public:
|
||||||
void PreRender_SilentPatch();
|
void PreRender_SilentPatch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CStoredCar
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
CVector m_position;
|
||||||
|
uint32_t m_handlingFlags;
|
||||||
|
uint8_t m_flags;
|
||||||
|
uint16_t m_modelIndex;
|
||||||
|
uint16_t m_carMods[15];
|
||||||
|
uint8_t m_colour[4];
|
||||||
|
uint8_t m_radioStation;
|
||||||
|
uint8_t m_extra[2];
|
||||||
|
uint8_t m_bombType;
|
||||||
|
uint8_t m_remapIndex;
|
||||||
|
uint8_t m_nitro;
|
||||||
|
int8_t m_angleX, m_angleY, m_angleZ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||||
|
|
||||||
|
CVehicle* RestoreCar_SilentPatch();
|
||||||
|
};
|
||||||
|
|
||||||
void ReadRotorFixExceptions(const wchar_t* pPath);
|
void ReadRotorFixExceptions(const wchar_t* pPath);
|
||||||
|
|
||||||
static_assert(sizeof(CBouncingPanel) == 0x20, "Wrong size: CBouncingPanel");
|
static_assert(sizeof(CBouncingPanel) == 0x20, "Wrong size: CBouncingPanel");
|
||||||
static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
|
static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
|
||||||
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");
|
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");
|
||||||
|
static_assert(sizeof(CStoredCar) == 0x40, "Wrong size: CStoredCar");
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue