mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-11 00:17:44 +00:00
There was two problems I was running into: 1. The move packet changed slightly, using a different way to encode the rotation. In hindsight, it should seem obvious they would encode it the same way for CommonSpawn and ActorMove. 2. write_quantized_rotation did it's order of operations wrong, and it would spit out nonsensical rotations. Both issues are fixed and you can see the other player's rotation correctly now!
20 lines
506 B
Rust
20 lines
506 B
Rust
use binrw::binrw;
|
|
|
|
use crate::common::{
|
|
Position, read_packed_position, read_quantized_rotation, write_packed_position,
|
|
write_quantized_rotation,
|
|
};
|
|
|
|
#[binrw]
|
|
#[derive(Debug, Clone, Default)]
|
|
pub struct Move {
|
|
#[br(map = read_quantized_rotation)]
|
|
#[bw(map = write_quantized_rotation)]
|
|
pub rotation: f32,
|
|
pub flag1: u16,
|
|
pub flag2: u16,
|
|
#[brw(pad_after = 4)] // empty
|
|
#[br(map = read_packed_position)]
|
|
#[bw(map = write_packed_position)]
|
|
pub position: Position,
|
|
}
|