[saco] Implement/match CMenuPool::Process()

* Implement/match `CMenu::GetSelectedRow()`
This commit is contained in:
RD42 2024-07-16 23:32:22 +08:00
parent f51ecadaef
commit 62eaba43a7
5 changed files with 43 additions and 0 deletions

View File

@ -104,3 +104,10 @@ PCHAR CMenu::MS(BYTE byteRow, BYTE byteColumn)
return "DUMMY";
}
BYTE CMenu::GetSelectedRow()
{
if (!m_MenuInteraction.bMenu) return 0xFF;
DWORD dwRetVal;
ScriptCommand(&get_panel_active_row, m_dwPanel, &dwRetVal);
return (BYTE)dwRetVal;
}

View File

@ -49,4 +49,5 @@ public:
PCHAR GetMenuTitle();
PCHAR GetMenuHeader(BYTE byteColumn);
PCHAR MS(BYTE byteColumn, BYTE byteRow);
BYTE GetSelectedRow();
};

View File

@ -87,6 +87,8 @@ const SCRIPT_COMMAND set_panel_column_data = { 0x08DB, "iisssssssssssss" };
const SCRIPT_COMMAND set_panel_column_width = { 0x09DB, "iii" };
const SCRIPT_COMMAND set_panel_row_enable = { 0x08D9, "iii" };
const SCRIPT_COMMAND get_panel_active_row = { 0x08D7, "iv" };
const SCRIPT_COMMAND restore_camera_to_user_defined = { 0x925, "" };
const SCRIPT_COMMAND set_camera_position_to = { 0x936, "ffffffii" };

View File

@ -1,5 +1,6 @@
#include "../main.h"
#include "../game/keystuff.h"
CHAR g_szMenuItems[MAX_MENU_ITEMS][MAX_COLUMNS][MAX_MENU_LINE+1] =
{
@ -17,6 +18,8 @@ CHAR g_szMenuItems[MAX_MENU_ITEMS][MAX_COLUMNS][MAX_MENU_LINE+1] =
{"SAMP011", "SAMP111"},
};
extern CNetGame* pNetGame;
//----------------------------------------------------
CMenuPool::CMenuPool()
@ -117,3 +120,32 @@ PCHAR CMenuPool::GetTextPointer(PCHAR szName)
return NULL;
}
void CMenuPool::Process()
{
if (m_byteCurrentMenu == MAX_MENUS) return;
GTA_CONTROLSET * pControls = GameGetInternalKeys();
RakClientInterface* pRak = pNetGame->GetRakClient();
if (pControls->wKeys1[16] && !pControls->wKeys2[16]) // Selected an item
{
BYTE row = m_pMenus[m_byteCurrentMenu]->GetSelectedRow();
if (row != 0xFF)
{
m_byteExited = 1;
RakNet::BitStream bsSend;
bsSend.Write(row);
pRak->RPC(RPC_MenuSelect, &bsSend, HIGH_PRIORITY, RELIABLE, 0, FALSE);
}
}
else if (pControls->wKeys1[15] && !pControls->wKeys2[15]) // Exited
{
m_byteExited = 1;
pRak->RPC(RPC_MenuQuit, NULL, HIGH_PRIORITY, RELIABLE, 0, FALSE);
}
else if (m_byteExited)
{
// Delay clearing for one frame to allow SA to make the nice noise
HideMenu(m_byteCurrentMenu);
m_byteExited = 0;
}
}

View File

@ -25,6 +25,7 @@ public:
PCHAR GetTextPointer(PCHAR szName);
void Process();
};
//----------------------------------------------------