mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
III/VC/SA 1.0: Fix lightless taxis
This commit is contained in:
parent
b46e91918c
commit
9248a822c6
5 changed files with 44 additions and 1 deletions
|
@ -90,6 +90,19 @@ namespace TaxiCoronaFix
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
// ============= Reset requested extras if created vehicle has no extras =============
|
||||
namespace CompsToUseFix
|
||||
{
|
||||
static int8_t* ms_compsUsed = *hook::get_pattern<int8_t*>( "89 E9 88 1D", 4 );
|
||||
static int8_t* ms_compsToUse = *hook::get_pattern<int8_t*>( "0F BE 05 ? ? ? ? 83 C4 28", 3 );
|
||||
static void ResetCompsForNoExtras()
|
||||
{
|
||||
ms_compsUsed[0] = ms_compsUsed[1] = -1;
|
||||
ms_compsToUse[0] = ms_compsToUse[1] = -2;
|
||||
}
|
||||
};
|
||||
|
||||
// ============= Delayed patches =============
|
||||
namespace DelayedPatches
|
||||
{
|
||||
|
@ -226,6 +239,16 @@ namespace Common {
|
|||
InjectHook( match.get<void>(), GetTransformedCoronaPos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reset requested extras if created vehicle has no extras
|
||||
{
|
||||
using namespace CompsToUseFix;
|
||||
|
||||
auto resetComps = pattern( "8B 04 24 83 C4 08 5D 5F" ).get_one();
|
||||
InjectHook( resetComps.get<void>( -14 ), ResetCompsForNoExtras, PATCH_CALL );
|
||||
Nop( resetComps.get<void>( -9 ), 9 );
|
||||
}
|
||||
}
|
||||
|
||||
void III_VC_SetDelayedPatchesFunc( void(*func)() )
|
||||
|
|
|
@ -17,6 +17,9 @@ bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen); // Read fro
|
|||
|
||||
CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0x4C0C96, 0x403DB7);
|
||||
|
||||
int8_t* CVehicleModelInfo::ms_compsUsed = *AddressByVersion<int8_t**>( 0x4C973B + 2, 0, 0 );
|
||||
int8_t* CVehicleModelInfo::ms_compsToUse = *AddressByVersion<int8_t**>( 0x4C8057 + 2, 0, 0 );
|
||||
|
||||
|
||||
static RwTexture** const ms_aDirtTextures = *AddressByVersion<RwTexture***>( 0x5D5DCC + 3, 0, 0x5F259C + 3 );
|
||||
void RemapDirt( CVehicleModelInfo* modelInfo, uint32_t dirtID )
|
||||
|
@ -106,6 +109,12 @@ void CVehicleModelInfo::SetCarCustomPlate()
|
|||
CCustomCarPlateMgr::SetupClump(reinterpret_cast<RpClump*>(pRwObject), m_apPlateMaterials);
|
||||
}
|
||||
|
||||
void CVehicleModelInfo::ResetCompsForNoExtras()
|
||||
{
|
||||
ms_compsUsed[0] = ms_compsUsed[1] = -1;
|
||||
ms_compsToUse[0] = ms_compsToUse[1] = -2;
|
||||
}
|
||||
|
||||
void CCustomCarPlateMgr::PollPlates( RpClump* clump, PlateMaterialsData* materials )
|
||||
{
|
||||
std::vector<RpMaterial*> carplates;
|
||||
|
|
|
@ -308,6 +308,11 @@ public:
|
|||
class CAnimBlock* m_pAnimBlock;
|
||||
|
||||
public:
|
||||
static int8_t* ms_compsUsed;
|
||||
static int8_t* ms_compsToUse;
|
||||
|
||||
static void ResetCompsForNoExtras();
|
||||
|
||||
inline const char* GetCustomCarPlateText()
|
||||
{ return m_plateText[0] ? m_plateText : nullptr; }
|
||||
|
||||
|
|
|
@ -4228,6 +4228,12 @@ void Patch_SA_10()
|
|||
}
|
||||
|
||||
|
||||
// Reset requested extras if created vehicle has no extras
|
||||
// Fixes eg. lightless taxis
|
||||
InjectHook( 0x4C97B1, CVehicleModelInfo::ResetCompsForNoExtras, PATCH_CALL );
|
||||
Nop( 0x4C97B1 + 5, 9 );
|
||||
|
||||
|
||||
#if FULL_PRECISION_D3D
|
||||
// Test - full precision D3D device
|
||||
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
|
||||
|
|
|
@ -389,7 +389,7 @@ private:
|
|||
uint16_t m_carMods[15];
|
||||
uint8_t m_colour[4];
|
||||
uint8_t m_radioStation;
|
||||
uint8_t m_extra[2];
|
||||
int8_t m_extra[2];
|
||||
uint8_t m_bombType;
|
||||
uint8_t m_remapIndex;
|
||||
uint8_t m_nitro;
|
||||
|
|
Loading…
Reference in a new issue