Skip to content

Commit

Permalink
Merge branch 'master' into TheNormalnij/fix_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored Jun 16, 2024
2 parents d0ba61b + 53e03d0 commit 5fb153c
Show file tree
Hide file tree
Showing 923 changed files with 161,079 additions and 97,622 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
name: windows-${{ matrix.platform }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache-dxfiles
with:
path: utils/DXFiles
Expand Down Expand Up @@ -45,16 +45,16 @@ jobs:
- name: Create build artifacts
run: utils\premake5 compose_files

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: InstallFiles
name: InstallFiles-${{ matrix.platform }}
path: InstallFiles/

macOS:
name: macOS
runs-on: macOS-latest
runs-on: macOS-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install MySQL
run: brew install mysql
Expand All @@ -80,7 +80,7 @@ jobs:
container:
image: docker://ghcr.io/multitheftauto/mtasa-blue-build:${{ matrix.image-tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Run Build
run: ./linux-build.sh --arch=${{ matrix.architecture }}
8 changes: 4 additions & 4 deletions .github/workflows/dockerimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
dockerfile: Dockerfile.osx-arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CI_PAT }}
- uses: docker/build-push-action@v3
- uses: docker/build-push-action@v5
with:
push: true
file: ./${{ matrix.dockerfile }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rebuild-pots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.POT_CI_PAT }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/sync-master-to-maetro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
sync-master-to-maetro:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SYNC_CI_PAT }}
Expand All @@ -36,6 +36,10 @@ jobs:
git checkout --ours -- "Shared/data/MTA San Andreas/MTA/d3dcompiler_47.dll"
git add --verbose "Shared/data/MTA San Andreas/MTA/d3dcompiler_47.dll"
# Discard cefweb conflicts
git checkout --ours -- Client/cefweb/CWebView.cpp
git add --verbose Client/cefweb/CWebView.cpp
git checkout --ours -- "Client/loader/MainFunctions.cpp"
git add --verbose "Client/loader/MainFunctions.cpp"
Expand Down
2 changes: 1 addition & 1 deletion Client/cefweb/CWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ bool CWebView::SetAudioVolume(float fVolume)

for (auto& name : frameNames)
{
auto frame = m_pWebView->GetFrame(name);
auto frame = m_pWebView->GetFrameByName(name);
frame->ExecuteJavaScript(strJSCode, "", 0);
}
m_fVolume = fVolume;
Expand Down
16 changes: 15 additions & 1 deletion Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,21 @@ void CCore::OnPreHUDRender()
{
IDirect3DDevice9* pDevice = CGraphics::GetSingleton().GetDevice();

CGraphics::GetSingleton().EnteringMTARenderZone();
if (CGraphics::GetSingleton().HasLine3DPostFXQueueItems() || CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems())
{
/*
Although MTA render zones are expensive, we should use them twice in the bounds of the function
because some of render states from PostFX drain to the 2D part of the frame.
*/
CGraphics::GetSingleton().EnteringMTARenderZone();

CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue();
CGraphics::GetSingleton().DrawLine3DPostFXQueue();

CGraphics::GetSingleton().LeavingMTARenderZone();
}

CGraphics::GetSingleton().EnteringMTARenderZone();

// Maybe capture screen and other stuff
CGraphics::GetSingleton().GetRenderItemManager()->DoPulse();
Expand Down
18 changes: 18 additions & 0 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,18 @@ void CSettings::CreateGUI()
m_pEditNick->SetMaxLength(MAX_PLAYER_NICK_LENGTH);
m_pEditNick->SetTextAcceptedHandler(GUI_CALLBACK(&CSettings::OnOKButtonClick, this));

m_pButtonGenerateNick = reinterpret_cast<CGUIButton*>(pManager->CreateButton(pTabMultiplayer));
m_pButtonGenerateNick->SetPosition(CVector2D(vecSize.fX + vecTemp.fX + 50.0f + 178.0f + 5.0f, vecTemp.fY - 1.0f), false);
m_pButtonGenerateNick->SetSize(CVector2D(26.0f, 26.0f), false);
m_pButtonGenerateNick->SetClickHandler(GUI_CALLBACK(&CSettings::OnNickButtonClick, this));
m_pButtonGenerateNick->SetZOrderingEnabled(false);

m_pButtonGenerateNickIcon = reinterpret_cast<CGUIStaticImage*>(pManager->CreateStaticImage(m_pButtonGenerateNick));
m_pButtonGenerateNickIcon->SetSize(CVector2D(1, 1), true);
m_pButtonGenerateNickIcon->LoadFromFile("cgui\\images\\serverbrowser\\refresh.png");
m_pButtonGenerateNickIcon->SetProperty("MousePassThroughEnabled", "True");
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->GetPosition(vecTemp, false);
Expand Down Expand Up @@ -2940,6 +2952,12 @@ bool CSettings::OnOKButtonClick(CGUIElement* pElement)
return true;
}

