re3/src/Radar.cpp

49 lines
1.5 KiB
C++
Raw Normal View History

#include "common.h"
#include "patcher.h"
#include "Radar.h"
2019-06-14 23:34:19 +00:00
#include "Camera.h"
#include "Hud.h"
#include "World.h"
#include "Frontend.h"
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
2019-06-14 23:34:19 +00:00
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
2019-06-16 22:16:38 +00:00
float &CRadar::m_RadarRange = *(float*)0x8E281C;
2019-06-14 23:34:19 +00:00
CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8;
void CRadar::DrawMap()
{
2019-06-14 23:34:19 +00:00
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
if (FindPlayerVehicle()) {
if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.3f) {
if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.9f)
CRadar::m_RadarRange = 350.0f;
else
CRadar::m_RadarRange = (FindPlayerVehicle()->GetSpeed().Magnitude() + 0.3f) * 200.0f;
}
else
2019-06-14 23:34:19 +00:00
CRadar::m_RadarRange = 120.0f;
}
else
2019-06-14 23:34:19 +00:00
CRadar::m_RadarRange = 120.0f;
2019-06-14 23:34:19 +00:00
vec2DRadarOrigin.x = FindPlayerCentreOfWorld_NoSniperShift().x;
vec2DRadarOrigin.y = FindPlayerCentreOfWorld_NoSniperShift().y;
CRadar::DrawRadarMap();
}
}
void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in)
{
2019-06-16 17:06:01 +00:00
out->x = in->x * HUD_STRETCH_X(47.0f) + HUD_STRETCH_X(47.0f + 20.0f);
out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f;
2019-06-14 23:34:19 +00:00
}
STARTPATCHES
InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
ENDPATCHES