Ejemplo n.º 1
0
// send a broadcast pack indicating a player has respawned
void multi_respawn_broadcast(net_player *np)
{
	ubyte data[50],val;
	int packet_size = 0;
	ushort signature;
	vector pos;

	// broadcast the packet to all players
	Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);

	signature = Objects[np->player->objnum].net_signature;
	pos = Objects[np->player->objnum].pos;

	// build the header and add the opcode
	BUILD_HEADER(RESPAWN_NOTICE);
	val = RESPAWN_BROADCAST;
	ADD_DATA(val);

	// add the data for the respawn
	ADD_USHORT(signature);
    add_vector_data( data, &packet_size, pos );
	ADD_SHORT(np->player_id);
	ADD_DATA(np->s_info.cur_primary_bank);
	ADD_DATA(np->s_info.cur_secondary_bank);
	ADD_DATA(np->s_info.cur_link_status);
	ADD_USHORT(np->s_info.ship_ets);
	ADD_STRING(np->p_info.p_objp->name);

	Assert( np->s_info.ship_ets != 0 );		// find dave or allender

	multi_io_send_to_all_reliable(data, packet_size);
}
Ejemplo n.º 2
0
// send a request to respawn an AI object
void multi_respawn_send_ai_respawn( ushort net_signature )
{
	ubyte data[50],val;
	int packet_size = 0;

	// build the header and add the opcode
	BUILD_HEADER(RESPAWN_NOTICE);
	val = AI_RESPAWN_NOTICE;
	ADD_DATA(val);
	ADD_USHORT( net_signature );

	// broadcast the packet to all players
	Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);
	multi_io_send_to_all_reliable(data, packet_size);	
}
Ejemplo n.º 3
0
// update everyone on the current netgame options
void multi_options_update_netgame()
{
	ubyte data[MAX_PACKET_SIZE],code;
	int packet_size = 0;
	
	Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST);

	// build the header and add the opcode
	BUILD_HEADER(OPTIONS_UPDATE);
	code = MULTI_OPTION_SERVER;
	ADD_DATA(code);

	// add the netgame options
	add_server_options(data, &packet_size, &Netgame.options);

	// send the packet
	if(Net_player->flags & NETINFO_FLAG_AM_MASTER){
		multi_io_send_to_all_reliable(data, packet_size);
	} else {
		multi_io_send_reliable(Net_player, data, packet_size);
	}
}