Skip to content

Commit 28492ca

Browse files
committed
1 parent a98a3d4 commit 28492ca

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

game/quiver/info_changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Added the following Source SDK Pull Requests:
6767
- #1496: Fix for collection checklists incorrectly marking some items as 'owned'
6868
- #1497: Add custom text handling for vote failed messages
6969
- #1498: Updated armory controls to mimic December 2021 Workshop dialog QOL update
70+
- #1500: Added support for team-colored tinting to invis proxy
7071

7172
Details:
7273
- Fixed a bug where the mini-crit damage effect doesn't show up when your shield breaks.

src/game/shared/tf/tf_viewmodel.cpp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ ConVar viewmodel_offset_z("viewmodel_offset_z", "0", FCVAR_CLIENTDLL | FCVAR_ARC
138138
ConVar viewmodel_offset_pitch("viewmodel_offset_pitch", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
139139
ConVar viewmodel_offset_yaw("viewmodel_offset_yaw", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
140140
ConVar viewmodel_offset_roll("viewmodel_offset_roll", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);
141+
ConVar tf_viewmodel_cloak_tint("tf_viewmodel_cloak_tint", "0", FCVAR_ARCHIVE, "Allow viewmodels to be tinted while cloaked.");
141142
#else
142143
ConVar tf_viewmodels_offset_override("tf_viewmodels_offset_override", "", FCVAR_CHEAT, "If set, this will override the position of all viewmodels. Usage 'x y z'");
143144
#endif
@@ -636,9 +637,42 @@ EXPOSE_INTERFACE( CViewModelInvisProxy, IMaterialProxy, "vm_invis" IMATERIAL_PRO
636637
class CInvisProxy : public CBaseInvisMaterialProxy
637638
{
638639
public:
640+
#ifdef BDSBASE
641+
CInvisProxy(void);
642+
virtual bool Init(IMaterial* pMaterial, KeyValues* pKeyValues) OVERRIDE;
643+
#endif
639644
virtual void OnBind( C_BaseEntity *pC_BaseEntity ) OVERRIDE;
645+
#ifdef BDSBASE
646+
private:
647+
IMaterialVar* m_pCloakColorTint;
648+
#endif
640649
};
641650

651+
#ifdef BDSBASE
652+
//-----------------------------------------------------------------------------
653+
// Purpose:
654+
//-----------------------------------------------------------------------------
655+
CInvisProxy::CInvisProxy(void)
656+
{
657+
m_pCloakColorTint = NULL;
658+
}
659+
660+
//-----------------------------------------------------------------------------
661+
// Purpose: Get pointer to the color value
662+
// Input : *pMaterial -
663+
//-----------------------------------------------------------------------------
664+
bool CInvisProxy::Init(IMaterial* pMaterial, KeyValues* pKeyValues)
665+
{
666+
// Need to get the material var
667+
bool bInvis = CBaseInvisMaterialProxy::Init(pMaterial, pKeyValues);
668+
669+
bool bTint;
670+
m_pCloakColorTint = pMaterial->FindVar("$cloakColorTint", &bTint);
671+
672+
return (bInvis && bTint);
673+
}
674+
#endif
675+
642676
//-----------------------------------------------------------------------------
643677
// Purpose:
644678
//-----------------------------------------------------------------------------
@@ -651,11 +685,30 @@ void CInvisProxy::OnBind( C_BaseEntity *pC_BaseEntity )
651685

652686
CTFPlayer *pPlayer = NULL;
653687

688+
#ifdef BDSBASE
689+
static Vector cloakTintRed = Vector(1.0f, 0.5f, 0.4f);
690+
static Vector cloakTintBlue = Vector(0.4f, 0.5f, 1.0f);
691+
#endif
692+
654693
// Check if we have a move parent and if it's a player
655694
C_BaseEntity *pMoveParent = pEnt->GetMoveParent();
656695
if ( pMoveParent && pMoveParent->IsPlayer() )
657696
{
658697
pPlayer = ToTFPlayer( pMoveParent );
698+
#ifdef BDSBASE
699+
// Anything relating to players always tint
700+
switch (pPlayer->GetTeamNumber())
701+
{
702+
case TF_TEAM_RED:
703+
m_pCloakColorTint->SetVecValue(cloakTintRed.Base(), 3);
704+
break;
705+
706+
case TF_TEAM_BLUE:
707+
default:
708+
m_pCloakColorTint->SetVecValue(cloakTintBlue.Base(), 3);
709+
break;
710+
}
711+
#endif
659712
}
660713

661714
// If it's not a player then check for viewmodel.
@@ -667,6 +720,29 @@ void CInvisProxy::OnBind( C_BaseEntity *pC_BaseEntity )
667720
if ( pVM )
668721
{
669722
pPlayer = ToTFPlayer( pVM->GetOwner() );
723+
#ifdef BDSBASE
724+
// Viewmodels do not tint unless otherwise specified
725+
bool bViewmodelTint = tf_viewmodel_cloak_tint.GetBool();
726+
727+
if (!bViewmodelTint)
728+
{
729+
m_pCloakColorTint->SetVecValue(1.0f, 1.0f, 1.0f);
730+
}
731+
else
732+
{
733+
switch (pPlayer->GetTeamNumber())
734+
{
735+
case TF_TEAM_RED:
736+
m_pCloakColorTint->SetVecValue(cloakTintRed.Base(), 3);
737+
break;
738+
739+
case TF_TEAM_BLUE:
740+
default:
741+
m_pCloakColorTint->SetVecValue(cloakTintBlue.Base(), 3);
742+
break;
743+
}
744+
}
745+
#endif
670746
}
671747
}
672748

0 commit comments

Comments
 (0)