mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
[saco] Implement/match CMenuPool::Process()
* Implement/match `CMenu::GetSelectedRow()`
This commit is contained in:
parent
f51ecadaef
commit
62eaba43a7
@ -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;
|
||||
}
|
||||
|
@ -49,4 +49,5 @@ public:
|
||||
PCHAR GetMenuTitle();
|
||||
PCHAR GetMenuHeader(BYTE byteColumn);
|
||||
PCHAR MS(BYTE byteColumn, BYTE byteRow);
|
||||
BYTE GetSelectedRow();
|
||||
};
|
||||
|
@ -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" };
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
|
||||
PCHAR GetTextPointer(PCHAR szName);
|
||||
|
||||
void Process();
|
||||
};
|
||||
|
||||
//----------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user