@@ -1414,16 +1414,20 @@ CStreamingInfo* GetStreamingInfoFromModelId ( uint id )
14141414void OnMY_CAnimManager_CreateAnimAssocGroups ( uint uiModelId )
14151415{
14161416 CModelInfo* pModelInfo = pGameInterface->GetModelInfo ( uiModelId );
1417+ CBaseModelInfoSAInterface* pModelInfoSAInterface = pModelInfo->GetInterface ();
14171418 bool bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
14181419 bool bHasRwObject = ( pModelInfo->GetInterface ()->pRwObject != NULL );
14191420 int iRefCount = pModelInfo->GetRefCount ();
1421+ unsigned short usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs ;
14201422 CStreamingInfo* pStreamingInfo = GetStreamingInfoFromModelId ( uiModelId );
14211423
14221424 if ( !bIsLoaded || !bHasRwObject || pStreamingInfo->reqload != 1 )
14231425 {
1424- AddReportLog ( 7440 , SString ( " CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d"
1426+ for ( uint i = 0 ; i < 2 ; i++ )
1427+ {
1428+ AddReportLog ( 7440 , SString ( " CAnimManager_CreateAnimAssocGroups: Unexpected id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
14251429 " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1426- , uiModelId, bIsLoaded, bHasRwObject, iRefCount
1430+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
14271431 , pStreamingInfo->gta_hash
14281432 , pStreamingInfo->chain_next
14291433 , pStreamingInfo->flg
@@ -1435,19 +1439,42 @@ void OnMY_CAnimManager_CreateAnimAssocGroups( uint uiModelId )
14351439
14361440 pModelInfo->Request ( BLOCKING, " AnimAssocGroups" );
14371441
1442+ uint uiTimeTaken = 0 ;
1443+ while ( pStreamingInfo->reqload == 2 && uiTimeTaken < 3000 )
1444+ {
1445+ Sleep ( 100 );
1446+ uiTimeTaken += 100 ;
1447+ pGameInterface->GetStreaming ()->LoadAllRequestedModels ( true , " AnimAssocGroups" );
1448+ pGameInterface->GetStreaming ()->LoadAllRequestedModels ( false , " AnimAssocGroups" );
1449+ }
1450+
14381451 bIsLoaded = ( pModelInfo->IsLoaded () != 0 );
14391452 bHasRwObject = ( pModelInfo->GetInterface ()->pRwObject != NULL );
1440- AddReportLog ( 7441 , SString ( " CAnimManager_CreateAnimAssocGroups: Load result id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d"
1441- " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d"
1442- , uiModelId, bIsLoaded, bHasRwObject, iRefCount
1453+ iRefCount = pModelInfo->GetRefCount ();
1454+ usNumberOfRefs = pModelInfoSAInterface->usNumberOfRefs ;
1455+ AddReportLog ( 7441 , SString ( " CAnimManager_CreateAnimAssocGroups: Load result id:%d bIsLoaded:%d bHasRwObject:%d iRefCount:%d usNumberOfRefs:%d"
1456+ " gta_hash:%08x chain_next:%04x flg:%02x arch:%d offset:%d size:%d reqload:%d uiTimeTaken:%d"
1457+ , uiModelId, bIsLoaded, bHasRwObject, iRefCount, usNumberOfRefs
14431458 , pStreamingInfo->gta_hash
14441459 , pStreamingInfo->chain_next
14451460 , pStreamingInfo->flg
14461461 , pStreamingInfo->archiveId
14471462 , pStreamingInfo->offsetInBlocks
14481463 , pStreamingInfo->sizeInBlocks
14491464 , pStreamingInfo->reqload
1465+ , uiTimeTaken
14501466 ) );
1467+
1468+ if ( pStreamingInfo->reqload != 2 )
1469+ break ;
1470+
1471+ if ( i == 0 )
1472+ {
1473+ // If still loading, remove and retry
1474+ pModelInfo->ModelAddRef ( BLOCKING, " " );
1475+ pModelInfo->RemoveRef ();
1476+ }
1477+ }
14511478 }
14521479}
14531480
0 commit comments