1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-11 18:20:42 +00:00

This DCC frame size calculation seems useless

TBH there some to be some other overcomplicated things going on in
DCCAnimation but too tired to use brain right now.
This commit is contained in:
Ziemas 2021-01-02 01:56:09 +01:00
parent 427170e2e8
commit 826b1224f6

View File

@ -2,9 +2,6 @@ package d2asset
import (
"errors"
"math"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2math"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
@ -132,24 +129,11 @@ func (a *DCCAnimation) decodeDirection(directionIndex int) error {
func (a *DCCAnimation) decodeFrame(directionIndex int) animationFrame {
dccDirection := a.dcc.Directions[directionIndex]
minX, minY := math.MaxInt32, math.MaxInt32
maxX, maxY := math.MinInt32, math.MinInt32
for _, dccFrame := range dccDirection.Frames {
minX = d2math.MinInt(minX, dccFrame.Box.Left)
minY = d2math.MinInt(minY, dccFrame.Box.Top)
maxX = d2math.MaxInt(maxX, dccFrame.Box.Right())
maxY = d2math.MaxInt(maxY, dccFrame.Box.Bottom())
}
frameWidth := maxX - minX
frameHeight := maxY - minY
frame := animationFrame{
width: frameWidth,
height: frameHeight,
offsetX: minX,
offsetY: minY,
width: dccDirection.Box.Width,
height: dccDirection.Box.Height,
offsetX: dccDirection.Box.Left,
offsetY: dccDirection.Box.Top,
decoded: true,
}