📄 characterprocess.cpp
字号:
*pszSex = '\0';
pszSex++;
pxChInfo->Gender = atoi(pszSex);
m_CList.AddNode(pxChInfo);
m_Image.NewSetIndex(IDX_IMG_MALE_WAR + m_CList.GetCurrentData()->Gender + (m_CList.GetCurrentData()->Class * 2)) ;
CHRRECT* pxChRect = new CHRRECT;
pxChRect->nLeft = nChrPos[i + tdm.nRecog - 1];
pxChRect->nTop = 280;
pxChRect->nWidth = m_Image.m_lpstNewCurrWilImageInfo->shWidth;
pxChRect->nHeight = m_Image.m_lpstNewCurrWilImageInfo->shHeight;
m_CRectList.AddNode(pxChRect);
if (pszNext = strchr(pszSex, '/'))
{
pszNext++;
if (*pszNext != '\0')
nPos = pszNext - &szDecodeMsg[0];
}
}
}
}
} // For
m_xSelectChr.Create(&m_Image,&m_CList,&m_CRectList,tdm.nRecog);
m_xSelectChr.OpenWnd ();
}
}
break;
}
case SM_NEWCHR_SUCCESS: // New character Create Success
{
m_Progress = PRG_CREA_TO_SEL;
g_xClientSocket.OnQueryChar();
break;
}
case SM_STARTPLAY: // Start Game
{
char szDecodeMsg[512];
char *pszIP = &szDecodeMsg[0], *pszPort;
ZeroMemory(szDecodeMsg, sizeof(szDecodeMsg));
fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
if (pszPort = strchr(pszIP, '/'))
{
*pszPort = '\0';
pszPort++;
strcpy(g_szServerIP, pszIP);
g_nServerPort = atoi(pszPort);
g_xClientSocket.DisconnectToServer();
m_xSelectChr.m_nRenderState = 2; // Set Select Renderstaet to Ready startgame
}
break;
}
}
/* _TDEFAULTMESSAGE tdm;
char szDecodeMsg[256];
char szTmpDecodeMsg[512];
ZeroMemory(szTmpDecodeMsg, 512);
strcpy(szTmpDecodeMsg, pszMsg);
char *pszData = &szTmpDecodeMsg[1];
fnDecodeMessage(&tdm, pszData);
if(lstrlen(szTmpDecodeMsg) >= DEFBLOCKSIZE + 1)
fnDecode6BitBuf((szTmpDecodeMsg + DEFBLOCKSIZE + 1), szDecodeMsg, sizeof(szDecodeMsg));
switch(tdm.wIdent)
{
case SM_QUERYCHR: // Getting character List
{
pCHRINFO ChrInfo;
pCHRRECT tChRect;
m_CRectList.ClearAllNodes();
m_CList.ClearAllNodes();
if(tdm.wParam!=0) // 纳腐磐啊 粮犁 且版快
{
ChrInfo = new CHRINFO[tdm.wParam]; // 罐酒柯 百荐父怒 纳腐磐 沥焊 甫 父电促.
m_SelectChr = SELECT_FIRST;
m_ChrCount = tdm.wParam;
fnDecode6BitBuf((szTmpDecodeMsg + DEFBLOCKSIZE + 1), (char*)ChrInfo, sizeof(CHRINFO)*(tdm.wParam));
pCHRINFO tChInfo;
for(int i = 0 ;i<tdm.wParam;i++)
{
// 纳腐磐啊 粮犁 窍瘤 臼阑版快?
// 纳腐磐 Info
tChInfo = new CHRINFO;
strcpy(tChInfo->ChrName,ChrInfo[i].ChrName);
tChInfo->Class=ChrInfo[i].Class;
tChInfo->Gender=ChrInfo[i].Gender;
tChInfo->Level=ChrInfo[i].Level;
m_CList.AddNode(tChInfo);
// 纳腐磐 Rect 荐沥 且巴 // 烙矫
tChRect = new CHRRECT;
m_tImage1.NewSetIndex((2-(INT)(tChInfo->Class)));
switch(tdm.wParam)
{
case 1:
tChRect->nLeft = 350;
break;
case 2:
{
switch(i)
{
case 0:
tChRect->nLeft = 280;
break;
case 1:
tChRect->nLeft = 420;
break;
}
break;
}
case 3:
{
switch(i)
{
case 0:
tChRect->nLeft = 180;
break;
case 1:
tChRect->nLeft = 350;
break;
case 2:
tChRect->nLeft = 480;
break;
}
break;
}
}
tChRect->nTop = 250+((2-tChInfo->Class)/2)*30;
tChRect->nWidth = m_tImage1.m_lpstNewCurrWilImageInfo->shWidth;
tChRect->nHeight = m_tImage1.m_lpstNewCurrWilImageInfo->shHeight;
m_CRectList.AddNode(tChRect);
}
delete ChrInfo;
}
else
{ // 纳腐磐啊 粮犁 窍瘤 臼阑版快绰?
m_SelectChr = SELECT_NONE;
}
break;
}
case SM_NEWCHR_SUCCESS: // New character Create Success
{
m_Progress = PRG_CREA_TO_SEL;
g_xClientSocket.OnQueryChar();
break;
}
case SM_NEWCHR_FAIL: // New character Create Fail
{
m_nMessage = tdm.wParam; // Message Parameter 傈崔
SetErrorMessage(m_nMessage,m_szErrorMsg);
m_xMsgBox.ShowMessageBox(m_szErrorMsg,1,_WNDIMGINDX_MSGBOX1);
m_Progress = PRG_CREATE_CHAR; // Create New Character
}
break;
case SM_DELCHR_SUCCESS: // Delete character Success
g_xClientSocket.OnQueryChar();
m_Progress = PRG_CHAR_SELE; // Character Selection
break;
case SM_DELCHR_FAIL: // Delete character Fail
{
m_nMessage = tdm.wParam;
SetErrorMessage(m_nMessage,m_szErrorMsg);
m_xMsgBox.ShowMessageBox(m_szErrorMsg,1,_WNDIMGINDX_MSGBOX1);
// 1. 粮犁窍瘤 臼绰 纳腐磐甫 瘤匡版快
// 2. 舅荐 绝绰 Error
// 3.
m_Progress = PRG_CHAR_SELE; // Character Selection
}
break;
case SM_STARTPLAY: // Start Game
{
int Count;
Count = strlen(szDecodeMsg);
for(int i = 0 ; i< Count ; i++)
{
if(szDecodeMsg[i]==':')
{
strncpy(g_szServerIP,szDecodeMsg,i);
g_nServerPort = atoi(szDecodeMsg+i+1);
}
}
g_xClientSocket.DisconnectToServer(); // Char sever客狼 楷搬 辆丰
m_Progress=PRG_SEL_TO_GAME;
break;
}
case SM_STARTFAIL:
{ // Fail to start game
m_Progress = PRG_QUIT; // Quit for Some Reason
SendMessage(g_xMainWnd.GetSafehWnd(), WM_DESTROY, NULL, NULL);
}
break;
case SM_QUERYCHR_FAIL:
{ // Getting character List Fail
m_Progress = PRG_QUIT; // Quit for Some Reason
SendMessage(g_xMainWnd.GetSafehWnd(), WM_DESTROY, NULL, NULL);
}
break;
case SM_OUTOFCONNECTION:
{ // Connection Lost(close Connection)
m_Progress = PRG_QUIT; // Quit for Some Reason
SendMessage(g_xMainWnd.GetSafehWnd(), WM_DESTROY, NULL, NULL);
}
break;
}
return 0L; */
}
/**/
VOID CCharacterProcess::RenderScene(INT nLoopTime)
{
m_xBGround.Render(nLoopTime);
switch(m_Progress)
{
case PRG_CHAR_SELE:
{
ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE);
switch(m_xSelectChr.m_nRenderState)
{
case 11: // Zoom in
{
m_xBGround.SetRenderState(_RENDER_AVI_IN);
m_Progress = PRG_SEL_TO_CREA;
m_xSelectChr.CloseWnd();
break;
}
case 12: // Zoom Out
{
m_xBGround.SetRenderState(_RENDER_AVI_START);
m_Progress = PRG_SEL_TO_GAME;
m_xSelectChr.CloseWnd();
break;
}
case 19: // Select;
{
m_xSelectChr.m_nRenderState = 0;
}
}
m_xSelectChr.Render(nLoopTime);
break;
}
case PRG_SEL_TO_CREA:
ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE);
if(m_xBGround.GetRenderState()==_RENDER_STILL_2)
m_Progress = PRG_CREATE_CHAR;
break;
case PRG_CREATE_CHAR:
ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_SHOW);
RenderCharCreate(nLoopTime);
break;
case PRG_CREA_TO_SEL:
ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE);
if(m_xBGround.GetRenderState() == _RENDER_STILL_1)
{ m_Progress = PRG_CHAR_SELE;
m_xSelectChr.OpenWnd();
}
break;
case PRG_SEL_TO_GAME:
ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE);
if(m_xBGround.GetRenderState()==_RENDER_STARTGAME)
{ m_Progress = PRG_PLAY_GAME; // Play Game
SetNextProc();
}
break;
}
m_xMsgBox.RenderMessageBox(0);
}
VOID CCharacterProcess::ShowStatus(INT nStartX, INT nStartY)
{
/* TCHAR szBuff[MAX_PATH];
sprintf(szBuff, "Character Procedure");*/
CWHDefProcess::ShowStatus(nStartX, nStartY+20);
}
VOID CCharacterProcess::RenderCharCreate(INT nLoopTime)
{
POINT nPos[] = { {120, 88}, {120, 85}, {150, 108}};
// int i ;
MoveWindow(g_xChatEditBox.GetSafehWnd(),
g_xMainWnd.m_rcWindow.left+POS_NAME_X,
g_xMainWnd.m_rcWindow.top+POS_NAME_Y, 75, 15, TRUE);
/* for (i = ID_CREATE_CHR_OK_BTN ; i <= ID_CREATE_CHR_TAO_BTN; i++)
{
m_Image.NewSetIndex(m_pBtn[i].m_nButtonID + m_pBtn[i].m_nState -1);
g_xMainWnd.DrawWithImageForComp(m_pBtn[i].m_Rect.left, m_pBtn[i].m_Rect.top,
m_Image.m_lpstNewCurrWilImageInfo->shWidth,
m_Image.m_lpstNewCurrWilImageInfo->shHeight
, (WORD*)(m_Image.m_pbCurrImage));
}
*/
// 烙矫~!
m_Image.NewSetIndex(IMG_IDX_WAR_MALE_CREATE + m_SelectSex + m_SelectJob * 2);
g_xMainWnd.DrawWithImageForComp(nPos[m_SelectJob].x,nPos[m_SelectJob].y
,m_Image.m_lpstNewCurrWilImageInfo->shWidth,m_Image.m_lpstNewCurrWilImageInfo->shHeight
,(WORD*)(m_Image.m_pbCurrImage));
}
VOID CCharacterProcess::SetErrorMessage(INT nMsg,CHAR* szMgs)
{
HINSTANCE hLib;
hLib = LoadLibrary(MESSAGE_DLL_1); // Load Dll
if(nMsg!=99 && nMsg!=0)
{
LoadString(hLib,(nMsg+199),szMgs,512);
}
else
{
if(nMsg!=0)
LoadString(hLib,9999,szMgs,512);
else
ZeroMemory(szMgs,512);
}
FreeLibrary(hLib);
}
BOOL CCharacterProcess::MessageBoxProcess(LPARAM lParam)
{
HRESULT hResult;
POINT ptMouse;
ptMouse.x = LOWORD(lParam);
ptMouse.y = HIWORD(lParam);
hResult = m_xMsgBox.OnButtonUp(ptMouse);
if((hResult&HAVE_EDITOBOX)==HAVE_EDITOBOX)
{
// edit box exist
switch(hResult^HAVE_EDITOBOX)
{
case CLICK_OK:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
case CLICK_YES:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
case CLICK_NO:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
case CLICK_CANCLE:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
}
}
else
{
// edit box not exist
switch(hResult)
{
case CLICK_OK:
{
m_xMsgBox.HideMessageBox();
switch(m_nMessage)
{
case 103: //
{
PostQuitMessage(NULL);
m_nMessage = 0;
break;
}
}
break;
}
case CLICK_YES:
{
m_xMsgBox.HideMessageBox();
switch(m_nMessage)
{
case 5:
{
m_CList.MoveCurrentToTop();
m_CList.MoveNode(m_xSelectChr.m_nSelectChr);
g_xClientSocket.OnDelChar(m_CList.GetCurrentData()->ChrName);
g_xClientSocket.OnQueryChar();
m_ChrCount =0 ;
break;
}
}
break;
}
case CLICK_NO:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
case CLICK_CANCLE:
{
m_xMsgBox.HideMessageBox();
/* switch(m_nMessage)
{
}*/
break;
}
}
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -