Skip to content

Commit

Permalink
Deselect actively edited menu items on menu change
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored Aug 14, 2023
1 parent 2d04d13 commit fe1dadf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/blood/src/gamemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CGameMenuMgr gGameMenuMgr;

extern CGameMenuItemPicCycle itemSorryPicCycle;
extern CGameMenuItemQAV itemBloodQAV;
static CGameMenuItemZEdit *pGameMenuItemZEdit = NULL;

CMenuTextMgr::CMenuTextMgr()
{
Expand Down Expand Up @@ -122,6 +123,8 @@ bool CGameMenuMgr::Push(CGameMenu *pMenu, int nItem)
InitializeMenu();
m_menuchange_watchpoint = 1;
m_mousecaught = 1;
if (pGameMenuItemZEdit) // deselect last actively edited item
pGameMenuItemZEdit->at30 = 0, pGameMenuItemZEdit = NULL;
return true;
}

Expand All @@ -137,6 +140,8 @@ void CGameMenuMgr::Pop(void)
pActiveMenu = pMenuStack[nMenuPointer-1];

m_menuchange_watchpoint = 1;
if (pGameMenuItemZEdit) // deselect last actively edited item
pGameMenuItemZEdit->at30 = 0, pGameMenuItemZEdit = NULL;
}
m_mousecaught = 1;
}
Expand Down Expand Up @@ -1906,7 +1911,6 @@ void CGameMenuItemZEdit::Draw(void)
bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
{
static char buffer[256];
static CGameMenuItemZEdit *pGameMenuItemZEdit = NULL;
// Hack
if (event.at2 == sc_kpad_2 || event.at2 == sc_kpad_4 || event.at2 == sc_kpad_6 || event.at2 == sc_kpad_8)
event.at0 = kMenuEventKey;
Expand Down Expand Up @@ -1936,7 +1940,7 @@ bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
at30 = 0;
return false;
}
else // unselect previously edited item
else // deselect last actively edited item
{
if (!pGameMenuItemZEdit)
pGameMenuItemZEdit = this;
Expand Down

0 comments on commit fe1dadf

Please sign in to comment.