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

#include <AGUISlideshow.h>

Inheritance diagram for AGUISlideshow:

Classes

struct  Params
 

Public Types

enum  Flags_ : Flags {
  Flags_None = 0 , Flags_Skippable = ( 1U << ( 0 ) ) , Flags_Unk1 = ( 1U << ( 1 ) ) , Flags_InstaSkippable = ( 1U << ( 2 ) ) ,
  Flags_HasFadeIn = ( 1U << ( 3 ) ) , Flags_HasFadeOut = ( 1U << ( 4 ) ) , Flags_Repeat = ( 1U << ( 5 ) ) , Flags_Ended = ( 1U << ( 6 ) )
}
 
using ThisClass = AGUISlideshow
 
using BaseClass = Toshi::TObject
 
using Flags = TUINT32
 

Public Member Functions

virtual Toshi::TClass * GetClass () override
 
 AGUISlideshow ()
 
TBOOL Setup (AGameState::HUDParams *a_pHUDParams, const Params &a_rParams, TBOOL a_bShouldLocalise)
 
void Update (TFLOAT a_fDeltaTime)
 
void UpdateFadeOverlay ()
 
void SwitchToNextSlide (TBOOL a_bUnused=true)
 
void Activate ()
 
void Deactivate ()
 
void Reset ()
 
TBOOL ProcessInput (const Toshi::TInputInterface::InputEvent *a_pEvent)
 
TBOOL ProcessCommand (AInputCommand a_eCommand)
 
TBOOL IsSlideshowOver ()
 
TBOOL HasSlides () const
 
void AddSlide (const Toshi::TPString8 &a_rName)
 

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 Toshi::TPString8 * LocaliseBackgroundFileName (Toshi::TPString8 &a_rOutName, const Toshi::TPString8 &a_rName)
 
static void LocaliseBackgroundFileName (Toshi::TPString8 &a_rOutName, const TCHAR *a_szName)
 

Static Public Attributes

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

Protected Attributes

AGameState::HUDParamsm_pHUDParams
 
Toshi::T2DynamicVector< Toshi::TPString8 > m_Images
 
Toshi::T2DynamicVector< Toshi::TPString8 >::Iterator m_ImageIterator
 
Flags m_eFlags
 
TBOOL m_bIsActive
 
TFLOAT m_fCurrentSlideTime
 
TFLOAT m_fUnk2
 
TFLOAT m_fDuration
 
TFLOAT m_fFadeInTime
 
TFLOAT m_fFadeOutTime
 
TFLOAT m_fUnk4
 
AGUI2Rectangle m_FadeOverlay
 
TBOOL m_bIsAppearing
 
TBOOL m_bShouldLocalise
 

Detailed Description

Definition at line 8 of file AGUISlideshow.h.

Member Typedef Documentation

◆ BaseClass

using AGUISlideshow::BaseClass = Toshi::TObject

Definition at line 11 of file AGUISlideshow.h.

◆ Flags

Definition at line 13 of file AGUISlideshow.h.

◆ ThisClass

Definition at line 11 of file AGUISlideshow.h.

Member Enumeration Documentation

◆ Flags_

Enumerator
Flags_None 
Flags_Skippable 
Flags_Unk1 
Flags_InstaSkippable 
Flags_HasFadeIn 
Flags_HasFadeOut 
Flags_Repeat 
Flags_Ended 

Definition at line 14 of file AGUISlideshow.h.

Constructor & Destructor Documentation

◆ AGUISlideshow()

AGUISlideshow::AGUISlideshow ( )

Definition at line 15 of file AGUISlideshow.cpp.

16 : m_Images( Toshi::GetGlobalAllocator(), 64, 64 )
17{
22 m_fUnk2 = 0.0f;
23 m_fDuration = 1.0f;
24 m_fFadeInTime = 0.0f;
25 m_fFadeOutTime = 0.0f;
26 m_fUnk4 = -1.0f;
29}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
TFLOAT m_fFadeOutTime
AGameState::HUDParams * m_pHUDParams
Toshi::T2DynamicVector< Toshi::TPString8 > m_Images
TFLOAT m_fFadeInTime
TFLOAT m_fCurrentSlideTime
TBOOL m_bShouldLocalise

Member Function Documentation

◆ Activate()

void AGUISlideshow::Activate ( )

Definition at line 59 of file AGUISlideshow.cpp.

