mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-06-20 06:05:23 +00:00
d2ds1 encoder: fixed lint errors
This commit is contained in:
parent
5702d96cac
commit
9227de3418
|
@ -30,6 +30,9 @@ func (v *StreamWriter) PushBytes(b ...byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushBit pushes single bit into stream
|
||||||
|
// WARNING: if you'll use PushBit, offset'll be less then 7, and if you'll
|
||||||
|
// use another Push... method, bits'll not be pushed
|
||||||
func (v *StreamWriter) PushBit(b bool) {
|
func (v *StreamWriter) PushBit(b bool) {
|
||||||
if b {
|
if b {
|
||||||
v.bitCache |= (1 << v.bitOffset)
|
v.bitCache |= (1 << v.bitOffset)
|
||||||
|
@ -45,6 +48,7 @@ func (v *StreamWriter) PushBit(b bool) {
|
||||||
v.bitOffset = 0
|
v.bitOffset = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushBits pushes bits (with max range 8)
|
||||||
func (v *StreamWriter) PushBits(b byte, bits int) {
|
func (v *StreamWriter) PushBits(b byte, bits int) {
|
||||||
val := b
|
val := b
|
||||||
for i := 0; i < bits; i++ {
|
for i := 0; i < bits; i++ {
|
||||||
|
@ -58,6 +62,7 @@ func (v *StreamWriter) PushBits(b byte, bits int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushBits16 pushes bits (with max range 16)
|
||||||
func (v *StreamWriter) PushBits16(b uint16, bits int) {
|
func (v *StreamWriter) PushBits16(b uint16, bits int) {
|
||||||
val := b
|
val := b
|
||||||
for i := 0; i < bits; i++ {
|
for i := 0; i < bits; i++ {
|
||||||
|
@ -66,10 +71,12 @@ func (v *StreamWriter) PushBits16(b uint16, bits int) {
|
||||||
} else {
|
} else {
|
||||||
v.PushBit(false)
|
v.PushBit(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
val >>= 1
|
val >>= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushBits32 pushes bits (with max range 32)
|
||||||
func (v *StreamWriter) PushBits32(b uint32, bits int) {
|
func (v *StreamWriter) PushBits32(b uint32, bits int) {
|
||||||
val := b
|
val := b
|
||||||
for i := 0; i < bits; i++ {
|
for i := 0; i < bits; i++ {
|
||||||
|
@ -78,13 +85,8 @@ func (v *StreamWriter) PushBits32(b uint32, bits int) {
|
||||||
} else {
|
} else {
|
||||||
v.PushBit(false)
|
v.PushBit(false)
|
||||||
}
|
}
|
||||||
val >>= 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *StreamWriter) ForcePushBits() {
|
val >>= 1
|
||||||
for i := 0; i < bitsPerByte-v.bitOffset; i++ {
|
|
||||||
v.PushBit(0 != 0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -550,7 +550,6 @@ func (ds1 *DS1) Marshal() []byte {
|
||||||
case d2enum.LayerStreamSubstitute:
|
case d2enum.LayerStreamSubstitute:
|
||||||
sw.PushUint32(ds1.Tiles[y][x].Substitutions[0].Unknown)
|
sw.PushUint32(ds1.Tiles[y][x].Substitutions[0].Unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user