Skip to content

Commit

Permalink
Fix host tab issues
Browse files Browse the repository at this point in the history
  • Loading branch information
g0aty committed Sep 12, 2024
1 parent b1e6287 commit 3e26dd3
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 141 deletions.
250 changes: 124 additions & 126 deletions gui/tabs/host_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,164 +328,162 @@ namespace HostTab {

static bool ejects = false, anonVotes = false, visualTasks = false;

if (openSettings) {
// AU v2022.8.24 has been able to change maps in lobby.
State.mapHostChoice = options.GetByte(app::ByteOptionNames__Enum::MapId);
if (State.mapHostChoice > 3)
State.mapHostChoice--;
State.mapHostChoice = std::clamp(State.mapHostChoice, 0, (int)MAP_NAMES.size() - 1);
auto gamemode = options.GetGameMode();

auto MakeBool = [&](const char* str, bool& v, BoolOptionNames__Enum opt) {
if (ToggleButton(str, &v)) {
options.SetBool(opt, v);
SyncAllSettings();
}
else v = options.GetBool(opt);
};
// AU v2022.8.24 has been able to change maps in lobby.
State.mapHostChoice = options.GetByte(app::ByteOptionNames__Enum::MapId);
if (State.mapHostChoice > 3)
State.mapHostChoice--;
State.mapHostChoice = std::clamp(State.mapHostChoice, 0, (int)MAP_NAMES.size() - 1);
auto gamemode = options.GetGameMode();

auto MakeBool = [&](const char* str, bool& v, BoolOptionNames__Enum opt) {
if (ToggleButton(str, &v)) {
options.SetBool(opt, v);
SyncAllSettings();
}
else v = options.GetBool(opt);
};

auto MakeInt = [&](const char* str, int& v, Int32OptionNames__Enum opt) {
if (ImGui::InputInt(str, &v)) {
options.SetInt(opt, v);
SyncAllSettings();
}
else v = options.GetInt(opt);
};
auto MakeInt = [&](const char* str, int& v, Int32OptionNames__Enum opt) {
if (ImGui::InputInt(str, &v)) {
options.SetInt(opt, v);
SyncAllSettings();
}
else v = options.GetInt(opt);
};

auto MakeFloat = [&](const char* str, float& v, FloatOptionNames__Enum opt) {
if (ImGui::InputFloat(str, &v)) {
options.SetFloat(opt, v);
SyncAllSettings();
}
else v = options.GetFloat(opt);
};
auto MakeFloat = [&](const char* str, float& v, FloatOptionNames__Enum opt) {
if (ImGui::InputFloat(str, &v)) {
options.SetFloat(opt, v);
SyncAllSettings();
}
else v = options.GetFloat(opt);
};

if (gamemode == GameModes__Enum::Normal || gamemode == GameModes__Enum::NormalFools) {
static int emergencyMeetings = 1, emergencyCooldown = 1, discussionTime = 1,
votingTime = 1, killDistance = 1, commonTasks = 1, shortTasks = 1, longTasks = 1, taskBarMode = 1;
if (gamemode == GameModes__Enum::Normal || gamemode == GameModes__Enum::NormalFools) {
static int emergencyMeetings = 1, emergencyCooldown = 1, discussionTime = 1,
votingTime = 1, killDistance = 1, commonTasks = 1, shortTasks = 1, longTasks = 1, taskBarMode = 1;

static float playerSpeed = 1.f, crewVision = 1.f, impVision = 1.f, killCooldown = 1.f;
static float playerSpeed = 1.f, crewVision = 1.f, impVision = 1.f, killCooldown = 1.f;

static bool ejects = false, anonVotes = false, visualTasks = false;
static bool ejects = false, anonVotes = false, visualTasks = false;

#pragma region General
MakeBool("Confirm Ejects", ejects, BoolOptionNames__Enum::ConfirmImpostor);
MakeInt("# Emergency Meetings", emergencyMeetings, Int32OptionNames__Enum::NumEmergencyMeetings);
MakeBool("Anonymous Votes", anonVotes, BoolOptionNames__Enum::AnonymousVotes);
MakeInt("Emergency Cooldown", emergencyCooldown, Int32OptionNames__Enum::EmergencyCooldown);
MakeInt("Discussion Time", discussionTime, Int32OptionNames__Enum::DiscussionTime);
MakeInt("Voting Time", votingTime, Int32OptionNames__Enum::VotingTime);
MakeFloat("Player Speed", playerSpeed, FloatOptionNames__Enum::PlayerSpeedMod);
MakeInt("Task Bar Updates", taskBarMode, Int32OptionNames__Enum::TaskBarMode);
MakeBool("Visual Tasks", visualTasks, BoolOptionNames__Enum::VisualTasks);
MakeFloat("Crewmate Vision", crewVision, FloatOptionNames__Enum::CrewLightMod);
MakeFloat("Impostor Vision", impVision, FloatOptionNames__Enum::ImpostorLightMod);
MakeFloat("Kill Cooldown", killCooldown, FloatOptionNames__Enum::KillCooldown);
MakeInt("Kill Distance", killDistance, Int32OptionNames__Enum::KillDistance);
MakeInt("# Short Tasks", shortTasks, Int32OptionNames__Enum::NumShortTasks);
MakeInt("# Common Tasks", commonTasks, Int32OptionNames__Enum::NumCommonTasks);
MakeInt("# Long Tasks", longTasks, Int32OptionNames__Enum::NumLongTasks);
MakeBool("Confirm Ejects", ejects, BoolOptionNames__Enum::ConfirmImpostor);
MakeInt("# Emergency Meetings", emergencyMeetings, Int32OptionNames__Enum::NumEmergencyMeetings);
MakeBool("Anonymous Votes", anonVotes, BoolOptionNames__Enum::AnonymousVotes);
MakeInt("Emergency Cooldown", emergencyCooldown, Int32OptionNames__Enum::EmergencyCooldown);
MakeInt("Discussion Time", discussionTime, Int32OptionNames__Enum::DiscussionTime);
MakeInt("Voting Time", votingTime, Int32OptionNames__Enum::VotingTime);
MakeFloat("Player Speed", playerSpeed, FloatOptionNames__Enum::PlayerSpeedMod);
MakeInt("Task Bar Updates", taskBarMode, Int32OptionNames__Enum::TaskBarMode);
MakeBool("Visual Tasks", visualTasks, BoolOptionNames__Enum::VisualTasks);
MakeFloat("Crewmate Vision", crewVision, FloatOptionNames__Enum::CrewLightMod);
MakeFloat("Impostor Vision", impVision, FloatOptionNames__Enum::ImpostorLightMod);
MakeFloat("Kill Cooldown", killCooldown, FloatOptionNames__Enum::KillCooldown);
MakeInt("Kill Distance", killDistance, Int32OptionNames__Enum::KillDistance);
MakeInt("# Short Tasks", shortTasks, Int32OptionNames__Enum::NumShortTasks);
MakeInt("# Common Tasks", commonTasks, Int32OptionNames__Enum::NumCommonTasks);
MakeInt("# Long Tasks", longTasks, Int32OptionNames__Enum::NumLongTasks);
#pragma endregion
#pragma region Scientist
ImGui::Text("Scientist");
static float vitalsCooldown = 1.f, batteryDuration = 1.f;
ImGui::Text("Scientist");
static float vitalsCooldown = 1.f, batteryDuration = 1.f;

MakeFloat("Vitals Display Cooldown", vitalsCooldown, FloatOptionNames__Enum::ScientistCooldown);
MakeFloat("Battery Duration", batteryDuration, FloatOptionNames__Enum::ScientistBatteryCharge);
MakeFloat("Vitals Display Cooldown", vitalsCooldown, FloatOptionNames__Enum::ScientistCooldown);
MakeFloat("Battery Duration", batteryDuration, FloatOptionNames__Enum::ScientistBatteryCharge);
#pragma endregion
#pragma region Engineer
ImGui::Text("Engineer");
static float ventCooldown = 1.f, ventDuration = 1.f;
ImGui::Text("Engineer");
static float ventCooldown = 1.f, ventDuration = 1.f;

MakeFloat("Vent Use Cooldown", ventCooldown, FloatOptionNames__Enum::EngineerCooldown);
MakeFloat("Max Time in Vents", ventDuration, FloatOptionNames__Enum::EngineerInVentMaxTime);
MakeFloat("Vent Use Cooldown", ventCooldown, FloatOptionNames__Enum::EngineerCooldown);
MakeFloat("Max Time in Vents", ventDuration, FloatOptionNames__Enum::EngineerInVentMaxTime);
#pragma endregion
#pragma region Guardian Angel
ImGui::Text("Guardian Angel");
static float protectCooldown = 1.f, protectDuration = 1.f;
static bool protectVisible = false;
ImGui::Text("Guardian Angel");
static float protectCooldown = 1.f, protectDuration = 1.f;
static bool protectVisible = false;

MakeFloat("Protect Cooldown", protectCooldown, FloatOptionNames__Enum::GuardianAngelCooldown);
MakeFloat("Protection Duration", protectCooldown, FloatOptionNames__Enum::ProtectionDurationSeconds);
MakeBool("Protect Visible to Impostors", protectVisible, BoolOptionNames__Enum::ImpostorsCanSeeProtect);
MakeFloat("Protect Cooldown", protectCooldown, FloatOptionNames__Enum::GuardianAngelCooldown);
MakeFloat("Protection Duration", protectCooldown, FloatOptionNames__Enum::ProtectionDurationSeconds);
MakeBool("Protect Visible to Impostors", protectVisible, BoolOptionNames__Enum::ImpostorsCanSeeProtect);
#pragma endregion
#pragma region Shapeshifter
ImGui::Text("Shapeshifter");
static float shapeshiftDuration = 1.f, shapeshiftCooldown = 1.f;
static bool shapeshiftEvidence = false;
ImGui::Text("Shapeshifter");
static float shapeshiftDuration = 1.f, shapeshiftCooldown = 1.f;
static bool shapeshiftEvidence = false;

MakeFloat("Shapeshift Duration", shapeshiftDuration, FloatOptionNames__Enum::ShapeshifterDuration);
MakeFloat("Shapeshift Cooldown", shapeshiftCooldown, FloatOptionNames__Enum::ShapeshifterCooldown);
MakeBool("Leave Shapeshifting Evidence", shapeshiftEvidence, BoolOptionNames__Enum::ShapeshifterLeaveSkin);
MakeFloat("Shapeshift Duration", shapeshiftDuration, FloatOptionNames__Enum::ShapeshifterDuration);
MakeFloat("Shapeshift Cooldown", shapeshiftCooldown, FloatOptionNames__Enum::ShapeshifterCooldown);
MakeBool("Leave Shapeshifting Evidence", shapeshiftEvidence, BoolOptionNames__Enum::ShapeshifterLeaveSkin);
#pragma endregion
#pragma region Noisemaker
ImGui::Text("Noisemaker");
static float alertDuration = 1.f;
ImGui::Text("Noisemaker");
static float alertDuration = 1.f;

MakeFloat("Alert Duration", alertDuration, FloatOptionNames__Enum::NoisemakerAlertDuration);
MakeFloat("Alert Duration", alertDuration, FloatOptionNames__Enum::NoisemakerAlertDuration);
#pragma endregion
#pragma region Tracker
ImGui::Text("Tracker");
static float trackerDuration = 1.f, trackerCooldown = 1.f, trackerDelay = 1.f;
ImGui::Text("Tracker");
static float trackerDuration = 1.f, trackerCooldown = 1.f, trackerDelay = 1.f;

MakeFloat("Tracker Duration", trackerDuration, FloatOptionNames__Enum::TrackerDuration);
MakeFloat("Tracker Cooldown", trackerCooldown, FloatOptionNames__Enum::TrackerCooldown);
MakeFloat("Tracker Delay", trackerDelay, FloatOptionNames__Enum::TrackerDelay);
MakeFloat("Tracker Duration", trackerDuration, FloatOptionNames__Enum::TrackerDuration);
MakeFloat("Tracker Cooldown", trackerCooldown, FloatOptionNames__Enum::TrackerCooldown);
MakeFloat("Tracker Delay", trackerDelay, FloatOptionNames__Enum::TrackerDelay);
#pragma endregion
#pragma region Phantom
ImGui::Text("Phantom");
static float phantomDuration = 1.f, phantomCooldown = 1.f;
ImGui::Text("Phantom");
static float phantomDuration = 1.f, phantomCooldown = 1.f;

MakeFloat("Phantom Duration", phantomDuration, FloatOptionNames__Enum::PhantomDuration);
MakeFloat("Phantom Cooldown", phantomCooldown, FloatOptionNames__Enum::PhantomCooldown);
MakeFloat("Phantom Duration", phantomDuration, FloatOptionNames__Enum::PhantomDuration);
MakeFloat("Phantom Cooldown", phantomCooldown, FloatOptionNames__Enum::PhantomCooldown);
#pragma endregion
}
#pragma region Hide and Seek
if (gamemode == GameModes__Enum::HideNSeek || gamemode == GameModes__Enum::SeekFools) {
static int killDistance = 1, commonTasks = 1, shortTasks = 1, longTasks = 1, maxVents = 1;

static float playerSpeed = 1.f, crewVision = 1.f, impVision = 1.f, killCooldown = 1.f,
hidingTime = 1.f, finalHideTime = 1.f, ventTime = 1.f, crewLight = 1.f, impLight = 1.f,
finalImpSpeed = 1.f, pingInterval = 1.f;

static bool flashlight = false, seekMap = false, hidePings = false, showNames = false;

MakeFloat("Crewmate Vision", crewVision, FloatOptionNames__Enum::CrewLightMod);
MakeFloat("Impostor Vision", impVision, FloatOptionNames__Enum::ImpostorLightMod);
MakeFloat("Kill Cooldown", killCooldown, FloatOptionNames__Enum::KillCooldown);
MakeInt("Kill Distance", killDistance, Int32OptionNames__Enum::KillDistance);
MakeInt("# Short Tasks", shortTasks, Int32OptionNames__Enum::NumShortTasks);
MakeInt("# Common Tasks", commonTasks, Int32OptionNames__Enum::NumCommonTasks);
MakeInt("# Long Tasks", longTasks, Int32OptionNames__Enum::NumLongTasks);
MakeFloat("Player Speed", playerSpeed, FloatOptionNames__Enum::PlayerSpeedMod);
MakeFloat("Hiding Time", hidingTime, FloatOptionNames__Enum::EscapeTime);
MakeFloat("Final Hide Time", finalHideTime, FloatOptionNames__Enum::FinalEscapeTime);
MakeInt("Max Vent Uses", maxVents, Int32OptionNames__Enum::CrewmateVentUses);
MakeFloat("Max Time In Vent", ventTime, FloatOptionNames__Enum::CrewmateTimeInVent);
MakeBool("Flashlight Mode", flashlight, BoolOptionNames__Enum::UseFlashlight);
MakeFloat("Crewmate Flashlight Size", crewLight, FloatOptionNames__Enum::CrewmateFlashlightSize);
MakeFloat("Impostor Flashlight Size", impLight, FloatOptionNames__Enum::ImpostorFlashlightSize);
MakeFloat("Final Hide Impostor Speed", finalImpSpeed, FloatOptionNames__Enum::SeekerFinalSpeed);
MakeBool("Final Hide Seek Map", seekMap, BoolOptionNames__Enum::SeekerFinalMap);
MakeBool("Final Hide Pings", hidePings, BoolOptionNames__Enum::SeekerPings);
MakeFloat("Ping Interval", pingInterval, FloatOptionNames__Enum::MaxPingTime);
MakeBool("Show Names", showNames, BoolOptionNames__Enum::ShowCrewmateNames);
}
}
}
#pragma region Hide and Seek
if (gamemode == GameModes__Enum::HideNSeek || gamemode == GameModes__Enum::SeekFools) {
static int killDistance = 1, commonTasks = 1, shortTasks = 1, longTasks = 1, maxVents = 1;

static float playerSpeed = 1.f, crewVision = 1.f, impVision = 1.f, killCooldown = 1.f,
hidingTime = 1.f, finalHideTime = 1.f, ventTime = 1.f, crewLight = 1.f, impLight = 1.f,
finalImpSpeed = 1.f, pingInterval = 1.f;

static bool flashlight = false, seekMap = false, hidePings = false, showNames = false;

MakeFloat("Crewmate Vision", crewVision, FloatOptionNames__Enum::CrewLightMod);
MakeFloat("Impostor Vision", impVision, FloatOptionNames__Enum::ImpostorLightMod);
MakeFloat("Kill Cooldown", killCooldown, FloatOptionNames__Enum::KillCooldown);
MakeInt("Kill Distance", killDistance, Int32OptionNames__Enum::KillDistance);
MakeInt("# Short Tasks", shortTasks, Int32OptionNames__Enum::NumShortTasks);
MakeInt("# Common Tasks", commonTasks, Int32OptionNames__Enum::NumCommonTasks);
MakeInt("# Long Tasks", longTasks, Int32OptionNames__Enum::NumLongTasks);
MakeFloat("Player Speed", playerSpeed, FloatOptionNames__Enum::PlayerSpeedMod);
MakeFloat("Hiding Time", hidingTime, FloatOptionNames__Enum::EscapeTime);
MakeFloat("Final Hide Time", finalHideTime, FloatOptionNames__Enum::FinalEscapeTime);
MakeInt("Max Vent Uses", maxVents, Int32OptionNames__Enum::CrewmateVentUses);
MakeFloat("Max Time In Vent", ventTime, FloatOptionNames__Enum::CrewmateTimeInVent);
MakeBool("Flashlight Mode", flashlight, BoolOptionNames__Enum::UseFlashlight);
MakeFloat("Crewmate Flashlight Size", crewLight, FloatOptionNames__Enum::CrewmateFlashlightSize);
MakeFloat("Impostor Flashlight Size", impLight, FloatOptionNames__Enum::ImpostorFlashlightSize);
MakeFloat("Final Hide Impostor Speed", finalImpSpeed, FloatOptionNames__Enum::SeekerFinalSpeed);
MakeBool("Final Hide Seek Map", seekMap, BoolOptionNames__Enum::SeekerFinalMap);
MakeBool("Final Hide Pings", hidePings, BoolOptionNames__Enum::SeekerPings);
MakeFloat("Ping Interval", pingInterval, FloatOptionNames__Enum::MaxPingTime);
MakeBool("Show Names", showNames, BoolOptionNames__Enum::ShowCrewmateNames);
}
#pragma endregion
if (openTournaments && State.TournamentMode) {
if (ImGui::Button("Clear All Data")) {
State.tournamentPoints.clear();
State.tournamentKillCaps.clear();
}
}
if (openTournaments && State.TournamentMode) {
if (ImGui::Button("Clear All Data")) {
State.tournamentPoints.clear();
State.tournamentKillCaps.clear();
}

for (auto i : State.tournamentFriendCodes) {
float points = State.tournamentPoints[i], win = State.tournamentWinPoints[i],
callout = State.tournamentCalloutPoints[i], death = State.tournamentEarlyDeathPoints[i];
ImGui::Text(std::format("{}: {} Normal, {} +W, {} +C, {} +D", i, DisplayScore(points),
DisplayScore(win), DisplayScore(callout), DisplayScore(death)).c_str());
}
}
for (auto i : State.tournamentFriendCodes) {
float points = State.tournamentPoints[i], win = State.tournamentWinPoints[i],
callout = State.tournamentCalloutPoints[i], death = State.tournamentEarlyDeathPoints[i];
ImGui::Text(std::format("{}: {} Normal, {} +W, {} +C, {} +D", i, DisplayScore(points),
DisplayScore(win), DisplayScore(callout), DisplayScore(death)).c_str());
}
}
ImGui::EndChild();
Expand Down
8 changes: 4 additions & 4 deletions gui/tabs/players_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ namespace PlayersTab {
if ((IsInGame() || (IsInLobby() && State.KillInLobbies))) {
if (!murderLoop && ImGui::Button("Murder Loop")) {
murderLoop = true;
murderCount = 200; //controls how many times the player is to be murdered
murderCount = 1000; //controls how many times the player is to be murdered
}
if (murderLoop && ImGui::Button(std::format("Stop Murder Loop ({})", 800 - murderCount * 4).c_str())) {
if (murderLoop && ImGui::Button(std::format("Stop Murder Loop ({})", 1000 - murderCount).c_str())) {
murderLoop = false;
murderCount = 0;
}
Expand All @@ -730,10 +730,10 @@ namespace PlayersTab {
for (auto p : selectedPlayers) {
auto validPlayer = p.validate();
if (IsInGame()) {
State.rpcQueue.push(new RpcMurderLoop(*Game::pLocalPlayer, validPlayer.get_PlayerControl(), 4, false));
State.rpcQueue.push(new RpcMurderLoop(*Game::pLocalPlayer, validPlayer.get_PlayerControl(), 1, false));
}
else if (IsInLobby()) {
State.lobbyRpcQueue.push(new RpcMurderLoop(*Game::pLocalPlayer, validPlayer.get_PlayerControl(), 4, false));
State.lobbyRpcQueue.push(new RpcMurderLoop(*Game::pLocalPlayer, validPlayer.get_PlayerControl(), 1, false));
}
}
murderDelay = 5;
Expand Down
Loading

0 comments on commit 3e26dd3

Please sign in to comment.