Merge pull request #641 from kevlahnota/master

Fix crash bug, support doubled res texture for background, avatars, menutitle
This commit is contained in:
Anthony Calosa
2015-10-12 06:46:53 +08:00
25 changed files with 109 additions and 87 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB

+1 -1
View File
@@ -22,7 +22,7 @@ private:
InOutQuadEasing zoomFactorEasing; InOutQuadEasing zoomFactorEasing;
DuelLayers* mpDuelLayers; DuelLayers* mpDuelLayers;
void DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale); void DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale, float z);
public: public:
GuiPhaseBar(DuelLayers* duelLayers); GuiPhaseBar(DuelLayers* duelLayers);
~GuiPhaseBar(); ~GuiPhaseBar();
+3 -3
View File
@@ -1220,11 +1220,11 @@ void ActionStack::Render()
JRenderer * renderer = JRenderer::GetInstance(); JRenderer * renderer = JRenderer::GetInstance();
//stack shadow //stack shadow
renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0)); //renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0));
//stack fill //stack fill
renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(200,10,10,10)); renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(215,10,10,10));
//stack border //stack border
renderer->DrawRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(160,240,240,240)); renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(180,240,240,240));
std::ostringstream stream; std::ostringstream stream;
// WALDORF - changed "interrupt ?" to "Interrupt?". Don't display count down // WALDORF - changed "interrupt ?" to "Interrupt?". Don't display count down
+46 -48
View File
@@ -237,29 +237,30 @@ void CardGui::Render()
if (quad) if (quad)
{ {
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255)); quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
//static border
/*if(card->isTapped())
{
//focus?
CardView* cv = dynamic_cast<CardView*>(card->view);
if(cv->mHasFocus)
renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-9.0f,actY - (scale * quad->mHeight / 2)+7, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.0f,ARGB(250,20,20,20));
else
renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-7,actY - (scale * quad->mHeight / 2)+5.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.0f,ARGB(250,20,20,20));
}
else
{
renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-1,actY - (scale * quad->mHeight / 2)-1, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.0f,ARGB(250,20,20,20));
}*///the border needs animation when the card rotates...but how?
//fake border... //fake border...
JQuadPtr fakeborder; JQuadPtr fakeborder;
JQuadPtr highlightborder;
fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white"); fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if(fakeborder) if(fakeborder)
{ {
fakeborder->SetColor(ARGB((int)(actA),15,15,15)); fakeborder->SetColor(ARGB((int)(actA),15,15,15));
renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16); renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16);
} }
//draw border for highlighting
if (game)
{
if (card && card->isTargetted() && highlightborder)
{
highlightborder->SetColor(ARGB(95,255,0,0));
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
if (card && card->isTargetter() && highlightborder)
{
highlightborder->SetColor(ARGB(95,0,245,0));
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
}
//draw the card image //draw the card image
renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale); renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale);
} }
@@ -301,38 +302,33 @@ void CardGui::Render()
} }
} }
//draw border?line //draw line
if (card && card->isTargetted()) if (game)
{ {
if(card->isTapped()) if (card && card->isTargetted())
{ {
//focus? if(card->isTapped())
CardView* cv = dynamic_cast<CardView*>(card->view); {
if(cv->mHasFocus) if(mHasFocus)
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0));
else
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0));
}
else else
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,255,0,0));
} }
else if (card && card->isTargetter())
{ {
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,255,0,0)); if(card->isTapped())
} {
} if(mHasFocus)
if (card && card->isTargetter()) renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0));
{ else
if(card->isTapped()) renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0));
{ }
//focus?
CardView* cv = dynamic_cast<CardView*>(card->view);
if(cv->mHasFocus)
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0));
else else
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,0,255,0));
} }
else
{
renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,0,255,0));
}
} }
//draws the numbers power/toughness //draws the numbers power/toughness
@@ -341,8 +337,10 @@ void CardGui::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200]; char buffer[200];
sprintf(buffer, "%i/%i", card->power, card->life); sprintf(buffer, "%i/%i", card->power, card->life);
renderer->FillRect(actX - (12 * actZ), actY + 6 * actZ, 25 * actZ, 12 * actZ, renderer->FillRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ,
ARGB(((static_cast<unsigned char>(actA))/2),0,0,0)); ARGB(((static_cast<unsigned char>(actA))/2),0,0,0));
renderer->DrawRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ,
ARGB(((static_cast<unsigned char>(actA))),20,20,20));
//damaged or buffed or powered down //damaged or buffed or powered down
if(card->wasDealtDamage && card->life <= 2) if(card->wasDealtDamage && card->life <= 2)
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,0,0));//red critical and damaged mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,0,0));//red critical and damaged
@@ -356,7 +354,7 @@ void CardGui::Render()
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default
mFont->SetScale(actZ); mFont->SetScale(actZ);
mFont->SetScale(actZ); mFont->SetScale(actZ);
mFont->DrawString(buffer, actX - 10 * actZ, actY + 8 * actZ); mFont->DrawString(buffer, actX - 10 * actZ, actY + 7 * actZ);
mFont->SetScale(1); mFont->SetScale(1);
} }
@@ -1078,19 +1076,19 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR") if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR")
{ {
//like white border //like white border
renderer->FillRoundRect(x-92,pos.actY-128, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,248,248,255)); renderer->FillRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,248,248,255));
//black thin line to simulate card edge //black thin line to simulate card edge
renderer->DrawRoundRect(x-92,pos.actY-128, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(150,20,20,20)); renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(150,20,20,20));
} }
else else
{ {
//like black border //like black border
renderer->FillRoundRect(x-92,pos.actY-128, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,10,10,10)); renderer->FillRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,10,10,10));
//white thin line to simulate card edge //white thin line to simulate card edge
renderer->DrawRoundRect(x-92,pos.actY-128, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(50,240,240,240)); renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(50,240,240,240));
} }
//render card image //render card image
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.02f, scale-0.02f); renderer->RenderQuad(quad.get(), x, pos.actY-2, pos.actT, scale-0.02f, scale-0.02f);
} }
else else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale); renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
+2
View File
@@ -276,6 +276,8 @@ void DeckMenu::Render()
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR); JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR);
if(quad.get()) if(quad.get())
{ {
quad->mWidth = 35.f;
quad->mHeight = 50.f;
if (currentMenuItem->getText() == "Evil Twin") if (currentMenuItem->getText() == "Evil Twin")
{ {
JQuad * evil = quad.get(); JQuad * evil = quad.get();
+1
View File
@@ -173,6 +173,7 @@ void GameApp::Create()
LOG("Loading Textures"); LOG("Loading Textures");
LOG("--Loading menuicons.png"); LOG("--Loading menuicons.png");
WResourceManager::Instance()->RetrieveTexture("menuicons.png", RETRIEVE_MANAGE); WResourceManager::Instance()->RetrieveTexture("menuicons.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("miconslarge.png", RETRIEVE_MANAGE);
LOG("---Gettings menuicons.png quads"); LOG("---Gettings menuicons.png quads");
//Load all icons from gModRules and save in manaIcons -> todo. Change the icons positions on menuicons.png to avoid use item->mColorId //Load all icons from gModRules and save in manaIcons -> todo. Change the icons positions on menuicons.png to avoid use item->mColorId
+9 -5
View File
@@ -85,10 +85,14 @@ void GameStateMenu::Create()
{ {
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
{ {
sprintf(buf, "menuicons%d%d", i, j); sprintf(buf, "miconslarge%d%d", i, j);
mIcons[n] = WResourceManager::Instance()->RetrieveQuad("menuicons.png", 2 + i * 36.0f, 2.0f + j * 36.0f, 32.0f, 32.0f, buf); mIcons[n] = WResourceManager::Instance()->RetrieveQuad("miconslarge.png", 4 + i * 72.0f, 4.0f + j * 72.0f, 72.0f, 72.0f, buf);
if (mIcons[n]) if (mIcons[n])
{
mIcons[n]->mHeight = 36.f;
mIcons[n]->mWidth = 36.f;
mIcons[n]->SetHotSpot(16, 16); mIcons[n]->SetHotSpot(16, 16);
}
n++; n++;
} }
} }
@@ -141,10 +145,10 @@ void GameStateMenu::Start()
WResourceManager::Instance()->ClearUnlocked(); WResourceManager::Instance()->ClearUnlocked();
bgTexture = WResourceManager::Instance()->RetrieveTexture("menutitle.png", RETRIEVE_LOCK); bgTexture = WResourceManager::Instance()->RetrieveTexture("menutitle.png", RETRIEVE_LOCK);
mBg = WResourceManager::Instance()->RetrieveQuad("menutitle.png", 0, 0, 256, 166); // Create background quad for rendering. mBg = WResourceManager::Instance()->RetrieveQuad("menutitle.png", 0, 0, 0, 0); // Create background quad for rendering.
if (mBg) if (mBg)
mBg->SetHotSpot(128, 50); mBg->SetHotSpot(0, 0);
if (MENU_STATE_MAJOR_MAINMENU == currentState) if (MENU_STATE_MAJOR_MAINMENU == currentState)
currentState = currentState | MENU_STATE_MINOR_FADEIN; currentState = currentState | MENU_STATE_MINOR_FADEIN;
@@ -790,7 +794,7 @@ void GameStateMenu::Render()
scroller->Render(); scroller->Render();
if (mBg.get()) if (mBg.get())
renderer->RenderQuad(mBg.get(), SCREEN_WIDTH / 2, 50); renderer->RenderQuad(mBg.get(), (SCREEN_WIDTH/4)-6, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight);
RenderTopMenu(); RenderTopMenu();
+3 -1
View File
@@ -30,6 +30,8 @@ void GuiBackground::Render()
} }
if (quad.get()) if (quad.get())
{ {
renderer->RenderQuad(quad.get(), 0, 18); quad->mWidth = 480.f;
quad->mHeight = 272.f;
renderer->RenderQuad(quad.get(), 0, 0);
} }
} }
+2
View File
@@ -483,6 +483,8 @@ void GuiCombat::Render()
} }
else else
{ {
observer->opponent()->getIcon()->mHeight = 50.f;
observer->opponent()->getIcon()->mWidth = 35.f;
observer->opponent()->getIcon()->SetHotSpot(18, 25); observer->opponent()->getIcon()->SetHotSpot(18, 25);
enemy_avatar.Render(observer->opponent()->getIcon().get()); enemy_avatar.Render(observer->opponent()->getIcon().get());
} }
+19 -15
View File
@@ -6,16 +6,20 @@
GuiFrame::GuiFrame(GameObserver* observer) GuiFrame::GuiFrame(GameObserver* observer)
: GuiLayer(observer) : GuiLayer(observer)
{ {
if (observer->getResourceManager()) //if (observer->getResourceManager())
{ //{
if (observer->getResourceManager()->GetTexture("wood.png")) /*if (observer->getResourceManager()->GetTexture("wood.png"))
wood = observer->getResourceManager()->RetrieveQuad("wood.png", 0, 0, SCREEN_WIDTH, 28); {
wood = observer->getResourceManager()->RetrieveQuad("wood.png", 0, 0, 0, 0);
wood->mHeight = 32.f;
wood->mWidth = 480.f;
}
else else
{ {
GameApp::systemError += "Can't load wood texture : " __FILE__ "\n"; GameApp::systemError += "Can't load wood texture : " __FILE__ "\n";
} }*/
if (observer->getResourceManager()->GetTexture("gold.png")) /*if (observer->getResourceManager()->GetTexture("gold.png"))
{ {
gold1 = observer->getResourceManager()->RetrieveQuad("gold.png", 0, 0, SCREEN_WIDTH, 6, "gold1"); gold1 = observer->getResourceManager()->RetrieveQuad("gold.png", 0, 0, SCREEN_WIDTH, 6, "gold1");
gold2 = observer->getResourceManager()->RetrieveQuad("gold.png", 0, 6, SCREEN_WIDTH, 6, "gold2"); gold2 = observer->getResourceManager()->RetrieveQuad("gold.png", 0, 6, SCREEN_WIDTH, 6, "gold2");
@@ -26,9 +30,9 @@ GuiFrame::GuiFrame(GameObserver* observer)
gold2->SetColor(ARGB(127, 255, 255, 255)); gold2->SetColor(ARGB(127, 255, 255, 255));
gold2->SetHFlip(true); gold2->SetHFlip(true);
} }
} }*/
} //}
step = 0.0; //step = 0.0;
} }
@@ -38,12 +42,12 @@ GuiFrame::~GuiFrame()
void GuiFrame::Render() void GuiFrame::Render()
{ {
JRenderer* renderer = JRenderer::GetInstance(); /*JRenderer* renderer = JRenderer::GetInstance();
float sized = step / 4; float sized = step / 4;
if (sized > SCREEN_WIDTH) if (sized > SCREEN_WIDTH)
sized -= SCREEN_WIDTH; sized -= SCREEN_WIDTH;
renderer->RenderQuad(wood.get(), 0, 0); renderer->RenderQuad(wood.get(), 0, 0);*/
if (gold1.get()) /*if (gold1.get())
{ {
renderer->RenderQuad(gold1.get(), -sized, 16); renderer->RenderQuad(gold1.get(), -sized, 16);
renderer->RenderQuad(gold1.get(), -sized + 479, 16); renderer->RenderQuad(gold1.get(), -sized + 479, 16);
@@ -60,12 +64,12 @@ void GuiFrame::Render()
renderer->RenderQuad(gold2.get(), step / 2, 16); renderer->RenderQuad(gold2.get(), step / 2, 16);
renderer->RenderQuad(gold2.get(), step / 2 - 479, 16); renderer->RenderQuad(gold2.get(), step / 2 - 479, 16);
} }
} }*/
} }
void GuiFrame::Update(float dt) void GuiFrame::Update(float dt)
{ {
step += dt * 5; /*step += dt * 5;
if (step > 2 * SCREEN_WIDTH) if (step > 2 * SCREEN_WIDTH)
step -= 2 * SCREEN_WIDTH; step -= 2 * SCREEN_WIDTH;*/
} }
+7 -4
View File
@@ -24,7 +24,7 @@
}; };
*/ */
const float GuiPhaseBar::zoom_big = (float)(1.5 * 1.4); const float GuiPhaseBar::zoom_big = (float)(1.5 * 1.25);
const float GuiPhaseBar::zoom_small = 1.5; const float GuiPhaseBar::zoom_small = 1.5;
const float GuiPhaseBar::step = M_PI/6.0f; const float GuiPhaseBar::step = M_PI/6.0f;
@@ -36,9 +36,9 @@ namespace
const unsigned kPhases = NB_MTG_PHASES - 2; //there are two phases we do not show const unsigned kPhases = NB_MTG_PHASES - 2; //there are two phases we do not show
} }
void GuiPhaseBar::DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale) void GuiPhaseBar::DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale, float z)
{ {
inQuad->SetTextureRect(phaseId * (kWidth + 1), 0, kWidth, kHeight); inQuad->SetTextureRect(phaseId * (kWidth + 1), z, kWidth, kHeight);
JRenderer::GetInstance()->RenderQuad(inQuad, x, y - scale * kWidth/2, 0.0f, scale, scale); JRenderer::GetInstance()->RenderQuad(inQuad, x, y - scale * kWidth/2, 0.0f, scale, scale);
} }
@@ -110,7 +110,10 @@ void GuiPhaseBar::Render()
//hint: sin(circPos + PI/2) = cos(circPos) //hint: sin(circPos + PI/2) = cos(circPos)
const float glyphScale = float(zoomFactor * cosf(circPos) * 0.5f); const float glyphScale = float(zoomFactor * cosf(circPos) * 0.5f);
DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale); if (observer->currentPlayer && observer->currentPlayer->isAI() && !observer->currentPlayer->opponent()->isAI())
DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale, 29);
else
DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale, 0);
} }
//print phase name //print phase name
+7 -3
View File
@@ -106,7 +106,7 @@ GuiPlay::BattleField::BattleField() :
attackers(0), height(0.0), red(0), colorFlow(0) attackers(0), height(0.0), red(0), colorFlow(0)
{ {
} }
const float GuiPlay::BattleField::HEIGHT = 80.0f; const float GuiPlay::BattleField::HEIGHT = 146.0f;
void GuiPlay::BattleField::addAttacker(MTGCardInstance*) void GuiPlay::BattleField::addAttacker(MTGCardInstance*)
{ {
++attackers; ++attackers;
@@ -160,7 +160,11 @@ void GuiPlay::BattleField::Update(float dt)
void GuiPlay::BattleField::Render() void GuiPlay::BattleField::Render()
{ {
if (height > 3) if (height > 3)
JRenderer::GetInstance()->FillRect(44, SCREEN_HEIGHT / 2 + 10 - height / 2, 318, height, ARGB(127, red, 0, 0)); {
JRenderer::GetInstance()->FillRect(0, SCREEN_HEIGHT / 2 + 8.5f - height / 2, 480, height, ARGB(127, red, 0, 0));
if(red > 1)
JRenderer::GetInstance()->DrawRect(-2, SCREEN_HEIGHT / 2 + 8.5f - height / 2, 484, height, ARGB(255, 255, 165, 0));
}
} }
GuiPlay::GuiPlay(DuelLayers* view) : GuiPlay::GuiPlay(DuelLayers* view) :
@@ -270,7 +274,7 @@ void GuiPlay::Replace()
//rerun the iter reattaching planes walkers to the back of the lands. //rerun the iter reattaching planes walkers to the back of the lands.
for (iterator it = end_spells; it != cards.end(); ++it) for (iterator it = end_spells; it != cards.end(); ++it)
{ {
if ((*it)->card->hasType(Subtypes::TYPE_PLANESWALKER)) if ((*it)->card->hasType(Subtypes::TYPE_PLANESWALKER) && !(*it)->card->isCreature())
{ {
if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller()) if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller())
selfLands.Enstack(*it); selfLands.Enstack(*it);
+5 -5
View File
@@ -60,8 +60,8 @@ void GuiAvatar::Render()
{ {
if (corner == BOTTOM_RIGHT) if (corner == BOTTOM_RIGHT)
{ {
x0 -= player->getIcon()->mWidth * actZ; x0 -= Width * actZ;
y0 -= player->getIcon()->mHeight * actZ; y0 -= Height * actZ;
} }
switch (corner) switch (corner)
{ {
@@ -69,14 +69,14 @@ void GuiAvatar::Render()
player->getIcon()->SetHotSpot(0, 0); player->getIcon()->SetHotSpot(0, 0);
break; break;
case BOTTOM_RIGHT: case BOTTOM_RIGHT:
player->getIcon()->SetHotSpot(35, 50); player->getIcon()->SetHotSpot(player->getIcon()->mWidth, player->getIcon()->mHeight);
break; break;
} }
player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed)); player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
r->RenderQuad(player->getIcon().get(), actX, actY, actT, actZ, actZ); r->RenderQuad(player->getIcon().get(), actX, actY, actT, Width/player->getIcon()->mWidth*actZ, Height/player->getIcon()->mHeight*actZ);
if (mHasFocus) if (mHasFocus)
{ {
r->FillRect(x0, x0, player->getIcon()->mWidth * actZ, player->getIcon()->mHeight * actZ, ARGB(abs(128 - wave),255,255,255)); r->FillRect(x0, x0, Width/player->getIcon()->mWidth * actZ, Height/player->getIcon()->mHeight * actZ, ARGB(abs(128 - wave),255,255,255));
} }
} }
+3 -1
View File
@@ -583,11 +583,13 @@ Player * MTGCardInstance::controller()
int MTGCardInstance::canAttack() int MTGCardInstance::canAttack()
{ {
if (basicAbilities[(int)Constants::CANTATTACK])
return 0;
if (tapped) if (tapped)
return 0; return 0;
if (hasSummoningSickness()) if (hasSummoningSickness())
return 0; return 0;
if ((basicAbilities[(int)Constants::DEFENSER] || basicAbilities[(int)Constants::CANTATTACK]) && !basicAbilities[(int)Constants::CANATTACK]) if (basicAbilities[(int)Constants::DEFENSER] && !basicAbilities[(int)Constants::CANATTACK])
return 0; return 0;
if (!isCreature()) if (!isCreature())
return 0; return 0;
+1 -1
View File
@@ -89,7 +89,7 @@ bool Player::loadAvatar(string file, string resName)
} }
mAvatarTex = rm->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR); mAvatarTex = rm->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR);
if (mAvatarTex) { if (mAvatarTex) {
mAvatar = rm->RetrieveQuad(file, 0, 0, 35, 50, resName, RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR); mAvatar = rm->RetrieveQuad(file, 0, 0, 0, 0, resName, RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR);
return true; return true;
} }