mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement/match CMenuPool::New(...)
* Implement/match CMenu constructor * Update CMenuPool constructor
This commit is contained in:
parent
42b48b681e
commit
fc436d9489
@ -7,6 +7,7 @@
|
||||
#include "audio.h"
|
||||
#include "camera.h"
|
||||
#include "scripting.h"
|
||||
#include "menu.h"
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
27
saco/game/menu.cpp
Normal file
27
saco/game/menu.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
#include "../main.h"
|
||||
|
||||
|
||||
CMenu::CMenu(float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction)
|
||||
{
|
||||
for (int i = 0; i < MAX_MENU_ITEMS; i++)
|
||||
{
|
||||
memset(m_charItems[i][0], 0, sizeof(m_charItems[i][0]));
|
||||
memset(m_charItems[i][1], 0, sizeof(m_charItems[i][1]));
|
||||
}
|
||||
memset(m_charHeader[0], 0, sizeof(m_charHeader[0]));
|
||||
memset(m_charHeader[1], 0, sizeof(m_charHeader[1]));
|
||||
memset(m_charTitle, 0, sizeof(m_charTitle));
|
||||
|
||||
m_fXPos = fX;
|
||||
m_fYPos = fY;
|
||||
m_fCol1Width = fCol1Width;
|
||||
m_fCol2Width = fCol2Width;
|
||||
|
||||
if (byteColumns == 2) m_byteColumns = 2;
|
||||
else m_byteColumns = 1;
|
||||
memcpy(&m_MenuInteraction, MenuInteraction, sizeof (MENU_INT));
|
||||
|
||||
m_dwPanel = 0;
|
||||
}
|
||||
|
43
saco/game/menu.h
Normal file
43
saco/game/menu.h
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_MENU_ITEMS 12
|
||||
#define MAX_MENU_LINE 32
|
||||
#define MAX_COLUMNS 2
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
struct MENU_INT
|
||||
{
|
||||
BOOL bMenu;
|
||||
BOOL bRow[MAX_MENU_ITEMS];
|
||||
BOOL bPadding[8 - ((MAX_MENU_ITEMS + 1) % 8)];
|
||||
};
|
||||
|
||||
class CMenu
|
||||
{
|
||||
private:
|
||||
|
||||
//char _gap0[979];
|
||||
BYTE m_byteMenuID;
|
||||
|
||||
CHAR m_charTitle[MAX_MENU_LINE+1];
|
||||
CHAR m_charItems[MAX_MENU_ITEMS][MAX_COLUMNS][MAX_MENU_LINE+1];
|
||||
CHAR m_charHeader[MAX_COLUMNS][MAX_MENU_LINE+1];
|
||||
|
||||
float m_fXPos;
|
||||
float m_fYPos;
|
||||
float m_fCol1Width;
|
||||
float m_fCol2Width;
|
||||
BYTE m_byteColumns;
|
||||
MENU_INT m_MenuInteraction;
|
||||
|
||||
BYTE m_byteColCount[MAX_COLUMNS];
|
||||
|
||||
DWORD m_dwPanel;
|
||||
|
||||
public:
|
||||
|
||||
CMenu(float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction);
|
||||
|
||||
};
|
@ -8,10 +8,25 @@ CMenuPool::CMenuPool()
|
||||
// loop through and initialize all net players to null and slot states to false
|
||||
for (BYTE byteMenuID = 0; byteMenuID < MAX_MENUS; byteMenuID++)
|
||||
{
|
||||
field_200[byteMenuID] = 0;
|
||||
field_0[byteMenuID] = 0;
|
||||
m_bMenuSlotState[byteMenuID] = FALSE;
|
||||
m_pMenus[byteMenuID] = NULL;
|
||||
}
|
||||
field_400 = -128;
|
||||
m_byteCurrentMenu = MAX_MENUS;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CMenu* CMenuPool::New(BYTE byteMenuID, float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction)
|
||||
{
|
||||
SAFE_DELETE(m_pMenus[byteMenuID]);
|
||||
m_bMenuSlotState[byteMenuID] = FALSE;
|
||||
CMenu* pMenu = new CMenu(fX, fY, byteColumns, fCol1Width, fCol2Width, MenuInteraction);
|
||||
|
||||
if (pMenu)
|
||||
{
|
||||
m_bMenuSlotState[byteMenuID] = TRUE;
|
||||
m_pMenus[byteMenuID] = pMenu;
|
||||
return pMenu;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -6,13 +6,18 @@
|
||||
class CMenuPool
|
||||
{
|
||||
private:
|
||||
int field_0[MAX_MENUS];
|
||||
int field_200[MAX_MENUS];
|
||||
char field_400;
|
||||
char field_401;
|
||||
|
||||
CMenu *m_pMenus[MAX_MENUS];
|
||||
BOOL m_bMenuSlotState[MAX_MENUS];
|
||||
BYTE m_byteCurrentMenu;
|
||||
|
||||
public:
|
||||
CMenuPool();
|
||||
|
||||
CMenu* New(BYTE byteMenuID, float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction);
|
||||
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user