| 1904 | //---------------------------------------------------------------------------- |
| 1905 | |
| 1906 | void ShapeBase::blowUp() |
| 1907 | { |
| 1908 | Point3F center; |
| 1909 | mObjBox.getCenter(¢er); |
| 1910 | center += getPosition(); |
| 1911 | MatrixF trans = getTransform(); |
| 1912 | trans.setPosition( center ); |
| 1913 | |
| 1914 | // explode |
| 1915 | Explosion* pExplosion = NULL; |
| 1916 | |
| 1917 | if( pointInWater( (Point3F &)center ) && mDataBlock->underwaterExplosion ) |
| 1918 | { |
| 1919 | pExplosion = new Explosion; |
| 1920 | pExplosion->onNewDataBlock(mDataBlock->underwaterExplosion, false); |
| 1921 | } |
| 1922 | else |
| 1923 | { |
| 1924 | if (mDataBlock->explosion) |
| 1925 | { |
| 1926 | pExplosion = new Explosion; |
| 1927 | pExplosion->onNewDataBlock(mDataBlock->explosion, false); |
| 1928 | } |
| 1929 | } |
| 1930 | |
| 1931 | if( pExplosion ) |
| 1932 | { |
| 1933 | pExplosion->setTransform(trans); |
| 1934 | pExplosion->setInitialState(center, damageDir); |
| 1935 | if (pExplosion->registerObject() == false) |
| 1936 | { |
| 1937 | Con::errorf(ConsoleLogEntry::General, "ShapeBase(%s)::explode: couldn't register explosion", |
| 1938 | mDataBlock->getName() ); |
| 1939 | delete pExplosion; |
| 1940 | pExplosion = NULL; |
| 1941 | } |
| 1942 | } |
| 1943 | |
| 1944 | TSShapeInstance *debShape = NULL; |
| 1945 | |
| 1946 | if( mDataBlock->mDebrisShape == NULL ) |
| 1947 | { |
| 1948 | return; |
| 1949 | } |
| 1950 | else |
| 1951 | { |
| 1952 | debShape = new TSShapeInstance( mDataBlock->mDebrisShape, true); |
| 1953 | } |
| 1954 | |
| 1955 | |
| 1956 | Vector< TSPartInstance * > partList; |
| 1957 | TSPartInstance::breakShape( debShape, 0, partList, NULL, NULL, 0 ); |
| 1958 | |
| 1959 | if( !mDataBlock->debris ) |
| 1960 | { |
| 1961 | mDataBlock->debris = new DebrisData; |
| 1962 | } |
| 1963 |
no test coverage detected