diff --git a/sp/src/game/shared/mapbase/protagonist_system.cpp b/sp/src/game/shared/mapbase/protagonist_system.cpp index 8a8720ac..b4eb1313 100644 --- a/sp/src/game/shared/mapbase/protagonist_system.cpp +++ b/sp/src/game/shared/mapbase/protagonist_system.cpp @@ -176,11 +176,11 @@ void CProtagonistSystem::LoadProtagonistFile( const char *pszFile ) else if (FStrEq( pszSubKeyName, "team" )) { #ifdef HL2MP - if (FStrEq( pszSubKeyName, "combine" )) + if (FStrEq( pSubKey->GetString(), "combine" )) { pProtag->nTeam = TEAM_COMBINE; } - else if (FStrEq( pszSubKeyName, "rebels" )) + else if (FStrEq( pSubKey->GetString(), "rebels" )) { pProtag->nTeam = TEAM_REBELS; } @@ -188,7 +188,7 @@ void CProtagonistSystem::LoadProtagonistFile( const char *pszFile ) #endif { // Try to get a direct integer - pProtag->nTeam = atoi( pszSubKeyName ); + pProtag->nTeam = atoi( pSubKey->GetString() ); } } #endif @@ -335,6 +335,12 @@ void CProtagonistSystem::PrecacheProtagonist( CBaseEntity *pSource, int nIdx ) ProtagonistData_t &pProtag = m_Protagonists[nIdx]; + // Don't if it's already precached + if (pProtag.bPrecached) + return; + + CBaseEntity::SetAllowPrecache( true ); + // Playermodel if (pProtag.pszPlayerModel) { @@ -358,6 +364,16 @@ void CProtagonistSystem::PrecacheProtagonist( CBaseEntity *pSource, int nIdx ) pSource->PrecacheModel( pProtag.dictWpnData[i].pszVM ); } } + + CBaseEntity::SetAllowPrecache( false ); + + // Precache parents + FOR_EACH_VEC( pProtag.vecParents, i ) + { + PrecacheProtagonist( pSource, pProtag.vecParents[i] ); + } + + pProtag.bPrecached = true; #endif } @@ -416,7 +432,6 @@ GetProtagParamBody( ResponseContexts, bool, GetProtagParamInner( ResponseConte int nLast = V_strlen( pszContexts )-1; if (pszContexts[nLast] == ',') { - Msg( "Removing trailing comma from \"%s\"\n", pszContexts ); pszContexts[nLast] = '\0'; } } @@ -681,6 +696,11 @@ void CProtagonistSystem::PrintProtagonistData() if (pProtag.pszPlayerModel) Msg( "\t\tPlayer model: \"%s\" (%i, %i)\n", pProtag.pszPlayerModel, pProtag.nPlayerSkin, pProtag.nPlayerBody ); +#ifdef HL2MP + if ( pProtag.nTeam != TEAM_ANY ) + Msg( "\t\tTeam: %i\n", pProtag.nTeam ); +#endif + for (int j = 0; j < NUM_HAND_RIG_TYPES; j++) { extern const char *pHandRigs[NUM_HAND_RIG_TYPES]; diff --git a/sp/src/game/shared/mapbase/protagonist_system.h b/sp/src/game/shared/mapbase/protagonist_system.h index 396187c2..e678bc90 100644 --- a/sp/src/game/shared/mapbase/protagonist_system.h +++ b/sp/src/game/shared/mapbase/protagonist_system.h @@ -61,6 +61,9 @@ private: // Multiplayer int nTeam = TEAM_ANY; + + // Precached (used by system, not actual data) + bool bPrecached = false; #endif // Weapon Data