aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/toggletextureproxy.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /sp/src/game/client/toggletextureproxy.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/game/client/toggletextureproxy.cpp')
-rw-r--r--sp/src/game/client/toggletextureproxy.cpp252
1 files changed, 126 insertions, 126 deletions
diff --git a/sp/src/game/client/toggletextureproxy.cpp b/sp/src/game/client/toggletextureproxy.cpp
index 01d6f088..77eea576 100644
--- a/sp/src/game/client/toggletextureproxy.cpp
+++ b/sp/src/game/client/toggletextureproxy.cpp
@@ -1,126 +1,126 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-#include "cbase.h"
-#include "toggletextureproxy.h"
-#include "materialsystem/imaterial.h"
-#include "materialsystem/imaterialvar.h"
-#include "materialsystem/itexture.h"
-#include <KeyValues.h>
-#include "functionproxy.h"
-#include "toolframework_client.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-// forward declarations
-void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
-
-EXPOSE_INTERFACE( CBaseToggleTextureProxy, IMaterialProxy, "ToggleTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
-
-//-----------------------------------------------------------------------------
-// Constructor, destructor:
-//-----------------------------------------------------------------------------
-
-CBaseToggleTextureProxy::CBaseToggleTextureProxy()
-{
- Cleanup();
-}
-
-CBaseToggleTextureProxy::~CBaseToggleTextureProxy()
-{
- Cleanup();
-}
-
-C_BaseEntity *CBaseToggleTextureProxy::BindArgToEntity( void *pArg )
-{
- IClientRenderable *pRend = (IClientRenderable *)pArg;
- return pRend->GetIClientUnknown()->GetBaseEntity();
-}
-
-//-----------------------------------------------------------------------------
-// Initialization, shutdown
-//-----------------------------------------------------------------------------
-bool CBaseToggleTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
-{
- char const* pTextureVarName = pKeyValues->GetString( "toggleTextureVar" );
- if( !pTextureVarName )
- return false;
-
- bool foundVar;
- m_TextureVar = pMaterial->FindVar( pTextureVarName, &foundVar, false );
- if( !foundVar )
- return false;
-
- char const* pTextureFrameNumVarName = pKeyValues->GetString( "toggleTextureFrameNumVar" );
- if( !pTextureFrameNumVarName )
- return false;
-
- m_TextureFrameNumVar = pMaterial->FindVar( pTextureFrameNumVarName, &foundVar, false );
- if( !foundVar )
- return false;
-
- m_WrapAnimation = !!pKeyValues->GetInt( "toggleShouldWrap", 1 );
- return true;
-}
-
-void CBaseToggleTextureProxy::Cleanup()
-{
- m_TextureVar = NULL;
- m_TextureFrameNumVar = NULL;
-}
-
-
-//-----------------------------------------------------------------------------
-// Does the dirty deed
-//-----------------------------------------------------------------------------
-void CBaseToggleTextureProxy::OnBind( void *pC_BaseEntity )
-{
- assert ( m_TextureVar );
-
- if (!pC_BaseEntity)
- return;
-
- if( m_TextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
- {
- return;
- }
-
- ITexture *pTexture = NULL;
-
- pTexture = m_TextureVar->GetTextureValue();
-
- if ( pTexture == NULL )
- return;
-
- C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
-
- if ( pEntity == NULL )
- return;
-
- int numFrames = pTexture->GetNumAnimationFrames();
- int frame = pEntity->GetTextureFrameIndex();
-
- int intFrame = ((int)frame) % numFrames;
-
- if ( m_WrapAnimation == false )
- {
- if ( frame > numFrames )
- intFrame = numFrames;
- }
-
- m_TextureFrameNumVar->SetIntValue( intFrame );
-
- if ( ToolsEnabled() )
- {
- ToolFramework_RecordMaterialParams( GetMaterial() );
- }
-}
-
-IMaterial *CBaseToggleTextureProxy::GetMaterial()
-{
- return m_TextureFrameNumVar->GetOwningMaterial();
-}
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "toggletextureproxy.h"
+#include "materialsystem/imaterial.h"
+#include "materialsystem/imaterialvar.h"
+#include "materialsystem/itexture.h"
+#include <KeyValues.h>
+#include "functionproxy.h"
+#include "toolframework_client.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+// forward declarations
+void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
+
+EXPOSE_INTERFACE( CBaseToggleTextureProxy, IMaterialProxy, "ToggleTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
+
+//-----------------------------------------------------------------------------
+// Constructor, destructor:
+//-----------------------------------------------------------------------------
+
+CBaseToggleTextureProxy::CBaseToggleTextureProxy()
+{
+ Cleanup();
+}
+
+CBaseToggleTextureProxy::~CBaseToggleTextureProxy()
+{
+ Cleanup();
+}
+
+C_BaseEntity *CBaseToggleTextureProxy::BindArgToEntity( void *pArg )
+{
+ IClientRenderable *pRend = (IClientRenderable *)pArg;
+ return pRend->GetIClientUnknown()->GetBaseEntity();
+}
+
+//-----------------------------------------------------------------------------
+// Initialization, shutdown
+//-----------------------------------------------------------------------------
+bool CBaseToggleTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
+{
+ char const* pTextureVarName = pKeyValues->GetString( "toggleTextureVar" );
+ if( !pTextureVarName )
+ return false;
+
+ bool foundVar;
+ m_TextureVar = pMaterial->FindVar( pTextureVarName, &foundVar, false );
+ if( !foundVar )
+ return false;
+
+ char const* pTextureFrameNumVarName = pKeyValues->GetString( "toggleTextureFrameNumVar" );
+ if( !pTextureFrameNumVarName )
+ return false;
+
+ m_TextureFrameNumVar = pMaterial->FindVar( pTextureFrameNumVarName, &foundVar, false );
+ if( !foundVar )
+ return false;
+
+ m_WrapAnimation = !!pKeyValues->GetInt( "toggleShouldWrap", 1 );
+ return true;
+}
+
+void CBaseToggleTextureProxy::Cleanup()
+{
+ m_TextureVar = NULL;
+ m_TextureFrameNumVar = NULL;
+}
+
+
+//-----------------------------------------------------------------------------
+// Does the dirty deed
+//-----------------------------------------------------------------------------
+void CBaseToggleTextureProxy::OnBind( void *pC_BaseEntity )
+{
+ assert ( m_TextureVar );
+
+ if (!pC_BaseEntity)
+ return;
+
+ if( m_TextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
+ {
+ return;
+ }
+
+ ITexture *pTexture = NULL;
+
+ pTexture = m_TextureVar->GetTextureValue();
+
+ if ( pTexture == NULL )
+ return;
+
+ C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
+
+ if ( pEntity == NULL )
+ return;
+
+ int numFrames = pTexture->GetNumAnimationFrames();
+ int frame = pEntity->GetTextureFrameIndex();
+
+ int intFrame = ((int)frame) % numFrames;
+
+ if ( m_WrapAnimation == false )
+ {
+ if ( frame > numFrames )
+ intFrame = numFrames;
+ }
+
+ m_TextureFrameNumVar->SetIntValue( intFrame );
+
+ if ( ToolsEnabled() )
+ {
+ ToolFramework_RecordMaterialParams( GetMaterial() );
+ }
+}
+
+IMaterial *CBaseToggleTextureProxy::GetMaterial()
+{
+ return m_TextureFrameNumVar->GetOwningMaterial();
+}