mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
III/VC: Moved taxi corona fix to shared code
This commit is contained in:
parent
330f1e3072
commit
7aebe3f355
@ -70,6 +70,31 @@ namespace StaticShadowAlphaFix
|
||||
}
|
||||
};
|
||||
|
||||
// ============= Corrected corona placement for taxi =============
|
||||
namespace TaxiCoronaFix
|
||||
{
|
||||
CVector& GetTransformedCoronaPos( CVector& out, float offsetZ, const CAutomobile* vehicle )
|
||||
{
|
||||
CVector pos;
|
||||
pos.x = 0.0f;
|
||||
if ( vehicle->GetModelIndex() == MI_TAXI )
|
||||
{
|
||||
#if _GTA_III
|
||||
pos.y = -0.25f;
|
||||
#elif _GTA_VC
|
||||
pos.y = -0.4f;
|
||||
#endif
|
||||
pos.z = 0.9f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y = 0.0f;
|
||||
pos.z = offsetZ;
|
||||
}
|
||||
return out = Multiply3x3( vehicle->GetMatrix(), pos );
|
||||
}
|
||||
};
|
||||
|
||||
// ============= Delayed patches =============
|
||||
namespace DelayedPatches
|
||||
{
|
||||
@ -173,6 +198,21 @@ namespace Common {
|
||||
ReadCall( renderStaticShadows, orgRenderStoredShadows );
|
||||
InjectHook( renderStaticShadows, RenderStoredShadows_StateFix );
|
||||
}
|
||||
|
||||
// Corrected taxi light placement for Taxi
|
||||
// TODO: INI entry
|
||||
{
|
||||
using namespace TaxiCoronaFix;
|
||||
|
||||
auto getTaxiLightPos = pattern( "E8 ? ? ? ? D9 84 24 ? ? ? ? D8 84 24 ? ? ? ? 83 C4 0C FF 35" );
|
||||
|
||||
if ( getTaxiLightPos.count_hint(1).size() == 1 )
|
||||
{
|
||||
auto match = getTaxiLightPos.get_one();
|
||||
Patch<uint8_t>( match.get<void>( -15 ), 0x55 ); // push eax -> push ebp
|
||||
InjectHook( match.get<void>(), GetTransformedCoronaPos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void III_VC_SetDelayedPatchesFunc( void(*func)() )
|
||||
|
@ -493,27 +493,6 @@ namespace SirenSwitchingFix
|
||||
};
|
||||
|
||||
|
||||
// ============= Corrected siren corona placement for taxi =============
|
||||
namespace TaxiCoronaFix
|
||||
{
|
||||
CVector& GetTransformedCoronaPos( CVector& out, float offsetZ, const CAutomobile* vehicle )
|
||||
{
|
||||
CVector pos;
|
||||
pos.x = 0.0f;
|
||||
if ( vehicle->GetModelIndex() == 110 ) // TAXI
|
||||
{
|
||||
pos.y = -0.25f;
|
||||
pos.z = 0.9f;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y = 0.0f;
|
||||
pos.z = offsetZ;
|
||||
}
|
||||
return out = Multiply3x3( vehicle->GetMatrix(), pos );
|
||||
}
|
||||
};
|
||||
|
||||
void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModulePath )
|
||||
{
|
||||
using namespace Memory;
|
||||
@ -616,18 +595,6 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul
|
||||
Patch<float>( enforcerZ2.get_first( 7 ), ENFORCER_SIREN_POS.z );
|
||||
}
|
||||
}
|
||||
{
|
||||
using namespace TaxiCoronaFix;
|
||||
|
||||
auto getTaxiLightPos = pattern( "E8 ? ? ? ? D9 84 24 ? ? ? ? D8 84 24 ? ? ? ? 83 C4 0C" );
|
||||
|
||||
if ( getTaxiLightPos.count_hint(1).size() == 1 )
|
||||
{
|
||||
auto match = getTaxiLightPos.get_one();
|
||||
Patch<uint8_t>( match.get<void>( -15 ), 0x55 ); // push eax -> push ebp
|
||||
InjectHook( match.get<void>(), GetTransformedCoronaPos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@ enum eVehicleType
|
||||
VEHICLE_PLANE
|
||||
};
|
||||
|
||||
constexpr uint16_t MI_TAXI = 110;
|
||||
|
||||
class CVehicle
|
||||
{
|
||||
protected:
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Maths.h"
|
||||
|
||||
enum eVehicleType
|
||||
{
|
||||
@ -12,10 +13,18 @@ enum eVehicleType
|
||||
VEHICLE_BIKE
|
||||
};
|
||||
|
||||
constexpr uint16_t MI_TAXI = 150;
|
||||
|
||||
class CVehicle
|
||||
{
|
||||
private:
|
||||
uint8_t __pad1[510];
|
||||
protected:
|
||||
// TODO: Make this part of CEntity properly
|
||||
void* __vmt;
|
||||
CMatrix m_matrix;
|
||||
uint8_t __pad4[16];
|
||||
uint16_t m_modelIndex; // TODO: THE FLA
|
||||
|
||||
uint8_t __pad1[414];
|
||||
uint8_t m_BombOnBoard : 3;
|
||||
uint8_t __pad2[17];
|
||||
class CEntity* m_pBombOwner;
|
||||
@ -24,6 +33,12 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
int32_t GetModelIndex() const
|
||||
{ return m_modelIndex; }
|
||||
|
||||
const CMatrix& GetMatrix() const
|
||||
{ return m_matrix; }
|
||||
|
||||
uint32_t GetClass() const
|
||||
{ return m_dwVehicleClass; }
|
||||
|
||||
@ -33,4 +48,8 @@ public:
|
||||
{ m_pBombOwner = owner; }
|
||||
};
|
||||
|
||||
class CAutomobile : public CVehicle
|
||||
{
|
||||
};
|
||||
|
||||
static_assert(sizeof(CVehicle) == 0x2A0, "Wrong size: CVehicle");
|
Loading…
Reference in New Issue
Block a user