bool CSettings::OnNickButtonClick(CGUIElement* pElement)
{
m_pEditNick->SetText(CNickGen::GetRandomNickname());
return true;
}

bool CSettings::OnCancelButtonClick(CGUIElement* pElement)
{
CMainMenu* pMainMenu = CLocalGUI::GetSingleton().GetMainMenu();
Expand Down
3 changes: 3 additions & 0 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class CSettings
CGUIButton* m_pButtonOK;
CGUIButton* m_pButtonCancel;
CGUILabel* m_pLabelNick;
CGUIButton* m_pButtonGenerateNick;
CGUIStaticImage* m_pButtonGenerateNickIcon;
CGUIEdit* m_pEditNick;
CGUICheckBox* m_pSavePasswords;
CGUICheckBox* m_pAutoRefreshBrowser;
Expand Down Expand Up @@ -347,6 +349,7 @@ class CSettings
bool OnVideoDefaultClick(CGUIElement* pElement);
bool OnBindsListClick(CGUIElement* pElement);
bool OnOKButtonClick(CGUIElement* pElement);
bool OnNickButtonClick(CGUIElement* pElement);
bool OnCancelButtonClick(CGUIElement* pElement);
bool OnFieldOfViewChanged(CGUIElement* pElement);
bool OnDrawDistanceChanged(CGUIElement* pElement);
Expand Down
72 changes: 58 additions & 14 deletions Client/core/Graphics/CGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ CGraphics::CGraphics(CLocalGUI* pGUI)
m_pRenderItemManager = new CRenderItemManager();
m_pTileBatcher = new CTileBatcher();
m_pLine3DBatcherPreGUI = new CLine3DBatcher(true);
m_pLine3DBatcherPostFX = new CLine3DBatcher(true);
m_pLine3DBatcherPostGUI = new CLine3DBatcher(false);
m_pMaterialLine3DBatcherPreGUI = new CMaterialLine3DBatcher(true);
m_pMaterialLine3DBatcherPostFX = new CMaterialLine3DBatcher(true);
m_pMaterialLine3DBatcherPostGUI = new CMaterialLine3DBatcher(false);
m_pPrimitive3DBatcherPreGUI = new CPrimitive3DBatcher(true);
m_pPrimitive3DBatcherPostFX = new CPrimitive3DBatcher(true);
m_pPrimitive3DBatcherPostGUI = new CPrimitive3DBatcher(false);
m_pMaterialPrimitive3DBatcherPreGUI = new CMaterialPrimitive3DBatcher(true, this);
m_pMaterialPrimitive3DBatcherPostFX = new CMaterialPrimitive3DBatcher(true, this);
m_pMaterialPrimitive3DBatcherPostGUI = new CMaterialPrimitive3DBatcher(false, this);
m_pPrimitiveBatcher = new CPrimitiveBatcher();
m_pPrimitiveMaterialBatcher = new CPrimitiveMaterialBatcher(this);
Expand All @@ -83,14 +87,18 @@ CGraphics::~CGraphics()
SAFE_DELETE(m_pRenderItemManager);
SAFE_DELETE(m_pTileBatcher);
SAFE_DELETE(m_pLine3DBatcherPreGUI);
SAFE_DELETE(m_pLine3DBatcherPostFX);
SAFE_DELETE(m_pLine3DBatcherPostGUI);
SAFE_DELETE(m_pMaterialLine3DBatcherPreGUI);
SAFE_DELETE(m_pMaterialLine3DBatcherPostFX);
SAFE_DELETE(m_pMaterialLine3DBatcherPostGUI);
SAFE_DELETE(m_pPrimitiveBatcher);
SAFE_DELETE(m_pPrimitiveMaterialBatcher);
SAFE_DELETE(m_pPrimitive3DBatcherPreGUI);
SAFE_DELETE(m_pPrimitive3DBatcherPostFX);
SAFE_DELETE(m_pPrimitive3DBatcherPostGUI);
SAFE_DELETE(m_pMaterialPrimitive3DBatcherPreGUI);
SAFE_DELETE(m_pMaterialPrimitive3DBatcherPostFX);
SAFE_DELETE(m_pMaterialPrimitive3DBatcherPostGUI);
SAFE_DELETE(m_pScreenGrabber);
SAFE_DELETE(m_pPixelsManager);
Expand Down Expand Up @@ -207,7 +215,7 @@ void CGraphics::DrawStringOutline(const RECT& rect, unsigned long ulColor, const

void CGraphics::DrawLine3D(const CVector& vecBegin, const CVector& vecEnd, unsigned long ulColor, float fWidth)
{
DrawLine3DQueued(vecBegin, vecEnd, fWidth, ulColor, true);
DrawLine3DQueued(vecBegin, vecEnd, fWidth, ulColor, eRenderStage::POST_GUI);
}

void CGraphics::DrawRectangleInternal(float fX, float fY, float fWidth, float fHeight, unsigned long ulColor, bool bSubPixelPositioning)
Expand Down Expand Up @@ -831,21 +839,23 @@ void CGraphics::DrawLineQueued(float fX1, float fY1, float fX2, float fY2, float
AddQueueItem(Item, bPostGUI);
}

void CGraphics::DrawLine3DQueued(const CVector& vecBegin, const CVector& vecEnd, float fWidth, unsigned long ulColor, bool bPostGUI)
void CGraphics::DrawLine3DQueued(const CVector& vecBegin, const CVector& vecEnd, float fWidth, unsigned long ulColor, eRenderStage stage)
{
if (g_pCore->IsWindowMinimized())
return;

// Add it to the queue
if (bPostGUI && !CCore::GetSingleton().IsMenuVisible())
if (stage == eRenderStage::POST_GUI && !CCore::GetSingleton().IsMenuVisible())
m_pLine3DBatcherPostGUI->AddLine3D(vecBegin, vecEnd, fWidth, ulColor);
else
else if (stage == eRenderStage::PRE_FX)
m_pLine3DBatcherPreGUI->AddLine3D(vecBegin, vecEnd, fWidth, ulColor);
else
m_pLine3DBatcherPostFX->AddLine3D(vecBegin, vecEnd, fWidth, ulColor);
}

void CGraphics::DrawMaterialLine3DQueued(const CVector& vecBegin, const CVector& vecEnd, float fWidth, unsigned long ulColor, CMaterialItem* pMaterial,
float fU, float fV, float fSizeU, float fSizeV, bool bRelativeUV, bool bFlipUV, bool bUseFaceToward,
const CVector& vecFaceToward, bool bPostGUI)
const CVector& vecFaceToward, eRenderStage stage)
{
if (g_pCore->IsWindowMinimized())
return;
Expand All @@ -857,12 +867,15 @@ void CGraphics::DrawMaterialLine3DQueued(const CVector& vecBegin, const CVector&
}

// Add it to the queue
if (bPostGUI && !CCore::GetSingleton().IsMenuVisible())
if (stage == eRenderStage::POST_GUI && !CCore::GetSingleton().IsMenuVisible())
m_pMaterialLine3DBatcherPostGUI->AddLine3D(vecBegin, vecEnd, fWidth, ulColor, pMaterial, fU, fV, fSizeU, fSizeV, bRelativeUV, bFlipUV, bUseFaceToward,
vecFaceToward);
else
else if (stage == eRenderStage::PRE_FX)
m_pMaterialLine3DBatcherPreGUI->AddLine3D(vecBegin, vecEnd, fWidth, ulColor, pMaterial, fU, fV, fSizeU, fSizeV, bRelativeUV, bFlipUV, bUseFaceToward,
vecFaceToward);
else
m_pMaterialLine3DBatcherPostFX->AddLine3D(vecBegin, vecEnd, fWidth, ulColor, pMaterial, fU, fV, fSizeU, fSizeV, bRelativeUV, bFlipUV, bUseFaceToward,
vecFaceToward);
}

void CGraphics::DrawRectQueued(float fX, float fY, float fWidth, float fHeight, unsigned long ulColor, bool bPostGUI, bool bSubPixelPositioning)
Expand Down Expand Up @@ -939,7 +952,7 @@ void CGraphics::DrawPrimitiveQueued(std::vector<PrimitiveVertice>* pVecVertices,
AddQueueItem(Item, bPostGUI);
}

void CGraphics::DrawPrimitive3DQueued(std::vector<PrimitiveVertice>* pVecVertices, D3DPRIMITIVETYPE eType, bool bPostGUI)
void CGraphics::DrawPrimitive3DQueued(std::vector<PrimitiveVertice>* pVecVertices, D3DPRIMITIVETYPE eType, eRenderStage stage)
{
// Prevent queuing when minimized
if (g_pCore->IsWindowMinimized())
Expand All @@ -949,14 +962,16 @@ void CGraphics::DrawPrimitive3DQueued(std::vector<PrimitiveVertice>* pVecVertice
}

// Add it to the queue
if (bPostGUI && !CCore::GetSingleton().IsMenuVisible())
if (stage == eRenderStage::POST_GUI && !CCore::GetSingleton().IsMenuVisible())
m_pPrimitive3DBatcherPostGUI->AddPrimitive(eType, pVecVertices);
else
else if (stage == eRenderStage::PRE_FX)
m_pPrimitive3DBatcherPreGUI->AddPrimitive(eType, pVecVertices);
else
m_pPrimitive3DBatcherPostFX->AddPrimitive(eType, pVecVertices);
}

void CGraphics::DrawMaterialPrimitive3DQueued(std::vector<PrimitiveMaterialVertice>* pVecVertices, D3DPRIMITIVETYPE eType, CMaterialItem* pMaterial,
bool bPostGUI)
eRenderStage stage)
{
// Prevent queuing when minimized
if (g_pCore->IsWindowMinimized())
Expand All @@ -972,10 +987,13 @@ void CGraphics::DrawMaterialPrimitive3DQueued(std::vector<PrimitiveMaterialVerti
}

// Add it to the queue
if (bPostGUI && !CCore::GetSingleton().IsMenuVisible())
if (stage == eRenderStage::POST_GUI && !CCore::GetSingleton().IsMenuVisible())
m_pMaterialPrimitive3DBatcherPostGUI->AddPrimitive(eType, pMaterial, pVecVertices);
else
else if (stage == eRenderStage::PRE_FX)
m_pMaterialPrimitive3DBatcherPreGUI->AddPrimitive(eType, pMaterial, pVecVertices);
else
m_pMaterialPrimitive3DBatcherPostFX->AddPrimitive(eType, pMaterial, pVecVertices);

}

