From 25d3066eae00ea0af66c0ea908f7bbddac806078 Mon Sep 17 00:00:00 2001 From: withmorten Date: Tue, 19 Jan 2021 12:05:38 +0100 Subject: fix RWLIBS build without GTA_PS2_STUFF --- src/core/Radar.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 816da6b9..ba939fa3 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1,3 +1,6 @@ +#if !defined(GTA_PS2_STUFF) && defined(RWLIBS) +#define WITHD3D +#endif #include "config.h" #include "common.h" -- cgit v1.2.3 From bb66028e74d5a8d9e75f2448caa876ac35d4f700 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 Jan 2021 21:33:09 +0100 Subject: pc radar fix --- src/core/Radar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 816da6b9..a5acdfad 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -778,7 +778,7 @@ void CRadar::DrawRadarMask() CVector2D(-1.0, -1.0f) }; - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)nil); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); -- cgit v1.2.3 From ac0f759b274368b9424222a392d9f28b73980eb0 Mon Sep 17 00:00:00 2001 From: withmorten Date: Tue, 19 Jan 2021 13:35:48 +0100 Subject: make building with Codewarrior 7 possible --- src/core/Radar.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index ba939fa3..4672e024 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1,4 +1,4 @@ -#if !defined(GTA_PS2_STUFF) && defined(RWLIBS) +#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__) #define WITHD3D #endif #include "config.h" @@ -79,7 +79,7 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { #define RADAR_NUM_TILES (8) #define RADAR_TILE_SIZE (RADAR_SIZE_X / RADAR_NUM_TILES) -static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); +re3_static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); #define RADAR_MIN_RANGE (120.0f) #define RADAR_MAX_RANGE (350.0f) @@ -298,10 +298,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id) int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) { CVector2D corners[4] = { - { 1.0f, -1.0f }, // top right - { 1.0f, 1.0f }, // bottom right - { -1.0f, 1.0f }, // bottom left - { -1.0f, -1.0f }, // top left + CVector2D( 1.0f, -1.0f ), // top right + CVector2D( 1.0f, 1.0f ), // bottom right + CVector2D( -1.0f, 1.0f ), // bottom left + CVector2D( -1.0f, -1.0f ), // top left }; CVector2D tmp; int i, j, n; -- cgit v1.2.3 From 034df61f3c2757b28c082101fd0f38054263c0ed Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 21 Jan 2021 03:40:56 +0100 Subject: codewarrior: finishing touches --- src/core/Radar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 99ad7d0b..116e9e94 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -79,7 +79,7 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { #define RADAR_NUM_TILES (8) #define RADAR_TILE_SIZE (RADAR_SIZE_X / RADAR_NUM_TILES) -re3_static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); +static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not a square"); #define RADAR_MIN_RANGE (120.0f) #define RADAR_MAX_RANGE (350.0f) -- cgit v1.2.3 From d52b917c549719addf45788413210ea1700cd0d5 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 29 Jan 2021 03:32:21 +0300 Subject: Some regular fixes and UB fixes --- src/core/Radar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 116e9e94..4fd7f1a5 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -908,7 +908,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i) uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright) { - int32 c; + uint32 c; switch (color) { case RADAR_TRACE_RED: if (bright) -- cgit v1.2.3 From 7a3b80a9b7f414967fe59f89ab0fe5416735babe Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 31 Jan 2021 20:44:39 +0100 Subject: First batch of fixes (CallAndMessage) --- src/core/Radar.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 4fd7f1a5..7f778498 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -404,6 +404,9 @@ void CRadar::Draw3dMarkers() case BLIP_CHAR: { CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); +#ifdef FIX_BUGS + if(!entity) break; +#endif if (entity != nil) { if (((CPed*)entity)->InVehicle()) entity = ((CPed * )entity)->m_pMyVehicle; -- cgit v1.2.3 From 3d4791f2915a5b1f38c34a0cf01e0dffc588af8c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 31 Jan 2021 21:06:38 +0100 Subject: Revert "First batch of fixes (CallAndMessage)" This reverts commit 7a3b80a9b7f414967fe59f89ab0fe5416735babe. --- src/core/Radar.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 7f778498..4fd7f1a5 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -404,9 +404,6 @@ void CRadar::Draw3dMarkers() case BLIP_CHAR: { CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); -#ifdef FIX_BUGS - if(!entity) break; -#endif if (entity != nil) { if (((CPed*)entity)->InVehicle()) entity = ((CPed * )entity)->m_pMyVehicle; -- cgit v1.2.3 From 931bc690cd898497ed4c783ecffb8e00a0594ac2 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 28 Feb 2021 14:55:01 +0100 Subject: proper radar clipping --- src/core/Radar.cpp | 190 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 73 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 4fd7f1a5..31b5669f 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -142,6 +142,79 @@ void GetTextureCorners(int32 x, int32 y, CVector2D *out) out[3].y = RADAR_TILE_SIZE * (y); } +uint8 CRadar::CalculateBlipAlpha(float dist) +{ +#ifdef MENU_MAP + if (CMenuManager::bMenuMapActive) + return 255; +#endif + if (dist <= 1.0f) + return 255; + + if (dist <= 5.0f) + return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f); + + return 128; +} + +void CRadar::ChangeBlipBrightness(int32 i, int32 bright) +{ + int index = GetActualBlipArrayIndex(i); + if (index != -1) + ms_RadarTrace[index].m_bDim = bright != 1; +} + +void CRadar::ChangeBlipColour(int32 i, int32 color) +{ + int index = GetActualBlipArrayIndex(i); + if (index != -1) + ms_RadarTrace[index].m_nColor = color; +} + +void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display) +{ + int index = GetActualBlipArrayIndex(i); + if (index != -1) + ms_RadarTrace[index].m_eBlipDisplay = display; +} + +void CRadar::ChangeBlipScale(int32 i, int32 scale) +{ + int index = GetActualBlipArrayIndex(i); + if (index != -1) + ms_RadarTrace[index].m_wScale = scale; +} + +void CRadar::ClearBlip(int32 i) +{ + int index = GetActualBlipArrayIndex(i); + if (index != -1) { + SetRadarMarkerState(index, false); + ms_RadarTrace[index].m_bInUse = false; +#ifndef MENU_MAP + // Ssshhh + ms_RadarTrace[index].m_eBlipType = BLIP_NONE; + ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; + ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE; +#endif + } +} + +void CRadar::ClearBlipForEntity(eBlipType type, int32 id) +{ + for (int i = 0; i < NUMRADARBLIPS; i++) { + if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) { + SetRadarMarkerState(i, false); + ms_RadarTrace[i].m_bInUse = false; + ms_RadarTrace[i].m_eBlipType = BLIP_NONE; + ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; + ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE; + } + }; +} + +// Why not a proper clipping algorithm? +#ifdef THIS_IS_STUPID bool IsPointInsideRadar(const CVector2D &point) { @@ -222,79 +295,6 @@ int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D & return edge; } - -uint8 CRadar::CalculateBlipAlpha(float dist) -{ -#ifdef MENU_MAP - if (CMenuManager::bMenuMapActive) - return 255; -#endif - if (dist <= 1.0f) - return 255; - - if (dist <= 5.0f) - return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f); - - return 128; -} - -void CRadar::ChangeBlipBrightness(int32 i, int32 bright) -{ - int index = GetActualBlipArrayIndex(i); - if (index != -1) - ms_RadarTrace[index].m_bDim = bright != 1; -} - -void CRadar::ChangeBlipColour(int32 i, int32 color) -{ - int index = GetActualBlipArrayIndex(i); - if (index != -1) - ms_RadarTrace[index].m_nColor = color; -} - -void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display) -{ - int index = GetActualBlipArrayIndex(i); - if (index != -1) - ms_RadarTrace[index].m_eBlipDisplay = display; -} - -void CRadar::ChangeBlipScale(int32 i, int32 scale) -{ - int index = GetActualBlipArrayIndex(i); - if (index != -1) - ms_RadarTrace[index].m_wScale = scale; -} - -void CRadar::ClearBlip(int32 i) -{ - int index = GetActualBlipArrayIndex(i); - if (index != -1) { - SetRadarMarkerState(index, false); - ms_RadarTrace[index].m_bInUse = false; -#ifndef MENU_MAP - // Ssshhh - ms_RadarTrace[index].m_eBlipType = BLIP_NONE; - ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; - ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE; -#endif - } -} - -void CRadar::ClearBlipForEntity(eBlipType type, int32 id) -{ - for (int i = 0; i < NUMRADARBLIPS; i++) { - if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) { - SetRadarMarkerState(i, false); - ms_RadarTrace[i].m_bInUse = false; - ms_RadarTrace[i].m_eBlipType = BLIP_NONE; - ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; - ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE; - } - }; -} - -// Why not a proper clipping algorithm? int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) { CVector2D corners[4] = { @@ -373,6 +373,50 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) return n; } +#else + +int +ClipPolyPlane(const CVector2D *in, int nin, CVector2D *out, CVector *plane) +{ + int j; + int nout; + int x1, x2; + float d1, d2, t; + + nout = 0; + for(j = 0; j < nin; j++){ + x1 = j; + x2 = (j+1) % nin; + + d1 = plane->x*in[x1].x + plane->y*in[x1].y + plane->z; + d2 = plane->x*in[x2].x + plane->y*in[x2].y + plane->z; + if(d1*d2 < 0.0f){ + t = d1/(d1 - d2); + out[nout++] = in[x1]*(1.0f-t) + in[x2]*t; + } + if(d2 >= 0.0f) + out[nout++] = in[x2]; + } + return nout; +} + +int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) +{ + CVector planes[4] = { + CVector(-1.0f, 0.0f, 1.0f), + CVector( 1.0f, 0.0f, 1.0f), + CVector(0.0f, -1.0f, 1.0f), + CVector(0.0f, 1.0f, 1.0f) + }; + CVector2D tmp[8]; + int n; + if(n = ClipPolyPlane(rect, 4, tmp, &planes[0]), n == 0) return 0; + if(n = ClipPolyPlane(tmp, n, poly, &planes[1]), n == 0) return 0; + if(n = ClipPolyPlane(poly, n, tmp, &planes[2]), n == 0) return 0; + if(n = ClipPolyPlane(tmp, n, poly, &planes[3]), n == 0) return 0; + return n; +} +#endif bool CRadar::DisplayThisBlip(int32 counter) { -- cgit v1.2.3 From 596e12b8976f2138eb0d010a8c0e37ca0d614e1f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 22 May 2021 08:35:29 +0300 Subject: Fix C3dMarkers::PlaceMarker calls in Radar --- src/core/Radar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 31b5669f..8f2c1747 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -441,7 +441,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5); } break; } @@ -455,7 +455,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += 3.0f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, 0, 128, 255, 255, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.5f, 0, 128, 255, 255, 1024, 0.2f, 5); } break; } @@ -465,7 +465,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5); } break; } @@ -474,7 +474,7 @@ void CRadar::Draw3dMarkers() case BLIP_CONTACT_POINT: if (!CTheScripts::IsPlayerOnAMission()) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) - C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, 0, 128, 255, 128, 2048, 0.2f, 0); + C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_CYLINDER, ms_RadarTrace[i].m_vecPos, 2.0f, 0, 128, 255, 128, 2048, 0.2f, 0); } break; } -- cgit v1.2.3 From 2b67aba94cb6448fb24c869559465eddf2bad069 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 25 Jun 2021 19:03:05 +0300 Subject: Redo ReadSaveBuf + common.h cleanup --- src/core/Radar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 8f2c1747..77d6cc7f 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -16,6 +16,7 @@ #include "Script.h" #include "TxdStore.h" #include "World.h" +#include "SaveBuf.h" #include "Streaming.h" #include "SpecialFX.h" @@ -1055,7 +1056,7 @@ INITSAVEBUF CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE); for (int i = 0; i < NUMRADARBLIPS; i++) - ms_RadarTrace[i] = ReadSaveBuf(buf); + ReadSaveBuf(&ms_RadarTrace[i], buf); VALIDATESAVEBUF(size); } -- cgit v1.2.3 From af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 26 Jun 2021 00:25:59 +0300 Subject: Revert "Redo ReadSaveBuf + common.h cleanup" This reverts commit 2b67aba94cb6448fb24c869559465eddf2bad069. --- src/core/Radar.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 77d6cc7f..8f2c1747 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -16,7 +16,6 @@ #include "Script.h" #include "TxdStore.h" #include "World.h" -#include "SaveBuf.h" #include "Streaming.h" #include "SpecialFX.h" @@ -1056,7 +1055,7 @@ INITSAVEBUF CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE); for (int i = 0; i < NUMRADARBLIPS; i++) - ReadSaveBuf(&ms_RadarTrace[i], buf); + ms_RadarTrace[i] = ReadSaveBuf(buf); VALIDATESAVEBUF(size); } -- cgit v1.2.3 From f3a931e1c99372ae4bc224ef482d4052a09580cb Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 26 Jun 2021 19:14:46 +0200 Subject: Revert "Revert "Redo ReadSaveBuf + common.h cleanup"" This reverts commit af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f. --- src/core/Radar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 8f2c1747..77d6cc7f 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -16,6 +16,7 @@ #include "Script.h" #include "TxdStore.h" #include "World.h" +#include "SaveBuf.h" #include "Streaming.h" #include "SpecialFX.h" @@ -1055,7 +1056,7 @@ INITSAVEBUF CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE); for (int i = 0; i < NUMRADARBLIPS; i++) - ms_RadarTrace[i] = ReadSaveBuf(buf); + ReadSaveBuf(&ms_RadarTrace[i], buf); VALIDATESAVEBUF(size); } -- cgit v1.2.3 From bd3c3849fea9837fb3b1834c5216f5bab5823d69 Mon Sep 17 00:00:00 2001 From: Davi Date: Wed, 21 Jul 2021 23:13:35 -0300 Subject: Properly fix blip rendering during scripted sequences Changes conditionals from "DrawBlips" and "ShowRadarTrace", "ShowRadarTraceWithHeight" to allow blips to be rendered during scripted sequences when "MENU_MAP" is enabled. --- src/core/Radar.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 77d6cc7f..e0203355 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -485,7 +485,11 @@ void CRadar::Draw3dMarkers() void CRadar::DrawBlips() { - if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { + if ((!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) +#ifdef MENU_MAP + || CMenuManager::bMenuMapActive +#endif + ) { RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); @@ -1216,7 +1220,11 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha) { - if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn) + if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud) +#ifdef MENU_MAP + && !CMenuManager::bMenuMapActive +#endif + ) return; CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha)); @@ -1225,7 +1233,11 @@ void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 gree void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode) { - if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn) + if ((TheCamera.m_WideScreenOn || !CHud::m_Wants_To_Draw_Hud) +#ifdef MENU_MAP + && !CMenuManager::bMenuMapActive +#endif + ) return; switch (mode) -- cgit v1.2.3 From 865ce46fdb77e769101fd8c693272eab1c800e34 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 2 Aug 2021 14:26:00 +0300 Subject: Fix waypoint disappearing after each save --- src/core/Radar.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core/Radar.cpp') diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index e0203355..cccf1d2e 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1022,6 +1022,10 @@ const char* gRadarTexNames[] = { void CRadar::Initialise() { +#ifdef MENU_MAP + TargetMarkerId = -1; +#endif + for (int i = 0; i < NUMRADARBLIPS; i++) { ms_RadarTrace[i].m_BlipIndex = 1; SetRadarMarkerState(i, false); @@ -1107,15 +1111,23 @@ INITSAVEBUF WriteSaveHeader(buf, 'R', 'D', 'R', '\0', *size - SAVE_HEADER_SIZE); #ifdef MENU_MAP + bool bWaypointDeleted = false; if (TargetMarkerId != -1) { ClearBlip(TargetMarkerId); TargetMarkerId = -1; + bWaypointDeleted = true; } #endif for (int i = 0; i < NUMRADARBLIPS; i++) WriteSaveBuf(buf, ms_RadarTrace[i]); + +#ifdef MENU_MAP + if(bWaypointDeleted) + ToggleTargetMarker(TargetMarkerPos.x, TargetMarkerPos.y); +#endif + VALIDATESAVEBUF(*size); } -- cgit v1.2.3