update the entity /////////////////////////////////////////////////////////////////////
| 657 | // update the entity |
| 658 | ////////////////////////////////////////////////////////////////////////// |
| 659 | void CEntitySystem::UpdateEntity(CEntity *ce,SEntityUpdateContext &ctx) |
| 660 | { |
| 661 | if (ce->m_bGarbage) |
| 662 | { |
| 663 | if (ce->IsDestroyable()) |
| 664 | { |
| 665 | DeleteEntity(ce); |
| 666 | } |
| 667 | else |
| 668 | { // [kirill] we must be in editor gamemode (Timur assures it wil newer happen in game) |
| 669 | // can't destroy entity - just hide it/remove physics |
| 670 | ce->DestroyPhysics(); |
| 671 | ce->DrawObject(0); |
| 672 | ce->DrawCharacter(0,0); |
| 673 | } |
| 674 | return; |
| 675 | } |
| 676 | |
| 677 | if (ce->m_bHidden) |
| 678 | return; |
| 679 | |
| 680 | if (ce->m_bTrackable) |
| 681 | { |
| 682 | //if (ce->GetDrawFrame() == ctx.nFrameID) |
| 683 | //if (ce->m_nLastVisibleFrameID == ctx.nFrameID) |
| 684 | if (abs(int(ctx.nFrameID - ce->m_nLastVisibleFrameID)) < MAX_FRAME_ID_STEP_PER_FRAME) |
| 685 | m_vEntitiesInFrustrum.push_back(ce); |
| 686 | } |
| 687 | |
| 688 | // Bound entites always updated by thier parents. |
| 689 | if (ce->m_bIsBound) |
| 690 | return; |
| 691 | if (ce->m_eUpdateVisLevel==eUT_PhysicsPostStep) |
| 692 | return; |
| 693 | |
| 694 | //if (bUpdateEntities) |
| 695 | { |
| 696 | bool bNeedUpdate = (ce->m_bUpdate && !ce->m_bSleeping) || (ce->m_awakeCounter > 0); |
| 697 | if (bNeedUpdate) |
| 698 | { |
| 699 | ce->Update(ctx); |
| 700 | } |
| 701 | |
| 702 | // If have childs. |
| 703 | if (ce->m_bUpdateBinds) |
| 704 | { |
| 705 | // If not updated. |
| 706 | ce->UpdateHierarchy( ctx ); |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | //update the entity system |
| 712 | ////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected