This is a follow up to PR #4. Handling for the Vector prop needs to be
fixed on the write/encoding side as well. When the float definition is
NormalFloatVar we need to skip writing the last component (z) to the
stream, since it's calculated from the first two components (x, y), and
just write out its sign.
SayText2 messages can use a simplified format where the body is just
client, raw, and a single null-terminated colored text string, without
the usual kind/from/text fields. The parser detected this by peeking
the first byte after client and raw and checking if it was \x01 (color
code for default color), but the text can also start with other color
codes such as \x07 (6-char hex color). When this happened, the parser
would consume the entire message text as the kind string (falling back
to ChatAll), leaving the text and from fields empty.
When the float definition is NormalFloatVar, the last component (z)
should be skipped and calculated from the first two components (x and
y), otherwise we can read too many bits, causing decoding failures:
* 744d6eb003/src/engine/dt_encode.cpp (L119-L143)
This is what was causing the issue with demos recorded on the
jump_classics_a3 map:
* https://codeberg.org/demostf/parser/issues/2
- Fix overflow in ExtraData by casting byte_len to usize before
multiplication. This was previously multiplying a u16 with
saturating_mul and would overflow when the extra data in string
tables reaches a certain size.
- Add test case for parsing large string table to verify correct
stream position after read.