Merge pull request #808 from kevlahnota/master
alphabeta border & scale
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 19 KiB |
@@ -33,7 +33,7 @@ protected:
|
|||||||
/*
|
/*
|
||||||
** Tries to render the Big version of a card picture, backups to text version in case of failure
|
** 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 RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
|
||||||
static void AlternateRender(MTGCard * card, const Pos& pos);
|
static void AlternateRender(MTGCard * card, const Pos& pos);
|
||||||
@@ -55,8 +55,8 @@ public:
|
|||||||
virtual void Render();
|
virtual void Render();
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
|
|
||||||
void DrawCard(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);
|
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);
|
static JQuadPtr AlternateThumbQuad(MTGCard * card);
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public:
|
|||||||
bool exileEffects;
|
bool exileEffects;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
bool miracle;
|
bool miracle;
|
||||||
|
bool hasCopiedToken;
|
||||||
bool isBestowed;
|
bool isBestowed;
|
||||||
int chooseacolor;
|
int chooseacolor;
|
||||||
string chooseasubtype;
|
string chooseasubtype;
|
||||||
|
|||||||
@@ -1466,18 +1466,23 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
|
|||||||
|
|
||||||
int AACopier::resolve()
|
int AACopier::resolve()
|
||||||
{
|
{
|
||||||
|
bool tokencopied = false;
|
||||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
MTGCard* clone ;
|
MTGCard* clone ;
|
||||||
if(_target->isToken || _target->isACopier)
|
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
|
||||||
|
{
|
||||||
clone = _target;
|
clone = _target;
|
||||||
|
tokencopied = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
clone = MTGCollection()->getCardById(_target->copiedID);
|
clone = MTGCollection()->getCardById(_target->copiedID);
|
||||||
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
|
||||||
source->copy(myClone);
|
source->copy(myClone);
|
||||||
SAFE_DELETE(myClone);
|
SAFE_DELETE(myClone);
|
||||||
source->isACopier = true;
|
source->isACopier = true;
|
||||||
|
source->hasCopiedToken = tokencopied;
|
||||||
source->copiedID = _target->copiedID;
|
source->copiedID = _target->copiedID;
|
||||||
if(_target->isMorphed)
|
if(_target->isMorphed)
|
||||||
{
|
{
|
||||||
@@ -3880,8 +3885,8 @@ int AACloner::resolve()
|
|||||||
// Use id of the card to have the same image as the original
|
// Use id of the card to have the same image as the original
|
||||||
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId()));
|
MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId()));
|
||||||
|
|
||||||
// If its a copier then copy what it is
|
// If its a copier and copied a token then copy what it is
|
||||||
if(_target->isACopier)
|
if(_target->isACopier && _target->hasCopiedToken)
|
||||||
clone = _target;
|
clone = _target;
|
||||||
|
|
||||||
Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller();
|
Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller();
|
||||||
|
|||||||
@@ -263,11 +263,11 @@ void CardDisplay::Render()
|
|||||||
{
|
{
|
||||||
mObjects[mCurr]->Render();
|
mObjects[mCurr]->Render();
|
||||||
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
|
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
|
||||||
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
|
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.90f, 0.0, 220);
|
||||||
int drawMode = DrawMode::kNormal;
|
int drawMode = DrawMode::kNormal;//scale card display from 1.0f to 0.90f
|
||||||
if (observer)
|
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;
|
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
|
||||||
drawMode = observer->getCardSelector()->GetDrawMode();
|
drawMode = observer->getCardSelector()->GetDrawMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,17 +111,17 @@ void CardGui::Update(float dt)
|
|||||||
PlayGuiObject::Update(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)
|
switch (inMode)
|
||||||
{
|
{
|
||||||
case DrawMode::kNormal:
|
case DrawMode::kNormal:
|
||||||
RenderBig(inCard, inPosition, thumb, noborder);
|
RenderBig(inCard, inPosition, thumb, noborder, smallerscale);
|
||||||
break;
|
break;
|
||||||
case DrawMode::kText:
|
case DrawMode::kText:
|
||||||
AlternateRender(inCard, inPosition);
|
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
|
//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();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
//GameObserver * game = GameObserver::GetInstance();
|
//GameObserver * game = GameObserver::GetInstance();
|
||||||
@@ -1145,7 +1145,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
|
|||||||
if(!noborder)
|
if(!noborder)
|
||||||
{
|
{
|
||||||
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
|
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->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));
|
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")
|
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->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));
|
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
|
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->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));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
//draw inner border
|
||||||
|
if(cardsetname == "LEA"||cardsetname == "LEB")
|
||||||
|
{
|
||||||
|
if(alphabeta.get())
|
||||||
|
{
|
||||||
|
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
|
else
|
||||||
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
|
||||||
|
|
||||||
RenderCountersBig(card, pos);
|
RenderCountersBig(card, pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord
|
|||||||
{//NORMAL VIEW WITH IMAGES
|
{//NORMAL VIEW WITH IMAGES
|
||||||
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
|
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
|
||||||
float modx = addWHborder ? 2.0f:0.0f;
|
float modx = addWHborder ? 2.0f:0.0f;
|
||||||
|
bool smallerscale = modx > 0.0f ? true:false;
|
||||||
//border for editor && others???
|
//border for editor && others???
|
||||||
string cardsetname = setlist[cardPosition.card->setId].c_str();
|
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")
|
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
|
||||||
@@ -156,11 +157,19 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord
|
|||||||
}
|
}
|
||||||
else
|
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));
|
if (cardsetname == "LEA" || cardsetname == "LEB")
|
||||||
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));
|
{
|
||||||
|
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);
|
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;
|
int quadAlpha = alpha;
|
||||||
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
|
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ void MTGCardInstance::initMTGCI()
|
|||||||
myPair = NULL;
|
myPair = NULL;
|
||||||
shackled = NULL;
|
shackled = NULL;
|
||||||
miracle = false;
|
miracle = false;
|
||||||
|
hasCopiedToken = false;
|
||||||
countTrini = 0;
|
countTrini = 0;
|
||||||
imprintedCards.clear();
|
imprintedCards.clear();
|
||||||
attackCost = 0;
|
attackCost = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user