Skip to content

Commit 87e3dce

Browse files
authored
Fix #2944: Fix cursor alpha issues (#3034)
1 parent 6c1f318 commit 87e3dce

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

Client/core/CGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ void CLocalGUI::SetConsoleVisible(bool bVisible)
383383
CGUI* pGUI = CCore::GetSingleton().GetGUI();
384384
if (bVisible)
385385
pGUI->SetCursorAlpha(1.0f);
386-
else
386+
else if (!g_pCore->IsMenuVisible())
387387
pGUI->SetCursorAlpha(pGUI->GetCurrentServerCursorAlpha());
388388
}
389389
}

Client/core/CMessageLoopHook.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ LRESULT CALLBACK CMessageLoopHook::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM w
293293
{
294294
ms_bIgnoreNextEscapeCharacter = true;
295295
pConsole->SetVisible(false);
296+
297+
CGUI* pGUI = g_pCore->GetGUI();
298+
if (!g_pCore->IsMenuVisible())
299+
pGUI->SetCursorAlpha(pGUI->GetCurrentServerCursorAlpha());
300+
296301
return true;
297302
}
298303

Client/gui/CGUI_Impl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,12 @@ void CGUI_Impl::SetCursorAlpha(float fAlpha, bool bOnlyCurrentServer)
499499
CEGUI::MouseCursor::getSingleton().setAlpha(fAlpha);
500500

501501
if (bOnlyCurrentServer)
502-
m_fCurrentServerCursorAlpha = fAlpha;
502+
SetCurrentServerCursorAlpha(fAlpha);
503+
}
504+
505+
void CGUI_Impl::SetCurrentServerCursorAlpha(float fAlpha)
506+
{
507+
m_fCurrentServerCursorAlpha = fAlpha;
503508
}
504509

505510
float CGUI_Impl::GetCurrentServerCursorAlpha()

Client/gui/CGUI_Impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class CGUI_Impl : public CGUI, public CGUITabList
143143
void SetCursorEnabled(bool bEnabled);
144144
bool IsCursorEnabled();
145145
void SetCursorAlpha(float fAlpha, bool bOnlyCurrentServer = false);
146+
void SetCurrentServerCursorAlpha(float fAlpha);
146147
float GetCurrentServerCursorAlpha();
147148
eCursorType GetCursorType();
148149

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5030,7 +5030,11 @@ bool CStaticFunctionDefinitions::SetCursorAlpha(float fAlpha)
50305030
{
50315031
if (fAlpha >= 0.0f && fAlpha <= 1.0f)
50325032
{
5033-
m_pGUI->SetCursorAlpha(fAlpha, true);
5033+
if (!m_pCore->IsMenuVisible() && !m_pCore->GetConsole()->IsVisible())
5034+
m_pGUI->SetCursorAlpha(fAlpha, true);
5035+
else
5036+
m_pGUI->SetCurrentServerCursorAlpha(fAlpha);
5037+
50345038
return true;
50355039
}
50365040
return false;

Client/sdk/gui/CGUI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class CGUI
126126
virtual void SetCursorEnabled(bool bEnabled) = 0;
127127
virtual bool IsCursorEnabled() = 0;
128128
virtual void SetCursorAlpha(float fAlpha, bool bOnlyCurrentServer = false) = 0;
129+
virtual void SetCurrentServerCursorAlpha(float fAlpha) = 0;
129130
virtual float GetCurrentServerCursorAlpha() = 0;
130131
virtual eCursorType GetCursorType() = 0;
131132

0 commit comments

Comments
 (0)