hooks.hpp
namespace index
{
constexpr auto DrawModelExecute = 21;
}
hooks.cpp
vfunc_hook mdlrender_hook;
void Initialize()
{
...
mdlrender_hook.setup(g_MdlRender);
...
mdlrender_hook.hook_index(index::DrawModelExecute, hkDrawModelExecute);
}
...
void __stdcall hkDrawModelExecute(IMatRenderContext* ctx, const DrawModelState_t& state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld)
{
static auto ofunc = mdlrender_hook.GetOriginalFunc<DrawModelExecute>(index::DrawModelExecute);
if (g_MdlRender->IsForcedMaterialOverride())
ofunc(g_MdlRender, ctx, state, pInfo, pCustomBoneToWorld);
ofunc(g_MdlRender, ctx, state, pInfo, pCustomBoneToWorld);
}