|
6 | 6 | #include "Player/APlayerManager.h" |
7 | 7 | #include "Sound/ASoundManager.h" |
8 | 8 | #include "Helpers/AInstanceManager.h" |
| 9 | +#include "Physics/ACollisionManager.h" |
| 10 | +#include "GameInterface/AFrontEndMainMenuState2.h" |
9 | 11 |
|
10 | 12 | //----------------------------------------------------------------------------- |
11 | 13 | // Enables memory debugging. |
@@ -248,3 +250,86 @@ void AGameLoader::Terrain_Load() |
248 | 250 | if ( AGameLoader::IsChangingTerrain() ) |
249 | 251 | pTerrain->m_fnGetCurrentVISGroup = ATerrainInterface::GetSectionPlayerIsIn; |
250 | 252 | } |
| 253 | + |
| 254 | + |
| 255 | +TPSTRING8_DECLARE( ui ); |
| 256 | +TPSTRING8_DECLARE( music ); |
| 257 | + |
| 258 | +// TODO: move this away from here |
| 259 | +static TUINT s_aFrontEndInstanceModels[] = { |
| 260 | + 0x13, 0x14, 0x15, 0x16, |
| 261 | + 0x4A, 0x4B, 0x84, 0x47, |
| 262 | + 0x38, 0x3F, 0x37, 0x46, |
| 263 | + 0x0, 0x1, 0x2, 0x3, |
| 264 | + 0x4, 0x5, 0x6, 0x7, |
| 265 | + 0x8, 0x9, 0xA, 0xB, |
| 266 | + 0xC, 0xD, 0xE, 0xF, |
| 267 | + 0x10, 0x11, 0x12, 0x18, |
| 268 | + 0x1D, 0x1E, 0x1F, 0x20, |
| 269 | + 0x24, 0x25, 0x26, 0x27, |
| 270 | + 0x28, 0x29, 0x2A, 0x2B, |
| 271 | + 0x2C, 0x2D, 0x2E, 0x2F, |
| 272 | + 0x30, 0x31, 0x34, 0x35, |
| 273 | + 0x36, 0x39, 0x3A, 0x3B, |
| 274 | + 0x3C, 0x3D, 0x3E, 0x41, |
| 275 | + 0x40, 0x42, 0x43, 0x44, |
| 276 | + 0x45, 0x48, 0x49, 0x4C, |
| 277 | + 0x4D, 0x75, 0x76, 0x4F, |
| 278 | + 0x5A, 0x59, 0x80, 0x81, |
| 279 | + 0x82, 0x83, 0x85, 0x86 |
| 280 | +}; |
| 281 | +static constexpr TINT s_iNumFrontEndInstanceModels = TARRAYSIZE( s_aFrontEndInstanceModels ); |
| 282 | +static constexpr TINT s_iNumFrontEndCollModelNodes = 720; |
| 283 | + |
| 284 | +// $Barnyard: FUNCTION 00427c40 |
| 285 | +void AGameLoader::LoadFrontEnd() |
| 286 | +{ |
| 287 | + TIMPLEMENT(); |
| 288 | + ASoundManager* pSoundManager = ASoundManager::GetSingleton(); |
| 289 | + |
| 290 | + // Load ui & music soundbanks |
| 291 | + pSoundManager->LoadSoundBank( TPS8( ui ), TFALSE, TTRUE ); |
| 292 | + pSoundManager->LoadSoundBank( TPS8( music ), TFALSE, TFALSE ); |
| 293 | + |
| 294 | + AGameLoader::Debug_VerifyModelsInAssetPack( AAssetLoader::GetAssetTRB( AAssetType_Startup ) ); |
| 295 | + |
| 296 | + AAssetLoader::LoadAssetPackOfLibrary( "lib_frontend", TTRUE ); |
| 297 | + ACollisionManager::GetSingleton()->CreateObjectHashMain( ACollisionManager::HashType_UNK2 ); |
| 298 | + AInstanceManager::GetSingleton()->LoadModels( 1, s_iNumFrontEndInstanceModels, s_aFrontEndInstanceModels, TFALSE, TFALSE, s_iNumFrontEndCollModelNodes ); |
| 299 | + |
| 300 | + AGameLoader::Terrain_Set( AGameLoader::Terrain_FrontEnd, TTRUE, TTRUE, 0, 0, 0, 0 ); |
| 301 | + AGameLoader::Terrain_Load(); |
| 302 | + AAssetLoader::CreateAssetsFromLibrary( "lib_frontend" ); |
| 303 | + |
| 304 | + // Load music wavebank samples |
| 305 | + ASoundManager::ms_bShouldUpdateLoadingScreen = TTRUE; |
| 306 | + pSoundManager->LoadWaveBankSamples( TPS8( music ), AWaveBank::LOADFLAGS_NONE, -1 ); |
| 307 | + ASoundManager::ms_bShouldUpdateLoadingScreen = TFALSE; |
| 308 | + |
| 309 | + // Load music samples |
| 310 | + pSoundManager->LoadSoundBankSamples( TPS8( music ) ); |
| 311 | + |
| 312 | + // Create front end state |
| 313 | + AFrontEndMainMenuState2* pFrontEndState = new AFrontEndMainMenuState2(); |
| 314 | + AGameLoader::Terrain_Set( AGameLoader::Terrain_FrontEnd, TFALSE, TTRUE, 0, 0, 0, 0 ); |
| 315 | + pFrontEndState->SetupCamera(); |
| 316 | + |
| 317 | + AGameLoader::Terrain_Load(); |
| 318 | + |
| 319 | + ARootTask::GetSingleton()->SetRenderWorld( TTRUE ); |
| 320 | + |
| 321 | + // Push the state |
| 322 | + AGameStateController::GetSingleton()->PushState( pFrontEndState ); |
| 323 | + AGameLoader::Debug_VerifyModelsInAssetPack( AAssetLoader::GetAssetTRB( AAssetType_AssetPack ) ); |
| 324 | + |
| 325 | + // Hide loading screen |
| 326 | + g_oLoadScreen.Reset(); |
| 327 | + g_oLoadScreen.SetLoadingState( TFALSE, TTRUE ); |
| 328 | + |
| 329 | + // Fade screen from black |
| 330 | + AFadeManager::GetSingleton()->StartFade( |
| 331 | + AFade::Color( 255, 0, 0, 0 ), |
| 332 | + AFade::Color( 0, 0, 0, 0 ), |
| 333 | + 1.0f |
| 334 | + ); |
| 335 | +} |
0 commit comments