Skip to content

Commit

Permalink
Merge branch 'radar-jpg-update' of github.com:Fernando-A-Rocha/mtasa-…
Browse files Browse the repository at this point in the history
…blue into radar-jpg-update
  • Loading branch information
Fernando-A-Rocha committed Oct 26, 2024
2 parents c48fa4e + 905ac0c commit 3c280b6
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 15 deletions.
14 changes: 14 additions & 0 deletions Client/game_sa/CSettingsSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,20 @@ void CSettingsSA::SetDynamicPedShadowsEnabled(bool bEnable)
m_bDynamicPedShadowsEnabled = bEnable;
}

bool CSettingsSA::IsDynamicPedShadowsEnabledByVideoSetting() const noexcept
{
bool pedDynamicShadows;
g_pCore->GetCVars()->Get("dynamic_ped_shadows", pedDynamicShadows);
return pedDynamicShadows;
}

bool CSettingsSA::ResetDynamicPedShadows() noexcept
{
pGame->GetSettings()->SetDynamicPedShadowsEnabled(pGame->GetSettings()->IsDynamicPedShadowsEnabledByVideoSetting());
return true;
}


//
// Volumetric shadow hooks
//
Expand Down
2 changes: 2 additions & 0 deletions Client/game_sa/CSettingsSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class CSettingsSA : public CGameSettings

bool IsDynamicPedShadowsEnabled();
void SetDynamicPedShadowsEnabled(bool bEnable);
bool IsDynamicPedShadowsEnabledByVideoSetting() const noexcept;
bool ResetDynamicPedShadows() noexcept;

float GetAspectRatioValue();
eAspectRatio GetAspectRatio();
Expand Down
10 changes: 6 additions & 4 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5456,10 +5456,6 @@ void CClientGame::ResetMapInfo()
// Players
m_pPlayerManager->ResetAll();

// Reset Frozen Time
g_pGame->GetClock()->ResetTimeFrozen();
g_pGame->GetSettings()->ResetVolumetricShadows();

// Disable the change of any player stats
g_pMultiplayer->SetLocalStatsStatic(true);

Expand Down Expand Up @@ -6887,6 +6883,12 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo

// Reset volumetric shadows
g_pGame->GetSettings()->ResetVolumetricShadows();

// Reset Frozen Time
g_pGame->GetClock()->ResetTimeFrozen();

// Reset DynamicPedShadows
g_pGame->GetSettings()->ResetDynamicPedShadows();
}

void CClientGame::OnWindowFocusChange(bool state)
Expand Down
20 changes: 20 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void CLuaVehicleDefs::LoadFunctions()
{"getVehicleModelWheelSize", ArgumentParser<GetVehicleModelWheelSize>},
{"getVehicleWheelFrictionState", ArgumentParser<GetVehicleWheelFrictionState>},
{"getVehicleEntryPoints", ArgumentParser<GetVehicleEntryPoints>},
{"isVehicleSmokeTrailEnabled", ArgumentParser<IsSmokeTrailEnabled>},

// Vehicle set funcs
{"createVehicle", CreateVehicle},
Expand Down Expand Up @@ -156,6 +157,7 @@ void CLuaVehicleDefs::LoadFunctions()
{"setVehicleWheelScale", ArgumentParser<SetVehicleWheelScale>},
{"setVehicleModelWheelSize", ArgumentParser<SetVehicleModelWheelSize>},
{"spawnVehicleFlyingComponent", ArgumentParser<SpawnVehicleFlyingComponent>},
{"setVehicleSmokeTrailEnabled", ArgumentParser<SetSmokeTrailEnabled>},
};

// Add functions
Expand Down Expand Up @@ -244,6 +246,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "getModelWheelSize", "getVehicleModelWheelSize");
lua_classfunction(luaVM, "getWheelFrictionState", "getVehicleWheelFrictionState");
lua_classfunction(luaVM, "getEntryPoints", ArgumentParser<OOP_GetVehicleEntryPoints>);
lua_classfunction(luaVM, "isSmokeTrailEnabled", "isVehicleSmokeTrailEnabled");

