diff options
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() |