diff --git a/d2common/d2enum/draw_effect.go b/d2common/d2enum/draw_effect.go index 0abbb5fc..d2e84dd5 100644 --- a/d2common/d2enum/draw_effect.go +++ b/d2common/d2enum/draw_effect.go @@ -40,3 +40,11 @@ const ( // no effect DrawEffectNone ) + +func (d DrawEffect) Transparent() bool { + if d == DrawEffectNone { + return false + } + + return true +} diff --git a/d2common/d2interface/animation.go b/d2common/d2interface/animation.go index 6a229193..fb46844c 100644 --- a/d2common/d2interface/animation.go +++ b/d2common/d2interface/animation.go @@ -38,4 +38,5 @@ type Animation interface { GetPlayedCount() int ResetPlayedCount() SetEffect(effect d2enum.DrawEffect) + SetShadow(shadow bool) } diff --git a/d2core/d2asset/animation.go b/d2core/d2asset/animation.go index 974e69f6..a4caa0f4 100644 --- a/d2core/d2asset/animation.go +++ b/d2core/d2asset/animation.go @@ -54,6 +54,7 @@ type animation struct { originAtBottom bool playLoop bool hasSubLoop bool // runs after first animation ends + hasShadow bool } // SetSubLoop sets a sub loop for the animation @@ -158,7 +159,7 @@ func (a *animation) RenderFromOrigin(target d2iface.Surface, shadow bool) error defer target.Pop() } - if shadow { + if shadow && !a.effect.Transparent() && a.hasShadow { _, height := a.GetFrameBounds() height = int(math.Abs(float64(height))) @@ -338,3 +339,7 @@ func (a *animation) ResetPlayedCount() { func (a *animation) SetEffect(e d2enum.DrawEffect) { a.effect = e } + +func (a *animation) SetShadow(shadow bool) { + a.hasShadow = shadow +} diff --git a/d2core/d2asset/composite.go b/d2core/d2asset/composite.go index 63299808..16252b05 100644 --- a/d2core/d2asset/composite.go +++ b/d2core/d2asset/composite.go @@ -275,6 +275,7 @@ func (c *Composite) createMode(animationMode animationMode, weaponClass string) if err == nil { layer.SetPlaySpeed(mode.animationSpeed) layer.PlayForward() + layer.SetShadow(cofLayer.Shadow != 0) if err := layer.SetDirection(c.direction); err != nil { return nil, err