|
32 | 32 | #define ROTATION_TIME 0.25f |
33 | 33 |
|
34 | 34 | BOOL b_toggle_weapon_aim = FALSE; |
| 35 | +extern float g_first_person_body_offset; |
35 | 36 |
|
36 | 37 | static class CUIWpnScopeXmlManager : public CUIResetNotifier, public pureAppEnd |
37 | 38 | { |
@@ -187,6 +188,13 @@ void CWeapon::UpdateXForm() |
187 | 188 | mRes.mulA_43(E->XFORM()); |
188 | 189 | } |
189 | 190 |
|
| 191 | + if (auto actorOwner = smart_cast<CActor*>(H_Parent())) |
| 192 | + if ((psActorFlags.test(AF_FIRST_PERSON_BODY)) && actorOwner->active_cam() == eacFirstEye) |
| 193 | + { |
| 194 | + Fvector camdir = { actorOwner->cam_Active()->Direction().x, 0.f, actorOwner->cam_Active()->Direction().z }; // ignore Y (vertical) value |
| 195 | + mRes.c.add(camdir.normalize().mul(g_first_person_body_offset)); // push model back so it doesn't look weird (default value: -0.75f) |
| 196 | + } |
| 197 | + |
190 | 198 | UpdatePosition(mRes); |
191 | 199 | } |
192 | 200 |
|
@@ -911,21 +919,8 @@ void CWeapon::EnableActorNVisnAfterZoom() |
911 | 919 | } |
912 | 920 |
|
913 | 921 | bool CWeapon::need_renderable() { return !(IsZoomed() && ZoomTexture() && !IsRotatingToZoom()); } |
914 | | - |
915 | | -extern float g_first_person_body_offset; |
916 | 922 | void CWeapon::renderable_Render(u32 context_id, IRenderable* root) |
917 | 923 | { |
918 | | - if (auto actorOwner = smart_cast<CActor*>(H_Parent())) |
919 | | - { |
920 | | - if ((psActorFlags.test(AF_FIRST_PERSON_BODY)) && actorOwner->active_cam() == eacFirstEye) |
921 | | - { |
922 | | - Fvector camdir = { actorOwner->cam_Active()->Direction().x, 0.f, actorOwner->cam_Active()->Direction().z }; // ignore Y (vertical) value |
923 | | - Fmatrix trans = XFORM(); |
924 | | - trans.c.add(camdir.normalize().mul(g_first_person_body_offset)); // push model back so it doesn't look weird (default value: -0.75f) |
925 | | - XFORM().translate_over(trans.c); // move our original weapon to where our first person body is, so shadow render in correct place |
926 | | - } |
927 | | - } |
928 | | - |
929 | 924 | ScopeLock lock{ &render_lock }; |
930 | 925 |
|
931 | 926 | UpdateXForm(); |
|
0 commit comments