From f56bb35301836e56582a575a75864392a0177875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 2 Dec 2013 19:31:46 -0800 Subject: Fix line endings. WHAMMY. --- mp/src/game/client/toggletextureproxy.cpp | 252 +++++++++++++++--------------- 1 file changed, 126 insertions(+), 126 deletions(-) (limited to 'mp/src/game/client/toggletextureproxy.cpp') diff --git a/mp/src/game/client/toggletextureproxy.cpp b/mp/src/game/client/toggletextureproxy.cpp index 01d6f088..77eea576 100644 --- a/mp/src/game/client/toggletextureproxy.cpp +++ b/mp/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 -#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 +#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(); +} -- cgit v1.2.3