void CHLClient::UncacheAllMaterials( ) { for (int i = m_CachedMaterials.Count(); --i >= 0; ) { m_CachedMaterials[i]->DecrementReferenceCount(); } m_CachedMaterials.RemoveAll(); }
void CUtlSymbolTable::RemoveAll() { m_Lookup.RemoveAll(); for ( int i=0; i < m_StringPools.Count(); i++ ) free( m_StringPools[i] ); m_StringPools.RemoveAll(); }
// Creates a list of watermodel_t for later processing by EmitPhysCollision void EmitWaterVolumesForBSP( dmodel_t *pModel, node_t *node ) { CUtlVector<node_t *> leafListAnyWater; // build the list of all leaves containing water EnumLeaves_r( leafListAnyWater, node, MASK_WATER ); // make a sorted list to flood fill CUtlVector<waterleaf_t> list; int i; for ( i = 0; i < leafListAnyWater.Count(); i++ ) { waterleaf_t waterLeaf; BuildWaterLeaf( leafListAnyWater[i], waterLeaf ); InsertSortWaterLeaf( list, waterLeaf ); } leafbitarray_t visited; CUtlVector<node_t *> waterAreaList; for ( i = 0; i < list.Count(); i++ ) { Flood_FindConnectedWaterVolumes_r( waterAreaList, list[i].pNode, list[i], visited ); // did we find a list of leaves connected to this one? // remember the list is sorted, so this one may have been attached to a previous // leaf. So it could have nothing hanging off of it. if ( waterAreaList.Count() ) { // yes, emit a watermodel watermodel_t tmp; tmp.modelIndex = nummodels; tmp.contents = list[i].pNode->contents; tmp.waterLeafData = list[i]; tmp.firstWaterLeafIndex = g_WaterLeafList.Count(); tmp.waterLeafCount = waterAreaList.Count(); float waterDepth = tmp.waterLeafData.surfaceDist - tmp.waterLeafData.minZ; if ( tmp.waterLeafData.surfaceTexInfo < 0 ) { // the map has probably leaked in this case, but output something anyway. Assert(list[i].pNode->planenum == PLANENUM_LEAF); tmp.waterLeafData.surfaceTexInfo = FirstWaterTexinfo( list[i].pNode->brushlist, tmp.contents ); } tmp.depthTexinfo = FindOrCreateWaterTexInfo( &texinfo[ tmp.waterLeafData.surfaceTexInfo ], waterDepth ); tmp.fogVolumeIndex = FindOrCreateLeafWaterData( tmp.waterLeafData.surfaceDist, tmp.waterLeafData.minZ, tmp.waterLeafData.surfaceTexInfo ); for ( int j = 0; j < waterAreaList.Count(); j++ ) { g_WaterLeafList.AddToTail( waterAreaList[j]->diskId ); } waterAreaList.RemoveAll(); g_WaterModels.AddToTail( tmp ); } } WriteFogVolumeIDs( pModel ); }
// static method void CBuildFactoryHelper::GetFactoryNames( CUtlVector< char const * >& list ) { list.RemoveAll(); CBuildFactoryHelper *p = m_sHelpers; while ( p ) { list.AddToTail( p->GetClassName() ); p = p->GetNext(); } }
// Thiis is a hack due to the fact that the user can type quit with the video panel up, but it's parented to the GameUI dll root panel, which is already gone so // we would crash in the destructor void VGui_ClearVideoPanels() { for ( int i = g_vecVideoPanels.Count() - 1; i >= 0; --i ) { if ( g_vecVideoPanels[ i ] ) { delete g_vecVideoPanels[ i ]; } } g_vecVideoPanels.RemoveAll(); }
//----------------------------------------------------------------------------- // Purpose: Shuts down all modules //----------------------------------------------------------------------------- void CToolFrameworkInternal::ShutdownModules() { // Shutdown dictionaries int i; for ( i = m_Modules.Count(); --i >= 0; ) { Sys_UnloadModule( m_Modules[i] ); } m_Modules.RemoveAll(); }
//----------------------------------------------------------------------------- // Purpose: Frees all the template data. Called on level shutdown. //----------------------------------------------------------------------------- void Templates_RemoveAll(void) { int nCount = g_Templates.Count(); for (int i = 0; i < nCount; i++) { TemplateEntityData_t *pTemplate = g_Templates.Element(i); Templates_FreeTemplate( pTemplate ); } g_Templates.RemoveAll(); }
void RemoveAll( void ) { for ( int i = 0; i < m_PanelList.Size(); i++ ) { PanelItem_t *item = &m_PanelList[i]; delete item->m_EditLabel; delete item->m_EditPanel; delete item->m_EditButton; } m_PanelList.RemoveAll(); m_pControls->RemoveAll(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSchemeManager::Shutdown( bool full ) { // Full shutdown kills the null scheme for( int i = full ? 0 : 1; i < m_Schemes.Count(); i++ ) { m_Schemes[i]->Shutdown( full ); } if ( full ) { m_Schemes.RemoveAll(); } }
void CTilegenAction_ChooseCandidate::Execute( CLayoutSystem *pLayoutSystem ) { CUtlVector< CRoomCandidate > *pRoomCandidateList = pLayoutSystem->GetRoomCandidateList(); if ( pRoomCandidateList->Count() == 0 ) { Log_Msg( LOG_TilegenLayoutSystem, "No more room candidates to choose from.\n" ); pLayoutSystem->GetFreeVariables()->SetOrCreateFreeVariable( "ChoseCandidate", ( void * )0 ); return; } int i; float flChance = 0.0f; for ( i = 0; i < pRoomCandidateList->Count(); ++ i ) { flChance += pRoomCandidateList->Element( i ).m_flCandidateChance; } float flRandom = pLayoutSystem->GetRandomFloat( 0.0f, 1.0f ) * flChance; for ( i = 0; i < pRoomCandidateList->Count(); ++ i ) { flRandom -= pRoomCandidateList->Element( i ).m_flCandidateChance; if ( flRandom <= 0.0f ) { break; } } if ( i == pRoomCandidateList->Count() ) { i = pRoomCandidateList->Count() - 1; } const CRoomCandidate *pCandidate = &pRoomCandidateList->Element( i ); // This should always succeed since it's in the candidate list to begin with bool bSuccess = pLayoutSystem->TryPlaceRoom( pCandidate ); Assert( bSuccess ); bSuccess; Log_Msg( LOG_TilegenLayoutSystem, "Chose room candidate %s at position (%d, %d).\n", pCandidate->m_pRoomTemplate->GetFullName(), pCandidate->m_iXPos, pCandidate->m_iYPos ); // Empty the room candidate list for future actions pRoomCandidateList->RemoveAll(); if ( m_bStopProcessingActionsOnSuccess ) { pLayoutSystem->StopProcessingActions(); } pLayoutSystem->GetFreeVariables()->SetOrCreateFreeVariable( "ChoseCandidate", ( void * )1 ); }
void CPlaneList::AddBrushes( void ) { CUtlVector<listplane_t> temp; for ( int brushnumber = 0; brushnumber < numbrushes; brushnumber++ ) { if ( IsBrushReferenced(brushnumber) ) { CUtlVector<winding_t *> windings; for ( int i = 0; i < dbrushes[brushnumber].numsides; i++ ) { dbrushside_t *pside = dbrushsides + i + dbrushes[brushnumber].firstside; if (pside->bevel) continue; dplane_t *pplane = dplanes + pside->planenum; winding_t *w = BaseWindingForPlane( pplane->normal, pplane->dist - m_shrink ); for ( int j = 0; j < dbrushes[brushnumber].numsides && w; j++ ) { if (i == j) continue; dbrushside_t *pClipSide = dbrushsides + j + dbrushes[brushnumber].firstside; if (pClipSide->bevel) continue; dplane_t *pClipPlane = dplanes + pClipSide->planenum; ChopWindingInPlace (&w, -pClipPlane->normal, -pClipPlane->dist+m_shrink, 0); //CLIP_EPSILON); } if ( w ) { windings.AddToTail( w ); } } CUtlVector<Vector *> vertList; for ( int p = 0; p < windings.Count(); p++ ) { for ( int v = 0; v < windings[p]->numpoints; v++ ) { vertList.AddToTail( windings[p]->p + v ); } } CPhysConvex *pConvex = physcollision->ConvexFromVerts( vertList.Base(), vertList.Count() ); if ( pConvex ) { physcollision->SetConvexGameData( pConvex, brushnumber ); AddConvex( pConvex ); } temp.RemoveAll(); } } }
void CGECharacters::GetTeamMembers( int team, CUtlVector<const CGECharData*> &members ) const { if ( !m_pCharacters.Count() ) return; members.RemoveAll(); // Add our sorted list next, filter for team for ( int i=0; i < m_pCharacters.Count(); i++ ) { if ( team == TEAM_UNASSIGNED || m_pCharacters[i]->iTeam == team ) members.AddToTail( m_pCharacters[i] ); } }
// Write the buffered crap out on shutdown. void FinishRecording() { #ifndef CRASH_RECORDING FILE* fp = OpenRecordingFile(); if (fp) { // store the command size fwrite( g_pRecordingBuffer.Base(), 1, g_pRecordingBuffer.Size(), fp ); fflush( fp ); } g_pRecordingBuffer.RemoveAll(); #endif }
void PerfThread_SendSpewText() { // Send the spew text to the database. CCriticalSectionLock csLock( &g_SpewTextCS ); csLock.Lock(); if ( g_SpewText.Count() > 0 ) { g_SpewText.AddToTail( 0 ); g_pDB->AddCommandToQueue( new CSQLDBCommand_TextMessage( g_SpewText.Base() ), NULL ); g_SpewText.RemoveAll(); } csLock.Unlock(); }
void Update() { if ( tickCount > gpGlobals->tickcount ) { list.RemoveAll(); return; } for ( int i = list.Count()-1; i >= 0; --i ) { if ( list[i].tickCount != gpGlobals->tickcount ) { list.FastRemove(i); } } }
int CFileLoaderThread::ProcessCompleted() { Lock(); int c = m_Completed.Count(); for ( int i = c - 1; i >= 0 ; i-- ) { SentenceRequest *r = m_Completed[ i ]; r->wavefile->SetThreadLoadedSentence( r->sentence ); delete r; } m_Completed.RemoveAll(); Unlock(); return c; }
//----------------------------------------------------------------------------- // Purpose: Shuts down all tool dictionaries //----------------------------------------------------------------------------- void CToolFrameworkInternal::ShutdownToolDictionaries() { // Shutdown dictionaries int i; for ( i = m_Dictionaries.Count(); --i >= 0; ) { m_Dictionaries[i]->Shutdown(); } for ( i = m_Dictionaries.Count(); --i >= 0; ) { m_Dictionaries[i]->Disconnect(); } m_Dictionaries.RemoveAll(); }
void C_SceneEntity::CheckQueuedEvents() { // Check for duplicates CUtlVector< QueuedEvents_t > events; events = m_QueuedEvents; m_QueuedEvents.RemoveAll(); int c = events.Count(); for ( int i = 0; i < c; ++i ) { const QueuedEvents_t& check = events[ i ]; // Retry starting this event StartEvent( check.starttime, check.scene, check.event ); } }
// call this before and after each frame to delete all of the marked entities. void CGlobalEntityList::CleanupDeleteList( void ) { VPROF( "CGlobalEntityList::CleanupDeleteList" ); g_fInCleanupDelete = true; // clean up the vphysics delete list as well PhysOnCleanupDeleteList(); g_bDisableEhandleAccess = true; for ( int i = 0; i < g_DeleteList.Count(); i++ ) { g_DeleteList[i]->Release(); } g_bDisableEhandleAccess = false; g_DeleteList.RemoveAll(); g_fInCleanupDelete = false; }
void C_CFPlayer::ShowHandMagic(C_BaseEntity* pEnt, CUtlVector<CNewParticleEffect*>& aHandComboEffects, element_t eElements, const char* pszAttachment) { MDLCACHE_CRITICAL_SECTION(); int i; for (i = 0; i < aHandComboEffects.Count(); i++) pEnt->ParticleProp()->StopEmission(aHandComboEffects[i]); aHandComboEffects.RemoveAll(); for (i = 0; i < TOTAL_ELEMENTS; i++) { if (!(eElements&(1<<i))) continue; aHandComboEffects.AddToTail(pEnt->ParticleProp()->Create( VarArgs("hand_%s", ElementToString((element_t)(1<<i))), PATTACH_POINT_FOLLOW, pszAttachment )); } }
//----------------------------------------------------------------------------- // Purpose: Seperates out a newline-seperated map list into an array //----------------------------------------------------------------------------- void CServerInfoPanel::ParseIntoMapList(const char *maplist, CUtlVector<CUtlSymbol> &mapArray) { mapArray.RemoveAll(); const char *parse = maplist; while (*parse) { // newline-seperated map list //!! this should be done with a more standard tokenizer if (isspace(*parse)) { parse++; continue; } // pull out the map name const char *end = strstr(parse, "\n"); const char *end2 = strstr(parse, "\r"); if (end && end2 && end2 < end) { end = end2; } if (!end) break; char customString[64]; int nameSize = end - parse; if (nameSize >= sizeof(customString)) { nameSize = sizeof(customString) - 1; } // copy in the name strncpy(customString, parse, nameSize); customString[nameSize] = 0; parse = end; // add to the list string that aren't comments if (nameSize > 0 && !(customString[0] == '/' && customString[1] == '/')) { int i = mapArray.AddToTail(); mapArray[i] = customString; } } }
static void ThreadComputeLeafAmbient( int iThread, void *pUserData ) { CUtlVector<ambientsample_t> list; while (1) { int leafID = GetThreadWork (); if (leafID == -1) break; list.RemoveAll(); ComputeAmbientForLeaf(iThread, leafID, list); // copy to the output array g_LeafAmbientSamples[leafID].SetCount( list.Count() ); for ( int i = 0; i < list.Count(); i++ ) { g_LeafAmbientSamples[leafID].Element(i) = list.Element(i); } } }
// look for dead/spectating players in our volume, to call touch on void CTriggerSoundscape::PlayerUpdateThink() { int i; SetNextThink( gpGlobals->curtime + 0.2 ); CUtlVector<CBasePlayerHandle> oldSpectators; oldSpectators = m_spectators; m_spectators.RemoveAll(); for ( i=1; i <= gpGlobals->maxClients; ++i ) { CBasePlayer *player = UTIL_PlayerByIndex( i ); if ( !player ) continue; if ( player->IsAlive() ) continue; // if the spectator is intersecting the trigger, track it, and start a touch if it is just starting to touch if ( Intersects( player ) ) { if ( !oldSpectators.HasElement( player ) ) { StartTouch( player ); } m_spectators.AddToTail( player ); } } // check for spectators who are no longer intersecting for ( i=0; i<oldSpectators.Count(); ++i ) { CBasePlayer *player = oldSpectators[i]; if ( !player ) continue; if ( !m_spectators.HasElement( player ) ) { EndTouch( player ); } } }
void CSoundCombiner::CleanupWork() { int c = m_Work.Count(); for ( int i = 0; i < c; ++i ) { CombinerWork *workitem = m_Work[ i ]; delete workitem->mixer; delete workitem->wave; delete m_Work[ i ]; } m_Work.RemoveAll(); delete m_pOutIterator; m_pOutIterator = NULL; delete m_pOutRIFF; m_pOutRIFF = NULL; }
//----------------------------------------------------------------------------- // Purpose: Shuts down all tools // Input : - //----------------------------------------------------------------------------- void CToolFrameworkInternal::ShutdownTools() { // Deactivate tool SwitchToTool( -1 ); // Reverse order int i; int toolCount = m_ToolSystems.Count(); for ( i = toolCount - 1; i >= 0; --i ) { IToolSystem *system = m_ToolSystems[ i ]; system->Shutdown(); } m_ToolSystems.RemoveAll(); ShutdownToolDictionaries(); ShutdownModules(); }
//----------------------------------------------------------------------------- // This is what happens before rendering a particular view //----------------------------------------------------------------------------- void CClientLeafSystem::PreRender() { VPROF( "CClientLeafSystem::PreRender" ); // Iterate through all renderables and tell them to compute their FX blend for ( int i = m_DirtyRenderables.Count(); --i >= 0; ) { ClientRenderHandle_t handle = m_DirtyRenderables[i]; RenderableInfo_t& renderable = m_Renderables[ handle ]; Assert( renderable.m_Flags & RENDER_FLAGS_HASCHANGED ); // Update position in leaf system RemoveFromTree( handle ); InsertIntoTree( handle ); renderable.m_Flags &= ~RENDER_FLAGS_HASCHANGED; } m_DirtyRenderables.RemoveAll(); }
//----------------------------------------------------------------------------- // Purpose: Frees all the template data. Called on level shutdown. //----------------------------------------------------------------------------- void Templates_RemoveAll(void) { int nCount = g_Templates.Count(); for (int i = 0; i < nCount; i++) { TemplateEntityData_t *pTemplate = g_Templates.Element(i); free((void *)pTemplate->pszName); free(pTemplate->pszMapData); if ( pTemplate->pszFixedMapData ) { free(pTemplate->pszFixedMapData); } free(pTemplate); } g_Templates.RemoveAll(); }
void ComputeAmbientForLeaf( int iThread, int leafID, CUtlVector<ambientsample_t> &list ) { CUtlVector<dplane_t> leafPlanes; CLeafSampler sampler( iThread ); GetLeafBoundaryPlanes( leafPlanes, leafID ); list.RemoveAll(); // this heuristic tries to generate at least one sample per volume (chosen to be similar to the size of a player) in the space int xSize = (dleafs[leafID].maxs[0] - dleafs[leafID].mins[0]) / 32; int ySize = (dleafs[leafID].maxs[1] - dleafs[leafID].mins[1]) / 32; int zSize = (dleafs[leafID].maxs[2] - dleafs[leafID].mins[2]) / 64; xSize = max(xSize,1); ySize = max(xSize,1); zSize = max(xSize,1); // generate update 128 candidate samples, always at least one sample int volumeCount = xSize * ySize * zSize; if ( g_bFastAmbient ) { // save compute time, only do one sample volumeCount = 1; } int sampleCount = clamp( volumeCount, 1, 128 ); if ( dleafs[leafID].contents & CONTENTS_SOLID ) { // don't generate any samples in solid leaves // NOTE: We copy the nearest non-solid leaf sample pointers into this leaf at the end return; } Vector cube[6]; for ( int i = 0; i < sampleCount; i++ ) { // compute each candidate sample and add to the list Vector samplePosition; sampler.GenerateLeafSamplePosition( leafID, leafPlanes, samplePosition ); ComputeAmbientFromSphericalSamples( iThread, samplePosition, cube ); // note this will remove the least valuable sample once the limit is reached AddSampleToList( list, samplePosition, cube ); } // remove any samples that can be reconstructed with the remaining data CompressAmbientSampleList( list ); }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void CDmeSingleIndexedComponent::GetComponents( CUtlVector< int > &components ) const { if ( IsComplete() ) { const int nComponents = Count(); int *pComponents = reinterpret_cast< int * >( alloca( nComponents * sizeof( int ) ) ); for ( int i = 0; i < nComponents; ++i ) { pComponents[ i ] = i; } components.CopyArray( pComponents, nComponents ); } else { components.RemoveAll(); components.CopyArray( m_Components.Base(), m_Components.Count() ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CCollisionEvent::UpdateTouchEvents( void ) { // Turn on buffering in case new touch events occur during processing bool bOldTouchEvents = m_bBufferTouchEvents; m_bBufferTouchEvents = true; for ( int i = 0; i < m_touchEvents.Count(); i++ ) { const touchevent_t &event = m_touchEvents[i]; if ( event.touchType == TOUCH_START ) { DispatchStartTouch( event.pEntity0, event.pEntity1, event.endPoint, event.normal ); } else { // TOUCH_END DispatchEndTouch( event.pEntity0, event.pEntity1 ); } } m_touchEvents.RemoveAll(); m_bBufferTouchEvents = bOldTouchEvents; }