60{
61 TASSERT( m_Images.Size() > 0 );
62
65 m_fUnk2 = 0.0f;
66
67 if ( !m_bIsAppearing )
68 {
69 if ( !m_bShouldLocalise )
70 {
71 AGUISystem::GetSingleton()->SetPicture( m_Images[ 0 ] );
72 }
73 else
74 {
75 Toshi::TPString8 pictureName;
76 LocaliseBackgroundFileName( pictureName, m_Images[ 0 ] );
77 AGUISystem::GetSingleton()->SetPicture( pictureName );
78 }
79 }
80
83}
#define TASSERT(X,...)
Definition Defines.h:138
#define TTRUE
Definition Typedefs.h:25
void UpdateFadeOverlay()
Toshi::T2DynamicVector< Toshi::TPString8 >::Iterator m_ImageIterator
static Toshi::TPString8 * LocaliseBackgroundFileName(Toshi::TPString8 &a_rOutName, const Toshi::TPString8 &a_rName)

◆ AddSlide()

void AGUISlideshow::AddSlide ( const Toshi::TPString8 & a_rName)
inline

Definition at line 63 of file AGUISlideshow.h.

64 {
65 m_Images.PushBack( a_rName );
66 }

◆ CreateTObject()

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

Definition at line 13 of file AGUISlideshow.cpp.

◆ CreateTObjectInPlace()

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

Definition at line 13 of file AGUISlideshow.cpp.

◆ Deactivate()

void AGUISlideshow::Deactivate ( )

Definition at line 196 of file AGUISlideshow.cpp.

197{
199
201 AGUISystem::GetSingleton()->SetPicture( Toshi::TPString8() );
203}

◆ DeinitialiseClass()

void AGUISlideshow::DeinitialiseClass ( )
static

Definition at line 13 of file AGUISlideshow.cpp.

◆ GetClass()

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

Definition at line 13 of file AGUISlideshow.cpp.

◆ GetClassStatic()

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

Definition at line 11 of file AGUISlideshow.h.

◆ HasSlides()

TBOOL AGUISlideshow::HasSlides ( ) const
inline

Definition at line 58 of file AGUISlideshow.h.

59 {
60 return m_Images.Size() != 0;
61 }

◆ InitialiseClass()

void AGUISlideshow::InitialiseClass ( )
static

Definition at line 13 of file AGUISlideshow.cpp.

◆ IsSlideshowOver()

TBOOL AGUISlideshow::IsSlideshowOver ( )

Definition at line 161 of file AGUISlideshow.cpp.

162{
164 {
165 return !m_ImageIterator.IsValid();
166 }
167
168 if ( !HASANYFLAG( m_eFlags, Flags_Ended ) && ( m_fUnk4 <= 0.0f || m_fUnk2 <= m_fUnk4 ) )
169 {
170 return TFALSE;
171 }
172
173 return TTRUE;
174}
#define HASANYFLAG(STATE, FLAG)
Definition Defines.h:5

◆ LocaliseBackgroundFileName() [1/2]

void AGUISlideshow::LocaliseBackgroundFileName ( Toshi::TPString8 & a_rOutName,
const TCHAR * a_szName )
static

Definition at line 37 of file AGUISlideshow.cpp.

38{
39 TCHAR szFormattedName[ 256 ];
40 auto eLang = ALocaleManager::GetSingleton()->GetLanguage();
41
43 {
44 TCHAR szLang[ 4 ];
45 Toshi::TStringManager::String8Copy(
46 szLang,
47 ALocaleManager::Interface()->GetCurrentLanguageName(),
48 sizeof( szLang )
49 );
50
51 szLang[ 1 ] = '\0';
52 Toshi::TStringManager::String8Format( szFormattedName, sizeof( szFormattedName ), "%s%s", a_szName, szLang );
53 a_szName = szFormattedName;
54 }
55
56 a_rOutName = Toshi::TPString8( a_szName );
57}
char TCHAR
Definition Typedefs.h:20
static ALocaleManager * Interface()

◆ LocaliseBackgroundFileName() [2/2]

Toshi::TPString8 * AGUISlideshow::LocaliseBackgroundFileName ( Toshi::TPString8 & a_rOutName,
const Toshi::TPString8 & a_rName )
static

Definition at line 31 of file AGUISlideshow.cpp.

32{
33 LocaliseBackgroundFileName( a_rOutName, a_rName.GetString8().GetString() );
34 return &a_rOutName;
35}

◆ ProcessCommand()

TBOOL AGUISlideshow::ProcessCommand ( AInputCommand a_eCommand)

