Skip to content

Commit 2704d75

Browse files
committed
Switch to 2D mode when zooming with the sniper rifle, the rocket launcher or the OICW
1 parent 72fc5f9 commit 2704d75

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

Installer/farcry.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!include "MUI2.nsh"
2-
!define VERSION '0.2.1'
2+
!define VERSION '0.2.2'
33

44
Name "FarCry VR Mod"
55

Sources/CryGame C++/Solution1/CryGame/VRRenderer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ bool VRRenderer::ShouldRenderVR() const
131131
if (m_pGame->AreBinocularsActive())
132132
return false;
133133

134+
CPlayer *player = m_pGame->GetLocalPlayer();
135+
if (player && player->IsWeaponZoomActive())
136+
return false;
137+
134138
return true;
135139
}
136140

Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,19 @@ bool CPlayer::Init()
441441
return true;
442442
}
443443

444+
bool CPlayer::IsWeaponZoomActive() const
445+
{
446+
if (!m_stats.aiming || !GetSelectedWeapon())
447+
return false;
448+
449+
string weaponName = GetSelectedWeapon()->GetName();
450+
// we want to switch to 2D rendering mode for appropriate weapons
451+
if (weaponName == "RL" || weaponName == "SniperRifle" || weaponName == "OICW")
452+
return true;
453+
454+
return false;
455+
}
456+
444457
//////////////////////////////////////////////////////////////////////
445458
/*!Called by the entity when the angles are changed.
446459
This notification is used to force the orientation of the player.

Sources/CryGame C++/Solution1/CryGame/XPlayer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ enum eInVehiclestate
366366
bool HasFlashLight() const { return m_stats.has_flashlight; }
367367
void GiveFlashLight( bool on );
368368

369+
bool IsWeaponZoomActive() const;
370+
369371
// interface IEntityContainer
370372

371373
virtual bool Init();

0 commit comments

Comments
 (0)