ParticleManager::~ParticleManager() { ClearAll(); ClearInUse(); while (!_unused.empty()) { delete _unused.top(); _unused.pop(); } /* for (auto it = _inUse.begin(); it != _inUse.end(); ++it) { for (auto it2 = it->begin(); it2 != it->end(); ++it2) { for (auto it3 = it2->begin(); it3 != it2->end(); ++it3) { delete *it3; } } } for (auto it = _effects.begin(); it != _effects.end(); ++it) { for (auto it2 = it->begin(); it2 != it->end(); ++it2) { delete *it2; } } */ }
/* ================= G_FreeEntity Marks the entity as free ================= */ void G_FreeEntity( gentity_t *ed ) { gi.unlinkentity (ed); // unlink from world ICARUS_FreeEnt( ed ); /*if ( ed->neverFree ) { return; }*/ // remove any ghoul2 models here gi.G2API_CleanGhoul2Models(ed->ghoul2); memset (ed, 0, sizeof(*ed)); //FIXME: This sets the entity number to zero, which is the player. // This is really f*****g stupid and has caused us no end of // trouble!!! Change it to set the s.number to the proper index // (ed - g_entities) *OR* ENTITYNUM_NONE!!! ed->s.number = ENTITYNUM_NONE; ed->classname = "freed"; ed->freetime = level.time; ed->inuse = qfalse; ClearInUse(ed); }
/* ================= G_FreeEntity Marks the entity as free ================= */ void G_FreeEntity( gentity_t *ed ) { gi.unlinkentity (ed); // unlink from world // Free the Game Element (the entity) and delete the Icarus ID. Quake3Game()->FreeEntity( ed ); /*if ( ed->neverFree ) { return; }*/ if (ed->wayedge!=0) { NAV::WayEdgesNowClear(ed); } // remove any ghoul2 models here gi.G2API_CleanGhoul2Models(ed->ghoul2); if (ed->client && ed->client->NPC_class == CLASS_VEHICLE) { Vehicle_Remove(ed); if ( ed->m_pVehicle ) { gi.Free( ed->m_pVehicle ); } //CVehicleNPC *pVeh = static_cast< CVehicleNPC * >( ed->NPC ); //delete pVeh; //gi.Free((char*)ed->NPC-4);//crazy hack for class vtables } //free this stuff now, rather than waiting until the level ends. if (ed->NPC) { gi.Free(ed->NPC); if(ed->client->clientInfo.customBasicSoundDir && gi.bIsFromZone(ed->client->clientInfo.customBasicSoundDir, TAG_G_ALLOC)) { gi.Free(ed->client->clientInfo.customBasicSoundDir); } if(ed->client->clientInfo.customCombatSoundDir) { #ifdef _MSC_VER assert(*(unsigned int*)ed->client->clientInfo.customCombatSoundDir != 0xfeeefeee); #endif gi.Free(ed->client->clientInfo.customCombatSoundDir); } if(ed->client->clientInfo.customExtraSoundDir) { #ifdef _MSC_VER assert(*(unsigned int*)ed->client->clientInfo.customExtraSoundDir != 0xfeeefeee); #endif gi.Free(ed->client->clientInfo.customExtraSoundDir); } if(ed->client->clientInfo.customJediSoundDir) { gi.Free(ed->client->clientInfo.customJediSoundDir); } if(ed->client->ps.saber[0].name && gi.bIsFromZone(ed->client->ps.saber[0].name, TAG_G_ALLOC) ) { gi.Free(ed->client->ps.saber[0].name); } if(ed->client->ps.saber[0].model && gi.bIsFromZone(ed->client->ps.saber[0].model, TAG_G_ALLOC) ) { gi.Free(ed->client->ps.saber[0].model); } if(ed->client->ps.saber[1].name && gi.bIsFromZone(ed->client->ps.saber[1].name, TAG_G_ALLOC) ) { gi.Free(ed->client->ps.saber[1].name); } if(ed->client->ps.saber[1].model && gi.bIsFromZone(ed->client->ps.saber[1].model, TAG_G_ALLOC) ) { gi.Free(ed->client->ps.saber[1].model); } gi.Free(ed->client); } if (ed->soundSet && gi.bIsFromZone(ed->soundSet, TAG_G_ALLOC)) { gi.Free(ed->soundSet); } if (ed->targetname && gi.bIsFromZone(ed->targetname, TAG_G_ALLOC)) { gi.Free(ed->targetname); } if (ed->NPC_targetname && gi.bIsFromZone(ed->NPC_targetname, TAG_G_ALLOC)) { gi.Free(ed->NPC_targetname); } if (ed->NPC_type && gi.bIsFromZone(ed->NPC_type, TAG_G_ALLOC)) { gi.Free(ed->NPC_type); } if (ed->classname && gi.bIsFromZone(ed->classname, TAG_G_ALLOC)) { gi.Free(ed->classname ); } if (ed->message && gi.bIsFromZone(ed->message, TAG_G_ALLOC)) { gi.Free(ed->message); } if (ed->model && gi.bIsFromZone(ed->model, TAG_G_ALLOC)) { gi.Free(ed->model); } //scripting if (ed->script_targetname && gi.bIsFromZone(ed->script_targetname, TAG_G_ALLOC)) { gi.Free(ed->script_targetname); } if (ed->cameraGroup && gi.bIsFromZone(ed->cameraGroup, TAG_G_ALLOC)) { gi.Free(ed->cameraGroup); } if (ed->paintarget && gi.bIsFromZone(ed->paintarget, TAG_G_ALLOC)) { gi.Free(ed->paintarget); } if(ed->parms) { gi.Free(ed->parms); } //Limbs if (ed->target && gi.bIsFromZone(ed->target , TAG_G_ALLOC)) { gi.Free(ed->target); } if (ed->target2 && gi.bIsFromZone(ed->target2 , TAG_G_ALLOC)) { gi.Free(ed->target2); } if (ed->target3 && gi.bIsFromZone(ed->target3 , TAG_G_ALLOC)) { gi.Free(ed->target3); } if (ed->target4 && gi.bIsFromZone(ed->target4 , TAG_G_ALLOC)) { gi.Free(ed->target4); } if (ed->opentarget) { gi.Free(ed->opentarget); } if (ed->closetarget) { gi.Free(ed->closetarget); } // Free any associated timers TIMER_Clear(ed->s.number); memset (ed, 0, sizeof(*ed)); ed->s.number = ENTITYNUM_NONE; ed->classname = "freed"; ed->freetime = level.time; ed->inuse = qfalse; ClearInUse(ed); }
void ParticleManager::Destroy() { ClearAll(); ClearInUse(); }