void CGraphics::DrawMaterialPrimitiveQueued(std::vector<PrimitiveMaterialVertice>* pVecVertices, D3DPRIMITIVETYPE eType, CMaterialItem* pMaterial,
Expand Down Expand Up @@ -1515,14 +1533,18 @@ void CGraphics::OnDeviceCreate(IDirect3DDevice9* pDevice)

m_pTileBatcher->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pLine3DBatcherPreGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pLine3DBatcherPostFX->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pLine3DBatcherPostGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialLine3DBatcherPreGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialLine3DBatcherPostFX->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialLine3DBatcherPostGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pPrimitiveBatcher->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pPrimitiveMaterialBatcher->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pPrimitive3DBatcherPreGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pPrimitive3DBatcherPostFX->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pPrimitive3DBatcherPostGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialPrimitive3DBatcherPreGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialPrimitive3DBatcherPostFX->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pMaterialPrimitive3DBatcherPostGUI->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pRenderItemManager->OnDeviceCreate(pDevice, GetViewportWidth(), GetViewportHeight());
m_pScreenGrabber->OnDeviceCreate(pDevice);
Expand Down Expand Up @@ -1612,6 +1634,12 @@ void CGraphics::DrawLine3DPreGUIQueue()
m_pMaterialLine3DBatcherPreGUI->Flush();
}

