コード例 #1
0
ファイル: commands.cpp プロジェクト: SCMapsAndMods/teippi
void Command_GameData(uint8_t *data, int net_player)
{
    if (*bw::in_lobby || net_player != 0)
        return;
    *bw::tileset = *(uint16_t *)(data + 0x1);
    *bw::map_width_tiles = *(uint16_t *)(data + 0x3);
    *bw::map_height_tiles = *(uint16_t *)(data + 0x5);
    memset(bw::temp_players.v(), 0, sizeof(Player) * Limits::Players);
    for (int i = 0; i < Limits::Players; i++)
    {
        Player *player = &bw::temp_players[i];
        player->id = i;
        player->storm_id = -1;
        player->type = data[0x7 + i];
        player->race = data[0x13 + i];
        player->team = data[0x2b + i];
    }
    if (IsTeamGame())
    {
        int player_id = 0;
        int players_per_team = GetTeamGameTeamSize();
        int team_count = 2;
        if (bw::game_data[0].got.game_type_id != 0xf) // Tvb
            team_count = *bw::team_game;
        for (int i = 0; i < team_count; i++)
        {
            for (int j = 0; j < players_per_team; j++)
            {
                if (!IsActivePlayer(player_id))
                    break;
                Player *player = &bw::temp_players[player_id];
                player->team = i + 1;
                player_id += 1;
            }
        }
    }
    memcpy(bw::player_types_unused.v(), data + 0x1f, 0xc);
    memcpy(bw::force_layout.v(), data + 0x2b, 0xc);
    memcpy(bw::user_select_slots.v(), data + 0x37, 0x8);
    if (!IsReplay())
        memcpy(bw::replay_user_select_slots.v(), data + 0x37, 0x8);
    int save_player_id = *bw::loaded_save ? *bw::loaded_local_player_id : 0;
    int save_unique_player_id = *bw::loaded_save ? *bw::loaded_local_unique_player_id : 0;
    int flags = *bw::own_net_player_flags;
    MakeJoinedGameCommand(flags, 1, save_player_id, save_unique_player_id, *bw::saved_seed, false);
    *bw::lobby_state = 3;
}
コード例 #2
0
static void __stdcall MakeJoinedGameCommand_Hook(uint32_t a, uint32_t b, uint32_t c,
        uint32_t d, uint32_t e, uint32_t f, bool create)
{
    MakeJoinedGameCommand(a, b, e, d, f, create);
}