Skip to content

Commit 0a785b4

Browse files
authored
Merge branch 'master' into add-vehicle-sirens
2 parents 9d1bc82 + 63d3ab7 commit 0a785b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1365
-662
lines changed

Client/core/CClientVariables.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ void CClientVariables::ValidateValues()
256256
ClampValue("mtavolume", 0.0f, 1.0f);
257257
ClampValue("voicevolume", 0.0f, 1.0f);
258258
ClampValue("mapalpha", 0, 255);
259+
ClampValue("mapimage", 0, 1);
259260
}
260261

261262
void CClientVariables::LoadDefaults()
@@ -313,7 +314,8 @@ void CClientVariables::LoadDefaults()
313314
DEFAULT("mastervolume", 1.0f); // master volume
314315
DEFAULT("mtavolume", 1.0f); // custom sound's volume
315316
DEFAULT("voicevolume", 1.0f); // voice chat output volume
316-
DEFAULT("mapalpha", 155); // map alpha
317+
DEFAULT("mapalpha", 155); // player map alpha
318+
DEFAULT("mapimage", 0); // player map image
317319
DEFAULT("browser_speed", 1); // Browser speed
318320
DEFAULT("single_download", 0); // Single connection for downloads
319321
DEFAULT("packet_tag", 0); // Tag network packets

Client/core/CConsole.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
4141
bool IsInputActive();
4242
void ActivateInput();
4343

44-
void HandleTextAccepted(bool bHandled);
4544
void GetCommandInfo(const std::string& strIn, std::string& strCmdOut, std::string& strCmdLineOut);
4645

4746
void ResetHistoryChanges();

Client/core/CNickGen.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
*****************************************************************************/
99

1010
#include "StdInc.h"
11-
#include "time.h"
11+
#include <random>
1212

1313
// These words are of a maximum length of 10 characters, capitalized, and stripped of whitespace
14-
const char* const CNickGen::m_szAdjectives[] = {
14+
const char* const szAdjectives[] = {
1515
"Aback", "Abaft", "Abandoned", "Abashed", "Aberrant", "Abhorrent", "Abiding", "Abject", "Ablaze", "Able", "Abnormal",
1616
"Aboard", "Aboriginal", "Abortive", "Abounding", "Abrasive", "Abrupt", "Absent", "Absorbed", "Absorbing", "Abstracted", "Absurd",
1717
"Abundant", "Abusive", "Acceptable", "Accessible", "Accidental", "Accurate", "Acid", "Acidic", "Acoustic", "Acrid", "Actually",
@@ -109,7 +109,7 @@ const char* const CNickGen::m_szAdjectives[] = {
109109
"Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry",
110110
};
111111

112-
const char* const CNickGen::m_szNouns[] = {
112+
const char* const szNouns[] = {
113113
"Aardvark", "Buffalo", "Alligator", "Ant", "Anteater", "Antelope", "Ape", "Armadillo", "Donkey", "Baboon", "Badger",
114114
"Barracuda", "Bat", "Bear", "Beaver", "Bee", "Bison", "Boar", "Bush", "Butterfly", "Camel", "Calf",
115115
"Cat", "Kitten", "Cattle", "Chamois", "Cheetah", "Chicken", "Chick", "Chimpanzee", "Infant", "Empress", "Troop",
@@ -196,10 +196,18 @@ const char* const CNickGen::m_szNouns[] = {
196196
"Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat",
197197
};
198198

199+
constexpr auto numAdjectives = std::size(szAdjectives);
200+
constexpr auto numNouns = std::size(szNouns);
201+
constexpr auto maxNum = 100;
202+
199203
SString CNickGen::GetRandomNickname()
200204
{
201-
srand((unsigned int)time(NULL));
202-
int iAdjective = rand() % NICKGEN_NUM_ADJECTIVES;
203-
int iNoun = rand() % NICKGEN_NUM_NOUNS;
204-
return SString("%s%s%i", m_szAdjectives[iAdjective], m_szNouns[iNoun], rand() % 100);
205+
std::random_device rd;
206+
std::mt19937 gen(rd());
207+
208+
std::uniform_int_distribution<int> adjectiveDist(0, numAdjectives - 1);
209+
std::uniform_int_distribution<int> nounDist(0, numNouns - 1);
210+
std::uniform_int_distribution<int> numDist(0, maxNum);
211+
212+
return SString("%s%s%i", szAdjectives[adjectiveDist(gen)], szNouns[nounDist(gen)], numDist(gen));
205213
}

Client/core/CNickGen.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99

1010
#pragma once
1111

12-
#define NICKGEN_NUM_ADJECTIVES 1048
13-
#define NICKGEN_NUM_NOUNS 934
14-
1512
class CNickGen
1613
{
1714
public:
18-
static const char* const m_szAdjectives[NICKGEN_NUM_ADJECTIVES];
19-
static const char* const m_szNouns[NICKGEN_NUM_NOUNS];
2015
static SString GetRandomNickname();
2116
};

Client/core/CSettings.cpp

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void CSettings::CreateGUI()
376376
m_pButtonGenerateNickIcon->SetProperty("DistributeCapturedInputs", "True");
377377

378378
m_pSavePasswords = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Save server passwords"), true));
379-
m_pSavePasswords->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 50.0f));
379+
m_pSavePasswords->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 35.0f));
380380
m_pSavePasswords->GetPosition(vecTemp, false);
381381
m_pSavePasswords->AutoSize(NULL, 20.0f);
382382

