diff --git a/projects/mtg/include/CardGui.h b/projects/mtg/include/CardGui.h index 7a8bca284..0060d79db 100644 --- a/projects/mtg/include/CardGui.h +++ b/projects/mtg/include/CardGui.h @@ -57,7 +57,7 @@ public: void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); - + static void DrawBorder(string setname, const Pos& inPosition, float x, bool noborder = false, bool smallscale = false); static JQuadPtr AlternateThumbQuad(MTGCard * card); virtual ostream& toString(ostream&) const; }; diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 7dc7e14d7..aecf87ddc 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -130,25 +130,9 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string if (bigQuad) { - //Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); - Pos npos = Pos(CardGui::BigWidth / 2 + 8.f, CardGui::BigHeight / 2 - 2.f, 1.0f - (1.0f/10), 0.0, 220); - //border - if(observer->getCardSelector()->GetDrawMode() < 2) - { - string cardsetname = setlist[source->setId].c_str(); - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } - //render card - CardGui::DrawCard(source, npos, observer->getCardSelector()->GetDrawMode(),false,true); + Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.90f, 0.0, 220); + pos.actY = 142;//adjust y a little bit + CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode()); } if (targetQuad) diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index d0021a34b..b9b17ee3c 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -1122,10 +1122,10 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder // card = (MTGCard*)game->mLayers->actionLayer()->currentActionCard; //i want this but ai targets cards so quickly that it can crash the game. float x = pos.actX; - + //init setname + string cardsetname = setlist[card->setId].c_str(); JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB) : WResourceManager::Instance()->RetrieveCard(card); - JQuadPtr alphabeta = WResourceManager::Instance()->RetrieveTempQuad("alphabeta.png"); MTGCardInstance * kcard = dynamic_cast(card); if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name) { @@ -1140,43 +1140,10 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder } quad->SetColor(ARGB(255,255,255,255)); float scale = pos.actZ * 250.f / quad->mHeight; - //init setname - string cardsetname = setlist[card->setId].c_str(); - if(!noborder) - { - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - {//Draw white border - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - if(cardsetname == "LEA"||cardsetname == "LEB") - { - //force smaller scale - smallerscale = true; - //Draw more rounder black border - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(255,5,5,5)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(50,240,240,240)); - } - else - {//draw black border - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } - } - //draw inner border - if(cardsetname == "LEA"||cardsetname == "LEB") - { - if(alphabeta.get()) - { - alphabeta->SetHotSpot(static_cast (alphabeta->mWidth / 2), static_cast (alphabeta->mHeight / 2)); - float myscale = pos.actZ * 250 / alphabeta->mHeight; - alphabeta->SetColor(ARGB((int)pos.actA,255,255,255)); - renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale); - } - } + //Draw border + DrawBorder(cardsetname, pos, x, noborder, smallerscale); + //force smaller scale on alpha beta + smallerscale = cardsetname=="LEA"||cardsetname=="LEB"?true:smallerscale; //Draw card if(smallerscale) renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.01f, scale-0.01f); @@ -1192,6 +1159,46 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder AlternateRender(card, pos); } +void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool noborder, bool smallerscale) +{ + JRenderer * renderer = JRenderer::GetInstance(); + JQuadPtr alphabeta = WResourceManager::Instance()->RetrieveTempQuad("alphabeta.png"); + + if(!noborder) + { + if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") + {//Draw white border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); + } + else + { + if(cardsetname == "LEA") + {//BETA HAS REGULAR BORDER + //Draw more rounder black border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(255,5,5,5)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(50,240,240,240)); + } + else + {//draw black border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); + } + } + } + //draw inner border + if(cardsetname == "LEA"||cardsetname == "LEB") + { + if(alphabeta.get()) + { + alphabeta->SetHotSpot(static_cast (alphabeta->mWidth / 2), static_cast (alphabeta->mHeight / 2)); + float myscale = pos.actZ * 250 / alphabeta->mHeight; + alphabeta->SetColor(ARGB((int)pos.actA,255,255,255)); + renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale); + } + } +} + string CardGui::FormattedData(string data, string replace, string value) { size_t found = data.find(replace.c_str()); diff --git a/projects/mtg/src/CardSelector.cpp b/projects/mtg/src/CardSelector.cpp index 0e478f288..cb698d7a6 100644 --- a/projects/mtg/src/CardSelector.cpp +++ b/projects/mtg/src/CardSelector.cpp @@ -341,28 +341,9 @@ void CardSelector::Render() { if(timer > 0) { - float modx = 0.f; - //if(card->mHasFocus && observer->isInHand(card->getCard()) && !card->getCard()->owner->isAI()) - //modx -= 1.8f;//todo small adjustment - //new npos for smaller bigquad - Pos npos = Pos(bigpos.x+7.f+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/10),bigpos.t,bigpos.alpha); - //border - if(mDrawMode < 2) - { - string cardsetname = setlist[card->getCard()->setId].c_str(); - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } + Pos npos = Pos(bigpos.x+7.f,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/10),bigpos.t,bigpos.alpha); //render card - card->DrawCard(npos, mDrawMode, false, true); + card->DrawCard(npos, mDrawMode); } } } diff --git a/projects/mtg/src/DeckView.cpp b/projects/mtg/src/DeckView.cpp index 18e6247b3..9fbdb8c21 100644 --- a/projects/mtg/src/DeckView.cpp +++ b/projects/mtg/src/DeckView.cpp @@ -148,7 +148,7 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText; float modx = addWHborder ? 2.0f:0.0f; bool smallerscale = modx > 0.0f ? true:false; - //border for editor && others??? + //border for editor && others since the border in cardgui:drawcard scales larger... string cardsetname = setlist[cardPosition.card->setId].c_str(); if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") { @@ -157,7 +157,7 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord } else { - if (cardsetname == "LEA" || cardsetname == "LEB") + if (cardsetname == "LEA") { JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 96.75f)-(7.f+modx),(cardPosition.y - cardPosition.scale * 139.25f)-(7.f+modx),cardPosition.scale * 193.5f,cardPosition.scale * 278.5f,7.f+modx,ARGB(255,10,10,10)); JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 96.75f)-(7.f+modx),(cardPosition.y - cardPosition.scale * 139.25f)-(7.f+modx),cardPosition.scale * 193.5f,cardPosition.scale * 278.5f,7.f+modx,ARGB(50,240,240,240));