Skip to content
This repository was archived by the owner on Aug 6, 2022. It is now read-only.

Commit e0b3d19

Browse files
committed
init
0 parents  commit e0b3d19

File tree

3,050 files changed

+1217106
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,050 files changed

+1217106
-0
lines changed

cl_dll/alphamaterialproxy.cpp

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
// $NoKeywords: $
6+
//=============================================================================//
7+
#include "cbase.h"
8+
#include "ProxyEntity.h"
9+
#include "materialsystem/IMaterial.h"
10+
#include "materialsystem/IMaterialVar.h"
11+
12+
// memdbgon must be the last include file in a .cpp file!!!
13+
#include "tier0/memdbgon.h"
14+
15+
// $sineVar : name of variable that controls the alpha level (float)
16+
class CAlphaMaterialProxy : public CEntityMaterialProxy
17+
{
18+
public:
19+
CAlphaMaterialProxy();
20+
virtual ~CAlphaMaterialProxy();
21+
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
22+
virtual void OnBind( C_BaseEntity *pEntity );
23+
24+
private:
25+
IMaterialVar *m_AlphaVar;
26+
};
27+
28+
CAlphaMaterialProxy::CAlphaMaterialProxy()
29+
{
30+
m_AlphaVar = NULL;
31+
}
32+
33+
CAlphaMaterialProxy::~CAlphaMaterialProxy()
34+
{
35+
}
36+
37+
38+
bool CAlphaMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
39+
{
40+
bool foundVar;
41+
m_AlphaVar = pMaterial->FindVar( "$alpha", &foundVar, false );
42+
return foundVar;
43+
}
44+
45+
void CAlphaMaterialProxy::OnBind( C_BaseEntity *pEnt )
46+
{
47+
if (m_AlphaVar)
48+
{
49+
m_AlphaVar->SetFloatValue( pEnt->m_clrRender->a );
50+
}
51+
}
52+
53+
EXPOSE_INTERFACE( CAlphaMaterialProxy, IMaterialProxy, "Alpha" IMATERIAL_PROXY_INTERFACE_VERSION );

