diff --git a/data/textures/atlas.png b/data/textures/atlas.png index d4f80b35..c61a00cd 100755 Binary files a/data/textures/atlas.png and b/data/textures/atlas.png differ diff --git a/data/textures/atlas.xcf b/data/textures/atlas.xcf index 3bc60123..3bc57526 100755 Binary files a/data/textures/atlas.xcf and b/data/textures/atlas.xcf differ diff --git a/src/hacks/Radar.cpp b/src/hacks/Radar.cpp index 677c3117..aeb11dad 100644 --- a/src/hacks/Radar.cpp +++ b/src/hacks/Radar.cpp @@ -69,6 +69,7 @@ static std::vector> tx_class{}; static std::vector tx_teams{}; static std::vector tx_items{}; static std::vector tx_buildings{}; +static std::vector tx_sentry{}; void DrawEntity(int x, int y, CachedEntity *ent) { @@ -127,12 +128,16 @@ void DrawEntity(int x, int y, CachedEntity *ent) } case CL_CLASS(CObjectSentrygun): { - tx_buildings[1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white); + int level = CE_INT(ent, netvar.iUpgradeLevel); + bool IsMini = CE_BYTE(ent, netvar.m_bMiniBuilding); + if (IsMini) + level = 4; + tx_sentry[level - 1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white); break; } case CL_CLASS(CObjectTeleporter): { - tx_buildings[2].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white); + tx_buildings[1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white); break; } } @@ -244,8 +249,10 @@ static InitRoutine init([]() { for (int j = 0; j < 9; ++j) tx_class[i].push_back(textures::atlas().create_sprite(j * 64, 320 + i * 64, 64, 64)); } - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) tx_buildings.push_back(textures::atlas().create_sprite(576 + i * 64, 320, 64, 64)); + for (int i = 0; i < 4; i++) + tx_sentry.push_back(textures::atlas().create_sprite(640 + i * 64, 256, 64, 64)); logging::Info("Radar sprites loaded"); EC::Register(EC::Draw, Draw, "radar", EC::average); }); diff --git a/src/irc.cpp b/src/irc.cpp index 36a94ce3..194e5380 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -18,6 +18,7 @@ static settings::Int port("irc.port", "8080"); static settings::String commandandcontrol_channel("irc.cc.channel", ""); static settings::String commandandcontrol_password("irc.cc.password", ""); +static settings::Bool transfer_leader_on_kick("irc.cc.leader-transfer", "true"); static settings::Bool botonly("irc.cc.command-bot-only", "true"); static settings::Bool irc_party{ "irc.cc.party", "false" }; static settings::Bool answer_steam{ "irc.cc.respondparty", "false" }; @@ -314,8 +315,44 @@ int GetMaxParty() return partyable; } CatCommand debug_maxparty("debug_partysize", "Debug party size", []() { logging::Info("%d", GetMaxParty()); }); - +CatCommand debug_steamids("debug_steamids", "Debug steamids", []() { + for (auto &i : irc.getPeers()) + logging::Info("%u", i.second.steamid); +}); static Timer resize_party{}; + +void party_leader_pass() +{ + re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem(); + re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient(); + if (gc && !gc->BHaveLiveMatch() && pc->GetNumMembers() > 1) + { + CSteamID steamid; + pc->GetCurrentPartyLeader(steamid); + if (steamid.GetAccountID() == g_ISteamUser->GetSteamID().GetAccountID()) + { + std::vector valid_steam_ids = pc->GetPartySteamIDs(); + bool found = false; + for (auto &peer : irc.getPeers()) + { + if (found) + break; + if (peer.second.is_ingame) + { + for (auto &id : valid_steam_ids) + if (id == peer.second.steamid) + { + CSteamID steam(id, EUniverse::k_EUniversePublic, EAccountType::k_EAccountTypeIndividual); + pc->PromotePlayerToLeader(steam); + found = true; + break; + } + } + } + } + } +} + static void run() { if (!restarting) @@ -388,10 +425,13 @@ static void run() size = online_members; else size = -1; - state.party_size = size; - state.is_ingame = true; + state.party_size = size; + re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem(); + state.is_ingame = gc && gc->BHaveLiveMatch(); irc.setState(state); } + if (transfer_leader_on_kick) + party_leader_pass(); } }