[saco] Implement/match CNewPlayerTags::DeleteDeviceObjects()

This commit is contained in:
RD42 2024-07-28 22:40:51 +08:00
parent e7af6d933f
commit a79dde901d
4 changed files with 130 additions and 14 deletions

View File

@ -1,13 +1,14 @@
#include "main.h"
extern CConfig *pConfig;
extern CGame *pGame;
extern CConfig *pConfig;
//----------------------------------------------------
// MATCH
CCmdWindow::CCmdWindow(IDirect3DDevice9 *pD3DDevice)
{
field_14E0 = 0;
m_bEnabled = FALSE;
m_pD3DDevice = pD3DDevice;
m_iCmdCount = 0;
field_1AF4 = 0;
@ -15,12 +16,18 @@ CCmdWindow::CCmdWindow(IDirect3DDevice9 *pD3DDevice)
field_1AF0 = -1;
memset(&field_1565[0],0,1290);
memset(&field_14E4[0],0,129);
memset(&m_szInputBuffer[0],0,(MAX_CMD_INPUT+1));
memset(&field_1A6F[0],0,129);
}
//----------------------------------------------------
// MATCH
CCmdWindow::~CCmdWindow()
{
}
//----------------------------------------------------
void CCmdWindow::ResetDialogControls(CDXUTDialog *pGameUI)
{
m_pGameUI = pGameUI;
@ -42,14 +49,92 @@ void CCmdWindow::ResetDialogControls(CDXUTDialog *pGameUI)
}
//----------------------------------------------------
// MATCH
void CCmdWindow::AddDefaultCmdProc(CMDPROC cmdDefault)
void CCmdWindow::GetDialogSize(RECT *pRect)
{
m_pDefaultCmd = cmdDefault;
memset(pRect,0,sizeof(RECT));
if(m_pGameUI) {
pRect->right = m_pGameUI->GetWidth();
pRect->bottom = m_pGameUI->GetHeight();
}
}
//----------------------------------------------------
// MATCH
void CCmdWindow::Enable()
{
if(m_bEnabled) return;
if(m_pEditControl) {
RECT rect;
GetClientRect(pGame->GetMainWindowHwnd(), &rect);
m_pEditControl->SetEnabled(true);
m_pEditControl->SetVisible(true);
// TODO: CCmdWindow::Enable()
}
m_bEnabled = TRUE;
}
//----------------------------------------------------
void CCmdWindow::Disable()
{
if(!m_bEnabled) return;
if(m_pEditControl) {
m_pEditControl->OnFocusOut();
m_pEditControl->SetEnabled(false);
m_pEditControl->SetVisible(false);
}
pGame->ToggleKeyInputsDisabled(0, TRUE);
m_bEnabled = FALSE;
}
//----------------------------------------------------
//----------------------------------------------------
void CCmdWindow::ProcessInput()
{
if(!m_pEditControl) return;
strncpy(m_szInputBuffer,m_pEditControl->GetTextA(),MAX_CMD_INPUT);
m_szInputBuffer[MAX_CMD_INPUT] = '\0';
// TODO: CCmdWindow::ProcessInput()
}
//----------------------------------------------------
CMDPROC CCmdWindow::GetCmdHandler(PCHAR szCmdName)
{
int x=0;
while(x!=m_iCmdCount) {
if(!stricmp(szCmdName,m_szCmdNames[x])) {
return m_pCmds[x];
}
x++;
}
return NULL;
}
//----------------------------------------------------
void CCmdWindow::AddDefaultCmdProc(CMDPROC cmdDefault)
{
m_pDefaultCmd = cmdDefault;
}
//----------------------------------------------------
void CCmdWindow::AddCmdProc(PCHAR szCmdName, CMDPROC cmdHandler)
{
if(m_iCmdCount < MAX_CMDS && (strlen(szCmdName) < MAX_CMD_STRLEN)) {
@ -61,3 +146,12 @@ void CCmdWindow::AddCmdProc(PCHAR szCmdName, CMDPROC cmdHandler)
//----------------------------------------------------

View File

@ -1,12 +1,15 @@
#pragma once
#define MAX_CMD_INPUT 128
#define MAX_CMDS 144
#define MAX_CMD_STRLEN 32
typedef void (__cdecl *CMDPROC)(PCHAR);
class CCmdWindow // size: 6908
//----------------------------------------------------
class CCmdWindow
{
private:
@ -20,21 +23,31 @@ public:
CHAR m_szCmdNames[MAX_CMDS][MAX_CMD_STRLEN+1];
int m_iCmdCount;
int field_14E0;
char field_14E4[129];
BOOL m_bEnabled;
char m_szInputBuffer[MAX_CMD_INPUT + 1];
char field_1565[1290];
char field_1A6F[129];
int field_1AF0;
int field_1AF4;
CMDPROC m_pDefaultCmd; // used when no command specifier was
// used (ie. a normal chat message)
void GetDialogSize(RECT *pRect);
CCmdWindow(IDirect3DDevice9 *pD3DDevice);
void Enable();
void Disable();
void ProcessInput();
CMDPROC GetCmdHandler(PCHAR szCmdName);
void AddDefaultCmdProc(CMDPROC cmdDefault);
void AddCmdProc(PCHAR szCmdName, CMDPROC cmdHandler);
void ResetDialogControls(CDXUTDialog *pGameUI);
CCmdWindow(IDirect3DDevice9 *pD3DDevice);
~CCmdWindow();
};
//----------------------------------------------------
// EOF

View File

@ -16,6 +16,14 @@ CNewPlayerTags::~CNewPlayerTags()
SAFE_DELETE(m_pSprite);
}
void CNewPlayerTags::DeleteDeviceObjects()
{
SAFE_RELEASE(m_pStates);
if(m_pSprite)
m_pSprite->OnLostDevice();
}
void CNewPlayerTags::RestoreDeviceObjects()
{
if(m_pSprite)

View File

@ -12,5 +12,6 @@ public:
CNewPlayerTags(IDirect3DDevice9* pDevice);
~CNewPlayerTags();
void DeleteDeviceObjects();
void RestoreDeviceObjects();
};