2137 lines
56 KiB
C++
2137 lines
56 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "TableFrameSink.h"
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
#define IDI_SEND_OVER 1 //<2F><><EFBFBD>Ƽ<EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDI_ROB_BANKER 2 //<2F><>ׯ<EFBFBD><D7AF>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDI_USER_CHIP 3 //<2F><>ע<EFBFBD><D7A2>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDI_USER_OPERATE 4 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDI_COMPARE_OVER 5 //<2F><><EFBFBD>Ƽ<EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDI_AUTO_SHOW_CARD 6 //<2F>Զ<EFBFBD>̯<EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD>;
|
|||
|
|
#define IDI_SHOW_SCORE 7 //<2F><><EFBFBD>㵯<EFBFBD><E3B5AF>ʱ<EFBFBD><CAB1>;
|
|||
|
|
|
|||
|
|
#define IDI_AUTO_SHOW_CARD_USER 10 //<2F><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
|
|||
|
|
#define IDT_SEND_OVER 10000 //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDT_ROB_BANKER 10000 //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
#define IDT_USER_CHIP 10000 //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
#define IDT_USER_OPERATE 20000 //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDT_COMPARE_OVER 20000 //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>;
|
|||
|
|
#define IDT_OFFLINE_TIME 120000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
|
|||
|
|
#define MIN_USER_CHIP 3
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>캯<EFBFBD><ECBAAF>;
|
|||
|
|
CTableFrameSink::CTableFrameSink()
|
|||
|
|
{
|
|||
|
|
//AllocConsole();
|
|||
|
|
//freopen("CON", "wt", stdout);
|
|||
|
|
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
m_wPlayCount = 0;
|
|||
|
|
m_bClassicRule = true;
|
|||
|
|
RepositionSink();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
CTableFrameSink::~CTableFrameSink(void)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ӿڲ<D3BF>ѯ;
|
|||
|
|
VOID * CTableFrameSink::QueryInterface(REFGUID Guid, DWORD dwQueryVer)
|
|||
|
|
{
|
|||
|
|
QUERYINTERFACE(ITableFrameSink,Guid,dwQueryVer);
|
|||
|
|
QUERYINTERFACE(ITableUserAction,Guid,dwQueryVer);
|
|||
|
|
QUERYINTERFACE_IUNKNOWNEX(ITableFrameSink,Guid,dwQueryVer);
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC>;
|
|||
|
|
bool CTableFrameSink::Initialization(IUnknownEx * pIUnknownEx)
|
|||
|
|
{
|
|||
|
|
//<2F><>ѯ<EFBFBD>ӿ<EFBFBD>;
|
|||
|
|
ASSERT(pIUnknownEx!=NULL);
|
|||
|
|
m_pITableFrame=QUERY_OBJECT_PTR_INTERFACE(pIUnknownEx,ITableFrame);
|
|||
|
|
if (m_pITableFrame==NULL) return false;
|
|||
|
|
m_pITableFrame->SetStartMode(START_MODE_ALL_READY);
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>;
|
|||
|
|
m_pGameServiceOption=m_pITableFrame->GetGameServiceOption();
|
|||
|
|
ASSERT(m_pGameServiceOption!=NULL);
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
ASSERT(m_pITableFrame->GetCustomRule() != NULL);
|
|||
|
|
m_pGameCustomRule = (tagCustomRule *)m_pITableFrame->GetCustomRule();
|
|||
|
|
|
|||
|
|
//BYTE bInFirstList[5] = { 0x21, 0x05, 0x04, 0x13, 0x32};
|
|||
|
|
//BYTE bInNextList[5] = { 0x11, 0x15, 0x24, 0x33, 0x02};
|
|||
|
|
//BYTE cbResult = m_GameLogic.CompareCard(bInFirstList, bInNextList, 5, 5, false);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>;
|
|||
|
|
VOID CTableFrameSink::RepositionSink()
|
|||
|
|
{
|
|||
|
|
m_wWinAllUser = INVALID_CHAIR;
|
|||
|
|
|
|||
|
|
memset(m_aryShowCard, 0, sizeof(m_aryShowCard));
|
|||
|
|
|
|||
|
|
memset(m_aryGameScore, 0, sizeof(m_aryGameScore));
|
|||
|
|
memset(m_aryToltalWinDaoShu, 0, sizeof(m_aryToltalWinDaoShu));
|
|||
|
|
memset(m_aryRobStatus, 0, sizeof(m_aryRobStatus));
|
|||
|
|
memset(m_lTableScore, 0, sizeof(m_lTableScore));
|
|||
|
|
|
|||
|
|
memset(m_aryFrontCard, 0, sizeof(m_aryFrontCard));
|
|||
|
|
memset(m_aryMidCard, 0, sizeof(m_aryMidCard));
|
|||
|
|
memset(m_aryBackCard, 0, sizeof(m_aryBackCard));
|
|||
|
|
memset(m_arySpecialType, 0, sizeof(m_arySpecialType));
|
|||
|
|
|
|||
|
|
memset(m_aryHandCardData, 0, sizeof(m_aryHandCardData));
|
|||
|
|
memset(m_aryHandCardType, 0, sizeof(m_aryHandCardType));
|
|||
|
|
memset(m_arySpecialCompareResult, 0, sizeof(m_arySpecialCompareResult));
|
|||
|
|
memset(m_aryCompareResult, 0, sizeof(m_aryCompareResult));
|
|||
|
|
memset(m_aryDaoShui, 0, sizeof(m_aryDaoShui));
|
|||
|
|
memset(m_aryShootDaoShu, 0, sizeof(m_aryShootDaoShu));
|
|||
|
|
|
|||
|
|
memset(m_aryBankerCmpResult, 0, sizeof(m_aryBankerCmpResult));
|
|||
|
|
memset(m_aryOtherCmResult, 0, sizeof(m_aryOtherCmResult));
|
|||
|
|
|
|||
|
|
memset(m_aryNormalResult, 0, sizeof(m_aryNormalResult));
|
|||
|
|
memset(m_arySpecialResult, 0, sizeof(m_arySpecialResult));
|
|||
|
|
|
|||
|
|
memset(m_aryShootState, 0, sizeof(m_aryShootState));
|
|||
|
|
memset(m_aryThreeKillResult, 0, sizeof(m_aryThreeKillResult));
|
|||
|
|
memset(m_aryToltalWinDaoShu, 0, sizeof(m_aryToltalWinDaoShu));
|
|||
|
|
memset(m_aryCompareDouble, 0, sizeof(m_aryCompareDouble));
|
|||
|
|
m_cbShootCount = 0;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
m_arySendAniOver[i] = false;
|
|||
|
|
m_aryCompareOver[i] = false;
|
|||
|
|
|
|||
|
|
m_aryShowCard[i] = false;
|
|||
|
|
m_aryDaoShui[i] = false;
|
|||
|
|
m_aryResponse[i] = false;
|
|||
|
|
|
|||
|
|
m_aryHandStatus[i] = HAND_STATUS_NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_cbRobBankerCount = 0;
|
|||
|
|
|
|||
|
|
ZeroMemory(m_wRobBankerUser, sizeof(m_wRobBankerUser));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>ʼ;
|
|||
|
|
bool CTableFrameSink::OnEventGameStart()
|
|||
|
|
{
|
|||
|
|
BYTE cbCardData[52] = {0};
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>;
|
|||
|
|
m_GameLogic.RandCardList(cbCardData, 52);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
IServerUserItem * pIServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (nullptr == pIServerUserItem) continue;
|
|||
|
|
//if (pIServerUserItem->GetUserStatus() != US_PLAYING) continue;
|
|||
|
|
//ASSERT(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
|
|||
|
|
//BYTE cbUserStatus = pIServerUserItem->GetUserStatus();
|
|||
|
|
//BYTE cbReUserStatus = pIServerUserItem->GetReUserStatus();
|
|||
|
|
//if (cbUserStatus == US_PLAYING || (US_OFFLINE == cbUserStatus && cbReUserStatus == US_PLAYING))
|
|||
|
|
{
|
|||
|
|
m_aryHandStatus[i] = HAND_STATUS_DISORDER;
|
|||
|
|
m_PrivateEndInfo.aryActiveStatus[i] = HAND_STATUS_DISORDER;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
ASSERT(pPrivateFrame != nullptr);
|
|||
|
|
ASSERT(pPrivateFrame->dwRoomNum>0);
|
|||
|
|
DWORD dwGameRule = pPrivateFrame->dwGameRule;
|
|||
|
|
|
|||
|
|
if (dwGameRule&eSSSGameRuleTurnBanker)
|
|||
|
|
{
|
|||
|
|
if (m_wPlayCount > 0)
|
|||
|
|
{
|
|||
|
|
if (m_wBankerUser != INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
do
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = (m_wBankerUser + 1) % GAME_PLAYER;
|
|||
|
|
|
|||
|
|
if (m_aryHandStatus[m_wBankerUser]>0)
|
|||
|
|
{
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
} while (true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
m_wBankerUser = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ASSERT(m_wBankerUser!=INVALID_CHAIR);
|
|||
|
|
}
|
|||
|
|
else if (dwGameRule&eSSSGameRuleFixBanker)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>Ϊ0;
|
|||
|
|
m_wBankerUser = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ¼<><C2BC><EFBFBD><EFBFBD>ʼ;
|
|||
|
|
starGameRecord();
|
|||
|
|
|
|||
|
|
CMD_S_GameStart mStart;
|
|||
|
|
memset(&mStart, 0, sizeof(mStart));
|
|||
|
|
memcpy(mStart.cbHandStatus, m_aryHandStatus, sizeof(m_aryHandStatus));
|
|||
|
|
mStart.wBankerChairID = m_wBankerUser;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>淨;
|
|||
|
|
if (dwGameRule&eSSSGameRuleClassic)
|
|||
|
|
{
|
|||
|
|
m_bClassicRule = true;
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < HAND_CARD_COUNT; j++)
|
|||
|
|
{
|
|||
|
|
BYTE cbTempCardData = cbCardData[j + i*HAND_CARD_COUNT];
|
|||
|
|
m_aryHandCardData[i][j] = cbTempCardData;
|
|||
|
|
m_arySaveHandCard[i][j] = cbTempCardData;
|
|||
|
|
mStart.cbHandCardData[j] = cbTempCardData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
mStart.cbCardCount = HAND_CARD_COUNT;
|
|||
|
|
mStart.wSpecialType = m_GameLogic.GetCardType(m_aryHandCardData[i], 13, m_arySaveHandCard[i]);
|
|||
|
|
|
|||
|
|
m_arySpecialType[i] = mStart.wSpecialType;
|
|||
|
|
m_pITableFrame->SendTableData(i, SUB_S_GAME_START, &mStart, sizeof(mStart));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_bClassicRule = false;
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < HAND_CARD_COUNT; j++)
|
|||
|
|
{
|
|||
|
|
BYTE cbTempCardData = cbCardData[j + i*HAND_CARD_COUNT];
|
|||
|
|
m_aryHandCardData[i][j] = cbTempCardData;
|
|||
|
|
m_arySaveHandCard[i][j] = cbTempCardData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (dwGameRule&eSSSGameRuleSend7Cards)
|
|||
|
|
{
|
|||
|
|
mStart.cbCardCount = 7;
|
|||
|
|
memcpy(mStart.cbHandCardData, m_aryHandCardData[i], sizeof(BYTE) * 7);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->SendTableData(i, SUB_S_GAME_START, &mStart, sizeof(mStart));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((dwGameRule&eSSSGameRuleTurnBanker) || (dwGameRule&eSSSGameRuleFixBanker))
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>л<EFBFBD>;
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_USER_CHIP);
|
|||
|
|
|
|||
|
|
if (m_pGameCustomRule->bAutoBuildCard)
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_USER_CHIP, IDT_USER_CHIP, 1, 0);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_SEND_CARD);
|
|||
|
|
|
|||
|
|
DWORD dwElapse = __max(IDT_SEND_OVER, m_pGameCustomRule->wSendCardTime * 1000);
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_SEND_OVER, dwElapse, 1, 0);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_GameLogic.setClassicRule(m_bClassicRule);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnEventGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_SHOW_SCORE);
|
|||
|
|
|
|||
|
|
switch (cbReason)
|
|||
|
|
{
|
|||
|
|
case GER_DISMISS:
|
|||
|
|
{
|
|||
|
|
CMD_S_GameEnd ge = { 0 };
|
|||
|
|
ge.isPrivateEnd = true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &ge, sizeof(CMD_S_GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &ge, sizeof(CMD_S_GameEnd));
|
|||
|
|
|
|||
|
|
return m_pITableFrame->ConcludeGame(GAME_STATUS_FREE, cbReason);
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
case GER_NORMAL:
|
|||
|
|
{
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>;
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray, sizeof(ScoreInfoArray));
|
|||
|
|
|
|||
|
|
CMD_S_GameEnd ge = { 0 };
|
|||
|
|
ge.isPrivateEnd = IsPrivateEnd();
|
|||
|
|
memset(&ge, 0, sizeof(ge));
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (!IsUserPlaying(i)) continue;
|
|||
|
|
|
|||
|
|
BYTE cbType = SCORE_TYPE_NULL;
|
|||
|
|
ge.lGameScore[i] = m_aryGameScore[i];
|
|||
|
|
if (m_aryGameScore[i]>0)
|
|||
|
|
{
|
|||
|
|
cbType = SCORE_TYPE_WIN;
|
|||
|
|
m_PrivateEndInfo.aryWinTimes[i]++;
|
|||
|
|
}
|
|||
|
|
else if (m_aryGameScore[i]<0)
|
|||
|
|
{
|
|||
|
|
cbType = SCORE_TYPE_LOSE;
|
|||
|
|
m_PrivateEndInfo.aryLoseTimes[i]++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbType = SCORE_TYPE_DRAW;
|
|||
|
|
m_PrivateEndInfo.aryWinTimes[i]++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ScoreInfoArray[i].cbType = cbType;
|
|||
|
|
ScoreInfoArray[i].lScore = m_aryGameScore[i];
|
|||
|
|
|
|||
|
|
m_PrivateEndInfo.lUserScore[i] += m_aryGameScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_GAME_END, &ge, sizeof(CMD_S_GameEnd));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_GAME_END, &ge, sizeof(CMD_S_GameEnd));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ״̬;
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_FREE);
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_END, &ge, sizeof(CMD_S_GameEnd));
|
|||
|
|
|
|||
|
|
//<2F>ƾֽ<C6BE><D6BD><EFBFBD><EFBFBD><EFBFBD>,ÿ8<C3BF><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㾭<EFBFBD><E3BEAD>ֵ;
|
|||
|
|
if (IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
//tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
//SCORE lGrade = pPrivateFrame->dwPlayCost;
|
|||
|
|
|
|||
|
|
//for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
//{
|
|||
|
|
// ScoreInfoArray[i].lGrade = lGrade;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
ScoreInfoArray[0].lGrade = 2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32>;
|
|||
|
|
for (WORD i = 1; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].lGrade = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
m_wPlayCount++;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ;
|
|||
|
|
return m_pITableFrame->ConcludeGame(GAME_STATUS_FREE, cbReason);
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
case GER_USER_LEAVE:
|
|||
|
|
case GER_NETWORK_ERROR:
|
|||
|
|
{
|
|||
|
|
ASSERT(nullptr != pIServerUserItem);
|
|||
|
|
ASSERT(0);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnEventSendGameScene(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE bGameStatus, bool bSendSecret)
|
|||
|
|
{
|
|||
|
|
switch (bGameStatus)
|
|||
|
|
{
|
|||
|
|
case GS_WK_FREE: //<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusFree sf = { 0 };
|
|||
|
|
sf.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sf.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sf.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sf, sizeof(CMD_S_StatusFree));
|
|||
|
|
}
|
|||
|
|
case GS_WK_SEND_CARD: //<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusSendCard sc = { 0 };
|
|||
|
|
sc.BaseStatus.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sc.BaseStatus.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sc.BaseStatus.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
sc.bSendOver = m_arySendAniOver[wChairID];
|
|||
|
|
sc.wSpecialType = m_arySpecialType[wChairID];
|
|||
|
|
CopyMemory(sc.BaseStatus.cbHandStatus, m_aryHandStatus, sizeof(m_aryHandStatus));
|
|||
|
|
|
|||
|
|
sc.wBankerUser = m_wBankerUser;
|
|||
|
|
if (IsHaveRule(eSSSGameRuleRobBanker))
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 7;
|
|||
|
|
}
|
|||
|
|
else if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 13;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((sc.cbCardCount>0)&&(HAND_STATUS_NULL != m_aryHandStatus[wChairID]))
|
|||
|
|
{
|
|||
|
|
CopyMemory(sc.cbHandCardData, m_aryHandCardData[wChairID], sizeof(BYTE)*sc.cbCardCount);
|
|||
|
|
}
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sc, sizeof(CMD_S_StatusSendCard));
|
|||
|
|
}
|
|||
|
|
case GS_WK_ROB_BANKER:
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusRob sr = {0};
|
|||
|
|
sr.BaseStatus.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sr.BaseStatus.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sr.BaseStatus.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
CopyMemory(sr.BaseStatus.cbHandStatus, m_aryHandStatus, sizeof(m_aryHandStatus));
|
|||
|
|
CopyMemory(sr.cbRobStatus, m_aryRobStatus, sizeof(m_aryRobStatus));
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
sr.BaseStatus.cbHandStatus[i] = m_aryHandStatus[i];
|
|||
|
|
sr.cbRobStatus[i] = m_aryRobStatus[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (IsHaveRule(eSSSGameRuleRobBanker))
|
|||
|
|
{
|
|||
|
|
sr.cbCardCount = 7;
|
|||
|
|
}
|
|||
|
|
else if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
sr.cbCardCount = 13;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sr.cbCardCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((sr.cbCardCount > 0) && (HAND_STATUS_NULL != m_aryHandStatus[wChairID]))
|
|||
|
|
{
|
|||
|
|
CopyMemory(sr.cbHandCardData, m_aryHandCardData[wChairID], sizeof(BYTE)*sr.cbCardCount);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sr, sizeof(CMD_S_StatusRob));
|
|||
|
|
}
|
|||
|
|
case GS_WK_USER_CHIP:
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusChip sc = {0};
|
|||
|
|
sc.BaseStatus.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sc.BaseStatus.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sc.BaseStatus.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
|
|||
|
|
sc.wBankerUser = m_wBankerUser;
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
sc.BaseStatus.cbHandStatus[i] = m_aryHandStatus[i];
|
|||
|
|
sc.cbChipStatus[i] = m_aryResponse[i] ? 1 : 0;
|
|||
|
|
sc.lUserChipScore[i] = m_lTableScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (IsHaveRule(eSSSGameRuleRobBanker))
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 7;
|
|||
|
|
}
|
|||
|
|
else if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 13;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sc.cbCardCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((sc.cbCardCount > 0) && (HAND_STATUS_NULL != m_aryHandStatus[wChairID]))
|
|||
|
|
{
|
|||
|
|
CopyMemory(sc.cbHandCardData, m_aryHandCardData[wChairID], sizeof(BYTE)*sc.cbCardCount);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sc, sizeof(CMD_S_StatusChip));
|
|||
|
|
}
|
|||
|
|
case GS_WK_OPEN_CARD: //<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
{
|
|||
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ˵<CFA2><CBB5><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
WORD wTimeID = IDI_AUTO_SHOW_CARD_USER + wChairID;
|
|||
|
|
m_pITableFrame->KillGameTimer(wTimeID);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
CMD_S_StatusOpen sp = { 0 };
|
|||
|
|
sp.BaseStatus.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sp.BaseStatus.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sp.BaseStatus.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
|
|||
|
|
sp.wBankerUser = m_wBankerUser;
|
|||
|
|
sp.wSpecialType = m_arySpecialType[wChairID];
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
sp.BaseStatus.cbHandStatus[i] = m_aryHandStatus[i];
|
|||
|
|
sp.lUserChipScore[i] = m_lTableScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (HAND_STATUS_NULL != m_aryHandStatus[wChairID])
|
|||
|
|
{
|
|||
|
|
if (HAND_STATUS_SORTED == m_aryHandStatus[wChairID])
|
|||
|
|
{
|
|||
|
|
CopyMemory(&sp.cbHandCardData[0], m_aryFrontCard[wChairID], sizeof(BYTE)*3);
|
|||
|
|
CopyMemory(&sp.cbHandCardData[3], m_aryMidCard[wChairID], sizeof(BYTE) * 5);
|
|||
|
|
CopyMemory(&sp.cbHandCardData[8], m_aryBackCard[wChairID], sizeof(BYTE) * 5);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CopyMemory(sp.cbHandCardData, m_aryHandCardData[wChairID], sizeof(BYTE)*HAND_CARD_COUNT);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sp, sizeof(sp));
|
|||
|
|
}
|
|||
|
|
case GS_WK_COMPARE_CARD: //<2F><><EFBFBD><EFBFBD>״̬;
|
|||
|
|
{
|
|||
|
|
if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusClassicCompare scc = {0};
|
|||
|
|
scc.wRobBankerTime = IDT_ROB_BANKER/1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
scc.wUserChipTime = IDT_USER_CHIP/1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
scc.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
scc.bCompareOver = m_aryCompareOver[wChairID];
|
|||
|
|
InitClassicCompareStatus(&scc.CompareStatus);
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &scc, sizeof(scc));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CMD_S_StatusBankerCompare sbc = { 0 };
|
|||
|
|
sbc.wRobBankerTime = IDT_ROB_BANKER / 1000; //<2F><>ׯʱ<D7AF><CAB1>;
|
|||
|
|
sbc.wUserChipTime = IDT_USER_CHIP / 1000; //<2F><>עʱ<D7A2><CAB1>;
|
|||
|
|
sbc.wBuildCardTime = m_pGameCustomRule->wTimeOut;
|
|||
|
|
sbc.bCompareOver = m_aryCompareOver[wChairID];
|
|||
|
|
sbc.wBankerUser = m_wBankerUser;
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
sbc.lUserChipScore[i] = m_lTableScore[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
InitBankerCompareStatus(&sbc.CompareStatus);
|
|||
|
|
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem, &sbc, sizeof(sbc));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD>¼<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnTimerMessage(DWORD wTimerID, WPARAM wBindParam)
|
|||
|
|
{
|
|||
|
|
switch(wTimerID)
|
|||
|
|
{
|
|||
|
|
case IDI_SEND_OVER:
|
|||
|
|
{
|
|||
|
|
OnSendCardOver(INVALID_CHAIR);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_ROB_BANKER:
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_USER_CHIP:
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_USER_OPERATE:
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_COMPARE_OVER:
|
|||
|
|
{
|
|||
|
|
OnCompareCardOver(INVALID_CHAIR);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_AUTO_SHOW_CARD:
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
VERIFY_RETURN_TRUE(m_pITableFrame->GetGameStatus() == GS_WK_OPEN_CARD);
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_AUTO_SHOW_CARD);
|
|||
|
|
for (int i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
if (m_aryResponse[i]) continue;
|
|||
|
|
AutoShowCard(i);
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case IDI_SHOW_SCORE:
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_SHOW_SCORE);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (wTimerID >= IDI_AUTO_SHOW_CARD_USER && wTimerID < IDI_AUTO_SHOW_CARD_USER + GAME_PLAYER)
|
|||
|
|
{
|
|||
|
|
WORD wChairID = wTimerID - IDI_AUTO_SHOW_CARD_USER;
|
|||
|
|
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
VERIFY_RETURN_TRUE(m_pITableFrame->GetGameStatus() == GS_WK_OPEN_CARD);
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(wTimerID);
|
|||
|
|
if (!m_aryResponse[wChairID])
|
|||
|
|
{
|
|||
|
|
AutoShowCard(wChairID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnGameMessage(WORD wSubCmdID, VOID * pDataBuffer, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
switch (wSubCmdID)
|
|||
|
|
{
|
|||
|
|
case SUB_C_SEND_OVER: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
VERIFY_RETURN_TRUE(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
|
|||
|
|
return OnSendCardOver(pIServerUserItem->GetChairID());
|
|||
|
|
}
|
|||
|
|
case SUB_C_OPEN_CARD:
|
|||
|
|
{
|
|||
|
|
ASSERT(sizeof(CMD_C_OpenCard) == wDataSize);
|
|||
|
|
if (sizeof(CMD_C_OpenCard) != wDataSize) return false;
|
|||
|
|
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
VERIFY_RETURN_TRUE(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
|
|||
|
|
CMD_C_OpenCard* pShowCard = (CMD_C_OpenCard*)pDataBuffer;
|
|||
|
|
return OnUserShowCard(pIServerUserItem->GetChairID(), pShowCard);
|
|||
|
|
}
|
|||
|
|
case SUB_C_COMPARE_OVER: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
{
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
VERIFY_RETURN_TRUE(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
|
|||
|
|
return OnCompareCardOver(pIServerUserItem->GetChairID());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
case SUB_C_ROB_BANKER:
|
|||
|
|
{
|
|||
|
|
ASSERT(sizeof(CMD_C_RobBanker) == wDataSize);
|
|||
|
|
if (sizeof(CMD_C_RobBanker) != wDataSize) return false;
|
|||
|
|
|
|||
|
|
ASSERT(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus() != US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
|
|||
|
|
CMD_C_RobBanker *pRobBanker = (CMD_C_RobBanker *)pDataBuffer;
|
|||
|
|
return OnUserRobBanker(wChairID, pRobBanker->bRob);
|
|||
|
|
}
|
|||
|
|
case SUB_C_CHIP_SCORE:
|
|||
|
|
{
|
|||
|
|
ASSERT(sizeof(CMD_C_ChipScore) == wDataSize);
|
|||
|
|
if (sizeof(CMD_C_ChipScore) != wDataSize) return false;
|
|||
|
|
|
|||
|
|
ASSERT(pIServerUserItem->GetUserStatus() == US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus() != US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
|
|||
|
|
CMD_C_ChipScore *pChipScore = (CMD_C_ChipScore *)pDataBuffer;
|
|||
|
|
return OnUserChipScore(wChairID, pChipScore->lScore);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnFrameMessage(WORD wSubCmdID, VOID * pDataBuffer, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnDataBaseMessage(WORD wRequestID, VOID * pData, WORD wDataSize)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnUserScroeNotify(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnActionUserOffLine(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
BYTE cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
if (cbGameStatus == GS_WK_OPEN_CARD)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#if _DEBUG
|
|||
|
|
DWORD dwElapse = 60* 1000;
|
|||
|
|
#else
|
|||
|
|
DWORD dwElapse = IDT_OFFLINE_TIME;
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
WORD wTimeID = IDI_AUTO_SHOW_CARD_USER + wChairID;
|
|||
|
|
m_pITableFrame->SetGameTimer(wTimeID, dwElapse, 1, 0);
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnActionUserConnect(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
BYTE cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
if (cbGameStatus == GS_WK_OPEN_CARD)
|
|||
|
|
{
|
|||
|
|
WORD wTimeID = IDI_AUTO_SHOW_CARD_USER + wChairID;
|
|||
|
|
m_pITableFrame->KillGameTimer(wTimeID);
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnActionUserSitDown(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser)
|
|||
|
|
{
|
|||
|
|
if (!bLookonUser && INVALID_CHAIR == m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
const tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
ASSERT(pPrivateFrame != nullptr);
|
|||
|
|
ASSERT(pPrivateFrame->dwRoomNum > 0);
|
|||
|
|
DWORD dwGameRule = pPrivateFrame->dwGameRule;
|
|||
|
|
|
|||
|
|
if ((dwGameRule&eSSSGameRuleFixBanker) || (dwGameRule&eSSSGameRuleTurnBanker))
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = pIServerUserItem->GetChairID();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::OnActionUserStandUp( WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser )
|
|||
|
|
{
|
|||
|
|
if (!bLookonUser && m_pITableFrame->GetSitUserCount() == 0)
|
|||
|
|
{
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::ShowCard(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
CMD_S_OpenCard nShowCard;
|
|||
|
|
memset(&nShowCard, 0, sizeof(nShowCard));
|
|||
|
|
nShowCard.wChairID = wChairID;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_OPEN_CARD, &nShowCard, sizeof(nShowCard));
|
|||
|
|
|
|||
|
|
m_aryHandStatus[wChairID] = HAND_STATUS_SORTED;
|
|||
|
|
m_aryShowCard[wChairID] = true;
|
|||
|
|
bool bAllShow = true;
|
|||
|
|
|
|||
|
|
for (BYTE i=0; i<GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!m_aryShowCard[i])
|
|||
|
|
{
|
|||
|
|
bAllShow = false;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (bAllShow)
|
|||
|
|
{
|
|||
|
|
if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
GameClassicCompare();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GameBankerCompare();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::GameClassicCompare()
|
|||
|
|
{
|
|||
|
|
ComputeChout();
|
|||
|
|
GetCompareResult();
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>;
|
|||
|
|
CMD_S_ClassicCompareCard nCompare;
|
|||
|
|
memset(&nCompare, 0, sizeof(nCompare));
|
|||
|
|
InitClassicCompareStatus(&nCompare);
|
|||
|
|
|
|||
|
|
int nPlayerCount = 0;
|
|||
|
|
for (BYTE i=0; i<GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (false==IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
nPlayerCount++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_SHOW_SCORE,(nPlayerCount*2200+5000), 1, NULL);
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_CLASSIC_CMP_CARD, &nCompare, sizeof(nCompare));
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_COMPARE_CARD);
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_CLASSIC_CMP_CARD, &nCompare, sizeof(nCompare));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ׯ<EFBFBD>ұ<EFBFBD><D2B1><EFBFBD>;
|
|||
|
|
void CTableFrameSink::GameBankerCompare()
|
|||
|
|
{
|
|||
|
|
ASSERT(m_wBankerUser < GAME_PLAYER);
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (i==m_wBankerUser || !IsUserPlaying(i)) continue;
|
|||
|
|
|
|||
|
|
BYTE cbWinCount = 0;
|
|||
|
|
//ͷ<><CDB7><EFBFBD>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbFrontCompareResult = 0;
|
|||
|
|
BYTE cbFirstType = m_aryHandCardType[i][0];
|
|||
|
|
BYTE cbNextType = m_aryHandCardType[m_wBankerUser][0];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbFrontCompareResult = m_GameLogic.CompareCard(m_aryFrontCard[i], m_aryFrontCard[m_wBankerUser], 3, 3, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>淨A2345<34><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>淨A2345˳<35><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С;
|
|||
|
|
if ((cbFirstType == CT_FIVE_MIXED_FLUSH_NO_A&&cbNextType == CT_FIVE_MIXED_FLUSH_FIRST_A) ||
|
|||
|
|
(cbFirstType == CT_FIVE_MIXED_FLUSH_FIRST_A&&cbNextType == CT_FIVE_MIXED_FLUSH_NO_A))
|
|||
|
|
{
|
|||
|
|
cbFrontCompareResult = (cbNextType < cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbFrontCompareResult = (cbNextType > cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>е<EFBFBD><D0B5>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbMidCardCompareResult = 0;
|
|||
|
|
cbFirstType = m_aryHandCardType[i][1];
|
|||
|
|
cbNextType = m_aryHandCardType[m_wBankerUser][1];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbMidCardCompareResult = m_GameLogic.CompareCard(m_aryMidCard[i], m_aryMidCard[m_wBankerUser], 5, 5, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if ((cbFirstType == CT_FIVE_MIXED_FLUSH_NO_A&&cbNextType == CT_FIVE_MIXED_FLUSH_FIRST_A) ||
|
|||
|
|
(cbFirstType == CT_FIVE_MIXED_FLUSH_FIRST_A&&cbNextType == CT_FIVE_MIXED_FLUSH_NO_A))
|
|||
|
|
{
|
|||
|
|
cbMidCardCompareResult = (cbNextType < cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbMidCardCompareResult = (cbNextType > cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//β<><CEB2><EFBFBD>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbBackCardCompareResult = 0;
|
|||
|
|
cbFirstType = m_aryHandCardType[i][2];
|
|||
|
|
cbNextType = m_aryHandCardType[m_wBankerUser][2];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbBackCardCompareResult = m_GameLogic.CompareCard(m_aryBackCard[i], m_aryBackCard[m_wBankerUser], 5, 5, false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if ((cbFirstType == CT_FIVE_MIXED_FLUSH_NO_A&&cbNextType == CT_FIVE_MIXED_FLUSH_FIRST_A) ||
|
|||
|
|
(cbFirstType == CT_FIVE_MIXED_FLUSH_FIRST_A&&cbNextType == CT_FIVE_MIXED_FLUSH_NO_A))
|
|||
|
|
{
|
|||
|
|
cbBackCardCompareResult = (cbNextType < cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbBackCardCompareResult = (cbNextType > cbFirstType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbFrontCompareResult>0)
|
|||
|
|
{
|
|||
|
|
cbWinCount++;
|
|||
|
|
m_aryOtherCmResult[i][0] = 0;
|
|||
|
|
m_aryBankerCmpResult[i][0] = 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_aryOtherCmResult[i][0] = 1;
|
|||
|
|
m_aryBankerCmpResult[i][0] = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbMidCardCompareResult>0)
|
|||
|
|
{
|
|||
|
|
cbWinCount++;
|
|||
|
|
m_aryOtherCmResult[i][1] = 0;
|
|||
|
|
m_aryBankerCmpResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_aryOtherCmResult[i][1] = 1;
|
|||
|
|
m_aryBankerCmpResult[i][1] = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbBackCardCompareResult>0)
|
|||
|
|
{
|
|||
|
|
cbWinCount++;
|
|||
|
|
m_aryOtherCmResult[i][2] = 0;
|
|||
|
|
m_aryBankerCmpResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_aryOtherCmResult[i][2] = 1;
|
|||
|
|
m_aryBankerCmpResult[i][2] = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbWinCount>=2)
|
|||
|
|
{
|
|||
|
|
m_aryGameScore[i] -= m_lTableScore[i];
|
|||
|
|
m_aryGameScore[m_wBankerUser] += m_lTableScore[i];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_aryGameScore[i] += m_lTableScore[i];
|
|||
|
|
m_aryGameScore[m_wBankerUser] -= m_lTableScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>;
|
|||
|
|
CMD_S_BankerCompareCard nCompare;
|
|||
|
|
memset(&nCompare, 0, sizeof(nCompare));
|
|||
|
|
InitBankerCompareStatus(&nCompare);
|
|||
|
|
|
|||
|
|
int nPlayerCount = 0;
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
nPlayerCount++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_SHOW_SCORE, (nPlayerCount * 2200 + 5000), 1, NULL);
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_BANKER_CMP_CARD, &nCompare, sizeof(nCompare));
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_COMPARE_CARD);
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_BANKER_CMP_CARD, &nCompare, sizeof(nCompare));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ƽṹ;
|
|||
|
|
void CTableFrameSink::InitClassicCompareStatus(CMD_S_ClassicCompareCard* pComStatus)
|
|||
|
|
{
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbHandStatus[i] = m_aryHandStatus[i];
|
|||
|
|
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pComStatus->wSpecialType[i] = m_arySpecialType[i];
|
|||
|
|
pComStatus->nSpecialCompareResult[i] = m_arySpecialCompareResult[i];
|
|||
|
|
|
|||
|
|
if (m_arySpecialType[i] != CT_INVALID)
|
|||
|
|
{
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbFrontCard[i][j] = m_aryHandCardData[i][j];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < 5; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbMidCard[i][j] = m_aryHandCardData[i][j + 3];
|
|||
|
|
pComStatus->cbBackCard[i][j] = m_aryHandCardData[i][j + 8];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbFrontCard[i][j] = m_aryFrontCard[i][j];
|
|||
|
|
}
|
|||
|
|
for (BYTE j = 0; j < 5; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbMidCard[i][j] = m_aryMidCard[i][j];
|
|||
|
|
pComStatus->cbBackCard[i][j] = m_aryBackCard[i][j];
|
|||
|
|
}
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->nCompareResult[i][j] = m_aryCompareResult[i][j];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->wHandCardType[i][j] = m_aryHandCardType[i][j];
|
|||
|
|
pComStatus->nCompareResult[i][j] = m_aryCompareResult[i][j];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
memcpy(pComStatus->aryShootDaoShu, m_aryShootDaoShu, sizeof(m_aryShootDaoShu));
|
|||
|
|
memcpy(pComStatus->aryShootState, m_aryShootState, sizeof(m_aryShootState));
|
|||
|
|
pComStatus->cbShootCount = m_cbShootCount;
|
|||
|
|
memcpy(pComStatus->cbThreeKillResult, m_aryThreeKillResult, sizeof(m_aryThreeKillResult));
|
|||
|
|
pComStatus->wAllUser = m_wWinAllUser;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ׯ<EFBFBD><D7AF><EFBFBD>淨<EFBFBD>ṹ;
|
|||
|
|
void CTableFrameSink::InitBankerCompareStatus(CMD_S_BankerCompareCard* pComStatus)
|
|||
|
|
{
|
|||
|
|
for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbHandStatus[i] = m_aryHandStatus[i];
|
|||
|
|
|
|||
|
|
if (false == IsUserPlaying(i))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbFrontCard[i][j] = m_aryFrontCard[i][j];
|
|||
|
|
}
|
|||
|
|
for (BYTE j = 0; j < 5; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->cbMidCard[i][j] = m_aryMidCard[i][j];
|
|||
|
|
pComStatus->cbBackCard[i][j] = m_aryBackCard[i][j];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < 3; j++)
|
|||
|
|
{
|
|||
|
|
pComStatus->wHandCardType[i][j] = m_aryHandCardType[i][j];
|
|||
|
|
pComStatus->cbBankerCmpResult[i][j] = m_aryBankerCmpResult[i][j];
|
|||
|
|
pComStatus->cbOtherCmResult[i][j] = m_aryOtherCmResult[i][j];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::OnSendCardOver(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
//У<><D0A3>;
|
|||
|
|
BYTE &&cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
ASSERT(GS_WK_SEND_CARD == cbGameStatus);
|
|||
|
|
if (GS_WK_SEND_CARD != cbGameStatus)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>;
|
|||
|
|
if (wChairID != INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
VERIFY_RETURN_FALSE(VALID_CHAIR(wChairID));
|
|||
|
|
VERIFY_RETURN_TRUE(HAND_STATUS_DISORDER == m_aryHandStatus[wChairID]);
|
|||
|
|
VERIFY_RETURN_TRUE(!m_arySendAniOver[wChairID]);
|
|||
|
|
|
|||
|
|
m_arySendAniOver[wChairID] = true;
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (IsUserPlaying(i) && !m_arySendAniOver[i])
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_SEND_OVER);
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
m_arySendAniOver[i] = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>ׯ;
|
|||
|
|
if (IsHaveRule(eSSSGameRuleRobBanker))
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_START_ROB);
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_START_ROB);
|
|||
|
|
|
|||
|
|
//״̬<D7B4>л<EFBFBD>;
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_ROB_BANKER);
|
|||
|
|
|
|||
|
|
if (m_pGameCustomRule->bAutoBuildCard)
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_ROB_BANKER, IDT_ROB_BANKER, 1, 0);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ģʽ;
|
|||
|
|
else if (IsHaveRule(eSSSGameRuleClassic))
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_START_OPEN);
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_START_OPEN);
|
|||
|
|
|
|||
|
|
//״̬<D7B4>л<EFBFBD>;
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_OPEN_CARD);
|
|||
|
|
|
|||
|
|
if (m_pGameCustomRule->bAutoBuildCard)
|
|||
|
|
{
|
|||
|
|
DWORD dwElapse = __max(IDT_USER_OPERATE, m_pGameCustomRule->wTimeOut * 1000);
|
|||
|
|
//m_pITableFrame->SetGameTimer(IDI_USER_OPERATE, dwElapse, 1, 0);IDI_AUTO_SHOW_CARD
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_AUTO_SHOW_CARD, dwElapse, 1, 0);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
//CMD_S_StartChip StartChip = {0};
|
|||
|
|
//StartChip.wBankerUser = m_wBankerUser;
|
|||
|
|
|
|||
|
|
//m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_START_CHIP, &StartChip, sizeof(CMD_S_StartChip));
|
|||
|
|
//m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_START_CHIP, &StartChip, sizeof(CMD_S_StartChip));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::OnUserShowCard(WORD wChairID, CMD_C_OpenCard *pShowCard)
|
|||
|
|
{
|
|||
|
|
ASSERT(false == m_aryResponse[wChairID]);
|
|||
|
|
if (m_aryResponse[wChairID])
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (pShowCard->wSpecialType != CT_INVALID)
|
|||
|
|
{
|
|||
|
|
if (pShowCard->wSpecialType != m_arySpecialType[wChairID])
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < 3; i++)
|
|||
|
|
{
|
|||
|
|
m_aryFrontCard[wChairID][i] = m_arySaveHandCard[wChairID][i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < 5; i++)
|
|||
|
|
{
|
|||
|
|
m_aryMidCard[wChairID][i] = m_arySaveHandCard[wChairID][i+3];
|
|||
|
|
m_aryBackCard[wChairID][i] = m_arySaveHandCard[wChairID][i+8];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_arySpecialType[wChairID] = CT_INVALID;
|
|||
|
|
|
|||
|
|
for (BYTE i = 0; i < 3; i++)
|
|||
|
|
{
|
|||
|
|
m_aryFrontCard[wChairID][i] = pShowCard->cbFrontCard[i];
|
|||
|
|
}
|
|||
|
|
for (BYTE i = 0; i < 5; i++)
|
|||
|
|
{
|
|||
|
|
m_aryMidCard[wChairID][i] = pShowCard->cbMidCard[i];
|
|||
|
|
m_aryBackCard[wChairID][i] = pShowCard->cbBackCard[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BYTE aryHandCardData[HAND_CARD_COUNT] = {0};
|
|||
|
|
memcpy(aryHandCardData, m_aryHandCardData[wChairID], sizeof(aryHandCardData));
|
|||
|
|
|
|||
|
|
if (!m_GameLogic.RemoveCard(m_aryFrontCard[wChairID], 3, aryHandCardData, 13))
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!m_GameLogic.RemoveCard(m_aryMidCard[wChairID], 5, aryHandCardData, 10))
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!m_GameLogic.RemoveCard(m_aryBackCard[wChairID], 5, aryHandCardData, 5))
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_GameLogic.SortCardList(m_aryFrontCard[wChairID], 3);
|
|||
|
|
m_aryHandCardType[wChairID][0] = m_GameLogic.GetCardType(m_aryFrontCard[wChairID], 3, m_GameLogic.btCardSpecialData);
|
|||
|
|
|
|||
|
|
m_GameLogic.SortCardList(m_aryMidCard[wChairID], 5);
|
|||
|
|
m_aryHandCardType[wChairID][1] = m_GameLogic.GetCardType(m_aryMidCard[wChairID], 5, m_GameLogic.btCardSpecialData);
|
|||
|
|
|
|||
|
|
m_GameLogic.SortCardList(m_aryBackCard[wChairID], 5);
|
|||
|
|
m_aryHandCardType[wChairID][2] = m_GameLogic.GetCardType(m_aryBackCard[wChairID], 5, m_GameLogic.btCardSpecialData);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_aryResponse[wChairID] = true;
|
|||
|
|
|
|||
|
|
ShowCard(wChairID);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
bool CTableFrameSink::OnCompareCardOver(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
//У<><D0A3>;
|
|||
|
|
BYTE &&cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
VERIFY_RETURN_TRUE(GS_WK_COMPARE_CARD == cbGameStatus);
|
|||
|
|
|
|||
|
|
//<2F><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>;
|
|||
|
|
if (wChairID != INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
VERIFY_RETURN_FALSE(VALID_CHAIR(wChairID));
|
|||
|
|
VERIFY_RETURN_TRUE(!m_aryCompareOver[wChairID]);
|
|||
|
|
|
|||
|
|
m_aryCompareOver[wChairID] = true;
|
|||
|
|
|
|||
|
|
WORD wOnlineCount = GetOnlineCount();
|
|||
|
|
WORD wResponseCount = 0;
|
|||
|
|
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
IServerUserItem* pIUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (IsUserPlaying(i) && m_aryCompareOver[i] && (pIUserItem->GetUserStatus() == US_PLAYING))
|
|||
|
|
{
|
|||
|
|
wResponseCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (wOnlineCount > wResponseCount)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_COMPARE_OVER);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_aryCompareOver[i] = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
OnEventGameConclude(INVALID_CHAIR, nullptr, GER_NORMAL);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ׯ<EFBFBD>¼<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnUserRobBanker(WORD wChairID, bool bRob)
|
|||
|
|
{
|
|||
|
|
const BYTE cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
ASSERT(GS_WK_ROB_BANKER == cbGameStatus);
|
|||
|
|
if (GS_WK_ROB_BANKER != cbGameStatus) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>;
|
|||
|
|
if (INVALID_CHAIR != wChairID)
|
|||
|
|
{
|
|||
|
|
ASSERT(IsUserPlaying(wChairID));
|
|||
|
|
if (!IsUserPlaying(wChairID)) return true;
|
|||
|
|
ASSERT(false==m_aryResponse[wChairID]);
|
|||
|
|
if (m_aryResponse[wChairID]) return true;
|
|||
|
|
m_aryResponse[wChairID] = true;
|
|||
|
|
|
|||
|
|
m_aryRobStatus[wChairID] = bRob ? 2 : 1;
|
|||
|
|
if (bRob)
|
|||
|
|
{
|
|||
|
|
m_wRobBankerUser[m_cbRobBankerCount++] = wChairID;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CMD_S_UserRob stUserRob = { 0 };
|
|||
|
|
stUserRob.wRobUser = wChairID;
|
|||
|
|
stUserRob.bRobResult = bRob;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (m_aryHandStatus[i]>0 && false == m_aryResponse[i])
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ;
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (m_aryHandStatus[i]>0 && 0 == m_aryRobStatus[i])
|
|||
|
|
{
|
|||
|
|
m_aryRobStatus[i] = 1;
|
|||
|
|
|
|||
|
|
CMD_S_UserRob stUserRob = { 0 };
|
|||
|
|
stUserRob.wRobUser = i;
|
|||
|
|
stUserRob.bRobResult = false;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_USER_ROB, &stUserRob, sizeof(stUserRob));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ׯ;
|
|||
|
|
if (0 == m_cbRobBankerCount)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (m_aryHandStatus[i]>0)
|
|||
|
|
{
|
|||
|
|
ASSERT(1 == m_aryRobStatus[i]);
|
|||
|
|
m_wRobBankerUser[m_cbRobBankerCount++] = i;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_ROB_BANKER);
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
m_aryResponse[i] = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ASSERT(m_cbRobBankerCount > 0);
|
|||
|
|
m_wBankerUser = m_wRobBankerUser[rand() % m_cbRobBankerCount];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ϳ<EFBFBD>ʼ<EFBFBD><CABC>ע<EFBFBD><D7A2>Ϣ;
|
|||
|
|
CMD_S_StartChip stStartChip = { 0 };
|
|||
|
|
stStartChip.wBankerUser = m_wBankerUser;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_START_CHIP, &stStartChip, sizeof(stStartChip));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_START_CHIP, &stStartChip, sizeof(stStartChip));
|
|||
|
|
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_USER_CHIP);
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_USER_CHIP, IDT_USER_CHIP, 1, 0);
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_START_CHIP, &stStartChip, sizeof(stStartChip));
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ע<EFBFBD>¼<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnUserChipScore(WORD wChairID, LONG lScore)
|
|||
|
|
{
|
|||
|
|
const BYTE cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
ASSERT(GS_WK_USER_CHIP == cbGameStatus);
|
|||
|
|
if (GS_WK_USER_CHIP != cbGameStatus) return true;
|
|||
|
|
|
|||
|
|
//ASSERT(IsUserPlaying(wChairID));
|
|||
|
|
ASSERT(wChairID != m_wBankerUser);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>;
|
|||
|
|
if (INVALID_CHAIR != wChairID)
|
|||
|
|
{
|
|||
|
|
ASSERT(IsUserPlaying(wChairID));
|
|||
|
|
if (!IsUserPlaying(wChairID)) return true;
|
|||
|
|
|
|||
|
|
ASSERT(false == m_aryResponse[wChairID]);
|
|||
|
|
if (m_aryResponse[wChairID]) return true;
|
|||
|
|
m_aryResponse[wChairID] = true;
|
|||
|
|
|
|||
|
|
m_lTableScore[wChairID] = lScore;
|
|||
|
|
|
|||
|
|
CMD_S_UserChip stUserChip = { 0 };
|
|||
|
|
stUserChip.wChipUser = wChairID;
|
|||
|
|
stUserChip.lChipScore = lScore;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
// ׯ<>Ҳ<EFBFBD><D2B2><EFBFBD>Ҫ<EFBFBD><D2AA>ע;
|
|||
|
|
if ((i!=m_wBankerUser) && (m_aryHandStatus[i]>0) && (false==m_aryResponse[i]))
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʱ,û<><C3BB>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>;
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (0==m_aryHandStatus[i] || i == m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (false == m_aryResponse[i])
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע;
|
|||
|
|
m_lTableScore[i] = MIN_USER_CHIP;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
CMD_S_UserChip stUserChip = { 0 };
|
|||
|
|
stUserChip.wChipUser = i;
|
|||
|
|
stUserChip.lChipScore = MIN_USER_CHIP;
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
|
|||
|
|
// <20><>Ϸ¼<CFB7><C2BC>;
|
|||
|
|
addGameRecordAction(SUB_S_USER_CHIP, &stUserChip, sizeof(stUserChip));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
if (0==m_aryHandStatus[i])
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ÿ<EFBFBD><C3BF>ư<EFBFBD><C6B0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><CDB8>ͻ<EFBFBD><CDBB><EFBFBD>;
|
|||
|
|
CMD_S_SendLeftCard stLeftCard = { 0 };
|
|||
|
|
stLeftCard.cbLeftCardCount = 6;
|
|||
|
|
CopyMemory(stLeftCard.cbLeftCardData, &m_aryHandCardData[i][7], sizeof(BYTE)*stLeftCard.cbLeftCardCount);
|
|||
|
|
CopyMemory(stLeftCard.cbHandCardData, m_aryHandCardData[i], sizeof(stLeftCard.cbHandCardData));
|
|||
|
|
|
|||
|
|
m_pITableFrame->SendTableData(i, SUB_S_SEND_LEFT_CARD, &stLeftCard, sizeof(stLeftCard));
|
|||
|
|
m_pITableFrame->SendLookonData(i, SUB_S_SEND_LEFT_CARD, &stLeftCard, sizeof(stLeftCard));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_USER_CHIP);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
m_aryResponse[i] = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->SetGameStatus(GS_WK_OPEN_CARD);
|
|||
|
|
//m_pITableFrame->SetGameTimer(IDI_USER_OPERATE, IDT_USER_OPERATE, 1, 0);
|
|||
|
|
if (m_pGameCustomRule->bAutoBuildCard)
|
|||
|
|
{
|
|||
|
|
DWORD dwElapse = __max(IDT_USER_OPERATE, m_pGameCustomRule->wTimeOut * 1000);
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_AUTO_SHOW_CARD, dwElapse, 1, 0);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::ComputeChout()
|
|||
|
|
{
|
|||
|
|
ZeroMemory(m_aryNormalResult, sizeof(m_aryNormalResult));
|
|||
|
|
ZeroMemory(m_arySpecialResult, sizeof(m_arySpecialResult));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (!IsUserPlaying(i)) continue;
|
|||
|
|
|
|||
|
|
/////////////////////////////////////////////////////////////
|
|||
|
|
//<2F>Ʊȵ<C6B1><C8B5><EFBFBD>;
|
|||
|
|
if (m_arySpecialType[i] == CT_INVALID)
|
|||
|
|
{
|
|||
|
|
BYTE cbFrontCardType = m_aryHandCardType[i][0]; //m_GameLogic.GetCardType(m_aryFrontCard[i], 3, m_GameLogic.btCardSpecialData);
|
|||
|
|
BYTE cbMidCardType = m_aryHandCardType[i][1]; //m_GameLogic.GetCardType(m_aryMidCard[i], 5, m_GameLogic.btCardSpecialData);
|
|||
|
|
BYTE cbBackCardType = m_aryHandCardType[i][2]; //m_GameLogic.GetCardType(m_aryBackCard[i], 5, m_GameLogic.btCardSpecialData);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͬ;
|
|||
|
|
if (0==m_aryNormalResult[i][2] && (CT_FIVE_BOMB == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 10;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD>ͬ;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_BOMB == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 20;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>˳;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_FIVE_STRAIGHT_FLUSH_FIRST_A == cbBackCardType ||
|
|||
|
|
CT_FIVE_STRAIGHT_FLUSH_NO_A == cbBackCardType || CT_FIVE_STRAIGHT_FLUSH_BACK_A == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 5;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>ͬ<EFBFBD><CDAC>˳;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_STRAIGHT_FLUSH_FIRST_A == cbMidCardType ||
|
|||
|
|
CT_FIVE_STRAIGHT_FLUSH_NO_A == cbMidCardType || CT_FIVE_STRAIGHT_FLUSH_BACK_A == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 10;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ը<EFBFBD><D5A8>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_FIVE_FOUR_ONE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 4;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>ը<EFBFBD><D5A8>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_FOUR_ONE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 8;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>غ<EFBFBD>«;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_FIVE_THREE_DEOUBLE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>жغ<D0B6>«;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_THREE_DEOUBLE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 2;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && CT_FIVE_FLUSH == cbBackCardType)
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>ͬ<EFBFBD><CDAC>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && CT_FIVE_FLUSH == cbMidCardType)
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_FIVE_MIXED_FLUSH_NO_A == cbBackCardType ||
|
|||
|
|
CT_FIVE_MIXED_FLUSH_FIRST_A == cbBackCardType || CT_FIVE_MIXED_FLUSH_BACK_A == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>˳<EFBFBD><CBB3>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_MIXED_FLUSH_NO_A == cbMidCardType ||
|
|||
|
|
CT_FIVE_MIXED_FLUSH_FIRST_A == cbMidCardType || CT_FIVE_MIXED_FLUSH_BACK_A == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_THREE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_THREE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (0 == m_aryNormalResult[i][0] && (CT_THREE == cbFrontCardType))
|
|||
|
|
{
|
|||
|
|
//<2F><> 3;
|
|||
|
|
m_aryNormalResult[i][0] = 3;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_FIVE_TWO_DOUBLE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_FIVE_TWO_DOUBLE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_ONE_DOUBLE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>һ<EFBFBD><D2BB>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_ONE_DOUBLE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ǰ<><C7B0>һ<EFBFBD><D2BB>;
|
|||
|
|
if (0 == m_aryNormalResult[i][0] && (CT_ONE_DOUBLE == cbFrontCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][0] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2>;
|
|||
|
|
if (0 == m_aryNormalResult[i][2] && (CT_SINGLE == cbBackCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][2] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>ɢ<EFBFBD><C9A2>;
|
|||
|
|
if (0 == m_aryNormalResult[i][1] && (CT_SINGLE == cbMidCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][1] = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ǰ<><C7B0>ɢ<EFBFBD><C9A2>;
|
|||
|
|
if (0 == m_aryNormalResult[i][0] && (CT_SINGLE == cbFrontCardType))
|
|||
|
|
{
|
|||
|
|
m_aryNormalResult[i][0] = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//BYTE cbCardType = m_GameLogic.GetCardType(m_aryHandCardData[i], 13, m_GameLogic.btCardSpecialData);
|
|||
|
|
BYTE cbCardType = m_arySpecialType[i];
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THIRTEEN_FLUSH == cbCardType)
|
|||
|
|
{
|
|||
|
|
m_arySpecialResult[i] = 108;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THIRTEEN == cbCardType)
|
|||
|
|
{
|
|||
|
|
//һ<><D2BB><EFBFBD><EFBFBD>;
|
|||
|
|
m_arySpecialResult[i] = 36;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_TWELVE_KING == cbCardType)
|
|||
|
|
{
|
|||
|
|
//ʮ<><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
m_arySpecialResult[i] = 24;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THREE_STRAIGHTFLUSH == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><>ͬ<EFBFBD><CDAC>˳;
|
|||
|
|
m_arySpecialResult[i] = 20;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THREE_BOMB == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><>ը<EFBFBD><D5A8>;
|
|||
|
|
m_arySpecialResult[i] = 20;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_ALL_BIG == cbCardType)
|
|||
|
|
{
|
|||
|
|
//ȫ<><C8AB>;
|
|||
|
|
m_arySpecialResult[i] = 10;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_ALL_SMALL == cbCardType)
|
|||
|
|
{
|
|||
|
|
//ȫС;
|
|||
|
|
m_arySpecialResult[i] = 10;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_SAME_COLOR == cbCardType)
|
|||
|
|
{
|
|||
|
|
//һɫ;
|
|||
|
|
m_arySpecialResult[i] = 10;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_FOUR_THREESAME == cbCardType)
|
|||
|
|
{
|
|||
|
|
//4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
m_arySpecialResult[i] = 6;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_FIVEPAIR_THREE == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
m_arySpecialResult[i] = 5;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_SIXPAIR == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>;
|
|||
|
|
m_arySpecialResult[i] = 4;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THREE_STRAIGHT == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><>˳<EFBFBD><CBB3>;
|
|||
|
|
m_arySpecialResult[i] = 3;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (0 == m_arySpecialResult[i] && CT_THREE_FLUSH == cbCardType)
|
|||
|
|
{
|
|||
|
|
//<2F><>ͬ<EFBFBD><CDAC>;
|
|||
|
|
m_arySpecialResult[i] = 3;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::GetCompareResult()
|
|||
|
|
{
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>;
|
|||
|
|
ZeroMemory(m_aryShootState, sizeof(m_aryShootState));
|
|||
|
|
ZeroMemory(m_aryThreeKillResult, sizeof(m_aryThreeKillResult));
|
|||
|
|
ZeroMemory(m_aryToltalWinDaoShu, sizeof(m_aryToltalWinDaoShu));
|
|||
|
|
ZeroMemory(m_aryCompareDouble, sizeof(m_aryCompareDouble));
|
|||
|
|
ZeroMemory(m_aryGameScore, sizeof(m_aryGameScore));
|
|||
|
|
m_cbShootCount = 0;
|
|||
|
|
|
|||
|
|
int aryWinNum[GAME_PLAYER] = { 0 };
|
|||
|
|
for (int i = 0; i < 6; i++)
|
|||
|
|
{
|
|||
|
|
m_aryShootState[i][0] = 255;
|
|||
|
|
m_aryShootState[i][1] = 255;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LONG lCellScore = m_pGameServiceOption->lCellScore;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i<GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (!IsUserPlaying(i)) continue;
|
|||
|
|
|
|||
|
|
BYTE const cbConstUserFrontDaoShu = m_aryNormalResult[i][0];
|
|||
|
|
BYTE const cbConstUserMidDaoShu = m_aryNormalResult[i][1];
|
|||
|
|
BYTE const cbConstUserBackDaoShu = m_aryNormalResult[i][2];
|
|||
|
|
BYTE const cbSpecialUserDaoShu = m_arySpecialResult[i];
|
|||
|
|
|
|||
|
|
//<2F><>Ӯ<EFBFBD><D3AE><EFBFBD><EFBFBD>;
|
|||
|
|
for (WORD wCmpUser = 0; wCmpUser<GAME_PLAYER; ++wCmpUser)
|
|||
|
|
{
|
|||
|
|
LONG lWinDaoShu = 0;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>;
|
|||
|
|
if (!IsUserPlaying(wCmpUser)) continue;
|
|||
|
|
|
|||
|
|
if (i != wCmpUser)
|
|||
|
|
{
|
|||
|
|
BYTE const cbConstCmpUserFrontDaoShu = m_aryNormalResult[wCmpUser][0];
|
|||
|
|
BYTE const cbConstCmpUserMidDaoShu = m_aryNormalResult[wCmpUser][1];
|
|||
|
|
BYTE const cbConstCmpUserBackDaoShu = m_aryNormalResult[wCmpUser][2];
|
|||
|
|
BYTE const cbSpecialCmpUserDaoShu = m_arySpecialResult[wCmpUser];
|
|||
|
|
|
|||
|
|
//һ<>ҵ<EFBFBD>ˮһ<CBAE>Ҳ<EFBFBD><D2B2><EFBFBD>ˮ;
|
|||
|
|
if (m_aryDaoShui[i] && m_aryDaoShui[wCmpUser] == false)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (CT_INVALID==m_arySpecialType[wCmpUser])
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbConstCmpUserFrontDaoShu;
|
|||
|
|
m_aryCompareResult[i][0] -= cbConstCmpUserFrontDaoShu;
|
|||
|
|
|
|||
|
|
lWinDaoShu -= cbConstCmpUserMidDaoShu;
|
|||
|
|
m_aryCompareResult[i][1] -= cbConstCmpUserMidDaoShu;
|
|||
|
|
|
|||
|
|
lWinDaoShu -= cbConstCmpUserBackDaoShu;
|
|||
|
|
m_aryCompareResult[i][2] -= cbConstCmpUserBackDaoShu;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbSpecialCmpUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] -= cbSpecialCmpUserDaoShu;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//һ<>Ҳ<EFBFBD><D2B2><EFBFBD>ˮ<EFBFBD><CBAE>һ<EFBFBD>ҵ<EFBFBD>ˮ;
|
|||
|
|
else if (m_aryDaoShui[i] == false && m_aryDaoShui[wCmpUser])
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
if (CT_INVALID==m_arySpecialType[i])
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbConstUserFrontDaoShu;
|
|||
|
|
m_aryCompareResult[i][0] += cbConstUserFrontDaoShu;
|
|||
|
|
|
|||
|
|
lWinDaoShu += cbConstUserMidDaoShu;
|
|||
|
|
m_aryCompareResult[i][1] += cbConstUserMidDaoShu;
|
|||
|
|
|
|||
|
|
lWinDaoShu += cbConstUserBackDaoShu;
|
|||
|
|
m_aryCompareResult[i][2] += cbConstUserBackDaoShu;
|
|||
|
|
|
|||
|
|
aryWinNum[i]++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbSpecialUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] += cbSpecialUserDaoShu;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (m_aryDaoShui[i] == false && m_aryDaoShui[wCmpUser] == false)
|
|||
|
|
{
|
|||
|
|
if (CT_INVALID == m_arySpecialType[i] && CT_INVALID == m_arySpecialType[wCmpUser])
|
|||
|
|
{
|
|||
|
|
//ͷ<><CDB7><EFBFBD>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbFrontCompareResult = 0;
|
|||
|
|
BYTE cbFirstType = m_aryHandCardType[i][0];
|
|||
|
|
BYTE cbNextType = m_aryHandCardType[wCmpUser][0];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbFrontCompareResult = m_GameLogic.CompareCard(m_aryFrontCard[wCmpUser], m_aryFrontCard[i], 3, 3, true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbFrontCompareResult = (cbFirstType > cbNextType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>е<EFBFBD><D0B5>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbMidCardCompareResult = 0;
|
|||
|
|
cbFirstType = m_aryHandCardType[i][1];
|
|||
|
|
cbNextType = m_aryHandCardType[wCmpUser][1];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbMidCardCompareResult = m_GameLogic.CompareCard(m_aryMidCard[wCmpUser], m_aryMidCard[i], 5, 5, true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbMidCardCompareResult = (cbFirstType > cbNextType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//β<><CEB2><EFBFBD>Ƚ<EFBFBD>;
|
|||
|
|
BYTE cbBackCardCompareResult = 0;
|
|||
|
|
cbFirstType = m_aryHandCardType[i][2];
|
|||
|
|
cbNextType = m_aryHandCardType[wCmpUser][2];
|
|||
|
|
if (cbFirstType == cbNextType)
|
|||
|
|
{
|
|||
|
|
cbBackCardCompareResult = m_GameLogic.CompareCard(m_aryBackCard[wCmpUser], m_aryBackCard[i], 5, 5, true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
cbBackCardCompareResult = (cbFirstType > cbNextType) ? 1 : 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>Ӯ;
|
|||
|
|
if (cbFrontCompareResult == 1)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbConstUserFrontDaoShu;
|
|||
|
|
m_aryCompareResult[i][0] += cbConstUserFrontDaoShu;
|
|||
|
|
}
|
|||
|
|
else if (cbFrontCompareResult == 0)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbConstCmpUserFrontDaoShu;
|
|||
|
|
m_aryCompareResult[i][0] -= cbConstCmpUserFrontDaoShu;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbMidCardCompareResult == 1)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbConstUserMidDaoShu;
|
|||
|
|
m_aryCompareResult[i][1] += cbConstUserMidDaoShu;
|
|||
|
|
}
|
|||
|
|
else if (cbMidCardCompareResult == 0)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbConstCmpUserMidDaoShu;
|
|||
|
|
m_aryCompareResult[i][1] -= cbConstCmpUserMidDaoShu;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (cbBackCardCompareResult == 1)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbConstUserBackDaoShu;
|
|||
|
|
m_aryCompareResult[i][2] += cbConstUserBackDaoShu;
|
|||
|
|
}
|
|||
|
|
else if (cbBackCardCompareResult == 0)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbConstCmpUserBackDaoShu;
|
|||
|
|
m_aryCompareResult[i][2] -= cbConstCmpUserBackDaoShu;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ((cbFrontCompareResult == 1 && cbMidCardCompareResult == 1 && cbBackCardCompareResult == 1)
|
|||
|
|
/*||(cbFrontCompareResult==2&&cbMidCardCompareResult==1&&cbBackCardCompareResult==1)
|
|||
|
|
||(cbFrontCompareResult==2&&cbMidCardCompareResult==2&&cbBackCardCompareResult==1)
|
|||
|
|
||(cbFrontCompareResult==1&&cbMidCardCompareResult==1&&cbBackCardCompareResult==2)*/)
|
|||
|
|
{
|
|||
|
|
m_aryCompareDouble[i] += lWinDaoShu;
|
|||
|
|
//֮ǰ<D6AE><C7B0>ˮ<EFBFBD><CBAE>;
|
|||
|
|
m_aryShootDaoShu[i][wCmpUser] = lWinDaoShu;
|
|||
|
|
//<2F><>ǹ *2;
|
|||
|
|
lWinDaoShu *= 2;
|
|||
|
|
|
|||
|
|
m_PrivateEndInfo.aryShootTimes[i]++;
|
|||
|
|
|
|||
|
|
m_aryShootState[m_cbShootCount][0] = i; //Ӯ<><D3AE>;
|
|||
|
|
m_aryShootState[m_cbShootCount][1] = wCmpUser; //<2F><><EFBFBD><EFBFBD>;
|
|||
|
|
m_cbShootCount++;
|
|||
|
|
aryWinNum[i]++;
|
|||
|
|
}
|
|||
|
|
else if (cbFrontCompareResult == 0 && cbMidCardCompareResult == 0 && cbBackCardCompareResult == 0
|
|||
|
|
/*||cbFrontCompareResult==2&&cbMidCardCompareResult==0&&cbBackCardCompareResult==0
|
|||
|
|
||cbFrontCompareResult==2&&cbMidCardCompareResult==2&&cbBackCardCompareResult==0
|
|||
|
|
||cbFrontCompareResult==0&&cbMidCardCompareResult==0&&cbBackCardCompareResult==2*/)
|
|||
|
|
{
|
|||
|
|
m_aryCompareDouble[i] += lWinDaoShu;
|
|||
|
|
//<2F><>ǹ *2;
|
|||
|
|
m_aryShootDaoShu[i][wCmpUser] = lWinDaoShu;
|
|||
|
|
|
|||
|
|
//֮ǰ<D6AE><C7B0>ˮ<EFBFBD><CBAE>;
|
|||
|
|
lWinDaoShu *= 2;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (m_arySpecialType[i]>CT_INVALID && CT_INVALID == m_arySpecialType[wCmpUser])
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbSpecialUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] += cbSpecialUserDaoShu;
|
|||
|
|
}
|
|||
|
|
else if (m_arySpecialType[i]>CT_INVALID && m_arySpecialType[wCmpUser]>CT_INVALID)
|
|||
|
|
{
|
|||
|
|
BYTE cbCurCardType = m_arySpecialType[i];
|
|||
|
|
BYTE cbCmpCardType = m_arySpecialType[wCmpUser];
|
|||
|
|
|
|||
|
|
if (cbCurCardType>cbCmpCardType)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu += cbSpecialUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] += cbSpecialUserDaoShu;
|
|||
|
|
}
|
|||
|
|
else if (cbCurCardType<cbCmpCardType)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbSpecialCmpUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] -= cbSpecialCmpUserDaoShu;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (CT_INVALID==m_arySpecialType[i] && m_arySpecialType[wCmpUser]>CT_INVALID)
|
|||
|
|
{
|
|||
|
|
lWinDaoShu -= cbSpecialCmpUserDaoShu;
|
|||
|
|
m_arySpecialCompareResult[i] -= cbSpecialCmpUserDaoShu;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
m_aryGameScore[i] += lWinDaoShu*lCellScore;
|
|||
|
|
m_aryToltalWinDaoShu[i] += lWinDaoShu;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ȫ<EFBFBD>ݴ<EFBFBD><DDB4>ڼӼ<DABC><D3BC><EFBFBD>;
|
|||
|
|
for (int i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (aryWinNum[i] >= 3)
|
|||
|
|
{
|
|||
|
|
for (int j = 0; j < GAME_PLAYER; j++)
|
|||
|
|
{
|
|||
|
|
if (i == j)
|
|||
|
|
{
|
|||
|
|
m_aryGameScore[j] += 36 * lCellScore;
|
|||
|
|
m_aryToltalWinDaoShu[j] += 36;
|
|||
|
|
m_aryThreeKillResult[j] = 36;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_aryGameScore[j] -= 12 * lCellScore;
|
|||
|
|
m_aryToltalWinDaoShu[j] -= 12;
|
|||
|
|
m_aryThreeKillResult[j] = -12;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_wWinAllUser = i;
|
|||
|
|
|
|||
|
|
m_PrivateEndInfo.aryKillAllTimes[i]++;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::AutoShowCard(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
//ShowCard(wChairID);
|
|||
|
|
|
|||
|
|
|
|||
|
|
//״̬<D7B4>ж<EFBFBD>;
|
|||
|
|
IServerUserItem * pIServerUserItem = m_pITableFrame->GetTableUserItem(wChairID);
|
|||
|
|
if (nullptr == pIServerUserItem) return;
|
|||
|
|
|
|||
|
|
//if(pIServerUserItem->GetUserStatus() != US_PLAYING) return;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>;
|
|||
|
|
BYTE aryHandCardData[13] = { 0 };
|
|||
|
|
CopyMemory(aryHandCardData, m_aryHandCardData[wChairID], HAND_CARD_COUNT);
|
|||
|
|
m_GameLogic.SortCardList(aryHandCardData, HAND_CARD_COUNT, enDescend);
|
|||
|
|
|
|||
|
|
tagAnalyseType AnalyseType = m_GameLogic.GetType(aryHandCardData, HAND_CARD_COUNT);
|
|||
|
|
|
|||
|
|
BYTE aryFrontCard[3] = { 0 };
|
|||
|
|
BYTE aryMidCard[5] = { 0 };
|
|||
|
|
BYTE aryBackCard[5] = { 0 };
|
|||
|
|
m_GameLogic.TheBestCard(AnalyseType, aryHandCardData, HAND_CARD_COUNT, aryFrontCard, aryMidCard, aryBackCard);
|
|||
|
|
|
|||
|
|
if (0 == aryFrontCard[0] || 0 == aryMidCard[0] || 0 == aryBackCard[0])
|
|||
|
|
{
|
|||
|
|
//"δ<>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>ƣ<EFBFBD>";
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CMD_C_OpenCard mOpenCard;
|
|||
|
|
ZeroMemory(&mOpenCard, sizeof(CMD_C_OpenCard));
|
|||
|
|
memcpy(mOpenCard.cbFrontCard, aryFrontCard, sizeof(aryFrontCard));
|
|||
|
|
memcpy(mOpenCard.cbMidCard, aryMidCard, sizeof(aryMidCard));
|
|||
|
|
memcpy(mOpenCard.cbBackCard, aryBackCard, sizeof(aryBackCard));
|
|||
|
|
|
|||
|
|
OnUserShowCard(wChairID, &mOpenCard);
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
WORD CTableFrameSink::GetOnlineCount()
|
|||
|
|
{
|
|||
|
|
WORD dwOnlineUserCount = 0;
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; ++i)
|
|||
|
|
{
|
|||
|
|
IServerUserItem* pIServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pIServerUserItem != nullptr && pIServerUserItem->GetUserStatus() == US_PLAYING)
|
|||
|
|
{
|
|||
|
|
dwOnlineUserCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return dwOnlineUserCount;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Ƿ<EFBFBD>֧<EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::IsHaveRule(DWORD dwGameRule)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pITableFrame != nullptr);
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
const tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
if (nullptr == pPrivateFrame) return false;
|
|||
|
|
if (0 == pPrivateFrame->dwRoomNum) return false;
|
|||
|
|
|
|||
|
|
return ((pPrivateFrame->dwGameRule & dwGameRule) == dwGameRule);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::ResetPrivateEndInfo()
|
|||
|
|
{
|
|||
|
|
ZeroMemory(&m_PrivateEndInfo, sizeof(CMD_S_Private_End_Info));
|
|||
|
|
m_wBankerUser = INVALID_CHAIR;
|
|||
|
|
m_wPlayCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>;
|
|||
|
|
void CTableFrameSink::GetPrivateEndInfo(DataStream &kDataStream, bool bSend)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.StreamValue(kDataStream, bSend);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
bool CTableFrameSink::IsPrivateEnd()
|
|||
|
|
{
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
|
|||
|
|
if ((pPrivateFrame == nullptr) || (pPrivateRecord == nullptr)) return false;
|
|||
|
|
|
|||
|
|
if (pPrivateFrame->cbGameCout <= pPrivateRecord->cbFinishCout)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/////////////////////////////// <20><>Ϸ¼<CFB7><C2BC> ///////////////////////////////////////////
|
|||
|
|
|
|||
|
|
void CTableFrameSink::addGameRecordAction(WORD wSubCmdID, void* pSubMessage, int nMessageSize)
|
|||
|
|
{
|
|||
|
|
tagGameRecordOperateResult kOperateRecord;
|
|||
|
|
kOperateRecord.wSubCmdID = wSubCmdID;
|
|||
|
|
kOperateRecord.subMessageData.pushValue(pSubMessage, nMessageSize);
|
|||
|
|
m_kGameRecord.actionVec.push_back(kOperateRecord);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::starGameRecord()
|
|||
|
|
{
|
|||
|
|
m_kGameRecord = tagGameRecord();
|
|||
|
|
|
|||
|
|
m_kGameRecord.wBankerUser = m_wBankerUser;
|
|||
|
|
m_kGameRecord.wEastUser = 0;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
IServerUserItem* pUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (NULL==pUserItem)
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tagUserInfo* pUserInfo = pUserItem->GetUserInfo();
|
|||
|
|
if (pUserItem == NULL || NULL == pUserInfo)
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tagGameRecordPlayer kReocrdPlayer;
|
|||
|
|
kReocrdPlayer.dwUserID = pUserItem->GetUserID();
|
|||
|
|
kReocrdPlayer.dwGameID = pUserItem->GetGameID();
|
|||
|
|
kReocrdPlayer.wChairID = pUserItem->GetChairID();
|
|||
|
|
kReocrdPlayer.cbSex = pUserItem->GetGender();
|
|||
|
|
kReocrdPlayer.lScore = pUserItem->GetUserScore();
|
|||
|
|
kReocrdPlayer.strHead = pUserInfo->szHeadHttp;
|
|||
|
|
kReocrdPlayer.strNickName = pUserItem->GetNickName();
|
|||
|
|
|
|||
|
|
//for (BYTE j = 0; j < HAND_CARD_COUNT; j++)
|
|||
|
|
//{
|
|||
|
|
// kReocrdPlayer.cbCardData.push_back(m_aryHandCardData[i][j]);
|
|||
|
|
//}
|
|||
|
|
m_kGameRecord.playersVec.push_back(kReocrdPlayer);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|