diff --git a/CHANGELOG-VC.md b/CHANGELOG-VC.md index 0dfebc9..74e672e 100644 --- a/CHANGELOG-VC.md +++ b/CHANGELOG-VC.md @@ -46,6 +46,7 @@ All the remaining, non-critical fixes. * Mission title and 'Mission Passed' texts now stay on screen for the same duration, regardless of screen resolution. * The inner padding of the text boxes with a background now scales to resolution correctly. * The vertical offset of the weapon name text in Ammu-Nation now scales to resolution correctly. +* The downward-pointing destination blip in the Map Legend now displays with a correct outline. * `FILE_FLAG_NO_BUFFERING` flag has been removed from IMG reading functions - speeding up streaming. * Free resprays will not carry on a New Game now. * Fixed ambulance and firetruck dispatch timers - they reset on New Game now. diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 0914b55..1da4a66 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -648,6 +648,22 @@ namespace BigMessage3ScalingFixes } +// ============= Fix an incorrect vertex setup for the outline of a destination blip in the Map Legend ============= +namespace LegendBlipFix +{ + static void (*orgDraw2DPolygon)(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA& color); + static void Draw2DPolygon_FixVertices(float x1, float y1, float x2, float y2, float /*x3*/, float y3, float x4, float y4, const CRGBA& color) + { + // In this setup, x3 is incorrect - it should have been (X + scaleX(14.0f)) but is (X + scaleX(2.0f)), same as x4 + // We can recover the correct dimensions from x1 (bottom center) and x4 (top left): + // x3 = x1 + (x1 - x4) + // Write it out in full like this (without simplifying), so we know (x1 - x4) is done at a correct floating point precision. + const float x3 = x1 + (x1 - x4); + orgDraw2DPolygon(x1, y1, x2, y2, x3, y3, x4, y4, color); + } +} + + float FixedRefValue() { return 1.0f; @@ -2915,6 +2931,17 @@ void Patch_VC_Common() Nop(set_peds_choking, 6); } TXN_CATCH(); + + + // Fix an incorrect vertex setup for the outline of a destination blip in the Map Legend + try + { + using namespace LegendBlipFix; + + auto draw2dPolygon = get_pattern("E8 ? ? ? ? D9 EE D9 EE D9 EE DB 05 ? ? ? ? 89 5C 24 24"); + InterceptCall(draw2dPolygon, orgDraw2DPolygon, Draw2DPolygon_FixVertices); + } + TXN_CATCH(); } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)