Double artict3 trailer

This commit is contained in:
Silent 2018-06-05 19:50:25 +02:00
parent 3ec5663861
commit 77f78fedca
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
4 changed files with 116 additions and 2 deletions

View File

@ -280,6 +280,9 @@ private:
float fLighting; // 0x12C col lighting? CPhysical::GetLightingFromCol float fLighting; // 0x12C col lighting? CPhysical::GetLightingFromCol
float fLighting_2; // 0x130 added to col lighting in CPhysical::GetTotalLighting float fLighting_2; // 0x130 added to col lighting in CPhysical::GetTotalLighting
BYTE pad3a[4]; // 0x134 BYTE pad3a[4]; // 0x134
public:
virtual void* ProcessEntityCollision(CEntity*, void*);
}; };
enum // m_objectCreatedBy enum // m_objectCreatedBy

View File

@ -3725,6 +3725,14 @@ void Patch_SA_10()
FollowCarCamJmpBack = 0x5254F6 + 6; FollowCarCamJmpBack = 0x5254F6 + 6;
InjectHook( 0x5254F6, CamControlFirela, PATCH_JUMP ); InjectHook( 0x5254F6, CamControlFirela, PATCH_JUMP );
} }
// Double artict3 trailer
{
auto* trailerTowBarPos = (*(decltype(CTrailer::orgGetTowBarPos)**)(0x6D03FD + 2)) + 60;
CTrailer::orgGetTowBarPos = *trailerTowBarPos;
Patch(trailerTowBarPos, &CTrailer::GetTowBarPos_Stub);
}
} }
void Patch_SA_11() void Patch_SA_11()

View File