Definition at line 292 of file AGUISlideshow.cpp.

293{
294 if ( ( ( a_eCommand != AInputCommand_Back && a_eCommand != AInputCommand_Cancel && a_eCommand != AInputCommand_Quit ) || !HASANYFLAG( m_eFlags, Flags_Unk1 ) ) && !HASANYFLAG( m_eFlags, Flags_InstaSkippable ) )
295 {
297 {
299 return TTRUE;
300 }
301
302 return TFALSE;
303 }
304
307 return TTRUE;
308}
@ AInputCommand_Back
Definition AInputMap.h:18
@ AInputCommand_Quit
Definition AInputMap.h:20
@ AInputCommand_Cancel
Definition AInputMap.h:16
void SwitchToNextSlide(TBOOL a_bUnused=true)

◆ ProcessInput()

TBOOL AGUISlideshow::ProcessInput ( const Toshi::TInputInterface::InputEvent * a_pEvent)

Definition at line 271 of file AGUISlideshow.cpp.

272{
273 if ( a_pEvent->GetEventType() == Toshi::TInputInterface::EVENT_TYPE_GONE_DOWN )
274 {
276 {
279 return TTRUE;
280 }
281
283 {
285 return TTRUE;
286 }
287 }
288
289 return TFALSE;
290}

◆ Reset()

void AGUISlideshow::Reset ( )

Definition at line 310 of file AGUISlideshow.cpp.

311{
313 m_fCurrentSlideTime = 0.0f;
314 m_fUnk2 = 0.0f;
315}

◆ Setup()

TBOOL AGUISlideshow::Setup ( AGameState::HUDParams * a_pHUDParams,
const Params & a_rParams,
TBOOL a_bShouldLocalise )

Definition at line 205 of file AGUISlideshow.cpp.

206{
207 if ( m_pHUDParams )
208 {
209 return TFALSE;
210 }
211
212 m_bShouldLocalise = a_bShouldLocalise;
214
215 if ( a_rParams.iUnk1 != 0 )
216 {
217 return TFALSE;
218 }
219
220 m_pHUDParams = a_pHUDParams;
221
222 if ( a_rParams.bSlideSkippable )
223 {
225 }
226
227 if ( a_rParams.bUnk2 )
228 {
230 }
231
232 if ( a_rParams.bInstaSkippable )
233 {
235 }
236
237 if ( a_rParams.bHasFadeIn )
238 {
240 m_fFadeInTime = a_rParams.fFadeInTime;
241 }
242
243 if ( a_rParams.bHasFadeOut )
244 {
246 m_fFadeOutTime = a_rParams.fFadeOutTime;
247 }
248
249 if ( a_rParams.bRepeat )
250 {
252 }
253
254 m_fDuration = a_rParams.fDuration;
255 m_fUnk4 = a_rParams.fUnk5;
256
257 TFLOAT fWidth, fHeight;
258 AGUI2::GetSingleton()->GetDimensions( fWidth, fHeight );
259 m_FadeOverlay.SetDimensions( fWidth, fHeight );
261 m_FadeOverlay.Hide();
262
263 if ( a_rParams.bDelayAppear )
264 {
266 }
267
268 return TTRUE;
269}
float TFLOAT
Definition Typedefs.h:4
@ AGUI2ATTACHMENT_TOPCENTER
AGUI2Rectangle m_FadeOverlay

◆ SwitchToNextSlide()

void AGUISlideshow::SwitchToNextSlide ( TBOOL a_bUnused = true)

Definition at line 176 of file AGUISlideshow.cpp.

177{
178 if ( m_ImageIterator.IsValid() )
179 {
181 }
182
183 if ( !m_ImageIterator.IsValid() )
184 {
185 if ( !HASANYFLAG( m_eFlags, Flags_Repeat ) ) return;
187 }
188
189 m_fCurrentSlideTime = 0.0f;
190
191 Toshi::TPString8 pictureName;
193 AGUISystem::GetSingleton()->SetPicture( pictureName );
194}

◆ Update()

void AGUISlideshow::Update ( TFLOAT a_fDeltaTime)

Definition at line 135 of file AGUISlideshow.cpp.

136{
137 if ( m_bIsActive && !IsSlideshowOver() )
138 {
139 m_fCurrentSlideTime += a_fDeltaTime;
140
141 if ( m_bIsAppearing )
142 {
144 return;
145 }
146
147 m_fUnk2 += a_fDeltaTime;
148
150 {
152 }
153
155 return;
156 }
157
158 m_FadeOverlay.Unlink();
159}
TBOOL IsSlideshowOver()

