r5sdk/r5dev/game/shared/animation.cpp
Kawe Mazidjatari 7dd107916c Fix rare crash
Rare crash when the sqvm tries to look for an animation sequence on a missing prop_dynamic model (mdl/error.rmdl doesn't support animations), its purely to indicate there is a problem).
2022-04-30 18:59:55 +02:00

31 lines
943 B
C++

//=============================================================================//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "core/stdafx.h"
#include "public/include/studio.h"
#include "game/shared/animation.h"
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
int CStudioHdr::LookupSequence(CStudioHdr* pStudio, const char* pszName)
{
if (!pStudio->m_pMdlCacheVTable)
return -1; // animations are unavailable for missing dynamic props! (mdl/error.rmdl).
return v_CStudioHdr__LookupSequence(pStudio, pszName);
}
void Animation_Attach()
{
DetourAttach((LPVOID*)&v_CStudioHdr__LookupSequence, &CStudioHdr::LookupSequence);
}
void Animation_Detach()
{
DetourDetach((LPVOID*)&v_CStudioHdr__LookupSequence, &CStudioHdr::LookupSequence);
}