Fix damage render

This commit is contained in:
Anthony Calosa
2016-06-07 18:20:30 +08:00
parent 2c7921479a
commit d8e28dad7f
2 changed files with 35 additions and 19 deletions

View File

@@ -274,28 +274,44 @@ void Damage::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, _("Deals %i damage to").c_str(), damage);
mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT);
//mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT);
mFont->DrawString(buffer, x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT);
JRenderer * renderer = JRenderer::GetInstance();
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB);
if (quad.get())
{
float scale = 30 / quad->mHeight;
renderer->RenderQuad(quad.get(), x, y, 0, scale, scale);
//float scale = 30 / quad->mHeight;
//renderer->RenderQuad(quad.get(), x, y, 0, scale, scale);
quad->SetColor(ARGB(255,255,255,255));
float scale = mHeight / quad->mHeight;
renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale);
}
else
{
mFont->DrawString(_(source->getName()).c_str(), x, y - 15);
//mFont->DrawString(_(source->getName()).c_str(), x, y - 15);
mFont->DrawString(_(source->getName()).c_str(), x, y + GetVerticalTextOffset() - 15);
}
quad = target->getIcon();
if (quad.get())
{
float scale = 30 / quad->mHeight;
renderer->RenderQuad(quad.get(), x + 150, y, 0, scale, scale);
//float scale = 30 / quad->mHeight;
//renderer->RenderQuad(quad.get(), x + 150, y, 0, scale, scale);
float backupX = quad->mHotSpotX;
float backupY = quad->mHotSpotY;
quad->SetColor(ARGB(255,255,255,255));
quad->SetHotSpot(quad->mWidth / 2, quad->mHeight / 2);
float scale = mHeight / quad->mHeight;
renderer->RenderQuad(quad.get(), x + 130, y - 0.5f + ((mHeight - quad->mHeight) / 2) + quad->mHotSpotY, 0, scale, scale);
quad->SetHotSpot(backupX, backupY);
}
else
{
//if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
//mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y);
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y);
mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 35, y+15 + GetVerticalTextOffset());
else if(target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER)
mFont->DrawString(_(((Player *) target)->getDisplayName()).c_str(), x + 35, y+15 + GetVerticalTextOffset());
}
}

View File

@@ -639,18 +639,18 @@ void GameObserver::gameStateBasedEffects()
}
}
///while checking all these zones, lets also strip devoid cards of thier colors
for (int w = 0; w < zone->nb_cards; w++)
{
MTGCardInstance * card = zone->cards[w];
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (card->has(Constants::DEVOID))
{
card->removeColor(i);
}
}
}
///while checking all these zones, lets also strip devoid cards of thier colors
for (int w = 0; w < zone->nb_cards; w++)
{
MTGCardInstance * card = zone->cards[w];
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
{
if (card->has(Constants::DEVOID))
{
card->removeColor(i);
}
}
}
}//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue