mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Merge pull request #5395 from IvanSavenko/xbrz_effects
Implemented bloodlust, clone, and petrify effects for xbrz mode
This commit is contained in:
@@ -205,8 +205,7 @@ void BattleStacksController::stackAdded(const CStack * stack, bool instant)
|
||||
if (!instant)
|
||||
{
|
||||
// immediately make stack transparent, giving correct shifter time to start
|
||||
auto shifterFade = ColorFilter::genAlphaShifter(0);
|
||||
setStackColorFilter(shifterFade, stack, nullptr, true);
|
||||
setStackColorFilter(Colors::TRANSPARENCY, 0, stack, nullptr, true);
|
||||
|
||||
owner.addToAnimationStage(EAnimationEvents::HIT, [=]()
|
||||
{
|
||||
@@ -334,14 +333,18 @@ void BattleStacksController::showStackAmountBox(Canvas & canvas, const CStack *
|
||||
|
||||
void BattleStacksController::showStack(Canvas & canvas, const CStack * stack)
|
||||
{
|
||||
ColorFilter fullFilter = ColorFilter::genEmptyShifter();
|
||||
ColorRGBA effectColor = Colors::TRANSPARENCY;
|
||||
uint8_t transparency = 255;
|
||||
for(const auto & filter : stackFilterEffects)
|
||||
{
|
||||
if (filter.target == stack)
|
||||
fullFilter = ColorFilter::genCombined(fullFilter, filter.effect);
|
||||
{
|
||||
effectColor = filter.effectColor;
|
||||
transparency = static_cast<int>(filter.transparency) * transparency / 255;
|
||||
}
|
||||
}
|
||||
|
||||
stackAnimation[stack->unitId()]->nextFrame(canvas, fullFilter, facingRight(stack)); // do actual blit
|
||||
stackAnimation[stack->unitId()]->nextFrame(canvas, effectColor, transparency, facingRight(stack)); // do actual blit
|
||||
}
|
||||
|
||||
void BattleStacksController::tick(uint32_t msPassed)
|
||||
@@ -779,18 +782,19 @@ Point BattleStacksController::getStackPositionAtHex(const BattleHex & hexNum, co
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BattleStacksController::setStackColorFilter(const ColorFilter & effect, const CStack * target, const CSpell * source, bool persistent)
|
||||
void BattleStacksController::setStackColorFilter(const ColorRGBA & effectColor, uint8_t transparency, const CStack * target, const CSpell * source, bool persistent)
|
||||
{
|
||||
for (auto & filter : stackFilterEffects)
|
||||
{
|
||||
if (filter.target == target && filter.source == source)
|
||||
{
|
||||
filter.effect = effect;
|
||||
filter.effectColor = effectColor;
|
||||
filter.transparency = transparency;
|
||||
filter.persistent = persistent;
|
||||
return;
|
||||
}
|
||||
}
|
||||
stackFilterEffects.push_back({ effect, target, source, persistent });
|
||||
stackFilterEffects.push_back({ target, source, effectColor, transparency, persistent });
|
||||
}
|
||||
|
||||
void BattleStacksController::removeExpiredColorFilters()
|
||||
@@ -801,7 +805,7 @@ void BattleStacksController::removeExpiredColorFilters()
|
||||
{
|
||||
if (filter.source && !filter.target->hasBonus(Selector::source(BonusSource::SPELL_EFFECT, BonusSourceID(filter.source->id)), Selector::all))
|
||||
return true;
|
||||
if (filter.effect == ColorFilter::genEmptyShifter())
|
||||
if (filter.effectColor == Colors::TRANSPARENCY && filter.transparency == 255)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user