mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-28 14:16:01 -04:00
This commit is contained in:
parent
7f19f7e970
commit
ec9c0c3d95
@ -124,3 +124,18 @@ func scanlineType(b int) scanlineState {
|
|||||||
|
|
||||||
return runOfOpaquePixels
|
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
|
// decodeDirection decodes and returns the given direction
|
||||||
func (dcc *DCC) decodeDirection(direction int) *DCCDirection {
|
func (d *DCC) decodeDirection(direction int) *DCCDirection {
|
||||||
return CreateDCCDirection(d2datautils.CreateBitMuncher(dcc.fileData,
|
return CreateDCCDirection(d2datautils.CreateBitMuncher(d.fileData,
|
||||||
dcc.directionOffsets[direction]*directionOffsetMultiplier), dcc)
|
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) {
|
func (a *Animation) SetShadow(shadow bool) {
|
||||||
a.hasShadow = shadow
|
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
|
// Clone creates a copy of the animation
|
||||||
func (a *DC6Animation) Clone() d2interface.Animation {
|
func (a *DC6Animation) Clone() d2interface.Animation {
|
||||||
animation := *a
|
clone := &DC6Animation{}
|
||||||
return &animation
|
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
|
// Clone creates a copy of the animation
|
||||||
func (a *DCCAnimation) Clone() d2interface.Animation {
|
func (a *DCCAnimation) Clone() d2interface.Animation {
|
||||||
animation := *a
|
clone := &DCCAnimation{}
|
||||||
return &animation
|
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
|
// SetDirection places the animation in the direction of an animation
|
||||||
|
Loading…
Reference in New Issue
Block a user