Commit 8c7dd9d7 authored by mercury233's avatar mercury233

test resize (from edo9300)

parent 99e8cff7
...@@ -662,8 +662,9 @@ void DeckBuilder::GetHoveredCard() { ...@@ -662,8 +662,9 @@ void DeckBuilder::GetHoveredCard() {
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root) if(root->getElementFromPoint(mouse_pos) != root)
return; return;
int x = mouse_pos.X; position2di pos = mainGame->ResizeReverse(mouse_pos.X, mouse_pos.Y);
int y = mouse_pos.Y; int x = pos.X;
int y = pos.Y;
int pre_code = hovered_code; int pre_code = hovered_code;
hovered_pos = 0; hovered_pos = 0;
hovered_code = 0; hovered_code = 0;
...@@ -732,8 +733,8 @@ void DeckBuilder::GetHoveredCard() { ...@@ -732,8 +733,8 @@ void DeckBuilder::GetHoveredCard() {
} }
} }
if(is_draging) { if(is_draging) {
dragx = x; dragx = mouse_pos.X;
dragy = y; dragy = mouse_pos.Y;
} }
if(!is_draging && pre_code != hovered_code) { if(!is_draging && pre_code != hovered_code) {
if(hovered_code) if(hovered_code)
......
...@@ -67,13 +67,13 @@ void Game::DrawBackGround() { ...@@ -67,13 +67,13 @@ void Game::DrawBackGround() {
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix); driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
bool drawField = false; bool drawField = false;
int rule = (dInfo.duel_rule >= 4) ? 1 : 0; int rule = (dInfo.duel_rule >= 4) ? 1 : 0;
if(mainGame->gameConf.draw_field_spell) { if(gameConf.draw_field_spell) {
int fieldcode1 = -1; int fieldcode1 = -1;
int fieldcode2 = -1; int fieldcode2 = -1;
if(mainGame->dField.szone[0][5] && mainGame->dField.szone[0][5]->position & POS_FACEUP) if(dField.szone[0][5] && dField.szone[0][5]->position & POS_FACEUP)
fieldcode1 = mainGame->dField.szone[0][5]->code; fieldcode1 = dField.szone[0][5]->code;
if(mainGame->dField.szone[1][5] && mainGame->dField.szone[1][5]->position & POS_FACEUP) if(dField.szone[1][5] && dField.szone[1][5]->position & POS_FACEUP)
fieldcode2 = mainGame->dField.szone[1][5]->code; fieldcode2 = dField.szone[1][5]->code;
int fieldcode = (fieldcode1 > 0) ? fieldcode1 : fieldcode2; int fieldcode = (fieldcode1 > 0) ? fieldcode1 : fieldcode2;
if(fieldcode1 > 0 && fieldcode2 > 0 && fieldcode1 != fieldcode2) { if(fieldcode1 > 0 && fieldcode2 > 0 && fieldcode1 != fieldcode2) {
ITexture* texture = imageManager.GetTextureField(fieldcode1); ITexture* texture = imageManager.GetTextureField(fieldcode1);
...@@ -169,7 +169,7 @@ void Game::DrawBackGround() { ...@@ -169,7 +169,7 @@ void Game::DrawBackGround() {
vertex = matManager.vFieldDeck[dField.hovered_controler]; vertex = matManager.vFieldDeck[dField.hovered_controler];
else if (dField.hovered_location == LOCATION_MZONE) { else if (dField.hovered_location == LOCATION_MZONE) {
vertex = matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence]; vertex = matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence];
ClientCard* pcard = mainGame->dField.mzone[dField.hovered_controler][dField.hovered_sequence]; ClientCard* pcard = dField.mzone[dField.hovered_controler][dField.hovered_sequence];
if(pcard && pcard->type & TYPE_LINK) { if(pcard && pcard->type & TYPE_LINK) {
DrawLinkedZones(pcard); DrawLinkedZones(pcard);
} }
...@@ -201,12 +201,12 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -201,12 +201,12 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
ClientCard* pcard2; ClientCard* pcard2;
if (dField.hovered_sequence < 5) { if (dField.hovered_sequence < 5) {
if (mark & LINK_MARKER_LEFT && dField.hovered_sequence > 0) { if (mark & LINK_MARKER_LEFT && dField.hovered_sequence > 0) {
pcard2 = mainGame->dField.mzone[dField.hovered_controler][dField.hovered_sequence - 1]; pcard2 = dField.mzone[dField.hovered_controler][dField.hovered_sequence - 1];
CheckMutual(pcard2, LINK_MARKER_RIGHT); CheckMutual(pcard2, LINK_MARKER_RIGHT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence - 1], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence - 1], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_RIGHT && dField.hovered_sequence < 4) { if (mark & LINK_MARKER_RIGHT && dField.hovered_sequence < 4) {
pcard2 = mainGame->dField.mzone[dField.hovered_controler][dField.hovered_sequence + 1]; pcard2 = dField.mzone[dField.hovered_controler][dField.hovered_sequence + 1];
CheckMutual(pcard2, LINK_MARKER_LEFT); CheckMutual(pcard2, LINK_MARKER_LEFT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence + 1], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][dField.hovered_sequence + 1], 4, matManager.iRectangle, 2);
} }
...@@ -215,9 +215,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -215,9 +215,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
|| (mark & LINK_MARKER_TOP && dField.hovered_sequence == 1) || (mark & LINK_MARKER_TOP && dField.hovered_sequence == 1)
|| (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 0)) { || (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 0)) {
int mark = (dField.hovered_sequence == 2) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 1) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT; int mark = (dField.hovered_sequence == 2) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 1) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT;
pcard2 = mainGame->dField.mzone[dField.hovered_controler][5]; pcard2 = dField.mzone[dField.hovered_controler][5];
if (!pcard2) { if (!pcard2) {
pcard2 = mainGame->dField.mzone[1 - dField.hovered_controler][6]; pcard2 = dField.mzone[1 - dField.hovered_controler][6];
mark = (dField.hovered_sequence == 2) ? LINK_MARKER_TOP_LEFT : (dField.hovered_sequence == 1) ? LINK_MARKER_TOP : LINK_MARKER_TOP_RIGHT; mark = (dField.hovered_sequence == 2) ? LINK_MARKER_TOP_LEFT : (dField.hovered_sequence == 1) ? LINK_MARKER_TOP : LINK_MARKER_TOP_RIGHT;
} }
CheckMutual(pcard2, mark); CheckMutual(pcard2, mark);
...@@ -227,9 +227,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -227,9 +227,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
|| (mark & LINK_MARKER_TOP && dField.hovered_sequence == 3) || (mark & LINK_MARKER_TOP && dField.hovered_sequence == 3)
|| (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 2)) { || (mark & LINK_MARKER_TOP_RIGHT && dField.hovered_sequence == 2)) {
int mark = (dField.hovered_sequence == 4) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 3) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT; int mark = (dField.hovered_sequence == 4) ? LINK_MARKER_BOTTOM_RIGHT : (dField.hovered_sequence == 3) ? LINK_MARKER_BOTTOM : LINK_MARKER_BOTTOM_LEFT;
pcard2 = mainGame->dField.mzone[dField.hovered_controler][6]; pcard2 = dField.mzone[dField.hovered_controler][6];
if (!pcard2) { if (!pcard2) {
pcard2 = mainGame->dField.mzone[1 - dField.hovered_controler][5]; pcard2 = dField.mzone[1 - dField.hovered_controler][5];
mark = (dField.hovered_sequence == 4) ? LINK_MARKER_TOP_LEFT : (dField.hovered_sequence == 3) ? LINK_MARKER_TOP : LINK_MARKER_TOP_RIGHT; mark = (dField.hovered_sequence == 4) ? LINK_MARKER_TOP_LEFT : (dField.hovered_sequence == 3) ? LINK_MARKER_TOP : LINK_MARKER_TOP_RIGHT;
} }
CheckMutual(pcard2, mark); CheckMutual(pcard2, mark);
...@@ -239,32 +239,32 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -239,32 +239,32 @@ void Game::DrawLinkedZones(ClientCard* pcard) {
} else { } else {
int swap = (dField.hovered_sequence == 5) ? 0 : 2; int swap = (dField.hovered_sequence == 5) ? 0 : 2;
if (mark & LINK_MARKER_BOTTOM_LEFT) { if (mark & LINK_MARKER_BOTTOM_LEFT) {
pcard2 = mainGame->dField.mzone[dField.hovered_controler][0 + swap]; pcard2 = dField.mzone[dField.hovered_controler][0 + swap];
CheckMutual(pcard2, LINK_MARKER_TOP_RIGHT); CheckMutual(pcard2, LINK_MARKER_TOP_RIGHT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][0 + swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][0 + swap], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_BOTTOM) { if (mark & LINK_MARKER_BOTTOM) {
pcard2 = mainGame->dField.mzone[dField.hovered_controler][1 + swap]; pcard2 = dField.mzone[dField.hovered_controler][1 + swap];
CheckMutual(pcard2, LINK_MARKER_TOP); CheckMutual(pcard2, LINK_MARKER_TOP);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][1 + swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][1 + swap], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_BOTTOM_RIGHT) { if (mark & LINK_MARKER_BOTTOM_RIGHT) {
pcard2 = mainGame->dField.mzone[dField.hovered_controler][2 + swap]; pcard2 = dField.mzone[dField.hovered_controler][2 + swap];
CheckMutual(pcard2, LINK_MARKER_TOP_LEFT); CheckMutual(pcard2, LINK_MARKER_TOP_LEFT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][2 + swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[dField.hovered_controler][2 + swap], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_TOP_LEFT) { if (mark & LINK_MARKER_TOP_LEFT) {
pcard2 = mainGame->dField.mzone[1 - dField.hovered_controler][4 - swap]; pcard2 = dField.mzone[1 - dField.hovered_controler][4 - swap];
CheckMutual(pcard2, LINK_MARKER_TOP_LEFT); CheckMutual(pcard2, LINK_MARKER_TOP_LEFT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][4 - swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][4 - swap], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_TOP) { if (mark & LINK_MARKER_TOP) {
pcard2 = mainGame->dField.mzone[1 - dField.hovered_controler][3 - swap]; pcard2 = dField.mzone[1 - dField.hovered_controler][3 - swap];
CheckMutual(pcard2, LINK_MARKER_TOP); CheckMutual(pcard2, LINK_MARKER_TOP);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][3 - swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][3 - swap], 4, matManager.iRectangle, 2);
} }
if (mark & LINK_MARKER_TOP_RIGHT) { if (mark & LINK_MARKER_TOP_RIGHT) {
pcard2 = mainGame->dField.mzone[1 - dField.hovered_controler][2 - swap]; pcard2 = dField.mzone[1 - dField.hovered_controler][2 - swap];
CheckMutual(pcard2, LINK_MARKER_TOP_RIGHT); CheckMutual(pcard2, LINK_MARKER_TOP_RIGHT);
driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][2 - swap], 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(&matManager.vFieldMzone[1 - dField.hovered_controler][2 - swap], 4, matManager.iRectangle, 2);
} }
...@@ -452,20 +452,20 @@ void Game::DrawMisc() { ...@@ -452,20 +452,20 @@ void Game::DrawMisc() {
} }
//lp bar //lp bar
if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) { if((dInfo.turn % 2 && dInfo.isFirst) || (!(dInfo.turn % 2) && !dInfo.isFirst)) {
driver->draw2DRectangle(0xa0000000, recti(327, 8, 630, 51)); driver->draw2DRectangle(0xa0000000, Resize(327, 8, 630, 51));
driver->draw2DRectangleOutline(recti(327, 8, 630, 51), 0xffff8080); driver->draw2DRectangleOutline(Resize(327, 8, 630, 51), 0xffff8080);
} else { } else {
driver->draw2DRectangle(0xa0000000, recti(689, 8, 991, 51)); driver->draw2DRectangle(0xa0000000, Resize(689, 8, 991, 51));
driver->draw2DRectangleOutline(recti(689, 8, 991, 51), 0xffff8080); driver->draw2DRectangleOutline(Resize(689, 8, 991, 51), 0xffff8080);
} }
driver->draw2DImage(imageManager.tLPFrame, recti(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, recti(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, Resize(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.lp[0] >= 8000) if(dInfo.lp[0] >= 8000)
driver->draw2DImage(imageManager.tLPBar, recti(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, recti(335, 12, 335 + 290 * dInfo.lp[0] / 8000, 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / 8000, 28), recti(0, 0, 16, 16), 0, 0, true);
if(dInfo.lp[1] >= 8000) if(dInfo.lp[1] >= 8000)
driver->draw2DImage(imageManager.tLPBar, recti(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
else driver->draw2DImage(imageManager.tLPBar, recti(986 - 290 * dInfo.lp[1] / 8000, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / 8000, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
if(lpframe) { if(lpframe) {
dInfo.lp[lpplayer] -= lpd; dInfo.lp[lpplayer] -= lpd;
myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]); myswprintf(dInfo.strLP[lpplayer], L"%d", dInfo.lp[lpplayer]);
...@@ -474,39 +474,43 @@ void Game::DrawMisc() { ...@@ -474,39 +474,43 @@ void Game::DrawMisc() {
} }
if(lpcstring) { if(lpcstring) {
if(lpplayer == 0) { if(lpplayer == 0) {
lpcFont->draw(lpcstring, recti(400, 470, 920, 520), lpccolor | 0x00ffffff, true, false, 0); lpcFont->draw(lpcstring, Resize(400, 470, 920, 520), lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(400, 472, 922, 520), lpccolor, true, false, 0); lpcFont->draw(lpcstring, Resize(400, 472, 922, 520), lpccolor, true, false, 0);
} else { } else {
lpcFont->draw(lpcstring, recti(400, 160, 920, 210), lpccolor | 0x00ffffff, true, false, 0); lpcFont->draw(lpcstring, Resize(400, 160, 920, 210), lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(400, 162, 922, 210), lpccolor, true, false, 0); lpcFont->draw(lpcstring, Resize(400, 162, 922, 210), lpccolor, true, false, 0);
} }
} }
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
driver->draw2DRectangle(recti(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(recti(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff);
driver->draw2DRectangle(recti(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(recti(695, 34, 795, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(695, 34, 795, 44), 0xffffffff);
} }
numFont->draw(dInfo.strLP[0], recti(330, 11, 629, 30), 0xff000000, true, false, 0); numFont->draw(dInfo.strLP[0], Resize(330, 11, 629, 30), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[0], recti(330, 12, 631, 30), 0xffffff00, true, false, 0); numFont->draw(dInfo.strLP[0], Resize(330, 12, 631, 30), 0xffffff00, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(691, 11, 990, 30), 0xff000000, true, false, 0); numFont->draw(dInfo.strLP[1], Resize(691, 11, 990, 30), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(691, 12, 992, 30), 0xffffff00, true, false, 0); numFont->draw(dInfo.strLP[1], Resize(691, 12, 992, 30), 0xffffff00, true, false, 0);
recti p1size = Resize(335, 31, 629, 50);
recti p2size = Resize(986, 31, 986, 50);
if(!dInfo.isTag || !dInfo.tag_player[0]) if(!dInfo.isTag || !dInfo.tag_player[0])
textFont->draw(dInfo.hostname, recti(335, 31, 629, 50), 0xffffffff, false, false, 0); textFont->draw(dInfo.hostname, p1size, 0xffffffff, false, false, 0);
else else
textFont->draw(dInfo.hostname_tag, recti(335, 31, 629, 50), 0xffffffff, false, false, 0); textFont->draw(dInfo.hostname_tag, p1size, 0xffffffff, false, false, 0);
if(!dInfo.isTag || !dInfo.tag_player[1]) { if(!dInfo.isTag || !dInfo.tag_player[1]) {
auto cld = textFont->getDimension(dInfo.clientname); auto cld = textFont->getDimension(dInfo.clientname);
textFont->draw(dInfo.clientname, recti(986 - cld.Width, 31, 986, 50), 0xffffffff, false, false, 0); p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname, p2size, 0xffffffff, false, false, 0);
} else { } else {
auto cld = textFont->getDimension(dInfo.clientname_tag); auto cld = textFont->getDimension(dInfo.clientname_tag);
textFont->draw(dInfo.clientname_tag, recti(986 - cld.Width, 31, 986, 50), 0xffffffff, false, false, 0); p2size.UpperLeftCorner.X -= cld.Width;
textFont->draw(dInfo.clientname_tag, p2size, 0xffffffff, false, false, 0);
} }
driver->draw2DRectangle(recti(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff); driver->draw2DRectangle(Resize(632, 10, 688, 30), 0x00000000, 0x00000000, 0xffffffff, 0xffffffff);
driver->draw2DRectangle(recti(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000); driver->draw2DRectangle(Resize(632, 30, 688, 50), 0xffffffff, 0xffffffff, 0x00000000, 0x00000000);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 685, 40), 0x80000000, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), Resize(635, 5, 685, 40), 0x80000000, true, false, 0);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 687, 40), 0x8000ffff, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), Resize(635, 5, 687, 40), 0x8000ffff, true, false, 0);
ClientCard* pcard; ClientCard* pcard;
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
pcard = dField.mzone[0][i]; pcard = dField.mzone[0][i];
...@@ -533,125 +537,125 @@ void Game::DrawMisc() { ...@@ -533,125 +537,125 @@ void Game::DrawMisc() {
if(dInfo.duel_rule < 4) { if(dInfo.duel_rule < 4) {
pcard = dField.szone[0][6]; pcard = dField.szone[0][6];
if(pcard) { if(pcard) {
adFont->draw(pcard->lscstring, recti(426, 394, 438, 414), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, Resize(426, 394, 438, 414), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(427, 395, 439, 415), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, Resize(427, 395, 439, 415), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[0][7]; pcard = dField.szone[0][7];
if(pcard) { if(pcard) {
adFont->draw(pcard->rscstring, recti(880, 394, 912, 414), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, Resize(880, 394, 912, 414), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(881, 395, 913, 415), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, Resize(881, 395, 913, 415), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][6]; pcard = dField.szone[1][6];
if(pcard) { if(pcard) {
adFont->draw(pcard->lscstring, recti(839, 245, 871, 265), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, Resize(839, 245, 871, 265), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(840, 246, 872, 266), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, Resize(840, 246, 872, 266), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][7]; pcard = dField.szone[1][7];
if(pcard) { if(pcard) {
adFont->draw(pcard->rscstring, recti(463, 245, 495, 265), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, Resize(463, 245, 495, 265), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(464, 246, 496, 266), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, Resize(464, 246, 496, 266), 0xffffffff, true, false, 0);
} }
} else { } else {
pcard = dField.szone[0][0]; pcard = dField.szone[0][0];
if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) { if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) {
adFont->draw(pcard->lscstring, recti(454, 430, 466, 450), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, Resize(454, 430, 466, 450), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(455, 431, 467, 451), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, Resize(455, 431, 467, 451), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[0][4]; pcard = dField.szone[0][4];
if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) { if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) {
adFont->draw(pcard->rscstring, recti(850, 430, 882, 450), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, Resize(850, 430, 882, 450), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(851, 431, 883, 451), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, Resize(851, 431, 883, 451), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][0]; pcard = dField.szone[1][0];
if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) { if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) {
adFont->draw(pcard->lscstring, recti(806, 222, 838, 242), 0xff000000, true, false, 0); adFont->draw(pcard->lscstring, Resize(806, 222, 838, 242), 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(807, 223, 839, 243), 0xffffffff, true, false, 0); adFont->draw(pcard->lscstring, Resize(807, 223, 839, 243), 0xffffffff, true, false, 0);
} }
pcard = dField.szone[1][4]; pcard = dField.szone[1][4];
if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) { if(pcard && (pcard->type & TYPE_PENDULUM) && !pcard->equipTarget) {
adFont->draw(pcard->rscstring, recti(498, 222, 530, 242), 0xff000000, true, false, 0); adFont->draw(pcard->rscstring, Resize(498, 222, 530, 242), 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(499, 223, 531, 243), 0xffffffff, true, false, 0); adFont->draw(pcard->rscstring, Resize(499, 223, 531, 243), 0xffffffff, true, false, 0);
} }
} }
if(dField.extra[0].size()) { if(dField.extra[0].size()) {
int offset = (dField.extra[0].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width; int offset = (dField.extra[0].size() >= 10) ? 0 : textFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 562, 371, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[0].size()), Resize(320 + offset, 562, 371, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 563, 373, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[0].size()), Resize(320 + offset, 563, 373, 553), 0xffffff00, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), recti(340, 562, 391, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), Resize(340, 562, 391, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), recti(340, 563, 393, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[0], true), Resize(340, 563, 393, 553), 0xffffff00, true, false, 0);
} }
if(dField.deck[0].size()) { if(dField.deck[0].size()) {
numFont->draw(dataManager.GetNumString(dField.deck[0].size()), recti(907, 562, 1021, 552), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[0].size()), Resize(907, 562, 1021, 552), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[0].size()), recti(908, 563, 1023, 553), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[0].size()), Resize(908, 563, 1023, 553), 0xffffff00, true, false, 0);
} }
if (rule == 0) { if (rule == 0) {
if (dField.grave[0].size()) { if (dField.grave[0].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(837, 375, 984, 380), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), Resize(837, 375, 984, 380), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(837, 376, 986, 381), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), Resize(837, 376, 986, 381), 0xffffff00, true, false, 0);
} }
if (dField.remove[0].size()) { if (dField.remove[0].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(1015, 375, 957, 380), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), Resize(1015, 375, 957, 380), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(1015, 376, 959, 381), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), Resize(1015, 376, 959, 381), 0xffffff00, true, false, 0);
} }
} else { } else {
if (dField.grave[0].size()) { if (dField.grave[0].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(870, 456, 1002, 461), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), Resize(870, 456, 1002, 461), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(870, 457, 1004, 462), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[0].size()), Resize(870, 457, 1004, 462), 0xffffff00, true, false, 0);
} }
if (dField.remove[0].size()) { if (dField.remove[0].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(837, 375, 984, 380), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), Resize(837, 375, 984, 380), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(837, 376, 986, 381), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[0].size()), Resize(837, 376, 986, 381), 0xffffff00, true, false, 0);
} }
} }
if(dField.extra[1].size()) { if(dField.extra[1].size()) {
int offset = (dField.extra[1].size() >= 10) ? 0 : mainGame->textFont->getDimension(dataManager.GetNumString(1)).Width; int offset = (dField.extra[1].size() >= 10) ? 0 : textFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 207, 898, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[1].size()), Resize(808 + offset, 207, 898, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 208, 900, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra[1].size()), Resize(808 + offset, 208, 900, 233), 0xffffff00, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), recti(828, 207, 918, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), Resize(828, 207, 918, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), recti(828, 208, 920, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.extra_p_count[1], true), Resize(828, 208, 920, 233), 0xffffff00, true, false, 0);
} }
if(dField.deck[1].size()) { if(dField.deck[1].size()) {
numFont->draw(dataManager.GetNumString(dField.deck[1].size()), recti(465, 207, 481, 232), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[1].size()), Resize(465, 207, 481, 232), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[1].size()), recti(465, 208, 483, 233), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.deck[1].size()), Resize(465, 208, 483, 233), 0xffffff00, true, false, 0);
} }
if (rule == 0) { if (rule == 0) {
if (dField.grave[1].size()) { if (dField.grave[1].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(420, 310, 462, 281), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), Resize(420, 310, 462, 281), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(420, 311, 464, 282), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), Resize(420, 311, 464, 282), 0xffffff00, true, false, 0);
} }
if (dField.remove[1].size()) { if (dField.remove[1].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(300, 310, 443, 340), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), Resize(300, 310, 443, 340), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(300, 311, 445, 341), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), Resize(300, 311, 445, 341), 0xffffff00, true, false, 0);
} }
} else { } else {
if (dField.grave[1].size()) { if (dField.grave[1].size()) {
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(455, 249, 462, 299), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), Resize(455, 249, 462, 299), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(455, 250, 464, 300), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.grave[1].size()), Resize(455, 250, 464, 300), 0xffffff00, true, false, 0);
} }
if (dField.remove[1].size()) { if (dField.remove[1].size()) {
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(420, 310, 462, 281), 0xff000000, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), Resize(420, 310, 462, 281), 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(420, 311, 464, 282), 0xffffff00, true, false, 0); numFont->draw(dataManager.GetNumString(dField.remove[1].size()), Resize(420, 311, 464, 282), 0xffffff00, true, false, 0);
} }
} }
} }
void Game::DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2) { void Game::DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2) {
adFont->draw(L"/", recti(x1 - 4, y1, x1 + 4, y1 + 20), 0xff000000, true, false, 0); adFont->draw(L"/", Resize(x1 - 4, y1, x1 + 4, y1 + 20), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(x1 - 3, y1 + 1, x1 + 5, y1 + 21), 0xffffffff, true, false, 0); adFont->draw(L"/", Resize(x1 - 3, y1 + 1, x1 + 5, y1 + 21), 0xffffffff, true, false, 0);
int w = adFont->getDimension(pcard->atkstring).Width; int w = adFont->getDimension(pcard->atkstring).Width;
adFont->draw(pcard->atkstring, recti(x1 - 5 - w, y1, x1 - 5, y1 + 20), 0xff000000, false, false, 0); adFont->draw(pcard->atkstring, Resize(x1 - 5 - w, y1, x1 - 5, y1 + 20), 0xff000000, false, false, 0);
adFont->draw(pcard->atkstring, recti(x1 - 4 - w, y1 + 1, x1 - 4, y1 + 21), adFont->draw(pcard->atkstring, Resize(x1 - 4 - w, y1 + 1, x1 - 4, y1 + 21),
pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff, false, false, 0); pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff, false, false, 0);
if(pcard->type & TYPE_LINK) { if(pcard->type & TYPE_LINK) {
w = adFont->getDimension(pcard->linkstring).Width; w = adFont->getDimension(pcard->linkstring).Width;
adFont->draw(pcard->linkstring, recti(x1 + 4, y1, x1 + 4 + w, y1 + 20), 0xff000000, false, false, 0); adFont->draw(pcard->linkstring, Resize(x1 + 4, y1, x1 + 4 + w, y1 + 20), 0xff000000, false, false, 0);
adFont->draw(pcard->linkstring, recti(x1 + 5, y1 + 1, x1 + 5 + w, y1 + 21), 0xff99ffff, false, false, 0); adFont->draw(pcard->linkstring, Resize(x1 + 5, y1 + 1, x1 + 5 + w, y1 + 21), 0xff99ffff, false, false, 0);
} else { } else {
w = adFont->getDimension(pcard->defstring).Width; w = adFont->getDimension(pcard->defstring).Width;
adFont->draw(pcard->defstring, recti(x1 + 4, y1, x1 + 4 + w, y1 + 20), 0xff000000, false, false, 0); adFont->draw(pcard->defstring, Resize(x1 + 4, y1, x1 + 4 + w, y1 + 20), 0xff000000, false, false, 0);
adFont->draw(pcard->defstring, recti(x1 + 5, y1 + 1, x1 + 5 + w, y1 + 21), adFont->draw(pcard->defstring, Resize(x1 + 5, y1 + 1, x1 + 5 + w, y1 + 21),
pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff, false, false, 0); pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff, false, false, 0);
adFont->draw(pcard->lvstring, recti(x2, y2, x2 + 2, y2 + 20), 0xff000000, false, false, 0); adFont->draw(pcard->lvstring, Resize(x2, y2, x2 + 2, y2 + 20), 0xff000000, false, false, 0);
adFont->draw(pcard->lvstring, recti(x2 + 1, y2, x2 + 3, y2 + 21), adFont->draw(pcard->lvstring, Resize(x2 + 1, y2, x2 + 3, y2 + 21),
(pcard->type & TYPE_XYZ) ? 0xffff80ff : (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0); (pcard->type & TYPE_XYZ) ? 0xffff80ff : (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
} }
} }
...@@ -745,8 +749,8 @@ void Game::DrawSpec() { ...@@ -745,8 +749,8 @@ void Game::DrawSpec() {
if(showcard) { if(showcard) {
switch(showcard) { switch(showcard) {
case 1: { case 1: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 404), driver->draw2DImage(imageManager.tMask, ResizeElem(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 404),
recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true); recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= CARD_IMG_HEIGHT) { if(showcarddif >= CARD_IMG_HEIGHT) {
...@@ -756,8 +760,8 @@ void Game::DrawSpec() { ...@@ -756,8 +760,8 @@ void Game::DrawSpec() {
break; break;
} }
case 2: { case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574 + showcarddif, 150, 761, 404), recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true); driver->draw2DImage(imageManager.tMask, ResizeElem(574 + showcarddif, 150, 761, 404), recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= CARD_IMG_WIDTH) { if(showcarddif >= CARD_IMG_WIDTH) {
showcard = 0; showcard = 0;
...@@ -765,8 +769,8 @@ void Game::DrawSpec() { ...@@ -765,8 +769,8 @@ void Game::DrawSpec() {
break; break;
} }
case 3: { case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tNegated, recti(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true); driver->draw2DImage(imageManager.tNegated, ResizeElem(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
break; break;
...@@ -776,8 +780,8 @@ void Game::DrawSpec() { ...@@ -776,8 +780,8 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 24) | 0xffffff; matManager.c2d[1] = (showcarddif << 24) | 0xffffff;
matManager.c2d[2] = (showcarddif << 24) | 0xffffff; matManager.c2d[2] = (showcarddif << 24) | 0xffffff;
matManager.c2d[3] = (showcarddif << 24) | 0xffffff; matManager.c2d[3] = (showcarddif << 24) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode), recti(574, 154, 751, 404), driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeElem(574, 154, 751, 404),
recti(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeElem(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 255) if(showcarddif < 255)
showcarddif += 17; showcarddif += 17;
break; break;
...@@ -787,15 +791,15 @@ void Game::DrawSpec() { ...@@ -787,15 +791,15 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 25) | 0xffffff; matManager.c2d[1] = (showcarddif << 25) | 0xffffff;
matManager.c2d[2] = (showcarddif << 25) | 0xffffff; matManager.c2d[2] = (showcarddif << 25) | 0xffffff;
matManager.c2d[3] = (showcarddif << 25) | 0xffffff; matManager.c2d[3] = (showcarddif << 25) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode), recti(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif), driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeElem(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif),
recti(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeElem(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 127) if(showcarddif < 127)
showcarddif += 9; showcarddif += 9;
break; break;
} }
case 6: { case 6: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tNumber, recti(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), driver->draw2DImage(imageManager.tNumber, ResizeElem(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif),
recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true); recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
...@@ -803,12 +807,12 @@ void Game::DrawSpec() { ...@@ -803,12 +807,12 @@ void Game::DrawSpec() {
} }
case 7: { case 7: {
core::position2d<s32> corner[4]; core::position2d<s32> corner[4];
float y = sin(showcarddif * 3.1415926f / 180.0f) * CARD_IMG_HEIGHT; float y = sin(showcarddif * 3.1415926f / 180.0f) * CARD_IMG_HEIGHT * yScale;
corner[0] = core::position2d<s32>(574 - (CARD_IMG_HEIGHT - y) * 0.3f, 404 - y); corner[0] = core::position2d<s32>(574 * xScale - (CARD_IMG_HEIGHT * yScale - y) * 0.3f, 404 * yScale - y);
corner[1] = core::position2d<s32>(751 + (CARD_IMG_HEIGHT - y) * 0.3f, 404 - y); corner[1] = core::position2d<s32>(751 * xScale + (CARD_IMG_HEIGHT * yScale - y) * 0.3f, 404 * yScale - y);
corner[2] = core::position2d<s32>(574, 404); corner[2] = core::position2d<s32>(574 * xScale, 404 * yScale);
corner[3] = core::position2d<s32>(751, 404); corner[3] = core::position2d<s32>(751 * xScale, 404 * yScale);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner); irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), ResizeElem(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
showcardp++; showcardp++;
showcarddif += 9; showcarddif += 9;
if(showcarddif >= 90) if(showcarddif >= 90)
...@@ -821,8 +825,8 @@ void Game::DrawSpec() { ...@@ -821,8 +825,8 @@ void Game::DrawSpec() {
} }
case 100: { case 100: {
if(showcardp < 60) { if(showcardp < 60) {
driver->draw2DImage(imageManager.tHand[(showcardcode >> 16) & 0x3], position2di(615, showcarddif)); driver->draw2DImage(imageManager.tHand[(showcardcode >> 16) & 0x3], Resize(615, showcarddif));
driver->draw2DImage(imageManager.tHand[showcardcode & 0x3], position2di(615, 540 - showcarddif)); driver->draw2DImage(imageManager.tHand[showcardcode & 0x3], Resize(615, 540 - showcarddif));
float dy = -0.333333f * showcardp + 10; float dy = -0.333333f * showcardp + 10;
showcardp++; showcardp++;
if(showcardp < 30) if(showcardp < 30)
...@@ -880,21 +884,21 @@ void Game::DrawSpec() { ...@@ -880,21 +884,21 @@ void Game::DrawSpec() {
auto pos = lpcFont->getDimension(lstr); auto pos = lpcFont->getDimension(lstr);
if(showcardp < 10) { if(showcardp < 10) {
int alpha = (showcardp * 25) << 24; int alpha = (showcardp * 25) << 24;
lpcFont->draw(lstr, recti(651 - pos.Width / 2 - (9 - showcardp) * 40, 291, 950, 370), alpha); lpcFont->draw(lstr, ResizeElem(651 - pos.Width / 2 - (9 - showcardp) * 40, 291, 950, 370), alpha);
lpcFont->draw(lstr, recti(650 - pos.Width / 2 - (9 - showcardp) * 40, 290, 950, 370), alpha | 0xffffff); lpcFont->draw(lstr, ResizeElem(650 - pos.Width / 2 - (9 - showcardp) * 40, 290, 950, 370), alpha | 0xffffff);
} else if(showcardp < showcarddif) { } else if(showcardp < showcarddif) {
recti loc = recti(650 - pos.Width / 2, 290, 950, 370); recti loc = ResizeElem(650 - pos.Width / 2, 290, 950, 370);
lpcFont->draw(lstr, recti(651 - pos.Width / 2, 291, 950, 370), 0xff000000); lpcFont->draw(lstr, ResizeElem(651 - pos.Width / 2, 291, 950, 370), 0xff000000);
lpcFont->draw(lstr, loc, 0xffffffff); lpcFont->draw(lstr, loc, 0xffffffff);
if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) { if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) {
driver->draw2DRectangle(0xa0000000, recti(540, 320, 800, 340)); driver->draw2DRectangle(0xa0000000, ResizeElem(540, 320, 800, 340));
guiFont->draw(dInfo.vic_string, recti(502, 321, 840, 340), 0xff000000, true, true); guiFont->draw(dInfo.vic_string, ResizeElem(502, 321, 840, 340), 0xff000000, true, true);
guiFont->draw(dInfo.vic_string, recti(500, 320, 840, 340), 0xffffffff, true, true); guiFont->draw(dInfo.vic_string, ResizeElem(500, 320, 840, 340), 0xffffffff, true, true);
} }
} else if(showcardp < showcarddif + 10) { } else if(showcardp < showcarddif + 10) {
int alpha = ((showcarddif + 10 - showcardp) * 25) << 24; int alpha = ((showcarddif + 10 - showcardp) * 25) << 24;
lpcFont->draw(lstr, recti(651 - pos.Width / 2 + (showcardp - showcarddif) * 40, 291, 950, 370), alpha); lpcFont->draw(lstr, ResizeElem(651 - pos.Width / 2 + (showcardp - showcarddif) * 40, 291, 950, 370), alpha);
lpcFont->draw(lstr, recti(650 - pos.Width / 2 + (showcardp - showcarddif) * 40, 290, 950, 370), alpha | 0xffffff); lpcFont->draw(lstr, ResizeElem(650 - pos.Width / 2 + (showcardp - showcarddif) * 40, 290, 950, 370), alpha | 0xffffff);
} }
showcardp++; showcardp++;
break; break;
...@@ -920,7 +924,7 @@ void Game::DrawSpec() { ...@@ -920,7 +924,7 @@ void Game::DrawSpec() {
showChat = false; showChat = false;
hideChatTimer--; hideChatTimer--;
} }
int maxChatLines = mainGame->dInfo.isStarted ? 5 : 8; int maxChatLines = dInfo.isStarted ? 5 : 8;
for(int i = 0; i < maxChatLines; ++i) { for(int i = 0; i < maxChatLines; ++i) {
static unsigned int chatColor[] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8080ff, 0xffff4040, 0xffff4040, static unsigned int chatColor[] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff8080ff, 0xffff4040, 0xffff4040,
0xffff4040, 0xff40ff40, 0xff4040ff, 0xff40ffff, 0xffff40ff, 0xffffff40, 0xffffffff, 0xff808080, 0xff404040}; 0xffff4040, 0xff40ff40, 0xff4040ff, 0xff40ffff, 0xffff40ff, 0xffffff40, 0xffffffff, 0xff808080, 0xff404040};
...@@ -929,16 +933,23 @@ void Game::DrawSpec() { ...@@ -929,16 +933,23 @@ void Game::DrawSpec() {
if(!showChat && i > 2) if(!showChat && i > 2)
continue; continue;
int w = textFont->getDimension(chatMsg[i].c_str()).Width; int w = textFont->getDimension(chatMsg[i].c_str()).Width;
driver->draw2DRectangle(recti(305, 596 - 20 * i, 307 + w, 616 - 20 * i), 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000);
textFont->draw(chatMsg[i].c_str(), rect<s32>(305, 595 - 20 * i, 1020, 615 - 20 * i), 0xff000000, false, false); recti rectloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X + 2 + w, mainGame->window_size.Height - 25);
textFont->draw(chatMsg[i].c_str(), rect<s32>(306, 596 - 20 * i, 1021, 616 - 20 * i), chatColor[chatType[i]], false, false); rectloc -= position2di(0, i * 20);
recti msgloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X - 4, mainGame->window_size.Height - 25);
msgloc -= position2di(0, i * 20);
recti shadowloc = msgloc + position2di(1, 1);
driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000);
textFont->draw(chatMsg[i].c_str(), msgloc, 0xff000000, false, false);
textFont->draw(chatMsg[i].c_str(), shadowloc, chatColor[chatType[i]], false, false);
} }
} }
} }
void Game::DrawBackImage(irr::video::ITexture* texture) { void Game::DrawBackImage(irr::video::ITexture* texture) {
if(!texture) if(!texture)
return; return;
driver->draw2DImage(texture, recti(0, 0, 1024, 640), recti(0, 0, texture->getOriginalSize().Width, texture->getOriginalSize().Height)); driver->draw2DImage(texture, Resize(0, 0, 1024, 640), recti(0, 0, texture->getOriginalSize().Width, texture->getOriginalSize().Height));
} }
void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) { void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
FadingUnit fu; FadingUnit fu;
...@@ -1009,7 +1020,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) { ...@@ -1009,7 +1020,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
} }
void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) { void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
element->getParent()->bringToFront(element); element->getParent()->bringToFront(element);
if(!mainGame->is_building) if(!is_building)
dField.panel = element; dField.panel = element;
env->setFocus(element); env->setFocus(element);
if(!hideframe) if(!hideframe)
...@@ -1021,7 +1032,7 @@ void Game::WaitFrameSignal(int frame) { ...@@ -1021,7 +1032,7 @@ void Game::WaitFrameSignal(int frame) {
signalFrame = frame; signalFrame = frame;
frameSignal.Wait(); frameSignal.Wait();
} }
void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist) { void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag) {
int code = cp->first; int code = cp->first;
int lcode = cp->second.alias; int lcode = cp->second.alias;
if(lcode == 0) if(lcode == 0)
...@@ -1030,37 +1041,44 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i ...@@ -1030,37 +1041,44 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i
if(img == NULL) if(img == NULL)
return; //NULL->getSize() will cause a crash return; //NULL->getSize() will cause a crash
dimension2d<u32> size = img->getOriginalSize(); dimension2d<u32> size = img->getOriginalSize();
driver->draw2DImage(img, rect<s32>(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH, pos.Y + CARD_THUMB_HEIGHT), rect<s32>(0, 0, size.Width, size.Height)); recti dragloc = mainGame->Resize(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH, pos.Y + CARD_THUMB_HEIGHT);
recti limitloc = mainGame->Resize(pos.X, pos.Y, pos.X + 20, pos.Y + 20);
recti otloc = Resize(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65);
if(drag) {
dragloc = recti(pos.X, pos.Y, pos.X + CARD_THUMB_WIDTH * mainGame->xScale, pos.Y + CARD_THUMB_HEIGHT * mainGame->yScale);
limitloc = recti(pos.X, pos.Y, pos.X + 20 * mainGame->xScale, pos.Y + 20 * mainGame->yScale);
otloc = recti(pos.X + 7, pos.Y + 50, pos.X + 37 * mainGame->xScale, pos.Y + 65 * mainGame->yScale);
}
driver->draw2DImage(img, dragloc, rect<s32>(0, 0, size.Width, size.Height));
if(lflist->count(lcode)) { if(lflist->count(lcode)) {
switch((*lflist)[lcode]) { switch((*lflist)[lcode]) {
case 0: case 0:
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 0, 64, 64), 0, 0, true); driver->draw2DImage(imageManager.tLim, limitloc, recti(0, 0, 64, 64), 0, 0, true);
break; break;
case 1: case 1:
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(64, 0, 128, 64), 0, 0, true); driver->draw2DImage(imageManager.tLim, limitloc, recti(64, 0, 128, 64), 0, 0, true);
break; break;
case 2: case 2:
driver->draw2DImage(imageManager.tLim, recti(pos.X, pos.Y, pos.X + 20, pos.Y + 20), recti(0, 64, 64, 128), 0, 0, true); driver->draw2DImage(imageManager.tLim, limitloc, recti(0, 64, 64, 128), 0, 0, true);
break; break;
} }
} }
if(mainGame->cbLimit->getSelected() >= 4 && (cp->second.ot & mainGame->gameConf.defaultOT)) { if(cbLimit->getSelected() >= 4 && (cp->second.ot & gameConf.defaultOT)) {
switch(cp->second.ot) { switch(cp->second.ot) {
case 1: case 1:
driver->draw2DImage(imageManager.tOT, recti(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65), recti(0, 128, 128, 192), 0, 0, true); driver->draw2DImage(imageManager.tOT, otloc, recti(0, 128, 128, 192), 0, 0, true);
break; break;
case 2: case 2:
driver->draw2DImage(imageManager.tOT, recti(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65), recti(0, 192, 128, 256), 0, 0, true); driver->draw2DImage(imageManager.tOT, otloc, recti(0, 192, 128, 256), 0, 0, true);
break; break;
} }
} else if(mainGame->cbLimit->getSelected() >= 4 || !(cp->second.ot & mainGame->gameConf.defaultOT)) { } else if(cbLimit->getSelected() >= 4 || !(cp->second.ot & gameConf.defaultOT)) {
switch(cp->second.ot) { switch(cp->second.ot) {
case 1: case 1:
driver->draw2DImage(imageManager.tOT, recti(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65), recti(0, 0, 128, 64), 0, 0, true); driver->draw2DImage(imageManager.tOT, otloc, recti(0, 0, 128, 64), 0, 0, true);
break; break;
case 2: case 2:
driver->draw2DImage(imageManager.tOT, recti(pos.X + 7, pos.Y + 50, pos.X + 37, pos.Y + 65), recti(0, 64, 128, 128), 0, 0, true); driver->draw2DImage(imageManager.tOT, otloc, recti(0, 64, 128, 128), 0, 0, true);
break; break;
} }
} }
...@@ -1068,14 +1086,14 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i ...@@ -1068,14 +1086,14 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i
void Game::DrawDeckBd() { void Game::DrawDeckBd() {
wchar_t textBuffer[64]; wchar_t textBuffer[64];
//main deck //main deck
driver->draw2DRectangle(recti(310, 137, 410, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 137, 410, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 136, 410, 157)); driver->draw2DRectangleOutline(Resize(309, 136, 410, 157));
textFont->draw(dataManager.GetSysString(1330), recti(314, 136, 409, 156), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1330), Resize(314, 136, 409, 156), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1330), recti(315, 137, 410, 157), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1330), Resize(315, 137, 410, 157), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(379, 137, 439, 157), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], Resize(379, 137, 439, 157), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(380, 138, 440, 158), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], Resize(380, 138, 440, 158), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 159, 797, 436)); driver->draw2DRectangleOutline(Resize(309, 159, 797, 436));
int lx; int lx;
float dx; float dx;
if(deckManager.current_deck.main.size() <= 40) { if(deckManager.current_deck.main.size() <= 40) {
...@@ -1088,66 +1106,66 @@ void Game::DrawDeckBd() { ...@@ -1088,66 +1106,66 @@ void Game::DrawDeckBd() {
for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) {
DrawThumb(deckManager.current_deck.main[i], position2di(314 + (i % lx) * dx, 164 + (i / lx) * 68), deckBuilder.filterList); DrawThumb(deckManager.current_deck.main[i], position2di(314 + (i % lx) * dx, 164 + (i / lx) * 68), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 1 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 1 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + (i % lx) * dx, 163 + (i / lx) * 68, 359 + (i % lx) * dx, 228 + (i / lx) * 68)); driver->draw2DRectangleOutline(Resize(313 + (i % lx) * dx, 163 + (i / lx) * 68, 359 + (i % lx) * dx, 228 + (i / lx) * 68));
} }
//extra deck //extra deck
driver->draw2DRectangle(recti(310, 440, 410, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 440, 410, 460), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 439, 410, 460)); driver->draw2DRectangleOutline(Resize(309, 439, 410, 460));
textFont->draw(dataManager.GetSysString(1331), recti(314, 439, 409, 459), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1331), Resize(314, 439, 409, 459), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1331), recti(315, 440, 410, 460), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1331), Resize(315, 440, 410, 460), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(379, 440, 439, 460), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], Resize(379, 440, 439, 460), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(380, 441, 440, 461), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], Resize(380, 441, 440, 461), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(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)
dx = 436.0f / 9; dx = 436.0f / 9;
else dx = 436.0f / (deckManager.current_deck.extra.size() - 1); else dx = 436.0f / (deckManager.current_deck.extra.size() - 1);
for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) {
DrawThumb(deckManager.current_deck.extra[i], position2di(314 + i * dx, 466), deckBuilder.filterList); DrawThumb(deckManager.current_deck.extra[i], position2di(314 + i * dx, 466), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 2 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 2 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + i * dx, 465, 359 + i * dx, 531)); driver->draw2DRectangleOutline(Resize(313 + i * dx, 465, 359 + i * dx, 531));
} }
//side deck //side deck
driver->draw2DRectangle(recti(310, 537, 410, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 537, 410, 557), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(309, 536, 410, 557)); driver->draw2DRectangleOutline(Resize(309, 536, 410, 557));
textFont->draw(dataManager.GetSysString(1332), recti(314, 536, 409, 556), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1332), Resize(314, 536, 409, 556), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1332), recti(315, 537, 410, 557), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1332), Resize(315, 537, 410, 557), 0xffffffff, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(379, 537, 439, 557), 0xff000000, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], Resize(379, 537, 439, 557), 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(380, 538, 440, 558), 0xffffffff, false, true); numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], Resize(380, 538, 440, 558), 0xffffffff, false, true);
driver->draw2DRectangle(recti(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(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)
dx = 436.0f / 9; dx = 436.0f / 9;
else dx = 436.0f / (deckManager.current_deck.side.size() - 1); else dx = 436.0f / (deckManager.current_deck.side.size() - 1);
for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) { for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) {
DrawThumb(deckManager.current_deck.side[i], position2di(314 + i * dx, 564), deckBuilder.filterList); DrawThumb(deckManager.current_deck.side[i], position2di(314 + i * dx, 564), deckBuilder.filterList);
if(deckBuilder.hovered_pos == 3 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 3 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangleOutline(recti(313 + i * dx, 563, 359 + i * dx, 629)); driver->draw2DRectangleOutline(Resize(313 + i * dx, 563, 359 + i * dx, 629));
} }
//search result //search result
driver->draw2DRectangle(recti(805, 137, 915, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(805, 137, 915, 157), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(804, 136, 915, 157)); driver->draw2DRectangleOutline(Resize(804, 136, 915, 157));
textFont->draw(dataManager.GetSysString(1333), recti(809, 136, 914, 156), 0xff000000, false, true); textFont->draw(dataManager.GetSysString(1333), Resize(809, 136, 914, 156), 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1333), recti(810, 137, 915, 157), 0xffffffff, false, true); textFont->draw(dataManager.GetSysString(1333), Resize(810, 137, 915, 157), 0xffffffff, false, true);
numFont->draw(deckBuilder.result_string, recti(874, 136, 934, 156), 0xff000000, false, true); numFont->draw(deckBuilder.result_string, Resize(874, 136, 934, 156), 0xff000000, false, true);
numFont->draw(deckBuilder.result_string, recti(875, 137, 935, 157), 0xffffffff, false, true); numFont->draw(deckBuilder.result_string, Resize(875, 137, 935, 157), 0xffffffff, false, true);
driver->draw2DRectangle(recti(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(804, 159, 1020, 630)); driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630));
for(size_t i = 0; i < 7 && i + mainGame->scrFilter->getPos() < deckBuilder.results.size(); ++i) { for(size_t i = 0; i < 7 && i + scrFilter->getPos() < deckBuilder.results.size(); ++i) {
code_pointer ptr = deckBuilder.results[i + mainGame->scrFilter->getPos()]; code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()];
if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i) if(deckBuilder.hovered_pos == 4 && deckBuilder.hovered_seq == (int)i)
driver->draw2DRectangle(0x80000000, recti(806, 164 + i * 66, 1019, 230 + i * 66)); driver->draw2DRectangle(0x80000000, Resize(806, 164 + i * 66, 1019, 230 + i * 66));
DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList); DrawThumb(ptr, position2di(810, 165 + i * 66), deckBuilder.filterList);
if(ptr->second.type & TYPE_MONSTER) { if(ptr->second.type & TYPE_MONSTER) {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first)); myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
textFont->draw(textBuffer, recti(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false);
if(!(ptr->second.type & TYPE_LINK)) { if(!(ptr->second.type & TYPE_LINK)) {
wchar_t* form = L"\u2605"; wchar_t* form = L"\u2605";
if(ptr->second.type & TYPE_XYZ) form = L"\u2606"; if(ptr->second.type & TYPE_XYZ) form = L"\u2606";
myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level); myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level);
textFont->draw(textBuffer, recti(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false);
if(ptr->second.attack < 0 && ptr->second.defense < 0) if(ptr->second.attack < 0 && ptr->second.defense < 0)
myswprintf(textBuffer, L"?/?"); myswprintf(textBuffer, L"?/?");
else if(ptr->second.attack < 0) else if(ptr->second.attack < 0)
...@@ -1157,8 +1175,8 @@ void Game::DrawDeckBd() { ...@@ -1157,8 +1175,8 @@ void Game::DrawDeckBd() {
else myswprintf(textBuffer, L"%d/%d", ptr->second.attack, ptr->second.defense); else myswprintf(textBuffer, L"%d/%d", ptr->second.attack, ptr->second.defense);
} else { } else {
myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), ptr->second.level); myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), ptr->second.level);
textFont->draw(textBuffer, recti(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false);
if(ptr->second.attack < 0) if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/-"); myswprintf(textBuffer, L"?/-");
else myswprintf(textBuffer, L"%d/-", ptr->second.attack); else myswprintf(textBuffer, L"%d/-", ptr->second.attack);
...@@ -1174,15 +1192,15 @@ void Game::DrawDeckBd() { ...@@ -1174,15 +1192,15 @@ void Game::DrawDeckBd() {
wcscat(textBuffer, L" [TCG]"); wcscat(textBuffer, L" [TCG]");
else if((ptr->second.ot & 0x7) == 4) else if((ptr->second.ot & 0x7) == 4)
wcscat(textBuffer, L" [Custom]"); wcscat(textBuffer, L" [Custom]");
textFont->draw(textBuffer, recti(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false);
} else { } else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first)); myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
textFont->draw(textBuffer, recti(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 164 + i * 66, 955, 185 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false);
const wchar_t* ptype = dataManager.FormatType(ptr->second.type); const wchar_t* ptype = dataManager.FormatType(ptr->second.type);
textFont->draw(ptype, recti(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false); textFont->draw(ptype, Resize(859, 186 + i * 66, 955, 207 + i * 66), 0xff000000, false, false);
textFont->draw(ptype, recti(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false); textFont->draw(ptype, Resize(860, 187 + i * 66, 955, 207 + i * 66), 0xffffffff, false, false);
textBuffer[0] = 0; textBuffer[0] = 0;
if((ptr->second.ot & 0x3) == 1) if((ptr->second.ot & 0x3) == 1)
wcscat(textBuffer, L"[OCG]"); wcscat(textBuffer, L"[OCG]");
...@@ -1190,12 +1208,12 @@ void Game::DrawDeckBd() { ...@@ -1190,12 +1208,12 @@ void Game::DrawDeckBd() {
wcscat(textBuffer, L"[TCG]"); wcscat(textBuffer, L"[TCG]");
else if((ptr->second.ot & 0x7) == 4) else if((ptr->second.ot & 0x7) == 4)
wcscat(textBuffer, L"[Custom]"); wcscat(textBuffer, L"[Custom]");
textFont->draw(textBuffer, recti(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false); textFont->draw(textBuffer, Resize(859, 208 + i * 66, 955, 229 + i * 66), 0xff000000, false, false);
textFont->draw(textBuffer, recti(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false); textFont->draw(textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), 0xffffffff, false, false);
} }
} }
if(deckBuilder.is_draging) { if(deckBuilder.is_draging) {
DrawThumb(deckBuilder.draging_pointer, position2di(deckBuilder.dragx - 22, deckBuilder.dragy - 32), deckBuilder.filterList); DrawThumb(deckBuilder.draging_pointer, position2di(deckBuilder.dragx - CARD_THUMB_WIDTH / 2 * mainGame->xScale, deckBuilder.dragy - CARD_THUMB_HEIGHT / 2 * mainGame->yScale), deckBuilder.filterList, true);
} }
} }
} }
...@@ -978,10 +978,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -978,10 +978,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_LMOUSE_LEFT_UP: { case irr::EMIE_LMOUSE_LEFT_UP: {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
s32 x = event.MouseInput.X;
s32 y = event.MouseInput.Y;
hovered_location = 0; hovered_location = 0;
irr::core::position2di pos(x, y); position2di pos = mainGame->ResizeReverse(event.MouseInput.X, event.MouseInput.Y);
position2di mousepos(event.MouseInput.X, event.MouseInput.Y);
s32 x = pos.X;
s32 y = pos.Y;
if(x < 300) if(x < 300)
break; break;
if(mainGame->gameConf.control_mode == 1) { if(mainGame->gameConf.control_mode == 1) {
...@@ -990,7 +991,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -990,7 +991,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
UpdateChainButtons(); UpdateChainButtons();
} }
if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(pos)) if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(mousepos))
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(panel && panel->isVisible()) if(panel && panel->isVisible())
break; break;
...@@ -1364,7 +1365,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1364,7 +1365,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(pos) == mainGame->btnCancelOrFinish) if(root->getElementFromPoint(pos) == mainGame->btnCancelOrFinish)
mainGame->chkHideHintButton->setChecked(true); mainGame->chkHideHintButton->setChecked(true);
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300) { if(mainGame->gameConf.control_mode == 1 && x > 300 * mainGame->xScale) {
mainGame->ignore_chain = event.MouseInput.isRightPressed(); mainGame->ignore_chain = event.MouseInput.isRightPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
...@@ -1380,9 +1381,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1380,9 +1381,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
bool should_show_tip = false; bool should_show_tip = false;
s32 x = event.MouseInput.X; position2di pos = mainGame->ResizeReverse(event.MouseInput.X, event.MouseInput.Y);
s32 y = event.MouseInput.Y; position2di mousepos = position2di(event.MouseInput.X, event.MouseInput.Y);
irr::core::position2di pos(x, y); s32 x = pos.X;
s32 y = pos.Y;
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
if(x < 300) { if(x < 300) {
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
...@@ -1392,7 +1394,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1392,7 +1394,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf(formatBuffer, dataManager.GetSysString(1700), mainGame->btnCancelOrFinish->getText()); myswprintf(formatBuffer, dataManager.GetSysString(1700), mainGame->btnCancelOrFinish->getText());
mainGame->stTip->setText(formatBuffer); mainGame->stTip->setText(formatBuffer);
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(formatBuffer) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(formatBuffer) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(x - 10 - dtip.Width, y - 10 - dtip.Height, x - 10, y - 10)); mainGame->stTip->setRelativePosition(mainGame->Resize(x - 10 - dtip.Width, y - 10 - dtip.Height, x - 10, y - 10));
} }
mainGame->stTip->setVisible(should_show_tip); mainGame->stTip->setVisible(should_show_tip);
break; break;
...@@ -1400,7 +1402,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1400,7 +1402,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
hovered_location = 0; hovered_location = 0;
ClientCard* mcard = 0; ClientCard* mcard = 0;
int mplayer = -1; int mplayer = -1;
if(!panel || !panel->isVisible() || !panel->getRelativePosition().isPointInside(pos)) { if(!panel || !panel->isVisible() || !panel->getRelativePosition().isPointInside(mousepos)) {
GetHoverField(x, y); GetHoverField(x, y);
if(hovered_location & 0xe) if(hovered_location & 0xe)
mcard = GetCard(hovered_controler, hovered_location, hovered_sequence); mcard = GetCard(hovered_controler, hovered_location, hovered_sequence);
...@@ -1417,9 +1419,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1417,9 +1419,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(deck[hovered_controler].size()) if(deck[hovered_controler].size())
mcard = deck[hovered_controler].back(); mcard = deck[hovered_controler].back();
} else { } else {
if(irr::core::recti(327, 8, 630, 51).isPointInside(pos)) if(mainGame->Resize(327, 8, 630, 51).isPointInside(mousepos))
mplayer = 0; mplayer = 0;
else if(irr::core::recti(689, 8, 991, 51).isPointInside(pos)) else if(mainGame->Resize(689, 8, 991, 51).isPointInside(mousepos))
mplayer = 1; mplayer = 1;
} }
} }
...@@ -1431,7 +1433,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1431,7 +1433,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mainGame->stTip->isVisible()) { if(mainGame->stTip->isVisible()) {
should_show_tip = true; should_show_tip = true;
irr::core::recti tpos = mainGame->stTip->getRelativePosition(); irr::core::recti tpos = mainGame->stTip->getRelativePosition();
mainGame->stTip->setRelativePosition(irr::core::position2di(x - tpos.getWidth() - 10, mcard ? y - tpos.getHeight() - 10 : y + 10)); mainGame->stTip->setRelativePosition(irr::core::position2di(mousepos.X - tpos.getWidth() - 10, mcard ? mousepos.Y - tpos.getHeight() - 10 : y + 10));
} }
} }
if(mcard != hovered_card) { if(mcard != hovered_card) {
...@@ -1516,7 +1518,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1516,7 +1518,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
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->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(x - 10 - dtip.Width, y - 10 - dtip.Height, x - 10, y - 10)); mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y - 10 - dtip.Height, mousepos.X - 10, mousepos.Y - 10));
mainGame->stTip->setText(str.c_str()); mainGame->stTip->setText(str.c_str());
} }
} else { } else {
...@@ -1554,7 +1556,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1554,7 +1556,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
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->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(x - 10 - dtip.Width, y + 10, x - 10, 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());
} }
hovered_player = mplayer; hovered_player = mplayer;
...@@ -1568,7 +1570,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1568,7 +1570,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_LMOUSE_PRESSED_DOWN: { case irr::EMIE_LMOUSE_PRESSED_DOWN: {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300) { if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300 * mainGame->xScale) {
mainGame->always_chain = event.MouseInput.isLeftPressed(); mainGame->always_chain = event.MouseInput.isLeftPressed();
mainGame->ignore_chain = false; mainGame->ignore_chain = false;
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
...@@ -1579,7 +1581,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1579,7 +1581,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_RMOUSE_PRESSED_DOWN: { case irr::EMIE_RMOUSE_PRESSED_DOWN: {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300) { if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300 * mainGame->xScale) {
mainGame->ignore_chain = event.MouseInput.isRightPressed(); mainGame->ignore_chain = event.MouseInput.isRightPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
...@@ -2066,6 +2068,9 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -2066,6 +2068,9 @@ void ClientField::ShowMenu(int flag, int x, int y) {
} else mainGame->btnReset->setVisible(false); } else mainGame->btnReset->setVisible(false);
panel = mainGame->wCmdMenu; panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true); mainGame->wCmdMenu->setVisible(true);
position2di mouse = mainGame->Resize(x, y);
x = mouse.X;
y = mouse.Y;
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20)); mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20));
} }
void ClientField::UpdateChainButtons() { void ClientField::UpdateChainButtons() {
......
...@@ -69,19 +69,19 @@ bool Game::Initialize() { ...@@ -69,19 +69,19 @@ bool Game::Initialize() {
textFont = guiFont; textFont = guiFont;
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"YGOPro"); device->setWindowCaption(L"YGOPro");
device->setResizable(false); device->setResizable(true);
#ifdef _WIN32 #ifdef _WIN32
irr::video::SExposedVideoData exposedData = driver->getExposedVideoData(); irr::video::SExposedVideoData exposedData = driver->getExposedVideoData();
if(gameConf.use_d3d) if(gameConf.use_d3d)
hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd);
else else
hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd);
if(hWnd) { /*if(hWnd) {
LONG style = GetWindowLong(hWnd, GWL_STYLE); LONG style = GetWindowLong(hWnd, GWL_STYLE);
style |= WS_MINIMIZEBOX; style |= WS_MINIMIZEBOX;
SetWindowLong(hWnd, GWL_STYLE, style); SetWindowLong(hWnd, GWL_STYLE, style);
SendMessage(hWnd, WM_NCPAINT, 1, 0); SendMessage(hWnd, WM_NCPAINT, 1, 0);
} }*/
#endif #endif
SetWindowsIcon(); SetWindowsIcon();
//main menu //main menu
...@@ -423,10 +423,10 @@ bool Game::Initialize() { ...@@ -423,10 +423,10 @@ bool Game::Initialize() {
//deck edit //deck edit
wDeckEdit = env->addStaticText(L"", rect<s32>(309, 5, 605, 130), true, false, 0, -1, true); wDeckEdit = env->addStaticText(L"", rect<s32>(309, 5, 605, 130), true, false, 0, -1, true);
wDeckEdit->setVisible(false); wDeckEdit->setVisible(false);
env->addStaticText(dataManager.GetSysString(1300), rect<s32>(10, 9, 100, 29), false, false, wDeckEdit); stBanlist = env->addStaticText(dataManager.GetSysString(1300), rect<s32>(10, 9, 100, 29), false, false, wDeckEdit);
cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST); cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST);
cbDBLFList->setMaxSelectionRows(10); cbDBLFList->setMaxSelectionRows(10);
env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit); stDeck = env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit);
cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS); cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS);
cbDBDecks->setMaxSelectionRows(15); cbDBDecks->setMaxSelectionRows(15);
for(unsigned int i = 0; i < deckManager._lfList.size(); ++i) for(unsigned int i = 0; i < deckManager._lfList.size(); ++i)
...@@ -462,7 +462,7 @@ bool Game::Initialize() { ...@@ -462,7 +462,7 @@ bool Game::Initialize() {
//filters //filters
wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true); wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true);
wFilter->setVisible(false); wFilter->setVisible(false);
env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 25 / 6 + 2, 70, 22 + 25 / 6), false, false, wFilter); stCategory = env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 25 / 6 + 2, 70, 22 + 25 / 6), false, false, wFilter);
cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE); cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE);
cbCardType->addItem(dataManager.GetSysString(1310)); cbCardType->addItem(dataManager.GetSysString(1310));
cbCardType->addItem(dataManager.GetSysString(1312)); cbCardType->addItem(dataManager.GetSysString(1312));
...@@ -471,7 +471,7 @@ bool Game::Initialize() { ...@@ -471,7 +471,7 @@ bool Game::Initialize() {
cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 200, 20 + 25 / 6), wFilter, COMBOBOX_SECONDTYPE); cbCardType2 = env->addComboBox(rect<s32>(125, 25 / 6, 200, 20 + 25 / 6), wFilter, COMBOBOX_SECONDTYPE);
cbCardType2->setMaxSelectionRows(10); cbCardType2->setMaxSelectionRows(10);
cbCardType2->addItem(dataManager.GetSysString(1310), 0); cbCardType2->addItem(dataManager.GetSysString(1310), 0);
env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter); stLimit = env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter);
cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, COMBOBOX_LIMIT); cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, COMBOBOX_LIMIT);
cbLimit->setMaxSelectionRows(10); cbLimit->setMaxSelectionRows(10);
cbLimit->addItem(dataManager.GetSysString(1310)); cbLimit->addItem(dataManager.GetSysString(1310));
...@@ -482,31 +482,31 @@ bool Game::Initialize() { ...@@ -482,31 +482,31 @@ bool Game::Initialize() {
cbLimit->addItem(dataManager.GetSysString(1241)); cbLimit->addItem(dataManager.GetSysString(1241));
cbLimit->addItem(dataManager.GetSysString(1242)); cbLimit->addItem(dataManager.GetSysString(1242));
cbLimit->addItem(dataManager.GetSysString(1243)); cbLimit->addItem(dataManager.GetSysString(1243));
env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter); stAttribute = env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter);
cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, COMBOBOX_ATTRIBUTE); cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, COMBOBOX_ATTRIBUTE);
cbAttribute->setMaxSelectionRows(10); cbAttribute->setMaxSelectionRows(10);
cbAttribute->addItem(dataManager.GetSysString(1310), 0); cbAttribute->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1) for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(dataManager.FormatAttribute(filter), filter); cbAttribute->addItem(dataManager.FormatAttribute(filter), filter);
env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter); stRace = env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, COMBOBOX_RACE); cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, COMBOBOX_RACE);
cbRace->setMaxSelectionRows(10); cbRace->setMaxSelectionRows(10);
cbRace->addItem(dataManager.GetSysString(1310), 0); cbRace->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x2000000; filter <<= 1) for(int filter = 0x1; filter != 0x2000000; filter <<= 1)
cbRace->addItem(dataManager.FormatRace(filter), filter); cbRace->addItem(dataManager.FormatRace(filter), filter);
env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter); stAttack = env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter); ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter);
ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1323), rect<s32>(205, 42 + 75 / 6, 280, 62 + 75 / 6), false, false, wFilter); stDefense = env->addStaticText(dataManager.GetSysString(1323), rect<s32>(205, 42 + 75 / 6, 280, 62 + 75 / 6), false, false, wFilter);
ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter); ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter);
ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter); stStar = env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter); ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter); stScale = env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter); ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter); stSearch = env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD); ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD);
ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnEffectFilter = env->addButton(rect<s32>(345, 20 + 50 / 6, 390, 60 + 75 / 6), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326)); btnEffectFilter = env->addButton(rect<s32>(345, 20 + 50 / 6, 390, 60 + 75 / 6), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326));
...@@ -666,6 +666,13 @@ void Game::MainLoop() { ...@@ -666,6 +666,13 @@ void Game::MainLoop() {
int fps = 0; int fps = 0;
int cur_time = 0; int cur_time = 0;
while(device->run()) { while(device->run()) {
dimension2du size = driver->getScreenSize();
if(window_size != size) {
window_size = size;
xScale = window_size.Width / 1024.0;
yScale = window_size.Height / 640.0;
OnResize();
}
if(gameConf.use_d3d) if(gameConf.use_d3d)
linePattern = (linePattern + 1) % 30; linePattern = (linePattern + 1) % 30;
else else
...@@ -1131,7 +1138,7 @@ void Game::ShowCardInfo(int code) { ...@@ -1131,7 +1138,7 @@ void Game::ShowCardInfo(int code) {
wchar_t formatBuffer[256]; wchar_t formatBuffer[256];
if(!dataManager.GetData(code, &cd)) if(!dataManager.GetData(code, &cd))
memset(&cd, 0, sizeof(CardData)); memset(&cd, 0, sizeof(CardData));
imgCard->setImage(imageManager.GetTexture(code)); imgCard->setImage(imageManager.GetTexture(code, true));
imgCard->setScaleImage(true); imgCard->setScaleImage(true);
if(cd.alias != 0 && (cd.alias - code < 10 || code - cd.alias < 10)) if(cd.alias != 0 && (cd.alias - code < 10 || code - cd.alias < 10))
myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(cd.alias), cd.alias); myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(cd.alias), cd.alias);
...@@ -1187,16 +1194,16 @@ void Game::ShowCardInfo(int code) { ...@@ -1187,16 +1194,16 @@ void Game::ShowCardInfo(int code) {
wcscat(formatBuffer, scaleBuffer); wcscat(formatBuffer, scaleBuffer);
} }
stDataInfo->setText(formatBuffer); stDataInfo->setText(formatBuffer);
stSetName->setRelativePosition(rect<s32>(15, 83, 296, 106)); stSetName->setRelativePosition(Resize(15, 83, 296, 106));
stText->setRelativePosition(rect<s32>(15, 83 + offset, 287, 324)); stText->setRelativePosition(Resize(15, 83 + offset, 287, 324));
scrCardText->setRelativePosition(rect<s32>(267, 83 + offset, 287, 324)); scrCardText->setRelativePosition(Resize(267, 83 + offset, 287, 324));
} 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->setText(L""); stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60, 296, 83)); stSetName->setRelativePosition(Resize(15, 60, 296, 83));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287, 324)); stText->setRelativePosition(Resize(15, 60 + offset, 287, 324));
scrCardText->setRelativePosition(rect<s32>(267, 60 + offset, 287, 324)); scrCardText->setRelativePosition(Resize(267, 60 + offset, 287, 324));
} }
showingtext = dataManager.GetText(code); showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition(); const auto& tsize = stText->getRelativePosition();
...@@ -1321,6 +1328,162 @@ int Game::LocalPlayer(int player) { ...@@ -1321,6 +1328,162 @@ int Game::LocalPlayer(int player) {
const wchar_t* Game::LocalName(int local_player) { const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname; return local_player == 0 ? dInfo.hostname : dInfo.clientname;
} }
void Game::OnResize() {
wMainMenu->setRelativePosition(ResizeWin(370, 200, 650, 415));
wDeckEdit->setRelativePosition(Resize(309, 8, 605, 130));
cbDBLFList->setRelativePosition(Resize(80, 5, 220, 30));
cbDBDecks->setRelativePosition(Resize(80, 35, 220, 60));
btnClearDeck->setRelativePosition(Resize(115, 99, 165, 120));
btnSortDeck->setRelativePosition(Resize(60, 99, 110, 120));
btnShuffleDeck->setRelativePosition(Resize(5, 99, 55, 120));
btnSaveDeck->setRelativePosition(Resize(225, 35, 290, 60));
btnSaveDeckAs->setRelativePosition(Resize(225, 65, 290, 90));
ebDeckname->setRelativePosition(Resize(80, 65, 220, 90));
wSort->setRelativePosition(Resize(930, 132, 1020, 156));
cbSortType->setRelativePosition(Resize(10, 2, 85, 22));
wFilter->setRelativePosition(Resize(610, 8, 1020, 130));
scrFilter->setRelativePosition(Resize(999, 161, 1019, 629));
cbCardType->setRelativePosition(Resize(60, 3, 120, 23));
cbCardType2->setRelativePosition(Resize(130, 3, 190, 23));
cbRace->setRelativePosition(Resize(60, 49, 190, 69));
cbAttribute->setRelativePosition(Resize(60, 26, 190, 46));
cbLimit->setRelativePosition(Resize(260, 3, 390, 23));
ebStar->setRelativePosition(Resize(60, 72, 100, 92));
ebScale->setRelativePosition(Resize(150, 72, 190, 92));
ebAttack->setRelativePosition(Resize(260, 26, 340, 46));
ebDefense->setRelativePosition(Resize(260, 49, 340, 69));
ebCardName->setRelativePosition(Resize(260, 72, 390, 92));
btnEffectFilter->setRelativePosition(Resize(345, 28, 390, 69));
btnStartFilter->setRelativePosition(Resize(327, 96, 390, 118));
btnClearFilter->setRelativePosition(Resize(260, 96, 322, 118));
btnMarksFilter->setRelativePosition(Resize(60, 80 + 125 / 6, 190, 100 + 125 / 6));
wCategories->setRelativePosition(ResizeWin(450, 60, 1000, 270));
wLinkMarks->setRelativePosition(ResizeWin(700, 30, 820, 150));
stBanlist->setRelativePosition(ResizeWin(10, 9, 100, 29));
stDeck->setRelativePosition(ResizeWin(10, 39, 100, 59));
stCategory->setRelativePosition(ResizeWin(10, 5, 70, 25));
stLimit->setRelativePosition(ResizeWin(205, 5, 280, 25));
stAttribute->setRelativePosition(ResizeWin(10, 28, 70, 48));
stRace->setRelativePosition(ResizeWin(10, 51, 70, 71));
stAttack->setRelativePosition(ResizeWin(205, 28, 280, 48));
stDefense->setRelativePosition(ResizeWin(205, 51, 280, 71));
stStar->setRelativePosition(ResizeWin(10, 74, 80, 94));
stSearch->setRelativePosition(ResizeWin(205, 74, 280, 94));
stScale->setRelativePosition(ResizeWin(110, 74, 150, 94));
btnSideOK->setRelativePosition(Resize(510, 40, 820, 80));
btnSideShuffle->setRelativePosition(Resize(310, 100, 370, 130));
btnSideSort->setRelativePosition(Resize(375, 100, 435, 130));
btnSideReload->setRelativePosition(Resize(440, 100, 500, 130));
btnDeleteDeck->setRelativePosition(Resize(225, 95, 290, 120));
wLanWindow->setRelativePosition(ResizeWin(220, 100, 800, 520));
wCreateHost->setRelativePosition(ResizeWin(320, 100, 700, 520));
wHostPrepare->setRelativePosition(ResizeWin(270, 120, 750, 440));
wReplay->setRelativePosition(ResizeWin(220, 100, 800, 520));
wSinglePlay->setRelativePosition(ResizeWin(220, 100, 800, 520));
wHand->setRelativePosition(ResizeWin(500, 450, 825, 605));
wFTSelect->setRelativePosition(ResizeWin(550, 240, 780, 340));
wMessage->setRelativePosition(ResizeWin(490, 200, 840, 340));
wACMessage->setRelativePosition(ResizeWin(490, 240, 840, 300));
wQuery->setRelativePosition(ResizeWin(490, 200, 840, 340));
wOptions->setRelativePosition(ResizeWin(490, 200, 840, 340));
wPosSelect->setRelativePosition(ResizeWin(340, 200, 935, 410));
wCardSelect->setRelativePosition(ResizeWin(320, 100, 1000, 400));
wANNumber->setRelativePosition(ResizeWin(550, 200, 780, 295));
wANCard->setRelativePosition(ResizeWin(430, 170, 840, 370));
wANAttribute->setRelativePosition(ResizeWin(500, 200, 830, 285));
wANRace->setRelativePosition(ResizeWin(480, 200, 850, 410));
wReplaySave->setRelativePosition(ResizeWin(510, 200, 820, 320));
stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90));
wCardImg->setRelativePosition(Resize(1, 1, 1 + CARD_IMG_WIDTH + 20, 1 + CARD_IMG_HEIGHT + 18));
imgCard->setRelativePosition(Resize(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT));
wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 287 * xScale, 32));
lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition();
//if(showingcard)
// ShowCardInfo(showingcard, true);
btnClearLog->setRelativePosition(Resize(160, 300, 260, 325));
wPhase->setRelativePosition(Resize(480, 310, 855, 330));
btnPhaseStatus->setRelativePosition(Resize(0, 0, 50, 20));
btnBP->setRelativePosition(Resize(160, 0, 210, 20));
btnM2->setRelativePosition(Resize(160, 0, 210, 20));
btnEP->setRelativePosition(Resize(320, 0, 370, 20));
wChat->setRelativePosition(ResizeWin(wInfos->getRelativePosition().LowerRightCorner.X + 6, 615, 1020, 640, true));
ebChatInput->setRelativePosition(recti(3, 2, window_size.Width - wChat->getRelativePosition().UpperLeftCorner.X - 6, 22));
btnLeaveGame->setRelativePosition(Resize(205, 5, 295, 80));
wReplayControl->setRelativePosition(Resize(205, 143, 295, 273));
btnReplayStart->setRelativePosition(Resize(5, 5, 85, 25));
btnReplayPause->setRelativePosition(Resize(5, 5, 85, 25));
btnReplayStep->setRelativePosition(Resize(5, 55, 85, 75));
btnReplayUndo->setRelativePosition(Resize(5, 80, 85, 100));
btnReplaySwap->setRelativePosition(Resize(5, 30, 85, 50));
btnReplayExit->setRelativePosition(Resize(5, 105, 85, 125));
btnSpectatorSwap->setRelativePosition(Resize(205, 100, 295, 135));
btnChainAlways->setRelativePosition(Resize(205, 140, 295, 175));
btnChainIgnore->setRelativePosition(Resize(205, 100, 295, 135));
btnChainWhenAvail->setRelativePosition(Resize(205, 180, 295, 215));
btnShuffle->setRelativePosition(Resize(205, 230, 295, 265));
btnCancelOrFinish->setRelativePosition(Resize(205, 230, 295, 265));
imageManager.ClearTexture();
}
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2) {
x = x * xScale;
y = y * yScale;
x2 = x2 * xScale;
y2 = y2 * yScale;
return recti(x, y, x2, y2);
}
recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2) {
x = x * xScale + dx;
y = y * yScale + dy;
x2 = x2 * xScale + dx2;
y2 = y2 * yScale + dy2;
return recti(x, y, x2, y2);
}
position2di Game::Resize(s32 x, s32 y) {
x = x * xScale;
y = y * yScale;
return position2di(x, y);
}
position2di Game::ResizeReverse(s32 x, s32 y) {
x = x / xScale;
y = y / yScale;
return position2di(x, y);
}
recti Game::ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat) {
s32 sx = x2 - x;
s32 sy = y2 - y;
if(chat) {
y = window_size.Height - sy;
x2 = window_size.Width;
y2 = y + sy;
return recti(x, y, x2, y2);
}
x = (x + sx / 2) * xScale - sx / 2;
y = (y + sy / 2) * yScale - sy / 2;
x2 = sx + x;
y2 = sy + y;
return recti(x, y, x2, y2);
}
recti Game::ResizeElem(s32 x, s32 y, s32 x2, s32 y2) {
s32 sx = x2 - x;
s32 sy = y2 - y;
x = (x + sx / 2 - 100) * xScale - sx / 2 + 100;
y = y * yScale;
x2 = sx + x;
y2 = sy + y;
return recti(x, y, x2, y2);
}
void Game::SetWindowsIcon() { void Game::SetWindowsIcon() {
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hInstance = (HINSTANCE)GetModuleHandleW(NULL); HINSTANCE hInstance = (HINSTANCE)GetModuleHandleW(NULL);
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
void HideElement(irr::gui::IGUIElement* element, bool set_action = false); void HideElement(irr::gui::IGUIElement* element, bool set_action = false);
void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0); void PopupElement(irr::gui::IGUIElement* element, int hideframe = 0);
void WaitFrameSignal(int frame); void WaitFrameSignal(int frame);
void DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist); void DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag = false);
void DrawDeckBd(); void DrawDeckBd();
void LoadConfig(); void LoadConfig();
void SaveConfig(); void SaveConfig();
...@@ -136,6 +136,14 @@ public: ...@@ -136,6 +136,14 @@ public:
return focus && focus->hasType(type); return focus && focus->hasType(type);
} }
void OnResize();
recti Resize(s32 x, s32 y, s32 x2, s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
position2di Resize(s32 x, s32 y);
position2di ResizeReverse(s32 x, s32 y);
recti ResizeElem(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false);
void SetWindowsIcon(); void SetWindowsIcon();
void FlashWindow(); void FlashWindow();
void SetCursor(ECURSOR_ICON icon); void SetCursor(ECURSOR_ICON icon);
...@@ -186,6 +194,10 @@ public: ...@@ -186,6 +194,10 @@ public:
bool is_building; bool is_building;
bool is_siding; bool is_siding;
irr::core::dimension2d<irr::u32> window_size;
float xScale;
float yScale;
ClientField dField; ClientField dField;
DeckBuilder deckBuilder; DeckBuilder deckBuilder;
MenuHandler menuHandler; MenuHandler menuHandler;
...@@ -402,6 +414,17 @@ public: ...@@ -402,6 +414,17 @@ public:
irr::gui::IGUIButton* btnSideSort; irr::gui::IGUIButton* btnSideSort;
irr::gui::IGUIButton* btnSideReload; irr::gui::IGUIButton* btnSideReload;
irr::gui::IGUIEditBox* ebDeckname; irr::gui::IGUIEditBox* ebDeckname;
irr::gui::IGUIStaticText* stBanlist;
irr::gui::IGUIStaticText* stDeck;
irr::gui::IGUIStaticText* stCategory;
irr::gui::IGUIStaticText* stLimit;
irr::gui::IGUIStaticText* stAttribute;
irr::gui::IGUIStaticText* stRace;
irr::gui::IGUIStaticText* stAttack;
irr::gui::IGUIStaticText* stDefense;
irr::gui::IGUIStaticText* stStar;
irr::gui::IGUIStaticText* stSearch;
irr::gui::IGUIStaticText* stScale;
//filter //filter
irr::gui::IGUIStaticText* wFilter; irr::gui::IGUIStaticText* wFilter;
irr::gui::IGUIScrollBar* scrFilter; irr::gui::IGUIScrollBar* scrFilter;
......
...@@ -45,7 +45,11 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { ...@@ -45,7 +45,11 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
driver = dev->getVideoDriver(); driver = dev->getVideoDriver();
} }
void ImageManager::ClearTexture() { void ImageManager::ClearTexture() {
for(auto tit = tMap.begin(); tit != tMap.end(); ++tit) { for(auto tit = tMap[0].begin(); tit != tMap[0].end(); ++tit) {
if(tit->second)
driver->removeTexture(tit->second);
}
for(auto tit = tMap[1].begin(); tit != tMap[1].end(); ++tit) {
if(tit->second) if(tit->second)
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
} }
...@@ -53,20 +57,26 @@ void ImageManager::ClearTexture() { ...@@ -53,20 +57,26 @@ void ImageManager::ClearTexture() {
if(tit->second) if(tit->second)
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
} }
tMap.clear(); tMap[0].clear();
tMap[1].clear();
tThumb.clear(); tThumb.clear();
} }
void ImageManager::RemoveTexture(int code) { void ImageManager::RemoveTexture(int code) {
auto tit = tMap.find(code); auto tit = tMap[0].find(code);
if(tit != tMap.end()) { if(tit != tMap[0].end()) {
if(tit->second) if(tit->second)
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
tMap.erase(tit); tMap[0].erase(tit);
}
tit = tMap[1].find(code);
if(tit != tMap[1].end()) {
if(tit->second)
driver->removeTexture(tit->second);
tMap[1].erase(tit);
} }
} }
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified // function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
{
double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa; double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa;
u32 dy, dx; u32 dy, dx;
irr::video::SColor pxl; irr::video::SColor pxl;
...@@ -158,23 +168,29 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3 ...@@ -158,23 +168,29 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
return driver->getTexture(file); return driver->getTexture(file);
} }
} }
irr::video::ITexture* ImageManager::GetTexture(int code) { irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
if(code == 0) if(code == 0)
return tUnknown; return tUnknown;
auto tit = tMap.find(code); int width = CARD_IMG_WIDTH;
if(tit == tMap.end()) { int height = CARD_IMG_HEIGHT;
if(fit) {
width = width * mainGame->xScale;
height = height * mainGame->yScale;
}
auto tit = tMap[fit ? 1 : 0].find(code);
if(tit == tMap[fit ? 1 : 0].end()) {
char file[256]; char file[256];
sprintf(file, "expansions/pics/%d.jpg", code); sprintf(file, "expansions/pics/%d.jpg", code);
irr::video::ITexture* img = GetTextureFromFile(file, CARD_IMG_WIDTH, CARD_IMG_HEIGHT); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/%d.jpg", code); sprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, CARD_IMG_WIDTH, CARD_IMG_HEIGHT); img = GetTextureFromFile(file, width, height);
} }
if(img == NULL && !mainGame->gameConf.use_image_scale) { if(img == NULL && !mainGame->gameConf.use_image_scale) {
tMap[code] = NULL; tMap[fit ? 1 : 0][code] = NULL;
return GetTextureThumb(code); return GetTextureThumb(code);
} }
tMap[code] = img; tMap[fit ? 1 : 0][code] = img;
return (img == NULL) ? tUnknown : img; return (img == NULL) ? tUnknown : img;
} }
if(tit->second) if(tit->second)
...@@ -186,20 +202,22 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -186,20 +202,22 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(code == 0) if(code == 0)
return tUnknown; return tUnknown;
auto tit = tThumb.find(code); auto tit = tThumb.find(code);
int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale;
if(tit == tThumb.end()) { if(tit == tThumb.end()) {
char file[256]; char file[256];
sprintf(file, "expansions/pics/thumbnail/%d.jpg", code); sprintf(file, "expansions/pics/thumbnail/%d.jpg", code);
irr::video::ITexture* img = GetTextureFromFile(file, CARD_THUMB_WIDTH, CARD_THUMB_HEIGHT); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/thumbnail/%d.jpg", code); sprintf(file, "pics/thumbnail/%d.jpg", code);
img = GetTextureFromFile(file, CARD_THUMB_WIDTH, CARD_THUMB_HEIGHT); img = GetTextureFromFile(file, width, height);
} }
if(img == NULL && mainGame->gameConf.use_image_scale) { if(img == NULL && mainGame->gameConf.use_image_scale) {
sprintf(file, "expansions/pics/%d.jpg", code); sprintf(file, "expansions/pics/%d.jpg", code);
img = GetTextureFromFile(file, CARD_THUMB_WIDTH, CARD_THUMB_HEIGHT); img = GetTextureFromFile(file, width, height);
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/%d.jpg", code); sprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, CARD_THUMB_WIDTH, CARD_THUMB_HEIGHT); img = GetTextureFromFile(file, width, height);
} }
} }
tThumb[code] = img; tThumb[code] = img;
...@@ -217,18 +235,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) { ...@@ -217,18 +235,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
if(tit == tFields.end()) { if(tit == tFields.end()) {
char file[256]; char file[256];
sprintf(file, "expansions/pics/field/%d.png", code); sprintf(file, "expansions/pics/field/%d.png", code);
irr::video::ITexture* img = GetTextureFromFile(file, 512, 512); irr::video::ITexture* img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == NULL) { if(img == NULL) {
sprintf(file, "expansions/pics/field/%d.jpg", code); sprintf(file, "expansions/pics/field/%d.jpg", code);
img = GetTextureFromFile(file, 512, 512); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
} }
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/field/%d.png", code); sprintf(file, "pics/field/%d.png", code);
img = GetTextureFromFile(file, 512, 512); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
} }
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/field/%d.jpg", code); sprintf(file, "pics/field/%d.jpg", code);
img = GetTextureFromFile(file, 512, 512); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == NULL) { if(img == NULL) {
tFields[code] = NULL; tFields[code] = NULL;
return NULL; return NULL;
......
...@@ -14,11 +14,11 @@ public: ...@@ -14,11 +14,11 @@ public:
void ClearTexture(); void ClearTexture();
void RemoveTexture(int code); void RemoveTexture(int code);
irr::video::ITexture* GetTextureFromFile(char* file, s32 width, s32 height); irr::video::ITexture* GetTextureFromFile(char* file, s32 width, s32 height);
irr::video::ITexture* GetTexture(int code); irr::video::ITexture* GetTexture(int code, bool fit = false);
irr::video::ITexture* GetTextureThumb(int code); irr::video::ITexture* GetTextureThumb(int code);
irr::video::ITexture* GetTextureField(int code); irr::video::ITexture* GetTextureField(int code);
std::unordered_map<int, irr::video::ITexture*> tMap; std::unordered_map<int, irr::video::ITexture*> tMap[2];
std::unordered_map<int, irr::video::ITexture*> tThumb; std::unordered_map<int, irr::video::ITexture*> tThumb;
std::unordered_map<int, irr::video::ITexture*> tFields; std::unordered_map<int, irr::video::ITexture*> tFields;
irr::IrrlichtDevice* device; irr::IrrlichtDevice* device;
......
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