1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-05-13 07:07:45 +00:00

Propagate pose changes to other players

Building off of the previous propagation work, your current pose is sent
to other players now too.
This commit is contained in:
Joshua Goins 2025-05-08 23:03:51 -04:00
parent fd1fbe7188
commit 88e02452c4
3 changed files with 51 additions and 1 deletions

View file

@ -41,6 +41,12 @@ pub enum ActorControlCategory {
#[brw(pad_before = 22)] // actually full of info, and 2 bytes of padding at the beginning
actor_id: u32,
},
#[brw(magic = 0x127u16)]
Pose {
#[brw(pad_before = 2)] //padding
unk1: u32,
pose: u32,
},
}
#[binrw]

View file

@ -12,6 +12,18 @@ pub enum ClientTriggerCommand {
Unk1 {},
#[brw(magic = 0xC9u16)]
Unk2 {},
#[brw(magic = 0x1F9u16)]
ChangePose {
#[brw(pad_before = 2)] // padding
unk1: u32,
pose: u32,
},
#[brw(magic = 0x1FAu16)]
ReapplyPose {
#[brw(pad_before = 2)] // padding
unk1: u32,
pose: u32,
},
}
#[binrw]

View file

@ -3,7 +3,9 @@ use tokio::sync::mpsc::Receiver;
use crate::{
common::ObjectId,
ipc::zone::{ActorControlCategory, ActorControlTarget, ClientTriggerCommand, CommonSpawn},
ipc::zone::{
ActorControl, ActorControlCategory, ActorControlTarget, ClientTriggerCommand, CommonSpawn,
},
};
use super::{Actor, ClientHandle, ClientId, FromServer, ToServer};
@ -142,6 +144,36 @@ pub async fn server_main_loop(mut recv: Receiver<ToServer>) -> Result<(), std::i
to_remove.push(id);
}
}
ClientTriggerCommand::ChangePose { unk1, pose } => {
let msg = FromServer::ActorControl(
from_actor_id,
ActorControl {
category: ActorControlCategory::Pose {
unk1: *unk1,
pose: *pose,
},
},
);
if handle.send(msg).is_err() {
to_remove.push(id);
}
}
ClientTriggerCommand::ReapplyPose { unk1, pose } => {
let msg = FromServer::ActorControl(
from_actor_id,
ActorControl {
category: ActorControlCategory::Pose {
unk1: *unk1,
pose: *pose,
},
},
);
if handle.send(msg).is_err() {
to_remove.push(id);
}
}
_ => tracing::warn!("Server doesn't know what to do with {:#?}", trigger),
}
}