Add imgui golf mode overlay

This commit is contained in:
Techjar
2019-04-02 17:13:42 -04:00
parent 1a12876330
commit 6c393f9ff4
13 changed files with 156 additions and 10 deletions

View File

@ -2108,15 +2108,19 @@ void NetPlayClient::RequestGolfControl()
RequestGolfControl(m_local_player->pid);
}
// called from ---GUI--- thread
std::string NetPlayClient::GetCurrentGolfer()
{
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
if (m_players.count(m_current_golfer))
return m_players[m_current_golfer].name;
return "";
}
// called from ---GUI--- thread
bool NetPlayClient::LocalPlayerHasControllerMapped() const
{
const auto mapping_matches_player_id = [this](const PlayerId& mapping) {
return mapping == m_local_player->pid;
};
return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
return PlayerHasControllerMapped(m_local_player->pid);
}
bool NetPlayClient::IsFirstInGamePad(int ingame_pad) const
@ -2169,6 +2173,19 @@ int NetPlayClient::LocalPadToInGamePad(int local_pad) const
return ingame_pad;
}
bool NetPlayClient::PlayerHasControllerMapped(const PlayerId pid) const
{
const auto mapping_matches_player_id = [pid](const PlayerId& mapping) { return mapping == pid; };
return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
}
bool NetPlayClient::IsLocalPlayer(const PlayerId pid) const
{
return pid == m_local_player->pid;
}
void NetPlayClient::SendTimeBase()
{
std::lock_guard<std::mutex> lk(crit_netplay_client);