summaryrefslogtreecommitdiffstats
path: root/src/Radar.cpp
diff options
context:
space:
mode:
author_AG <gennariarmando@outlook.com>2019-06-15 01:34:19 +0200
committer_AG <gennariarmando@outlook.com>2019-06-15 01:34:36 +0200
commit92cc1cf3af5c5454eddd464e42c495d3739a1cce (patch)
tree1de213d2ed114443e28a72e486af0c173b8b3b1a /src/Radar.cpp
parentMerge pull request #15 from ShFil119/patch-1 (diff)
downloadre3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar.gz
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar.bz2
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar.lz
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar.xz
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.tar.zst
re3-92cc1cf3af5c5454eddd464e42c495d3739a1cce.zip
Diffstat (limited to 'src/Radar.cpp')
-rw-r--r--src/Radar.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Radar.cpp b/src/Radar.cpp
index a84d5b91..3b2d6b26 100644
--- a/src/Radar.cpp
+++ b/src/Radar.cpp
@@ -1,5 +1,47 @@
#include "common.h"
#include "patcher.h"
#include "Radar.h"
+#include "Camera.h"
+#include "Hud.h"
+#include "World.h"
+#include "Frontend.h"
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
+WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
+//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
+WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
+WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
+
+Float &CRadar::m_RadarRange = *(Float*)0x8E281C;
+CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8;
+
+void CRadar::DrawMap() {
+ 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 {
+ CRadar::m_RadarRange = 120.0f;
+ }
+ }
+ else {
+ CRadar::m_RadarRange = 120.0f;
+ }
+ vec2DRadarOrigin.x = FindPlayerCentreOfWorld_NoSniperShift().x;
+ vec2DRadarOrigin.y = FindPlayerCentreOfWorld_NoSniperShift().y;
+ CRadar::DrawRadarMap();
+ }
+}
+
+void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) {
+ out->x = in->x * SCREEN_STRETCH_X(47.0f) + SCREEN_STRETCH_X(47.0f + 20.0f);
+ out->y = (SCREEN_STRETCH_Y(76.0f)) * 0.5f + RsGlobal.height - (SCREEN_STRETCH_Y(123.0f)) - in->y * (SCREEN_STRETCH_Y(76.0f)) * 0.5f;
+}
+
+STARTPATCHES
+ InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file