Merge branch 'skmp/fix-radar-masking' into 'main'
Some checks are pending
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Waiting to run
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Waiting to run

Fix radar masking

See merge request skmp/dca3-game!47
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2025-03-10 23:51:47 +00:00
commit 162de2aab4
2 changed files with 18 additions and 0 deletions

View file

@ -752,6 +752,15 @@ void CRadar::DrawRadarMask()
CVector2D out[8]; CVector2D out[8];
CVector2D in; CVector2D in;
// First draw with near Z to clear nearer Z from any 3d objects
for (int i = 0; i < 4; i++) {
in.x = corners[i].x;
in.y = corners[i].y;
TransformRadarPointToScreenSpace(out[i], in);
}
CSprite2d::SetMaskVertices(4, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 4);
// Draw the shape we want to mask out from the radar in four segments // Draw the shape we want to mask out from the radar in four segments
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
// First point is always the corner itself // First point is always the corner itself
@ -767,6 +776,13 @@ void CRadar::DrawRadarMask()
}; };
CSprite2d::SetMaskVertices(8, (float *)out); CSprite2d::SetMaskVertices(8, (float *)out);
// Make the mask depth slightly above the map depth
// Not sure how this worked in the original code tbh
auto vtx = CSprite2d::GetVertices();
for (int j = 0; j < 8; j++) {
vtx[j].w /= 5;
}
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8); RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
} }
#if !defined(GTA_PS2_STUFF) && defined(RWLIBS) #if !defined(GTA_PS2_STUFF) && defined(RWLIBS)

View file

@ -1074,10 +1074,12 @@ void CHud::Draw()
#else #else
rect.Grow(6.0f); rect.Grow(6.0f);
#endif #endif
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(2.0f)); rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(2.0f));
Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(-2.0f)); rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(-2.0f));
Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
} }
CRadar::DrawBlips(); CRadar::DrawBlips();
} }