Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ bool CMainMenu::OnRenderPPUI_query()
return IsActive() && !m_Flags.test(flGameSaveScreenshot) && b_shniaganeed_pp;
}

CUIDialogWnd* CMainMenu::ModalOverStartDialog()
{
CUIDialogWnd* tir = TopInputReceiver();
return (tir && tir != m_startDialog) ? tir : NULL;
}


extern void draw_wnds_rects();
extern bool use_reshade;
Expand All @@ -435,11 +441,15 @@ void CMainMenu::OnRender()
Render->Render();

if (!OnRenderPPUI_query())
{
DoRenderDialogs();
UI().RenderFont();
draw_wnds_rects();
else if (CUIDialogWnd* modal = ModalOverStartDialog())
{
if (modal->IsShown())
modal->Draw();
}

UI().RenderFont();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We start to call those if OnRenderPPUI_query() == true, is this expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. they are safe to call regardless of that check. and now both non-PP case and shniaga(PP) case draw modal dialog separately here and both need those two calls because of this

draw_wnds_rects();
}

void CMainMenu::OnRenderPPUI_main()
Expand All @@ -456,7 +466,7 @@ void CMainMenu::OnRenderPPUI_main()

if (OnRenderPPUI_query())
{
DoRenderDialogs();
DoRenderDialogs(ModalOverStartDialog());
UI().RenderFont();
}

Expand Down
1 change: 1 addition & 0 deletions src/xrGame/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class CMainMenu :

virtual void IR_OnMouseWheel(int direction);

CUIDialogWnd* ModalOverStartDialog();
bool OnRenderPPUI_query();
void OnRenderPPUI_main();
void OnRenderPPUI_PP();
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/UIDialogHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ void CDialogHolder::RemoveDialogToRender(CUIWindow* pDialog)
}


void CDialogHolder::DoRenderDialogs()
void CDialogHolder::DoRenderDialogs(CUIWindow* skip)
{
xr_vector<dlgItem>::iterator it = m_dialogsToRender.begin();
for (; it != m_dialogsToRender.end(); ++it)
{
if ((*it).enabled && (*it).wnd->IsShown())
if ((*it).enabled && (*it).wnd->IsShown() && (*it).wnd != skip)
(*it).wnd->Draw();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/UIDialogHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PROTECT_API CDialogHolder : public pureFrame
void StopMenu(CUIDialogWnd* pDialog);
void SetMainInputReceiver(CUIDialogWnd* ir, bool _find_remove);
protected:
void DoRenderDialogs();
void DoRenderDialogs(CUIWindow* skip = NULL);
void CleanInternals();
public:
CDialogHolder();
Expand Down
18 changes: 18 additions & 0 deletions src/xrGame/ui/UIMMShniaga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "UIMMShniaga.h"
#include "UICursor.h"
#include "UIDialogWnd.h"
#include "UIStatic.h"
#include "UIScrollView.h"
#include "UIXmlInit.h"
Expand Down Expand Up @@ -256,6 +257,20 @@ bool CUIMMShniaga::IsButton(CUIWindow* st)
return false;
}

bool CUIMMShniaga::IsFrozenByModal()
{
CUIDialogWnd* owner = smart_cast<CUIDialogWnd*>(GetTop());
if (!owner)
return false;

CDialogHolder* holder = owner->GetHolder();
if (!holder)
return false;

CUIDialogWnd* tir = holder->TopInputReceiver();
return tir && tir != owner;
}

void CUIMMShniaga::SendMessage(CUIWindow* pWnd, s16 msg, void* pData)
{
CUIWindow::SendMessage(pWnd, msg, pData);
Expand Down Expand Up @@ -337,6 +352,9 @@ void CUIMMShniaga::Update()

ProcessEvent(E_Update);

if (IsFrozenByModal())
return;

CUIWindow::Update();
}

Expand Down
1 change: 1 addition & 0 deletions src/xrGame/ui/UIMMShniaga.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CUIMMShniaga : public CUIWindow,
void ProcessEvent(EVENT ev);

bool IsButton(CUIWindow* st);
bool IsFrozenByModal();
void CreateList(xr_vector<CUITextWnd*>& lst, CUIXml& xml_doc, LPCSTR path);
void ShowMain();
void ShowNewGame();
Expand Down
Loading