#![allow(unused_imports)]
use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
use crate::omp::types::{
Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
UID, Vector2, Vector3, Vector4, WorldTimePoint,
};
use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
use crate::omp::*;
slots! {
SLOT_ENTRIES: usize = 6, 5;
SLOT_PLAYERS: usize = 7, 6;
SLOT_BOTS: usize = 8, 7;
SLOT_GET_POOL_EVENT_DISPATCHER: usize = 19, 18;
SLOT_IS_NAME_TAKEN: usize = 20, 19;
SLOT_SEND_CLIENT_MESSAGE_TO_ALL: usize = 21, 20;
SLOT_SEND_CHAT_MESSAGE_TO_ALL: usize = 22, 21;
SLOT_SEND_GAME_TEXT_TO_ALL: usize = 23, 22;
SLOT_HIDE_GAME_TEXT_FOR_ALL: usize = 24, 23;
SLOT_SEND_DEATH_MESSAGE_TO_ALL: usize = 25, 24;
SLOT_SEND_EMPTY_DEATH_MESSAGE_TO_ALL: usize = 26, 25;
SLOT_CREATE_EXPLOSION_FOR_ALL: usize = 27, 26;
SLOT_REQUEST_PLAYER: usize = 28, 27;
SLOT_BROADCAST_PACKET: usize = 29, 28;
SLOT_BROADCAST_RPC: usize = 30, 29;
SLOT_IS_NAME_VALID: usize = 31, 30;
SLOT_ALLOW_NICK_NAME_CHARACTER: usize = 32, 31;
SLOT_IS_NICK_NAME_CHARACTER_ALLOWED: usize = 33, 32;
SLOT_GET_DEFAULT_COLOUR: usize = 34, 33;
}
virtual_fns! {
#[must_use]
pub fn players_entries(
pool: IPlayerPool,
) -> *const FlatSet<IPlayer> = [0, SLOT_ENTRIES] or std::ptr::null();
#[must_use]
pub fn players_players(
pool: IPlayerPool,
) -> *const FlatSet<IPlayer> = [0, SLOT_PLAYERS] or std::ptr::null();
#[must_use]
pub fn players_bots(
pool: IPlayerPool,
) -> *const FlatSet<IPlayer> = [0, SLOT_BOTS] or std::ptr::null();
#[must_use]
pub fn players_pool_event_dispatcher(
pool: IPlayerPool,
) -> *mut EventDispatcher<PlayerPoolHandler> = [0, SLOT_GET_POOL_EVENT_DISPATCHER] or std::ptr::null_mut();
#[must_use]
pub fn players_is_name_taken(
pool: IPlayerPool,
name: StringView,
skip: *mut IPlayer,
) -> bool = [0, SLOT_IS_NAME_TAKEN] or false;
pub fn players_send_client_message_to_all(
pool: IPlayerPool,
colour: &Colour,
message: StringView,
) = [0, SLOT_SEND_CLIENT_MESSAGE_TO_ALL];
pub fn players_send_chat_message_to_all(
pool: IPlayerPool,
from: *mut IPlayer,
message: StringView,
) = [0, SLOT_SEND_CHAT_MESSAGE_TO_ALL];
pub fn players_send_game_text_to_all(
pool: IPlayerPool,
message: StringView,
time: Milliseconds,
style: i32,
) = [0, SLOT_SEND_GAME_TEXT_TO_ALL];
pub fn players_hide_game_text_for_all(
pool: IPlayerPool,
style: i32,
) = [0, SLOT_HIDE_GAME_TEXT_FOR_ALL];
pub fn players_send_death_message_to_all(
pool: IPlayerPool,
killer: *mut IPlayer,
killee: *mut IPlayer,
weapon: i32,
) = [0, SLOT_SEND_DEATH_MESSAGE_TO_ALL];
pub fn players_send_empty_death_message_to_all(
pool: IPlayerPool,
) = [0, SLOT_SEND_EMPTY_DEATH_MESSAGE_TO_ALL];
pub fn players_create_explosion_for_all(
pool: IPlayerPool,
vec: Vector3,
type_value: i32,
radius: f32,
) = [0, SLOT_CREATE_EXPLOSION_FOR_ALL];
pub fn players_broadcast_packet(
pool: IPlayerPool,
data: Span<u8>,
channel: i32,
skip_from: *mut IPlayer,
dispatch_events: bool,
) = [0, SLOT_BROADCAST_PACKET];
pub fn players_broadcast_rpc(
pool: IPlayerPool,
id: i32,
data: Span<u8>,
channel: i32,
skip_from: *mut IPlayer,
dispatch_events: bool,
) = [0, SLOT_BROADCAST_RPC];
#[must_use]
pub fn players_is_name_valid(
pool: IPlayerPool,
name: StringView,
) -> bool = [0, SLOT_IS_NAME_VALID] or false;
pub fn players_allow_nick_name_character(
pool: IPlayerPool,
character: i8,
allow: bool,
) = [0, SLOT_ALLOW_NICK_NAME_CHARACTER];
#[must_use]
pub fn players_is_nick_name_character_allowed(
pool: IPlayerPool,
character: i8,
) -> bool = [0, SLOT_IS_NICK_NAME_CHARACTER_ALLOWED] or false;
}
#[must_use]
pub unsafe fn players_request_player(
pool: *mut IPlayerPool,
net_data: &PeerNetworkData,
params: &PeerRequestParams,
) -> Option<Pair<i32, *mut IPlayer>> {
call_vtable_small_struct!(pool.cast::<u8>(), 0, SLOT_REQUEST_PLAYER, Pair<i32, *mut IPlayer>, unsafe { std::mem::zeroed::<Pair<i32, *mut IPlayer>>() }, (&PeerNetworkData, &PeerRequestParams) (net_data, params))
}
#[must_use]
pub unsafe fn players_default_colour(pool: *mut IPlayerPool, pid: i32) -> Option<Colour> {
call_vtable_small_struct!(
pool.cast::<u8>(),
0,
SLOT_GET_DEFAULT_COLOUR,
Colour,
Colour::default(),
(i32)(pid)
)
}