From 9a66b0c6e4dfc7ced5c194cdd95f6e5b8317854f Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 13 Oct 2015 19:27:25 +0800 Subject: [PATCH] some fix and polished static mana and action stack I moved the target quad near the source card and moved the action string forward so there is no overlapping of action string and the target quad if the action string is too long... --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 5 ++- projects/mtg/src/ActionStack.cpp | 41 ++++++++++++-------- projects/mtg/src/GuiCombat.cpp | 2 +- projects/mtg/src/GuiMana.cpp | 8 ++-- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index d5701472c..9531c0e06 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -8140,7 +8140,7 @@ toughness=2 [/card] [card] name=Battleflight Eagle -auto=target(creature|battlefield) 2/2 ueot && flying ueot +auto=target(creature|battlefield) transforms((,newability[2/2],newability[flying])) ueot abilities=flying text=Flying -- When Battleflight Eagle enters the battlefield, target creature gets +2/+2 and gains flying until end of turn. mana={4}{W} @@ -37095,6 +37095,7 @@ toughness=3 [/card] [card] name=Fylgja +target=creature auto=all(this) counter(0/0,4,Healing) auto={C(0/0,-1,Healing)}:prevent:1 auto={2}{W}:all(this) counter(0/0,1,Healing) @@ -45155,7 +45156,7 @@ toughness=5 [/card] [card] name=Hellkite Hatchling -auto=may target(other creature|mybattlefield) sacrifice && counter(1/1,1) all(this) && all(this) transforms((,flying,trample)) forever +auto=may target(other creature|mybattlefield) sacrifice && counter(1/1,1) all(this) && all(this) transforms((,newability[flying],newability[trample])) forever text=Devour 1 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with that many +1/+1 counters on it.) -- Hellkite Hatchling has flying and trample if it devoured a creature. mana={2}{R}{G} type=Creature diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index d6e59cf9a..5fd4c6f3c 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -93,22 +93,27 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); + JRenderer * renderer = JRenderer::GetInstance(); if (!targetQuad) { - if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) - mFont->DrawString("You play:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) + mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) - mFont->DrawString("Opponent plays:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/ mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); - //mFont->DrawString(">>>", x + 35, y+5 + GetVerticalTextOffset(), JGETEXT_LEFT); } else { + renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10)); + /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI()) + renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0)); + else + renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,255,0,0));*/ mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString(_(action).c_str(), x + 75, y + GetVerticalTextOffset(), JGETEXT_LEFT); } - JRenderer * renderer = JRenderer::GetInstance(); + JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) quad = CardGui::AlternateThumbQuad(source); @@ -1235,10 +1240,14 @@ void ActionStack::Render() //stack shadow //renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0)); //stack fill - renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(215,10,10,10)); + renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(225,5,5,5)); + //stack highlight + renderer->FillRect(x0 - 6, y0+3, width + 15, 30, ARGB(255,89,89,89)); + //another border + renderer->DrawRect(x0 - 6, y0+33, width + 15, height - 18, ARGB(255,89,89,89)); //stack border - renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(180,240,240,240)); - + renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(255,240,240,240)); + std::ostringstream stream; // WALDORF - changed "interrupt ?" to "Interrupt?". Don't display count down // seconds if the user disables auto progressing interrupts by setting the seconds @@ -1251,11 +1260,11 @@ void ActionStack::Render() else stream << _(kInterruptMessageString) << " " << static_cast(timer); - mFont->DrawString(stream.str(), x0 + 5, currenty); + mFont->DrawString(stream.str(), x0 + 5, currenty - 2); // static const float kIconVerticalOffset = 24; static const float kIconHorizontalOffset = 10; - static const float kBeforeIconSpace = 10; + static const float kBeforeIconSpace = 12; //Render "interrupt?" text + possible actions { @@ -1264,25 +1273,25 @@ void ActionStack::Render() if (gModRules.game.canInterrupt()) { - renderer->RenderQuad(pspIcons[7].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[7].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kInterruptString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kInterruptString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kInterruptString).c_str()) + kBeforeIconSpace; } noBtnXOffset = static_cast(currentx); - renderer->RenderQuad(pspIcons[4].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[4].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kNoString).c_str()) + kBeforeIconSpace; noToAllBtnXOffset = static_cast(currentx); if (mObjects.size() > 1) { - renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kNoToAllString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kNoToAllString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kNoToAllString).c_str()) + kBeforeIconSpace; } diff --git a/projects/mtg/src/GuiCombat.cpp b/projects/mtg/src/GuiCombat.cpp index 2e367ce28..ad9a05a98 100644 --- a/projects/mtg/src/GuiCombat.cpp +++ b/projects/mtg/src/GuiCombat.cpp @@ -504,7 +504,7 @@ void GuiCombat::Render() ok_quad->SetHotSpot(28, 22); ok.Render(ok_quad.get()); } - renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0)); + renderer->DrawLine(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2, ARGB(255, 255, 64, 0)); if (FIRST_STRIKE == step) { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); diff --git a/projects/mtg/src/GuiMana.cpp b/projects/mtg/src/GuiMana.cpp index c4ca3d257..e5ab1145c 100644 --- a/projects/mtg/src/GuiMana.cpp +++ b/projects/mtg/src/GuiMana.cpp @@ -262,7 +262,7 @@ void GuiMana::RenderStatic() float x0 = x - 20 * totalColors; x0 = max(40.f, x0); float xEnd = x0 + 20 * totalColors; - r->FillRoundRect(x0, y - 5, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,0,0,0)); + r->FillRoundRect(x0, y - 8, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,0,0,0)); int offset = 0; for (int i = 0; i < Constants::NB_Colors; ++i) @@ -270,10 +270,10 @@ void GuiMana::RenderStatic() if (values[i]) { offset -= 20; - r->RenderQuad(manaIcons[i].get(), xEnd + 15 + offset, y + 5, 0, 0.7f, 0.7f); + r->RenderQuad(manaIcons[i].get(), xEnd + 15 + offset, y + 3, 0, 0.65f, 0.65f); } } - r->FillRoundRect(x0, y, static_cast (20 * totalColors + 5), 8, 2, ARGB(100,0,0,0)); + //r->DrawRoundRect(x0, y - 8, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,255,255,255)); offset = 0; for (int i = 0; i < Constants::NB_Colors; ++i) { @@ -283,7 +283,7 @@ void GuiMana::RenderStatic() char buf[4]; sprintf(buf, "%i", values[i]); mFont->SetColor(ARGB(255,255,255,255)); - mFont->DrawString(buf, xEnd + offset + 9, y); + mFont->DrawString(buf, xEnd + offset + 18, y + 5); } } }