VC: Fix an incorrect vertex setup for the outline of a destination blip

Fixes #66
This commit is contained in:
Silent 2024-11-02 17:18:44 +01:00
parent 7d055f9264
commit 52deecd5ac
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
2 changed files with 28 additions and 0 deletions

View File

@ -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. * 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 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 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. * `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. * Free resprays will not carry on a New Game now.
* Fixed ambulance and firetruck dispatch timers - they reset on New Game now. * Fixed ambulance and firetruck dispatch timers - they reset on New Game now.

View File

@ -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() float FixedRefValue()
{ {
return 1.0f; return 1.0f;
@ -2915,6 +2931,17 @@ void Patch_VC_Common()
Nop(set_peds_choking, 6); Nop(set_peds_choking, 6);
} }
TXN_CATCH(); 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) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)