mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-27 21:56:19 -04:00
rename: PushBytes(b []byte) -> PushBytes(b ...byte)
This commit is contained in:
parent
0f32ad5d62
commit
0fec9473ed
@ -27,7 +27,7 @@ func (v *StreamWriter) PushByte(val byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PushBytes writes a byte slince to the stream
|
// PushBytes writes a byte slince to the stream
|
||||||
func (v *StreamWriter) PushBytes(b []byte) {
|
func (v *StreamWriter) PushBytes(b ...byte) {
|
||||||
for _, i := range b {
|
for _, i := range b {
|
||||||
v.PushByte(i)
|
v.PushByte(i)
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ type COF struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load loads a COF file.
|
// Load loads a COF file.
|
||||||
|
// nolint:funlen // no need to change
|
||||||
func Load(fileData []byte) (*COF, error) {
|
func Load(fileData []byte) (*COF, error) {
|
||||||
result := &COF{}
|
result := &COF{}
|
||||||
streamReader := d2datautils.CreateStreamReader(fileData)
|
streamReader := d2datautils.CreateStreamReader(fileData)
|
||||||
@ -140,16 +141,16 @@ func Load(fileData []byte) (*COF, error) {
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshals encodes COF back into byte slince
|
// Marshal encodes COF back into byte slince
|
||||||
func (c *COF) Marshal() []byte {
|
func (c *COF) Marshal() []byte {
|
||||||
sw := d2datautils.CreateStreamWriter()
|
sw := d2datautils.CreateStreamWriter()
|
||||||
|
|
||||||
sw.PushByte(byte(c.NumberOfLayers))
|
sw.PushByte(byte(c.NumberOfLayers))
|
||||||
sw.PushByte(byte(c.FramesPerDirection))
|
sw.PushByte(byte(c.FramesPerDirection))
|
||||||
sw.PushByte(byte(c.NumberOfDirections))
|
sw.PushByte(byte(c.NumberOfDirections))
|
||||||
sw.PushBytes(c.unknownHeaderBytes)
|
sw.PushBytes(c.unknownHeaderBytes...)
|
||||||
sw.PushByte(byte(c.Speed))
|
sw.PushByte(byte(c.Speed))
|
||||||
sw.PushBytes(c.unknown1)
|
sw.PushBytes(c.unknown1...)
|
||||||
|
|
||||||
for i := range c.CofLayers {
|
for i := range c.CofLayers {
|
||||||
sw.PushByte(byte(c.CofLayers[i].Type.Int()))
|
sw.PushByte(byte(c.CofLayers[i].Type.Int()))
|
||||||
@ -169,7 +170,7 @@ func (c *COF) Marshal() []byte {
|
|||||||
|
|
||||||
sw.PushByte(byte(c.CofLayers[i].DrawEffect))
|
sw.PushByte(byte(c.CofLayers[i].DrawEffect))
|
||||||
|
|
||||||
sw.PushBytes(c.CofLayers[i].weaponClassByte)
|
sw.PushBytes(c.CofLayers[i].weaponClassByte...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, i := range c.AnimationFrames {
|
for _, i := range c.AnimationFrames {
|
||||||
|
Loading…
Reference in New Issue
Block a user