Merge pull request #950 from kevlahnota/master

Swap zones - exile and library for opponent
This commit is contained in:
Anthony Calosa
2017-03-04 05:42:34 +08:00
committed by GitHub
9 changed files with 66 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -343,7 +343,7 @@ void CardSelector::Render()
//card->DrawCard(bigpos, mDrawMode);
if(timer > 0)
{
float modx = 14.f;
float modx = 0.f;
Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha);
card->DrawCard(npos, mDrawMode);
}

View File

@@ -20,17 +20,17 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;
//opponentExile
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
Add(opponentExile = NEW GuiExile(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentHand
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
Add(opponentLibrary = NEW GuiLibrary(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self);
observer->getCardSelector()->Add(selfGraveyard);
@@ -149,7 +149,7 @@ void GuiAvatars::Render()
float h = 54;
if (opponent == active)
{
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+20 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+25 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0));
}
else if (self == active)

View File

@@ -86,7 +86,10 @@ void GuiHandOpponent::Render()
(*it)->y = 2;
(*it)->zoom = 0.3f;
(*it)->Render(quad.get());
x += 18;
if(cards.size() > 12)
x += 240/cards.size();
else
x += 18;
}
}

View File

@@ -123,6 +123,8 @@ void GuiPlay::BattleField::reset(float x, float y)
}
void GuiPlay::BattleField::EnstackAttacker(CardView* card)
{
if(card->card->getObserver() && card->card->getObserver()->getCurrentGamePhase() == MTG_PHASE_COMBATDAMAGE)
return;
//card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1));
card->x = x + (CARD_WIDTH/2.5f) + baseX;
if (attackers+1 < 8)
@@ -138,6 +140,8 @@ void GuiPlay::BattleField::EnstackAttacker(CardView* card)
}
void GuiPlay::BattleField::EnstackBlocker(CardView* card)
{
if(card->card->getObserver() && card->card->getObserver()->getCurrentGamePhase() == MTG_PHASE_COMBATDAMAGE)
return;
MTGCardInstance * c = card->card;
if (!c)
return;

View File

@@ -196,9 +196,12 @@ void GuiGameZone::Render()
{
//Texture
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
JQuadPtr overlay;
float scale = defaultHeight / quad->mHeight;
float scale2 = scale;
float modx = 0;
float mody = 0;
bool replaced = false;
bool showtop = (zone && zone->owner->game->battlefield->nb_cards && zone->owner->game->battlefield->hasAbility(Constants::SHOWFROMTOPLIBRARY))?true:false;
bool showopponenttop = (zone && zone->owner->opponent()->game->battlefield->nb_cards && zone->owner->opponent()->game->battlefield->hasAbility(Constants::SHOWOPPONENTTOPLIBRARY))?true:false;
@@ -208,6 +211,46 @@ void GuiGameZone::Render()
{
quad->SetColor(ARGB((int)(actA),255,240,255));
}
//overlay
JQuadPtr iconcard = WResourceManager::Instance()->RetrieveTempQuad("iconcard.png");
JQuadPtr iconhand = WResourceManager::Instance()->RetrieveTempQuad("iconhand.png");
JQuadPtr iconlibrary = WResourceManager::Instance()->RetrieveTempQuad("iconlibrary.png");
JQuadPtr iconexile = WResourceManager::Instance()->RetrieveTempQuad("iconexile.png");
if(iconlibrary && type == GUI_LIBRARY)
{
scale2 = defaultHeight / iconlibrary->mHeight;
modx = -0.f;
mody = -2.f;
iconlibrary->SetColor(ARGB((int)(actA),255,255,255));
quad = iconlibrary;
}
if(iconhand && type == GUI_OPPONENTHAND)
{
scale2 = defaultHeight / iconhand->mHeight;
modx = -0.f;
mody = -2.f;
iconhand->SetColor(ARGB((int)(actA),255,255,255));
quad = iconhand;
}
if(iconcard && type == GUI_GRAVEYARD)
{
scale2 = defaultHeight / iconcard->mHeight;
modx = -0.f;
mody = -2.f;
iconcard->SetColor(ARGB((int)(actA),255,255,255));
quad = iconcard;
}
if(iconexile && type == GUI_EXILE)
{
scale2 = defaultHeight / iconexile->mHeight;
modx = -0.f;
mody = -2.f;
iconexile->SetColor(ARGB((int)(actA),255,255,255));
quad = iconexile;
}
//
if(type == GUI_LIBRARY && zone->nb_cards && !showCards)
{
@@ -227,7 +270,7 @@ void GuiGameZone::Render()
if(kquad)
{
kquad->SetColor(ARGB((int)(actA),255,255,255));
scale = defaultHeight / kquad->mHeight;
scale2 = defaultHeight / kquad->mHeight;
modx = (35/4)+1;
mody = (50/4)+1;
quad = kquad;
@@ -238,7 +281,7 @@ void GuiGameZone::Render()
if(quad)
{
quad->SetColor(ARGB((int)(actA),255,255,255));
scale = defaultHeight / quad->mHeight;
scale2 = defaultHeight / quad->mHeight;
modx = (35/4)+1;
mody = (50/4)+1;
}
@@ -250,7 +293,9 @@ void GuiGameZone::Render()
//render small card quad
if(quad)
JRenderer::GetInstance()->RenderQuad(quad.get(), actX+modx, actY+mody, 0.0, scale * actZ, scale * actZ);
JRenderer::GetInstance()->RenderQuad(quad.get(), actX+modx, actY+mody, 0.0, scale2 * actZ, scale2 * actZ);
/*if(overlay)
JRenderer::GetInstance()->RenderQuad(overlay.get(), actX, actY, 0.0, scale2 * actZ, scale2 * actZ);*/
float x0 = actX;
if (x0 < SCREEN_WIDTH / 2)
@@ -261,7 +306,7 @@ void GuiGameZone::Render()
if (mHasFocus)
{
if(!replaced)
JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale * actZ, quad->mHeight * scale * actZ,
JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale2 * actZ, quad->mHeight * scale2 * actZ,
ARGB(abs(128 - wave),255,255,255));
}
@@ -279,14 +324,14 @@ void GuiGameZone::Render()
else if(type == GUI_EXILE)
sprintf(buffer, "%i\ne", zone->nb_cards);
else*/
sprintf(buffer, "%i", zone->nb_cards);
sprintf(buffer, "%i", zone->nb_cards);
mFont->SetColor(ARGB(mAlpha,0,0,0));
mFont->DrawString(buffer, x0 + 1, actY + 1);
if (actA > 120)
mAlpha = 255;
mFont->SetColor(ARGB(mAlpha,255,255,255));
mFont->DrawString(buffer, x0, actY);
//show top library - big card display
if(type == GUI_LIBRARY && mHasFocus && zone->nb_cards && !showCards && replaced)
{