#include <kthook/kthook.hpp>
typedef struct CVector { float x, y, z; } CVector;
typedef struct tRadarTrace {
unsigned int m_nColour; // see eBlipColour
unsigned int m_nEntityHandle;
CVector m_vecPos;
unsigned short m_nCounter;
float m_fSphereRadius;
unsigned short m_nBlipSize;
class CEntryExit* m_pEntryExit;
unsigned char m_nRadarSprite; // see eRadarSprite
unsigned char m_bBright : 1; // It makes use of bright colors. Always set.
unsigned char m_bInUse : 1; // It is available.
unsigned char m_bShortRange : 1; // It doesn't show permanently on the radar.
unsigned char m_bFriendly : 1; // It is affected by BLIP_COLOUR_THREAT.
unsigned char m_bBlipRemain : 1; // It has the priority over the entity (it will still appear after the entity's deletion).
unsigned char m_bBlipFade : 1; // Possibly a leftover. Always unset (unused).
unsigned char m_nCoordBlipAppearance : 2; // see eBlipAppearance
unsigned char m_nBlipDisplay : 2; // see eBlipDisplay
unsigned char m_nBlipType : 4; // see eBlipType
} tRadarTrace;
class plugin {
protected:
using drawCoordBlip_t = void(__cdecl*)(int, std::uint8_t);
unsigned char deleted_sprite_idx = 32;
kthook::kthook_simple<drawCoordBlip_t> hk_drawCoordBlip{ 0x586D60 };
tRadarTrace* ms_RadarTrace = (tRadarTrace*)0xBA86F0;
public:
plugin() {
hk_drawCoordBlip.set_cb(
[this](const decltype(hk_drawCoordBlip)& hook, int blipArrId, std::uint8_t isSprite) {
if (ms_RadarTrace[blipArrId].m_nRadarSprite == deleted_sprite_idx) return;
return hook.get_trampoline()(blipArrId, isSprite);
}
);
hk_drawCoordBlip.install();
}
~plugin() { hk_drawCoordBlip.~kthook_simple(); }
} _plugin_;