| 1765 | //---------------------------------------------------------------------------- |
| 1766 | |
| 1767 | void ShapeBase::blowUp() |
| 1768 | { |
| 1769 | Point3F center; |
| 1770 | mObjBox.getCenter(¢er); |
| 1771 | center += getPosition(); |
| 1772 | MatrixF trans = getTransform(); |
| 1773 | trans.setPosition( center ); |
| 1774 | |
| 1775 | // explode |
| 1776 | Explosion* pExplosion = NULL; |
| 1777 | |
| 1778 | if( pointInWater( (Point3F &)center ) && mDataBlock->underwaterExplosion ) |
| 1779 | { |
| 1780 | pExplosion = new Explosion; |
| 1781 | pExplosion->onNewDataBlock(mDataBlock->underwaterExplosion, false); |
| 1782 | } |
| 1783 | else |
| 1784 | { |
| 1785 | if (mDataBlock->explosion) |
| 1786 | { |
| 1787 | pExplosion = new Explosion; |
| 1788 | pExplosion->onNewDataBlock(mDataBlock->explosion, false); |
| 1789 | } |
| 1790 | } |
| 1791 | |
| 1792 | if( pExplosion ) |
| 1793 | { |
| 1794 | pExplosion->setTransform(trans); |
| 1795 | pExplosion->setInitialState(center, damageDir); |
| 1796 | if (pExplosion->registerObject() == false) |
| 1797 | { |
| 1798 | Con::errorf(ConsoleLogEntry::General, "ShapeBase(%s)::explode: couldn't register explosion", |
| 1799 | mDataBlock->getName() ); |
| 1800 | delete pExplosion; |
| 1801 | pExplosion = NULL; |
| 1802 | } |
| 1803 | } |
| 1804 | |
| 1805 | TSShapeInstance *debShape = NULL; |
| 1806 | |
| 1807 | if( mDataBlock->debrisShape == NULL ) |
| 1808 | { |
| 1809 | return; |
| 1810 | } |
| 1811 | else |
| 1812 | { |
| 1813 | debShape = new TSShapeInstance( mDataBlock->debrisShape, true); |
| 1814 | } |
| 1815 | |
| 1816 | |
| 1817 | Vector< TSPartInstance * > partList; |
| 1818 | TSPartInstance::breakShape( debShape, 0, partList, NULL, NULL, 0 ); |
| 1819 | |
| 1820 | if( !mDataBlock->debris ) |
| 1821 | { |
| 1822 | mDataBlock->debris = new DebrisData; |
| 1823 | } |
| 1824 |
no test coverage detected