Skip to content

Commit 810e6e8

Browse files
committed
StudioModelRenderer: fix left-handed shielded weapons in spectator mode when cl_righthand is set to 1
1 parent 8e77e47 commit 810e6e8

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

cl_dll/StudioModelRenderer.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ void CStudioModelRenderer::StudioSetupBones(void)
710710
if (IEngineStudio.IsHardware())
711711
{
712712
// i know this looks HORRIBLE but I'm too lazy to simplify this right now
713-
if( gHUD.cl_righthand && gHUD.cl_righthand->value > 0.0f && bIsViewModel && !g_bHoldingShield || gHUD.GetGameType() == GAME_CZERO && bIsViewModel && g_bHoldingShield )
713+
if( gHUD.cl_righthand && gHUD.cl_righthand->value > 0.0f && bIsViewModel )
714714
{
715715
bonematrix[1][0] = -bonematrix[1][0];
716716
bonematrix[1][1] = -bonematrix[1][1];
@@ -838,20 +838,6 @@ int CStudioModelRenderer::StudioDrawModel(int flags)
838838

839839
m_pCurrentEntity = IEngineStudio.GetCurrentEntity();
840840

841-
if( g_bHoldingKnife && m_pCurrentEntity == gEngfuncs.GetViewModel() && (flags & STUDIO_RENDER) )
842-
{
843-
// Condition Zero knife viewmodel is left-handed by default, so we need to flip it too
844-
const char *pchGameDir = gEngfuncs.pfnGetGameDirectory();
845-
if( pchGameDir && stricmp( pchGameDir, "czero" ) != 0 )
846-
{
847-
bChangedRightHand = true;
848-
849-
iRightHandValue = gHUD.cl_righthand->value;
850-
851-
gHUD.cl_righthand->value = !gHUD.cl_righthand->value;
852-
}
853-
}
854-
855841
IEngineStudio.GetTimes(&m_nFrameCount, &m_clTime, &m_clOldTime);
856842
IEngineStudio.GetViewInfo(m_vRenderOrigin, m_vUp, m_vRight, m_vNormal);
857843
IEngineStudio.GetAliasScale(&m_fSoftwareXScale, &m_fSoftwareYScale);
@@ -905,6 +891,26 @@ int CStudioModelRenderer::StudioDrawModel(int flags)
905891
return 1;
906892
}
907893

894+
bool bShieldDetected = false;
895+
bool bIsViewModel = gEngfuncs.GetViewModel() == m_pCurrentEntity;
896+
897+
if ( bIsViewModel && m_pStudioHeader )
898+
{
899+
if ( strstr( m_pStudioHeader->name, "shield" ) )
900+
{
901+
bShieldDetected = true;
902+
}
903+
}
904+
905+
if( ( g_bHoldingKnife || bShieldDetected ) && !( gHUD.GetGameType() == GAME_CZERO ) && bIsViewModel )
906+
{
907+
bChangedRightHand = true;
908+
909+
iRightHandValue = gHUD.cl_righthand->value;
910+
911+
gHUD.cl_righthand->value = !gHUD.cl_righthand->value;
912+
}
913+
908914
if (m_pCurrentEntity->curstate.movetype == MOVETYPE_FOLLOW)
909915
StudioMergeBones(m_pRenderModel);
910916
else

0 commit comments

Comments
 (0)