[saco] Implement/match CMenuPool::GetTextPointer(...)

* Implement/match `CMenu::GetMenuItem(...)`
* Implement/match `CMenu::GetMenuTitle()`
* Implement/match `CMenu::GetMenuHeader(...)`
This commit is contained in:
RD42 2024-07-16 23:28:35 +08:00
parent b734328b5e
commit ad0b31deb5
4 changed files with 38 additions and 0 deletions

View File

@ -55,6 +55,21 @@ void CMenu::Hide()
ScriptCommand(&remove_panel, m_dwPanel);
}
PCHAR CMenu::GetMenuItem(BYTE byteColumn, BYTE byteRow)
{
return m_charItems[byteRow][byteColumn];
}
PCHAR CMenu::GetMenuTitle()
{
return m_charTitle;
}
PCHAR CMenu::GetMenuHeader(BYTE byteColumn)
{
return m_charHeader[byteColumn];
}
PCHAR CMenu::MS(BYTE byteRow, BYTE byteColumn)
{
if (m_charItems[byteRow][byteColumn][0]) return g_szMenuItems[byteRow][byteColumn];

View File

@ -42,5 +42,8 @@ public:
void Show();
void Hide();
PCHAR GetMenuItem(BYTE byteColumn, BYTE byteRow);
PCHAR GetMenuTitle();
PCHAR GetMenuHeader(BYTE byteColumn);
PCHAR MS(BYTE byteColumn, BYTE byteRow);
};

View File

@ -100,3 +100,20 @@ void CMenuPool::HideMenu(BYTE byteMenuID)
m_byteCurrentMenu = MAX_MENUS;
}
PCHAR CMenuPool::GetTextPointer(PCHAR szName)
{
if (m_byteCurrentMenu == MAX_MENUS) return NULL;
CMenu* pMenu = m_pMenus[m_byteCurrentMenu];
if (!pMenu) return NULL;
if (!strcmp(szName, "HED")) return pMenu->GetMenuTitle();
if (!strcmp(szName, "RW1")) return pMenu->GetMenuHeader(0);
if (!strcmp(szName, "RW2")) return pMenu->GetMenuHeader(1);
for (BYTE i = 0; i < MAX_MENU_ITEMS; i++)
{
if (!strcmp(szName, g_szMenuItems[i][0] + 4)) return pMenu->GetMenuItem(0, i);
if (!strcmp(szName, g_szMenuItems[i][1] + 4)) return pMenu->GetMenuItem(1, i);
}
return NULL;
}

View File

@ -22,6 +22,9 @@ public:
void ShowMenu(BYTE byteMenuID);
void HideMenu(BYTE byteMenuID);
PCHAR GetTextPointer(PCHAR szName);
};
//----------------------------------------------------