mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-31 16:27:18 -04:00
Don't reset animation when changing direction (#248)
This commit is contained in:
parent
413d95335a
commit
5b6da2434f
@ -86,6 +86,7 @@ func (v *AnimatedEntity) SetMode(animationMode, weaponClass string, direction in
|
|||||||
if v.Cof.NumberOfDirections == 0 || v.Cof.NumberOfLayers == 0 || v.Cof.FramesPerDirection == 0 {
|
if v.Cof.NumberOfDirections == 0 || v.Cof.NumberOfLayers == 0 || v.Cof.FramesPerDirection == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
resetAnimation := v.animationMode != animationMode || v.weaponClass != weaponClass
|
||||||
v.animationMode = animationMode
|
v.animationMode = animationMode
|
||||||
v.weaponClass = weaponClass
|
v.weaponClass = weaponClass
|
||||||
v.direction = direction
|
v.direction = direction
|
||||||
@ -101,7 +102,7 @@ func (v *AnimatedEntity) SetMode(animationMode, weaponClass string, direction in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v.updateFrameCache()
|
v.updateFrameCache(resetAnimation)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *AnimatedEntity) LoadLayer(layer string, fileProvider d2interface.FileProvider) d2dcc.DCC {
|
func (v *AnimatedEntity) LoadLayer(layer string, fileProvider d2interface.FileProvider) d2dcc.DCC {
|
||||||
@ -196,8 +197,10 @@ func (v *AnimatedEntity) Render(target *ebiten.Image, offsetX, offsetY int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *AnimatedEntity) updateFrameCache() {
|
func (v *AnimatedEntity) updateFrameCache(resetAnimation bool) {
|
||||||
|
if resetAnimation {
|
||||||
v.currentFrame = 0
|
v.currentFrame = 0
|
||||||
|
}
|
||||||
// TODO: This animation data madness is incorrect, yet tasty
|
// TODO: This animation data madness is incorrect, yet tasty
|
||||||
animDataTemp := d2data.AnimationData[strings.ToLower(v.token+v.animationMode+v.weaponClass)]
|
animDataTemp := d2data.AnimationData[strings.ToLower(v.token+v.animationMode+v.weaponClass)]
|
||||||
if animDataTemp == nil {
|
if animDataTemp == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user