mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Made Clone color filter identical to H3
This commit is contained in:
parent
fb3a08e0a6
commit
814f6ed684
@ -603,17 +603,17 @@ void FadingAnimation::nextFrame()
|
||||
float delta = elapsed / fullTime;
|
||||
progress += delta;
|
||||
|
||||
if (progress > 1.0f)
|
||||
progress = 1.0f;
|
||||
|
||||
uint8_t blueFactor = stack->cloned ? 0 : 255;
|
||||
uint8_t blueAdded = stack->cloned ? 255 : 0;
|
||||
uint8_t alpha = CSDL_Ext::lerp(from, dest, progress);
|
||||
|
||||
ColorShifterMultiplyAndAdd shifterFade ({255, 255, blueFactor, alpha}, {0, 0, blueAdded, 0});
|
||||
stackAnimation(stack)->shiftColor(&shifterFade);
|
||||
|
||||
if (progress == 1.0f)
|
||||
if (progress > 1.0f)
|
||||
progress = 1.0f;
|
||||
|
||||
uint8_t factor = stack->cloned ? 128 : 255;
|
||||
uint8_t blue = stack->cloned ? 128 : 0;
|
||||
uint8_t alpha = CSDL_Ext::lerp(from, dest, progress);
|
||||
|
||||
ColorShifterMultiplyAndAdd shifterFade ({factor, factor, factor, alpha}, {0, 0, blue, 0});
|
||||
stackAnimation(stack)->shiftColor(&shifterFade);
|
||||
|
||||
if (progress == 1.0f)
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
@ -126,12 +126,13 @@ public:
|
||||
/// Hand-to-hand attack
|
||||
class MeleeAttackAnimation : public AttackAnimation
|
||||
{
|
||||
bool multiAttack;
|
||||
public:
|
||||
bool init() override;
|
||||
void nextFrame() override;
|
||||
void playSound() override;
|
||||
|
||||
MeleeAttackAnimation(BattleInterface & owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked);
|
||||
MeleeAttackAnimation(BattleInterface & owner, const CStack * attacker, BattleHex _dest, const CStack * _attacked, bool multiAttack);
|
||||
};
|
||||
|
||||
/// Base class for all animations that play during stack movement
|
||||
|
@ -315,20 +315,19 @@ static SDL_Color addColors(const SDL_Color & base, const SDL_Color & over)
|
||||
ui8(over.a + base.a * (255 - over.a) / 256)
|
||||
);
|
||||
}
|
||||
|
||||
void CreatureAnimation::genSpecialPalette(IImage::SpecialPalette & target)
|
||||
{
|
||||
target[0] = genBorderColor(getBorderStrength(elapsedTime), border);
|
||||
target[1] = genShadow(shadowAlpha / 2);
|
||||
target[2] = genShadow(shadowAlpha / 2);
|
||||
target[3] = genShadow(shadowAlpha);
|
||||
target[4] = genShadow(shadowAlpha);
|
||||
target[5] = genBorderColor(getBorderStrength(elapsedTime), border);
|
||||
target[6] = addColors(genShadow(shadowAlpha), genBorderColor(getBorderStrength(elapsedTime), border));
|
||||
target[7] = addColors(genShadow(shadowAlpha / 2), genBorderColor(getBorderStrength(elapsedTime), border));
|
||||
}
|
||||
|
||||
void CreatureAnimation::nextFrame(Canvas & canvas, bool facingRight)
|
||||
|
||||
void CreatureAnimation::genSpecialPalette(IImage::SpecialPalette & target)
|
||||
{
|
||||
target[0] = genShadow(shadowAlpha / 2);
|
||||
target[1] = genShadow(shadowAlpha / 2);
|
||||
target[2] = genShadow(shadowAlpha);
|
||||
target[3] = genShadow(shadowAlpha);
|
||||
target[4] = genBorderColor(getBorderStrength(elapsedTime), border);
|
||||
target[5] = addColors(genShadow(shadowAlpha), genBorderColor(getBorderStrength(elapsedTime), border));
|
||||
target[6] = addColors(genShadow(shadowAlpha / 2), genBorderColor(getBorderStrength(elapsedTime), border));
|
||||
}
|
||||
|
||||
void CreatureAnimation::nextFrame(Canvas & canvas, bool facingRight)
|
||||
{
|
||||
size_t frame = static_cast<size_t>(floor(currentFrame));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user