void particle_move_all(float frametime) { MONITOR_INC( NumParticles, Num_particles ); if ( !Particles_enabled ) return; if ( Particles.empty() ) return; //MOD for (SCP_vector::iterator p = Particles.begin(); p != Particles.end(); ) { for ( uint i = 0; i < Particles.size(); ) { // ADDED particle * p = &Particles[i]; if (p->age == 0.0f) { p->age = 0.00001f; } else { p->age += frametime; } // if it's time expired, remove it if (p->age > p->max_life) { // special case, if max_life is 0 then we want it to render at least once if ( (p->age > frametime) || (p->max_life > 0.0f) ) { *p = Particles.back(); Particles.pop_back(); continue; } } // if the particle is attached to an object which has become invalid, kill it if (p->attached_objnum >= 0) { // if the signature has changed, or it's bogus, kill it if ( (p->attached_objnum >= MAX_OBJECTS) || (p->attached_sig != Objects[p->attached_objnum].signature) ) { *p = Particles.back(); Particles.pop_back(); continue; } } // move as a regular particle else { vm_vec_scale_add2( &p->pos, &p->velocity, frametime ); } // next particle //MOD ++p; i ++; } }