Skip to content

Commit ecdd555

Browse files
wip
1 parent 8327611 commit ecdd555

File tree

4 files changed

+56
-8
lines changed

4 files changed

+56
-8
lines changed

Client/core/CSettings.cpp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,26 @@ void CSettings::CreateGUI()
10041004
m_pAdvancedMiscLabel->AutoSize();
10051005
vecTemp.fY += fHeaderHeight;
10061006

1007-
fIndentX = pManager->CGUI_GetMaxTextExtent("default-normal", _("Fast CJ clothes loading:"), _("Browser speed:"), _("Single connection:"), _("Packet tag:"),
1007+
fIndentX = pManager->CGUI_GetMaxTextExtent("default-normal", _("Radar map image:"), _("Fast CJ clothes loading:"), _("Browser speed:"), _("Single connection:"), _("Packet tag:"),
10081008
_("Progress animation:"), _("Fullscreen mode:"), _("Process priority:"), _("Debug setting:"),
10091009
_("Streaming memory:"), _("Update build type:"), _("Install important updates:")) +
10101010
5.0f;
10111011

10121012
vecTemp.fX += 10.0f;
1013+
1014+
// Radar map image
1015+
m_pRadarMapImageLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Radar map image:")));
1016+
m_pRadarMapImageLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
1017+
m_pRadarMapImageLabel->AutoSize();
1018+
1019+
m_pRadarMapImageCombo = reinterpret_cast<CGUIComboBox*>(pManager->CreateComboBox(pTabAdvanced, ""));
1020+
m_pRadarMapImageCombo->SetPosition(CVector2D(vecTemp.fX + fIndentX, vecTemp.fY - 1.0f));
1021+
m_pRadarMapImageCombo->SetSize(CVector2D(fComboWidth, 95.0f));
1022+
m_pRadarMapImageCombo->AddItem(_("1024 x 1024 (Default)"))->SetData((void*)0);
1023+
m_pRadarMapImageCombo->AddItem(_("2048 x 2048"))->SetData((void*)1);
1024+
m_pRadarMapImageCombo->SetReadOnly(true);
1025+
vecTemp.fY += fLineHeight;
1026+
10131027
// Fast clothes loading
10141028
m_pFastClothesLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Fast CJ clothes loading:")));
10151029
m_pFastClothesLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
@@ -1238,7 +1252,7 @@ void CSettings::CreateGUI()
12381252
vecTemp.fX -= fComboWidth + 15;
12391253

12401254
// Description label
1241-
vecTemp.fY = 354 + 10;
1255+
vecTemp.fY += 10;
12421256
m_pAdvancedSettingDescriptionLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, ""));
12431257
m_pAdvancedSettingDescriptionLabel->SetPosition(CVector2D(vecTemp.fX + 10.f, vecTemp.fY));
12441258
m_pAdvancedSettingDescriptionLabel->SetFont("default-bold-small");
@@ -1297,6 +1311,9 @@ void CSettings::CreateGUI()
12971311
m_pFastClothesLabel->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
12981312
m_pFastClothesLabel->SetMouseLeaveHandler(GUI_CALLBACK(&CSettings::OnHideAdvancedSettingDescription, this));
12991313

1314+
m_pRadarMapImageCombo->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
1315+
m_pRadarMapImageCombo->SetMouseLeaveHandler(GUI_CALLBACK(&CSettings::OnHideAdvancedSettingDescription, this));
1316+
13001317
m_pFastClothesCombo->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
13011318
m_pFastClothesCombo->SetMouseLeaveHandler(GUI_CALLBACK(&CSettings::OnHideAdvancedSettingDescription, this));
13021319

@@ -3150,6 +3167,13 @@ void CSettings::LoadData()
31503167
int PriorityClassList[] = {NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS};
31513168
SetPriorityClass(GetCurrentProcess(), PriorityClassList[CVARS_GET_VALUE<int>("process_priority") % 3]);
31523169

3170+
// Radar map image
3171+
CVARS_GET("radar_map_image", iVar);
3172+
if (iVar == 0)
3173+
m_pRadarMapImageCombo->SetText(_("1024 x 1024 (Default)"));
3174+
else if (iVar == 1)
3175+
m_pRadarMapImageCombo->SetText(_("2048 x 2048"));
3176+
31533177
// Fast clothes loading
31543178
CVARS_GET("fast_clothes_loading", iVar);
31553179
if (iVar == CMultiplayer::FAST_CLOTHES_OFF)
@@ -3536,6 +3560,14 @@ void CSettings::SaveData()
35363560
CVARS_SET("dynamic_ped_shadows", bDynamicPedShadows);
35373561
gameSettings->SetDynamicPedShadowsEnabled(bDynamicPedShadows);
35383562

