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>
221 lines
6.7 KiB
C++
221 lines
6.7 KiB
C++
// HumanChrSelect1.cpp: implementation of the CHumanChrSelect1 class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "ClientMain.h"
|
|
#include "GUITextEdit.h"
|
|
#include "FrameTimer.h"
|
|
#include "HumanChrSelect1.h"
|
|
#include "WinInput.h"
|
|
#include "HumanGUI.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CHumanChrSelect1::CHumanChrSelect1()
|
|
{
|
|
|
|
}
|
|
|
|
CHumanChrSelect1::~CHumanChrSelect1()
|
|
{
|
|
|
|
}
|
|
|
|
BOOL CHumanChrSelect1::Init(unsigned short x, unsigned short y)
|
|
{
|
|
CSprite *lpSprite;
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(0, 499, 0, 0, 128, 101, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(128, 521, 206, 102, 233, 146, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(14, 14, 0, 102, 206, 182, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(153, 135, 0, 182, 130, 216, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(533, 67, 0, 182, 130, 216, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
lpSprite = new CSprite;
|
|
lpSprite->Create(449, 321, 0, 182, 130, 216, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
m_lstSprite.push_back(lpSprite);
|
|
|
|
CGUIButton *lpButton;
|
|
lpButton = new CGUIButton;
|
|
lpButton->m_nMethod = BUTTON_NORMAL;
|
|
lpButton->m_lpNormalButton = new CSprite;
|
|
lpButton->m_lpNormalButton->Create(33, 526, 144, 0, 256, 34, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
lpButton->m_lpOnMouseButton = new CSprite;
|
|
lpButton->m_lpOnMouseButton->Create(33, 526, 144, 34, 256, 68, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
lpButton->m_lpClickMouseButton = new CSprite;
|
|
lpButton->m_lpClickMouseButton->Create(33, 526, 144, 68, 256, 102, g_ClientMain.m_lpInterface->m_lstTexture[0]);
|
|
lpButton->SetTooltip(&m_TooltipManager, "");
|
|
lpButton->SetMove(x, y);
|
|
m_ButtonManager.AddButton(lpButton);
|
|
|
|
m_dwWindowKind = WINDOW_FIX;
|
|
|
|
m_rcWindowSize.left = x; m_rcWindowSize.top = y;
|
|
m_rcWindowSize.right = x; m_rcWindowSize.bottom = y;
|
|
|
|
m_rcMoveEdge.left = x; m_rcMoveEdge.top = y;
|
|
m_rcMoveEdge.right = x; m_rcMoveEdge.bottom = y;
|
|
|
|
InitValue();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CHumanChrSelect1::InitValue(void)
|
|
{
|
|
m_dwOverChrID = 0xFFFFFFFF;
|
|
m_dwEndTimer = 0xFFFFFFFF;
|
|
g_ClientMain.m_bSelectChar = FALSE;
|
|
}
|
|
|
|
BOOL CHumanChrSelect1::Update(BOOL &bClick, BOOL &bEdge)
|
|
{
|
|
POINT *ptMousePos = g_DeviceInput.GetMousePosition();
|
|
|
|
m_ButtonManager.Update();
|
|
m_TooltipManager.Update();
|
|
|
|
m_dwOverChrID = g_ClientMain.GetScreenPosChr(*ptMousePos, 10000, 0); // TARGET_SELECTCHAR = 10000
|
|
|
|
BOOL bIsExist = FALSE;
|
|
m_dwOverChr = 0xFFFFFFFF;
|
|
if(m_dwOverChrID != 0xFFFFFFFF)
|
|
{
|
|
for(long i = 0; i < 3; i++)
|
|
{
|
|
if(m_dwOverChrID == g_CharacterData.m_lstCharData[i]->m_dwChrID)
|
|
{
|
|
if(g_ClientMain.m_scLoginChar[i].UID) bIsExist = TRUE;
|
|
m_dwOverChr = i;
|
|
}
|
|
}
|
|
}
|
|
if(!bIsExist) m_dwOverChrID = 0xFFFFFFFF;
|
|
|
|
if(m_dwEndTimer != 0xFFFFFFFF)
|
|
{
|
|
if(g_ClientMain.m_bSelectChar) return TRUE;
|
|
|
|
if(CFrameTimer::GetUpdateTimer(m_dwEndTimer) >= 1.0f)
|
|
{
|
|
if(g_ClientMain.m_scLoginChar[g_ClientMain.m_dwSelectChr].UID)
|
|
g_ClientMain.m_dwClientState = CHRSELECT_INITSTART;
|
|
else
|
|
g_ClientMain.m_dwClientState = CHRSELECT_INITCREATE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
if(g_DeviceInput.GetIsLeftMouseDBClick())
|
|
{
|
|
if(g_ClientMain.m_scLoginChar[g_ClientMain.m_dwSelectChr].UID)
|
|
{
|
|
g_ClientMain.m_Network.CharSelect(g_ClientMain.m_scLoginChar[g_ClientMain.m_dwSelectChr].UID);
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
if(m_dwOverChr != 0xFFFFFFFF && g_DeviceInput.GetIsLeftMouseDown())
|
|
{
|
|
char strCameraPath[MAX_PATH];
|
|
|
|
m_dwEndTimer = CFrameTimer::Regist(1.0f);
|
|
|
|
g_ClientMain.m_dwSelectChr = m_dwOverChr;
|
|
|
|
switch(m_dwOverChr)
|
|
{
|
|
case 0:
|
|
sprintf(strCameraPath, "%s\\1stCSzi.zca", g_ClientMain.m_strClientPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Unload();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Load(strCameraPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->SetTotalAniTime(1000.0f);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->StartPlay();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->PlayAnimate();
|
|
break;
|
|
|
|
case 1:
|
|
sprintf(strCameraPath, "%s\\2ndCSzi.zca", g_ClientMain.m_strClientPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Unload();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Load(strCameraPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->SetTotalAniTime(1000.0f);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->StartPlay();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->PlayAnimate();
|
|
break;
|
|
|
|
case 2:
|
|
sprintf(strCameraPath, "%s\\3rdCSzi.zca", g_ClientMain.m_strClientPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Unload();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->Load(strCameraPath);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->SetTotalAniTime(1000.0f);
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->StartPlay();
|
|
g_ClientMain.m_lpSceneManager->GetCamera()->PlayAnimate();
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
if(m_ButtonManager.m_lstButton[0]->m_nState == BUTTON_CLICK)
|
|
{
|
|
SendMessage(g_ClientMain.m_hWnd, WM_DESTROY, 0, 0);
|
|
g_ClientMain.m_dwClientMode = CLIENT_END;
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CHumanChrSelect1::Render(LPDIRECT3DDEVICE8 lpD3DDevice)
|
|
{
|
|
if(m_dwEndTimer != 0xFFFFFFFF) return;
|
|
|
|
m_lstSprite[0]->Render(lpD3DDevice, m_cAlpha);
|
|
m_lstSprite[1]->Render(lpD3DDevice, m_cAlpha);
|
|
|
|
for(long i = 0; i < 3; i++)
|
|
{
|
|
if(!g_ClientMain.m_scLoginChar[i].UID)
|
|
{
|
|
m_lstSprite[3 + i]->Render(lpD3DDevice, m_cAlpha);
|
|
}
|
|
}
|
|
|
|
if(m_dwOverChrID != 0xFFFFFFFF)
|
|
{
|
|
m_lstSprite[2]->Render(lpD3DDevice, m_cAlpha);
|
|
RECT rcRect;
|
|
char Temp[MAX_PATH];
|
|
SetRect(&rcRect, 105, 23, 206, 36);
|
|
g_TextEdit.DrawText(g_ClientMain.m_scLoginChar[m_dwOverChr].Name, &rcRect, DT_LEFT | DT_VCENTER, D3DCOLOR_RGBA(255, 255, 255, m_cAlpha));
|
|
sprintf(Temp, "%d", g_ClientMain.m_scLoginChar[m_dwOverChr].Level);
|
|
SetRect(&rcRect, 105, 39, 206, 52);
|
|
g_TextEdit.DrawText(Temp, &rcRect, DT_LEFT | DT_VCENTER, D3DCOLOR_RGBA(255, 255, 255, m_cAlpha));
|
|
sprintf(Temp, "%d", g_ClientMain.m_scLoginChar[m_dwOverChr].Merits);
|
|
SetRect(&rcRect, 105, 55, 206, 68);
|
|
g_TextEdit.DrawText(Temp, &rcRect, DT_LEFT | DT_VCENTER, D3DCOLOR_RGBA(255, 255, 255, m_cAlpha));
|
|
SetRect(&rcRect, 105, 71, 206, 84);
|
|
g_TextEdit.DrawText(g_ClientMain.m_lpCommonInterface->GetClassName(g_ClientMain.m_scLoginChar[m_dwOverChr].Class),
|
|
&rcRect, DT_LEFT | DT_VCENTER, D3DCOLOR_RGBA(255, 255, 255, m_cAlpha));
|
|
}
|
|
|
|
m_ButtonManager.Render(lpD3DDevice, m_cAlpha);
|
|
}
|