| 3781 | } |
| 3782 | |
| 3783 | void b2ParticleSystem::SolveZombie() |
| 3784 | { |
| 3785 | // removes particles with zombie flag |
| 3786 | int32 newCount = 0; |
| 3787 | int32* newIndices = (int32*) m_world->m_stackAllocator.Allocate( |
| 3788 | sizeof(int32) * m_count); |
| 3789 | uint32 allParticleFlags = 0; |
| 3790 | for (int32 i = 0; i < m_count; i++) |
| 3791 | { |
| 3792 | int32 flags = m_flagsBuffer.data[i]; |
| 3793 | if (flags & b2_zombieParticle) |
| 3794 | { |
| 3795 | b2DestructionListener * const destructionListener = |
| 3796 | m_world->m_destructionListener; |
| 3797 | if ((flags & b2_destructionListenerParticle) && |
| 3798 | destructionListener) |
| 3799 | { |
| 3800 | destructionListener->SayGoodbye(this, i); |
| 3801 | } |
| 3802 | // Destroy particle handle. |
| 3803 | if (m_handleIndexBuffer.data) |
| 3804 | { |
| 3805 | b2ParticleHandle * const handle = m_handleIndexBuffer.data[i]; |
| 3806 | if (handle) |
| 3807 | { |
| 3808 | handle->SetIndex(b2_invalidParticleIndex); |
| 3809 | m_handleIndexBuffer.data[i] = NULL; |
| 3810 | m_handleAllocator.Free(handle); |
| 3811 | } |
| 3812 | } |
| 3813 | newIndices[i] = b2_invalidParticleIndex; |
| 3814 | } |
| 3815 | else |
| 3816 | { |
| 3817 | newIndices[i] = newCount; |
| 3818 | if (i != newCount) |
| 3819 | { |
| 3820 | // Update handle to reference new particle index. |
| 3821 | if (m_handleIndexBuffer.data) |
| 3822 | { |
| 3823 | b2ParticleHandle * const handle = |
| 3824 | m_handleIndexBuffer.data[i]; |
| 3825 | if (handle) handle->SetIndex(newCount); |
| 3826 | m_handleIndexBuffer.data[newCount] = handle; |
| 3827 | } |
| 3828 | m_flagsBuffer.data[newCount] = m_flagsBuffer.data[i]; |
| 3829 | if (m_lastBodyContactStepBuffer.data) |
| 3830 | { |
| 3831 | m_lastBodyContactStepBuffer.data[newCount] = |
| 3832 | m_lastBodyContactStepBuffer.data[i]; |
| 3833 | } |
| 3834 | if (m_bodyContactCountBuffer.data) |
| 3835 | { |
| 3836 | m_bodyContactCountBuffer.data[newCount] = |
| 3837 | m_bodyContactCountBuffer.data[i]; |
| 3838 | } |
| 3839 | if (m_consecutiveContactStepsBuffer.data) |
| 3840 | { |
nothing calls this directly
no test coverage detected