mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-04 17:27:16 -05:00
This commit is contained in:
parent
7f19f7e970
commit
ec9c0c3d95
@ -124,3 +124,18 @@ func scanlineType(b int) scanlineState {
|
||||
|
||||
return runOfOpaquePixels
|
||||
}
|
||||
|
||||
// Clone creates a copy of the DC6
|
||||
func (d *DC6) Clone() *DC6 {
|
||||
clone := *d
|
||||
copy(clone.Termination, d.Termination)
|
||||
copy(clone.FramePointers, d.FramePointers)
|
||||
clone.Frames = make([]*DC6Frame, len(d.Frames))
|
||||
|
||||
for i := range d.Frames {
|
||||
cloneFrame := *d.Frames[i]
|
||||
clone.Frames = append(clone.Frames, &cloneFrame)
|
||||
}
|
||||
|
||||
return &clone
|
||||
}
|
||||
|
@ -57,7 +57,22 @@ func Load(fileData []byte) (*DCC, error) {
|
||||
}
|
||||
|
||||
// decodeDirection decodes and returns the given direction
|
||||
func (dcc *DCC) decodeDirection(direction int) *DCCDirection {
|
||||
return CreateDCCDirection(d2datautils.CreateBitMuncher(dcc.fileData,
|
||||
dcc.directionOffsets[direction]*directionOffsetMultiplier), dcc)
|
||||
func (d *DCC) decodeDirection(direction int) *DCCDirection {
|
||||
return CreateDCCDirection(d2datautils.CreateBitMuncher(d.fileData,
|
||||
d.directionOffsets[direction]*directionOffsetMultiplier), d)
|
||||
}
|
||||
|
||||
// Clone creates a copy of the DCC
|
||||
func (d *DCC) Clone() *DCC {
|
||||
clone := *d
|
||||
copy(clone.directionOffsets, d.directionOffsets)
|
||||
copy(clone.fileData, d.fileData)
|
||||
clone.Directions = make([]*DCCDirection, len(d.Directions))
|
||||
|
||||
for i := range d.Directions {
|
||||
cloneDirection := *d.Directions[i]
|
||||
clone.Directions = append(clone.Directions, &cloneDirection)
|
||||
}
|
||||
|
||||
return &clone
|
||||
}
|
||||
|
@ -396,3 +396,11 @@ func (a *Animation) SetEffect(e d2enum.DrawEffect) {
|
||||
func (a *Animation) SetShadow(shadow bool) {
|
||||
a.hasShadow = shadow
|
||||
}
|
||||
|
||||
// Clone creates a copy of the Animation
|
||||
func (a *Animation) Clone() Animation {
|
||||
clone := *a
|
||||
copy(clone.directions, a.directions)
|
||||
|
||||
return clone
|
||||
}
|
||||
|
@ -188,6 +188,10 @@ func (a *DC6Animation) createFrameSurface(directionIndex, frameIndex int) (d2int
|
||||
|
||||
// Clone creates a copy of the animation
|
||||
func (a *DC6Animation) Clone() d2interface.Animation {
|
||||
animation := *a
|
||||
return &animation
|
||||
clone := &DC6Animation{}
|
||||
clone.Animation = a.Animation.Clone()
|
||||
clone.dc6 = a.dc6.Clone()
|
||||
clone.palette = a.palette
|
||||
|
||||
return clone
|
||||
}
|
||||
|
@ -72,8 +72,12 @@ func (a *DCCAnimation) init() error {
|
||||
|
||||
// Clone creates a copy of the animation
|
||||
func (a *DCCAnimation) Clone() d2interface.Animation {
|
||||
animation := *a
|
||||
return &animation
|
||||
clone := &DCCAnimation{}
|
||||
clone.Animation = a.Animation.Clone()
|
||||
clone.dcc = a.dcc.Clone()
|
||||
clone.palette = a.palette
|
||||
|
||||
return clone
|
||||
}
|
||||
|
||||
// SetDirection places the animation in the direction of an animation
|
||||
|
Loading…
Reference in New Issue
Block a user