// AkhanRespawn.cpp: implementation of the CAkhanRespawn class. // ////////////////////////////////////////////////////////////////////// #include "ClientMain.h" #include "AkhanRespawn.h" #include "WinInput.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CAkhanRespawn::CAkhanRespawn() { } CAkhanRespawn::~CAkhanRespawn() { } BOOL CAkhanRespawn::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 CAkhanRespawn::InitValue(void) { m_cSelectZone = 0; ZeroMemory(&m_aryRespawn, sizeof(RespawnPoint) * 30); m_aryRespawn[3].m_dwSpawnNumber = 3; m_aryRespawn[3].m_wPutX[0] = 100; m_aryRespawn[3].m_wPutY[0] = 172; m_aryRespawn[3].m_psPoint[0].fPointX = 1310.52f; m_aryRespawn[3].m_psPoint[0].fPointY = 28.53f; m_aryRespawn[3].m_psPoint[0].fPointZ = 1168.81f; m_aryRespawn[3].m_wPutX[1] = 163; m_aryRespawn[3].m_wPutY[1] = 209; m_aryRespawn[3].m_psPoint[1].fPointX = 1619.65f; m_aryRespawn[3].m_psPoint[1].fPointY = 49.31f; m_aryRespawn[3].m_psPoint[1].fPointZ = 998.32f; m_aryRespawn[3].m_wPutX[2] = 229; m_aryRespawn[3].m_wPutY[2] = 113; m_aryRespawn[3].m_psPoint[2].fPointX = 1976.27f; m_aryRespawn[3].m_psPoint[2].fPointY = 53.56f; m_aryRespawn[3].m_psPoint[2].fPointZ = 1464.75f; m_aryRespawn[6].m_dwSpawnNumber = 3; m_aryRespawn[6].m_wPutX[0] = 100; m_aryRespawn[6].m_wPutY[0] = 172; m_aryRespawn[6].m_psPoint[0].fPointX = 1310.52f; m_aryRespawn[6].m_psPoint[0].fPointY = 28.53f; m_aryRespawn[6].m_psPoint[0].fPointZ = 1168.81f; m_aryRespawn[6].m_wPutX[1] = 163; m_aryRespawn[6].m_wPutY[1] = 209; m_aryRespawn[6].m_psPoint[1].fPointX = 1619.65f; m_aryRespawn[6].m_psPoint[1].fPointY = 49.31f; m_aryRespawn[6].m_psPoint[1].fPointZ = 998.32f; m_aryRespawn[6].m_wPutX[2] = 229; m_aryRespawn[6].m_wPutY[2] = 113; m_aryRespawn[6].m_psPoint[2].fPointX = 1976.27f; m_aryRespawn[6].m_psPoint[2].fPointY = 53.56f; m_aryRespawn[6].m_psPoint[2].fPointZ = 1464.75f; } BOOL CAkhanRespawn::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(); for(unsigned long i = 0; i < m_aryRespawn[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_aryRespawn[m_cSelectZone].m_psPoint[i]); break; } } return TRUE; } void CAkhanRespawn::ShowWindow(BOOL bShow) { m_bShow = bShow; if(!bShow) { m_TooltipManager.DestroyAllTooltip(); m_ButtonManager.DestroyAllButton(); { vector::iterator it; for(it = m_lstSprite.begin(); it != m_lstSprite.end(); it++) { delete (*it); } m_lstSprite.clear(); } { vector::iterator it; for(it = m_lstTexture.begin(); it != m_lstTexture.end(); it++) { delete (*it); } m_lstTexture.clear(); } } } void CAkhanRespawn::Render(LPDIRECT3DDEVICE8 lpD3DDevice) { if(m_lstSprite[0]) { m_lstSprite[0]->Render(lpD3DDevice); } m_ButtonManager.Render(lpD3DDevice); } void CAkhanRespawn::SetRespawn(unsigned char cZoneNum) { m_cSelectZone = cZoneNum; CGUIButton *lpButton; for(unsigned long i = 0; i < m_aryRespawn[cZoneNum].m_dwSpawnNumber; i++) { lpButton = new CGUIButton; lpButton->m_nMethod = BUTTON_SIMPLE; lpButton->m_lpNormalButton = new CSprite; lpButton->m_lpNormalButton->Create(m_aryRespawn[cZoneNum].m_wPutX[i], m_aryRespawn[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_aryRespawn[cZoneNum].m_wPutX[i], m_aryRespawn[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; }