aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/svcBspDecal.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-09-16 20:39:02 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-09-16 21:39:43 +0300
commit81f365e99636104ff81151370048a51e8ae8027a (patch)
tree0bd2781ad73fdc982abdcb70f9f44c551ac76bcf /pkg/messages/types/svcBspDecal.go
parentupdate CI workflow for go 1.21.0 (diff)
downloadsdp.go-81f365e99636104ff81151370048a51e8ae8027a.tar.gz
sdp.go-81f365e99636104ff81151370048a51e8ae8027a.tar.bz2
sdp.go-81f365e99636104ff81151370048a51e8ae8027a.zip
feat: parsing sar custom data (#4)
Diffstat (limited to 'pkg/messages/types/svcBspDecal.go')
-rw-r--r--pkg/messages/types/svcBspDecal.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/messages/types/svcBspDecal.go b/pkg/messages/types/svcBspDecal.go
index 484497f..dda81dd 100644
--- a/pkg/messages/types/svcBspDecal.go
+++ b/pkg/messages/types/svcBspDecal.go
@@ -17,7 +17,7 @@ type vectorCoord struct {
17 Valid bool 17 Valid bool
18} 18}
19 19
20func ParseSvcBspDecal(reader *bitreader.ReaderType) SvcBspDecal { 20func ParseSvcBspDecal(reader *bitreader.Reader) SvcBspDecal {
21 svcBspDecal := SvcBspDecal{ 21 svcBspDecal := SvcBspDecal{
22 Pos: readVectorCoords(reader), 22 Pos: readVectorCoords(reader),
23 DecalTextureIndex: int16(reader.TryReadBits(9)), 23 DecalTextureIndex: int16(reader.TryReadBits(9)),
@@ -30,7 +30,7 @@ func ParseSvcBspDecal(reader *bitreader.ReaderType) SvcBspDecal {
30 return svcBspDecal 30 return svcBspDecal
31} 31}
32 32
33func readVectorCoords(reader *bitreader.ReaderType) []vectorCoord { 33func readVectorCoords(reader *bitreader.Reader) []vectorCoord {
34 const COORD_INTEGER_BITS uint8 = 14 34 const COORD_INTEGER_BITS uint8 = 14
35 const COORD_FRACTIONAL_BITS uint8 = 5 35 const COORD_FRACTIONAL_BITS uint8 = 5
36 const COORD_DENOMINATOR uint8 = 1 << COORD_FRACTIONAL_BITS 36 const COORD_DENOMINATOR uint8 = 1 << COORD_FRACTIONAL_BITS
@@ -42,10 +42,10 @@ func readVectorCoords(reader *bitreader.ReaderType) []vectorCoord {
42 if integer != 0 || fraction != 0 { 42 if integer != 0 || fraction != 0 {
43 sign := reader.TryReadBits(1) 43 sign := reader.TryReadBits(1)
44 if integer != 0 { 44 if integer != 0 {
45 integer = reader.TryReadBits(int(COORD_INTEGER_BITS)) + 1 45 integer = reader.TryReadBits(uint64(COORD_INTEGER_BITS)) + 1
46 } 46 }
47 if fraction != 0 { 47 if fraction != 0 {
48 fraction = reader.TryReadBits(int(COORD_FRACTIONAL_BITS)) 48 fraction = reader.TryReadBits(uint64(COORD_FRACTIONAL_BITS))
49 } 49 }
50 value = float32(integer) + float32(fraction)*COORD_RESOLUTION 50 value = float32(integer) + float32(fraction)*COORD_RESOLUTION
51 if sign != 0 { 51 if sign != 0 {