◆ UpdateFadeOverlay()

void AGUISlideshow::UpdateFadeOverlay ( )

Definition at line 85 of file AGUISlideshow.cpp.

86{
87 TFLOAT fOpacity;
88
89 if ( !m_bIsAppearing )
90 {
92 {
94 {
95 fOpacity = 0.0f;
96 }
97 else
98 {
100
101 if ( fOpacity > 1.0f )
102 {
103 fOpacity = 1.0f;
104 }
105 }
106 }
107 else
108 {
109 fOpacity = 1.0f - m_fCurrentSlideTime / m_fFadeInTime;
110 }
111 }
112 else
113 {
115
116 if ( fOpacity >= 1.0f )
117 {
118 Toshi::TPString8 pictureName;
120 AGUISystem::GetSingleton()->SetPicture( pictureName );
121
123 m_fCurrentSlideTime = 0.0f;
124 fOpacity = 1.0f;
125 }
126 }
127
128 TASSERT( fOpacity <= 1.0f );
129 m_FadeOverlay.SetColour( TUINT32( fOpacity * 255 ) << 24 );
130 m_FadeOverlay.Unlink();
132 m_FadeOverlay.Show();
133}
uint32_t TUINT32
Definition Typedefs.h:13
static AGUI2Element * GetRootElement()
Definition AGUI2.h:31
void AddChildTail(AGUI2Element &a_rElement)

Member Data Documentation

◆ m_bIsActive

TBOOL AGUISlideshow::m_bIsActive
protected

Definition at line 77 of file AGUISlideshow.h.

◆ m_bIsAppearing

TBOOL AGUISlideshow::m_bIsAppearing
protected

Definition at line 85 of file AGUISlideshow.h.

◆ m_bShouldLocalise

TBOOL AGUISlideshow::m_bShouldLocalise
protected

Definition at line 86 of file AGUISlideshow.h.

◆ m_eFlags

Flags AGUISlideshow::m_eFlags
protected

Definition at line 76 of file AGUISlideshow.h.

◆ m_FadeOverlay

AGUI2Rectangle AGUISlideshow::m_FadeOverlay
protected

Definition at line 84 of file AGUISlideshow.h.

◆ m_fCurrentSlideTime

TFLOAT AGUISlideshow::m_fCurrentSlideTime
protected

Definition at line 78 of file AGUISlideshow.h.

◆ m_fDuration

TFLOAT AGUISlideshow::m_fDuration
protected

Definition at line 80 of file AGUISlideshow.h.

◆ m_fFadeInTime

TFLOAT AGUISlideshow::m_fFadeInTime
protected

Definition at line 81 of file AGUISlideshow.h.

◆ m_fFadeOutTime

TFLOAT AGUISlideshow::m_fFadeOutTime
protected

Definition at line 82 of file AGUISlideshow.h.

◆ m_fUnk2

TFLOAT AGUISlideshow::m_fUnk2
protected

Definition at line 79 of file AGUISlideshow.h.

◆ m_fUnk4

TFLOAT AGUISlideshow::m_fUnk4
protected

Definition at line 83 of file AGUISlideshow.h.

◆ m_ImageIterator

Toshi::T2DynamicVector<Toshi::TPString8>::Iterator AGUISlideshow::m_ImageIterator
protected

Definition at line 75 of file AGUISlideshow.h.

◆ m_Images

Toshi::T2DynamicVector<Toshi::TPString8> AGUISlideshow::m_Images
protected

Definition at line 74 of file AGUISlideshow.h.

◆ m_pHUDParams

AGameState::HUDParams* AGUISlideshow::m_pHUDParams
protected

Definition at line 73 of file AGUISlideshow.h.

◆ ms_oClass

Toshi::TClass AGUISlideshow::ms_oClass = Toshi::TClass( "AGUISlideshow", AGUISlideshow::PARENTCLASS, AGUISlideshow::CreateTObject, AGUISlideshow::CreateTObjectInPlace, AGUISlideshow::InitialiseClass, AGUISlideshow::DeinitialiseClass, 0, 1, sizeof( AGUISlideshow ), alignof( AGUISlideshow ) )
static

Definition at line 11 of file AGUISlideshow.h.

◆ PARENTCLASS

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

Definition at line 11 of file AGUISlideshow.h.


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