mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-26 12:06:24 -05:00
Only draw shadows for layers that should have them (#704)
* Don't draw shadows for transparent layers * Also use cof shadow setting
This commit is contained in:
parent
8d87c19532
commit
dccb930f5c
@ -40,3 +40,11 @@ const (
|
||||
// no effect
|
||||
DrawEffectNone
|
||||
)
|
||||
|
||||
func (d DrawEffect) Transparent() bool {
|
||||
if d == DrawEffectNone {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -38,4 +38,5 @@ type Animation interface {
|
||||
GetPlayedCount() int
|
||||
ResetPlayedCount()
|
||||
SetEffect(effect d2enum.DrawEffect)
|
||||
SetShadow(shadow bool)
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user