r5sdk/r5dev/engine/gl_rsurf.cpp
Kawe Mazidjatari 144d5f62e1 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2024-04-05 16:41:09 +02:00

41 lines
1.2 KiB
C++
Raw Blame History

//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: render surface
//
// $NoKeywords: $
//===========================================================================//
#include "core/stdafx.h"
#include "tier1/cvar.h"
#include "engine/gl_rsurf.h"
void* R_DrawWorldMeshes(void* baseEntity, void* renderContext, DrawWorldLists_t worldLists)
{
if (r_drawWorldMeshes->GetBool())
return V_DrawWorldMeshes(baseEntity, renderContext, worldLists);
else
return nullptr;
}
void* R_DrawWorldMeshesDepthOnly(void* renderContext, DrawWorldLists_t worldLists)
{
if (r_drawWorldMeshesDepthOnly->GetBool())
return V_DrawWorldMeshesDepthOnly(renderContext, worldLists);
else
return nullptr;
}
void* R_DrawWorldMeshesDepthAtTheEnd(void* ptr1, void* ptr2, void* ptr3, DrawWorldLists_t worldLists)
{
if (r_drawWorldMeshesDepthAtTheEnd->GetBool())
return V_DrawWorldMeshesDepthAtTheEnd(ptr1, ptr2, ptr3, worldLists);
else
return nullptr;
}
void VGL_RSurf::Detour(const bool bAttach) const
{
DetourSetup(&V_DrawWorldMeshes, &R_DrawWorldMeshes, bAttach);
DetourSetup(&V_DrawWorldMeshesDepthOnly, &R_DrawWorldMeshesDepthOnly, bAttach);
DetourSetup(&V_DrawWorldMeshesDepthAtTheEnd, &R_DrawWorldMeshesDepthAtTheEnd, bAttach);
}