Commit 87e96921 authored by mercury233's avatar mercury233 Committed by GitHub

add window resize (#2123)

parent 1dd2fa99
...@@ -399,7 +399,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -399,7 +399,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
else if(conti_selecting) else if(conti_selecting)
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->chain_code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->chain_code));
else else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler]); mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardSelect[i]->setPressed(false); mainGame->btnCardSelect[i]->setPressed(false);
mainGame->btnCardSelect[i]->setVisible(true); mainGame->btnCardSelect[i]->setVisible(true);
...@@ -483,7 +483,7 @@ void ClientField::ShowChainCard() { ...@@ -483,7 +483,7 @@ void ClientField::ShowChainCard() {
if(selectable_cards[i]->code) if(selectable_cards[i]->code)
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardSelect[i], selectable_cards[i]->code));
else else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler]); mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardSelect[i]->setPressed(false); mainGame->btnCardSelect[i]->setPressed(false);
mainGame->btnCardSelect[i]->setVisible(true); mainGame->btnCardSelect[i]->setVisible(true);
...@@ -538,7 +538,7 @@ void ClientField::ShowLocationCard() { ...@@ -538,7 +538,7 @@ void ClientField::ShowLocationCard() {
if(display_cards[i]->code) if(display_cards[i]->code)
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code)); mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code));
else else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i]->controler]); mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i]->controler + 2]);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225)); mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardDisplay[i]->setPressed(false); mainGame->btnCardDisplay[i]->setPressed(false);
mainGame->btnCardDisplay[i]->setVisible(true); mainGame->btnCardDisplay[i]->setVisible(true);
......
...@@ -104,6 +104,7 @@ void DeckBuilder::Terminate() { ...@@ -104,6 +104,7 @@ void DeckBuilder::Terminate() {
mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wACMessage->setVisible(false); mainGame->wACMessage->setVisible(false);
mainGame->ClearTextures(); mainGame->ClearTextures();
mainGame->showingcode = 0;
mainGame->scrFilter->setVisible(false); mainGame->scrFilter->setVisible(false);
int sel = mainGame->cbDBDecks->getSelected(); int sel = mainGame->cbDBDecks->getSelected();
if(sel >= 0) if(sel >= 0)
...@@ -129,7 +130,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -129,7 +130,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
switch(id) { switch(id) {
case BUTTON_CLEAR_DECK: { case BUTTON_CLEAR_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, dataManager.GetSysString(1339)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1339));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
...@@ -185,7 +186,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -185,7 +186,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
wchar_t textBuffer[256]; wchar_t textBuffer[256];
myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
...@@ -195,7 +196,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -195,7 +196,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
...@@ -362,7 +363,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -362,7 +363,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case COMBOBOX_DBDECKS: { case COMBOBOX_DBDECKS: {
if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
...@@ -682,8 +683,9 @@ void DeckBuilder::GetHoveredCard() { ...@@ -682,8 +683,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;
is_lastcard = 0; is_lastcard = 0;
if(x >= 314 && x <= 794) { if(x >= 314 && x <= 794) {
if(y >= 164 && y <= 435) { if(y >= 164 && y <= 435) {
...@@ -749,8 +751,8 @@ void DeckBuilder::GetHoveredCard() { ...@@ -749,8 +751,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)
......
...@@ -88,13 +88,13 @@ void Game::DrawBackGround() { ...@@ -88,13 +88,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);
...@@ -190,7 +190,7 @@ void Game::DrawBackGround() { ...@@ -190,7 +190,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);
} }
...@@ -222,12 +222,12 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -222,12 +222,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);
} }
...@@ -236,9 +236,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -236,9 +236,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);
...@@ -248,9 +248,9 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -248,9 +248,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);
...@@ -260,32 +260,32 @@ void Game::DrawLinkedZones(ClientCard* pcard) { ...@@ -260,32 +260,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);
} }
...@@ -397,6 +397,13 @@ void Game::DrawCard(ClientCard* pcard) { ...@@ -397,6 +397,13 @@ void Game::DrawCard(ClientCard* pcard) {
driver->drawVertexPrimitiveList(matManager.vSymbol, 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(matManager.vSymbol, 4, matManager.iRectangle, 2);
} }
} }
void Game::DrawShadowText(CGUITTFont * font, const core::stringw & text, const core::rect<s32>& position, const core::rect<s32>& padding,
video::SColor color, video::SColor shadowcolor, bool hcenter, bool vcenter, const core::rect<s32>* clip) {
core::rect<s32> shadowposition = recti(position.UpperLeftCorner.X - padding.UpperLeftCorner.X, position.UpperLeftCorner.Y - padding.UpperLeftCorner.Y,
position.LowerRightCorner.X - padding.LowerRightCorner.X, position.LowerRightCorner.Y - padding.LowerRightCorner.Y);
font->draw(text, shadowposition, shadowcolor, hcenter, vcenter, clip);
font->draw(text, position, color, hcenter, vcenter, clip);
}
void Game::DrawMisc() { void Game::DrawMisc() {
static irr::core::vector3df act_rot(0, 0, 0); static irr::core::vector3df act_rot(0, 0, 0);
int rule = (dInfo.duel_rule >= 4) ? 1 : 0; int rule = (dInfo.duel_rule >= 4) ? 1 : 0;
...@@ -477,20 +484,20 @@ void Game::DrawMisc() { ...@@ -477,20 +484,20 @@ void Game::DrawMisc() {
DrawSelectionLine(btnCancelOrFinish, 2, 0xffffff00); DrawSelectionLine(btnCancelOrFinish, 2, 0xffffff00);
//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]);
...@@ -499,39 +506,38 @@ void Game::DrawMisc() { ...@@ -499,39 +506,38 @@ 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); DrawShadowText(lpcFont, lpcstring, Resize(400, 472, 922, 520), Resize(0, 2, 2, 0), lpccolor, lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(400, 472, 922, 520), lpccolor, true, false, 0);
} else { } else {
lpcFont->draw(lpcstring, recti(400, 160, 920, 210), lpccolor | 0x00ffffff, true, false, 0); DrawShadowText(lpcFont, lpcstring, Resize(400, 162, 922, 210), Resize(0, 2, 2, 0), lpccolor, lpccolor | 0x00ffffff, true, false, 0);
lpcFont->draw(lpcstring, recti(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); DrawShadowText(numFont, dInfo.strLP[0], Resize(330, 12, 631, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[0], recti(330, 12, 631, 30), 0xffffff00, true, false, 0); DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(691, 11, 990, 30), 0xff000000, true, false, 0);
numFont->draw(dInfo.strLP[1], recti(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); DrawShadowText(lpcFont, dataManager.GetNumString(dInfo.turn), Resize(635, 5, 687, 40), Resize(0, 0, 2, 0), 0x8000ffff, 0x80000000, true, false, 0);
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(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];
...@@ -558,126 +564,99 @@ void Game::DrawMisc() { ...@@ -558,126 +564,99 @@ 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); DrawShadowText(adFont, pcard->lscstring, Resize(427, 395, 439, 415), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(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); DrawShadowText(adFont, pcard->rscstring, Resize(881, 395, 913, 415), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(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); DrawShadowText(adFont, pcard->lscstring, Resize(840, 246, 872, 266), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(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); DrawShadowText(adFont, pcard->rscstring, Resize(464, 246, 496, 266), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(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); DrawShadowText(adFont, pcard->lscstring, Resize(455, 431, 467, 451), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(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); DrawShadowText(adFont, pcard->rscstring, Resize(851, 431, 883, 451), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(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); DrawShadowText(adFont, pcard->lscstring, Resize(807, 223, 839, 243), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->lscstring, recti(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); DrawShadowText(adFont, pcard->rscstring, Resize(499, 223, 531, 243), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(pcard->rscstring, recti(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 : numFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 562, 371, 552), 0xff000000, true, false, 0); DrawShadowText(numFont, dataManager.GetNumString(dField.extra[0].size()), Resize(320, 563, 373, 553, offset, 0, 0, 0), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[0].size()), recti(320 + offset, 563, 373, 553), 0xffffff00, true, false, 0); DrawShadowText(numFont, dataManager.GetNumString(dField.extra_p_count[0], true), Resize(340, 563, 393, 553), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, 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), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.deck[0].size()), Resize(908, 563, 1023, 553), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[0].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.grave[0].size()), Resize(837, 376, 986, 381), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.remove[0].size()), Resize(1015, 376, 959, 381), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.grave[0].size()), Resize(870, 457, 1004, 462), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[0].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.remove[0].size()), Resize(837, 376, 986, 381), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[0].size()), recti(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 : numFont->getDimension(dataManager.GetNumString(1)).Width;
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 207, 898, 232), 0xff000000, true, false, 0); DrawShadowText(numFont, dataManager.GetNumString(dField.extra[1].size()), Resize(808, 208, 900, 233, offset, 0, 0, 0), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.extra[1].size()), recti(808 + offset, 208, 900, 233), 0xffffff00, true, false, 0); DrawShadowText(numFont, dataManager.GetNumString(dField.extra_p_count[1], true), Resize(828, 208, 920, 233), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, 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), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.deck[1].size()), Resize(465, 208, 483, 233), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.deck[1].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.grave[1].size()), Resize(420, 311, 464, 282), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.remove[1].size()), Resize(300, 311, 445, 341), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.grave[1].size()), Resize(455, 250, 464, 300), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.grave[1].size()), recti(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); DrawShadowText(numFont, dataManager.GetNumString(dField.remove[1].size()), Resize(420, 311, 464, 282), Resize(0, 1, 2, 1), 0xffffff00, 0xff000000, true, false, 0);
numFont->draw(dataManager.GetNumString(dField.remove[1].size()), recti(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); DrawShadowText(adFont, L"/", Resize(x1 - 3, y1 + 1, x1 + 5, y1 + 21), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, true, false, 0);
adFont->draw(L"/", recti(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); DrawShadowText(adFont, pcard->atkstring, Resize(x1 - 4, y1 + 1, x1 - 4, y1 + 21, -w, 0, 0, 0), Resize(1, 1, 1, 1),
adFont->draw(pcard->atkstring, recti(x1 - 4 - w, y1 + 1, x1 - 4, y1 + 21), pcard->attack > pcard->base_attack ? 0xffffff00 : pcard->attack < pcard->base_attack ? 0xffff2090 : 0xffffffff, 0xff000000);
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); DrawShadowText(adFont, pcard->linkstring, Resize(x1 + 5, y1 + 1, x1 + 5, y1 + 21, 0, 0, w, 0), Resize(1, 1, 1, 1), 0xff99ffff);
adFont->draw(pcard->linkstring, recti(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); DrawShadowText(adFont, pcard->defstring, Resize(x1 + 5, y1 + 1, x1 + 5, y1 + 21, 0, 0, w, 0), Resize(1, 1, 1, 1),
adFont->draw(pcard->defstring, recti(x1 + 5, y1 + 1, x1 + 5 + w, y1 + 21), pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff);
pcard->defense > pcard->base_defense ? 0xffffff00 : pcard->defense < pcard->base_defense ? 0xffff2090 : 0xffffffff, false, false, 0); DrawShadowText(adFont, pcard->lvstring, Resize(x2 + 1, y2, x2 + 3, y2 + 21), Resize(1, 1, 1, 1),
adFont->draw(pcard->lvstring, recti(x2, y2, x2 + 2, y2 + 20), 0xff000000, false, false, 0); (pcard->type & TYPE_XYZ) ? 0xffff80ff : (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff);
adFont->draw(pcard->lvstring, recti(x2 + 1, y2, x2 + 3, y2 + 21),
(pcard->type & TYPE_XYZ) ? 0xffff80ff : (pcard->type & TYPE_TUNER) ? 0xffffff00 : 0xffffffff, false, false, 0);
} }
} }
void Game::DrawGUI() { void Game::DrawGUI() {
...@@ -766,12 +745,14 @@ void Game::DrawGUI() { ...@@ -766,12 +745,14 @@ void Game::DrawGUI() {
env->drawAll(); env->drawAll();
} }
void Game::DrawSpec() { void Game::DrawSpec() {
s32 midx = 574 + (CARD_IMG_WIDTH * 0.5);
s32 midy = 150 + (CARD_IMG_HEIGHT * 0.5);
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), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 404), driver->draw2DImage(imageManager.tMask, ResizeCardMid(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 150 + CARD_IMG_HEIGHT, midx, midy),
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) {
showcard = 2; showcard = 2;
...@@ -780,8 +761,9 @@ void Game::DrawSpec() { ...@@ -780,8 +761,9 @@ void Game::DrawSpec() {
break; break;
} }
case 2: { case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, recti(574 + showcarddif, 150, 751, 404), recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true); driver->draw2DImage(imageManager.tMask, ResizeCardMid(574 + showcarddif, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT, midx, midy),
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;
...@@ -789,8 +771,8 @@ void Game::DrawSpec() { ...@@ -789,8 +771,8 @@ void Game::DrawSpec() {
break; break;
} }
case 3: { case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), position2di(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(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, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy), recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
break; break;
...@@ -800,8 +782,8 @@ void Game::DrawSpec() { ...@@ -800,8 +782,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), ResizeCardHint(574, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT),
recti(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 255) if(showcarddif < 255)
showcarddif += 17; showcarddif += 17;
break; break;
...@@ -811,28 +793,34 @@ void Game::DrawSpec() { ...@@ -811,28 +793,34 @@ 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), ResizeCardMid(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif, midx, midy),
recti(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeFit(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), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNumber, recti(536 + showcarddif, 141 + showcarddif, 793 - showcarddif, 397 - showcarddif), driver->draw2DImage(imageManager.tNumber, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy),
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;
break; break;
} }
case 7: { case 7: {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
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 * mul;
corner[0] = core::position2d<s32>(574 - (CARD_IMG_HEIGHT - y) * 0.3f, 404 - y); s32 winx = midx * xScale + (574 - midx) * mul;
corner[1] = core::position2d<s32>(751 + (CARD_IMG_HEIGHT - y) * 0.3f, 404 - y); s32 winx2 = midx * xScale + (751 - midx) * mul;
corner[2] = core::position2d<s32>(574, 404); s32 winy = midy * yScale + (404 - midy) * mul;
corner[3] = core::position2d<s32>(751, 404); corner[0] = core::position2d<s32>(winx - (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode), rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner); corner[1] = core::position2d<s32>(winx2 + (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[2] = core::position2d<s32>(winx, winy);
corner[3] = core::position2d<s32>(winx2, winy);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
showcardp++; showcardp++;
showcarddif += 9; showcarddif += 9;
if(showcarddif >= 90) if(showcarddif >= 90)
...@@ -845,8 +833,8 @@ void Game::DrawSpec() { ...@@ -845,8 +833,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], position2di((615 + 44.5) * xScale - 44.5, (showcarddif + 64) * yScale - 64));
driver->draw2DImage(imageManager.tHand[showcardcode & 0x3], position2di(615, 540 - showcarddif)); driver->draw2DImage(imageManager.tHand[showcardcode & 0x3], position2di((615 + 44.5) * xScale - 44.5, (540 - showcarddif + 64) * yScale - 64));
float dy = -0.333333f * showcardp + 10; float dy = -0.333333f * showcardp + 10;
showcardp++; showcardp++;
if(showcardp < 30) if(showcardp < 30)
...@@ -904,21 +892,16 @@ void Game::DrawSpec() { ...@@ -904,21 +892,16 @@ 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); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660 - (9 - showcardp) * 40, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), alpha | 0xffffff, alpha);
lpcFont->draw(lstr, recti(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); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), 0xffffffff);
lpcFont->draw(lstr, recti(651 - pos.Width / 2, 291, 950, 370), 0xff000000);
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, Resize(540, 320, 790, 340));
guiFont->draw(dInfo.vic_string, recti(502, 321, 840, 340), 0xff000000, true, true); DrawShadowText(guiFont, dInfo.vic_string, Resize(490, 320, 840, 340), Resize(-2, -1, 0, 0), 0xffffffff, 0xff000000, true, true, 0);
guiFont->draw(dInfo.vic_string, recti(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); DrawShadowText(lpcFont, lstr, ResizePhaseHint(660 + (showcardp - showcarddif) * 40, 290, 960, 370, pos.Width), Resize(-1, -1, 0, 0), alpha | 0xffffff, alpha);
lpcFont->draw(lstr, recti(650 - pos.Width / 2 + (showcardp - showcarddif) * 40, 290, 950, 370), alpha | 0xffffff);
} }
showcardp++; showcardp++;
break; break;
...@@ -953,17 +936,24 @@ void Game::DrawSpec() { ...@@ -953,17 +936,24 @@ void Game::DrawSpec() {
continue; continue;
if(!showChat && i > 2) if(!showChat && i > 2)
continue; continue;
int w = textFont->getDimension(chatMsg[i].c_str()).Width; int w = guiFont->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);
guiFont->draw(chatMsg[i].c_str(), msgloc, 0xff000000, false, false);
guiFont->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;
...@@ -1035,7 +1025,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) { ...@@ -1035,7 +1025,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) {
soundManager.PlayDialogSound(element); soundManager.PlayDialogSound(element);
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)
...@@ -1047,7 +1037,7 @@ void Game::WaitFrameSignal(int frame) { ...@@ -1047,7 +1037,7 @@ void Game::WaitFrameSignal(int frame) {
signalFrame = (gameConf.quick_animation && frame >= 12) ? 12 : frame; signalFrame = (gameConf.quick_animation && frame >= 12) ? 12 : 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)
...@@ -1056,37 +1046,44 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i ...@@ -1056,37 +1046,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 * mainGame->yScale, 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;
} }
} }
...@@ -1094,14 +1091,12 @@ void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, i ...@@ -1094,14 +1091,12 @@ 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); DrawShadowText(textFont, dataManager.GetSysString(1330), Resize(315, 137, 410, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1330), recti(315, 137, 410, 157), 0xffffffff, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.main.size()], Resize(380, 138, 440, 158), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(379, 137, 439, 157), 0xff000000, false, true); driver->draw2DRectangle(Resize(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
numFont->draw(dataManager.numStrings[deckManager.current_deck.main.size()], recti(380, 138, 440, 158), 0xffffffff, false, true); driver->draw2DRectangleOutline(Resize(309, 159, 797, 436));
driver->draw2DRectangle(recti(310, 160, 797, 436), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(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) {
...@@ -1114,66 +1109,58 @@ void Game::DrawDeckBd() { ...@@ -1114,66 +1109,58 @@ 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); DrawShadowText(textFont, dataManager.GetSysString(1331), Resize(315, 440, 410, 460), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1331), recti(315, 440, 410, 460), 0xffffffff, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.extra.size()], Resize(380, 441, 440, 461), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(379, 440, 439, 460), 0xff000000, false, true); driver->draw2DRectangle(Resize(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
numFont->draw(dataManager.numStrings[deckManager.current_deck.extra.size()], recti(380, 441, 440, 461), 0xffffffff, false, true); driver->draw2DRectangleOutline(Resize(309, 462, 797, 533));
driver->draw2DRectangle(recti(310, 463, 797, 533), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(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); DrawShadowText(textFont, dataManager.GetSysString(1332), Resize(315, 537, 410, 557), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1332), recti(315, 537, 410, 557), 0xffffffff, false, true); DrawShadowText(numFont, dataManager.numStrings[deckManager.current_deck.side.size()], Resize(380, 538, 440, 558), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(379, 537, 439, 557), 0xff000000, false, true); driver->draw2DRectangle(Resize(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
numFont->draw(dataManager.numStrings[deckManager.current_deck.side.size()], recti(380, 538, 440, 558), 0xffffffff, false, true); driver->draw2DRectangleOutline(Resize(309, 559, 797, 630));
driver->draw2DRectangle(recti(310, 560, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(recti(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); DrawShadowText(textFont, dataManager.GetSysString(1333), Resize(810, 137, 915, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
textFont->draw(dataManager.GetSysString(1333), recti(810, 137, 915, 157), 0xffffffff, false, true); DrawShadowText(numFont, deckBuilder.result_string, Resize(875, 137, 935, 157), Resize(1, 1, 1, 1), 0xffffffff, 0xff000000, false, true);
numFont->draw(deckBuilder.result_string, recti(874, 136, 934, 156), 0xff000000, false, true); driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
numFont->draw(deckBuilder.result_string, recti(875, 137, 935, 157), 0xffffffff, false, true); driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630));
driver->draw2DRectangle(recti(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); for(size_t i = 0; i < 7 && i + scrFilter->getPos() < deckBuilder.results.size(); ++i) {
driver->draw2DRectangleOutline(recti(804, 159, 1020, 630)); code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()];
for(size_t i = 0; i < 7 && i + mainGame->scrFilter->getPos() < deckBuilder.results.size(); ++i) {
code_pointer ptr = deckBuilder.results[i + mainGame->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); DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(860, 165 + i * 66, 955, 185 + i * 66), 0xffffffff, false, false);
if(!(ptr->second.type & TYPE_LINK)) { if(!(ptr->second.type & TYPE_LINK)) {
const wchar_t* form = L"\u2605"; const 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); DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(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)
...@@ -1183,8 +1170,7 @@ void Game::DrawDeckBd() { ...@@ -1183,8 +1170,7 @@ 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); DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(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);
...@@ -1200,15 +1186,12 @@ void Game::DrawDeckBd() { ...@@ -1200,15 +1186,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); DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(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); DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(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); DrawShadowText(textFont, ptype, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(ptype, recti(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]");
...@@ -1216,12 +1199,11 @@ void Game::DrawDeckBd() { ...@@ -1216,12 +1199,11 @@ 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); DrawShadowText(textFont, textBuffer, Resize(860, 209 + i * 66, 955, 229 + i * 66), Resize(1, 1, 0, 0));
textFont->draw(textBuffer, recti(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);
} }
} }
} }
...@@ -940,7 +940,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -940,7 +940,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -958,7 +958,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -958,7 +958,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -969,7 +969,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -969,7 +969,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -980,7 +980,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -980,7 +980,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(data); mainGame->logParam.push_back(data);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -991,7 +991,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -991,7 +991,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1315,7 +1315,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1315,7 +1315,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, dataManager.GetDesc(desc), dataManager.GetName(code)); myswprintf(textBuffer, dataManager.GetDesc(desc), dataManager.GetName(code));
} }
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
...@@ -1325,7 +1325,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1325,7 +1325,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int desc = BufferIO::ReadInt32(pbuf); int desc = BufferIO::ReadInt32(pbuf);
mainGame->dField.highlighting_card = 0; mainGame->dField.highlighting_card = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, dataManager.GetDesc(desc)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetDesc(desc));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
...@@ -1569,7 +1569,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1569,7 +1569,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, L"%ls\n%ls\n%ls", event_string, dataManager.GetSysString(222), dataManager.GetSysString(223)); myswprintf(textBuffer, L"%ls\n%ls\n%ls", event_string, dataManager.GetSysString(222), dataManager.GetSysString(223));
else else
myswprintf(textBuffer, L"%ls\n%ls", event_string, dataManager.GetSysString(203)); myswprintf(textBuffer, L"%ls\n%ls", event_string, dataManager.GetSysString(203));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
} }
} }
......
...@@ -279,7 +279,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -279,7 +279,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->btnOptionn->setVisible(true); mainGame->btnOptionn->setVisible(true);
if(selected_option == 0) if(selected_option == 0)
mainGame->btnOptionp->setVisible(false); mainGame->btnOptionp->setVisible(false);
mainGame->SetStaticText(mainGame->stOptions, 310, mainGame->textFont, dataManager.GetDesc(select_options[selected_option])); mainGame->SetStaticText(mainGame->stOptions, 310, mainGame->guiFont, dataManager.GetDesc(select_options[selected_option]));
break; break;
} }
case BUTTON_OPTION_NEXT: { case BUTTON_OPTION_NEXT: {
...@@ -288,7 +288,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -288,7 +288,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->btnOptionp->setVisible(true); mainGame->btnOptionp->setVisible(true);
if(selected_option == select_options.size() - 1) if(selected_option == select_options.size() - 1)
mainGame->btnOptionn->setVisible(false); mainGame->btnOptionn->setVisible(false);
mainGame->SetStaticText(mainGame->stOptions, 310, mainGame->textFont, dataManager.GetDesc(select_options[selected_option])); mainGame->SetStaticText(mainGame->stOptions, 310, mainGame->guiFont, dataManager.GetDesc(select_options[selected_option]));
break; break;
} }
case BUTTON_OPTION_0: { case BUTTON_OPTION_0: {
...@@ -857,7 +857,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -857,7 +857,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else if(conti_selecting) else if(conti_selecting)
mainGame->btnCardSelect[i]->setImage(imageManager.GetTexture(selectable_cards[i + pos]->chain_code)); mainGame->btnCardSelect[i]->setImage(imageManager.GetTexture(selectable_cards[i + pos]->chain_code));
else else
mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i + pos]->controler]); mainGame->btnCardSelect[i]->setImage(imageManager.tCover[selectable_cards[i + pos]->controler + 2]);
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225)); mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
// text // text
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
...@@ -918,7 +918,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -918,7 +918,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(display_cards[i + pos]->code) if(display_cards[i + pos]->code)
mainGame->btnCardDisplay[i]->setImage(imageManager.GetTexture(display_cards[i + pos]->code)); mainGame->btnCardDisplay[i]->setImage(imageManager.GetTexture(display_cards[i + pos]->code));
else else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i + pos]->controler]); mainGame->btnCardDisplay[i]->setImage(imageManager.tCover[display_cards[i + pos]->controler + 2]);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225)); mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
if(display_cards[i + pos]->location == LOCATION_OVERLAY) { if(display_cards[i + pos]->location == LOCATION_OVERLAY) {
...@@ -1030,10 +1030,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1030,10 +1030,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) {
...@@ -1042,7 +1043,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1042,7 +1043,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;
...@@ -1426,7 +1427,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1426,7 +1427,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
if(event.MouseInput.isLeftPressed()) if(event.MouseInput.isLeftPressed())
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;
...@@ -1442,9 +1443,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1442,9 +1443,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();
...@@ -1453,8 +1455,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1453,8 +1455,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
should_show_tip = true; should_show_tip = true;
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->guiFont->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;
...@@ -1462,7 +1464,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1462,7 +1464,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);
...@@ -1485,9 +1487,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1485,9 +1487,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;
} }
} }
...@@ -1499,7 +1501,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1499,7 +1501,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) {
...@@ -1583,8 +1585,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1583,8 +1585,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
str.append(formatBuffer); str.append(formatBuffer);
} }
should_show_tip = true; should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(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 {
...@@ -1615,8 +1617,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1615,8 +1617,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
str.append(formatBuffer); str.append(formatBuffer);
} }
should_show_tip = true; should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(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;
...@@ -1630,7 +1632,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1630,7 +1632,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;
...@@ -1641,7 +1643,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1641,7 +1643,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;
...@@ -1790,6 +1792,26 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1790,6 +1792,26 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case BUTTON_WINDOW_RESIZE_S: {
mainGame->SetWindowsScale(0.8f);
return true;
break;
}
case BUTTON_WINDOW_RESIZE_M: {
mainGame->SetWindowsScale(1.0f);
return true;
break;
}
case BUTTON_WINDOW_RESIZE_L: {
mainGame->SetWindowsScale(1.25f);
return true;
break;
}
case BUTTON_WINDOW_RESIZE_XL: {
mainGame->SetWindowsScale(1.5f);
return true;
break;
}
} }
break; break;
} }
...@@ -1870,7 +1892,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1870,7 +1892,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break; break;
} }
u32 pos = mainGame->scrCardText->getPos(); u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->textFont, mainGame->showingtext, pos); mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
return true; return true;
break; break;
} }
...@@ -1882,6 +1904,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1882,6 +1904,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case SCROLL_TAB_HELPER: {
rect<s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
case SCROLL_TAB_SYSTEM: {
rect<s32> pos = mainGame->tabSystem->getRelativePosition();
mainGame->tabSystem->setRelativePosition(recti(0, mainGame->scrTabSystem->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
} }
break; break;
} }
...@@ -1911,15 +1945,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1911,15 +1945,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.KeyInput.Key) { switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: { case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0 if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
case irr::KEY_F9: { case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1 if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
...@@ -2134,25 +2172,26 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -2134,25 +2172,26 @@ void ClientField::ShowMenu(int flag, int x, int y) {
return; return;
} }
int height = 1; int height = 1;
int offset = mainGame->gameConf.resize_popup_menu ? ((mainGame->yScale >= 0.666) ? 21 * mainGame->yScale : 14) : 21;
if(flag & COMMAND_ACTIVATE) { if(flag & COMMAND_ACTIVATE) {
mainGame->btnActivate->setVisible(true); mainGame->btnActivate->setVisible(true);
mainGame->btnActivate->setRelativePosition(position2di(1, height)); mainGame->btnActivate->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnActivate->setVisible(false); } else mainGame->btnActivate->setVisible(false);
if(flag & COMMAND_SUMMON) { if(flag & COMMAND_SUMMON) {
mainGame->btnSummon->setVisible(true); mainGame->btnSummon->setVisible(true);
mainGame->btnSummon->setRelativePosition(position2di(1, height)); mainGame->btnSummon->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnSummon->setVisible(false); } else mainGame->btnSummon->setVisible(false);
if(flag & COMMAND_SPSUMMON) { if(flag & COMMAND_SPSUMMON) {
mainGame->btnSPSummon->setVisible(true); mainGame->btnSPSummon->setVisible(true);
mainGame->btnSPSummon->setRelativePosition(position2di(1, height)); mainGame->btnSPSummon->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnSPSummon->setVisible(false); } else mainGame->btnSPSummon->setVisible(false);
if(flag & COMMAND_MSET) { if(flag & COMMAND_MSET) {
mainGame->btnMSet->setVisible(true); mainGame->btnMSet->setVisible(true);
mainGame->btnMSet->setRelativePosition(position2di(1, height)); mainGame->btnMSet->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnMSet->setVisible(false); } else mainGame->btnMSet->setVisible(false);
if(flag & COMMAND_SSET) { if(flag & COMMAND_SSET) {
if(!(clicked_card->type & TYPE_MONSTER)) if(!(clicked_card->type & TYPE_MONSTER))
...@@ -2161,7 +2200,7 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -2161,7 +2200,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnSSet->setText(dataManager.GetSysString(1159)); mainGame->btnSSet->setText(dataManager.GetSysString(1159));
mainGame->btnSSet->setVisible(true); mainGame->btnSSet->setVisible(true);
mainGame->btnSSet->setRelativePosition(position2di(1, height)); mainGame->btnSSet->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnSSet->setVisible(false); } else mainGame->btnSSet->setVisible(false);
if(flag & COMMAND_REPOS) { if(flag & COMMAND_REPOS) {
if(clicked_card->position & POS_FACEDOWN) if(clicked_card->position & POS_FACEDOWN)
...@@ -2172,31 +2211,34 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -2172,31 +2211,34 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnRepos->setText(dataManager.GetSysString(1156)); mainGame->btnRepos->setText(dataManager.GetSysString(1156));
mainGame->btnRepos->setVisible(true); mainGame->btnRepos->setVisible(true);
mainGame->btnRepos->setRelativePosition(position2di(1, height)); mainGame->btnRepos->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnRepos->setVisible(false); } else mainGame->btnRepos->setVisible(false);
if(flag & COMMAND_ATTACK) { if(flag & COMMAND_ATTACK) {
mainGame->btnAttack->setVisible(true); mainGame->btnAttack->setVisible(true);
mainGame->btnAttack->setRelativePosition(position2di(1, height)); mainGame->btnAttack->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnAttack->setVisible(false); } else mainGame->btnAttack->setVisible(false);
if(flag & COMMAND_LIST) { if(flag & COMMAND_LIST) {
mainGame->btnShowList->setVisible(true); mainGame->btnShowList->setVisible(true);
mainGame->btnShowList->setRelativePosition(position2di(1, height)); mainGame->btnShowList->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnShowList->setVisible(false); } else mainGame->btnShowList->setVisible(false);
if(flag & COMMAND_OPERATION) { if(flag & COMMAND_OPERATION) {
mainGame->btnOperation->setVisible(true); mainGame->btnOperation->setVisible(true);
mainGame->btnOperation->setRelativePosition(position2di(1, height)); mainGame->btnOperation->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnOperation->setVisible(false); } else mainGame->btnOperation->setVisible(false);
if(flag & COMMAND_RESET) { if(flag & COMMAND_RESET) {
mainGame->btnReset->setVisible(true); mainGame->btnReset->setVisible(true);
mainGame->btnReset->setRelativePosition(position2di(1, height)); mainGame->btnReset->setRelativePosition(position2di(1, height));
height += 21; height += offset;
} else mainGame->btnReset->setVisible(false); } else mainGame->btnReset->setVisible(false);
panel = mainGame->wCmdMenu; panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true); mainGame->wCmdMenu->setVisible(true);
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20)); if(mainGame->gameConf.resize_popup_menu)
mainGame->wCmdMenu->setRelativePosition(mainGame->Resize(x - 20, y - 20, x + 80, y - 20, 0, -height, 0, 0));
else
mainGame->wCmdMenu->setRelativePosition(mainGame->Resize(x, y, x, y, -20, -(20 + height), 80, -20));
} }
void ClientField::UpdateChainButtons() { void ClientField::UpdateChainButtons() {
if(mainGame->btnChainAlways->isVisible()) { if(mainGame->btnChainAlways->isVisible()) {
......
...@@ -25,12 +25,14 @@ bool Game::Initialize() { ...@@ -25,12 +25,14 @@ bool Game::Initialize() {
params.DriverType = irr::video::EDT_DIRECT3D9; params.DriverType = irr::video::EDT_DIRECT3D9;
else else
params.DriverType = irr::video::EDT_OPENGL; params.DriverType = irr::video::EDT_OPENGL;
params.WindowSize = irr::core::dimension2d<u32>(1024, 640); params.WindowSize = irr::core::dimension2d<u32>(gameConf.window_width, gameConf.window_height);
device = irr::createDeviceEx(params); device = irr::createDeviceEx(params);
if(!device) { if(!device) {
ErrorLog("Failed to create Irrlicht Engine device!"); ErrorLog("Failed to create Irrlicht Engine device!");
return false; return false;
} }
xScale = 1;
yScale = 1;
linePatternD3D = 0; linePatternD3D = 0;
linePatternGL = 0x0f0f; linePatternGL = 0x0f0f;
waitFrame = 0; waitFrame = 0;
...@@ -72,26 +74,22 @@ bool Game::Initialize() { ...@@ -72,26 +74,22 @@ bool Game::Initialize() {
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12); adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12);
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48); lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48);
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize); guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
textFont = guiFont; textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
if(!numFont || !textFont) { if(!numFont || !textFont) {
ErrorLog("Failed to load font(s)!"); ErrorLog("Failed to load font(s)!");
return false; return false;
} }
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"YGOPro"); device->setWindowCaption(L"YGOPro");
device->setResizable(false); device->setResizable(true);
if(gameConf.window_maximized)
device->maximizeWindow();
#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) {
LONG style = GetWindowLongW(hWnd, GWL_STYLE);
style |= WS_MINIMIZEBOX;
SetWindowLongW(hWnd, GWL_STYLE, style);
SendMessageW(hWnd, WM_NCPAINT, 1, 0);
}
#endif #endif
SetWindowsIcon(); SetWindowsIcon();
//main menu //main menu
...@@ -215,6 +213,8 @@ bool Game::Initialize() { ...@@ -215,6 +213,8 @@ bool Game::Initialize() {
wCardImg->setVisible(false); wCardImg->setVisible(false);
imgCard = env->addImage(rect<s32>(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT), wCardImg); imgCard = env->addImage(rect<s32>(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT), wCardImg);
imgCard->setImage(imageManager.tCover[0]); imgCard->setImage(imageManager.tCover[0]);
showingcode = 0;
imgCard->setScaleImage(true);
imgCard->setUseAlphaChannel(true); imgCard->setUseAlphaChannel(true);
//phase //phase
wPhase = env->addStaticText(L"", rect<s32>(480, 310, 855, 330)); wPhase = env->addStaticText(L"", rect<s32>(480, 310, 855, 330));
...@@ -249,14 +249,24 @@ bool Game::Initialize() { ...@@ -249,14 +249,24 @@ bool Game::Initialize() {
scrCardText->setSmallStep(1); scrCardText->setSmallStep(1);
scrCardText->setVisible(false); scrCardText->setVisible(false);
//log //log
irr::gui::IGUITab* tabLog = wInfos->addTab(dataManager.GetSysString(1271)); irr::gui::IGUITab* tabLog = wInfos->addTab(dataManager.GetSysString(1271));
lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, LISTBOX_LOG, false); lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, LISTBOX_LOG, false);
lstLog->setItemHeight(18); lstLog->setItemHeight(18);
btnClearLog = env->addButton(rect<s32>(160, 300, 260, 325), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272)); btnClearLog = env->addButton(rect<s32>(160, 300, 260, 325), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272));
//helper //helper
irr::gui::IGUITab* tabHelper = wInfos->addTab(dataManager.GetSysString(1298)); irr::gui::IGUITab* _tabHelper = wInfos->addTab(dataManager.GetSysString(1298));
int posX = 20; _tabHelper->setRelativePosition(recti(16, 49, 299, 362));
int posY = 20; tabHelper = env->addWindow(recti(0, 0, 250, 300), false, L"", _tabHelper);
tabHelper->setDrawTitlebar(false);
tabHelper->getCloseButton()->setVisible(false);
tabHelper->setDrawBackground(false);
tabHelper->setDraggable(false);
scrTabHelper = env->addScrollBar(false, rect<s32>(252, 0, 272, 300), _tabHelper, SCROLL_TAB_HELPER);
scrTabHelper->setLargeStep(1);
scrTabHelper->setSmallStep(1);
scrTabHelper->setVisible(false);
int posX = 0;
int posY = 0;
chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1274)); chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1274));
chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0); chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0);
posY += 30; posY += 30;
...@@ -277,9 +287,20 @@ bool Game::Initialize() { ...@@ -277,9 +287,20 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkAutoSaveReplay = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1366)); chkAutoSaveReplay = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1366));
chkAutoSaveReplay->setChecked(gameConf.auto_save_replay != 0); chkAutoSaveReplay->setChecked(gameConf.auto_save_replay != 0);
elmTabHelperLast = chkAutoSaveReplay;
//system //system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273)); irr::gui::IGUITab* _tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20; _tabSystem->setRelativePosition(recti(16, 49, 299, 362));
tabSystem = env->addWindow(recti(0, 0, 250, 300), false, L"", _tabSystem);
tabSystem->setDrawTitlebar(false);
tabSystem->getCloseButton()->setVisible(false);
tabSystem->setDrawBackground(false);
tabSystem->setDraggable(false);
scrTabSystem = env->addScrollBar(false, rect<s32>(252, 0, 272, 300), _tabSystem, SCROLL_TAB_SYSTEM);
scrTabSystem->setLargeStep(1);
scrTabSystem->setSmallStep(1);
scrTabSystem->setVisible(false);
posY = 0;
chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290)); chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290));
chkIgnore1->setChecked(gameConf.chkIgnore1 != 0); chkIgnore1->setChecked(gameConf.chkIgnore1 != 0);
posY += 30; posY += 30;
...@@ -298,9 +319,15 @@ bool Game::Initialize() { ...@@ -298,9 +319,15 @@ bool Game::Initialize() {
chkPreferExpansionScript = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_PREFER_EXPANSION, dataManager.GetSysString(1379)); chkPreferExpansionScript = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_PREFER_EXPANSION, dataManager.GetSysString(1379));
chkPreferExpansionScript->setChecked(gameConf.prefer_expansion_script != 0); chkPreferExpansionScript->setChecked(gameConf.prefer_expansion_script != 0);
posY += 30; posY += 30;
env->addStaticText(dataManager.GetSysString(1282), rect<s32>(posX + 23, posY + 3, posX + 120, posY + 28), false, false, tabSystem);
btnWinResizeS = env->addButton(rect<s32>(posX + 115, posY, posX + 145, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_S, dataManager.GetSysString(1283));
btnWinResizeM = env->addButton(rect<s32>(posX + 150, posY, posX + 180, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_M, dataManager.GetSysString(1284));
btnWinResizeL = env->addButton(rect<s32>(posX + 185, posY, posX + 215, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_L, dataManager.GetSysString(1285));
btnWinResizeXL = env->addButton(rect<s32>(posX + 220, posY, posX + 250, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_XL, dataManager.GetSysString(1286));
posY += 30;
chkEnableSound = env->addCheckBox(gameConf.enable_sound, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, -1, dataManager.GetSysString(1279)); chkEnableSound = env->addCheckBox(gameConf.enable_sound, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, -1, dataManager.GetSysString(1279));
chkEnableSound->setChecked(gameConf.enable_sound); chkEnableSound->setChecked(gameConf.enable_sound);
scrSoundVolume = env->addScrollBar(true, rect<s32>(posX + 126, posY + 4, posX + 260, posY + 21), tabSystem, SCROLL_VOLUME); scrSoundVolume = env->addScrollBar(true, rect<s32>(posX + 116, posY + 4, posX + 250, posY + 21), tabSystem, SCROLL_VOLUME);
scrSoundVolume->setMax(100); scrSoundVolume->setMax(100);
scrSoundVolume->setMin(0); scrSoundVolume->setMin(0);
scrSoundVolume->setPos(gameConf.sound_volume * 100); scrSoundVolume->setPos(gameConf.sound_volume * 100);
...@@ -309,7 +336,7 @@ bool Game::Initialize() { ...@@ -309,7 +336,7 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkEnableMusic = env->addCheckBox(gameConf.enable_music, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, CHECKBOX_ENABLE_MUSIC, dataManager.GetSysString(1280)); chkEnableMusic = env->addCheckBox(gameConf.enable_music, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, CHECKBOX_ENABLE_MUSIC, dataManager.GetSysString(1280));
chkEnableMusic->setChecked(gameConf.enable_music); chkEnableMusic->setChecked(gameConf.enable_music);
scrMusicVolume = env->addScrollBar(true, rect<s32>(posX + 126, posY + 4, posX + 260, posY + 21), tabSystem, SCROLL_VOLUME); scrMusicVolume = env->addScrollBar(true, rect<s32>(posX + 116, posY + 4, posX + 250, posY + 21), tabSystem, SCROLL_VOLUME);
scrMusicVolume->setMax(100); scrMusicVolume->setMax(100);
scrMusicVolume->setMin(0); scrMusicVolume->setMin(0);
scrMusicVolume->setPos(gameConf.music_volume * 100); scrMusicVolume->setPos(gameConf.music_volume * 100);
...@@ -318,6 +345,7 @@ bool Game::Initialize() { ...@@ -318,6 +345,7 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkMusicMode = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1281)); chkMusicMode = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1281));
chkMusicMode->setChecked(gameConf.music_mode != 0); chkMusicMode->setChecked(gameConf.music_mode != 0);
elmTabSystemLast = chkMusicMode;
// //
wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L""); wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L"");
wHand->getCloseButton()->setVisible(false); wHand->getCloseButton()->setVisible(false);
...@@ -377,14 +405,14 @@ bool Game::Initialize() { ...@@ -377,14 +405,14 @@ bool Game::Initialize() {
btnPSAU->setImageScale(core::vector2df(0.5, 0.5)); btnPSAU->setImageScale(core::vector2df(0.5, 0.5));
btnPSAD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(155, 45, 295, 185), wPosSelect, BUTTON_POS_AD); btnPSAD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(155, 45, 295, 185), wPosSelect, BUTTON_POS_AD);
btnPSAD->setImageScale(core::vector2df(0.5, 0.5)); btnPSAD->setImageScale(core::vector2df(0.5, 0.5));
btnPSAD->setImage(imageManager.tCover[0], rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT)); btnPSAD->setImage(imageManager.tCover[2]);
btnPSDU = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(300, 45, 440, 185), wPosSelect, BUTTON_POS_DU); btnPSDU = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(300, 45, 440, 185), wPosSelect, BUTTON_POS_DU);
btnPSDU->setImageScale(core::vector2df(0.5, 0.5)); btnPSDU->setImageScale(core::vector2df(0.5, 0.5));
btnPSDU->setImageRotation(270); btnPSDU->setImageRotation(270);
btnPSDD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(445, 45, 585, 185), wPosSelect, BUTTON_POS_DD); btnPSDD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(445, 45, 585, 185), wPosSelect, BUTTON_POS_DD);
btnPSDD->setImageScale(core::vector2df(0.5, 0.5)); btnPSDD->setImageScale(core::vector2df(0.5, 0.5));
btnPSDD->setImageRotation(270); btnPSDD->setImageRotation(270);
btnPSDD->setImage(imageManager.tCover[0], rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT)); btnPSDD->setImage(imageManager.tCover[2]);
//card select //card select
wCardSelect = env->addWindow(rect<s32>(320, 100, 1000, 400), false, L""); wCardSelect = env->addWindow(rect<s32>(320, 100, 1000, 400), false, L"");
wCardSelect->getCloseButton()->setVisible(false); wCardSelect->getCloseButton()->setVisible(false);
...@@ -463,10 +491,10 @@ bool Game::Initialize() { ...@@ -463,10 +491,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)
...@@ -502,7 +530,7 @@ bool Game::Initialize() { ...@@ -502,7 +530,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, 2 + 25 / 6, 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));
...@@ -511,7 +539,7 @@ bool Game::Initialize() { ...@@ -511,7 +539,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));
...@@ -522,31 +550,31 @@ bool Game::Initialize() { ...@@ -522,31 +550,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));
...@@ -555,14 +583,23 @@ bool Game::Initialize() { ...@@ -555,14 +583,23 @@ bool Game::Initialize() {
btnStartFilter->setRelativePosition(rect<s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6)); btnStartFilter->setRelativePosition(rect<s32>(260, 80 + 125 / 6, 390, 100 + 125 / 6));
btnClearFilter = env->addButton(rect<s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304)); btnClearFilter = env->addButton(rect<s32>(205, 80 + 125 / 6, 255, 100 + 125 / 6), wFilter, BUTTON_CLEAR_FILTER, dataManager.GetSysString(1304));
} }
wCategories = env->addWindow(rect<s32>(630, 60, 1000, 270), false, dataManager.strBuffer); wCategories = env->addWindow(rect<s32>(600, 60, 1000, 305), false, dataManager.strBuffer);
wCategories->getCloseButton()->setVisible(false); wCategories->getCloseButton()->setVisible(false);
wCategories->setDrawTitlebar(false); wCategories->setDrawTitlebar(false);
wCategories->setDraggable(false); wCategories->setDraggable(false);
wCategories->setVisible(false); wCategories->setVisible(false);
btnCategoryOK = env->addButton(rect<s32>(135, 175, 235, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211)); btnCategoryOK = env->addButton(rect<s32>(150, 210, 250, 235), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211));
int catewidth = 0;
for(int i = 0; i < 32; ++i) {
irr::core::dimension2d<unsigned int> dtxt = mainGame->guiFont->getDimension(dataManager.GetSysString(1100 + i));
if(dtxt.Width + 40 > catewidth)
catewidth = dtxt.Width + 40;
}
for(int i = 0; i < 32; ++i) for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 90, 10 + (i / 4) * 20, 100 + (i % 4) * 90, 30 + (i / 4) * 20), wCategories, -1, dataManager.GetSysString(1100 + i)); chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * catewidth, 5 + (i / 4) * 25, 10 + (i % 4 + 1) * catewidth, 5 + (i / 4 + 1) * 25), wCategories, -1, dataManager.GetSysString(1100 + i));
int wcatewidth = catewidth * 4 + 16;
wCategories->setRelativePosition(rect<s32>(1000 - wcatewidth, 60, 1000, 305));
btnCategoryOK->setRelativePosition(recti(wcatewidth / 2 - 50, 210, wcatewidth / 2 + 50, 235));
btnMarksFilter = env->addButton(rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374)); btnMarksFilter = env->addButton(rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374));
wLinkMarks = env->addWindow(rect<s32>(700, 30, 820, 150), false, dataManager.strBuffer); wLinkMarks = env->addWindow(rect<s32>(700, 30, 820, 150), false, dataManager.strBuffer);
wLinkMarks->getCloseButton()->setVisible(false); wLinkMarks->getCloseButton()->setVisible(false);
...@@ -723,6 +760,13 @@ void Game::MainLoop() { ...@@ -723,6 +760,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();
}
linePatternD3D = (linePatternD3D + 1) % 30; linePatternD3D = (linePatternD3D + 1) % 30;
linePatternGL = (linePatternGL << 1) | (linePatternGL >> 15); linePatternGL = (linePatternGL << 1) | (linePatternGL >> 15);
atkframe += 0.1f; atkframe += 0.1f;
...@@ -1015,6 +1059,10 @@ void Game::LoadConfig() { ...@@ -1015,6 +1059,10 @@ void Game::LoadConfig() {
gameConf.enable_music = true; gameConf.enable_music = true;
gameConf.music_volume = 0.5; gameConf.music_volume = 0.5;
gameConf.music_mode = 1; gameConf.music_mode = 1;
gameConf.window_maximized = false;
gameConf.window_width = 1024;
gameConf.window_height = 640;
gameConf.resize_popup_menu = false;
while(fgets(linebuf, 256, fp)) { while(fgets(linebuf, 256, fp)) {
sscanf(linebuf, "%s = %s", strbuf, valbuf); sscanf(linebuf, "%s = %s", strbuf, valbuf);
if(!strcmp(strbuf, "antialias")) { if(!strcmp(strbuf, "antialias")) {
...@@ -1085,6 +1133,14 @@ void Game::LoadConfig() { ...@@ -1085,6 +1133,14 @@ void Game::LoadConfig() {
gameConf.auto_save_replay = atoi(valbuf); gameConf.auto_save_replay = atoi(valbuf);
} else if(!strcmp(strbuf, "prefer_expansion_script")) { } else if(!strcmp(strbuf, "prefer_expansion_script")) {
gameConf.prefer_expansion_script = atoi(valbuf); gameConf.prefer_expansion_script = atoi(valbuf);
} else if(!strcmp(strbuf, "window_maximized")) {
gameConf.window_maximized = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "window_width")) {
gameConf.window_width = atoi(valbuf);
} else if(!strcmp(strbuf, "window_height")) {
gameConf.window_height = atoi(valbuf);
} else if(!strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = atoi(valbuf) > 0;
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
} else if(!strcmp(strbuf, "enable_sound")) { } else if(!strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = atoi(valbuf) > 0; gameConf.enable_sound = atoi(valbuf) > 0;
...@@ -1162,6 +1218,10 @@ void Game::SaveConfig() { ...@@ -1162,6 +1218,10 @@ void Game::SaveConfig() {
fprintf(fp, "quick_animation = %d\n", gameConf.quick_animation); fprintf(fp, "quick_animation = %d\n", gameConf.quick_animation);
fprintf(fp, "auto_save_replay = %d\n", (chkAutoSaveReplay->isChecked() ? 1 : 0)); fprintf(fp, "auto_save_replay = %d\n", (chkAutoSaveReplay->isChecked() ? 1 : 0));
fprintf(fp, "prefer_expansion_script = %d\n", gameConf.prefer_expansion_script); fprintf(fp, "prefer_expansion_script = %d\n", gameConf.prefer_expansion_script);
fprintf(fp, "window_maximized = %d\n", (gameConf.window_maximized ? 1 : 0));
fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height);
fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0);
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0)); fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0));
fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0)); fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0));
...@@ -1176,12 +1236,14 @@ void Game::SaveConfig() { ...@@ -1176,12 +1236,14 @@ void Game::SaveConfig() {
#endif #endif
fclose(fp); fclose(fp);
} }
void Game::ShowCardInfo(int code) { void Game::ShowCardInfo(int code, bool resize) {
if(showingcode == code && !resize)
return;
CardData cd; CardData cd;
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 < CARD_ARTWORK_VERSIONS_OFFSET || code - cd.alias < CARD_ARTWORK_VERSIONS_OFFSET)) if(cd.alias != 0 && (cd.alias - code < CARD_ARTWORK_VERSIONS_OFFSET || code - cd.alias < CARD_ARTWORK_VERSIONS_OFFSET))
myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(cd.alias), cd.alias); myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(cd.alias), cd.alias);
...@@ -1196,7 +1258,7 @@ void Game::ShowCardInfo(int code) { ...@@ -1196,7 +1258,7 @@ void Game::ShowCardInfo(int code) {
sc = aptr->second.setcode; sc = aptr->second.setcode;
} }
if(sc) { if(sc) {
offset = 23; offset = 23;// *yScale;
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc)); myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc));
stSetName->setText(formatBuffer); stSetName->setText(formatBuffer);
} else } else
...@@ -1207,6 +1269,10 @@ void Game::ShowCardInfo(int code) { ...@@ -1207,6 +1269,10 @@ void Game::ShowCardInfo(int code) {
if(cd.type & TYPE_MONSTER) { if(cd.type & TYPE_MONSTER) {
myswprintf(formatBuffer, L"[%ls] %ls/%ls", dataManager.FormatType(cd.type), dataManager.FormatRace(cd.race), dataManager.FormatAttribute(cd.attribute)); myswprintf(formatBuffer, L"[%ls] %ls/%ls", dataManager.FormatType(cd.type), dataManager.FormatRace(cd.race), dataManager.FormatAttribute(cd.attribute));
stInfo->setText(formatBuffer); stInfo->setText(formatBuffer);
int offset_info = 0;
irr::core::dimension2d<unsigned int> dtxt = mainGame->guiFont->getDimension(formatBuffer);
if(dtxt.Width > (300 * xScale - 13) - 15)
offset_info = 15;
if(!(cd.type & TYPE_LINK)) { if(!(cd.type & TYPE_LINK)) {
const wchar_t* form = L"\u2605"; const wchar_t* form = L"\u2605";
if(cd.type & TYPE_XYZ) form = L"\u2606"; if(cd.type & TYPE_XYZ) form = L"\u2606";
...@@ -1237,23 +1303,31 @@ void Game::ShowCardInfo(int code) { ...@@ -1237,23 +1303,31 @@ 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)); int offset_arrows = offset_info;
stText->setRelativePosition(rect<s32>(15, 83 + offset, 287, 324)); dtxt = mainGame->guiFont->getDimension(formatBuffer);
scrCardText->setRelativePosition(rect<s32>(267, 83 + offset, 287, 324)); if(dtxt.Width > (300 * xScale - 13) - 15)
offset_arrows += 15;
stInfo->setRelativePosition(rect<s32>(15, 37, 300 * xScale - 13, (60 + offset_info)));
stDataInfo->setRelativePosition(rect<s32>(15, (60 + offset_info), 300 * xScale - 13, (83 + offset_arrows)));
stSetName->setRelativePosition(rect<s32>(15, (83 + offset_arrows), 296 * xScale, (83 + offset_arrows) + offset));
stText->setRelativePosition(rect<s32>(15, (83 + offset_arrows) + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + offset_arrows) + offset, 287 * xScale, 324 * yScale));
} else { } else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type)); myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer); stInfo->setText(formatBuffer);
stDataInfo->setText(L""); stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60, 296, 83)); stSetName->setRelativePosition(rect<s32>(15, 60, 296 * xScale, 60 + offset));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287, 324)); stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(267, 60 + offset, 287, 324)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
} }
showingcode = code;
showingtext = dataManager.GetText(code); showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition(); const auto& tsize = stText->getRelativePosition();
InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), textFont, showingtext); InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), guiFont, showingtext);
} }
void Game::ClearCardInfo(int player) { void Game::ClearCardInfo(int player) {
imgCard->setImage(imageManager.tCover[player]); imgCard->setImage(imageManager.tCover[player]);
showingcode = 0;
stName->setText(L""); stName->setText(L"");
stInfo->setText(L""); stInfo->setText(L"");
stDataInfo->setText(L""); stDataInfo->setText(L"");
...@@ -1338,6 +1412,8 @@ void Game::ErrorLog(const char* msg) { ...@@ -1338,6 +1412,8 @@ void Game::ErrorLog(const char* msg) {
void Game::ClearTextures() { void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0); matManager.mCard.setTexture(0, 0);
imgCard->setImage(imageManager.tCover[0]); imgCard->setImage(imageManager.tCover[0]);
scrCardText->setVisible(false);
imgCard->setScaleImage(true);
btnPSAU->setImage(); btnPSAU->setImage();
btnPSDU->setImage(); btnPSDU->setImage();
for(int i=0; i<=4; ++i) { for(int i=0; i<=4; ++i) {
...@@ -1396,6 +1472,278 @@ int Game::LocalPlayer(int player) { ...@@ -1396,6 +1472,278 @@ 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() {
#ifdef _WIN32
WINDOWPLACEMENT plc;
plc.length = sizeof(WINDOWPLACEMENT);
if(GetWindowPlacement(hWnd, &plc))
gameConf.window_maximized = (plc.showCmd == SW_SHOWMAXIMIZED);
#endif // _WIN32
if(!gameConf.window_maximized) {
gameConf.window_width = window_size.Width;
gameConf.window_height = window_size.Height;
}
irr::gui::CGUITTFont* old_numFont = numFont;
irr::gui::CGUITTFont* old_adFont = adFont;
irr::gui::CGUITTFont* old_lpcFont = lpcFont;
irr::gui::CGUITTFont* old_textFont = textFont;
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.5 ? 16 * yScale : 8));
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.75 ? 12 * yScale : 9));
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, (yScale > 0.642 ? gameConf.textfontsize * yScale : 9));
old_numFont->drop();
old_adFont->drop();
old_lpcFont->drop();
old_textFont->drop();
imageManager.ClearTexture();
imageManager.ResizeTexture();
wMainMenu->setRelativePosition(ResizeWin(370, 200, 650, 415));
wDeckEdit->setRelativePosition(Resize(309, 5, 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, 5, 1020, 130));
scrFilter->setRelativePosition(Resize(999, 161, 1019, 629));
cbCardType->setRelativePosition(Resize(60, 25 / 6, 120, 20 + 25 / 6));
cbCardType2->setRelativePosition(Resize(130, 25 / 6, 190, 20 + 25 / 6));
cbRace->setRelativePosition(Resize(60, 40 + 75 / 6, 190, 60 + 75 / 6));
cbAttribute->setRelativePosition(Resize(60, 20 + 50 / 6, 190, 40 + 50 / 6));
cbLimit->setRelativePosition(Resize(260, 25 / 6, 390, 20 + 25 / 6));
ebStar->setRelativePosition(Resize(60, 60 + 100 / 6, 95, 80 + 100 / 6));
ebScale->setRelativePosition(Resize(155, 60 + 100 / 6, 190, 80 + 100 / 6));
ebAttack->setRelativePosition(Resize(260, 20 + 50 / 6, 340, 40 + 50 / 6));
ebDefense->setRelativePosition(Resize(260, 40 + 75 / 6, 340, 60 + 75 / 6));
ebCardName->setRelativePosition(Resize(260, 60 + 100 / 6, 390, 80 + 100 / 6));
btnEffectFilter->setRelativePosition(Resize(345, 20 + 50 / 6, 390, 60 + 75 / 6));
btnStartFilter->setRelativePosition(Resize(260, 80 + 125 / 6, 390, 100 + 125 / 6));
if(btnClearFilter)
btnClearFilter->setRelativePosition(Resize(205, 80 + 125 / 6, 255, 100 + 125 / 6));
btnMarksFilter->setRelativePosition(Resize(60, 80 + 125 / 6, 190, 100 + 125 / 6));
recti btncatepos = btnEffectFilter->getAbsolutePosition();
wCategories->setRelativePosition(recti(
btncatepos.LowerRightCorner.X - wCategories->getRelativePosition().getWidth(),
btncatepos.LowerRightCorner.Y - btncatepos.getHeight() / 2,
btncatepos.LowerRightCorner.X,
btncatepos.LowerRightCorner.Y - btncatepos.getHeight() / 2 + 245));
wLinkMarks->setRelativePosition(ResizeWin(700, 30, 820, 150));
stBanlist->setRelativePosition(Resize(10, 9, 100, 29));
stDeck->setRelativePosition(Resize(10, 39, 100, 59));
stCategory->setRelativePosition(Resize(10, 2 + 25 / 6, 70, 22 + 25 / 6));
stLimit->setRelativePosition(Resize(205, 2 + 25 / 6, 280, 22 + 25 / 6));
stAttribute->setRelativePosition(Resize(10, 22 + 50 / 6, 70, 42 + 50 / 6));
stRace->setRelativePosition(Resize(10, 42 + 75 / 6, 70, 62 + 75 / 6));
stAttack->setRelativePosition(Resize(205, 22 + 50 / 6, 280, 42 + 50 / 6));
stDefense->setRelativePosition(Resize(205, 42 + 75 / 6, 280, 62 + 75 / 6));
stStar->setRelativePosition(Resize(10, 62 + 100 / 6, 70, 82 + 100 / 6));
stSearch->setRelativePosition(Resize(205, 62 + 100 / 6, 280, 82 + 100 / 6));
stScale->setRelativePosition(Resize(105, 62 + 100 / 6, 165, 82 + 100 / 6));
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(560, 170, 770, 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(660 - 160 * xScale, 60, 660 + 160 * xScale, 90));
//sound / music volume bar
scrSoundVolume->setRelativePosition(recti(scrSoundVolume->getRelativePosition().UpperLeftCorner.X, scrSoundVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrSoundVolume->getRelativePosition().LowerRightCorner.Y));
scrMusicVolume->setRelativePosition(recti(scrMusicVolume->getRelativePosition().UpperLeftCorner.X, scrMusicVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrMusicVolume->getRelativePosition().LowerRightCorner.Y));
recti tabHelperPos = recti(0, 0, 300 * xScale - 50, 365 * yScale - 65);
tabHelper->setRelativePosition(tabHelperPos);
scrTabHelper->setRelativePosition(recti(tabHelperPos.LowerRightCorner.X + 2, 0, tabHelperPos.LowerRightCorner.X + 22, tabHelperPos.LowerRightCorner.Y));
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
if(tabHelperLastY > tabHelperPos.LowerRightCorner.Y) {
scrTabHelper->setMax(tabHelperLastY - tabHelperPos.LowerRightCorner.Y + 5);
scrTabHelper->setPos(0);
scrTabHelper->setVisible(true);
}
else
scrTabHelper->setVisible(false);
recti tabSystemPos = recti(0, 0, 300 * xScale - 50, 365 * yScale - 65);
tabSystem->setRelativePosition(tabSystemPos);
scrTabSystem->setRelativePosition(recti(tabSystemPos.LowerRightCorner.X + 2, 0, tabSystemPos.LowerRightCorner.X + 22, tabSystemPos.LowerRightCorner.Y));
s32 tabSystemLastY = elmTabSystemLast->getRelativePosition().LowerRightCorner.Y;
if(tabSystemLastY > tabSystemPos.LowerRightCorner.Y) {
scrTabSystem->setMax(tabSystemLastY - tabSystemPos.LowerRightCorner.Y + 5);
scrTabSystem->setPos(0);
scrTabSystem->setVisible(true);
} else
scrTabSystem->setVisible(false);
if(gameConf.resize_popup_menu) {
int width = 100 * mainGame->xScale;
int height = (mainGame->yScale >= 0.666) ? 21 * mainGame->yScale : 14;
wCmdMenu->setRelativePosition(recti(1, 1, width + 1, 1));
btnActivate->setRelativePosition(recti(1, 1, width, height));
btnSummon->setRelativePosition(recti(1, 1, width, height));
btnSPSummon->setRelativePosition(recti(1, 1, width, height));
btnMSet->setRelativePosition(recti(1, 1, width, height));
btnSSet->setRelativePosition(recti(1, 1, width, height));
btnRepos->setRelativePosition(recti(1, 1, width, height));
btnAttack->setRelativePosition(recti(1, 1, width, height));
btnActivate->setRelativePosition(recti(1, 1, width, height));
btnShowList->setRelativePosition(recti(1, 1, width, height));
btnOperation->setRelativePosition(recti(1, 1, width, height));
btnReset->setRelativePosition(recti(1, 1, width, height));
}
wCardImg->setRelativePosition(ResizeCardImgWin(1, 1, 20, 18));
imgCard->setRelativePosition(ResizeCardImgWin(10, 9, 0, 0));
wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22));
lstLog->setRelativePosition(Resize(10, 10, 290, 290));
if(showingcode)
ShowCardInfo(showingcode, 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(recti(wInfos->getRelativePosition().LowerRightCorner.X + 6, window_size.Height - 25, window_size.Width, window_size.Height));
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));
}
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) {
s32 w = x2 - x;
s32 h = y2 - y;
x = (x + w / 2) * xScale - w / 2;
y = (y + h / 2) * yScale - h / 2;
x2 = w + x;
y2 = h + y;
return recti(x, y, x2, y2);
}
recti Game::ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width) {
x = x * xScale - width / 2;
y = y * yScale;
x2 = x2 * xScale;
y2 = y2 * yScale;
return recti(x, y, x2, y2);
}
recti Game::ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 w = CARD_IMG_WIDTH * mul + mx * xScale;
s32 h = CARD_IMG_HEIGHT * mul + my * yScale;
x = x * xScale;
y = y * yScale;
return recti(x, y, x + w, y + h);
}
recti Game::ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2) {
return ResizeCardMid(x, y, x2, y2, (x + x2) * 0.5, (y + y2) * 0.5);
}
position2di Game::ResizeCardHint(s32 x, s32 y) {
return ResizeCardMid(x, y, x + CARD_IMG_WIDTH * 0.5, y + CARD_IMG_HEIGHT * 0.5);
}
recti Game::ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 cx = midx * xScale;
s32 cy = midy * yScale;
x = cx + (x - midx) * mul;
y = cy + (y - midy) * mul;
x2 = cx + (x2 - midx) * mul;
y2 = cy + (y2 - midy) * mul;
return recti(x, y, x2, y2);
}
position2di Game::ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 cx = midx * xScale;
s32 cy = midy * yScale;
x = cx + (x - midx) * mul;
y = cy + (y - midy) * mul;
return position2di(x, y);
}
recti Game::ResizeFit(s32 x, s32 y, s32 x2, s32 y2) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
x = x * mul;
y = y * mul;
x2 = x2 * mul;
y2 = y2 * mul;
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);
...@@ -1405,6 +1753,21 @@ void Game::SetWindowsIcon() { ...@@ -1405,6 +1753,21 @@ void Game::SetWindowsIcon() {
SendMessageW(hWnd, WM_SETICON, ICON_BIG, (long)hBigIcon); SendMessageW(hWnd, WM_SETICON, ICON_BIG, (long)hBigIcon);
#endif #endif
} }
void Game::SetWindowsScale(float scale) {
#ifdef _WIN32
WINDOWPLACEMENT plc;
plc.length = sizeof(WINDOWPLACEMENT);
if(GetWindowPlacement(hWnd, &plc) && (plc.showCmd == SW_SHOWMAXIMIZED))
ShowWindow(hWnd, SW_RESTORE);
RECT rcWindow, rcClient;
GetWindowRect(hWnd, &rcWindow);
GetClientRect(hWnd, &rcClient);
MoveWindow(hWnd, rcWindow.left, rcWindow.top,
(rcWindow.right - rcWindow.left) - rcClient.right + 1024 * scale,
(rcWindow.bottom - rcWindow.top) - rcClient.bottom + 640 * scale,
true);
#endif
}
void Game::FlashWindow() { void Game::FlashWindow() {
#ifdef _WIN32 #ifdef _WIN32
FLASHWINFO fi; FLASHWINFO fi;
......
...@@ -51,6 +51,10 @@ struct Config { ...@@ -51,6 +51,10 @@ struct Config {
double sound_volume; double sound_volume;
double music_volume; double music_volume;
int music_mode; int music_mode;
bool window_maximized;
int window_width;
int window_height;
bool resize_popup_menu;
}; };
struct DuelInfo { struct DuelInfo {
...@@ -120,6 +124,7 @@ public: ...@@ -120,6 +124,7 @@ public:
void CheckMutual(ClientCard* pcard, int mark); void CheckMutual(ClientCard* pcard, int mark);
void DrawCards(); void DrawCards();
void DrawCard(ClientCard* pcard); void DrawCard(ClientCard* pcard);
void DrawShadowText(irr::gui::CGUITTFont* font, const core::stringw& text, const core::rect<s32>& position, const core::rect<s32>& padding, video::SColor color = 0xffffffff, video::SColor shadowcolor = 0xff000000, bool hcenter = false, bool vcenter = false, const core::rect<s32>* clip = 0);
void DrawMisc(); void DrawMisc();
void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2); void DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2);
void DrawGUI(); void DrawGUI();
...@@ -129,11 +134,11 @@ public: ...@@ -129,11 +134,11 @@ 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();
void ShowCardInfo(int code); void ShowCardInfo(int code, bool resize = false);
void ClearCardInfo(int player = 0); void ClearCardInfo(int player = 0);
void AddChatMsg(const wchar_t* msg, int player); void AddChatMsg(const wchar_t* msg, int player);
void ClearChatMsg(); void ClearChatMsg();
...@@ -150,7 +155,22 @@ public: ...@@ -150,7 +155,22 @@ 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 ResizePhaseHint(s32 x, s32 y, s32 x2, s32 y2, s32 width);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeCardImgWin(s32 x, s32 y, s32 mx, s32 my);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2);
position2di ResizeCardHint(s32 x, s32 y);
recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy);
position2di ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy);
recti ResizeFit(s32 x, s32 y, s32 x2, s32 y2);
void SetWindowsIcon(); void SetWindowsIcon();
void SetWindowsScale(float scale);
void FlashWindow(); void FlashWindow();
void SetCursor(ECURSOR_ICON icon); void SetCursor(ECURSOR_ICON icon);
...@@ -179,6 +199,7 @@ public: ...@@ -179,6 +199,7 @@ public:
int waitFrame; int waitFrame;
int signalFrame; int signalFrame;
int actionParam; int actionParam;
int showingcode;
const wchar_t* showingtext; const wchar_t* showingtext;
int showcard; int showcard;
int showcardcode; int showcardcode;
...@@ -201,6 +222,10 @@ public: ...@@ -201,6 +222,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;
...@@ -239,6 +264,9 @@ public: ...@@ -239,6 +264,9 @@ public:
irr::gui::IGUIListBox* lstLog; irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog; irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog; irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUIWindow* tabHelper;
irr::gui::IGUIElement* elmTabHelperLast;
irr::gui::IGUIScrollBar* scrTabHelper;
irr::gui::IGUICheckBox* chkMAutoPos; irr::gui::IGUICheckBox* chkMAutoPos;
irr::gui::IGUICheckBox* chkSTAutoPos; irr::gui::IGUICheckBox* chkSTAutoPos;
irr::gui::IGUICheckBox* chkRandomPos; irr::gui::IGUICheckBox* chkRandomPos;
...@@ -246,6 +274,9 @@ public: ...@@ -246,6 +274,9 @@ public:
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation; irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkAutoSaveReplay; irr::gui::IGUICheckBox* chkAutoSaveReplay;
irr::gui::IGUIWindow* tabSystem;
irr::gui::IGUIElement* elmTabSystemLast;
irr::gui::IGUIScrollBar* scrTabSystem;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges; irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
irr::gui::IGUICheckBox* chkAutoSearch; irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkMultiKeywords; irr::gui::IGUICheckBox* chkMultiKeywords;
...@@ -255,6 +286,10 @@ public: ...@@ -255,6 +286,10 @@ public:
irr::gui::IGUIScrollBar* scrSoundVolume; irr::gui::IGUIScrollBar* scrSoundVolume;
irr::gui::IGUIScrollBar* scrMusicVolume; irr::gui::IGUIScrollBar* scrMusicVolume;
irr::gui::IGUICheckBox* chkMusicMode; irr::gui::IGUICheckBox* chkMusicMode;
irr::gui::IGUIButton* btnWinResizeS;
irr::gui::IGUIButton* btnWinResizeM;
irr::gui::IGUIButton* btnWinResizeL;
irr::gui::IGUIButton* btnWinResizeXL;
//main menu //main menu
irr::gui::IGUIWindow* wMainMenu; irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode; irr::gui::IGUIButton* btnLanMode;
...@@ -426,6 +461,17 @@ public: ...@@ -426,6 +461,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;
...@@ -623,9 +669,11 @@ extern Game* mainGame; ...@@ -623,9 +669,11 @@ extern Game* mainGame;
#define BUTTON_BOT_START 340 #define BUTTON_BOT_START 340
#define LISTBOX_BOT_LIST 341 #define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342 #define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350 #define LISTBOX_SINGLEPLAY_LIST 343
#define BUTTON_LOAD_SINGLEPLAY 351 #define BUTTON_LOAD_SINGLEPLAY 344
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 345
#define SCROLL_TAB_HELPER 350
#define SCROLL_TAB_SYSTEM 351
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372 #define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373 #define CHECKBOX_PREFER_EXPANSION 373
...@@ -633,6 +681,10 @@ extern Game* mainGame; ...@@ -633,6 +681,10 @@ extern Game* mainGame;
#define CHECKBOX_ENABLE_MUSIC 362 #define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363 #define SCROLL_VOLUME 363
#define CHECKBOX_DISABLE_CHAT 364 #define CHECKBOX_DISABLE_CHAT 364
#define BUTTON_WINDOW_RESIZE_S 365
#define BUTTON_WINDOW_RESIZE_M 366
#define BUTTON_WINDOW_RESIZE_L 367
#define BUTTON_WINDOW_RESIZE_XL 368
#define CHECKBOX_QUICK_ANIMATION 369 #define CHECKBOX_QUICK_ANIMATION 369
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
......
...@@ -6,11 +6,15 @@ namespace ygo { ...@@ -6,11 +6,15 @@ namespace ygo {
ImageManager imageManager; ImageManager imageManager;
bool ImageManager::Initial() { bool ImageManager::Initial() {
tCover[0] = driver->getTexture("textures/cover.jpg"); tCover[0] = NULL;
tCover[1] = driver->getTexture("textures/cover2.jpg"); tCover[1] = NULL;
if(!tCover[1]) tCover[2] = GetTextureFromFile("textures/cover.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tCover[1] = tCover[0]; tCover[3] = GetTextureFromFile("textures/cover2.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tUnknown = driver->getTexture("textures/unknown.jpg"); if(!tCover[3])
tCover[3] = tCover[2];
tUnknown = NULL;
tUnknownFit = NULL;
tUnknownThumb = NULL;
tAct = driver->getTexture("textures/act.png"); tAct = driver->getTexture("textures/act.png");
tAttack = driver->getTexture("textures/attack.png"); tAttack = driver->getTexture("textures/attack.png");
tChain = driver->getTexture("textures/chain.png"); tChain = driver->getTexture("textures/chain.png");
...@@ -27,17 +31,14 @@ bool ImageManager::Initial() { ...@@ -27,17 +31,14 @@ bool ImageManager::Initial() {
tHand[0] = driver->getTexture("textures/f1.jpg"); tHand[0] = driver->getTexture("textures/f1.jpg");
tHand[1] = driver->getTexture("textures/f2.jpg"); tHand[1] = driver->getTexture("textures/f2.jpg");
tHand[2] = driver->getTexture("textures/f3.jpg"); tHand[2] = driver->getTexture("textures/f3.jpg");
tBackGround = driver->getTexture("textures/bg.jpg"); tBackGround = NULL;
tBackGround_menu = driver->getTexture("textures/bg_menu.jpg"); tBackGround_menu = NULL;
if(!tBackGround_menu) tBackGround_deck = NULL;
tBackGround_menu = tBackGround;
tBackGround_deck = driver->getTexture("textures/bg_deck.jpg");
if(!tBackGround_deck)
tBackGround_deck = tBackGround;
tField[0] = driver->getTexture("textures/field2.png"); tField[0] = driver->getTexture("textures/field2.png");
tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png"); tFieldTransparent[0] = driver->getTexture("textures/field-transparent2.png");
tField[1] = driver->getTexture("textures/field3.png"); tField[1] = driver->getTexture("textures/field3.png");
tFieldTransparent[1] = driver->getTexture("textures/field-transparent3.png"); tFieldTransparent[1] = driver->getTexture("textures/field-transparent3.png");
ResizeTexture();
return true; return true;
} }
void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
...@@ -45,7 +46,11 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { ...@@ -45,7 +46,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 +58,60 @@ void ImageManager::ClearTexture() { ...@@ -53,20 +58,60 @@ 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();
tFields.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)
driver->removeTexture(tit->second);
tMap[0].erase(tit);
}
tit = tMap[1].find(code);
if(tit != tMap[1].end()) {
if(tit->second) if(tit->second)
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
tMap.erase(tit); tMap[1].erase(tit);
} }
} }
void ImageManager::ResizeTexture() {
irr::s32 imgWidth = CARD_IMG_WIDTH * mainGame->xScale;
irr::s32 imgHeight = CARD_IMG_HEIGHT * mainGame->yScale;
irr::s32 imgWidthThumb = CARD_THUMB_WIDTH * mainGame->xScale;
irr::s32 imgHeightThumb = CARD_THUMB_HEIGHT * mainGame->yScale;
float mul = (mainGame->xScale > mainGame->yScale) ? mainGame->yScale : mainGame->xScale;
irr::s32 imgWidthFit = CARD_IMG_WIDTH * mul;
irr::s32 imgHeightFit = CARD_IMG_HEIGHT * mul;
irr::s32 bgWidth = 1024 * mainGame->xScale;
irr::s32 bgHeight = 640 * mainGame->yScale;
driver->removeTexture(tCover[0]);
driver->removeTexture(tCover[1]);
tCover[0] = GetTextureFromFile("textures/cover.jpg", imgWidth, imgHeight);
tCover[1] = GetTextureFromFile("textures/cover2.jpg", imgWidth, imgHeight);
if(!tCover[1])
tCover[1] = tCover[0];
driver->removeTexture(tUnknown);
driver->removeTexture(tUnknownFit);
driver->removeTexture(tUnknownThumb);
tUnknown = GetTextureFromFile("textures/unknown.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tUnknownFit = GetTextureFromFile("textures/unknown.jpg", imgWidthFit, imgHeightFit);
tUnknownThumb = GetTextureFromFile("textures/unknown.jpg", imgWidthThumb, imgHeightThumb);
driver->removeTexture(tBackGround);
tBackGround = GetTextureFromFile("textures/bg.jpg", bgWidth, bgHeight);
driver->removeTexture(tBackGround_menu);
tBackGround_menu = GetTextureFromFile("textures/bg_menu.jpg", bgWidth, bgHeight);
if(!tBackGround_menu)
tBackGround_menu = tBackGround;
driver->removeTexture(tBackGround_deck);
tBackGround_deck = GetTextureFromFile("textures/bg_deck.jpg", bgWidth, bgHeight);
if(!tBackGround_deck)
tBackGround_deck = tBackGround;
}
// 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,57 +203,68 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3 ...@@ -158,57 +203,68 @@ 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 fit ? tUnknownFit : tUnknown;
auto tit = tMap.find(code); int width = CARD_IMG_WIDTH;
if(tit == tMap.end()) { int height = CARD_IMG_HEIGHT;
if(fit) {
float mul = mainGame->xScale;
if(mainGame->xScale > mainGame->yScale)
mul = mainGame->yScale;
width = width * mul;
height = height * mul;
}
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) ? (fit ? tUnknownFit : tUnknown) : img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
return mainGame->gameConf.use_image_scale ? tUnknown : GetTextureThumb(code); return mainGame->gameConf.use_image_scale ? (fit ? tUnknownFit : tUnknown) : GetTextureThumb(code);
} }
irr::video::ITexture* ImageManager::GetTextureThumb(int code) { irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(code == 0) if(code == 0)
return tUnknown; return tUnknownThumb;
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;
return (img == NULL) ? tUnknown : img; return (img == NULL) ? tUnknownThumb : img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
return tUnknown; return tUnknownThumb;
} }
irr::video::ITexture* ImageManager::GetTextureField(int code) { irr::video::ITexture* ImageManager::GetTextureField(int code) {
if(code == 0) if(code == 0)
...@@ -217,18 +273,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) { ...@@ -217,18 +273,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;
......
...@@ -13,18 +13,21 @@ public: ...@@ -13,18 +13,21 @@ public:
void SetDevice(irr::IrrlichtDevice* dev); void SetDevice(irr::IrrlichtDevice* dev);
void ClearTexture(); void ClearTexture();
void RemoveTexture(int code); void RemoveTexture(int code);
void ResizeTexture();
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;
irr::video::IVideoDriver* driver; irr::video::IVideoDriver* driver;
irr::video::ITexture* tCover[2]; irr::video::ITexture* tCover[4];
irr::video::ITexture* tUnknown; irr::video::ITexture* tUnknown;
irr::video::ITexture* tUnknownFit;
irr::video::ITexture* tUnknownThumb;
irr::video::ITexture* tAct; irr::video::ITexture* tAct;
irr::video::ITexture* tAttack; irr::video::ITexture* tAttack;
irr::video::ITexture* tNegated; irr::video::ITexture* tNegated;
......
...@@ -248,7 +248,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -248,7 +248,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
wchar_t textBuffer[256]; wchar_t textBuffer[256];
myswprintf(textBuffer, L"%ls\n%ls", mainGame->lstReplayList->getListItem(sel), dataManager.GetSysString(1363)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->lstReplayList->getListItem(sel), dataManager.GetSysString(1363));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
......
...@@ -767,7 +767,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -767,7 +767,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
memcpy(msgbuf, begin, len + 1); memcpy(msgbuf, begin, len + 1);
BufferIO::DecodeUTF8(msgbuf, msg); BufferIO::DecodeUTF8(msgbuf, msg);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
......
...@@ -322,6 +322,11 @@ ...@@ -322,6 +322,11 @@
!system 1279 开启音效 !system 1279 开启音效
!system 1280 开启音乐 !system 1280 开启音乐
!system 1281 按场景切换音乐 !system 1281 按场景切换音乐
!system 1282 窗口大小
!system 1283
!system 1284
!system 1285
!system 1286 特大
!system 1290 禁用聊天功能 !system 1290 禁用聊天功能
!system 1291 忽略观战者发言 !system 1291 忽略观战者发言
!system 1292 忽略时点 !system 1292 忽略时点
......
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