Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
247 lines
8.2 KiB
C++
247 lines
8.2 KiB
C++
// HumanRespawn.cpp: implementation of the CHumanRespawn class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "ClientMain.h"
|
|
#include "HumanRespawn.h"
|
|
#include "WinInput.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CHumanRespawn::CHumanRespawn()
|
|
{
|
|
|
|
}
|
|
|
|
CHumanRespawn::~CHumanRespawn()
|
|
{
|
|
|
|
}
|
|
|
|
BOOL CHumanRespawn::Init(unsigned short x, unsigned short y)
|
|
{
|
|
m_bShow = FALSE;
|
|
|
|
m_dwWindowKind = WINDOW_FIX;
|
|
|
|
m_rcWindowSize.left = x; m_rcWindowSize.top = y;
|
|
|
|
m_rcMoveEdge.left = x; m_rcMoveEdge.top = y;
|
|
|
|
InitValue();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CHumanRespawn::InitValue(void)
|
|
{
|
|
m_cSelectZone = 0;
|
|
|
|
ZeroMemory(&m_aryHumanRespawn, sizeof(RespawnPoint) * 30);
|
|
|
|
m_aryHumanRespawn[3].m_dwSpawnNumber = 3;
|
|
m_aryHumanRespawn[3].m_wPutX[0] = 12; m_aryHumanRespawn[3].m_wPutY[0] = 127;
|
|
m_aryHumanRespawn[3].m_psPoint[0].fPointX = 868.65f;
|
|
m_aryHumanRespawn[3].m_psPoint[0].fPointY = 57.28f;
|
|
m_aryHumanRespawn[3].m_psPoint[0].fPointZ = 1397.06f;
|
|
|
|
m_aryHumanRespawn[3].m_wPutX[1] = 76; m_aryHumanRespawn[3].m_wPutY[1] = 37;
|
|
m_aryHumanRespawn[3].m_psPoint[1].fPointX = 1217.44f;
|
|
m_aryHumanRespawn[3].m_psPoint[1].fPointY = 48.62f;
|
|
m_aryHumanRespawn[3].m_psPoint[1].fPointZ = 1827.82f;
|
|
|
|
m_aryHumanRespawn[3].m_wPutX[2] = 146; m_aryHumanRespawn[3].m_wPutY[2] = 74;
|
|
m_aryHumanRespawn[3].m_psPoint[2].fPointX = 1526.42f;
|
|
m_aryHumanRespawn[3].m_psPoint[2].fPointY = 33.20f;
|
|
m_aryHumanRespawn[3].m_psPoint[2].fPointZ = 1685.55f;
|
|
|
|
m_aryHumanRespawn[6].m_dwSpawnNumber = 3;
|
|
m_aryHumanRespawn[6].m_wPutX[0] = 12; m_aryHumanRespawn[6].m_wPutY[0] = 127;
|
|
m_aryHumanRespawn[6].m_psPoint[0].fPointX = 868.65f;
|
|
m_aryHumanRespawn[6].m_psPoint[0].fPointY = 57.28f;
|
|
m_aryHumanRespawn[6].m_psPoint[0].fPointZ = 1397.06f;
|
|
|
|
m_aryHumanRespawn[6].m_wPutX[1] = 76; m_aryHumanRespawn[6].m_wPutY[1] = 37;
|
|
m_aryHumanRespawn[6].m_psPoint[1].fPointX = 1217.44f;
|
|
m_aryHumanRespawn[6].m_psPoint[1].fPointY = 48.62f;
|
|
m_aryHumanRespawn[6].m_psPoint[1].fPointZ = 1827.82f;
|
|
|
|
m_aryHumanRespawn[6].m_wPutX[2] = 146; m_aryHumanRespawn[6].m_wPutY[2] = 74;
|
|
m_aryHumanRespawn[6].m_psPoint[2].fPointX = 1526.42f;
|
|
m_aryHumanRespawn[6].m_psPoint[2].fPointY = 33.20f;
|
|
m_aryHumanRespawn[6].m_psPoint[2].fPointZ = 1685.55f;
|
|
|
|
ZeroMemory(&m_aryAkhanRespawn, sizeof(RespawnPoint) * 30);
|
|
|
|
m_aryAkhanRespawn[3].m_dwSpawnNumber = 3;
|
|
m_aryAkhanRespawn[3].m_wPutX[0] = 100; m_aryAkhanRespawn[3].m_wPutY[0] = 172;
|
|
m_aryAkhanRespawn[3].m_psPoint[0].fPointX = 1310.52f;
|
|
m_aryAkhanRespawn[3].m_psPoint[0].fPointY = 28.53f;
|
|
m_aryAkhanRespawn[3].m_psPoint[0].fPointZ = 1168.81f;
|
|
|
|
m_aryAkhanRespawn[3].m_wPutX[1] = 163; m_aryAkhanRespawn[3].m_wPutY[1] = 209;
|
|
m_aryAkhanRespawn[3].m_psPoint[1].fPointX = 1619.65f;
|
|
m_aryAkhanRespawn[3].m_psPoint[1].fPointY = 49.31f;
|
|
m_aryAkhanRespawn[3].m_psPoint[1].fPointZ = 998.32f;
|
|
|
|
m_aryAkhanRespawn[3].m_wPutX[2] = 229; m_aryAkhanRespawn[3].m_wPutY[2] = 113;
|
|
m_aryAkhanRespawn[3].m_psPoint[2].fPointX = 1976.27f;
|
|
m_aryAkhanRespawn[3].m_psPoint[2].fPointY = 53.56f;
|
|
m_aryAkhanRespawn[3].m_psPoint[2].fPointZ = 1464.75f;
|
|
|
|
m_aryAkhanRespawn[6].m_dwSpawnNumber = 3;
|
|
m_aryAkhanRespawn[6].m_wPutX[0] = 100; m_aryAkhanRespawn[6].m_wPutY[0] = 172;
|
|
m_aryAkhanRespawn[6].m_psPoint[0].fPointX = 1310.52f;
|
|
m_aryAkhanRespawn[6].m_psPoint[0].fPointY = 28.53f;
|
|
m_aryAkhanRespawn[6].m_psPoint[0].fPointZ = 1168.81f;
|
|
|
|
m_aryAkhanRespawn[6].m_wPutX[1] = 163; m_aryAkhanRespawn[6].m_wPutY[1] = 209;
|
|
m_aryAkhanRespawn[6].m_psPoint[1].fPointX = 1619.65f;
|
|
m_aryAkhanRespawn[6].m_psPoint[1].fPointY = 49.31f;
|
|
m_aryAkhanRespawn[6].m_psPoint[1].fPointZ = 998.32f;
|
|
|
|
m_aryAkhanRespawn[6].m_wPutX[2] = 229; m_aryAkhanRespawn[6].m_wPutY[2] = 113;
|
|
m_aryAkhanRespawn[6].m_psPoint[2].fPointX = 1976.27f;
|
|
m_aryAkhanRespawn[6].m_psPoint[2].fPointY = 53.56f;
|
|
m_aryAkhanRespawn[6].m_psPoint[2].fPointZ = 1464.75f;
|
|
}
|
|
|
|
BOOL CHumanRespawn::Update(BOOL &bClick, BOOL &bEdge)
|
|
{
|
|
if(g_DeviceInput.InRect(m_rcWindowSize.left, m_rcWindowSize.top, m_rcWindowSize.right, m_rcWindowSize.bottom))
|
|
{
|
|
bEdge = TRUE;
|
|
|
|
if(g_DeviceInput.GetIsLeftMouseDown() || g_DeviceInput.GetIsMiddleMouseDown() || g_DeviceInput.GetIsRightMouseDown() ||
|
|
g_DeviceInput.GetIsLeftMousePress() || g_DeviceInput.GetIsMiddleMousePress() || g_DeviceInput.GetIsRightMousePress() ||
|
|
g_DeviceInput.GetIsLeftMouseUp() || g_DeviceInput.GetIsMiddleMouseUp() || g_DeviceInput.GetIsRightMouseUp())
|
|
{
|
|
bClick = TRUE;
|
|
}
|
|
}
|
|
|
|
m_ButtonManager.Update();
|
|
m_TooltipManager.Update();
|
|
|
|
if(m_dwKind == NATION_HUMAN)
|
|
{
|
|
for(unsigned long i = 0; i < m_aryHumanRespawn[m_cSelectZone].m_dwSpawnNumber; i++)
|
|
{
|
|
if(m_ButtonManager.m_lstButton[i]->m_nState == BUTTON_CLICK)
|
|
{
|
|
g_ClientMain.m_Network.m_nsNetworkState = NS_RESPAWN;
|
|
g_ClientMain.m_lpInterface->DestroyRespawn();
|
|
g_ClientMain.m_Network.m_pSocket->CharRespawn(g_ClientMain.m_dwMyChrID, 1, m_aryHumanRespawn[m_cSelectZone].m_psPoint[i]);
|
|
break;
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for(unsigned long i = 0; i < m_aryAkhanRespawn[m_cSelectZone].m_dwSpawnNumber; i++)
|
|
{
|
|
if(m_ButtonManager.m_lstButton[i]->m_nState == BUTTON_CLICK)
|
|
{
|
|
g_ClientMain.m_Network.m_nsNetworkState = NS_RESPAWN;
|
|
g_ClientMain.m_lpInterface->DestroyRespawn();
|
|
g_ClientMain.m_Network.m_pSocket->CharRespawn(g_ClientMain.m_dwMyChrID, 1, m_aryAkhanRespawn[m_cSelectZone].m_psPoint[i]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CHumanRespawn::ShowWindow(BOOL bShow)
|
|
{
|
|
m_bShow = bShow;
|
|
|
|
if(!bShow)
|
|
{
|
|
m_TooltipManager.DestroyAllTooltip();
|
|
m_ButtonManager.DestroyAllButton();
|
|
|
|
{
|
|
vector<CSprite *>::iterator it;
|
|
for(it = m_lstSprite.begin(); it != m_lstSprite.end(); it++)
|
|
{
|
|
delete (*it);
|
|
}
|
|
m_lstSprite.clear();
|
|
}
|
|
|
|
{
|
|
vector<CTexture *>::iterator it;
|
|
for(it = m_lstTexture.begin(); it != m_lstTexture.end(); it++)
|
|
{
|
|
delete (*it);
|
|
}
|
|
m_lstTexture.clear();
|
|
}
|
|
}
|
|
}
|
|
|
|
void CHumanRespawn::Render(LPDIRECT3DDEVICE8 lpD3DDevice)
|
|
{
|
|
if(m_lstSprite[0])
|
|
{
|
|
m_lstSprite[0]->Render(lpD3DDevice);
|
|
}
|
|
|
|
m_ButtonManager.Render(lpD3DDevice);
|
|
}
|
|
|
|
void CHumanRespawn::SetRespawn(unsigned char cZoneNum, unsigned long dwKind)
|
|
{
|
|
m_cSelectZone = cZoneNum;
|
|
m_dwKind = dwKind;
|
|
|
|
if(m_dwKind == NATION_HUMAN)
|
|
{
|
|
CGUIButton *lpButton;
|
|
for(unsigned long i = 0; i < m_aryHumanRespawn[cZoneNum].m_dwSpawnNumber; i++)
|
|
{
|
|
lpButton = new CGUIButton;
|
|
lpButton->m_nMethod = BUTTON_SIMPLE;
|
|
lpButton->m_lpNormalButton = new CSprite;
|
|
lpButton->m_lpNormalButton->Create(m_aryHumanRespawn[cZoneNum].m_wPutX[i], m_aryHumanRespawn[cZoneNum].m_wPutY[i], 199, 153, 212, 166, g_ClientMain.m_lpInterface->m_lstTexture[26]);
|
|
lpButton->m_lpClickMouseButton = new CSprite;
|
|
lpButton->m_lpClickMouseButton->Create(m_aryHumanRespawn[cZoneNum].m_wPutX[i], m_aryHumanRespawn[cZoneNum].m_wPutY[i], 199, 169, 212, 182, g_ClientMain.m_lpInterface->m_lstTexture[26]);
|
|
lpButton->SetMove(m_rcWindowSize.left, m_rcWindowSize.top);
|
|
m_ButtonManager.AddButton(lpButton);
|
|
}
|
|
} else
|
|
{
|
|
CGUIButton *lpButton;
|
|
for(unsigned long i = 0; i < m_aryAkhanRespawn[cZoneNum].m_dwSpawnNumber; i++)
|
|
{
|
|
lpButton = new CGUIButton;
|
|
lpButton->m_nMethod = BUTTON_SIMPLE;
|
|
lpButton->m_lpNormalButton = new CSprite;
|
|
lpButton->m_lpNormalButton->Create(m_aryAkhanRespawn[cZoneNum].m_wPutX[i], m_aryAkhanRespawn[cZoneNum].m_wPutY[i], 183, 153, 196, 166, g_ClientMain.m_lpInterface->m_lstTexture[26]);
|
|
lpButton->m_lpClickMouseButton = new CSprite;
|
|
lpButton->m_lpClickMouseButton->Create(m_aryAkhanRespawn[cZoneNum].m_wPutX[i], m_aryAkhanRespawn[cZoneNum].m_wPutY[i], 183, 169, 196, 182, g_ClientMain.m_lpInterface->m_lstTexture[26]);
|
|
lpButton->SetMove(m_rcWindowSize.left, m_rcWindowSize.top);
|
|
m_ButtonManager.AddButton(lpButton);
|
|
}
|
|
}
|
|
|
|
CTexture::SetPath(INTERFACETEXTUREPATH);
|
|
CTexture *lpTexture;
|
|
lpTexture = new CTexture;
|
|
lpTexture->Load("Spon_BG.dds");
|
|
m_lstTexture.push_back(lpTexture);
|
|
|
|
CSprite *lpSprite;
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(m_rcWindowSize.left, m_rcWindowSize.top, 0, 0, 256, 256, m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
m_rcWindowSize.right = m_rcWindowSize.left + 256;
|
|
m_rcWindowSize.bottom = m_rcWindowSize.top + 256;
|
|
|
|
m_rcMoveEdge.right = m_rcWindowSize.left + 256;
|
|
m_rcMoveEdge.bottom = m_rcWindowSize.top + 20;
|
|
} |