@@ -411,11 +411,13 @@ void CSettings::CreateGUI()
411411
m_pCheckBoxCustomizedSAFiles->AutoSize(NULL, 20.0f);
412412

413413
m_pMapRenderingLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabMultiplayer, _("Map rendering options")));
414-
m_pMapRenderingLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 29.0f));
414+
m_pMapRenderingLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 30.0f));
415415
m_pMapRenderingLabel->GetPosition(vecTemp, false);
416416
m_pMapRenderingLabel->SetFont("default-bold-small");
417417
m_pMapRenderingLabel->AutoSize();
418418

419+
vecTemp.fX += 5.0f;
420+
419421
m_pMapAlphaLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabMultiplayer, _("Opacity:")));
420422
m_pMapAlphaLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 24.0f));
421423
m_pMapAlphaLabel->GetPosition(vecTemp, false);
@@ -433,6 +435,20 @@ void CSettings::CreateGUI()
433435
m_pMapAlphaValueLabel->GetPosition(vecTemp, false);
434436
m_pMapAlphaValueLabel->AutoSize("100%");
435437

438+
m_pMapAlphaLabel->GetPosition(vecTemp, false);
439+
vecTemp.fY += 24.0f;
440+
441+
m_pPlayerMapImageLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabMultiplayer, _("Image resolution:")));
442+
m_pPlayerMapImageLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 2.0f));
443+
m_pPlayerMapImageLabel->AutoSize();
444+
445+
m_pPlayerMapImageCombo = reinterpret_cast<CGUIComboBox*>(pManager->CreateComboBox(pTabMultiplayer, ""));
446+
m_pPlayerMapImageCombo->SetPosition(CVector2D(vecTemp.fX + fIndentX + 5.0f, vecTemp.fY - 1.0f));
447+
m_pPlayerMapImageCombo->SetSize(CVector2D(170.f, 95.0f));
448+
m_pPlayerMapImageCombo->AddItem(_("1024 x 1024 (Default)")); // index 0
449+
m_pPlayerMapImageCombo->AddItem(_("2048 x 2048")); // index 1
450+
m_pPlayerMapImageCombo->SetReadOnly(true);
451+
436452
/**
437453
* Audio tab
438454
**/
@@ -625,16 +641,13 @@ void CSettings::CreateGUI()
625641
* Video tab
626642
**/
627643
fIndentX = pManager->CGUI_GetMaxTextExtent("default-normal", _("Resolution:"), _("FOV:"), _("Draw Distance:"), _("Brightness:"), _("FX Quality:"),
628-
_("Anisotropic filtering:"), _("Anti-aliasing:"), _("Aspect Ratio:"), _("Opacity:"));
644+
_("Anisotropic filtering:"), _("Anti-aliasing:"), _("Aspect Ratio:"));
629645

630-
m_pVideoGeneralLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabVideo, _("General")));
631-
m_pVideoGeneralLabel->SetPosition(CVector2D(11, 13));
632-
m_pVideoGeneralLabel->GetPosition(vecTemp, false);
633-
m_pVideoGeneralLabel->AutoSize(NULL, 3.0f);
634-
m_pVideoGeneralLabel->SetFont("default-bold-small");
646+
vecTemp.fX = 11.0f;
647+
vecTemp.fY = 13.0f;
635648

636649
m_pVideoResolutionLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabVideo, _("Resolution:")));
637-
m_pVideoResolutionLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 26.0f));
650+
m_pVideoResolutionLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
638651
m_pVideoResolutionLabel->GetPosition(vecTemp, false);
639652
m_pVideoResolutionLabel->AutoSize();
640653

@@ -833,6 +846,10 @@ void CSettings::CreateGUI()
833846
m_pCheckBoxBlur->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 130.0f));
834847
m_pCheckBoxBlur->AutoSize(NULL, 20.0f);
835848

849+
m_pCheckBoxCoronaReflections = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabVideo, _("Corona rain reflections"), true));
850+
m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 150.0f));
851+
m_pCheckBoxCoronaReflections->AutoSize(nullptr, 20.0f);
852+
836853
float fPosY = vecTemp.fY;
837854
m_pCheckBoxMinimize = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabVideo, _("Full Screen Minimize"), true));
838855
m_pCheckBoxMinimize->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 30.0f));
@@ -878,10 +895,6 @@ void CSettings::CreateGUI()
878895
m_pCheckBoxHighDetailPeds->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 110.0f));
879896
m_pCheckBoxHighDetailPeds->AutoSize(NULL, 20.0f);
880897

881-
m_pCheckBoxCoronaReflections = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabVideo, _("Corona rain reflections"), true));
882-
m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 130.0f));
883-
m_pCheckBoxCoronaReflections->AutoSize(NULL, 20.0f);
884-
885898
vecTemp.fY += 10;
886899

887900
m_pTabs->GetSize(vecTemp);
@@ -1010,6 +1023,7 @@ void CSettings::CreateGUI()
10101023
5.0f;
10111024

10121025
vecTemp.fX += 10.0f;
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 += 15.0f;
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");
@@ -1629,12 +1643,17 @@ void CSettings::UpdateVideoTab()
16291643
float fPos = SharedUtil::Unlerp(g_pCore->GetMinStreamingMemory(), uiStreamingMemory, g_pCore->GetMaxStreamingMemory());
16301644
m_pStreamingMemory->SetScrollPosition(fPos);
16311645

1646+
// Player map alpha
16321647
int iVar = 0;
16331648
CVARS_GET("mapalpha", iVar);
16341649
int iAlphaPercent = ceil(((float)Clamp(0, iVar, 255) / 255) * 100);
16351650
m_pMapAlphaValueLabel->SetText(SString("%i%%", iAlphaPercent).c_str());
16361651
float sbPos = (float)iAlphaPercent / 100.0f;
16371652
m_pMapAlpha->SetScrollPosition(sbPos);
1653+
1654+
// Player map image
1655+
CVARS_GET("mapimage", iVar);
1656+
m_pPlayerMapImageCombo->SetSelectedItemByIndex(iVar);
16381657
}
16391658

16401659
//
@@ -1851,7 +1870,9 @@ bool CSettings::OnVideoDefaultClick(CGUIElement* pElement)
18511870

18521871
CVARS_SET("streaming_memory", g_pCore->GetMaxStreamingMemory());
18531872

1873+
// Player map defaults
18541874
CVARS_SET("mapalpha", 155);
1875+
CVARS_SET("mapimage", 0);
18551876

