MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UnsplitSingle

Method UnsplitSingle

ogsr_engine/xrGame/PHSkeleton.cpp:365–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365void 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
421void CPHSkeleton::CopySpawnInit()
422{

Callers 1

SpawnMethod · 0.80

Calls 15

CheckObjectSizeFunction · 0.85
VisualMethod · 0.80
LL_GetBonesVisibleMethod · 0.80
LL_SetBoneVisibleMethod · 0.80
AndMethod · 0.80
LL_SetBoneRootMethod · 0.80
LL_SetBonesVisibleMethod · 0.80
PPhysicsShellHolderFunction · 0.70
_validFunction · 0.50
sizeMethod · 0.45
PPhysicsShellHolderMethod · 0.45

Tested by

no test coverage detected