From 81f365e99636104ff81151370048a51e8ae8027a Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sat, 16 Sep 2023 20:39:02 +0300 Subject: feat: parsing sar custom data (#4) --- pkg/messages/types/svcBspDecal.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/messages/types/svcBspDecal.go') 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 { Valid bool } -func ParseSvcBspDecal(reader *bitreader.ReaderType) SvcBspDecal { +func ParseSvcBspDecal(reader *bitreader.Reader) SvcBspDecal { svcBspDecal := SvcBspDecal{ Pos: readVectorCoords(reader), DecalTextureIndex: int16(reader.TryReadBits(9)), @@ -30,7 +30,7 @@ func ParseSvcBspDecal(reader *bitreader.ReaderType) SvcBspDecal { return svcBspDecal } -func readVectorCoords(reader *bitreader.ReaderType) []vectorCoord { +func readVectorCoords(reader *bitreader.Reader) []vectorCoord { const COORD_INTEGER_BITS uint8 = 14 const COORD_FRACTIONAL_BITS uint8 = 5 const COORD_DENOMINATOR uint8 = 1 << COORD_FRACTIONAL_BITS @@ -42,10 +42,10 @@ func readVectorCoords(reader *bitreader.ReaderType) []vectorCoord { if integer != 0 || fraction != 0 { sign := reader.TryReadBits(1) if integer != 0 { - integer = reader.TryReadBits(int(COORD_INTEGER_BITS)) + 1 + integer = reader.TryReadBits(uint64(COORD_INTEGER_BITS)) + 1 } if fraction != 0 { - fraction = reader.TryReadBits(int(COORD_FRACTIONAL_BITS)) + fraction = reader.TryReadBits(uint64(COORD_FRACTIONAL_BITS)) } value = float32(integer) + float32(fraction)*COORD_RESOLUTION if sign != 0 { -- cgit v1.2.3