55 "sync"
66
77 proto "github.com/gogo/protobuf/proto"
8- r3 "github.com/golang/geo/r3"
98
10- bit "github.com/markus-wa/demoinfocs-golang/bitread"
119 msg "github.com/markus-wa/demoinfocs-golang/msg"
1210)
1311
@@ -20,9 +18,9 @@ var byteSlicePool sync.Pool = sync.Pool{
2018
2119func (p * Parser ) parsePacket () {
2220 // Booooring
23- parseCommandInfo ( p . bitReader )
24- p . bitReader . ReadInt ( 32 ) // SeqNrIn
25- p .bitReader .ReadInt ( 32 ) // SeqNrOut
21+ // 152 bytes CommandInfo, 4 bytes SeqNrIn, 4 bytes SeqNrOut
22+ // See at the bottom what the CommandInfo would contain if you are interested.
23+ p .bitReader .Skip (( 152 + 4 + 4 ) << 3 )
2624
2725 // Here we go
2826 p .bitReader .BeginChunk (p .bitReader .ReadSignedInt (32 ) << 3 )
@@ -92,69 +90,50 @@ func (p *Parser) parsePacket() {
9290 p .bitReader .EndChunk ()
9391}
9492
95- // TODO: Find out what all this is good for and why we didn't use the removed functions on seVector, split & commandInfo
96- type commandInfo struct {
97- splits [2 ]split
98- }
99-
100- type split struct {
101- flags int
102-
103- viewOrigin seVector
104- viewAngles r3.Vector
105- localViewAngles r3.Vector
106-
107- viewOrigin2 seVector
108- viewAngles2 r3.Vector
109- localViewAngles2 r3.Vector
110- }
111- type seVector struct {
112- r3.Vector
113- }
114-
115- type boundingBoxInformation struct {
116- index int
117- min r3.Vector
118- max r3.Vector
119- }
120-
121- func (bbi boundingBoxInformation ) contains (point r3.Vector ) bool {
122- return point .X >= bbi .min .X && point .X <= bbi .max .X &&
123- point .Y >= bbi .min .Y && point .Y <= bbi .max .Y &&
124- point .Z >= bbi .min .Z && point .Z <= bbi .max .Z
125- }
126-
127- type bombsiteInfo struct {
128- index int
129- center r3.Vector
130- }
131-
132- func parseCommandInfo (r * bit.BitReader ) commandInfo {
133- return commandInfo {splits : [2 ]split {parseSplit (r ), parseSplit (r )}}
134- }
135-
136- func parseSplit (r * bit.BitReader ) split {
137- return split {
138- flags : r .ReadSignedInt (32 ),
139-
140- viewOrigin : parseSEVector (r ),
141- viewAngles : parseVector (r ),
142- localViewAngles : parseVector (r ),
143-
144- viewOrigin2 : parseSEVector (r ),
145- viewAngles2 : parseVector (r ),
146- localViewAngles2 : parseVector (r ),
147- }
148- }
149-
150- func parseSEVector (r * bit.BitReader ) seVector {
151- return seVector {parseVector (r )}
152- }
153-
154- func parseVector (r * bit.BitReader ) r3.Vector {
155- return r3.Vector {
156- X : float64 (r .ReadFloat ()),
157- Y : float64 (r .ReadFloat ()),
158- Z : float64 (r .ReadFloat ()),
159- }
160- }
93+ /*
94+ Format of 'CommandInfos' - I honestly have no clue what they are good for.
95+ If you find a use for this please let me know!
96+
97+ Here is all i know:
98+
99+ CommandInfo [152 bytes]
100+ - [2]Split
101+
102+ Split [76 bytes]
103+ - flags [4 bytes]
104+ - viewOrigin [12 bytes]
105+ - viewAngles [12 bytes]
106+ - localViewAngles [12 bytes]
107+ - viewOrigin2 [12 bytes]
108+ - viewAngles2 [12 bytes]
109+ - localViewAngles2 [12 bytes]
110+
111+ Origin [12 bytes]
112+ - X [4 bytes]
113+ - Y [4 bytes]
114+ - Z [4 bytes]
115+
116+ Angle [12 bytes]
117+ - X [4 bytes]
118+ - Y [4 bytes]
119+ - Z [4 bytes]
120+
121+ They are parsed in the following order:
122+ split1.flags
123+ split1.viewOrigin.x
124+ split1.viewOrigin.y
125+ split1.viewOrigin.z
126+ split1.viewAngles.x
127+ split1.viewAngles.y
128+ split1.viewAngles.z
129+ split1.localViewAngles.x
130+ split1.localViewAngles.y
131+ split1.localViewAngles.z
132+ split1.viewOrigin2...
133+ split1.viewAngles2...
134+ split1.localViewAngles2...
135+ split2.flags
136+ ...
137+
138+ Or just check this file's history for an example on how to parse them
139+ */
0 commit comments