2323 MARKER_LAST_SPRITE_INDEX = MARKER_FIRST_SPRITE_INDEX + RADAR_MARKER_LIMIT - 1 ,
2424};
2525
26- constexpr std::array<std::uint32_t , 2 > RADAR_IMAGE_SIZES = {1024 , 2048 };
26+ constexpr std::array<std::uint32_t , 2 > MAP_IMAGE_SIZES = {1024 , 2048 };
2727
2828CPlayerMap::CPlayerMap (CClientManager* pManager)
2929{
@@ -32,8 +32,8 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
3232 m_pRadarMarkerManager = pManager->GetRadarMarkerManager ();
3333 m_pRadarAreaManager = m_pManager->GetRadarAreaManager ();
3434
35- // Set the radar bools
36- m_bIsRadarEnabled = false ;
35+ // Set the map bools
36+ m_bIsPlayerMapEnabled = false ;
3737 m_bForcedState = false ;
3838 m_bIsAttachedToLocal = false ;
3939 m_bHideHelpText = false ;
@@ -59,9 +59,9 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
5959 m_pLocalPlayerBlip = g_pCore->GetGraphics ()->GetRenderItemManager ()->CreateTexture (CalcMTASAPath (" MTA\\ cgui\\ images\\ radarset\\ 02.png" ));
6060
6161 // Create the map image
62- m_pRadarImage = nullptr ;
63- m_radarImageIndex = g_pCore->GetCVars ()->GetValue <std::size_t >(" mapimage" );
64- SetMapImage (m_radarImageIndex );
62+ m_pPlayerMapImage = nullptr ;
63+ m_playerMapImageIndex = g_pCore->GetCVars ()->GetValue <std::size_t >(" mapimage" );
64+ SetMapImage (m_playerMapImageIndex );
6565
6666 // Create the marker textures
6767 CreateMarkerTextures ();
@@ -79,13 +79,11 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
7979 {colorWhiteTransparent, 0 .92f , 1 .5f , " " },
8080 {colorWhite, 0 .95f , 1 .0f , SString (_ (" Change mode: %s" ), *GetBoundKeyName (" radar_attach" ))},
8181
82- {colorWhite, 0 .05f , 1 .0f ,
83- SString (_ (" Zoom: %s/%s Movement: %s, %s, %s, %s Opacity: %s/%s" ),
82+ {colorWhite, 0 .05f , 1 .0f , SString (_ (" Zoom: %s/%s Movement: %s, %s, %s, %s Opacity: %s/%s" ),
8483 *GetBoundKeyName (" radar_zoom_in" ), *GetBoundKeyName (" radar_zoom_out" ), *GetBoundKeyName (" radar_move_north" ),
8584 *GetBoundKeyName (" radar_move_east" ), *GetBoundKeyName (" radar_move_south" ), *GetBoundKeyName (" radar_move_west" ),
8685 *GetBoundKeyName (" radar_opacity_down" ), *GetBoundKeyName (" radar_opacity_up" ))},
87- {colorWhite, 0 .07f , 1 .0f ,
88- SString (_ (" Toggle map: %s Toggle help text: %s" ),
86+ {colorWhite, 0 .07f , 1 .0f , SString (_ (" Toggle map: %s Toggle help text: %s" ),
8987 *GetBoundKeyName (" radar" ), *GetBoundKeyName (" radar_help" ))},
9088 };
9189
@@ -111,7 +109,7 @@ CPlayerMap::CPlayerMap(CClientManager* pManager)
111109CPlayerMap::~CPlayerMap ()
112110{
113111 // Delete our images
114- SAFE_RELEASE (m_pRadarImage );
112+ SAFE_RELEASE (m_pPlayerMapImage );
115113 SAFE_RELEASE (m_pLocalPlayerBlip);
116114
117115 for (uint i = 0 ; i < m_MarkerTextureList.size (); i++)
@@ -125,25 +123,25 @@ CPlayerMap::~CPlayerMap()
125123void CPlayerMap::SetMapImage (std::size_t imageIndex)
126124{
127125 std::uint32_t width, height;
128- if (imageIndex < RADAR_IMAGE_SIZES .size ())
129- width = height = RADAR_IMAGE_SIZES [imageIndex];
126+ if (imageIndex < MAP_IMAGE_SIZES .size ())
127+ width = height = MAP_IMAGE_SIZES [imageIndex];
130128 else // Fail safe, ideally client settings system should not allow this case
131- width = height = RADAR_IMAGE_SIZES [0 ];
129+ width = height = MAP_IMAGE_SIZES [0 ];
132130
133- SString fileName (" MTA\\ cgui\\ images\\ radar_ %d.png" , width);
131+ SString fileName (" MTA\\ cgui\\ images\\ map_ %d.png" , width);
134132
135- if (m_pRadarImage )
136- SAFE_RELEASE (m_pRadarImage );
133+ if (m_pPlayerMapImage )
134+ SAFE_RELEASE (m_pPlayerMapImage );
137135
138- m_pRadarImage = g_pCore->GetGraphics ()->GetRenderItemManager ()->CreateTexture (CalcMTASAPath (fileName), nullptr , false , width, height, RFORMAT_DXT1);
136+ m_pPlayerMapImage = g_pCore->GetGraphics ()->GetRenderItemManager ()->CreateTexture (CalcMTASAPath (fileName), nullptr , false , width, height, RFORMAT_DXT1);
139137
140138 g_pCore->GetConsole ()->Printf (" Player map image loaded: %s" , fileName);
141139}
142140
143141void CPlayerMap::DoPulse ()
144142{
145- // If our radar image exists
146- if (IsRadarShowing ())
143+ // If our map image exists
144+ if (IsPlayerMapShowing ())
147145 {
148146 // If we are following the local player blip
149147 if (m_bIsAttachedToLocal)
@@ -254,26 +252,26 @@ CTextureItem* CPlayerMap::GetMarkerTexture(CClientRadarMarker* pMarker, float fL
254252
255253void CPlayerMap::DoRender ()
256254{
257- bool bIsRadarShowing = IsRadarShowing ();
255+ bool isMapShowing = IsPlayerMapShowing ();
258256
259257 // Render if showing
260- if (bIsRadarShowing )
258+ if (isMapShowing )
261259 {
262260 // Get the alpha value from the settings
263- int iRadarAlpha;
264- g_pCore->GetCVars ()->Get (" mapalpha" , iRadarAlpha);
261+ int mapAlpha;
262+ g_pCore->GetCVars ()->Get (" mapalpha" , mapAlpha);
263+ const SColorARGB mapColor (mapAlpha, 255 , 255 , 255 );
265264
266265 // Update the image if the user changed it via a setting
267- auto radarImageIndex = g_pCore->GetCVars ()->GetValue <std::size_t >(" mapimage" );
268- if (radarImageIndex != m_radarImageIndex )
266+ auto mapImageIndex = g_pCore->GetCVars ()->GetValue <std::size_t >(" mapimage" );
267+ if (mapImageIndex != m_playerMapImageIndex )
269268 {
270- m_radarImageIndex = radarImageIndex ;
271- SetMapImage (m_radarImageIndex );
269+ m_playerMapImageIndex = mapImageIndex ;
270+ SetMapImage (m_playerMapImageIndex );
272271 }
273272
274- g_pCore->GetGraphics ()->DrawTexture (m_pRadarImage, static_cast <float >(m_iMapMinX), static_cast <float >(m_iMapMinY),
275- m_fMapSize / m_pRadarImage->m_uiSizeX , m_fMapSize / m_pRadarImage->m_uiSizeY , 0 .0f , 0 .0f , 0 .0f ,
276- SColorARGB (iRadarAlpha, 255 , 255 , 255 ));
273+ g_pCore->GetGraphics ()->DrawTexture (m_pPlayerMapImage, static_cast <float >(m_iMapMinX), static_cast <float >(m_iMapMinY),
274+ m_fMapSize / m_pPlayerMapImage->m_uiSizeX , m_fMapSize / m_pPlayerMapImage->m_uiSizeY , 0 .0f , 0 .0f , 0 .0f , mapColor);
277275
278276 // Grab the info for the local player blip
279277 CVector2D vecLocalPos;
@@ -354,7 +352,7 @@ void CPlayerMap::DoRender()
354352 }
355353
356354 // Update visibility of help text
357- bool bRequiredTextVisible = bIsRadarShowing && !m_bHideHelpText;
355+ bool bRequiredTextVisible = isMapShowing && !m_bHideHelpText;
358356 if (bRequiredTextVisible != m_bTextVisible)
359357 {
360358 m_bTextVisible = bRequiredTextVisible;
@@ -365,31 +363,31 @@ void CPlayerMap::DoRender()
365363 }
366364}
367365
368- void CPlayerMap::SetPlayerMapEnabled (bool bIsRadarEnabled )
366+ void CPlayerMap::SetPlayerMapEnabled (bool show )
369367{
370- bool bAlreadyEnabled = (m_bIsRadarEnabled || m_bForcedState);
371- bool bWillShow = (bIsRadarEnabled || m_bForcedState);
372- if (bAlreadyEnabled != bWillShow )
368+ bool alreadyEnabled = (m_bIsPlayerMapEnabled || m_bForcedState);
369+ bool definitiveShow = (show || m_bForcedState);
370+ if (alreadyEnabled != definitiveShow )
373371 {
374- InternalSetRadarEnabled (bWillShow );
372+ InternalSetPlayerMapEnabled (definitiveShow );
375373 }
376- m_bIsRadarEnabled = bIsRadarEnabled ;
374+ m_bIsPlayerMapEnabled = show ;
377375}
378376
379- void CPlayerMap::SetForcedState (bool bState )
377+ void CPlayerMap::SetForcedState (bool state )
380378{
381- bool bAlreadyShowing = (m_bIsRadarEnabled || m_bForcedState);
382- bool bWillShow = (m_bIsRadarEnabled || bState );
383- if (bAlreadyShowing != bWillShow )
379+ bool currState = (m_bIsPlayerMapEnabled || m_bForcedState);
380+ bool definitiveState = (m_bIsPlayerMapEnabled || state );
381+ if (currState != definitiveState )
384382 {
385- InternalSetRadarEnabled (bWillShow );
383+ InternalSetPlayerMapEnabled (definitiveState );
386384 }
387- m_bForcedState = bState ;
385+ m_bForcedState = state ;
388386}
389387
390- void CPlayerMap::InternalSetRadarEnabled (bool bEnabled )
388+ void CPlayerMap::InternalSetPlayerMapEnabled (bool enable )
391389{
392- if (bEnabled )
390+ if (enable )
393391 {
394392 m_bChatVisible = g_pCore->IsChatVisible ();
395393 m_bChatInputBlocked = g_pCore->IsChatInputBlocked ();
@@ -684,15 +682,15 @@ void CPlayerMap::SetAttachedToLocalPlayer(bool bIsAttachedToLocal)
684682 m_HelpTextList[0 ]->SetCaption (_ (" Free Movement" ));
685683}
686684
687- bool CPlayerMap::IsRadarShowing ()
685+ bool CPlayerMap::IsPlayerMapShowing ()
688686{
689- return ((m_bIsRadarEnabled || m_bForcedState) && m_pRadarImage && m_pLocalPlayerBlip && (!g_pCore->GetConsole ()->IsVisible () && !g_pCore->IsMenuVisible ()));
687+ return ((m_bIsPlayerMapEnabled || m_bForcedState) && m_pPlayerMapImage && m_pLocalPlayerBlip && (!g_pCore->GetConsole ()->IsVisible () && !g_pCore->IsMenuVisible ()));
690688}
691689
692690bool CPlayerMap::GetBoundingBox (CVector& vecMin, CVector& vecMax)
693691{
694- // If our radar image exists (Values are not calculated unless map is showing)
695- if (IsRadarShowing ())
692+ // If our map image exists (Values are not calculated unless map is showing)
693+ if (IsPlayerMapShowing ())
696694 {
697695 vecMin.fX = static_cast <float >(m_iMapMinX);
698696 vecMin.fY = static_cast <float >(m_iMapMinY);
0 commit comments