by Spike » Tue May 31, 2011 12:00 pm
1 - you mimght be able to do something sneaky with subpic. failing that there's only the polygon drawing code, which is more complex to use, if only because its defered.
2 - you're using the 'renamed' constants, which do no match how the engine internally works
think of it this way. every stat has two versions of the stat. a float version and an 'integer' version.
The 'integer' version, or its bitwise identity, is its exact integer value. any getstats etc will return its exact bit value.
The 'AS_FLOAT' constant you have, is actually 'ev_integer'.
Thus you're claiming that a float is an integer, and its 'getstatf' value in csqc is then nonsensical. If you want to use 'AS_FLOAT' for floats, you need to use getstati to read it.
ev_float/AS_FLOAT_TRUNCATED: sends the field using the protocol's native float handling. in FTE, this is a true float. in DP, its truncated.
ev_integer/AS_FLOAT: sends the field (even if its a float) as if its an int, using the protocol's native 32bit stat handling. This always preserves all bits of any non-vector/string field.
ev_string/AS_STRING: field is intepreted as a string. this string is either packed into 4 adjacent stats (DP truncates to 15 chars), or sent using special handling in a separate stat namespace (which is what FTE does).
ev_entity/AS_ENTITY: sends th entity number as if an integer
getstati(330): directly returns the integer part, no conversion (think of it as the stat's identity). make sure you store the return value into the type it originally was. use this to read an ev_integer value.
getstatf(331): converts the stat into a float, makes no sense if it was already a float. use this to read ev_float or ev_entity
getstatbits(331): converts part of the integer stat's bits into a float (required for the self.items stat's default packing with runes due to limited float precision). use this to read stat_items, should otherwise not be used.
getstats(332): returns a tempstring containing either up to 16 chars of the original string from 4 consecutive stats, or up to 1024 chars of a string stat from a separate stat namespace. use this to read an ev_string.
For FTE, you generally want to use ev_float for floats, it'll give you better network usage. For DP, you may find you need to use the ev_integer hack for floats to avoid truncation, but you should only use it if you actually need the floating part. FTE may give more precision with ev_float or ev_string, but the two engines are otherwise compatible, hopefully.
3. yeah, your addstat is probably defined addstat(float,float,...), rather than taking an explicit type.
.