18561877
// Display restart required message if required
18571878
bool bIsAntiAliasingChanged = gameSettings->GetAntiAliasing() != m_pComboAntiAliasing->GetSelectedItemIndex();
@@ -3609,12 +3630,16 @@ void CSettings::SaveData()
36093630
CVARS_SET("update_auto_install", iSelected);
36103631
}
36113632

3612-
// Map alpha
3633+
// Player map alpha
36133634
SString sText = m_pMapAlphaValueLabel->GetText();
3614-
36153635
float fMapAlpha = ((atof(sText.substr(0, sText.length() - 1).c_str())) / 100) * 255;
36163636
CVARS_SET("mapalpha", fMapAlpha);
36173637

3638+
// Player map image
3639+
int selectedComboIndex = m_pPlayerMapImageCombo->GetSelectedItemIndex();
3640+
if (selectedComboIndex != -1)
3641+
CVARS_SET("mapimage", selectedComboIndex);
3642+
36183643
// Language
36193644
CGUIListItem* pItem = m_pInterfaceLanguageSelector->GetSelectedItem();
36203645
if (pItem)

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_pPlayerMapImageLabel;
200+
CGUIComboBox* m_pPlayerMapImageCombo;
199201
CGUILabel* m_pFastClothesLabel;
200202
CGUIComboBox* m_pFastClothesCombo;
201203
CGUILabel* m_pAudioGeneralLabel;

Client/game_sa/CGameSA.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,34 @@ void CGameSA::SetRoadSignsTextEnabled(bool isEnabled)
848848
m_isRoadSignsTextEnabled = isEnabled;
849849
}
850850