cl_dll/animatedentitytextureproxy.cpp

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
// $NoKeywords: $
6+
//=============================================================================//
7+
#include "cbase.h"
8+
#include "BaseAnimatedTextureProxy.h"
9+
10+
// memdbgon must be the last include file in a .cpp file!!!
11+
#include "tier0/memdbgon.h"
12+
13+
class CAnimatedEntityTextureProxy : public CBaseAnimatedTextureProxy
14+
{
15+
public:
16+
CAnimatedEntityTextureProxy() {}
17+
virtual ~CAnimatedEntityTextureProxy() {}
18+
19+
virtual float GetAnimationStartTime( void* pBaseEntity );
20+
virtual void AnimationWrapped( void* pC_BaseEntity );
21+
22+
};
23+
24+
EXPOSE_INTERFACE( CAnimatedEntityTextureProxy, IMaterialProxy, "AnimatedEntityTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
25+
26+
float CAnimatedEntityTextureProxy::GetAnimationStartTime( void* pArg )
27+
{
28+
IClientRenderable *pRend = (IClientRenderable *)pArg;
29+
if (!pRend)
30+
return 0.0f;
31+
32+
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
33+
if (pEntity)
34+
{
35+
return pEntity->GetTextureAnimationStartTime();
36+
}
37+
return 0.0f;
38+
}
39+
40+
void CAnimatedEntityTextureProxy::AnimationWrapped( void* pArg )
41+
{
42+
IClientRenderable *pRend = (IClientRenderable *)pArg;
43+
if (!pRend)
44+
return;
45+
46+
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
47+
if (pEntity)
48+
{
49+
pEntity->TextureAnimationWrapped();
50+
}
51+
}

cl_dll/animatedoffsettextureproxy.cpp

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
//=============================================================================//
6+
7+
#include "cbase.h"
8+
#include "BaseAnimatedTextureProxy.h"
9+
10+
// memdbgon must be the last include file in a .cpp file!!!
11+
#include "tier0/memdbgon.h"
12+
13+
class CAnimatedOffsetTextureProxy : public CBaseAnimatedTextureProxy
14+
{
15+
public:
16+
CAnimatedOffsetTextureProxy() : m_flFrameOffset( 0.0f ) {}
17+
18+
virtual ~CAnimatedOffsetTextureProxy() {}
19+
20+
virtual float GetAnimationStartTime( void* pBaseEntity );
21+
virtual void OnBind( void *pBaseEntity );
22+
23+
protected:
24+
25+
float m_flFrameOffset;
26+
};
27+
28+
EXPOSE_INTERFACE( CAnimatedOffsetTextureProxy, IMaterialProxy, "AnimatedOffsetTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
29+
30+
//-----------------------------------------------------------------------------
31+
// Purpose:
32+
// Input : pArg -
33+
// Output : float
34+
//-----------------------------------------------------------------------------
35+
float CAnimatedOffsetTextureProxy::GetAnimationStartTime( void* pArg )
36+
{
37+
return m_flFrameOffset;
38+
}
39+
40+
//-----------------------------------------------------------------------------
41+
// Purpose:
42+
// Input : *pBaseEntity -
43+
//-----------------------------------------------------------------------------
44+
void CAnimatedOffsetTextureProxy::OnBind( void *pBaseEntity )
45+
{
46+
C_BaseEntity* pEntity = (C_BaseEntity*)pBaseEntity;
47+
48+
if ( pEntity )
49+
{
50+
m_flFrameOffset = pEntity->GetTextureAnimationStartTime();
51+
}
52+
53+
// Call into the base class
54+
CBaseAnimatedTextureProxy::OnBind( pBaseEntity );
55+
}
56+

cl_dll/animatedtextureproxy.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose:
4+
//
5+
// $NoKeywords: $
6+
//=============================================================================//
7+
#include "cbase.h"
8+
#include "BaseAnimatedTextureProxy.h"
9+
10+
// memdbgon must be the last include file in a .cpp file!!!
11+
#include "tier0/memdbgon.h"
12+
13+
class CAnimatedTextureProxy : public CBaseAnimatedTextureProxy
14+
{
15+
public:
16+
CAnimatedTextureProxy() {}
17+
virtual ~CAnimatedTextureProxy() {}
18+
virtual float GetAnimationStartTime( void* pBaseEntity );
19+
};
20+
21+
EXPOSE_INTERFACE( CAnimatedTextureProxy, IMaterialProxy, "AnimatedTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
22+
23+
#pragma warning (disable : 4100)
24+
25+
float CAnimatedTextureProxy::GetAnimationStartTime( void* pBaseEntity )
26+
{
27+
return 0;
28+
}
29+
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
2+
//
3+
// Purpose: Acts exactly like "AnimatedTexture", but ONLY if the texture
4+
// it's working on matches the desired texture to work on.
5+
//
6+
// This assumes that some other proxy will be switching out the textures.
7+
//
8+
// $NoKeywords: $
9+
//=============================================================================//
10+
#include "cbase.h"
11+
#include "materialsystem/IMaterialProxy.h"
12+
#include "materialsystem/IMaterialVar.h"
13+
#include "materialsystem/IMaterial.h"
14+
#include "materialsystem/ITexture.h"
15+
#include "BaseAnimatedTextureProxy.h"
16+
#include "utlstring.h"
17+
#include <KeyValues.h>
18+
19+
// memdbgon must be the last include file in a .cpp file!!!
20+
#include "tier0/memdbgon.h"
21+
22+
class CAnimateSpecificTexture : public CBaseAnimatedTextureProxy
23+
{
24+
private:
25+
CUtlString m_OnlyAnimateOnTexture;
26+
public:
27+
virtual float GetAnimationStartTime( void* pBaseEntity ) { return 0; }
28+
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
29+
virtual void OnBind( void *pC_BaseEntity );
30+
virtual void Release( void ) { delete this; }
31+
};
32+
33+
bool CAnimateSpecificTexture::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
34+
{
35+
char const* pszAnimateOnTexture = pKeyValues->GetString( "onlyAnimateOnTexture" );
36+
if( !pszAnimateOnTexture )
37+
return false;
38+
39+
m_OnlyAnimateOnTexture.Set( pszAnimateOnTexture );
40+
41+
return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
42+
}
43+
44+
void CAnimateSpecificTexture::OnBind( void *pC_BaseEntity )
45+
{
46+
if( FStrEq( m_AnimatedTextureVar->GetTextureValue()->GetName(), m_OnlyAnimateOnTexture ) )
47+
{
48+
CBaseAnimatedTextureProxy::OnBind( pC_BaseEntity );
49+
}
50+
//else do nothing
51+
}
52+
53+
EXPOSE_INTERFACE( CAnimateSpecificTexture, IMaterialProxy, "AnimateSpecificTexture" IMATERIAL_PROXY_INTERFACE_VERSION );

0 commit comments

Comments
 (0)