mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
III: Give chopper/escape their own col model which is big enough
This commit is contained in:
parent
c1ccfba2ec
commit
9265226a09
2 changed files with 87 additions and 0 deletions
|
@ -1,6 +1,81 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Maths.h"
|
||||
|
||||
// This really belongs in Maths.h but San Andreas optimized those structured heavily...
|
||||
struct CColSphere
|
||||
{
|
||||
CVector m_center;
|
||||
float m_radius;
|
||||
uint8_t m_surface;
|
||||
uint8_t m_piece;
|
||||
|
||||
void Set(float radius, const CVector& center, uint8_t surf, uint8_t piece)
|
||||
{
|
||||
m_center = center;
|
||||
m_radius = radius;
|
||||
m_surface = surf;
|
||||
m_piece = piece;
|
||||
}
|
||||
|
||||
void Set(float radius, const CVector& center)
|
||||
{
|
||||
m_center = center;
|
||||
m_radius = radius;
|
||||
}
|
||||
|
||||
constexpr CColSphere( float radius, const CVector& center, uint8_t surf, uint8_t piece )
|
||||
: m_center( center ), m_radius( radius ), m_surface( surf ), m_piece( piece )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct CColBox
|
||||
{
|
||||
CVector m_min;
|
||||
CVector m_max;
|
||||
uint8_t m_surface;
|
||||
uint8_t m_piece;
|
||||
|
||||
void Set(const CVector& min, const CVector& max, uint8_t surf, uint8_t piece)
|
||||
{
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_surface = surf;
|
||||
m_piece = piece;
|
||||
}
|
||||
|
||||
CVector GetSize() const { return m_max - m_min; }
|
||||
|
||||
constexpr CColBox( const CVector& min, const CVector& max, uint8_t surf, uint8_t piece )
|
||||
: m_min( min ), m_max( max ), m_surface( surf ), m_piece( piece )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct CColModel
|
||||
{
|
||||
CColSphere m_boundingSphere;
|
||||
CColBox m_boundingBox;
|
||||
short m_m_numSpheres = 0;
|
||||
short m_numLines = 0;
|
||||
short m_numBoxes = 0;
|
||||
short m_numTriangles = 0;
|
||||
int m_level = 0;
|
||||
bool m_ownsCollisionVolumes = false;
|
||||
CColSphere* m_spheres = nullptr;
|
||||
struct CColLine* m_lines = nullptr;
|
||||
CColBox* m_boxes = nullptr;
|
||||
CVector* m_vertices = nullptr;
|
||||
struct CColTriangle* m_triangles = nullptr;
|
||||
struct CColTrianglePlane* m_trianglePlanes = nullptr;
|
||||
|
||||
constexpr CColModel( const CColSphere& sphere, const CColBox& box )
|
||||
: m_boundingSphere( sphere ), m_boundingBox ( box )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CSimpleModelInfo
|
||||
{
|
||||
|
|
|
@ -1213,6 +1213,18 @@ void Patch_III_Common()
|
|||
ReadCall( loadAllAudioScriptObjects, orgLoadAllAudioScriptObjects );
|
||||
InjectHook( loadAllAudioScriptObjects, LoadAllAudioScriptObjects_InitializedCheck );
|
||||
}
|
||||
|
||||
|
||||
// Give chopper/escape a properly sized collision bounding box instead of using ped's
|
||||
{
|
||||
static constexpr CColModel colModelChopper( CColSphere( 8.5f, CVector(0.0f, -1.75f, 0.73f), 0, 0 ),
|
||||
CColBox( CVector(-2.18f, -8.52f, -0.67f), CVector(-2.18f, 4.58f, 2.125f), 0, 0 ) );
|
||||
|
||||
auto initHelis = pattern( "C6 40 2C 00 A1" ).get_one();
|
||||
|
||||
Patch( initHelis.get<void>( -7 + 3 ), &colModelChopper );
|
||||
Patch( initHelis.get<void>( 9 + 3 ), &colModelChopper );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
|
Loading…
Reference in a new issue