851+
void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
852+
{
853+
if (isEnabled == m_isIgnoreFireStateEnabled)
854+
return;
855+
856+
if (isEnabled)
857+
{
858+
MemSet((void*)0x6511B9, 0x90, 10); // CCarEnterExit::IsVehicleStealable
859+
MemSet((void*)0x643A95, 0x90, 14); // CTaskComplexEnterCar::CreateFirstSubTask
860+
MemSet((void*)0x6900B5, 0x90, 14); // CTaskComplexCopInCar::ControlSubTask
861+
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter
862+
863+
MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
864+
}
865+
else
866+
{
867+
// Restore original bytes
868+
MemCpy((void*)0x6511B9, "\x88\x86\x90\x04\x00\x00\x85\xC0\x75\x3E", 10);
869+
MemCpy((void*)0x643A95, "\x8B\x88\x90\x04\x00\x00\x85\xC9\x0F\x85\x99\x01\x00\x00", 14);
870+
MemCpy((void*)0x6900B5, "\x8B\x81\x90\x04\x00\x00\x85\xC0\x0F\x85\x1A\x01\x00\x00", 14);
871+
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);
872+
873+
MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
874+
}
875+
876+
m_isIgnoreFireStateEnabled = isEnabled;
877+
}
878+
851879
bool CGameSA::PerformChecks()
852880
{
853881
std::map<std::string, SCheatSA*>::iterator it;

Client/game_sa/CGameSA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ class CGameSA : public CGame
249249
bool IsTunnelWeatherBlendEnabled() const noexcept override { return m_isTunnelWeatherBlendEnabled; }
250250
void SetTunnelWeatherBlendEnabled(bool isEnabled) override;
251251

252+
bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
253+
void SetIgnoreFireStateEnabled(bool isEnabled) override;
252254

253255
unsigned long GetMinuteDuration();
254256
void SetMinuteDuration(unsigned long ulTime);
@@ -378,6 +380,7 @@ class CGameSA : public CGame
378380
bool m_isRoadSignsTextEnabled{true};
379381
bool m_isBuildingsRemoved{false};
380382
bool m_isExtendedWaterCannonsEnabled{false};
383+
bool m_isIgnoreFireStateEnabled{false};
381384

382385
static unsigned int& ClumpOffset;
383386

Client/mods/deathmatch/CClient.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
6464
g_pCore->GetCommands()->Add("enter_passenger", _("enters a car as passenger"), COMMAND_EnterPassenger, true, true);
6565
g_pCore->GetCommands()->Add("radio_next", _("next radio channel"), COMMAND_RadioNext, true, true);
6666
g_pCore->GetCommands()->Add("radio_previous", _("previous radio channel"), COMMAND_RadioPrevious, true, true);
67-
g_pCore->GetCommands()->Add("radar", _("enables the radar view"), COMMAND_RadarMap, true, true);
68-
g_pCore->GetCommands()->Add("radar_zoom_in", _("zooms the radar in"), COMMAND_RadarZoomIn, true, true);
69-
g_pCore->GetCommands()->Add("radar_zoom_out", _("zooms the radar out"), COMMAND_RadarZoomOut, true, true);
70-
g_pCore->GetCommands()->Add("radar_move_north", _("moves the radar north"), COMMAND_RadarMoveNorth, true, true);
71-
g_pCore->GetCommands()->Add("radar_move_south", _("moves the radar south"), COMMAND_RadarMoveSouth, true, true);
72-
g_pCore->GetCommands()->Add("radar_move_east", _("moves the radar east"), COMMAND_RadarMoveEast, true, true);
73-
g_pCore->GetCommands()->Add("radar_move_west", _("moves the radar west"), COMMAND_RadarMoveWest, true, true);
74-
g_pCore->GetCommands()->Add("radar_attach", _("attaches the radar"), COMMAND_RadarAttach, true, true);
75-
g_pCore->GetCommands()->Add("radar_opacity_down", _("reduces radar opacity"), COMMAND_RadarOpacityDown, true, true);
76-
g_pCore->GetCommands()->Add("radar_opacity_up", _("increases radar opacity"), COMMAND_RadarOpacityUp, true, true);
77-
g_pCore->GetCommands()->Add("radar_help", _("toggles radar help text"), COMMAND_RadarHelp, true, true);
67+
g_pCore->GetCommands()->Add("radar", _("enables the player-map view"), COMMAND_PlayerMap, true, true);
68+
g_pCore->GetCommands()->Add("radar_zoom_in", _("zooms the player-map in"), COMMAND_PlayerMapZoomIn, true, true);
69+
g_pCore->GetCommands()->Add("radar_zoom_out", _("zooms the player-map out"), COMMAND_PlayerMapZoomOut, true, true);
70+
g_pCore->GetCommands()->Add("radar_move_north", _("moves the player-map north"), COMMAND_PlayerMapMoveNorth, true, true);
71+
g_pCore->GetCommands()->Add("radar_move_south", _("moves the player-map south"), COMMAND_PlayerMapMoveSouth, true, true);
72+
g_pCore->GetCommands()->Add("radar_move_east", _("moves the player-map east"), COMMAND_PlayerMapMoveEast, true, true);
73+
g_pCore->GetCommands()->Add("radar_move_west", _("moves the player-map west"), COMMAND_PlayerMapMoveWest, true, true);
74+
g_pCore->GetCommands()->Add("radar_attach", _("attaches the player-map"), COMMAND_PlayerMapAttach, true, true);
75+
g_pCore->GetCommands()->Add("radar_opacity_down", _("reduces player-map opacity"), COMMAND_PlayerMapOpacityDown, true, true);
76+
g_pCore->GetCommands()->Add("radar_opacity_up", _("increases player-map opacity"), COMMAND_PlayerMapOpacityUp, true, true);
77+
g_pCore->GetCommands()->Add("radar_help", _("toggles player-map help text"), COMMAND_PlayerMapHelp, true, true);
7878
g_pCore->GetCommands()->Add("msg_target", _("sends a message to the targetted player"), COMMAND_MessageTarget, true);
7979
g_pCore->GetCommands()->Add("vehicle_next_weapon", _("changes to the next weapon whilst in a vehicle"), COMMAND_VehicleNextWeapon, true);
8080
g_pCore->GetCommands()->Add("vehicle_previous_weapon", _("changes to the previous weapon whilst in a vehicle"), COMMAND_VehiclePreviousWeapon, true);

0 commit comments

Comments
 (0)