mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
III: Fixed taxi light corona placement for Taxi
This commit is contained in:
parent
9b26855d3d
commit
03a0cb68be
2 changed files with 49 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "Utils/Patterns.h"
|
||||
#include "Common.h"
|
||||
#include "Common_ddraw.h"
|
||||
#include "VehicleIII.h"
|
||||
|
||||
#include <memory>
|
||||
#include <Shlwapi.h>
|
||||
|
@ -491,6 +492,28 @@ 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;
|
||||
|
@ -593,6 +616,18 @@ 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Maths.h"
|
||||
|
||||
enum eVehicleType
|
||||
{
|
||||
|
@ -13,12 +14,23 @@ enum eVehicleType
|
|||
|
||||
class CVehicle
|
||||
{
|
||||
private:
|
||||
uint8_t __pad1[644];
|
||||
protected:
|
||||
// TODO: Make this part of CEntity properly
|
||||
void* __vmt;
|
||||
CMatrix m_matrix;
|
||||
uint8_t __pad2[16];
|
||||
uint16_t m_modelIndex; // TODO: THE FLA
|
||||
uint8_t __pad1[548];
|
||||
uint32_t m_dwVehicleClass;
|
||||
|
||||
|
||||
public:
|
||||
int32_t GetModelIndex() const
|
||||
{ return m_modelIndex; }
|
||||
|
||||
const CMatrix& GetMatrix() const
|
||||
{ return m_matrix; }
|
||||
|
||||
uint32_t GetClass() const
|
||||
{ return m_dwVehicleClass; }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue