public static long DecodeInt64(BitBuffer bitBuffer, CSVCMsgSendTable.SendpropT prop) { if (((SendPropFlag)prop.Flags & SendPropFlag.VARINT) != 0) { if (((SendPropFlag)prop.Flags & SendPropFlag.UNSIGNED) != 0) { return((long)bitBuffer.ReadVarInt64()); } return(bitBuffer.ReadSignedVarInt64()); } uint highInt = 0; uint lowInt = 0; var sign = 1; if (((SendPropFlag)prop.Flags & SendPropFlag.UNSIGNED) == 0) { sign = bitBuffer.ReadOneBit() ? -1 : 1; lowInt = bitBuffer.ReadUBitLong(32); highInt = bitBuffer.ReadUBitLong(prop.NumBits - 32 - 1); } else { lowInt = bitBuffer.ReadUBitLong(32); highInt = bitBuffer.ReadUBitLong(prop.NumBits - 32); } long temp = lowInt | highInt << 32; return(temp * sign); }
public static Vector3 DecodeVector(BitBuffer bitBuffer, CSVCMsgSendTable.SendpropT prop) { var vec = new Vector3 { x = DecodeFloat(bitBuffer, prop), z = DecodeFloat(bitBuffer, prop) }; if (((SendPropFlag)prop.Flags & SendPropFlag.NORMAL) == 0) { vec.y = DecodeFloat(bitBuffer, prop); return(vec); } var sign = bitBuffer.ReadOneBit() ? -1 : 1; var a2b2 = vec.x * vec.x + vec.z * vec.z; if (a2b2 < 1f) { vec.y = Mathf.Sqrt(1f - a2b2) * sign; } return(vec); }