OpenBarnyard
 
Loading...
Searching...
No Matches
ANamedAnimationSet Class Reference

#include <ANamedAnimationSet.h>

Inheritance diagram for ANamedAnimationSet:

Public Types

enum  OVERLAYTYPE_ : OVERLAYTYPE {
  OVERLAYTYPE_NONE = 0 , OVERLAYTYPE_BLINK = ( 1U << ( 0 ) ) , OVERLAYTYPE_LOOK_LEFT = ( 1U << ( 1 ) ) , OVERLAYTYPE_LOOK_RIGHT = ( 1U << ( 2 ) ) ,
  OVERLAYTYPE_LOOK_UP = ( 1U << ( 3 ) ) , OVERLAYTYPE_LOOK_DOWN = ( 1U << ( 4 ) )
}
 
using ThisClass = ANamedAnimationSet
 
using BaseClass = Toshi::TObject
 
using OVERLAYTYPE = TUINT8
 

Public Member Functions

virtual Toshi::TClass * GetClass () override
 
 ANamedAnimationSet ()
 
 ANamedAnimationSet (Toshi::T2Allocator *a_pAllocator)
 
 ~ANamedAnimationSet ()
 
TBOOL CreateFromProperties (const PBProperties *a_pProperties, Toshi::TSkeleton *a_pSkeleton)
 
void Destroy ()
 
TBOOL AddSoundBreakpoint (ASoundBreakpoint *a_pSoundBreakpoint, Toshi::TSkeleton *a_pSkeleton)
 
const Toshi::TPString8 & GetName () const
 
ANamedAnimationGetNamedAnimation (const Toshi::TPString8 &a_strName)
 

Static Public Member Functions

static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static __forceinline Toshi::TClass * GetClassStatic ()
 

Static Public Attributes

static constexpr Toshi::TClass * PARENTCLASS = & Toshi::TObject::ms_oClass
 
static Toshi::TClass ms_oClass = Toshi::TClass( "ANamedAnimationSet", ANamedAnimationSet::PARENTCLASS, ANamedAnimationSet::CreateTObject, ANamedAnimationSet::CreateTObjectInPlace, ANamedAnimationSet::InitialiseClass, ANamedAnimationSet::DeinitialiseClass, 0, 1, sizeof( ANamedAnimationSet ), alignof( ANamedAnimationSet ) )
 

Detailed Description

Definition at line 11 of file ANamedAnimationSet.h.

Member Typedef Documentation

◆ BaseClass

using ANamedAnimationSet::BaseClass = Toshi::TObject

Definition at line 16 of file ANamedAnimationSet.h.

◆ OVERLAYTYPE

Definition at line 18 of file ANamedAnimationSet.h.

◆ ThisClass

Member Enumeration Documentation

◆ OVERLAYTYPE_

Enumerator
OVERLAYTYPE_NONE 
OVERLAYTYPE_BLINK 
OVERLAYTYPE_LOOK_LEFT 
OVERLAYTYPE_LOOK_RIGHT 
OVERLAYTYPE_LOOK_UP 
OVERLAYTYPE_LOOK_DOWN 

Definition at line 19 of file ANamedAnimationSet.h.

Constructor & Destructor Documentation

◆ ANamedAnimationSet() [1/2]

ANamedAnimationSet::ANamedAnimationSet ( )

Definition at line 15 of file ANamedAnimationSet.cpp.

16 : m_mapAnimations( GetGlobalAllocator() )
17{
18 m_pAllocator = GetGlobalAllocator();
19 m_eOverlayType = OVERLAYTYPE_NONE;
20}
TFORCEINLINE T2Allocator * GetGlobalAllocator()
Definition T2Allocator.h:49

◆ ANamedAnimationSet() [2/2]

ANamedAnimationSet::ANamedAnimationSet ( Toshi::T2Allocator * a_pAllocator)

Definition at line 23 of file ANamedAnimationSet.cpp.

24 : m_mapAnimations( a_pAllocator )
25{
26 m_pAllocator = a_pAllocator;
27 m_eOverlayType = OVERLAYTYPE_NONE;
28}

◆ ~ANamedAnimationSet()

ANamedAnimationSet::~ANamedAnimationSet ( )

Definition at line 32 of file ANamedAnimationSet.cpp.

33{
34 Destroy();
35}

Member Function Documentation

◆ AddSoundBreakpoint()

TBOOL ANamedAnimationSet::AddSoundBreakpoint ( ASoundBreakpoint * a_pSoundBreakpoint,
Toshi::TSkeleton * a_pSkeleton )

Definition at line 125 of file ANamedAnimationSet.cpp.

126{
127 TASSERT( !"TODO" );
128 return TTRUE;
129}
#define TASSERT(X,...)
Definition Defines.h:138
#define TTRUE
Definition Typedefs.h:25

◆ CreateFromProperties()

TBOOL ANamedAnimationSet::CreateFromProperties ( const PBProperties * a_pProperties,
Toshi::TSkeleton * a_pSkeleton )

Definition at line 46 of file ANamedAnimationSet.cpp.

