mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 22:27:57 +03:00
Expose CBaseCombatCharacter glow funcs to VScript + add color functionality
Co-authored-by: Derek <1upderek@gmail.com>
This commit is contained in:
parent
d51d44eb73
commit
d4b66b16cd
@ -34,6 +34,10 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
|
|||||||
m_pGlowEffect = NULL;
|
m_pGlowEffect = NULL;
|
||||||
m_bGlowEnabled = false;
|
m_bGlowEnabled = false;
|
||||||
m_bOldGlowEnabled = false;
|
m_bOldGlowEnabled = false;
|
||||||
|
m_GlowColor.Init( 0.76f, 0.76f, 0.76f );
|
||||||
|
m_OldGlowColor = m_GlowColor;
|
||||||
|
m_GlowAlpha = 1.0f;
|
||||||
|
m_OldGlowAlpha = 1.0f;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +70,8 @@ void C_BaseCombatCharacter::OnPreDataChanged( DataUpdateType_t updateType )
|
|||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
m_bOldGlowEnabled = m_bGlowEnabled;
|
m_bOldGlowEnabled = m_bGlowEnabled;
|
||||||
|
m_OldGlowColor = m_GlowColor;
|
||||||
|
m_OldGlowAlpha = m_GlowAlpha;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +83,7 @@ void C_BaseCombatCharacter::OnDataChanged( DataUpdateType_t updateType )
|
|||||||
BaseClass::OnDataChanged( updateType );
|
BaseClass::OnDataChanged( updateType );
|
||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
if ( m_bOldGlowEnabled != m_bGlowEnabled )
|
if ( m_bOldGlowEnabled != m_bGlowEnabled || m_OldGlowColor != m_GlowColor || m_OldGlowAlpha != m_GlowAlpha )
|
||||||
{
|
{
|
||||||
UpdateGlowEffect();
|
UpdateGlowEffect();
|
||||||
}
|
}
|
||||||
@ -106,11 +112,13 @@ void C_BaseCombatCharacter::DoMuzzleFlash()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
|
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b, float *a )
|
||||||
{
|
{
|
||||||
*r = 0.76f;
|
*r = m_GlowColor.x;
|
||||||
*g = 0.76f;
|
*g = m_GlowColor.y;
|
||||||
*b = 0.76f;
|
*b = m_GlowColor.z;
|
||||||
|
if (a)
|
||||||
|
*a = m_GlowAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -127,10 +135,10 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
|
|||||||
// create a new effect
|
// create a new effect
|
||||||
if ( m_bGlowEnabled )
|
if ( m_bGlowEnabled )
|
||||||
{
|
{
|
||||||
float r, g, b;
|
float r, g, b, a;
|
||||||
GetGlowEffectColor( &r, &g, &b );
|
GetGlowEffectColor( &r, &g, &b, &a );
|
||||||
|
|
||||||
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
|
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +169,8 @@ BEGIN_RECV_TABLE(C_BaseCombatCharacter, DT_BaseCombatCharacter)
|
|||||||
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
|
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
|
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
|
||||||
|
RecvPropVector( RECVINFO( m_GlowColor ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_GlowAlpha ) ),
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
#ifdef INVASION_CLIENT_DLL
|
#ifdef INVASION_CLIENT_DLL
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
|
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
|
||||||
virtual void GetGlowEffectColor( float *r, float *g, float *b );
|
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a = NULL );
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
#ifdef MAPBASE_VSCRIPT
|
#ifdef MAPBASE_VSCRIPT
|
||||||
@ -133,6 +133,10 @@ private:
|
|||||||
bool m_bGlowEnabled;
|
bool m_bGlowEnabled;
|
||||||
bool m_bOldGlowEnabled;
|
bool m_bOldGlowEnabled;
|
||||||
CGlowObject *m_pGlowEffect;
|
CGlowObject *m_pGlowEffect;
|
||||||
|
Vector m_GlowColor;
|
||||||
|
Vector m_OldGlowColor;
|
||||||
|
float m_GlowAlpha;
|
||||||
|
int m_OldGlowAlpha;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -195,6 +195,13 @@ BEGIN_ENT_SCRIPTDESC( CBaseCombatCharacter, CBaseFlex, "The base class shared by
|
|||||||
|
|
||||||
DEFINE_SCRIPTFUNC( LastHitGroup, "Get the last hitgroup." )
|
DEFINE_SCRIPTFUNC( LastHitGroup, "Get the last hitgroup." )
|
||||||
|
|
||||||
|
#ifdef GLOWS_ENABLE
|
||||||
|
DEFINE_SCRIPTFUNC( AddGlowEffect, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( RemoveGlowEffect, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( IsGlowEffectActive, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetGlowColor, "" )
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hooks
|
// Hooks
|
||||||
//
|
//
|
||||||
@ -293,6 +300,8 @@ END_SEND_TABLE();
|
|||||||
IMPLEMENT_SERVERCLASS_ST(CBaseCombatCharacter, DT_BaseCombatCharacter)
|
IMPLEMENT_SERVERCLASS_ST(CBaseCombatCharacter, DT_BaseCombatCharacter)
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
SendPropBool( SENDINFO( m_bGlowEnabled ) ),
|
SendPropBool( SENDINFO( m_bGlowEnabled ) ),
|
||||||
|
SendPropVector( SENDINFO( m_GlowColor ), 8, 0, 0, 1 ),
|
||||||
|
SendPropFloat( SENDINFO( m_GlowAlpha ) ),
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
// Data that only gets sent to the local player.
|
// Data that only gets sent to the local player.
|
||||||
SendPropDataTable( "bcc_localdata", 0, &REFERENCE_SEND_TABLE(DT_BCCLocalPlayerExclusive), SendProxy_SendBaseCombatCharacterLocalDataTable ),
|
SendPropDataTable( "bcc_localdata", 0, &REFERENCE_SEND_TABLE(DT_BCCLocalPlayerExclusive), SendProxy_SendBaseCombatCharacterLocalDataTable ),
|
||||||
@ -878,6 +887,8 @@ CBaseCombatCharacter::CBaseCombatCharacter( void )
|
|||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
m_bGlowEnabled.Set( false );
|
m_bGlowEnabled.Set( false );
|
||||||
|
m_GlowColor.GetForModify().Init( 0.76f, 0.76f, 0.76f );
|
||||||
|
m_GlowAlpha.Set(1.0f);
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4098,6 +4109,12 @@ bool CBaseCombatCharacter::IsGlowEffectActive( void )
|
|||||||
{
|
{
|
||||||
return m_bGlowEnabled;
|
return m_bGlowEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBaseCombatCharacter::SetGlowColor( float red, float green, float blue, float alpha )
|
||||||
|
{
|
||||||
|
m_GlowColor.GetForModify().Init( red, green, blue );
|
||||||
|
m_GlowAlpha.Set( alpha );
|
||||||
|
}
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -532,6 +532,7 @@ public:
|
|||||||
void AddGlowEffect( void );
|
void AddGlowEffect( void );
|
||||||
void RemoveGlowEffect( void );
|
void RemoveGlowEffect( void );
|
||||||
bool IsGlowEffectActive( void );
|
bool IsGlowEffectActive( void );
|
||||||
|
void SetGlowColor( float red, float green, float blue, float alpha );
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
#ifdef INVASION_DLL
|
#ifdef INVASION_DLL
|
||||||
@ -576,6 +577,8 @@ public:
|
|||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
protected:
|
protected:
|
||||||
CNetworkVar( bool, m_bGlowEnabled );
|
CNetworkVar( bool, m_bGlowEnabled );
|
||||||
|
CNetworkVector( m_GlowColor );
|
||||||
|
CNetworkVar( float, m_GlowAlpha );
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user