@@ -465,17 +465,14 @@ void CActor::Load(LPCSTR section)
465
465
// initialize bones for first person body
466
466
m_firstPersonBodyBonesToHide =
467
467
{
468
- { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_head" ), true },
469
- { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_neck" ), true },
468
+ { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_head" ), true },
470
469
{ Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_l_clavicle" ), true },
471
470
{ Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_r_clavicle" ), true },
472
471
};
473
472
474
473
m_firstPersonBodyBonesToIgnoreAnims =
475
474
{
476
- { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_spine" ), true },
477
- { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_spine1" ), true },
478
- { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_spine2" ), true },
475
+ { Visual ()->dcast_PKinematics ()->LL_BoneID (" bip01_head" ), false },
479
476
};
480
477
}
481
478
@@ -1563,19 +1560,49 @@ void CActor::RenderFirstPersonBody(u32 context_id, IRenderable* root)
1563
1560
GEnv.Render ->add_Visual (context_id, root, m_firstPersonBody, m_firstPersonBodyXform);
1564
1561
m_firstPersonBody->getVisData ().hom_frame = Device.dwFrame ;
1565
1562
1566
- // Copy transforms from actual body visual, excluding bones we don't want to animate
1563
+ PIItem pItem = inventory ().ActiveItem ();
1564
+ bool noItemEquipped = 0 == pItem;
1565
+
1566
+ // On death or unarmed, show arms
1567
+ if (!g_Alive () || noItemEquipped)
1568
+ {
1569
+ m_firstPersonBodyBonesToHide[m_firstPersonBody->dcast_PKinematics ()->LL_BoneID (" bip01_l_clavicle" )] = false ;
1570
+ m_firstPersonBodyBonesToHide[m_firstPersonBody->dcast_PKinematics ()->LL_BoneID (" bip01_r_clavicle" )] = false ;
1571
+
1572
+ for (auto [boneId, vis] : m_firstPersonBodyBonesToIgnoreAnims)
1573
+ {
1574
+ m_firstPersonBodyBonesToIgnoreAnims[boneId] = false ;
1575
+ }
1576
+ }
1577
+ else
1578
+ {
1579
+ m_firstPersonBodyBonesToHide[m_firstPersonBody->dcast_PKinematics ()->LL_BoneID (" bip01_l_clavicle" )] = true ;
1580
+ m_firstPersonBodyBonesToHide[m_firstPersonBody->dcast_PKinematics ()->LL_BoneID (" bip01_r_clavicle" )] = true ;
1581
+
1582
+ for (auto [boneId, vis] : m_firstPersonBodyBonesToIgnoreAnims)
1583
+ {
1584
+ m_firstPersonBodyBonesToIgnoreAnims[boneId] = true ;
1585
+ }
1586
+ }
1587
+
1588
+ // Copy transforms from actual body visual, excluding hidden bones and bones we don't want to animate
1567
1589
const u16 bones_count = kinematics->LL_BoneCount ();
1568
1590
for (u16 i = 0 ; i < bones_count; ++i)
1569
1591
{
1570
- if (m_firstPersonBodyBonesToIgnoreAnims[i])
1592
+ if (m_firstPersonBodyBonesToIgnoreAnims.find (i) != m_firstPersonBodyBonesToIgnoreAnims.end () && m_firstPersonBodyBonesToIgnoreAnims[i])
1593
+ continue ;
1594
+ if (m_firstPersonBodyBonesToHide.find (i) != m_firstPersonBodyBonesToHide.end () && m_firstPersonBodyBonesToHide[i])
1571
1595
continue ;
1572
1596
1597
+ kinematics->LL_GetTransform (i).set (realBodyK->LL_GetTransform (i));
1573
1598
kinematics->LL_GetTransform_R (i).set (realBodyK->LL_GetTransform_R (i));
1574
1599
}
1575
1600
1576
- // Hide bones
1577
- for (auto [boneId, vis] : m_firstPersonBodyBonesToHide)
1578
- kinematics->LL_SetBoneVisible (boneId, !vis, true );
1601
+ // Hide/show bones AFTER copying transforms so we update all child bones properly
1602
+ for (auto [boneId, hide] : m_firstPersonBodyBonesToHide)
1603
+ {
1604
+ kinematics->LL_SetBoneVisible (boneId, hide ? FALSE : TRUE , TRUE );
1605
+ }
1579
1606
1580
1607
// Update camera position
1581
1608
m_firstPersonCameraXform.set (m_firstPersonBodyXform);
0 commit comments