1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-11 00:17:44 +00:00
kawari/src/ipc/zone/move.rs
Joshua Goins f338530e6d Fix rotations sent to other players
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!
2025-05-08 21:52:50 -04:00

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,
}