Skip to content

Commit

Permalink
Merge branch 'master' into task
Browse files Browse the repository at this point in the history
  • Loading branch information
Proxy-99 authored Nov 30, 2024
2 parents 65bb7bf + 63d3ab7 commit 9fa1927
Showing 64 changed files with 1,391 additions and 663 deletions.
4 changes: 3 additions & 1 deletion Client/core/CClientVariables.cpp
Original file line number Diff line number Diff line change
@@ -256,6 +256,7 @@ void CClientVariables::ValidateValues()
ClampValue("mtavolume", 0.0f, 1.0f);
ClampValue("voicevolume", 0.0f, 1.0f);
ClampValue("mapalpha", 0, 255);
ClampValue("mapimage", 0, 1);
}

void CClientVariables::LoadDefaults()
@@ -313,7 +314,8 @@ void CClientVariables::LoadDefaults()
DEFAULT("mastervolume", 1.0f); // master volume
DEFAULT("mtavolume", 1.0f); // custom sound's volume
DEFAULT("voicevolume", 1.0f); // voice chat output volume
DEFAULT("mapalpha", 155); // map alpha
DEFAULT("mapalpha", 155); // player map alpha
DEFAULT("mapimage", 0); // player map image
DEFAULT("browser_speed", 1); // Browser speed
DEFAULT("single_download", 0); // Single connection for downloads
DEFAULT("packet_tag", 0); // Tag network packets
1 change: 0 additions & 1 deletion Client/core/CConsole.h
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
bool IsInputActive();
void ActivateInput();

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

void ResetHistoryChanges();
22 changes: 15 additions & 7 deletions Client/core/CNickGen.cpp
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@
*****************************************************************************/

#include "StdInc.h"
#include "time.h"
#include <random>

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

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

constexpr auto numAdjectives = std::size(szAdjectives);
constexpr auto numNouns = std::size(szNouns);
constexpr auto maxNum = 100;

SString CNickGen::GetRandomNickname()
{
srand((unsigned int)time(NULL));
int iAdjective = rand() % NICKGEN_NUM_ADJECTIVES;
int iNoun = rand() % NICKGEN_NUM_NOUNS;
return SString("%s%s%i", m_szAdjectives[iAdjective], m_szNouns[iNoun], rand() % 100);
std::random_device rd;
std::mt19937 gen(rd());

std::uniform_int_distribution<int> adjectiveDist(0, numAdjectives - 1);
std::uniform_int_distribution<int> nounDist(0, numNouns - 1);
std::uniform_int_distribution<int> numDist(0, maxNum);

return SString("%s%s%i", szAdjectives[adjectiveDist(gen)], szNouns[nounDist(gen)], numDist(gen));
}
5 changes: 0 additions & 5 deletions Client/core/CNickGen.h
Original file line number Diff line number Diff line change
@@ -9,13 +9,8 @@

#pragma once

#define NICKGEN_NUM_ADJECTIVES 1048
#define NICKGEN_NUM_NOUNS 934

class CNickGen
{
public:
static const char* const m_szAdjectives[NICKGEN_NUM_ADJECTIVES];
static const char* const m_szNouns[NICKGEN_NUM_NOUNS];
static SString GetRandomNickname();
};
57 changes: 41 additions & 16 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
@@ -376,7 +376,7 @@ void CSettings::CreateGUI()
m_pButtonGenerateNickIcon->SetProperty("DistributeCapturedInputs", "True");

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

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

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

vecTemp.fX += 5.0f;

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

m_pMapAlphaLabel->GetPosition(vecTemp, false);
vecTemp.fY += 24.0f;

m_pPlayerMapImageLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabMultiplayer, _("Image resolution:")));
m_pPlayerMapImageLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 2.0f));
m_pPlayerMapImageLabel->AutoSize();

m_pPlayerMapImageCombo = reinterpret_cast<CGUIComboBox*>(pManager->CreateComboBox(pTabMultiplayer, ""));
m_pPlayerMapImageCombo->SetPosition(CVector2D(vecTemp.fX + fIndentX + 5.0f, vecTemp.fY - 1.0f));
m_pPlayerMapImageCombo->SetSize(CVector2D(170.f, 95.0f));
m_pPlayerMapImageCombo->AddItem(_("1024 x 1024 (Default)")); // index 0
m_pPlayerMapImageCombo->AddItem(_("2048 x 2048")); // index 1
m_pPlayerMapImageCombo->SetReadOnly(true);

/**
* Audio tab
**/
@@ -625,16 +641,13 @@ void CSettings::CreateGUI()
* Video tab
**/
fIndentX = pManager->CGUI_GetMaxTextExtent("default-normal", _("Resolution:"), _("FOV:"), _("Draw Distance:"), _("Brightness:"), _("FX Quality:"),
_("Anisotropic filtering:"), _("Anti-aliasing:"), _("Aspect Ratio:"), _("Opacity:"));
_("Anisotropic filtering:"), _("Anti-aliasing:"), _("Aspect Ratio:"));

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

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

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

