Commit c46801c4 authored by nanahira's avatar nanahira

Merge branch 'master' into irrlicht_linux

parents 37386e0c 64e3e4e3
...@@ -1549,6 +1549,7 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1549,6 +1549,7 @@ void ClientField::RefreshCardCountDisplay() {
ClientCard* pcard; ClientCard* pcard;
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size(); mainGame->dInfo.card_count[p] = hand[p].size();
mainGame->dInfo.total_attack[p] = 0;
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) { for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
pcard = *it; pcard = *it;
if(pcard) { if(pcard) {
...@@ -1556,6 +1557,8 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1556,6 +1557,8 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count[p] += pcard->link; mainGame->dInfo.card_count[p] += pcard->link;
else else
mainGame->dInfo.card_count[p]++; mainGame->dInfo.card_count[p]++;
if(pcard->position == POS_FACEUP_ATTACK && pcard->attack > 0 && (p == 1 || mainGame->dInfo.curMsg != MSG_SELECT_BATTLECMD || pcard->cmdFlag & COMMAND_ATTACK))
mainGame->dInfo.total_attack[p] += pcard->attack;
} }
} }
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) { for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
...@@ -1564,6 +1567,7 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1564,6 +1567,7 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count[p]++; mainGame->dInfo.card_count[p]++;
} }
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]); myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
myswprintf(mainGame->dInfo.str_total_attack[p], L"%d", mainGame->dInfo.total_attack[p]);
} }
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) { if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00; mainGame->dInfo.card_count_color[0] = 0xffffff00;
...@@ -1575,5 +1579,15 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1575,5 +1579,15 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count_color[0] = 0xffffffff; mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff; mainGame->dInfo.card_count_color[1] = 0xffffffff;
} }
if(mainGame->dInfo.total_attack[0] > mainGame->dInfo.total_attack[1]) {
mainGame->dInfo.total_attack_color[0] = 0xffffff00;
mainGame->dInfo.total_attack_color[1] = 0xffff0000;
} else if(mainGame->dInfo.total_attack[1] > mainGame->dInfo.total_attack[0]) {
mainGame->dInfo.total_attack_color[1] = 0xffffff00;
mainGame->dInfo.total_attack_color[0] = 0xffff0000;
} else {
mainGame->dInfo.total_attack_color[0] = 0xffffffff;
mainGame->dInfo.total_attack_color[1] = 0xffffffff;
}
} }
} }
...@@ -567,6 +567,12 @@ void Game::DrawMisc() { ...@@ -567,6 +567,12 @@ void Game::DrawMisc() {
DrawShadowText(numFont, dInfo.str_card_count[0], Resize(550, 31, 575, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[0], Resize(550, 31, 575, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], Resize(757, 31, 782, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[1], Resize(757, 31, 782, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[0], Resize(486, 31, 536, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[1], Resize(793, 31, 843, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(477, 32, 486, 50, 486, 41), recti(32, 0, 96, 128), 0, 0, true);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(784, 32, 793, 50, 793, 41), recti(32, 0, 96, 128), 0, 0, true);
/* /*
driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff);
...@@ -580,6 +586,12 @@ void Game::DrawMisc() { ...@@ -580,6 +586,12 @@ void Game::DrawMisc() {
DrawShadowText(numFont, dInfo.str_card_count[0], Resize(600, 31, 625, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[0], Resize(600, 31, 625, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], Resize(707, 31, 732, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[1], Resize(707, 31, 732, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[0], Resize(536, 31, 586, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[1], Resize(743, 31, 793, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(527, 32, 536, 50, 536, 41), recti(32, 0, 96, 128), 0, 0, true);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(734, 32, 743, 50, 743, 41), recti(32, 0, 96, 128), 0, 0, true);
} }
DrawShadowText(numFont, dInfo.strLP[0], Resize(330, 12, 631, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.strLP[0], Resize(330, 12, 631, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
......
...@@ -977,7 +977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -977,7 +977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -995,7 +995,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -995,7 +995,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1006,7 +1006,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1006,7 +1006,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1017,7 +1017,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1017,7 +1017,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(data); mainGame->logParam.push_back(data);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1028,7 +1028,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1028,7 +1028,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1234,6 +1234,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1234,6 +1234,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.attackable_cards.push_back(pcard); mainGame->dField.attackable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_ATTACK; pcard->cmdFlag |= COMMAND_ATTACK;
} }
mainGame->dField.RefreshCardCountDisplay();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadInt8(pbuf)) {
mainGame->btnM2->setVisible(true); mainGame->btnM2->setVisible(true);
...@@ -2405,6 +2406,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2405,6 +2406,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
mainGame->showcarddif = 30; mainGame->showcarddif = 30;
mainGame->showcardp = 0; mainGame->showcardp = 0;
mainGame->dField.RefreshCardCountDisplay();
switch (phase) { switch (phase) {
case PHASE_DRAW: case PHASE_DRAW:
mainGame->btnPhaseStatus->setText(L"\xff24\xff30"); mainGame->btnPhaseStatus->setText(L"\xff24\xff30");
......
...@@ -1633,7 +1633,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1633,7 +1633,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
str.append(formatBuffer); str.append(formatBuffer);
} }
should_show_tip = true; should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height)); mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height));
mainGame->stTip->setText(str.c_str()); mainGame->stTip->setText(str.c_str());
} }
...@@ -1989,15 +1989,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1989,15 +1989,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.KeyInput.Key) { switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: { case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0 if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
case irr::KEY_F9: { case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1 if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
......
...@@ -74,6 +74,7 @@ struct DuelInfo { ...@@ -74,6 +74,7 @@ struct DuelInfo {
int lp[2]; int lp[2];
int start_lp[2]; int start_lp[2];
int card_count[2]; int card_count[2];
int total_attack[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -90,7 +91,9 @@ struct DuelInfo { ...@@ -90,7 +91,9 @@ struct DuelInfo {
wchar_t str_time_left[2][16]; wchar_t str_time_left[2][16];
video::SColor time_color[2]; video::SColor time_color[2];
wchar_t str_card_count[2][16]; wchar_t str_card_count[2][16];
wchar_t str_total_attack[2][16];
video::SColor card_count_color[2]; video::SColor card_count_color[2];
video::SColor total_attack_color[2];
bool isReplaySwapped; bool isReplaySwapped;
std::vector<unsigned int> announce_cache; std::vector<unsigned int> announce_cache;
}; };
......
...@@ -777,7 +777,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -777,7 +777,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
memcpy(msgbuf, begin, len + 1); memcpy(msgbuf, begin, len + 1);
BufferIO::DecodeUTF8(msgbuf, msg); BufferIO::DecodeUTF8(msgbuf, msg);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment