use crate::bitbuf::BitWriter;
use crate::math::QAngle;
use crate::net::EncodeError;
use crate::user_messages::UserMessage;
use std::ffi::CStr;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ForcePlayerViewAngles {
pub player: u8,
pub angles: QAngle,
}
impl UserMessage for ForcePlayerViewAngles {
fn name(&self) -> &CStr {
c"ForcePlayerViewAngles"
}
fn write(&self, out: &mut BitWriter) -> Result<(), EncodeError> {
out.write_u8(1);
out.write_u8(self.player);
out.write_bit_angles(self.angles);
Ok(())
}
}
#[doc(alias("HudNotifyCustom", "SendHudNotification", "game_text_tf"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct HudNotification<'a> {
pub text: &'a CStr,
pub icon: &'a CStr,
pub team: u8,
}
impl UserMessage for HudNotification<'_> {
fn name(&self) -> &CStr {
c"HudNotifyCustom"
}
fn write(&self, out: &mut BitWriter) -> Result<(), EncodeError> {
out.write_cstr(self.text);
out.write_cstr(self.icon);
out.write_u8(self.team);
Ok(())
}
}