mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
Merge pull request #1016 from Ziemas/useless_dcc_math
This DCC frame size calculation seems useless
This commit is contained in:
commit
68d2486fbb
@ -2,9 +2,6 @@ package d2asset
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"math"
|
|
||||||
|
|
||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2math"
|
|
||||||
|
|
||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||||
|
|
||||||
@ -132,24 +129,11 @@ func (a *DCCAnimation) decodeDirection(directionIndex int) error {
|
|||||||
func (a *DCCAnimation) decodeFrame(directionIndex int) animationFrame {
|
func (a *DCCAnimation) decodeFrame(directionIndex int) animationFrame {
|
||||||
dccDirection := a.dcc.Directions[directionIndex]
|
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{
|
frame := animationFrame{
|
||||||
width: frameWidth,
|
width: dccDirection.Box.Width,
|
||||||
height: frameHeight,
|
height: dccDirection.Box.Height,
|
||||||
offsetX: minX,
|
offsetX: dccDirection.Box.Left,
|
||||||
offsetY: minY,
|
offsetY: dccDirection.Box.Top,
|
||||||
decoded: true,
|
decoded: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user