m_pCheckBoxCoronaReflections = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabVideo, _("Corona rain reflections"), true));
m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 150.0f));
m_pCheckBoxCoronaReflections->AutoSize(nullptr, 20.0f);

float fPosY = vecTemp.fY;
m_pCheckBoxMinimize = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabVideo, _("Full Screen Minimize"), true));
m_pCheckBoxMinimize->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 30.0f));
@@ -878,10 +895,6 @@ void CSettings::CreateGUI()
m_pCheckBoxHighDetailPeds->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 110.0f));
m_pCheckBoxHighDetailPeds->AutoSize(NULL, 20.0f);

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

vecTemp.fY += 10;

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

vecTemp.fX += 10.0f;

// Fast clothes loading
m_pFastClothesLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Fast CJ clothes loading:")));
m_pFastClothesLabel->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
@@ -1238,7 +1252,7 @@ void CSettings::CreateGUI()
vecTemp.fX -= fComboWidth + 15;

// Description label
vecTemp.fY = 354 + 10;
vecTemp.fY += 15.0f;
m_pAdvancedSettingDescriptionLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, ""));
m_pAdvancedSettingDescriptionLabel->SetPosition(CVector2D(vecTemp.fX + 10.f, vecTemp.fY));
m_pAdvancedSettingDescriptionLabel->SetFont("default-bold-small");
@@ -1629,12 +1643,17 @@ void CSettings::UpdateVideoTab()
float fPos = SharedUtil::Unlerp(g_pCore->GetMinStreamingMemory(), uiStreamingMemory, g_pCore->GetMaxStreamingMemory());
m_pStreamingMemory->SetScrollPosition(fPos);

// Player map alpha
int iVar = 0;
CVARS_GET("mapalpha", iVar);
int iAlphaPercent = ceil(((float)Clamp(0, iVar, 255) / 255) * 100);
m_pMapAlphaValueLabel->SetText(SString("%i%%", iAlphaPercent).c_str());
float sbPos = (float)iAlphaPercent / 100.0f;
m_pMapAlpha->SetScrollPosition(sbPos);

// Player map image
CVARS_GET("mapimage", iVar);
m_pPlayerMapImageCombo->SetSelectedItemByIndex(iVar);
}

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

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

// Player map defaults
CVARS_SET("mapalpha", 155);
CVARS_SET("mapimage", 0);

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

// Map alpha
// Player map alpha
SString sText = m_pMapAlphaValueLabel->GetText();

float fMapAlpha = ((atof(sText.substr(0, sText.length() - 1).c_str())) / 100) * 255;
CVARS_SET("mapalpha", fMapAlpha);

// Player map image
int selectedComboIndex = m_pPlayerMapImageCombo->GetSelectedItemIndex();
if (selectedComboIndex != -1)
CVARS_SET("mapimage", selectedComboIndex);

// Language
CGUIListItem* pItem = m_pInterfaceLanguageSelector->GetSelectedItem();
if (pItem)
2 changes: 2 additions & 0 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
@@ -196,6 +196,8 @@ class CSettings
CGUIComboBox* m_pFullscreenStyleCombo;
CGUILabel* m_pPriorityLabel;
CGUIComboBox* m_pPriorityCombo;
CGUILabel* m_pPlayerMapImageLabel;
CGUIComboBox* m_pPlayerMapImageCombo;
CGUILabel* m_pFastClothesLabel;
CGUIComboBox* m_pFastClothesCombo;
CGUILabel* m_pAudioGeneralLabel;
28 changes: 28 additions & 0 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
@@ -848,6 +848,34 @@ void CGameSA::SetRoadSignsTextEnabled(bool isEnabled)
m_isRoadSignsTextEnabled = isEnabled;
}

void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
{
if (isEnabled == m_isIgnoreFireStateEnabled)
return;

if (isEnabled)
{
MemSet((void*)0x6511B9, 0x90, 10); // CCarEnterExit::IsVehicleStealable
MemSet((void*)0x643A95, 0x90, 14); // CTaskComplexEnterCar::CreateFirstSubTask
MemSet((void*)0x6900B5, 0x90, 14); // CTaskComplexCopInCar::ControlSubTask
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter

MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
}
else
{
// Restore original bytes
MemCpy((void*)0x6511B9, "\x88\x86\x90\x04\x00\x00\x85\xC0\x75\x3E", 10);
MemCpy((void*)0x643A95, "\x8B\x88\x90\x04\x00\x00\x85\xC9\x0F\x85\x99\x01\x00\x00", 14);
MemCpy((void*)0x6900B5, "\x8B\x81\x90\x04\x00\x00\x85\xC0\x0F\x85\x1A\x01\x00\x00", 14);
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);

MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
}

