1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Implemented Bloodlust & Petrification effect

- ColorFilter is now in separate file
- Moved lerp function into global.h
- Bloodlust visuals mostly matches H3
- Petrify visual matches H3
- TODO: Adjust timing of all ColorFilter efects to match H3
- TODO: Petrify should pause stack animations
- TODO: ColorFilter-powered effects should be configurable in Spell system
This commit is contained in:
Ivan Savenko
2022-12-15 23:24:03 +02:00
parent 7e35a96055
commit 864990db13
30 changed files with 506 additions and 278 deletions

View File

@@ -56,8 +56,8 @@ void ProjectileMissile::show(Canvas & canvas)
float progress = float(step) / steps;
Point pos {
CSDL_Ext::lerp(from.x, dest.x, progress) - image->width() / 2,
CSDL_Ext::lerp(from.y, dest.y, progress) - image->height() / 2,
vstd::lerp(from.x, dest.x, progress) - image->width() / 2,
vstd::lerp(from.y, dest.y, progress) - image->height() / 2,
};
canvas.draw(image, pos);
@@ -84,7 +84,7 @@ void ProjectileCatapult::show(Canvas & canvas)
{
float progress = float(step) / steps;
int posX = CSDL_Ext::lerp(from.x, dest.x, progress);
int posX = vstd::lerp(from.x, dest.x, progress);
int posY = calculateCatapultParabolaY(from, dest, posX);
Point pos(posX, posY);
@@ -100,8 +100,8 @@ void ProjectileRay::show(Canvas & canvas)
float progress = float(step) / steps;
Point curr {
CSDL_Ext::lerp(from.x, dest.x, progress),
CSDL_Ext::lerp(from.y, dest.y, progress),
vstd::lerp(from.x, dest.x, progress),
vstd::lerp(from.y, dest.y, progress),
};
Point length = curr - from;
@@ -235,13 +235,13 @@ void BattleProjectileController::showProjectiles(Canvas & canvas)
});
}
bool BattleProjectileController::hasActiveProjectile(const CStack * stack) const
bool BattleProjectileController::hasActiveProjectile(const CStack * stack, bool emittedOnly) const
{
int stackID = stack ? stack->ID : -1;
for(auto const & instance : projectiles)
{
if(instance->shooterID == stackID)
if(instance->shooterID == stackID && (instance->playing || !emittedOnly))
{
return true;
}