Esempio n. 1
0
/**
 * netplay_flip_users:
 * @netplay              : pointer to netplay object
 *
 * On regular netplay, flip who controls user 1 and 2.
 **/
void netplay_flip_users(netplay_t *netplay)
{
    uint32_t flip_frame = netplay->frame_count + 2 * UDP_FRAME_PACKETS;
    uint32_t flip_frame_net = htonl(flip_frame);
    bool command = netplay_command(
                       netplay, NETPLAY_CMD_FLIP_PLAYERS,
                       &flip_frame_net, sizeof flip_frame_net,
                       CMD_OPT_HOST_ONLY | CMD_OPT_REQUIRE_SYNC,
                       "flip users", "Succesfully flipped users.\n");

    if(command)
    {
        netplay->flip       ^= true;
        netplay->flip_frame  = flip_frame;
    }
}
Esempio n. 2
0
/**
 * netplay_flip_users:
 * @netplay              : pointer to netplay object
 *
 * On regular netplay, flip who controls user 1 and 2.
 **/
static void netplay_flip_users(netplay_t *netplay)
{
   /* Must be in the future because we may have already sent this frame's data */
   uint32_t     flip_frame = netplay->self_frame_count + 1;
   uint32_t flip_frame_net = htonl(flip_frame);
   bool            command = netplay_command(
      netplay, NETPLAY_CMD_FLIP_PLAYERS,
      &flip_frame_net, sizeof flip_frame_net,
      CMD_OPT_HOST_ONLY | CMD_OPT_REQUIRE_SYNC,
      "flip users", "Successfully flipped users.\n");

   if(command)
   {
      netplay->flip       ^= true;
      netplay->flip_frame  = flip_frame;
   }
}