Sweeper animations

Fixed Phoenix anims
This commit is contained in:
Silent 2017-06-25 12:17:09 +02:00
parent 07776b44cb
commit 5f6ad2157d
2 changed files with 44 additions and 4 deletions

View file

@ -260,7 +260,12 @@ void CAutomobile::PreRender()
if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 603 ) if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 603 )
{ {
ProcessPhoenixBlower(); ProcessPhoenixBlower( 603 );
}
if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 574 )
{
ProcessSweeper();
} }
} }
@ -300,10 +305,20 @@ void CAutomobile::ResetFrames()
} }
} }
void CAutomobile::ProcessPhoenixBlower() void CAutomobile::ProcessPhoenixBlower( int32_t modelID )
{ {
if ( m_pCarNode[20] == nullptr ) return; if ( m_pCarNode[20] == nullptr ) return;
RpClump* pOrigClump = reinterpret_cast<RpClump*>(ms_modelInfoPtrs[ modelID ]->pRwObject);
if ( pOrigClump != nullptr )
{
RwFrame* origFrame = GetFrameFromName( RpClumpGetFrame(pOrigClump), GetFrameNodeName(m_pCarNode[20]) );
if ( origFrame != nullptr )
{
*RwFrameGetMatrix(m_pCarNode[20]) = *RwFrameGetMatrix(origFrame);
}
}
float finalAngle = 0.0f; float finalAngle = 0.0f;
if ( m_fGasPedal > 0.0f ) if ( m_fGasPedal > 0.0f )
{ {
@ -324,5 +339,29 @@ void CAutomobile::ProcessPhoenixBlower()
} }
} }
SetComponentRotation( m_pCarNode[20], 0, finalAngle, true ); SetComponentRotation( m_pCarNode[20], 0, finalAngle, false );
}
void CAutomobile::ProcessSweeper()
{
if ( !m_nVehicleFlags.bEngineOn ) return;
if ( m_pCarNode[20] == nullptr )
{
m_pCarNode[20] = GetFrameFromName( RpClumpGetFrame(m_pRwObject), "misca" );
}
if ( m_pCarNode[21] == nullptr )
{
m_pCarNode[21] = GetFrameFromName( RpClumpGetFrame(m_pRwObject), "miscb" );
}
const float angle = CTimer::m_fTimeStep * 0.5f;
if ( m_pCarNode[20] != nullptr )
{
SetComponentRotation( m_pCarNode[20], 2, angle, false );
}
if ( m_pCarNode[21] != nullptr )
{
SetComponentRotation( m_pCarNode[21], 2, -angle, false );
}
} }

View file

@ -170,7 +170,8 @@ public:
void Fix_SilentPatch(); void Fix_SilentPatch();
void ResetFrames(); void ResetFrames();
void ProcessPhoenixBlower(); void ProcessPhoenixBlower( int32_t modelID );
void ProcessSweeper();
static void (CAutomobile::*orgPreRender)(); static void (CAutomobile::*orgPreRender)();
}; };