mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
Stuntplane ailerons
Programmatically fixed props on Predator and Tropic
This commit is contained in:
parent
df32c8ab6a
commit
539398dd68
4 changed files with 86 additions and 8 deletions
|
@ -3431,8 +3431,8 @@ void Patch_SA_10()
|
||||||
|
|
||||||
|
|
||||||
// Animated Phoenix hood scoop
|
// Animated Phoenix hood scoop
|
||||||
auto* automobilePreRender = &(*(decltype(CAutomobile::orgPreRender)**)(0x6B0AD2 + 2))[17];
|
auto* automobilePreRender = &(*(decltype(CAutomobile::orgAutomobilePreRender)**)(0x6B0AD2 + 2))[17];
|
||||||
CAutomobile::orgPreRender = *automobilePreRender;
|
CAutomobile::orgAutomobilePreRender = *automobilePreRender;
|
||||||
Patch(automobilePreRender, &CAutomobile::PreRender_Stub);
|
Patch(automobilePreRender, &CAutomobile::PreRender_Stub);
|
||||||
|
|
||||||
InjectHook(0x6C7E7A, &CAutomobile::PreRender_Stub);
|
InjectHook(0x6C7E7A, &CAutomobile::PreRender_Stub);
|
||||||
|
@ -3440,6 +3440,19 @@ void Patch_SA_10()
|
||||||
InjectHook(0x6CFADC, &CAutomobile::PreRender_Stub);
|
InjectHook(0x6CFADC, &CAutomobile::PreRender_Stub);
|
||||||
|
|
||||||
|
|
||||||
|
// Extra animations for planes
|
||||||
|
auto* planePreRender = &(*(decltype(CPlane::orgPlanePreRender)**)(0x6C8E5A + 2))[17];
|
||||||
|
CPlane::orgPlanePreRender = *planePreRender;
|
||||||
|
Patch(planePreRender, &CPlane::PreRender_Stub);
|
||||||
|
|
||||||
|
|
||||||
|
// Fixed animations for boats
|
||||||
|
void* vehiclePreRender;
|
||||||
|
ReadCall( 0x6F119E, vehiclePreRender );
|
||||||
|
CVehicle::orgVehiclePreRender = *(decltype(CVehicle::orgVehiclePreRender)*)(&vehiclePreRender);
|
||||||
|
InjectHook( 0x6F119E, &CBoat::PreRender_SilentPatch );
|
||||||
|
|
||||||
|
|
||||||
// Stop BF Injection/Bandito/Hotknife rotating engine components when engine is off
|
// Stop BF Injection/Bandito/Hotknife rotating engine components when engine is off
|
||||||
Patch<const void*>(0x6AC2BE + 2, &CAutomobile::ms_engineCompSpeed);
|
Patch<const void*>(0x6AC2BE + 2, &CAutomobile::ms_engineCompSpeed);
|
||||||
Patch<const void*>(0x6ACB91 + 2, &CAutomobile::ms_engineCompSpeed);
|
Patch<const void*>(0x6ACB91 + 2, &CAutomobile::ms_engineCompSpeed);
|
||||||
|
|
|
@ -26,7 +26,10 @@ static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0x6D1680, 0x70
|
||||||
WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
|
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); }
|
||||||
void (CAutomobile::*CAutomobile::orgPreRender)();
|
|
||||||
|
void (CVehicle::*CVehicle::orgVehiclePreRender)();
|
||||||
|
void (CAutomobile::*CAutomobile::orgAutomobilePreRender)();
|
||||||
|
void (CPlane::*CPlane::orgPlanePreRender)();
|
||||||
|
|
||||||
static int32_t random(int32_t from, int32_t to)
|
static int32_t random(int32_t from, int32_t to)
|
||||||
{
|
{
|
||||||
|
@ -283,12 +286,54 @@ void CPlane::Fix_SilentPatch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPlane::PreRender()
|
||||||
|
{
|
||||||
|
(this->*(orgPlanePreRender))();
|
||||||
|
|
||||||
|
const int32_t extID = m_nModelIndex.Get();
|
||||||
|
if ( extID == 513 )
|
||||||
|
{
|
||||||
|
ProcessStuntPlane();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPlane::ProcessStuntPlane()
|
||||||
|
{
|
||||||
|
auto copyRotation = [&]( size_t src, size_t dest ) {
|
||||||
|
if ( m_pCarNode[src] != nullptr && m_pCarNode[dest] != nullptr )
|
||||||
|
{
|
||||||
|
RwMatrix* lhs = RwFrameGetMatrix( m_pCarNode[dest] );
|
||||||
|
const RwMatrix* rhs = RwFrameGetMatrix( m_pCarNode[src] );
|
||||||
|
|
||||||
|
lhs->at = rhs->at;
|
||||||
|
lhs->up = rhs->up;
|
||||||
|
lhs->right = rhs->right;
|
||||||
|
RwMatrixUpdate( lhs );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
copyRotation( 19, 23 );
|
||||||
|
copyRotation( 20, 24 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBoat::PreRender_SilentPatch()
|
||||||
|
{
|
||||||
|
(this->*(orgVehiclePreRender))();
|
||||||
|
|
||||||
|
// Fixed moving prop for Predator/Tropic/Reefer
|
||||||
|
const int32_t extID = m_nModelIndex.Get();
|
||||||
|
if ( (extID == 430 || extID == 453 || extID == 454) && m_pBoatNode[1] == nullptr )
|
||||||
|
{
|
||||||
|
m_pBoatNode[1] = GetFrameFromName( RpClumpGetFrame(m_pRwObject), "boat_moving" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CAutomobile::PreRender()
|
void CAutomobile::PreRender()
|
||||||
{
|
{
|
||||||
// For rotating engine components
|
// For rotating engine components
|
||||||
ms_engineCompSpeed = m_nVehicleFlags.bEngineOn ? CTimer::m_fTimeStep : 0.0f;
|
ms_engineCompSpeed = m_nVehicleFlags.bEngineOn ? CTimer::m_fTimeStep : 0.0f;
|
||||||
|
|
||||||
(this->*(orgPreRender))();
|
(this->*(orgAutomobilePreRender))();
|
||||||
|
|
||||||
const int32_t extID = m_nModelIndex.Get();
|
const int32_t extID = m_nModelIndex.Get();
|
||||||
if ( extID == 603 )
|
if ( extID == 603 )
|
||||||
|
|
|
@ -154,6 +154,8 @@ public:
|
||||||
|
|
||||||
static void SetComponentRotation( RwFrame* component, eRotAxis axis, float angle, bool absolute = true );
|
static void SetComponentRotation( RwFrame* component, eRotAxis axis, float angle, bool absolute = true );
|
||||||
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
|
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
|
||||||
|
|
||||||
|
static void (CVehicle::*orgVehiclePreRender)();
|
||||||
};
|
};
|
||||||
|
|
||||||
class NOVMT CAutomobile : public CVehicle
|
class NOVMT CAutomobile : public CVehicle
|
||||||
|
@ -179,13 +181,14 @@ public:
|
||||||
|
|
||||||
void Fix_SilentPatch();
|
void Fix_SilentPatch();
|
||||||
|
|
||||||
|
static void (CAutomobile::*orgAutomobilePreRender)();
|
||||||
|
static float ms_engineCompSpeed;
|
||||||
|
|
||||||
|
private:
|
||||||
void ResetFrames();
|
void ResetFrames();
|
||||||
void ProcessPhoenixBlower( int32_t modelID );
|
void ProcessPhoenixBlower( int32_t modelID );
|
||||||
void ProcessSweeper();
|
void ProcessSweeper();
|
||||||
void ProcessNewsvan();
|
void ProcessNewsvan();
|
||||||
|
|
||||||
static void (CAutomobile::*orgPreRender)();
|
|
||||||
static float ms_engineCompSpeed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NOVMT CHeli : public CAutomobile
|
class NOVMT CHeli : public CAutomobile
|
||||||
|
@ -206,10 +209,27 @@ public:
|
||||||
public:
|
public:
|
||||||
inline void Render_Stub()
|
inline void Render_Stub()
|
||||||
{ CPlane::Render(); }
|
{ CPlane::Render(); }
|
||||||
|
inline void PreRender_Stub()
|
||||||
|
{ CPlane::PreRender(); }
|
||||||
|
|
||||||
virtual void Render() override;
|
virtual void Render() override;
|
||||||
|
virtual void PreRender() override;
|
||||||
|
|
||||||
void Fix_SilentPatch();
|
void Fix_SilentPatch();
|
||||||
|
|
||||||
|
static void (CPlane::*orgPlanePreRender)();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ProcessStuntPlane();
|
||||||
|
};
|
||||||
|
|
||||||
|
class NOVMT CBoat : public CVehicle
|
||||||
|
{
|
||||||
|
uint8_t __pad[16];
|
||||||
|
RwFrame* m_pBoatNode[12];
|
||||||
|
|
||||||
|
public:
|
||||||
|
void PreRender_SilentPatch();
|
||||||
};
|
};
|
||||||
|
|
||||||
void ReadRotorFixExceptions(const wchar_t* pPath);
|
void ReadRotorFixExceptions(const wchar_t* pPath);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<SILENTPATCH_EXT>.asi</SILENTPATCH_EXT>
|
<SILENTPATCH_EXT>.asi</SILENTPATCH_EXT>
|
||||||
<SILENTPATCH_FULL_NAME>SilentPatch for San Andreas</SILENTPATCH_FULL_NAME>
|
<SILENTPATCH_FULL_NAME>SilentPatch for San Andreas</SILENTPATCH_FULL_NAME>
|
||||||
<SILENTPATCH_REVISION_ID>29</SILENTPATCH_REVISION_ID>
|
<SILENTPATCH_REVISION_ID>29</SILENTPATCH_REVISION_ID>
|
||||||
<SILENTPATCH_BUILD_ID>4</SILENTPATCH_BUILD_ID>
|
<SILENTPATCH_BUILD_ID>5</SILENTPATCH_BUILD_ID>
|
||||||
<SILENTPATCH_COPYRIGHT>2014-2017</SILENTPATCH_COPYRIGHT>
|
<SILENTPATCH_COPYRIGHT>2014-2017</SILENTPATCH_COPYRIGHT>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
|
Loading…
Reference in a new issue