Пример #1
0
// blit the pilot squadron logo
void multi_pinfo_blit_squadron_logo()
{
	char place_text[100];
	int w;
	player* p = Multi_pinfo_popup_player->m_player;

	// if we don't have a bitmap handle, blit a placeholder
	if (Mp_squad.bitmap == -1)
	{
		gr_set_color_fast(&Color_normal);

		// if there is no image
		if (strlen(p->squad_filename) <= 0)
		{
			strcpy_s(place_text, XSTR("No/Invalid Image", 1053));
		}
			// if the image is xferring
		else if (multi_xfer_lookup(p->squad_filename))
		{
			strcpy_s(place_text, XSTR("Image Transferring", 691));
		}
			// if we're not accepting images
		else if (!(Net_player->p_info.options.flags & MLO_FLAG_ACCEPT_PIX) || !(Netgame.options.flags &
																				MSO_FLAG_ACCEPT_PIX))
		{
			strcpy_s(place_text, XSTR("No Image", 692));
		}
			// otherwise we wait
		else
		{
			strcpy_s(place_text, XSTR("Waiting", 690));
		}

		// center the text
		gr_get_string_size(&w, NULL, place_text);
		gr_string(Multi_pinfo_squad_coords[gr_screen.res][0] + ((Multi_pinfo_squad_coords[gr_screen.res][2] - w) / 2),
			Multi_pinfo_squad_coords[gr_screen.res][1], place_text);
	}
		// otherwise blit the bitmap
	else
	{
		gr_set_bitmap(Mp_squad.bitmap);
		// gr_bitmap(MPI_SQUAD_X, MPI_SQUAD_Y);

		// get width and heigh
		int bm_w, bm_h;
		bm_get_info(Mp_squad.bitmap, &bm_w, &bm_h, NULL, NULL, NULL);

		gr_bitmap(Multi_pinfo_squad_coords[gr_screen.res][0] + ((Multi_pinfo_squad_coords[gr_screen.res][2] - bm_w) /
																2),
			Multi_pinfo_squad_coords[gr_screen.res][1] + ((Multi_pinfo_squad_coords[gr_screen.res][3] - bm_h) / 2));
		// g3_draw_2d_poly_bitmap(Multi_pinfo_squad_coords[gr_screen.res][0], Multi_pinfo_squad_coords[gr_screen.res][1], Multi_pinfo_squad_coords[gr_screen.res][2], Multi_pinfo_squad_coords[gr_screen.res][3]);
	}
}
Пример #2
0
// do all sync related data stuff (server-side only)
void multi_data_do()
{
	int idx, p_idx;

	// only do this once a second
	if ((time(NULL) - Multi_data_time) < 1)
	{
		return;
	}

	// maybe try and reload player squad logo bitmaps
	multi_data_maybe_reload();

	// reset the time
	Multi_data_time = time(NULL);

	// if I'm the server
	if (Net_player && (Net_player->flags & NETINFO_FLAG_AM_MASTER))
	{
		// for all valid files
		for (idx = 0; idx < MAX_MULTI_DATA; idx++)
		{
			// a valid file that isn't currently xferring (ie, anything we've got completely on our hard drive)
			if (Multi_data[idx].used && (multi_xfer_lookup(Multi_data[idx].filename) < 0))
			{
				// send it to all players who need it
				for (p_idx = 0; p_idx < MAX_PLAYERS; p_idx++)
				{
					// if he doesn't have it
					if ((Net_player != &Net_players[p_idx]) &&
						MULTI_CONNECTED(Net_players[p_idx]) && (Net_players[p_idx].reliable_socket !=
																INVALID_SOCKET) &&
						(Multi_data[idx].status[p_idx] == 0))
					{
						// queue up the file to send to him, or at least try to
						if (multi_xfer_send_file(Net_players[p_idx].reliable_socket, Multi_data[idx].filename,
							CF_TYPE_ANY, MULTI_XFER_FLAG_AUTODESTROY | MULTI_XFER_FLAG_QUEUE) < 0)
						{
							nprintf(("Network", "Failed to send data file! Trying again later...\n"));
						}
						else
						{
							// mark his status
							Multi_data[idx].status[p_idx] = 1;
						}
					}
				}
			}
		}
	}
}