Only animate Sweeper brushes when needed

This commit is contained in:
Silent 2017-09-09 20:04:48 +02:00
parent 36d9f1a29a
commit 88de5b8f00
3 changed files with 34 additions and 13 deletions

View file

@ -96,6 +96,22 @@ public:
{ if ( m_pCoords ) m_pCoords->SetRotateZOnly(fHeading); else m_transform.m_heading = fHeading; }
};
enum // nStatus
{
STATUS_PLAYER = 0,
STATUS_PLAYER_PLAYBACKFROMBUFFER = 1,
STATUS_SIMPLE = 2,
STATUS_PHYSICS = 3,
STATUS_ABANDONED = 4,
STATUS_WRECKED = 5,
STATUS_PLAYER_REMOTE = 8,
STATUS_PLAYER_DISABLED = 9,
STATUS_TRAILER = 10,
STATUS_SIMPLE_TRAILER = 11,
STATUS_GHOST = 12,
};
// TODO: May not be the best place to put it?
class NOVMT CEntity : public CPlaceable
{
@ -175,11 +191,13 @@ public:
char numLodChildrenRendered; // 0x35
//********* BEGIN CEntityInfo **********//
BYTE nType : 3; // what type is the entity // 0x36 (2 == Vehicle)
BYTE nStatus : 5; // control status // 0x36
uint8_t nType : 3; // what type is the entity // 0x36 (2 == Vehicle)
uint8_t nStatus : 5; // control status // 0x36
//********* END CEntityInfo ************//
public:
uint8_t GetStatus() const { return nStatus; }
bool IsVisible();
};

View file

@ -377,6 +377,8 @@ void CAutomobile::ProcessSweeper()
{
if ( !m_nVehicleFlags.bEngineOn ) return;
if ( GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PHYSICS || GetStatus() == STATUS_SIMPLE )
{
if ( m_pCarNode[20] == nullptr )
{
m_pCarNode[20] = GetFrameFromName( RpClumpGetFrame(m_pRwObject), "misca" );
@ -390,4 +392,5 @@ void CAutomobile::ProcessSweeper()
SetComponentRotation( m_pCarNode[20], ROT_AXIS_Z, angle, false );
SetComponentRotation( m_pCarNode[21], ROT_AXIS_Z, -angle, false );
}
}

View file

@ -152,7 +152,7 @@ public:
bool IsLawEnforcementVehicle();
static void SetComponentRotation( RwFrame* component, eRotAxis axis, float angle, bool absolute );
static void SetComponentRotation( RwFrame* component, eRotAxis axis, float angle, bool absolute = true );
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
};