void CGraphics::DrawLine3DPostFXQueue(void)
{
m_pLine3DBatcherPostFX->Flush();
m_pMaterialLine3DBatcherPostFX->Flush();
}

void CGraphics::DrawPrimitive3DPreGUIQueue(void)
{
m_pPrimitive3DBatcherPreGUI->Flush();
Expand All @@ -1623,11 +1651,27 @@ bool CGraphics::HasLine3DPreGUIQueueItems(void)
return m_pLine3DBatcherPreGUI->HasItems() || m_pMaterialLine3DBatcherPreGUI->HasItems();
}

bool CGraphics::HasLine3DPostFXQueueItems()
{
return m_pLine3DBatcherPostFX->HasItems() || m_pMaterialLine3DBatcherPostFX->HasItems();
}

void CGraphics::DrawPrimitive3DPostFXQueue(void)
{
m_pPrimitive3DBatcherPostFX->Flush();
m_pMaterialPrimitive3DBatcherPostFX->Flush();
}

bool CGraphics::HasPrimitive3DPreGUIQueueItems(void)
{
return m_pMaterialPrimitive3DBatcherPreGUI->HasItems() || m_pPrimitive3DBatcherPreGUI->HasItems();
}

bool CGraphics::HasPrimitive3DPostFXQueueItems()
{
return m_pMaterialPrimitive3DBatcherPostFX->HasItems() || m_pPrimitive3DBatcherPostFX->HasItems();
}

void CGraphics::DrawQueue(std::vector<sDrawQueueItem>& Queue)
{
BeginDrawBatch();
Expand Down Expand Up @@ -2519,6 +2563,6 @@ void CGraphics::DrawWiredSphere(CVector vecPosition, float fRadius, SColor color
{
const CVector& vecBegin = model.vertexList[i] * fRadius + vecPosition;
const CVector& vecEnd = model.vertexList[i + 1] * fRadius + vecPosition;
DrawLine3DQueued(vecBegin, vecEnd, fLineWidth, color, false);
DrawLine3DQueued(vecBegin, vecEnd, fLineWidth, color, eRenderStage::POST_FX);
}
}
Loading

0 comments on commit 5fb153c

Please sign in to comment.