@@ -34,10 +34,14 @@ IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrection, DT_ColorCorrection, CColorCorrection
3434#endif
3535 RecvPropString ( RECVINFO (m_netLookupFilename) ),
3636 RecvPropBool( RECVINFO (m_bEnabled) ),
37- #ifdef MAPBASE // From Alien Swarm SDK
37+ #ifdef MAPBASE
38+ // -- From Alien Swarm SDK --
3839 RecvPropBool ( RECVINFO (m_bMaster) ),
3940 RecvPropBool( RECVINFO (m_bClientSide) ),
40- RecvPropBool( RECVINFO (m_bExclusive) )
41+ RecvPropBool( RECVINFO (m_bExclusive) ),
42+ // ---------------------------
43+ RecvPropBool( RECVINFO (m_bMaskEnabled) ),
44+ RecvPropBool( RECVINFO (m_bMaskInvert) ),
4145#endif
4246
4347END_RECV_TABLE ()
@@ -48,7 +52,8 @@ END_RECV_TABLE()
4852// ------------------------------------------------------------------------------
4953C_ColorCorrection::C_ColorCorrection ()
5054{
51- #ifdef MAPBASE // From Alien Swarm SDK
55+ #ifdef MAPBASE
56+ // -- From Alien Swarm SDK --
5257 m_minFalloff = -1 .0f ;
5358 m_maxFalloff = -1 .0f ;
5459 m_flFadeInDuration = 0 .0f ;
@@ -59,6 +64,9 @@ C_ColorCorrection::C_ColorCorrection()
5964 m_bEnabled = false ;
6065 m_bMaster = false ;
6166 m_bExclusive = false ;
67+ // ---------------------------
68+ m_bMaskEnabled = false ;
69+ m_bMaskInvert = false ;
6270#endif
6371 m_CCHandle = INVALID_CLIENT_CCHANDLE ;
6472
@@ -134,7 +142,7 @@ void C_ColorCorrection::Update( C_BasePlayer *pPlayer, float ccScale )
134142 if ( mat_colcorrection_disableentities.GetInt () )
135143 {
136144 // Allow the colorcorrectionui panel (or user) to turn off color-correction entities
137- g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, 0 .0f , m_bExclusive );
145+ g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, 0 .0f , m_bExclusive, m_bMaskEnabled, m_bMaskInvert );
138146 return ;
139147 }
140148
@@ -146,7 +154,7 @@ void C_ColorCorrection::Update( C_BasePlayer *pPlayer, float ccScale )
146154
147155 if ( !m_bEnabled && m_flCurWeight == 0 .0f )
148156 {
149- g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, 0 .0f , m_bExclusive );
157+ g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, 0 .0f , m_bExclusive, m_bMaskEnabled, m_bMaskInvert );
150158 return ;
151159 }
152160
@@ -161,7 +169,7 @@ void C_ColorCorrection::Update( C_BasePlayer *pPlayer, float ccScale )
161169 if ( weight>1 .0f ) weight = 1 .0f ;
162170 }
163171
164- g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, m_flCurWeight * ( 1.0 - weight ) * ccScale, m_bExclusive );
172+ g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, m_flCurWeight * ( 1.0 - weight ) * ccScale, m_bExclusive, m_bMaskEnabled, m_bMaskInvert );
165173}
166174
167175void C_ColorCorrection::EnableOnClient ( bool bEnable, bool bSkipFade )
@@ -214,7 +222,7 @@ float C_ColorCorrection::GetMaxFalloff()
214222
215223void C_ColorCorrection::SetWeight ( float fWeight )
216224{
217- g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, fWeight , false );
225+ g_pColorCorrectionMgr->SetColorCorrectionWeight ( m_CCHandle, fWeight , false , m_bMaskEnabled, m_bMaskInvert );
218226}
219227
220228void C_ColorCorrection::StartFade ( float flDuration )
@@ -288,7 +296,88 @@ void C_ColorCorrection::ClientThink()
288296}
289297#endif
290298
299+ #ifdef MAPBASE
300+ class C_ColorCorrectionExclude : public C_BaseEntity
301+ {
302+ public:
303+ DECLARE_CLASS ( C_ColorCorrectionExclude, C_BaseEntity );
304+ DECLARE_CLIENTCLASS ();
305+
306+ void OnDataChanged ( DataUpdateType_t type );
307+ void UpdateOnRemove ( void );
308+
309+ void UpdateExclude ( void );
310+ void DestroyExclude ( void );
311+
312+ EHANDLE m_hExcludeTarget;
313+ color32 m_ExcludeColor;
314+ bool m_bExcludeDisabled;
315+
316+ int m_nExcludeHandle = -1 ;
317+ };
318+
319+ IMPLEMENT_CLIENTCLASS_DT ( C_ColorCorrectionExclude, DT_ColorCorrectionExclude, CColorCorrectionExclude )
320+ RecvPropEHandle ( RECVINFO ( m_hExcludeTarget ) ),
321+ RecvPropInt( RECVINFO ( m_ExcludeColor ), 0, RecvProxy_IntToColor32 ),
322+ RecvPropBool( RECVINFO ( m_bExcludeDisabled ) ),
323+ END_RECV_TABLE()
291324
325+ // -----------------------------------------------------------------------------
326+ // Purpose:
327+ // -----------------------------------------------------------------------------
328+ void C_ColorCorrectionExclude::OnDataChanged( DataUpdateType_t updateType )
329+ {
330+ BaseClass::OnDataChanged ( updateType );
331+
332+ UpdateExclude ();
333+ }
334+
335+ // -----------------------------------------------------------------------------
336+ // Purpose:
337+ // -----------------------------------------------------------------------------
338+ void C_ColorCorrectionExclude::UpdateOnRemove ( void )
339+ {
340+ DestroyExclude ();
341+
342+ BaseClass::UpdateOnRemove ();
343+ }
344+
345+ // -----------------------------------------------------------------------------
346+ // Purpose:
347+ // -----------------------------------------------------------------------------
348+ void C_ColorCorrectionExclude::UpdateExclude ( void )
349+ {
350+ // destroy the existing effect
351+ DestroyExclude ();
352+
353+ // create a new effect
354+ if ( m_hExcludeTarget && !m_bExcludeDisabled )
355+ {
356+ Vector4D vecColor ( m_ExcludeColor.r , m_ExcludeColor.g , m_ExcludeColor.b , m_ExcludeColor.a );
357+ for (int i = 0 ; i < 4 ; i++)
358+ {
359+ if (vecColor[i] == 0 .0f )
360+ continue ;
361+
362+ vecColor[i] /= 255 .0f ;
363+ }
364+
365+ m_nExcludeHandle = g_pColorCorrectionMgr->RegisterExclusionObject ( m_hExcludeTarget, &vecColor.AsVector3D (), vecColor.w );
366+ }
367+ }
368+
369+ // -----------------------------------------------------------------------------
370+ // Purpose:
371+ // -----------------------------------------------------------------------------
372+ void C_ColorCorrectionExclude::DestroyExclude ( void )
373+ {
374+ if ( m_nExcludeHandle != -1 )
375+ {
376+ g_pColorCorrectionMgr->UnregisterExclusionObject ( m_nExcludeHandle );
377+ m_nExcludeHandle = -1 ;
378+ }
379+ }
380+ #endif
292381
293382
294383
0 commit comments