| 363 | } |
| 364 | |
| 365 | void CPHSkeleton::UnsplitSingle(CPHSkeleton* SO) |
| 366 | { |
| 367 | // Msg("%o,received has %d,",this,m_unsplited_shels.size()); |
| 368 | if (0 == m_unsplited_shels.size()) |
| 369 | return; //. hack |
| 370 | CPhysicsShellHolder* obj = PPhysicsShellHolder(); |
| 371 | CPhysicsShellHolder* O = SO->PPhysicsShellHolder(); |
| 372 | VERIFY2(m_unsplited_shels.size(), "NO_SHELLS !!"); |
| 373 | VERIFY2(!O->m_pPhysicsShell, "this has shell already!!!"); |
| 374 | CPhysicsShell* newPhysicsShell = m_unsplited_shels.front().first; |
| 375 | O->m_pPhysicsShell = newPhysicsShell; |
| 376 | VERIFY(_valid(newPhysicsShell->mXFORM)); |
| 377 | IKinematics* newKinematics = smart_cast<IKinematics*>(O->Visual()); |
| 378 | IKinematics* pKinematics = smart_cast<IKinematics*>(obj->Visual()); |
| 379 | |
| 380 | VisMask mask0, mask1; |
| 381 | u16 split_bone = m_unsplited_shels.front().second; |
| 382 | mask1 = pKinematics->LL_GetBonesVisible(); // source bones mask |
| 383 | pKinematics->LL_SetBoneVisible(split_bone, FALSE, TRUE); |
| 384 | |
| 385 | pKinematics->CalculateBones_Invalidate(); |
| 386 | pKinematics->CalculateBones(); |
| 387 | |
| 388 | mask0 = pKinematics->LL_GetBonesVisible(); // first part mask |
| 389 | VERIFY2(mask0._visimask.flags, "mask0 -Zero"); |
| 390 | mask0.invert(); |
| 391 | mask1.And(mask0); // second part mask |
| 392 | |
| 393 | newKinematics->LL_SetBoneRoot(split_bone); |
| 394 | VERIFY2(mask1._visimask.flags, "mask1 -Zero"); |
| 395 | newKinematics->LL_SetBonesVisible(mask1); |
| 396 | |
| 397 | newKinematics->CalculateBones_Invalidate(); |
| 398 | newKinematics->CalculateBones(); |
| 399 | |
| 400 | newPhysicsShell->set_Kinematics(newKinematics); |
| 401 | VERIFY(_valid(newPhysicsShell->mXFORM)); |
| 402 | newPhysicsShell->ResetCallbacks(split_bone, mask1); |
| 403 | VERIFY(_valid(newPhysicsShell->mXFORM)); |
| 404 | |
| 405 | newPhysicsShell->ObjectInRoot().identity(); |
| 406 | |
| 407 | if (!newPhysicsShell->isEnabled()) |
| 408 | O->processing_deactivate(); |
| 409 | newPhysicsShell->set_PhysicsRefObject(O); |
| 410 | |
| 411 | m_unsplited_shels.erase(m_unsplited_shels.begin()); |
| 412 | O->setVisible(TRUE); |
| 413 | O->setEnabled(TRUE); |
| 414 | |
| 415 | SO->CopySpawnInit(); |
| 416 | CopySpawnInit(); |
| 417 | VERIFY3(CheckObjectSize(pKinematics), *(O->cNameVisual()), "Object unsplit whith no size"); |
| 418 | VERIFY3(CheckObjectSize(newKinematics), *(O->cNameVisual()), "Object unsplit whith no size"); |
| 419 | } |
| 420 | |
| 421 | void CPHSkeleton::CopySpawnInit() |
| 422 | { |
no test coverage detected