@ -30,6 +30,7 @@ namespace SVF {
BOAT_MOVING_PROP, BOAT_MOVING_PROP,
EXTRA_AILERONS1, // Like on Beagle EXTRA_AILERONS1, // Like on Beagle
EXTRA_AILERONS2, // Like on Stuntplane EXTRA_AILERONS2, // Like on Stuntplane
DOUBLE_TRAILER, // Like on artict3
// Those are partially controlled by SilentPatch (only affected by minor fixes) // Those are partially controlled by SilentPatch (only affected by minor fixes)
VORTEX_EXHAUST, VORTEX_EXHAUST,
@ -52,6 +53,7 @@ namespace SVF {
{ "BOAT_MOVING_PROP", Feature::BOAT_MOVING_PROP }, { "BOAT_MOVING_PROP", Feature::BOAT_MOVING_PROP },
{ "EXTRA_AILERONS1", Feature::EXTRA_AILERONS1 }, { "EXTRA_AILERONS1", Feature::EXTRA_AILERONS1 },
{ "EXTRA_AILERONS2", Feature::EXTRA_AILERONS2 }, { "EXTRA_AILERONS2", Feature::EXTRA_AILERONS2 },
{ "DOUBLE_TRAILER", Feature::DOUBLE_TRAILER },
{ "VORTEX_EXHAUST", Feature::VORTEX_EXHAUST }, { "VORTEX_EXHAUST", Feature::VORTEX_EXHAUST },
{ "TOWTRUCK_HOOK", Feature::TOWTRUCK_HOOK }, { "TOWTRUCK_HOOK", Feature::TOWTRUCK_HOOK },
{ "TRACTOR_HOOK", Feature::TRACTOR_HOOK }, { "TRACTOR_HOOK", Feature::TRACTOR_HOOK },
@ -97,6 +99,7 @@ namespace SVF {
_registerFeatureInternal( 544, Feature::FIRELA_LADDER ), _registerFeatureInternal( 544, Feature::FIRELA_LADDER ),
_registerFeatureInternal( 574, Feature::SWEEPER_BRUSHES ), _registerFeatureInternal( 574, Feature::SWEEPER_BRUSHES ),
_registerFeatureInternal( 582, Feature::NEWSVAN_DISH ), _registerFeatureInternal( 582, Feature::NEWSVAN_DISH ),
_registerFeatureInternal( 591, Feature::DOUBLE_TRAILER ),
_registerFeatureInternal( 603, Feature::PHOENIX_FLUTTER ), _registerFeatureInternal( 603, Feature::PHOENIX_FLUTTER ),
}; };
@ -647,6 +650,31 @@ void CAutomobile::ProcessNewsvan()
} }
} }
bool CTrailer::GetTowBarPos(CVector& posnOut, bool defaultPos, CVehicle* trailer)
{
const int32_t modelID = m_nModelIndex.Get();
if ( SVF::ModelHasFeature( modelID, SVF::Feature::DOUBLE_TRAILER ) )
{
if ( m_pCarNode[21] != nullptr )
{
const RwMatrix* ltm = RwFrameGetLTM( m_pCarNode[21] );
posnOut.x = ltm->pos.x;
posnOut.y = ltm->pos.y;
posnOut.z = ltm->pos.z;
return true;
}
// Fallback, same as in original CTrailer::GetTowBarPos
if ( defaultPos )
{
posnOut = *GetMatrix() * CVector(0.0f, ms_modelInfoPtrs[ modelID ]->pColModel->boundingBox.vecMin.y - 0.05f, 0.5f - m_fHeightAboveRoad);
return true;
}
}
return GetTowBarPos_GTA(posnOut, defaultPos, trailer);
}
CVehicle* CStoredCar::RestoreCar_SilentPatch() CVehicle* CStoredCar::RestoreCar_SilentPatch()
{ {
CVehicle* vehicle = (this->*(orgRestoreCar))(); CVehicle* vehicle = (this->*(orgRestoreCar))();

View File

@ -142,7 +142,7 @@ enum eRotAxis
ROT_AXIS_Z = 2 ROT_AXIS_Z = 2
}; };
enum eDoor enum eDoors
{ {
BONNET, BONNET,
BOOT, BOOT,
@ -200,6 +200,59 @@ public:
void SetBombOwner( CEntity* owner ) void SetBombOwner( CEntity* owner )
{ m_pBombOwner = owner; } { m_pBombOwner = owner; }
virtual void ProcessControlCollisionCheck();
virtual void ProcessControlInputs(unsigned char playerNum);
// component index in m_apModelNodes array
virtual void GetComponentWorldPosition(int componentId, CVector& posnOut);
// component index in m_apModelNodes array
virtual bool IsComponentPresent(int componentId);
virtual void OpenDoor(CPed* ped, int componentId, eDoors door, float doorOpenRatio, bool playSound);
virtual void ProcessOpenDoor(CPed* ped, unsigned int doorComponentId, unsigned int arg2, unsigned int arg3, float arg4);
virtual float GetDooorAngleOpenRatio(unsigned int door);
virtual float GetDooorAngleOpenRatio(eDoors door);
virtual bool IsDoorReady(unsigned int door);
virtual bool IsDoorReady(eDoors door);
virtual bool IsDoorFullyOpen(unsigned int door);
virtual bool IsDoorFullyOpen(eDoors door);
virtual bool IsDoorClosed(unsigned int door);
virtual bool IsDoorClosed(eDoors door);
virtual bool IsDoorMissing(unsigned int door);
virtual bool IsDoorMissing(eDoors door);
// check if car has roof as extra
virtual bool IsOpenTopCar();
// remove ref to this entity
virtual void RemoveRefsToVehicle(CEntity* entity);
virtual void BlowUpCar(CEntity* damager, unsigned char bHideExplosion);
virtual void BlowUpCarCutSceneNoExtras(bool bNoCamShake, bool bNoSpawnFlyingComps, bool bDetachWheels, bool bExplosionSound);
virtual bool SetUpWheelColModel(CColModel* wheelCol);
// returns false if it's not possible to burst vehicle's tyre or it is already damaged. bPhysicalEffect=true applies random moving force to vehicle
virtual bool BurstTyre(unsigned char tyreComponentId, bool bPhysicalEffect);
virtual bool IsRoomForPedToLeaveCar(unsigned int arg0, CVector* arg1);
virtual void ProcessDrivingAnims(CPed* driver, unsigned char arg1);
// get special ride anim data for bile or quad
virtual void* GetRideAnimData();
virtual void SetupSuspensionLines();
virtual CVector AddMovingCollisionSpeed(CVector& arg0);
virtual void Fix();
virtual void SetupDamageAfterLoad();
virtual void DoBurstAndSoftGroundRatios();
virtual float GetHeightAboveRoad();
virtual void PlayCarHorn();
virtual int GetNumContactWheels();
virtual void VehicleDamage(float damageIntensity, unsigned short collisionComponent, CEntity* damager, CVector* vecCollisionCoors, CVector* vecCollisionDirection, eWeaponType weapon);
virtual bool CanPedStepOutCar(bool arg0);
virtual bool CanPedJumpOutCar(CPed* ped);
virtual bool GetTowHitchPos(CVector& posnOut, bool defaultPos, CVehicle* trailer);
virtual bool GetTowBarPos(CVector& posnOut, bool defaultPos, CVehicle* trailer);
// always return true
virtual bool SetTowLink(CVehicle* arg0, bool arg1);
virtual bool BreakTowLink();
virtual float FindWheelWidth(bool bRear);
// always return true
virtual bool Save();
// always return true
virtual bool Load();
virtual void Render() override; virtual void Render() override;
virtual void PreRender() override; virtual void PreRender() override;
@ -226,7 +279,10 @@ public:
CBouncingPanel m_aBouncingPanel[3]; CBouncingPanel m_aBouncingPanel[3];
BYTE padding[320]; BYTE padding[320];
float m_fRotorSpeed; float m_fRotorSpeed;
BYTE __moarpad[252]; BYTE __rotorpad[72];
float m_fHeightAboveRoad;
float m_fRearHeightAboveRoad;
BYTE __moarpad[172];
float m_fGunOrientation; float m_fGunOrientation;
float m_fGunElevation; float m_fGunElevation;
float m_fUnknown; float m_fUnknown;
@ -280,6 +336,25 @@ public:
static void (CPlane::*orgPlanePreRender)(); static void (CPlane::*orgPlanePreRender)();
}; };
class NOVMT CTrailer : public CAutomobile
{
public:
virtual bool GetTowBarPos(CVector& posnOut, bool defaultPos, CVehicle* trailer) override;
inline bool GetTowBarPos_Stub( CVector& pos, bool anyPos, CVehicle* trailer )
{
return CTrailer::GetTowBarPos( pos, anyPos, trailer );
}
inline bool GetTowBarPos_GTA( CVector& pos, bool anyPos, CVehicle* trailer )
{
return std::invoke(orgGetTowBarPos, this, pos, anyPos, trailer);
}
static inline bool (CTrailer::*orgGetTowBarPos)(CVector& pos, bool anyPos, CVehicle* trailer);
};
class NOVMT CBoat : public CVehicle class NOVMT CBoat : public CVehicle
{ {
uint8_t __pad[16]; uint8_t __pad[16];