Commit 48d84bcc authored by nanahira's avatar nanahira

Merge branch 'master' into side

parents 9f632d6e ee40e6d0
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
*.log *.log
/.vscode /.vscode
/bak/ /bak/
/output
/temp /temp
[Tt]humbs.cdb [Tt]humbs.cdb
......
No preview for this file type
...@@ -94,6 +94,7 @@ void ClientField::Clear() { ...@@ -94,6 +94,7 @@ void ClientField::Clear() {
pzone_act[1] = false; pzone_act[1] = false;
conti_act = false; conti_act = false;
deck_reversed = false; deck_reversed = false;
RefreshCardCountDisplay();
} }
void ClientField::Initial(int player, int deckc, int extrac) { void ClientField::Initial(int player, int deckc, int extrac) {
ClientCard* pcard; ClientCard* pcard;
...@@ -117,6 +118,7 @@ void ClientField::Initial(int player, int deckc, int extrac) { ...@@ -117,6 +118,7 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->position = POS_FACEDOWN_DEFENSE; pcard->position = POS_FACEDOWN_DEFENSE;
GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true); GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true);
} }
RefreshCardCountDisplay();
} }
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) { ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0; std::vector<ClientCard*>* lst = 0;
...@@ -226,6 +228,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -226,6 +228,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
break; break;
} }
} }
RefreshCardCountDisplay();
} }
ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) { ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
ClientCard* pcard = 0; ClientCard* pcard = 0;
...@@ -297,6 +300,7 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) { ...@@ -297,6 +300,7 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
} }
} }
pcard->location = 0; pcard->location = 0;
RefreshCardCountDisplay();
return pcard; return pcard;
} }
void ClientField::UpdateCard(int controler, int location, int sequence, char* data) { void ClientField::UpdateCard(int controler, int location, int sequence, char* data) {
...@@ -1462,4 +1466,28 @@ void ClientField::UpdateDeclarableCode(bool enter) { ...@@ -1462,4 +1466,28 @@ void ClientField::UpdateDeclarableCode(bool enter) {
else else
UpdateDeclarableCodeOpcode(enter); UpdateDeclarableCodeOpcode(enter);
} }
void ClientField::RefreshCardCountDisplay() {
for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size();
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
}
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
}
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00;
mainGame->dInfo.card_count_color[1] = 0xffff0000;
} else if(mainGame->dInfo.card_count[1] > mainGame->dInfo.card_count[0]) {
mainGame->dInfo.card_count_color[1] = 0xffffff00;
mainGame->dInfo.card_count_color[0] = 0xffff0000;
} else {
mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff;
}
}
} }
...@@ -115,6 +115,8 @@ public: ...@@ -115,6 +115,8 @@ public:
void UpdateDeclarableCodeOpcode(bool enter); void UpdateDeclarableCodeOpcode(bool enter);
void UpdateDeclarableCode(bool enter); void UpdateDeclarableCode(bool enter);
void RefreshCardCountDisplay();
irr::gui::IGUIElement* panel; irr::gui::IGUIElement* panel;
std::vector<int> ancard; std::vector<int> ancard;
int hovered_controler; int hovered_controler;
......
...@@ -313,24 +313,7 @@ bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) { ...@@ -313,24 +313,7 @@ bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) {
return result == 0; return result == 0;
#endif #endif
} }
const wchar_t* DeckManager::GetMainFormatString() { int DeckManager::TypeCount(std::vector<code_pointer> list, unsigned int ctype) {
myswprintf(DeckFormatBuffer, L"%d ( Monster: %d / Spell: %d / Trap: %d )", deckManager.current_deck.main.size(), GetTypeCount(deckManager.current_deck.main, TYPE_MONSTER), GetTypeCount(deckManager.current_deck.main, TYPE_SPELL), GetTypeCount(deckManager.current_deck.main, TYPE_TRAP));
wchar_t* result = DeckFormatBuffer;
return result;
}
const wchar_t* DeckManager::GetExtraFormatString() {
myswprintf(DeckFormatBuffer, L"%d ( Fusion: %d / Synchro: %d / Xyz: %d / Link: %d )", deckManager.current_deck.extra.size(), GetTypeCount(deckManager.current_deck.extra, TYPE_FUSION), GetTypeCount(deckManager.current_deck.extra, TYPE_SYNCHRO), GetTypeCount(deckManager.current_deck.extra, TYPE_XYZ), GetTypeCount(deckManager.current_deck.extra, TYPE_LINK));
wchar_t* result = DeckFormatBuffer;
return result;
}
const wchar_t* DeckManager::GetSideFormatString() {
int mc = GetTypeCount(deckManager.current_deck.side, TYPE_MONSTER);
int ec = GetTypeCount(deckManager.current_deck.side, TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK);
myswprintf(DeckFormatBuffer, L"%d ( Monster: %d / Spell: %d / Trap: %d / Extra: %d )", deckManager.current_deck.side.size(), mc - ec, GetTypeCount(deckManager.current_deck.side, TYPE_SPELL), GetTypeCount(deckManager.current_deck.side, TYPE_TRAP), ec);
wchar_t* result = DeckFormatBuffer;
return result;
}
int DeckManager::GetTypeCount(std::vector<code_pointer> list, unsigned int ctype) {
int res = 0; int res = 0;
for(size_t i = 0; i < list.size(); ++i) { for(size_t i = 0; i < list.size(); ++i) {
code_pointer cur = list[i]; code_pointer cur = list[i];
......
...@@ -46,10 +46,7 @@ public: ...@@ -46,10 +46,7 @@ public:
bool DeleteDeck(Deck& deck, const wchar_t* name); bool DeleteDeck(Deck& deck, const wchar_t* name);
static bool RenameDeck(const wchar_t* oldname, const wchar_t* newname); static bool RenameDeck(const wchar_t* oldname, const wchar_t* newname);
wchar_t DeckFormatBuffer[128]; wchar_t DeckFormatBuffer[128];
const wchar_t* GetMainFormatString(); int TypeCount(std::vector<code_pointer> list, unsigned int ctype);
const wchar_t* GetSideFormatString();
const wchar_t* GetExtraFormatString();
int GetTypeCount(std::vector<code_pointer> list, unsigned int ctype);
}; };
extern DeckManager deckManager; extern DeckManager deckManager;
......
...@@ -531,19 +531,31 @@ void Game::DrawMisc() { ...@@ -531,19 +531,31 @@ void Game::DrawMisc() {
} }
} }
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
DrawShadowText(numFont, L"/", Resize(455, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0); if(imageManager.tClock) {
DrawShadowText(numFont, dInfo.str_time_left[0], Resize(455, 31, 490, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0); driver->draw2DImage(imageManager.tClock, ResizeCardMid(472, 32, 490, 50, 490, 41), recti(0, 0, 128, 128), 0, 0, true);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(490, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0); driver->draw2DImage(imageManager.tClock, ResizeCardMid(800, 32, 818, 50, 818, 41), recti(0, 0, 128, 128), 0, 0, true);
}
DrawShadowText(numFont, dInfo.str_time_left[0], Resize(490, 31, 520, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], Resize(818, 31, 848, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tCover[0], ResizeCardMid(433, 32, 445, 50, 455, 41), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tCover[1], ResizeCardMid(850, 32, 862, 50, 862, 41), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
DrawShadowText(numFont, L"/", Resize(795, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[0], Resize(445, 31, 470, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], Resize(795, 31, 830, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[1], Resize(862, 31, 887, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(830, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
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);
driver->draw2DRectangle(Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(Resize(695, 34, 795, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(695, 34, 795, 44), 0xffffffff);
} }
else {
driver->draw2DImage(imageManager.tCover[0], ResizeCardMid(588, 32, 600, 50, 600, 41), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tCover[1], ResizeCardMid(695, 32, 707, 50, 707, 41), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
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.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);
...@@ -1122,8 +1134,21 @@ void Game::DrawDeckBd() { ...@@ -1122,8 +1134,21 @@ void Game::DrawDeckBd() {
//main deck //main deck
driver->draw2DRectangle(Resize(310, 137, 797, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 137, 797, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 136, 797, 157)); driver->draw2DRectangleOutline(Resize(309, 136, 797, 157));
DrawShadowText(textFont, dataManager.GetSysString(1330), Resize(315, 137, 510, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(textFont, dataManager.GetSysString(1330), Resize(315, 137, 410, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, deckManager.GetMainFormatString(), Resize(380, 138, 797, 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.main.size()], Resize(380, 138, 440, 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//monster count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1312));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 3) - (25 * 3), 137, 797 - (55 * 2) - (25 * 3), 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.main, TYPE_MONSTER)], Resize(797 - (55 * 2) - (25 * 3), 138, 797 - (55 * 2) - (25 * 2), 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//spell count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1313));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 2) - (25 * 2), 137, 797 - (55 * 1) - (25 * 2), 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.main, TYPE_SPELL)], Resize(797 - (55 * 1) - (25 * 2), 138, 797 - (55 * 1) - (25 * 1), 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//trap count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1314));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 1) - (25 * 1), 137, 797 - (55 * 0) - (25 * 1), 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.main, TYPE_TRAP)], Resize(797 - (55 * 0) - (25 * 1), 138, 797 - (55 * 0) - (25 * 0), 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
driver->draw2DRectangle(Resize(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 159, 797, 436)); driver->draw2DRectangleOutline(Resize(309, 159, 797, 436));
int lx; int lx;
...@@ -1143,8 +1168,25 @@ void Game::DrawDeckBd() { ...@@ -1143,8 +1168,25 @@ void Game::DrawDeckBd() {
//extra deck //extra deck
driver->draw2DRectangle(Resize(310, 440, 797, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 440, 797, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 439, 797, 460)); driver->draw2DRectangleOutline(Resize(309, 439, 797, 460));
DrawShadowText(textFont, dataManager.GetSysString(1331), Resize(315, 440, 510, 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(textFont, dataManager.GetSysString(1331), Resize(315, 440, 410, 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, deckManager.GetExtraFormatString(), Resize(380, 441, 797, 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.extra.size()], Resize(380, 441, 440, 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//fusion count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1056));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 4) - (25 * 4), 440, 797 - (55 * 3) - (25 * 4), 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.extra, TYPE_FUSION)], Resize(797 - (55 * 3) - (25 * 4), 441, 797 - (55 * 3) - (25 * 3), 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//synchro count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1063));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 3) - (25 * 3), 440, 797 - (55 * 2) - (25 * 3), 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.extra, TYPE_SYNCHRO)], Resize(797 - (55 * 2) - (25 * 3), 441, 797 - (55 * 2) - (25 * 2), 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//xyz count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1073));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 2) - (25 * 2), 440, 797 - (55 * 1) - (25 * 2), 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.extra, TYPE_XYZ)], Resize(797 - (55 * 1) - (25 * 2), 441, 797 - (55 * 1) - (25 * 1), 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//link count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1076));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 1) - (25 * 1), 440, 797 - (55 * 0) - (25 * 1), 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.extra, TYPE_LINK)], Resize(797 - (55 * 0) - (25 * 1), 441, 797 - (55 * 0) - (25 * 0), 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
driver->draw2DRectangle(Resize(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 462, 797, 533)); driver->draw2DRectangleOutline(Resize(309, 462, 797, 533));
if(deckManager.current_deck.extra.size() <= 10) if(deckManager.current_deck.extra.size() <= 10)
...@@ -1158,8 +1200,21 @@ void Game::DrawDeckBd() { ...@@ -1158,8 +1200,21 @@ void Game::DrawDeckBd() {
//side deck //side deck
driver->draw2DRectangle(Resize(310, 537, 797, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 537, 797, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 536, 797, 557)); driver->draw2DRectangleOutline(Resize(309, 536, 797, 557));
DrawShadowText(textFont, dataManager.GetSysString(1332), Resize(315, 537, 510, 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(textFont, dataManager.GetSysString(1332), Resize(315, 537, 410, 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, deckManager.GetSideFormatString(), Resize(380, 538, 797, 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.side.size()], Resize(380, 538, 440, 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//monster count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1312));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 3) - (25 * 3), 537, 797 - (55 * 2) - (25 * 3), 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.side, TYPE_MONSTER)], Resize(797 - (55 * 2) - (25 * 3), 538, 797 - (55 * 2) - (25 * 2), 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//spell count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1313));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 2) - (25 * 2), 537, 797 - (55 * 1) - (25 * 2), 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.side, TYPE_SPELL)], Resize(797 - (55 * 1) - (25 * 2), 538, 797 - (55 * 1) - (25 * 1), 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
//trap count
myswprintf(textBuffer, L"%ls:", dataManager.GetSysString(1314));
DrawShadowText(textFont, textBuffer, Resize(797 - (55 * 1) - (25 * 1), 537, 797 - (55 * 0) - (25 * 1), 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
DrawShadowText(numFont, dataManager.numStrings[deckManager.TypeCount(deckManager.current_deck.side, TYPE_TRAP)], Resize(797 - (55 * 0) - (25 * 1), 538, 797 - (55 * 0) - (25 * 0), 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
driver->draw2DRectangle(Resize(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(309, 559, 797, 630)); driver->draw2DRectangleOutline(Resize(309, 559, 797, 630));
if(deckManager.current_deck.side.size() <= 10) if(deckManager.current_deck.side.size() <= 10)
......
...@@ -2334,7 +2334,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2334,7 +2334,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
std::vector<ClientCard*>::iterator cit; std::vector<ClientCard*>::iterator cit;
std::vector<ClientCard*>* lst = 0;
int loc = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
if(loc == LOCATION_MZONE)
lst = mainGame->dField.mzone;
else
lst = mainGame->dField.szone;
ClientCard* mc[5]; ClientCard* mc[5];
ClientCard* swp; ClientCard* swp;
int c, l, s, ps; int c, l, s, ps;
...@@ -2343,7 +2349,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2343,7 +2349,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
l = BufferIO::ReadInt8(pbuf); l = BufferIO::ReadInt8(pbuf);
s = BufferIO::ReadInt8(pbuf); s = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf); BufferIO::ReadInt8(pbuf);
mc[i] = mainGame->dField.mzone[c][s]; mc[i] = lst[c][s];
mc[i]->SetCode(0); mc[i]->SetCode(0);
if(!mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
mc[i]->dPos = irr::core::vector3df((3.95f - mc[i]->curPos.X) / 10, 0, 0.05f); mc[i]->dPos = irr::core::vector3df((3.95f - mc[i]->curPos.X) / 10, 0, 0.05f);
...@@ -2361,9 +2367,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2361,9 +2367,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf); BufferIO::ReadInt8(pbuf);
ps = mc[i]->sequence; ps = mc[i]->sequence;
if (l > 0) { if (l > 0) {
swp = mainGame->dField.mzone[c][s]; swp = lst[c][s];
mainGame->dField.mzone[c][ps] = swp; lst[c][ps] = swp;
mainGame->dField.mzone[c][s] = mc[i]; lst[c][s] = mc[i];
mc[i]->sequence = s; mc[i]->sequence = s;
swp->sequence = ps; swp->sequence = ps;
} }
......
...@@ -1858,7 +1858,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1858,7 +1858,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break; break;
} }
u32 pos = mainGame->scrCardText->getPos(); u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->textFont, mainGame->showingtext, pos); mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
return true; return true;
break; break;
} }
......
...@@ -855,7 +855,6 @@ void Game::RefreshTimeDisplay() { ...@@ -855,7 +855,6 @@ void Game::RefreshTimeDisplay() {
} }
myswprintf(dInfo.str_time_left[0], L"%d", dInfo.time_left[0]); myswprintf(dInfo.str_time_left[0], L"%d", dInfo.time_left[0]);
myswprintf(dInfo.str_time_left[1], L"%d", dInfo.time_left[1]); myswprintf(dInfo.str_time_left[1], L"%d", dInfo.time_left[1]);
myswprintf(dInfo.str_time_limit, L"%d", dInfo.time_limit);
} }
void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) { void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) {
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)
...@@ -1435,7 +1434,7 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1435,7 +1434,7 @@ void Game::ShowCardInfo(int code, bool resize) {
sc = aptr->second.setcode; sc = aptr->second.setcode;
} }
if(sc) { if(sc) {
offset = 23 * yScale; offset = 23;// *yScale;
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc)); myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc));
stSetName->setText(formatBuffer); stSetName->setText(formatBuffer);
} else } else
...@@ -1476,24 +1475,24 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1476,24 +1475,24 @@ void Game::ShowCardInfo(int code, bool resize) {
wcscat(formatBuffer, scaleBuffer); wcscat(formatBuffer, scaleBuffer);
} }
stDataInfo->setText(formatBuffer); stDataInfo->setText(formatBuffer);
if (cd.type & TYPE_LINK && cd.level > 5 && window_size.Width < 1220.0) { int offset_sayuri = 0;
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, (83 + 15) * yScale)); if(cd.type & TYPE_LINK && cd.level > 5 && window_size.Width < 1220.0)
stSetName->setRelativePosition(rect<s32>(15, (83 + 15) * yScale, 296 * xScale, (83 + 15) * yScale + offset)); offset_sayuri = 15;
stText->setRelativePosition(rect<s32>(15, (83 + 15) * yScale + offset, 287 * xScale, 324 * yScale)); stDataInfo->setRelativePosition(rect<s32>(15, 60, 300 * xScale - 13, (83 + offset_sayuri)));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + 15) + offset, 287 * xScale, 324 * yScale)); //stSetName->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) * yScale, 296 * xScale, (83 + offset_sayuri) * yScale + offset));
} else { //stText->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) * yScale + offset, 287 * xScale, 324 * yScale));
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale)); stSetName->setRelativePosition(rect<s32>(15, (83 + offset_sayuri), 296 * xScale, (83 + offset_sayuri) + offset));
stSetName->setRelativePosition(rect<s32>(15, 83 * yScale, 296 * xScale, 83 * yScale + offset)); stText->setRelativePosition(rect<s32>(15, (83 + offset_sayuri) + offset, 287 * xScale, 324 * yScale));
stText->setRelativePosition(rect<s32>(15, 83 * yScale + offset, 287 * xScale, 324 * yScale)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + offset_sayuri) + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 83 + offset, 287 * xScale, 324 * yScale));
}
} else { } else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type)); myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer); stInfo->setText(formatBuffer);
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale)); stDataInfo->setRelativePosition(recti(15, 60, 300 * xScale - 13, 83));
stDataInfo->setText(L""); stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60 * yScale, 296 * xScale, 60 * yScale + offset)); //stSetName->setRelativePosition(rect<s32>(15, 60 * yScale, 296 * xScale, 60 * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 60 * yScale + offset, 287 * xScale, 324 * yScale)); //stText->setRelativePosition(rect<s32>(15, 60 * yScale + offset, 287 * xScale, 324 * yScale));
stSetName->setRelativePosition(rect<s32>(15, 60, 296 * xScale, 60 + offset));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
} }
showingcode = code; showingcode = code;
...@@ -1673,6 +1672,9 @@ void Game::CloseDuelWindow() { ...@@ -1673,6 +1672,9 @@ void Game::CloseDuelWindow() {
wReplaySave->setVisible(false); wReplaySave->setVisible(false);
stHintMsg->setVisible(false); stHintMsg->setVisible(false);
btnSideOK->setVisible(false); btnSideOK->setVisible(false);
btnSideShuffle->setVisible(false);
btnSideSort->setVisible(false);
btnSideReload->setVisible(false);
btnLeaveGame->setVisible(false); btnLeaveGame->setVisible(false);
btnSpectatorSwap->setVisible(false); btnSpectatorSwap->setVisible(false);
btnChainIgnore->setVisible(false); btnChainIgnore->setVisible(false);
...@@ -1716,7 +1718,7 @@ void Game::OnResize() { ...@@ -1716,7 +1718,7 @@ void Game::OnResize() {
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale); lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale);
//guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale); //guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale);
//env->getSkin()->setFont(guiFont); //env->getSkin()->setFont(guiFont);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale); textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, (yScale > 0.642 ? gameConf.textfontsize * yScale : 9));
old_numFont->drop(); old_numFont->drop();
old_adFont->drop(); old_adFont->drop();
old_lpcFont->drop(); old_lpcFont->drop();
...@@ -1819,8 +1821,9 @@ void Game::OnResize() { ...@@ -1819,8 +1821,9 @@ void Game::OnResize() {
wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18)); wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18));
imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0)); imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0));
wInfos->setRelativePosition(Resize(1, 275, 301, 639)); wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22 * yScale)); stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22));
stInfo->setRelativePosition(recti(15, 37 * yScale, 300 * xScale - 13, 60 * yScale)); //stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22 * yScale));
//stInfo->setRelativePosition(recti(15, 37 * yScale, 300 * xScale - 13, 60 * yScale));
//stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale)); //stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
lstLog->setRelativePosition(Resize(10, 10, 290, 290)); lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition(); //const auto& tsize = stText->getRelativePosition();
......
...@@ -69,6 +69,7 @@ struct DuelInfo { ...@@ -69,6 +69,7 @@ struct DuelInfo {
bool tag_player[2]; bool tag_player[2];
int lp[2]; int lp[2];
int start_lp[2]; int start_lp[2];
int card_count[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -82,9 +83,10 @@ struct DuelInfo { ...@@ -82,9 +83,10 @@ struct DuelInfo {
unsigned char time_player; unsigned char time_player;
unsigned short time_limit; unsigned short time_limit;
unsigned short time_left[2]; unsigned short time_left[2];
wchar_t str_time_limit[16];
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];
video::SColor card_count_color[2];
bool isReplaySwapped; bool isReplaySwapped;
}; };
......
...@@ -74,6 +74,7 @@ bool ImageManager::Initial() { ...@@ -74,6 +74,7 @@ bool ImageManager::Initial() {
snprintf(buff, 100, "textures/pscale/lscale_%d.png", i); snprintf(buff, 100, "textures/pscale/lscale_%d.png", i);
tLScale[i] = driver->getTexture(buff); tLScale[i] = driver->getTexture(buff);
} }
tClock = driver->getTexture("textures/clock.png");
return true; return true;
} }
irr::video::ITexture* ImageManager::GetRandomImage(int image_type) { irr::video::ITexture* ImageManager::GetRandomImage(int image_type) {
......
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
irr::video::ITexture* tFieldTransparent[2]; irr::video::ITexture* tFieldTransparent[2];
irr::video::ITexture* tRScale[14]; irr::video::ITexture* tRScale[14];
irr::video::ITexture* tLScale[14]; irr::video::ITexture* tLScale[14];
irr::video::ITexture* tClock;
}; };
extern ImageManager imageManager; extern ImageManager imageManager;
......
...@@ -499,6 +499,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -499,6 +499,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
......
...@@ -879,14 +879,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -879,14 +879,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
NetServer::ReSendToPlayer(players[1]); NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
RefreshMzone(0, 0x181fff, 0); if(loc == LOCATION_MZONE) {
RefreshMzone(1, 0x181fff, 0); RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
}
else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
......
...@@ -417,6 +417,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -417,6 +417,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
pbuf++;
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
......
...@@ -843,6 +843,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -843,6 +843,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_SET_CARD: { case MSG_SHUFFLE_SET_CARD: {
int loc = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf); count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8; pbuf += count * 8;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -851,8 +852,13 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -851,8 +852,13 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer::ReSendToPlayer(players[3]); NetServer::ReSendToPlayer(players[3]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
RefreshMzone(0, 0x181fff, 0); if(loc == LOCATION_MZONE) {
RefreshMzone(1, 0x181fff, 0); RefreshMzone(0, 0x181fff, 0);
RefreshMzone(1, 0x181fff, 0);
} else {
RefreshSzone(0, 0x181fff, 0);
RefreshSzone(1, 0x181fff, 0);
}
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
......
Subproject commit 5484e52fd1a9e81c36101e0bb8e4e1e859368fe5 Subproject commit 9fb43bf0ef49641ba985b7b7a6666221acf5cf1e
...@@ -2,11 +2,9 @@ solution "ygo" ...@@ -2,11 +2,9 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Release", "Debug" }
defines { "LUA_COMPAT_5_2" } defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
......
Subproject commit eadaf7e6d270095cc47c5980c6fc1de95cfce530 Subproject commit ace33ce35cf778cb38fb187148c4ed58d63f8460
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