Skip to content

Commit

Permalink
Merge branch 'master' into feature/2dfx
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Sep 26, 2024
2 parents 3f687cc + d01df35 commit c905a3d
Show file tree
Hide file tree
Showing 15 changed files with 947 additions and 920 deletions.
1 change: 0 additions & 1 deletion Client/cefweb/CWebCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ bool CWebCore::Initialise()
#else
CefString(&settings.browser_subprocess_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\CEFLauncher_d.exe")));
#endif
CefString(&settings.resources_dir_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF")));
CefString(&settings.cache_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\cache")));
CefString(&settings.locales_dir_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\locales")));
CefString(&settings.log_file).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\cefdebug.txt")));
Expand Down
7 changes: 7 additions & 0 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,13 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0)
m_uiFrameRateLimit = uiClientScriptRate;

// Removes Limiter from Frame Graph if limit is zero and skips frame limit
if (m_uiFrameRateLimit == 0)
{
m_bQueuedFrameRateValid = false;
GetGraphStats()->RemoveTimingPoint("Limiter");
}

// Print new limits to the console
if (bLogToConsole)
{
Expand Down
16 changes: 16 additions & 0 deletions Client/core/CGraphStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CGraphStats : public CGraphStatsInterface
virtual void SetEnabled(bool bEnabled);
virtual bool IsEnabled();
virtual void AddTimingPoint(const char* szName);
virtual void RemoveTimingPoint(const char* szName);

protected:
bool m_bEnabled;
Expand Down Expand Up @@ -189,6 +190,21 @@ void CGraphStats::AddTimingPoint(const char* szName)
pLine->dataHistory[pLine->iDataPos] = AvgData;
}

///////////////////////////////////////////////////////////////
//
// CGraphStats::RemoveTimingPoint
//
//
//
///////////////////////////////////////////////////////////////
void CGraphStats::RemoveTimingPoint(const char* szName)
{
if (!IsEnabled() || szName[0] == 0)
return;

MapRemove(m_LineList, szName);
}

///////////////////////////////////////////////////////////////
//
// CGraphStats::Draw
Expand Down
1 change: 1 addition & 0 deletions Client/core/CGraphStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CGraphStatsInterface
virtual void SetEnabled(bool bEnabled) = 0;
virtual bool IsEnabled() = 0;
virtual void AddTimingPoint(const char* szName) = 0;
virtual void RemoveTimingPoint(const char* szName) = 0;
};

CGraphStatsInterface* GetGraphStats();
2 changes: 1 addition & 1 deletion Client/core/CVersionUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ void CVersionUpdater::_DialogUpdateQueryError()
// Display message
GetQuestionBox().Reset();
GetQuestionBox().SetTitle(_("UPDATE CHECK"));
GetQuestionBox().SetMessage(_("Update not currently avalable.\n\nPlease check www.mtasa.com"));
GetQuestionBox().SetMessage(_("An update is currently not available.\n\nPlease check www.mtasa.com"));
GetQuestionBox().SetButton(0, _("OK"));
GetQuestionBox().Show();
_PollAnyButton();
Expand Down
141 changes: 67 additions & 74 deletions Client/game_sa/CEntitySA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,101 +606,94 @@ bool CEntitySA::GetBoneRotation(eBone boneId, float& yaw, float& pitch, float& r
bool CEntitySA::GetBoneRotationQuat(eBone boneId, float& x, float& y, float& z, float& w)
{
RpClump* clump = GetRpClump();
if (clump)
{
// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
CAnimBlendClumpDataSAInterface* clumpDataInterface = *pGame->GetClumpData(clump);
AnimBlendFrameData* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (frameData)
{
RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
x = boneOrientation->imag.x;
y = boneOrientation->imag.y;
z = boneOrientation->imag.z;
w = boneOrientation->real;
return true;
}
}
return false;
if (!clump)
return false;

// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
auto* clumpDataInterface = *pGame->GetClumpData(clump);
auto* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (!frameData)
return false;

RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
x = boneOrientation->imag.x;
y = boneOrientation->imag.y;
z = boneOrientation->imag.z;
w = boneOrientation->real;
return true;
}

bool CEntitySA::SetBoneRotation(eBone boneId, float yaw, float pitch, float roll)
{
RpClump* clump = GetRpClump();
if (clump)
{
// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
CAnimBlendClumpDataSAInterface* clumpDataInterface = *pGame->GetClumpData(clump);
AnimBlendFrameData* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (frameData)
{
RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
RwV3d angles = {yaw, roll, pitch};
BoneNode_cSAInterface::EulerToQuat(&angles, boneOrientation);
CEntitySAInterface* theInterface = GetInterface();
if (theInterface)
{
theInterface->bDontUpdateHierarchy = false;
}
return true;
}
}
return false;
if (!clump)
return false;

// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
auto* clumpDataInterface = *pGame->GetClumpData(clump);
auto* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (!frameData)
return false;

RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
RwV3d angles = { yaw, roll, pitch };
BoneNode_cSAInterface::EulerToQuat(&angles, boneOrientation);
CEntitySAInterface* theInterface = GetInterface();
if (theInterface)
theInterface->bDontUpdateHierarchy = false;

return true;
}

bool CEntitySA::SetBoneRotationQuat(eBone boneId, float x, float y, float z, float w)
{
RpClump* clump = GetRpClump();
if (clump)
{
// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
CAnimBlendClumpDataSAInterface* clumpDataInterface = *pGame->GetClumpData(clump);
AnimBlendFrameData* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (frameData)
{
RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
boneOrientation->imag.x = x;
boneOrientation->imag.y = y;
boneOrientation->imag.z = z;
boneOrientation->real = w;
CEntitySAInterface* theInterface = GetInterface();
if (theInterface)
{
theInterface->bDontUpdateHierarchy = false;
}
return true;
}
}
return false;
if (!clump)
return false;

// updating the bone frame orientation will also update its children
// This rotation is only applied when UpdateElementRpHAnim is called
auto* clumpDataInterface = *pGame->GetClumpData(clump);
auto* frameData = clumpDataInterface->GetFrameDataByNodeId(boneId);
if (!frameData)
return false;

RtQuat* boneOrientation = &frameData->m_pIFrame->orientation;
boneOrientation->imag.x = x;
boneOrientation->imag.y = y;
boneOrientation->imag.z = z;
boneOrientation->real = w;
CEntitySAInterface* theInterface = GetInterface();
if (theInterface)
theInterface->bDontUpdateHierarchy = false;

return true;
}

bool CEntitySA::GetBonePosition(eBone boneId, CVector& position)
{
RwMatrix* rwBoneMatrix = GetBoneRwMatrix(boneId);
if (rwBoneMatrix)
{
const RwV3d& pos = rwBoneMatrix->pos;
position = {pos.x, pos.y, pos.z};
return true;
}
return false;
if (!rwBoneMatrix)
return false;

const RwV3d& pos = rwBoneMatrix->pos;
position = {pos.x, pos.y, pos.z};
return true;
}

// NOTE: The position will be reset if UpdateElementRpHAnim is called after this.
bool CEntitySA::SetBonePosition(eBone boneId, const CVector& position)
{
RwMatrix* rwBoneMatrix = GetBoneRwMatrix(boneId);
if (rwBoneMatrix)
{
CMatrixSAInterface boneMatrix(rwBoneMatrix, false);
boneMatrix.SetTranslateOnly(position);
boneMatrix.UpdateRW();
return true;
}
return false;
if (!rwBoneMatrix)
return false;

CMatrixSAInterface boneMatrix(rwBoneMatrix, false);
boneMatrix.SetTranslateOnly(position);
boneMatrix.UpdateRW();
return true;
}

BYTE CEntitySA::GetAreaCode()
Expand Down
41 changes: 24 additions & 17 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,22 +1003,26 @@ int CLuaPedDefs::CanPedBeKnockedOffBike(lua_State* luaVM)
bool CLuaPedDefs::SetElementBonePosition(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId, CVector position)
{
CEntity* theEntity = entity->GetGameEntity();
return theEntity ? theEntity->SetBonePosition(static_cast<eBone>(boneId), position) : false;
if (!theEntity)
return false;
return theEntity->SetBonePosition(static_cast<eBone>(boneId), position);
}

bool CLuaPedDefs::SetElementBoneRotation(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId, float yaw, float pitch, float roll)
{
if (boneId > BONE_RIGHTFOOT)
throw LuaFunctionError("Invalid bone ID");
throw LuaFunctionError("Invalid bone ID", false);

CEntity* theEntity = entity->GetGameEntity();
return theEntity ? theEntity->SetBoneRotation(static_cast<eBone>(boneId), yaw, pitch, roll) : false;
if (!theEntity)
return false;
return theEntity->SetBoneRotation(static_cast<eBone>(boneId), yaw, pitch, roll);
}

bool CLuaPedDefs::SetElementBoneQuaternion(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId, float x, float y, float z, float w)
{
if (boneId > BONE_RIGHTFOOT)
throw LuaFunctionError("Invalid bone ID");
throw LuaFunctionError("Invalid bone ID", false);

CEntity* theEntity = entity->GetGameEntity();
return theEntity ? theEntity->SetBoneRotationQuat(static_cast<eBone>(boneId), x, y, z, w) : false;
Expand All @@ -1028,33 +1032,36 @@ std::variant<bool, CLuaMultiReturn<float, float, float>> CLuaPedDefs::GetElement
{
CEntity* theEntity = entity->GetGameEntity();
CVector position;
if (theEntity && theEntity->GetBonePosition(static_cast<eBone>(boneId), position))
return std::make_tuple(position.fX, position.fY, position.fZ);
return false;
if (!theEntity || !theEntity->GetBonePosition(static_cast<eBone>(boneId), position))
return false;

return std::make_tuple(position.fX, position.fY, position.fZ);
}

std::variant<bool, CLuaMultiReturn<float, float, float>> CLuaPedDefs::GetElementBoneRotation(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId)
{
if (boneId > BONE_RIGHTFOOT)
throw LuaFunctionError("Invalid bone ID");
throw LuaFunctionError("Invalid bone ID", false);

float yaw = 0.0f, pitch = 0.0f, roll = 0.0f;
float yaw = 0.0f, pitch = 0.0f, roll = 0.0f;
CEntity* theEntity = entity->GetGameEntity();
if (theEntity && theEntity->GetBoneRotation(static_cast<eBone>(boneId), yaw, pitch, roll))
return std::make_tuple(yaw, pitch, roll);
return false;
if (!theEntity || !theEntity->GetBoneRotation(static_cast<eBone>(boneId), yaw, pitch, roll))
return false;

return std::make_tuple(yaw, pitch, roll);
}

std::variant<bool, CLuaMultiReturn<float, float, float, float>> CLuaPedDefs::GetElementBoneQuaternion(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId)
{
if (boneId > BONE_RIGHTFOOT)
throw LuaFunctionError("Invalid bone ID");
throw LuaFunctionError("Invalid bone ID", false);

float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
CEntity* theEntity = entity->GetGameEntity();
if (theEntity && theEntity->GetBoneRotationQuat(static_cast<eBone>(boneId), x, y, z, w))
return std::make_tuple(x, y, z, w);
return false;
if (!theEntity || !theEntity->GetBoneRotationQuat(static_cast<eBone>(boneId), x, y, z, w))
return false;

return std::make_tuple(x, y, z, w);
}

bool CLuaPedDefs::SetElementBoneMatrix(lua_State* const luaVM, CClientPed* entity, std::uint32_t boneId, CMatrix boneMatrix)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Multi Theft Auto: San Andreas
## Multi Theft Auto: San Andreas

[![Build Status](https://github.com/multitheftauto/mtasa-blue/workflows/Build/badge.svg?event=push&branch=master)](https://github.com/multitheftauto/mtasa-blue/actions?query=branch%3Amaster+event%3Apush) [![Unique servers online](https://img.shields.io/endpoint?url=https%3A%2F%2Fmultitheftauto.com%2Fapi%2Fservers-shields.io.json)](https://community.multitheftauto.com/index.php?p=servers) [![Unique players online](https://img.shields.io/endpoint?url=https%3A%2F%2Fmultitheftauto.com%2Fapi%2Fplayers-shields.io.json)](https://multitheftauto.com) [![Unique players last 24 hours](https://img.shields.io/endpoint?url=https%3A%2F%2Fmultitheftauto.com%2Fapi%2Funique-players-shields.io.json)](https://multitheftauto.com) [![Discord](https://img.shields.io/discord/278474088903606273?label=discord&logo=discord)](https://discord.com/invite/mtasa) [![Crowdin](https://badges.crowdin.net/e/f5dba7b9aa6594139af737c85d81d3aa/localized.svg)](https://multitheftauto.crowdin.com/multitheftauto)

Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/CResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3011,7 +3011,7 @@ HttpStatusCode CResource::HandleRequestRouter(HttpRequest* request, HttpResponse
luaRequest.PushString("path");
luaRequest.PushString(path);

luaRequest.PushString("absolute_path");
luaRequest.PushString("absolutePath");
luaRequest.PushString(request->sOriginalUri);

luaRequest.PushString("hostname");
Expand Down
Loading

0 comments on commit c905a3d

Please sign in to comment.