Reset Rhino middle wheels state on fixing

This commit is contained in:
Silent 2018-05-22 22:40:23 +02:00
parent 623464d45e
commit deb74e0249
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
3 changed files with 54 additions and 1 deletions

View file

@ -29,6 +29,7 @@ extern void (*GTAdelete)(void* data);
extern const char* (*GetFrameNodeName)(RwFrame*);
extern RpHAnimHierarchy* (*GetAnimHierarchyFromSkinClump)(RpClump*);
int32_t Int32Rand();
RwObject* GetFirstObject(RwFrame* pFrame);
extern unsigned char& nGameClockDays;
extern unsigned char& nGameClockMonths;

View file

@ -35,6 +35,7 @@ namespace SVF {
VORTEX_EXHAUST,
TOWTRUCK_HOOK,
TRACTOR_HOOK,
RHINO_WHEELS,
// Internal SP use only, formerly "rotor exceptions"
// Unreachable from RegisterSpecialVehicleFeature
@ -53,6 +54,7 @@ namespace SVF {
{ "VORTEX_EXHAUST", Feature::VORTEX_EXHAUST },
{ "TOWTRUCK_HOOK", Feature::TOWTRUCK_HOOK },
{ "TRACTOR_HOOK", Feature::TRACTOR_HOOK },
{ "RHINO_WHEELS", Feature::RHINO_WHEELS },
};
auto it = std::find_if( std::begin(features), std::end(features), [featureName]( const auto& e ) {
@ -82,6 +84,7 @@ namespace SVF {
static std::multimap<int32_t, std::tuple<Feature, int32_t> > specialVehFeatures = {
_registerFeatureInternal( 430, Feature::BOAT_MOVING_PROP ),
_registerFeatureInternal( 432, Feature::RHINO_WHEELS ),
_registerFeatureInternal( 453, Feature::BOAT_MOVING_PROP ),
_registerFeatureInternal( 454, Feature::BOAT_MOVING_PROP ),
_registerFeatureInternal( 511, Feature::EXTRA_AILERONS1 ),
@ -488,6 +491,19 @@ void CAutomobile::Fix_SilentPatch()
// Towtruck/Tractor fix
m_aBouncingPanel[i].m_nNodeIndex = -1;
}
// Reset Rhino middle wheels state
if ( SVF::ModelHasFeature( extID, SVF::Feature::RHINO_WHEELS ) )
{
Door[REAR_LEFT_DOOR].SetExtraWheelPositions( 1.0f, 1.0f, 1.0f, 1.0f );
Door[REAR_RIGHT_DOOR].SetExtraWheelPositions( 1.0f, 1.0f, 1.0f, 1.0f );
RwObject* object = GetFirstObject( m_pCarNode[3] );
RpAtomicSetFlags( object, 0 );
object = GetFirstObject( m_pCarNode[6] );
RpAtomicSetFlags( object, 0 );
}
}
void CAutomobile::ResetFrames()

View file

@ -113,6 +113,28 @@ public:
CVector m_vecBounceVector;
};
class CDoor
{
private:
float m_fOpenAngle;
float m_fClosedAngle;
int16_t m_nDirn;
uint8_t m_nAxis;
uint8_t m_nDoorState;
float m_fAngle;
float m_fPrevAngle;
float m_fAngVel;
public:
void SetExtraWheelPositions( float openAngle, float closedAngle, float angle, float prevAngle )
{
m_fOpenAngle = openAngle;
m_fClosedAngle = closedAngle;
m_fAngle = angle;
m_fPrevAngle = prevAngle;
}
};
enum eRotAxis
{
ROT_AXIS_X = 0,
@ -120,6 +142,18 @@ enum eRotAxis
ROT_AXIS_Z = 2
};
enum eDoor
{
BONNET,
BOOT,
FRONT_LEFT_DOOR,
FRONT_RIGHT_DOOR,
REAR_LEFT_DOOR,
REAR_RIGHT_DOOR,
NUM_DOORS
};
class NOVMT CVehicle : public CPhysical
{
protected:
@ -180,7 +214,8 @@ public:
class NOVMT CAutomobile : public CVehicle
{
public:
BYTE paddd[168];
BYTE paddd[24];
CDoor Door[NUM_DOORS];
RwFrame* m_pCarNode[25];
CBouncingPanel m_aBouncingPanel[3];
BYTE padding[320];
@ -272,6 +307,7 @@ public:
void ReadRotorFixExceptions(const wchar_t* pPath);
static_assert(sizeof(CDoor) == 0x18, "Wrong size: CDoor");
static_assert(sizeof(CBouncingPanel) == 0x20, "Wrong size: CBouncingPanel");
static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");