m_isIgnoreFireStateEnabled = isEnabled;
}

bool CGameSA::PerformChecks()
{
std::map<std::string, SCheatSA*>::iterator it;
3 changes: 3 additions & 0 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
@@ -249,6 +249,8 @@ class CGameSA : public CGame
bool IsTunnelWeatherBlendEnabled() const noexcept override { return m_isTunnelWeatherBlendEnabled; }
void SetTunnelWeatherBlendEnabled(bool isEnabled) override;

bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
void SetIgnoreFireStateEnabled(bool isEnabled) override;

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

static unsigned int& ClumpOffset;

22 changes: 11 additions & 11 deletions Client/mods/deathmatch/CClient.cpp
Original file line number Diff line number Diff line change
@@ -64,17 +64,17 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
g_pCore->GetCommands()->Add("enter_passenger", _("enters a car as passenger"), COMMAND_EnterPassenger, true, true);
g_pCore->GetCommands()->Add("radio_next", _("next radio channel"), COMMAND_RadioNext, true, true);
g_pCore->GetCommands()->Add("radio_previous", _("previous radio channel"), COMMAND_RadioPrevious, true, true);
g_pCore->GetCommands()->Add("radar", _("enables the radar view"), COMMAND_RadarMap, true, true);
g_pCore->GetCommands()->Add("radar_zoom_in", _("zooms the radar in"), COMMAND_RadarZoomIn, true, true);
g_pCore->GetCommands()->Add("radar_zoom_out", _("zooms the radar out"), COMMAND_RadarZoomOut, true, true);
g_pCore->GetCommands()->Add("radar_move_north", _("moves the radar north"), COMMAND_RadarMoveNorth, true, true);
g_pCore->GetCommands()->Add("radar_move_south", _("moves the radar south"), COMMAND_RadarMoveSouth, true, true);
g_pCore->GetCommands()->Add("radar_move_east", _("moves the radar east"), COMMAND_RadarMoveEast, true, true);
g_pCore->GetCommands()->Add("radar_move_west", _("moves the radar west"), COMMAND_RadarMoveWest, true, true);
g_pCore->GetCommands()->Add("radar_attach", _("attaches the radar"), COMMAND_RadarAttach, true, true);
g_pCore->GetCommands()->Add("radar_opacity_down", _("reduces radar opacity"), COMMAND_RadarOpacityDown, true, true);
g_pCore->GetCommands()->Add("radar_opacity_up", _("increases radar opacity"), COMMAND_RadarOpacityUp, true, true);
g_pCore->GetCommands()->Add("radar_help", _("toggles radar help text"), COMMAND_RadarHelp, true, true);
g_pCore->GetCommands()->Add("radar", _("enables the player-map view"), COMMAND_PlayerMap, true, true);
g_pCore->GetCommands()->Add("radar_zoom_in", _("zooms the player-map in"), COMMAND_PlayerMapZoomIn, true, true);
g_pCore->GetCommands()->Add("radar_zoom_out", _("zooms the player-map out"), COMMAND_PlayerMapZoomOut, true, true);
g_pCore->GetCommands()->Add("radar_move_north", _("moves the player-map north"), COMMAND_PlayerMapMoveNorth, true, true);
g_pCore->GetCommands()->Add("radar_move_south", _("moves the player-map south"), COMMAND_PlayerMapMoveSouth, true, true);
g_pCore->GetCommands()->Add("radar_move_east", _("moves the player-map east"), COMMAND_PlayerMapMoveEast, true, true);
g_pCore->GetCommands()->Add("radar_move_west", _("moves the player-map west"), COMMAND_PlayerMapMoveWest, true, true);
g_pCore->GetCommands()->Add("radar_attach", _("attaches the player-map"), COMMAND_PlayerMapAttach, true, true);
g_pCore->GetCommands()->Add("radar_opacity_down", _("reduces player-map opacity"), COMMAND_PlayerMapOpacityDown, true, true);
g_pCore->GetCommands()->Add("radar_opacity_up", _("increases player-map opacity"), COMMAND_PlayerMapOpacityUp, true, true);
g_pCore->GetCommands()->Add("radar_help", _("toggles player-map help text"), COMMAND_PlayerMapHelp, true, true);
g_pCore->GetCommands()->Add("msg_target", _("sends a message to the targetted player"), COMMAND_MessageTarget, true);
g_pCore->GetCommands()->Add("vehicle_next_weapon", _("changes to the next weapon whilst in a vehicle"), COMMAND_VehicleNextWeapon, true);
g_pCore->GetCommands()->Add("vehicle_previous_weapon", _("changes to the previous weapon whilst in a vehicle"), COMMAND_VehiclePreviousWeapon, true);
Loading

0 comments on commit 9fa1927

Please sign in to comment.