lua_classfunction(luaVM, "setComponentVisible", "setVehicleComponentVisible");
lua_classfunction(luaVM, "setSirensOn", "setVehicleSirensOn");
Expand Down Expand Up @@ -292,6 +295,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "setVariant", "setVehicleVariant");
lua_classfunction(luaVM, "setWheelScale", "setVehicleWheelScale");
lua_classfunction(luaVM, "setModelWheelSize", "setVehicleModelWheelSize");
lua_classfunction(luaVM, "setSmokeTrailEnabled", "setVehicleSmokeTrailEnabled");

lua_classfunction(luaVM, "resetComponentPosition", "resetVehicleComponentPosition");
lua_classfunction(luaVM, "resetComponentRotation", "resetVehicleComponentRotation");
Expand Down Expand Up @@ -4340,3 +4344,19 @@ bool CLuaVehicleDefs::SpawnVehicleFlyingComponent(CClientVehicle* const vehicle,

return vehicle->SpawnFlyingComponent(partNodeIndex, collisionType, removalTime.value_or(-1));
}

bool CLuaVehicleDefs::SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state)
{
std::uint16_t model = vehicle->GetModel();
if (model != 512 && model != 513)
throw LuaFunctionError("Invaild model ID");

vehicle->SetSmokeTrailEnabled(state);
return true;
}

bool CLuaVehicleDefs::IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept
{
return vehicle->IsSmokeTrailEnabled();
}

3 changes: 3 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,7 @@ class CLuaVehicleDefs : public CLuaDefs
LUA_DECLARE(GetVehicleComponents);

static bool SpawnVehicleFlyingComponent(CClientVehicle* const vehicle, std::uint8_t nodeIndex, std::optional<std::uint8_t> componentCollisionType, std::optional<std::uint32_t> removalTime);

static bool SetSmokeTrailEnabled(CClientVehicle* vehicle, bool state);
static bool IsSmokeTrailEnabled(CClientVehicle* vehicle) noexcept;
};
21 changes: 20 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void CLuaWorldDefs::LoadFunctions()
{"restoreWorldModel", RestoreWorldBuilding},
{"setTimeFrozen", ArgumentParser<SetTimeFrozen>},
{"setVolumetricShadowsEnabled", ArgumentParser<SetVolumetricShadowsEnabled>},
{"setDynamicPedShadowsEnabled", ArgumentParser<SetDynamicPedShadowsEnabled>},

// World create funcs
{"createSWATRope", CreateSWATRope},
Expand All @@ -131,6 +132,7 @@ void CLuaWorldDefs::LoadFunctions()
{"resetTimeFrozen", ArgumentParser<ResetTimeFrozen>},
{"resetVolumetricShadows", ArgumentParser<ResetVolumetricShadows>},
{"resetWorldProperties", ArgumentParser<ResetWorldProperties>},
{"resetDynamicPedShadows", ArgumentParser<ResetDynamicPedShadows>},

// World check funcs
{"areTrafficLightsLocked", AreTrafficLightsLocked},
Expand All @@ -139,7 +141,8 @@ void CLuaWorldDefs::LoadFunctions()
{"isWorldSpecialPropertyEnabled", ArgumentParserWarn<false, IsWorldSpecialPropertyEnabled>},
{"isGarageOpen", IsGarageOpen},
{"isTimeFrozen", ArgumentParser<IsTimeFrozen>},
{"isVolumetricShadowsEnabled", ArgumentParser<IsVolumetricShadowsEnabled>}};
{"isVolumetricShadowsEnabled", ArgumentParser<IsVolumetricShadowsEnabled>},
{"isDynamicPedShadowsEnabled", ArgumentParser<IsDynamicPedShadowsEnabled>}};

// Add functions
for (const auto& [name, func] : functions)
Expand Down Expand Up @@ -2278,3 +2281,19 @@ void CLuaWorldDefs::ResetWorldProperties(std::optional<bool> resetSpecialWorldPr
{
g_pClientGame->ResetWorldProperties(ResetWorldPropsInfo{resetSpecialWorldProperties.value_or(true), resetWorldProperties.value_or(true), resetWeatherProperties.value_or(true), resetLODs.value_or(true), resetSounds.value_or(true)});
}

bool CLuaWorldDefs::SetDynamicPedShadowsEnabled(bool enable)
{
g_pGame->GetSettings()->SetDynamicPedShadowsEnabled(enable);
return true;
}

bool CLuaWorldDefs::IsDynamicPedShadowsEnabled() noexcept
{
return g_pGame->GetSettings()->IsDynamicPedShadowsEnabled();
}

bool CLuaWorldDefs::ResetDynamicPedShadows() noexcept
{
return g_pGame->GetSettings()->ResetDynamicPedShadows();
}
5 changes: 4 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ class CLuaWorldDefs : public CLuaDefs
static bool ResetVolumetricShadows() noexcept;

static void ResetWorldProperties(std::optional<bool> resetSpecialWorldProperties, std::optional<bool> resetWorldProperties, std::optional<bool> resetWeatherProperties, std::optional<bool> resetLODs, std::optional<bool> resetSounds) noexcept;


static bool SetDynamicPedShadowsEnabled(bool enable);
static bool IsDynamicPedShadowsEnabled() noexcept;
static bool ResetDynamicPedShadows() noexcept;
};

2 changes: 2 additions & 0 deletions Client/sdk/game/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class CGameSettings

virtual bool IsDynamicPedShadowsEnabled() = 0;
virtual void SetDynamicPedShadowsEnabled(bool bEnable) = 0;
virtual bool IsDynamicPedShadowsEnabledByVideoSetting() const noexcept = 0;
virtual bool ResetDynamicPedShadows() noexcept = 0;

virtual float GetAspectRatioValue() = 0;
virtual eAspectRatio GetAspectRatio() = 0;
Expand Down
3 changes: 3 additions & 0 deletions Server/mods/deathmatch/logic/CMainConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ bool CMainConfig::Load()
return false;
}

// Strip spaces from beginning and end of server name
m_strServerName = SString(m_strServerName).TrimStart(" ").TrimEnd(" ");

// Grab the forced server ip(s)
GetString(m_pRootNode, "serverip", m_strServerIP);
m_strServerIP = SString(m_strServerIP).Replace(" ", "");
Expand Down
18 changes: 9 additions & 9 deletions Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: MTA San Andreas 1.x\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-21 22:24+0000\n"
"POT-Creation-Date: 2024-10-23 16:33+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -433,23 +433,23 @@ msgstr ""
msgid "MTA Client verification failed!"
msgstr ""

#: Client/mods/deathmatch/logic/CClientGame.cpp:5623
#: Client/mods/deathmatch/logic/CClientGame.cpp:5619
msgid "In a ditch"
msgstr ""

#: Client/mods/deathmatch/logic/CClientGame.cpp:5623
#: Client/mods/deathmatch/logic/CClientGame.cpp:5619
msgid "En-route to hospital"
msgstr ""

#: Client/mods/deathmatch/logic/CClientGame.cpp:5623
#: Client/mods/deathmatch/logic/CClientGame.cpp:5619
msgid "Meeting their maker"
msgstr ""

#: Client/mods/deathmatch/logic/CClientGame.cpp:5624
#: Client/mods/deathmatch/logic/CClientGame.cpp:5620
msgid "Regretting their decisions"
msgstr ""

#: Client/mods/deathmatch/logic/CClientGame.cpp:5624
#: Client/mods/deathmatch/logic/CClientGame.cpp:5620
msgid "Wasted"
msgstr ""

Expand Down Expand Up @@ -744,16 +744,16 @@ msgstr ""
msgid "Download error: %s"
msgstr ""

#: Client/game_sa/CSettingsSA.cpp:767
#: Client/game_sa/CSettingsSA.cpp:781
msgid "Can't find valid screen resolution."
msgstr ""

#. Confirm that res should be used
#: Client/game_sa/CSettingsSA.cpp:843
#: Client/game_sa/CSettingsSA.cpp:857
msgid "Are you sure you want to use this screen resolution?"
msgstr ""

#: Client/game_sa/CSettingsSA.cpp:845 Client/loader/Dialogs.cpp:194
#: Client/game_sa/CSettingsSA.cpp:859 Client/loader/Dialogs.cpp:194
msgid "MTA: San Andreas"
msgstr ""

Expand Down

0 comments on commit 3c280b6

Please sign in to comment.