Merge pull request #808 from kevlahnota/master

alphabeta border & scale
This commit is contained in:
Anthony Calosa
2016-07-29 18:40:38 +08:00
committed by GitHub
8 changed files with 53 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -33,7 +33,7 @@ protected:
/*
** Tries to render the Big version of a card picture, backups to text version in case of failure
*/
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool smallerscale = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render();
virtual void Update(float dt);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false);
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 JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const;

View File

@@ -98,6 +98,7 @@ public:
bool exileEffects;
bool suspended;
bool miracle;
bool hasCopiedToken;
bool isBestowed;
int chooseacolor;
string chooseasubtype;

View File

@@ -1466,18 +1466,23 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
int AACopier::resolve()
{
bool tokencopied = false;
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
MTGCard* clone ;
if(_target->isToken || _target->isACopier)
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
{
clone = _target;
tokencopied = true;
}
else
clone = MTGCollection()->getCardById(_target->copiedID);
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
source->copy(myClone);
SAFE_DELETE(myClone);
source->isACopier = true;
source->hasCopiedToken = tokencopied;
source->copiedID = _target->copiedID;
if(_target->isMorphed)
{
@@ -3880,8 +3885,8 @@ int AACloner::resolve()
// Use id of the card to have the same image as the original
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId()));
// If its a copier then copy what it is
if(_target->isACopier)
// If its a copier and copied a token then copy what it is
if(_target->isACopier && _target->hasCopiedToken)
clone = _target;
Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller();

View File

@@ -263,11 +263,11 @@ void CardDisplay::Render()
{
mObjects[mCurr]->Render();
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
int drawMode = DrawMode::kNormal;
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.90f, 0.0, 220);
int drawMode = DrawMode::kNormal;//scale card display from 1.0f to 0.90f
if (observer)
{
pos.actY = 145;
pos.actY = 142;//reduce y a little
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
drawMode = observer->getCardSelector()->GetDrawMode();
}

View File

@@ -111,17 +111,17 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(dt);
}
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder)
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale)
{
DrawCard(card, inPosition, inMode, thumb, noborder);
DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale);
}
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder)
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale)
{
switch (inMode)
{
case DrawMode::kNormal:
RenderBig(inCard, inPosition, thumb, noborder);
RenderBig(inCard, inPosition, thumb, noborder, smallerscale);
break;
case DrawMode::kText:
AlternateRender(inCard, inPosition);
@@ -1114,7 +1114,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
}
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder)
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder, bool smallerscale)
{
JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance();
@@ -1145,7 +1145,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
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));
}
@@ -1153,27 +1153,35 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
{
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())
renderer->RenderQuad(alphabeta.get(),(pos.actX - (pos.actZ * 100.f))+12.f,(pos.actY - (pos.actZ * 142.5f))+17.5f, pos.actT, 0.88f, 0.88f);
{
alphabeta->SetHotSpot(static_cast<float> (alphabeta->mWidth / 2), static_cast<float> (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 card
if(smallerscale)
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.01f, scale-0.01f);
}
else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
}
else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
RenderCountersBig(card, pos);
return;
}

View File

@@ -147,6 +147,7 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord
{//NORMAL VIEW WITH IMAGES
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???
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")
@@ -155,12 +156,20 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(150,20,20,20));
}
else
{
if (cardsetname == "LEA" || cardsetname == "LEB")
{
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));
}
else
{
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(255,10,10,10));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(50,240,240,240));
}
}
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true);
CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true, smallerscale);
}
int quadAlpha = alpha;
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;

View File

@@ -227,6 +227,7 @@ void MTGCardInstance::initMTGCI()
myPair = NULL;
shackled = NULL;
miracle = false;
hasCopiedToken = false;
countTrini = 0;
imprintedCards.clear();
attackCost = 0;