47{
48 // Get animation set name
49 TPString8 strSetName;
50 a_pProperties->GetOptionalPropertyValue( strSetName, TPS8( Name ) );
51
52 m_strName = strSetName;
53 auto pNullAnim = m_mapAnimations.Find( TPS8( null ) );
54
55 if ( !m_mapAnimations.IsValid( pNullAnim ) || pNullAnim.GetValue()->GetSecond() == TNULL )
56 {
57 // Create null (default) animation if it's not created yet
58 ANamedAnimation oUnused( m_pAllocator );
59
60 ANamedAnimation* pNullAnim = new ANamedAnimation( m_pAllocator );
61 pNullAnim->Reset();
62
63 m_mapAnimations.Insert( TPS8( null ), pNullAnim );
64 }
65
66 // Load all named animations
67 T2_FOREACH( ( *a_pProperties ), it )
68 {
69 if ( it->GetValue()->GetType() == PBPropertyValue::Type::Properties &&
70 it->GetName().GetString()[ 0 ] == 'N' )
71 {
72 // NamedAnimation
73 ANamedAnimation* pAnim = LoadNamedAnimation( it->GetValue()->GetProperties(), a_pSkeleton );
74
75 if ( pAnim && pAnim->IsOverlay() )
76 {
77 if ( pAnim->GetName() == TPS8( blink ) )
78 m_eOverlayType = OVERLAYTYPE_BLINK;
79 else if ( pAnim->GetName() == TPS8( lookl ) )
80 m_eOverlayType = OVERLAYTYPE_LOOK_LEFT;
81 else if ( pAnim->GetName() == TPS8( lookr ) )
82 m_eOverlayType = OVERLAYTYPE_LOOK_RIGHT;
83 else if ( pAnim->GetName() == TPS8( looku ) )
84 m_eOverlayType = OVERLAYTYPE_LOOK_UP;
85 else if ( pAnim->GetName() == TPS8( lookd ) )
86 m_eOverlayType = OVERLAYTYPE_LOOK_DOWN;
87 }
88 }
89 }
90
91 // Load transitions
92 T2_FOREACH( ( *a_pProperties ), it )
93 {
94 if ( it->GetValue()->GetType() == PBPropertyValue::Type::Properties &&
95 it->GetName().GetString()[ 0 ] == 'A' )
96 {
97 TBOOL bRes = LoadAnimationTransition( it->GetValue()->GetProperties() );
98
99 TASSERT( bRes == TTRUE );
100 }
101 }
102
103 return TTRUE;
104}
#define T2_FOREACH(vecName, iteratorName)
Definition T2Iterator.h:4
#define TPS8(STR)
Definition TPString8.h:16
#define TNULL
Definition Typedefs.h:23
bool TBOOL
Definition Typedefs.h:6
TBOOL GetOptionalPropertyValue(T &a_rOutValue, const TCHAR *a_szName) const
const Toshi::TPString8 & GetName() const
TBOOL IsOverlay() const

◆ CreateTObject()

Toshi::TObject * ANamedAnimationSet::CreateTObject ( )
static

Definition at line 10 of file ANamedAnimationSet.cpp.

◆ CreateTObjectInPlace()

Toshi::TObject * ANamedAnimationSet::CreateTObjectInPlace ( void * a_pPtr)
static

Definition at line 10 of file ANamedAnimationSet.cpp.

◆ DeinitialiseClass()

void ANamedAnimationSet::DeinitialiseClass ( )
static

Definition at line 10 of file ANamedAnimationSet.cpp.

◆ Destroy()

void ANamedAnimationSet::Destroy ( )

Definition at line 106 of file ANamedAnimationSet.cpp.

107{
108 // Delete all named animations
109 while ( !m_mapAnimations.IsEmpty() )
110 {
111 auto it = m_mapAnimations.Begin();
112 ANamedAnimation* pAnim = it->GetSecond();
113
114 if ( pAnim )
115 delete pAnim;
116
117 m_mapAnimations.Remove( it );
118 }
119
120 m_eOverlayType = OVERLAYTYPE_NONE;
121 m_strName = TPString8();
122}

◆ GetClass()

Toshi::TClass * ANamedAnimationSet::GetClass ( )
overridevirtual

Definition at line 10 of file ANamedAnimationSet.cpp.

◆ GetClassStatic()

static __forceinline Toshi::TClass * ANamedAnimationSet::GetClassStatic ( )
inlinestatic

Definition at line 16 of file ANamedAnimationSet.h.

◆ GetName()

const Toshi::TPString8 & ANamedAnimationSet::GetName ( ) const
inline

Definition at line 40 of file ANamedAnimationSet.h.

40{ return m_strName; }

◆ GetNamedAnimation()

ANamedAnimation * ANamedAnimationSet::GetNamedAnimation ( const Toshi::TPString8 & a_strName)

Definition at line 132 of file ANamedAnimationSet.cpp.

133{
134 auto it = m_mapAnimations.Find( a_strName );
135
136 if ( it != m_mapAnimations.End() )
137 return it->second;
138
139 return TNULL;
140}

◆ InitialiseClass()

void ANamedAnimationSet::InitialiseClass ( )
static

Definition at line 10 of file ANamedAnimationSet.cpp.

Member Data Documentation

◆ ms_oClass

Definition at line 16 of file ANamedAnimationSet.h.

◆ PARENTCLASS

Toshi::TClass* ANamedAnimationSet::PARENTCLASS = & Toshi::TObject::ms_oClass
staticconstexpr

Definition at line 16 of file ANamedAnimationSet.h.


The documentation for this class was generated from the following files: