diff --git a/Client/game_sa/CEntitySA.cpp b/Client/game_sa/CEntitySA.cpp index a55470adf6..02a9f00380 100644 --- a/Client/game_sa/CEntitySA.cpp +++ b/Client/game_sa/CEntitySA.cpp @@ -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() diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 6f6e4205e0..2c8741f4d7 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -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(boneId), position) : false; + if (!theEntity) + return false; + return theEntity->SetBonePosition(static_cast(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(boneId), yaw, pitch, roll) : false; + if (!theEntity) + return false; + return theEntity->SetBoneRotation(static_cast(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(boneId), x, y, z, w) : false; @@ -1028,33 +1032,36 @@ std::variant> CLuaPedDefs::GetElement { CEntity* theEntity = entity->GetGameEntity(); CVector position; - if (theEntity && theEntity->GetBonePosition(static_cast(boneId), position)) - return std::make_tuple(position.fX, position.fY, position.fZ); - return false; + if (!theEntity || !theEntity->GetBonePosition(static_cast(boneId), position)) + return false; + + return std::make_tuple(position.fX, position.fY, position.fZ); } std::variant> 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(boneId), yaw, pitch, roll)) - return std::make_tuple(yaw, pitch, roll); - return false; + if (!theEntity || !theEntity->GetBoneRotation(static_cast(boneId), yaw, pitch, roll)) + return false; + + return std::make_tuple(yaw, pitch, roll); } std::variant> 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(boneId), x, y, z, w)) - return std::make_tuple(x, y, z, w); - return false; + if (!theEntity || !theEntity->GetBoneRotationQuat(static_cast(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) diff --git a/Shared/mods/deathmatch/logic/CDebugHookManager.cpp b/Shared/mods/deathmatch/logic/CDebugHookManager.cpp index 48572d7364..b083746acc 100644 --- a/Shared/mods/deathmatch/logic/CDebugHookManager.cpp +++ b/Shared/mods/deathmatch/logic/CDebugHookManager.cpp @@ -659,7 +659,8 @@ bool CDebugHookManager::CallHook(const char* szName, const std::vectorGetType() == LUA_TSTRING) { - if (returnedValue->GetString() == "skip") + // We don't want to skip the creation of new debug hooks + if (returnedValue->GetString() == "skip" && strcmp(szName, "addDebugHook")) bSkip = true; } } diff --git a/utils/buildactions/install_cef.lua b/utils/buildactions/install_cef.lua index 194fcde4e6..b7495e6f7f 100644 --- a/utils/buildactions/install_cef.lua +++ b/utils/buildactions/install_cef.lua @@ -9,8 +9,8 @@ local CEF_URL_PREFIX = "https://cef-builds.spotifycdn.com/cef_binary_" local CEF_URL_SUFFIX = "_windows32_minimal.tar.bz2" -- Change here to update CEF version -local CEF_VERSION = "128.4.8+g88b5034+chromium-128.0.6613.114" -local CEF_HASH = "eb5a84db83b51f6d6be43e9bb7f8a557e86dd056a9a565251c28c301feb1c9ef" +local CEF_VERSION = "128.4.9+g9840ad9+chromium-128.0.6613.120" +local CEF_HASH = "34447cf2983ca4ad7a9077394b6ac75f30c393b41b2794cdbb10c49b5c8e1e85" function make_cef_download_url() return CEF_URL_PREFIX..http.escapeUrlParam(CEF_VERSION)..CEF_URL_SUFFIX