3563+
// Radar map image
3564+
if (CGUIListItem* pSelected = m_pRadarMapImageCombo->GetSelectedItem())
3565+
{
3566+
int iSelected = (int)pSelected->GetData();
3567+
CVARS_SET("radar_map_image", iSelected);
3568+
// TODO Update the map image if radar map exists
3569+
}
3570+
35393571
// Fast clothes loading
35403572
if (CGUIListItem* pSelected = m_pFastClothesCombo->GetSelectedItem())
35413573
{
@@ -4812,6 +4844,8 @@ bool CSettings::OnShowAdvancedSettingDescription(CGUIElement* pElement)
48124844

48134845
if (pLabel && pLabel == m_pPriorityLabel || pComboBox && pComboBox == m_pPriorityCombo)
48144846
strText = std::string(_("Process priority:")) + " " + std::string(_("Very experimental feature."));
4847+
else if (pLabel && pLabel == m_pRadarMapImageLabel || pComboBox && pComboBox == m_pRadarMapImageCombo)
4848+
strText = std::string(_("Radar map image:")) + " " + std::string(_("Select the San Andreas radar map image size."));
48154849
else if (pLabel && pLabel == m_pFastClothesLabel || pComboBox && pComboBox == m_pFastClothesCombo)
48164850
strText = std::string(_("Fast CJ clothes loading:")) + " " + std::string(_("Stops stalls with CJ variations (Uses 65MB more RAM)"));
48174851
else if (pLabel && pLabel == m_pBrowserSpeedLabel || pComboBox && pComboBox == m_pBrowserSpeedCombo)

Client/core/CSettings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ class CSettings
196196
CGUIComboBox* m_pFullscreenStyleCombo;
197197
CGUILabel* m_pPriorityLabel;
198198
CGUIComboBox* m_pPriorityCombo;
199+
CGUILabel* m_pRadarMapImageLabel;
200+
CGUIComboBox* m_pRadarMapImageCombo;
199201
CGUILabel* m_pFastClothesLabel;
200202
CGUIComboBox* m_pFastClothesCombo;
201203
CGUILabel* m_pAudioGeneralLabel;

Client/mods/deathmatch/logic/CRadarMap.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,12 @@ CRadarMap::CRadarMap(CClientManager* pManager)
5252
m_fZoom = 1;
5353
m_iHorizontalMovement = 0;
5454
m_iVerticalMovement = 0;
55-
SetupMapVariables();
5655

5756
// Create the local player blip image
5857
m_pLocalPlayerBlip = g_pCore->GetGraphics()->GetRenderItemManager()->CreateTexture(CalcMTASAPath("MTA\\cgui\\images\\radarset\\02.png"));
5958

6059
// Create the radar map image
61-
int radarImagePreset = 0; // TEMP
62-
auto [radarImgFileName, radarImgWidth, radarImgHeight] = GetRadarImagePreset(radarImagePreset);
63-
m_pRadarImage = g_pCore->GetGraphics()->GetRenderItemManager()->CreateTexture(CalcMTASAPath("MTA\\cgui\\images\\" + radarImgFileName), NULL, false,
64-
radarImgWidth, radarImgHeight, RFORMAT_DXT1);
60+
SetMapImage(g_pCore->GetCVars()->GetValue<int>("radar_map_image", 0));
6561

6662
// Create the marker textures
6763
CreateMarkerTextures();
@@ -118,6 +114,20 @@ CRadarMap::~CRadarMap()
118114
// Don't need to delete the help texts as those are destroyed by the display manager
119115
}
120116

117+
// If invalid presetIndex is passed, it will use the first preset
118+
void CRadarMap::SetMapImage(const int presetIndex)
119+
{
120+
if (m_pRadarImage)
121+
delete m_pRadarImage;
122+
123+
auto [fileName, width, height] = GetRadarImagePreset(presetIndex);
124+
m_pRadarImage = g_pCore->GetGraphics()->GetRenderItemManager()->CreateTexture(CalcMTASAPath("MTA\\cgui\\images\\" + fileName), NULL, false, width, height,
125+
RFORMAT_DXT1);
126+
g_pCore->GetConsole()->Printf("Radar map image preset id %d loaded (%d x %d)", presetIndex, width, height);
127+
128+
SetupMapVariables();
129+
}
130+
121131
void CRadarMap::DoPulse()
122132
{
123133
// If our radar image exists

Client/mods/deathmatch/logic/CRadarMap.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ class CRadarMap
6262
void ZoomIn();
6363
void ZoomOut();
6464

65+
void SetMapImage(const int presetIndex);
66+
6567
SString GetBoundKeyName(const SString& strCommand);
6668

67-
std::tuple<std::string, int, int> GetRadarImagePreset(int index) const
69+
std::tuple<std::string, int, int> GetRadarImagePreset(int index) const noexcept
6870
{
6971
if (index < 0 || index >= m_radarImagePresets.size())
7072
index = 0;

0 commit comments

Comments
 (0)