diff options
| author | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
|---|---|---|
| committer | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
| commit | 0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch) | |
| tree | c831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/game/client/baseanimatedtextureproxy.cpp | |
| parent | Updated the SDK with the latest code from the TF and HL2 branches. (diff) | |
| download | source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.tar.xz source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.zip | |
Diffstat (limited to 'mp/src/game/client/baseanimatedtextureproxy.cpp')
| -rw-r--r-- | mp/src/game/client/baseanimatedtextureproxy.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/mp/src/game/client/baseanimatedtextureproxy.cpp b/mp/src/game/client/baseanimatedtextureproxy.cpp index 4365e866..b7151114 100644 --- a/mp/src/game/client/baseanimatedtextureproxy.cpp +++ b/mp/src/game/client/baseanimatedtextureproxy.cpp @@ -11,6 +11,8 @@ #include "materialsystem/itexture.h" #include "tier1/KeyValues.h" #include "toolframework_client.h" +#include "tier0/minidump.h" +#include "tier0/stacktools.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -39,25 +41,33 @@ CBaseAnimatedTextureProxy::~CBaseAnimatedTextureProxy() bool CBaseAnimatedTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues ) { char const* pAnimatedTextureVarName = pKeyValues->GetString( "animatedTextureVar" ); - if( !pAnimatedTextureVarName ) - return false; - bool foundVar; - m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false ); - if( !foundVar ) - return false; - - char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" ); - if( !pAnimatedTextureFrameNumVarName ) - return false; + if( pAnimatedTextureVarName ) + { + bool foundVar; - m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false ); - if( !foundVar ) - return false; + m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false ); + if( foundVar ) + { + char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" ); + + if( pAnimatedTextureFrameNumVarName ) + { + m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false ); + + if( foundVar ) + { + m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 ); + m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 ); + return true; + } + } + } + } - m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 ); - m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 ); - return true; + // Error - null out pointers. + Cleanup(); + return false; } void CBaseAnimatedTextureProxy::Cleanup() |