@@ -1516,7 +1516,16 @@ void CActor::shedule_Update(u32 DT)
15161516void CActor::renderable_Render (u32 context_id, IRenderable* root)
15171517{
15181518 VERIFY (_valid (XFORM ()));
1519- inherited::renderable_Render (context_id, root);
1519+
1520+ if (m_firstPersonBody && psActorFlags.test (AF_FIRST_PERSON_BODY) && cam_active == eacFirstEye)
1521+ {
1522+ MakeMeCrow ();
1523+ GEnv.Render ->add_Visual (context_id, root, Visual (), firstPersonBodyXform);
1524+ Visual ()->getVisData ().hom_frame = Device.dwFrame ;
1525+ }
1526+ else
1527+ inherited::renderable_Render (context_id, root);
1528+
15201529 CInventoryOwner::renderable_Render (context_id, root);
15211530}
15221531
@@ -1546,12 +1555,11 @@ void CActor::RenderFirstPersonBody(u32 context_id, IRenderable* root)
15461555
15471556 // adjust body position
15481557 Fvector camdir = { cam_Active ()->Direction ().x , 0 .f , cam_Active ()->Direction ().z }; // ignore Y (vertical) value
1549- Fmatrix trans = XFORM ();
1550- trans.c .add (camdir.normalize ().mul (g_first_person_body_offset)); // push model back so it doesn't look weird (default value: -0.75f)
1551- XFORM ().translate_over (trans.c ); // move our original body to where our first person body is, so shadow renders in correct place
1558+ firstPersonBodyXform = XFORM ();
1559+ firstPersonBodyXform.translate_add (camdir.normalize ().mul (g_first_person_body_offset));
15521560
15531561 // Add body to render
1554- GEnv.Render ->add_Visual (context_id, root, m_firstPersonBody, trans );
1562+ GEnv.Render ->add_Visual (context_id, root, m_firstPersonBody, firstPersonBodyXform );
15551563 m_firstPersonBody->getVisData ().hom_frame = Device.dwFrame ;
15561564
15571565 // Copy transforms from actual body visual, excluding bones we don't want to animate
@@ -1561,7 +1569,6 @@ void CActor::RenderFirstPersonBody(u32 context_id, IRenderable* root)
15611569 if (m_firstPersonBodyBonesToIgnoreAnims[i])
15621570 continue ;
15631571
1564- kinematics->LL_GetTransform (i).set (realBodyK->LL_GetTransform (i));
15651572 kinematics->LL_GetTransform_R (i).set (realBodyK->LL_GetTransform_R (i));
15661573 }
15671574
@@ -1570,23 +1577,27 @@ void CActor::RenderFirstPersonBody(u32 context_id, IRenderable* root)
15701577 kinematics->LL_SetBoneVisible (boneId, !vis, true );
15711578
15721579 // Update head position
1573- headPosition.set (trans );
1574- headPosition.mulB_43 (realBodyK->LL_GetTransform (realBodyK->LL_BoneID (" bip01_head" )));
1580+ headPosition.set (firstPersonBodyXform );
1581+ headPosition.mulB_43 (realBodyK->LL_GetTransform_R (realBodyK->LL_BoneID (" bip01_head" )));
15751582
15761583#ifdef DEBUG
15771584 Fvector ypr;
1578- trans .getHPB (ypr);
1585+ firstPersonBodyXform .getHPB (ypr);
15791586 string1024 text;
15801587 CGameFont* F = UI ().Font ().pFontArial14 ;
15811588 F->SetAligment (CGameFont::alLeft);
15821589 F->OutSetI (-.9 , 0 );
15831590 F->SetColor (color_rgba (255 , 0 , 0 , 255 ));
1584- xr_sprintf (text, " first person body position [%3.3f %3.3f %3.3f]" , trans.c .x , trans.c .y , trans.c .z );
1591+ xr_sprintf (text, " first person body position [%3.3f %3.3f %3.3f]" , firstPersonBodyXform.c .x , firstPersonBodyXform.c .y , firstPersonBodyXform.c .z );
1592+ F->OutNext (text);
1593+ xr_sprintf (text, " first person body direction [%3.3f %3.3f %3.3f]" , firstPersonBodyXform.k .x , firstPersonBodyXform.k .y , firstPersonBodyXform.k .z );
15851594 F->OutNext (text);
15861595 xr_sprintf (text, " head position [%3.3f %3.3f %3.3f]" , headPosition.c .x , headPosition.c .y , headPosition.c .z );
15871596 F->OutNext (text);
15881597 xr_sprintf (text, " camera position [%3.3f %3.3f %3.3f]" , cam_Active ()->Position ().x , cam_Active ()->Position ().y , cam_Active ()->Position ().z );
15891598 F->OutNext (text);
1599+ xr_sprintf (text, " camera direction [%3.3f %3.3f %3.3f]" , cam_Active ()->Direction ().x , cam_Active ()->Direction ().y , cam_Active ()->Direction ().z );
1600+ F->OutNext (text);
15901601#endif // DEBUG
15911602}
15921603
0 commit comments