OpenBarnyard
 
Loading...
Searching...
No Matches
AGameSystemManager.cpp
Go to the documentation of this file.
1#include "pch.h"
13
14#include <Toshi/TScheduler.h>
16
17//-----------------------------------------------------------------------------
18// Enables memory debugging.
19// Note: Should be the last include!
20//-----------------------------------------------------------------------------
21#include <Core/TMemoryDebugOn.h>
22
24
26
28{
29 TIMPLEMENT();
30
31 // Load keylibs from the startup library
32 TString8 startupLibFileName;
33 startupLibFileName.Format( "Data/%s.trb", "lib_startup" );
34
35 TTRB startupLibTrb;
36 startupLibTrb.Load( startupLibFileName );
37 auto pProperties = PBProperties::LoadFromTRB( startupLibTrb );
38 auto pKeylibProperty = pProperties->GetProperty( "keylib" );
39
40 if ( pKeylibProperty )
41 {
42 AKeyFrameLibraryManager::GetSingleton()->LoadLibrariesFromProperties(
43 pKeylibProperty,
44 &startupLibTrb
45 );
46 }
47
48 TGetClass( AModelRepos ).CreateObject();
49
50 auto pScheduler = g_oSystemManager.GetScheduler();
51 pScheduler->CreateTask<AAnimatableObjectManager>( this )->Create();
52
53 AAnimatableObjectManager::GetSingleton()->LoadAnimSoundBreakpoints( "Data/Sound/AnimSoundBP.trb" );
54
55 // Initialise lighting manages for skinned meshes
56 ASkinLightingManager::CreateSingleton();
57
58 // Initialise some basic things like cameras, music and more
59 pScheduler->CreateTask<ACameraManager>( this )->Create();
60 pScheduler->CreateTask<AMusicManager>( this )->Create();
61
62 // Load models from the startup library
63 AAnimatableObjectManager::GetSingleton()->LoadTypesFromLibrary( "lib_startup" );
64
65 pScheduler->CreateTask<ASimAnimModelHelperManager>( this )->Create();
66
67 AAssetStreaming::CreateSingleton()->SetFlag( TFALSE );
68
69 // Instances, trees and other things...
70 ATreeManager::CreateSingleton()->Initialise();
71
72 return TTRUE;
73}
74
76{
77 TIMPLEMENT();
78
79 AAssetStreaming::GetSingleton()->Update();
80
81 if ( ATerrainInterface::IsSingletonCreated() )
82 {
83 ATerrainInterface::GetSingleton()->Update();
84 }
85
86 return TTRUE;
87}
#define TIMPLEMENT()
Definition Defines.h:136
#define TOSHI_NAMESPACE_USING
Definition Defines.h:46
#define TGetClass(CLASS)
Definition TObject.h:13
#define TDEFINE_CLASS(...)
Definition TObject.h:120
float TFLOAT
Definition Typedefs.h:4
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
bool TBOOL
Definition Typedefs.h:6
TSystemManager g_oSystemManager
Definition TSystem.cpp:15
Definition TTRB.h:253
ERROR Load(const TCHAR *a_szFilePath, TUINT32 a_uiUnknown=0)
Definition TTRB.cpp:38
TString8 & Format(const TCHAR *a_pcFormat,...)
Definition TString8.cpp:176
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) override
virtual TBOOL OnCreate() override