Merge pull request #836 from kevlahnota/master

re enabled token quads
This commit is contained in:
Anthony Calosa
2016-08-06 20:29:09 +08:00
committed by GitHub
5 changed files with 23 additions and 18 deletions

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, bool smallerscale = false);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool smallerscale = false, bool ingame = 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);
bool isBlackBorder(string set);
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);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = 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;

View File

@@ -132,7 +132,8 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
{
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
pos.actY = 142;//adjust y a little bit
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
bool ingame = observer?true:false;
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode(),false,false,false,ingame);
}
if (targetQuad)

View File

@@ -271,8 +271,8 @@ void CardDisplay::Render()
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
drawMode = observer->getCardSelector()->GetDrawMode();
}
cardg->DrawCard(pos, drawMode);
bool ingame = observer?true:false;
cardg->DrawCard(pos, drawMode, false, false, false,ingame);
}
}

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, bool smallerscale)
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
{
DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale);
DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale, ingame);
}
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale)
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
{
switch (inMode)
{
case DrawMode::kNormal:
RenderBig(inCard, inPosition, thumb, noborder, smallerscale);
RenderBig(inCard, inPosition, thumb, noborder, smallerscale, ingame);
break;
case DrawMode::kText:
AlternateRender(inCard, inPosition);
@@ -1135,7 +1135,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, bool smallerscale)
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder, bool smallerscale, bool ingame)
{
JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance();
@@ -1152,13 +1152,16 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
{
MTGCard * fcard = MTGCollection()->getCardByName(kcard->name);
quad = WResourceManager::Instance()->RetrieveCard(fcard);
}/*
if (kcard->hasCopiedToken && !quad.get())
}
if(ingame)
{
MTGCard * tcard = MTGCollection()->getCardById(abs(kcard->copiedID));
quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID))
: WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_NORMAL, 1, abs(kcard->copiedID));
}*///temporary disabled this so it will not crash, this must be called when ingame -kevlahnota
if (kcard->hasCopiedToken && kcard->getObserver() && !quad.get())
{
MTGCard * tcard = MTGCollection()->getCardById(abs(kcard->copiedID));
quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID))
: WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_NORMAL, 1, abs(kcard->copiedID));
}
}
if (quad.get())
{
if (quad->mHeight < quad->mWidth)

View File

@@ -344,7 +344,8 @@ void CardSelector::Render()
float modx = 14.f;
Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha);
//render card
card->DrawCard(npos, mDrawMode);
bool ingame = observer?true:false;
card->DrawCard(npos, mDrawMode, false, false, false,ingame);
}
}
}