void CFlock::CreateBoids(SBoidsCreateContext &ctx ) { m_createContext = ctx; ClearBoids(); if (!m_e_flocks) return; if (!ctx.models.empty()) m_model = ctx.models[0]; static ICVar* e_obj_quality(gEnv->pConsole->GetCVar("e_ObjQuality")); int obj_quality = 0; if (e_obj_quality) obj_quality = e_obj_quality->GetIVal(); ////////////////////////////////////////////////////////////////////////// // Scale boids down depended on spec ////////////////////////////////////////////////////////////////////////// if (obj_quality == CONFIG_LOW_SPEC) { if (ctx.boidsCount > 10) ctx.boidsCount /= 4; if (ctx.boidsCount > 20) ctx.boidsCount = 20; } if (obj_quality == CONFIG_MEDIUM_SPEC) { if (ctx.boidsCount > 10) ctx.boidsCount /= 2; } m_RequestedBoidsCount = ctx.boidsCount; if (ctx.boidsCount == 0) return; ////////////////////////////////////////////////////////////////////////// // precache flock model m_pPrecacheCharacter = 0; if (IsCharacterFile(m_model) && gEnv && gEnv->pCharacterManager) m_pPrecacheCharacter = gEnv->pCharacterManager->CreateInstance(m_model); if (!m_pPrecacheCharacter) return; m_pPrecacheCharacter->GetICharacterModel()->AddRef(); //strange workaround for Decide m_pPrecacheCharacter->GetICharacterModel()->AddRef(); }
void CFlock::CreateBoids(SBoidsCreateContext &ctx ) { m_createContext = ctx; ClearBoids(); if (!m_e_flocks) return; if (!ctx.models.empty()) m_model = ctx.models[0]; static ICVar* e_obj_quality(gEnv->pConsole->GetCVar("e_ObjQuality")); int obj_quality = 0; if (e_obj_quality) obj_quality = e_obj_quality->GetIVal(); ////////////////////////////////////////////////////////////////////////// // Scale boids down depended on spec ////////////////////////////////////////////////////////////////////////// if (obj_quality == CONFIG_LOW_SPEC) { if (ctx.boidsCount > 10) ctx.boidsCount /= 4; if (ctx.boidsCount > 20) ctx.boidsCount = 20; } if (obj_quality == CONFIG_MEDIUM_SPEC) { if (ctx.boidsCount > 10) ctx.boidsCount /= 2; } m_RequestedBoidsCount = ctx.boidsCount; if (ctx.boidsCount == 0) return; ////////////////////////////////////////////////////////////////////////// // precache flock model CGameCache &gameCache = g_pGame->GetGameCache(); if (IsCharacterFile(m_model) || IsStatObjFile(m_model)) { gameCache.CacheGeometry(m_model); } }
CFlock::~CFlock() { ClearBoids(); RegisterAIEventListener(false); }