mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-05 02:54:10 +02:00
format
This commit is contained in:
parent
8183ac5b65
commit
f2650dc32f
19 changed files with 3614 additions and 2210 deletions
|
|
@ -206,11 +206,15 @@ pub fn read_bit_coord(stream: &mut Stream) -> ReadResult<f32> {
|
|||
|
||||
Ok(if has_int || has_frac {
|
||||
let sign = if stream.read()? { -1f32 } else { 1f32 };
|
||||
let int_val: u16 = if has_int { stream.read_sized::<u16>(14)? + 1 } else { 0 };
|
||||
let int_val: u16 = if has_int {
|
||||
stream.read_sized::<u16>(14)? + 1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let frac_val: u8 = if has_frac { stream.read_sized(5)? } else { 0 };
|
||||
let value = int_val as f32 + (frac_val as f32 * (1f32 / 32f32));
|
||||
value * sign
|
||||
} else {
|
||||
0f32
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue