Open source remastering of the Freespace 2 engine
multiutil.cpp File Reference
#include <ctype.h>
#include "globalincs/pstypes.h"
#include "network/multiutil.h"
#include "globalincs/linklist.h"
#include "gamesequence/gamesequence.h"
#include "hud/hudmessage.h"
#include "freespace2/freespace.h"
#include "io/key.h"
#include "io/timer.h"
#include "ship/ship.h"
#include "globalincs/alphacolors.h"
#include "graphics/font.h"
#include "gamesnd/gamesnd.h"
#include "playerman/player.h"
#include "mission/missionparse.h"
#include "missionui/missionshipchoice.h"
#include "network/stand_gui.h"
#include "ship/shipfx.h"
#include "object/object.h"
#include "playerman/managepilot.h"
#include "missionui/missiondebrief.h"
#include "observer/observer.h"
#include "mission/missionmessage.h"
#include "popup/popup.h"
#include "popup/popupdead.h"
#include "hud/hudconfig.h"
#include "menuui/optionsmenu.h"
#include "mission/missionhotkey.h"
#include "mission/missiongoals.h"
#include "ship/afterburner.h"
#include "missionui/chatbox.h"
#include "osapi/osregistry.h"
#include "hud/hudescort.h"
#include "network/multi.h"
#include "cmdline/cmdline.h"
#include "cfile/cfile.h"
#include "cfile/cfilesystem.h"
#include "network/multimsgs.h"
#include "network/multi_xfer.h"
#include "network/multiteamselect.h"
#include "network/multiui.h"
#include "network/multi_kick.h"
#include "network/multi_data.h"
#include "network/multi_voice.h"
#include "network/multi_team.h"
#include "network/multi_respawn.h"
#include "network/multi_ingame.h"
#include "network/multi_observer.h"
#include "network/multi_pinfo.h"
#include "network/multi_endgame.h"
#include "network/multi_pmsg.h"
#include "network/multi_pause.h"
#include "network/multi_log.h"
#include "network/multi_rate.h"
#include "fs2netd/fs2netd_client.h"
#include "parse/parselo.h"
#include "debugconsole/console.h"

Go to the source code of this file.


#define MAX_SHIPS_PER_QUERY   10
#define NUM_DEATH_WORDS   40
#define MAX_CHAT_PHRASE_LEN   25
#define INACTIVE_LIMIT_NORMAL   (15 * F1_0)
#define INACTIVE_LIMIT_WAIT   (20 * F1_0)
#define MULTI_LAG_VAL   400
#define D_SCALE   32768.0f
#define D_MAX_RANGE   32767
#define D_MIN_RANGE   -32768
#define N_SCALE   2048.0f
#define N_MAX_RANGE   2047
#define N_MIN_RANGE   -2048


ushort multi_assign_network_signature (int what_kind)
ushort multi_get_next_network_signature (int what_kind)
void multi_set_network_signature (ushort signature, int what_kind)
objectmulti_get_network_object (ushort net_signature)
ushort netmisc_calc_checksum (void *vptr, int len)
const char * multi_random_death_word ()
const char * multi_random_chat_start ()
int multi_ship_class_lookup (const char *ship_name)
int find_player (net_addr *addr)
int find_player_no_port (net_addr *addr)
int find_player_id (short player_id)
int find_player_socket (PSNET_SOCKET_RELIABLE sock)
int multi_find_player_by_object (object *objp)
int multi_find_player_by_signature (int signature)
int multi_find_player_by_net_signature (ushort net_signature)
int multi_find_player_by_parse_object (p_object *p_objp)
int multi_find_player_by_ship_name (const char *ship_name, bool inc_respawning)
int multi_get_player_ship (int np_index)
int multi_find_open_netplayer_slot ()
int multi_find_open_player_slot ()
void stuff_netplayer_info (net_player *nplayer, net_addr *addr, int ship_class, player *pplayer)
void multi_assign_player_ship (int net_player_num, object *objp, int ship_class)
int multi_create_player (int net_player_num, player *pl, const char *name, net_addr *addr, int ship_class, short id)
void multi_make_player_ai (object *pobj)
void delete_player (int player_num, int kicked_reason)
void multi_cull_zombies ()
void fill_net_addr (net_addr *addr, ubyte *address, ushort port)
char * get_text_address (char *text, ubyte *address)
void multi_pack_orient_matrix (ubyte *data, matrix *m)
void multi_unpack_orient_matrix (ubyte *data, matrix *m)
void multi_do_client_warp (float frame_time)
int lookup_ship_status (net_player *p, int unique_id, int remove)
void remove_ship_status_item (net_player *p, int id)
void add_net_button_info (net_player *p, button_info *bi, int unique_id)
int button_function_critical (int n, net_player *p=NULL)
void multi_apply_ship_status (net_player *p, button_info *bi, int locally)
void multi_maybe_send_ship_status ()
void multi_subsys_update_all ()
int multi_find_player_by_callsign (const char *callsign)
int multi_is_builtin_mission ()
void server_verify_filesig (short player_id, ushort sum_sig, int length_sig)
int server_all_filesigs_ok ()
void multi_untag_player_ships ()
void multi_broadcast_stats (int stats_code)
int multi_netplayer_state_check (int state, int ignore_standalone)
int multi_netplayer_state_check2 (int state, int state2, int ignore_standalone)
int multi_netplayer_state_check3 (int state, int state2, int state3, int ignore_standalone)
int multi_netplayer_flag_check (int flags, int ignore_standalone)
void multi_eval_socket_error (PSNET_SOCKET sock, int error)
void multi_maybe_send_repair_info (object *dest_objp, object *source_objp, int code)
int multi_is_valid_unknown_packet (ubyte type)
void multi_create_standalone_object ()
int multi_message_should_broadcast (int type)
active_gamemulti_new_active_game (void)
active_gamemulti_update_active_games (active_game *ag)
void multi_free_active_games ()
server_itemmulti_new_server_item (void)
void multi_free_server_list ()
int multi_num_players ()
int multi_num_observers ()
int multi_num_connections ()
int multi_can_message (net_player *p)
int multi_can_end_mission (net_player *p)
int multi_eval_join_request (join_request *jr, net_addr *addr)
void multi_handle_sudden_mission_end ()
void multi_warpout_all_players ()
int multi_get_highest_rank ()
void multi_handle_end_mission_request ()
void multi_handle_state_special ()
void multi_file_xfer_notify (int handle)
int multi_query_lag_status ()
void multi_process_valid_join_request (join_request *jr, net_addr *who_from, int ingame_join_team)
int multi_process_restricted_keys (int k)
void multi_player_ships_available (int *team_0, int *team_1)
void multi_server_update_player_weapons (net_player *pl, ship *shipp)
void multi_flush_multidata_cache ()
void multi_flush_mission_stuff ()
int multi_ignore_controls (int key)
int multi_kill_limit_reached ()
void multi_display_chat_msg (const char *msg, int player_index, int add_id)
void multi_get_mission_checksum (const char *filename)
char multi_unit_to_char (float unit)
float multi_char_to_unit (float val)
int multi_show_ingame_ping ()
int multi_get_connection_speed ()
int multi_string_to_status (char *valid_string)
void multi_update_valid_missions ()
short multi_get_new_id ()
void bitbuffer_init (bitbuffer *bitbuf, ubyte *data)
int bitbuffer_write_flush (bitbuffer *bitbuf)
int bitbuffer_read_flush (bitbuffer *bitbuf)
void bitbuffer_put (bitbuffer *bitbuf, uint data, int bit_count)
uint bitbuffer_get_unsigned (bitbuffer *bitbuf, int bit_count)
int bitbuffer_get_signed (bitbuffer *bitbuf, int bit_count)
int multi_pack_unpack_position (int write, ubyte *data, vec3d *pos)
int multi_pack_unpack_orient (int write, ubyte *data, matrix *orient)
int multi_pack_unpack_vel (int write, ubyte *data, matrix *orient, vec3d *pos, physics_info *pi)
int multi_pack_unpack_desired_vel (int write, ubyte *data, matrix *orient, vec3d *pos, physics_info *pi, ship_info *sip)
int multi_pack_unpack_rotvel (int write, ubyte *data, matrix *orient, vec3d *pos, physics_info *pi)
int multi_pack_unpack_desired_rotvel (int write, ubyte *data, matrix *orient, vec3d *pos, physics_info *pi, ship_info *sip)
void send_debrief_event ()
void multi_send_anti_timeout_ping ()


int ascii_table []
int shifted_ascii_table []
int Multi_ping_timestamp
ushort Next_ship_signature
ushort Next_asteroid_signature
ushort Next_non_perm_signature
ushort Next_debris_signature
int Multi_ship_status_stamp = -1
button_info Multi_ship_status_bi
int degenerate_count = 0
int non_degenerate_count = 0

Macro Definition Documentation

#define D_MAX_RANGE   32767
#define D_MIN_RANGE   -32768
#define D_SCALE   32768.0f
#define INACTIVE_LIMIT_NORMAL   (15 * F1_0)

Definition at line 1001 of file multiutil.cpp.

#define INACTIVE_LIMIT_WAIT   (20 * F1_0)

Definition at line 1002 of file multiutil.cpp.

#define MAX_CHAT_PHRASE_LEN   25

Definition at line 374 of file multiutil.cpp.

#define MAX_SHIPS_PER_QUERY   10

Definition at line 97 of file multiutil.cpp.


Definition at line 96 of file multiutil.cpp.

#define MULTI_LAG_VAL   400

Definition at line 2391 of file multiutil.cpp.


Definition at line 1238 of file multiutil.cpp.

#define N_MAX_RANGE   2047
#define N_MIN_RANGE   -2048
#define N_SCALE   2048.0f

Definition at line 373 of file multiutil.cpp.

#define NUM_DEATH_WORDS   40

Definition at line 275 of file multiutil.cpp.

Function Documentation

void add_net_button_info ( net_player p,
button_info bi,
int  unique_id 

Definition at line 1183 of file multiutil.cpp.

int bitbuffer_get_signed ( bitbuffer *  bitbuf,
int  bit_count 

Definition at line 3553 of file multiutil.cpp.

uint bitbuffer_get_unsigned ( bitbuffer *  bitbuf,
int  bit_count 

Definition at line 3528 of file multiutil.cpp.

void bitbuffer_init ( bitbuffer *  bitbuf,
ubyte data 

Definition at line 3487 of file multiutil.cpp.

void bitbuffer_put ( bitbuffer *  bitbuf,
uint  data,
int  bit_count 

Definition at line 3509 of file multiutil.cpp.

int bitbuffer_read_flush ( bitbuffer *  bitbuf)

Definition at line 3504 of file multiutil.cpp.

int bitbuffer_write_flush ( bitbuffer *  bitbuf)

Definition at line 3495 of file multiutil.cpp.

int button_function_critical ( int  n,
net_player p = NULL 

Definition at line 1724 of file keycontrol.cpp.

void delete_player ( int  player_num,
int  kicked_reason 

Definition at line 862 of file multiutil.cpp.

void fill_net_addr ( net_addr addr,
ubyte address,
ushort  port 

Definition at line 1049 of file multiutil.cpp.

int find_player ( net_addr addr)

Definition at line 431 of file multiutil.cpp.

int find_player_id ( short  player_id)

Definition at line 465 of file multiutil.cpp.

int find_player_no_port ( net_addr addr)

Definition at line 448 of file multiutil.cpp.

int find_player_socket ( PSNET_SOCKET_RELIABLE  sock)

Definition at line 482 of file multiutil.cpp.

char* get_text_address ( char *  text,
ubyte address 

Definition at line 1067 of file multiutil.cpp.

int lookup_ship_status ( net_player p,
int  unique_id,
int  remove 

Definition at line 1156 of file multiutil.cpp.

void multi_apply_ship_status ( net_player p,
button_info bi,
int  locally 

Definition at line 1212 of file multiutil.cpp.

ushort multi_assign_network_signature ( int  what_kind)

Definition at line 105 of file multiutil.cpp.

void multi_assign_player_ship ( int  net_player_num,
object objp,
int  ship_class 

Definition at line 681 of file multiutil.cpp.

void multi_broadcast_stats ( int  stats_code)

Definition at line 1419 of file multiutil.cpp.

int multi_can_end_mission ( net_player p)

Definition at line 1897 of file multiutil.cpp.

int multi_can_message ( net_player p)

Definition at line 1848 of file multiutil.cpp.

float multi_char_to_unit ( float  val)

Definition at line 2975 of file multiutil.cpp.

int multi_create_player ( int  net_player_num,
player pl,
const char *  name,
net_addr addr,
int  ship_class,
short  id 

Definition at line 728 of file multiutil.cpp.

void multi_create_standalone_object ( )

Definition at line 1569 of file multiutil.cpp.

void multi_cull_zombies ( )

Definition at line 1010 of file multiutil.cpp.

void multi_display_chat_msg ( const char *  msg,
int  player_index,
int  add_id 

Definition at line 2895 of file multiutil.cpp.

void multi_do_client_warp ( float  frame_time)

Definition at line 1140 of file multiutil.cpp.

int multi_eval_join_request ( join_request jr,
net_addr addr 

Definition at line 1946 of file multiutil.cpp.

void multi_eval_socket_error ( PSNET_SOCKET  sock,
int  error 

Definition at line 1506 of file multiutil.cpp.

void multi_file_xfer_notify ( int  handle)

Definition at line 2327 of file multiutil.cpp.

int multi_find_open_netplayer_slot ( )

Definition at line 621 of file multiutil.cpp.

int multi_find_open_player_slot ( )

Definition at line 647 of file multiutil.cpp.

int multi_find_player_by_callsign ( const char *  callsign)

Definition at line 1291 of file multiutil.cpp.

int multi_find_player_by_net_signature ( ushort  net_signature)

Definition at line 537 of file multiutil.cpp.

int multi_find_player_by_object ( object objp)

Definition at line 500 of file multiutil.cpp.

int multi_find_player_by_parse_object ( p_object p_objp)

Definition at line 554 of file multiutil.cpp.

int multi_find_player_by_ship_name ( const char *  ship_name,
bool  inc_respawning 

Definition at line 570 of file multiutil.cpp.

int multi_find_player_by_signature ( int  signature)

Definition at line 520 of file multiutil.cpp.

void multi_flush_mission_stuff ( )

Definition at line 2787 of file multiutil.cpp.

void multi_flush_multidata_cache ( )

Definition at line 2778 of file multiutil.cpp.

void multi_free_active_games ( )

Definition at line 1739 of file multiutil.cpp.

void multi_free_server_list ( )

Definition at line 1781 of file multiutil.cpp.

int multi_get_connection_speed ( )

Definition at line 2999 of file multiutil.cpp.

int multi_get_highest_rank ( )

Definition at line 2201 of file multiutil.cpp.

void multi_get_mission_checksum ( const char *  filename)

Definition at line 2921 of file multiutil.cpp.

object* multi_get_network_object ( ushort  net_signature)

Definition at line 220 of file multiutil.cpp.

short multi_get_new_id ( )

Definition at line 3167 of file multiutil.cpp.

ushort multi_get_next_network_signature ( int  what_kind)

Definition at line 168 of file multiutil.cpp.

int multi_get_player_ship ( int  np_index)

Definition at line 599 of file multiutil.cpp.

void multi_handle_end_mission_request ( )

Definition at line 2218 of file multiutil.cpp.

void multi_handle_state_special ( )

Definition at line 2253 of file multiutil.cpp.

void multi_handle_sudden_mission_end ( )

Definition at line 2135 of file multiutil.cpp.

int multi_ignore_controls ( int  key)

Definition at line 2845 of file multiutil.cpp.

int multi_is_builtin_mission ( )

Definition at line 1304 of file multiutil.cpp.

int multi_is_valid_unknown_packet ( ubyte  type)

Definition at line 1563 of file multiutil.cpp.

int multi_kill_limit_reached ( )

Definition at line 2872 of file multiutil.cpp.

void multi_make_player_ai ( object pobj)

Definition at line 842 of file multiutil.cpp.

void multi_maybe_send_repair_info ( object dest_objp,
object source_objp,
int  code 

Definition at line 1551 of file multiutil.cpp.

void multi_maybe_send_ship_status ( )

Definition at line 1242 of file multiutil.cpp.

int multi_message_should_broadcast ( int  type)

Definition at line 1605 of file multiutil.cpp.

int multi_netplayer_flag_check ( int  flags,
int  ignore_standalone 

Definition at line 1486 of file multiutil.cpp.

int multi_netplayer_state_check ( int  state,
int  ignore_standalone 

Definition at line 1433 of file multiutil.cpp.

int multi_netplayer_state_check2 ( int  state,
int  state2,
int  ignore_standalone 

Definition at line 1450 of file multiutil.cpp.

int multi_netplayer_state_check3 ( int  state,
int  state2,
int  state3,
int  ignore_standalone 

Definition at line 1467 of file multiutil.cpp.

active_game* multi_new_active_game ( void  )

Definition at line 1621 of file multiutil.cpp.

server_item* multi_new_server_item ( void  )

Definition at line 1758 of file multiutil.cpp.

int multi_num_connections ( )

Definition at line 1832 of file multiutil.cpp.

int multi_num_observers ( )

Definition at line 1815 of file multiutil.cpp.

int multi_num_players ( )

Definition at line 1799 of file multiutil.cpp.

void multi_pack_orient_matrix ( ubyte data,
matrix m 

Definition at line 1089 of file multiutil.cpp.

int multi_pack_unpack_desired_rotvel ( int  write,
ubyte data,
matrix orient,
vec3d pos,
physics_info pi,
ship_info sip 

Definition at line 4081 of file multiutil.cpp.

int multi_pack_unpack_desired_vel ( int  write,
ubyte data,
matrix orient,
vec3d pos,
physics_info pi,
ship_info sip 

Definition at line 3941 of file multiutil.cpp.

int multi_pack_unpack_orient ( int  write,
ubyte data,
matrix orient 

Definition at line 3677 of file multiutil.cpp.

int multi_pack_unpack_position ( int  write,
ubyte data,
vec3d pos 

Definition at line 3586 of file multiutil.cpp.

int multi_pack_unpack_rotvel ( int  write,
ubyte data,
matrix orient,
vec3d pos,
physics_info pi 

Definition at line 4041 of file multiutil.cpp.

int multi_pack_unpack_vel ( int  write,
ubyte data,
matrix orient,
vec3d pos,
physics_info pi 

Definition at line 3893 of file multiutil.cpp.

void multi_player_ships_available ( int team_0,
int team_1 

Definition at line 2711 of file multiutil.cpp.

int multi_process_restricted_keys ( int  k)

Definition at line 2609 of file multiutil.cpp.

void multi_process_valid_join_request ( join_request jr,
net_addr who_from,
int  ingame_join_team 

Definition at line 2416 of file multiutil.cpp.

int multi_query_lag_status ( )

Definition at line 2392 of file multiutil.cpp.

const char* multi_random_chat_start ( )

Definition at line 376 of file multiutil.cpp.

const char* multi_random_death_word ( )

Definition at line 277 of file multiutil.cpp.

void multi_send_anti_timeout_ping ( )

Definition at line 4171 of file multiutil.cpp.

void multi_server_update_player_weapons ( net_player pl,
ship shipp 

Definition at line 2737 of file multiutil.cpp.

void multi_set_network_signature ( ushort  signature,
int  what_kind 

Definition at line 198 of file multiutil.cpp.

int multi_ship_class_lookup ( const char *  ship_name)

Definition at line 409 of file multiutil.cpp.

int multi_show_ingame_ping ( )

Definition at line 2993 of file multiutil.cpp.

int multi_string_to_status ( char *  valid_string)

Definition at line 3028 of file multiutil.cpp.

void multi_subsys_update_all ( )

Definition at line 1279 of file multiutil.cpp.

char multi_unit_to_char ( float  unit)

Definition at line 2958 of file multiutil.cpp.

void multi_unpack_orient_matrix ( ubyte data,
matrix m 

Definition at line 1113 of file multiutil.cpp.

void multi_untag_player_ships ( )

Definition at line 1404 of file multiutil.cpp.

active_game* multi_update_active_games ( active_game ag)

Definition at line 1649 of file multiutil.cpp.

void multi_update_valid_missions ( )

Definition at line 3041 of file multiutil.cpp.

void multi_warpout_all_players ( )

Definition at line 2143 of file multiutil.cpp.

ushort netmisc_calc_checksum ( void vptr,
int  len 

Definition at line 252 of file multiutil.cpp.

void remove_ship_status_item ( net_player p,
int  id 

Definition at line 1172 of file multiutil.cpp.

void send_debrief_event ( )

Definition at line 4159 of file multiutil.cpp.

int server_all_filesigs_ok ( )

Definition at line 1389 of file multiutil.cpp.

void server_verify_filesig ( short  player_id,
ushort  sum_sig,
int  length_sig 

Definition at line 1324 of file multiutil.cpp.

void stuff_netplayer_info ( net_player nplayer,
net_addr addr,
int  ship_class,
player pplayer 

Definition at line 664 of file multiutil.cpp.

Variable Documentation

int ascii_table[]

Definition at line 72 of file key.cpp.

int degenerate_count = 0

Definition at line 3626 of file multiutil.cpp.

int Multi_ping_timestamp

Definition at line 30 of file fredstubs.cpp.

button_info Multi_ship_status_bi

Definition at line 1240 of file multiutil.cpp.

int Multi_ship_status_stamp = -1

Definition at line 1239 of file multiutil.cpp.

ushort Next_asteroid_signature

Definition at line 89 of file multiutil.cpp.

ushort Next_debris_signature

Definition at line 91 of file multiutil.cpp.

ushort Next_non_perm_signature

Definition at line 90 of file multiutil.cpp.

ushort Next_ship_signature

Definition at line 88 of file multiutil.cpp.

int non_degenerate_count = 0

Definition at line 3627 of file multiutil.cpp.

int shifted_ascii_table[]

Definition at line 83 of file key.cpp.