Skip to content

Commit 4db5e95

Browse files
committed
Fix more visual glitches
1 parent 92b019b commit 4db5e95

File tree

4 files changed

+45
-34
lines changed

4 files changed

+45
-34
lines changed

hooks/MeetingHud.cpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,33 @@ void dMeetingHud_Close(MeetingHud* __this, MethodInfo* method) {
3434
PlayerControl_CmdCheckName(p, GetPlayerOutfit(playerData)->fields.PlayerName, NULL);
3535
}
3636
}*/
37-
uint8_t alivePlayers = 0;
38-
for (auto p : GetAllPlayerData()) {
39-
if (!p->fields.IsDead) alivePlayers++;
40-
}
41-
for (auto i : State.voteMonitor) {
42-
if (alivePlayers < 7) break;
43-
auto voter = GetPlayerDataById(i.first), target = GetPlayerDataById(i.second);
44-
if (target == NULL || target->fields.IsDead) continue;
45-
std::string voterFc = convert_from_string(voter->fields.FriendCode), targetFc = convert_from_string(target->fields.FriendCode);
46-
if (!PlayerIsImpostor(voter) &&
47-
std::find(State.tournamentCallers.begin(), State.tournamentCallers.end(), voterFc) == State.tournamentCallers.end() &&
48-
std::find(State.tournamentCalledOut.begin(), State.tournamentCalledOut.end(), targetFc) == State.tournamentCalledOut.end()) {
49-
if (PlayerIsImpostor(target)) {
50-
UpdatePoints(voter, 1.5); //CorrectCallout
51-
State.tournamentCalloutPoints[voterFc] += 1;
52-
LOG_DEBUG("Correct callout by " + ToString(target));
53-
State.tournamentCorrectCallers[voterFc] = target->fields.PlayerId;
54-
}
55-
else {
56-
UpdatePoints(voter, -1.5); //IncorrectCallout
57-
LOG_DEBUG("Incorrect callout by " + ToString(target));
37+
State.vanishedPlayers.clear();
38+
if (IsHost() && State.TournamentMode) {
39+
uint8_t alivePlayers = 0;
40+
for (auto p : GetAllPlayerData()) {
41+
if (!p->fields.IsDead) alivePlayers++;
42+
}
43+
for (auto i : State.voteMonitor) {
44+
if (alivePlayers < 7) break;
45+
auto voter = GetPlayerDataById(i.first), target = GetPlayerDataById(i.second);
46+
if (target == NULL || target->fields.IsDead) continue;
47+
std::string voterFc = convert_from_string(voter->fields.FriendCode), targetFc = convert_from_string(target->fields.FriendCode);
48+
if (!PlayerIsImpostor(voter) &&
49+
std::find(State.tournamentCallers.begin(), State.tournamentCallers.end(), voterFc) == State.tournamentCallers.end() &&
50+
std::find(State.tournamentCalledOut.begin(), State.tournamentCalledOut.end(), targetFc) == State.tournamentCalledOut.end()) {
51+
if (PlayerIsImpostor(target)) {
52+
UpdatePoints(voter, 1.5); //CorrectCallout
53+
State.tournamentCalloutPoints[voterFc] += 1;
54+
LOG_DEBUG("Correct callout by " + ToString(target));
55+
State.tournamentCorrectCallers[voterFc] = target->fields.PlayerId;
56+
}
57+
else {
58+
UpdatePoints(voter, -1.5); //IncorrectCallout
59+
LOG_DEBUG("Incorrect callout by " + ToString(target));
60+
}
61+
State.tournamentCallers.push_back(voterFc);
62+
State.tournamentCalledOut.push_back(targetFc);
5863
}
59-
State.tournamentCallers.push_back(voterFc);
60-
State.tournamentCalledOut.push_back(targetFc);
6164
}
6265
}
6366
}

hooks/PlayerControl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void dPlayerControl_FixedUpdate(PlayerControl* __this, MethodInfo* method) {
172172

173173
bool hideName = GameOptions().GetGameMode() == GameModes__Enum::HideNSeek && !(GameOptions().GetBool(app::BoolOptionNames__Enum::ShowCrewmateNames));
174174

175-
bool shouldSeeName = ((!State.PanicMode && (State.RevealRoles || State.ShowKillCD || State.PlayerColoredDots)) || PlayerControl_get_Visible(__this, NULL)) && !hideName;
175+
bool shouldSeeName = ((!State.PanicMode && (State.RevealRoles || State.ShowKillCD || State.PlayerColoredDots)) || !hideName) && PlayerControl_get_Visible(__this, NULL);
176176

177177
if (State.PlayerColoredDots && shouldSeeName && !State.PanicMode)
178178
{
@@ -605,9 +605,9 @@ void dPlayerControl_FixedUpdate(PlayerControl* __this, MethodInfo* method) {
605605
isPlaying = true;
606606
break;
607607
}
608-
if (isPlaying == State.ShowProtections)
608+
if (isPlaying == (State.ShowProtections && !State.PanicMode))
609609
break;
610-
if (!State.ShowProtections)
610+
if (!State.ShowProtections || State.PanicMode)
611611
app::PlayerControl_RemoveProtection(__this, nullptr);
612612
std::pair<int32_t/*ColorId*/, float/*Time*/> pair;
613613
synchronized(State.protectMutex) {
@@ -619,7 +619,7 @@ void dPlayerControl_FixedUpdate(PlayerControl* __this, MethodInfo* method) {
619619
if (_Duration > 0.f)
620620
app::PlayerControl_TurnOnProtection(__this, State.ShowProtections, pair.first, __this->fields.protectedByGuardianId, nullptr);
621621
options.SetFloat(app::FloatOptionNames__Enum::ProtectionDurationSeconds, ProtectionDurationSeconds);
622-
} while (State.PanicMode);
622+
} while (0);
623623

624624
/*if ((State.Wallhack || State.IsRevived) && __this == *Game::pLocalPlayer && !State.FreeCam
625625
&& !State.playerToFollow.has_value() && !State.PanicMode) {

hooks/PlayerPhysics.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,41 @@ void dPlayerPhysics_FixedUpdate(PlayerPhysics* __this, MethodInfo* method)
2222
bool shouldSeeGhost = localData->fields.IsDead || State.ShowGhosts;
2323
auto playerData = GetPlayerData(player);
2424
auto roleType = playerData->fields.RoleType;
25-
bool isFullyVanished = std::find(State.vanishedPlayers.begin(), State.vanishedPlayers.end(), GetPlayerData(player)->fields.PlayerId) != State.vanishedPlayers.end();
25+
bool isFullyVanished = std::find(State.vanishedPlayers.begin(), State.vanishedPlayers.end(), playerData->fields.PlayerId) != State.vanishedPlayers.end();
2626
bool isDead = playerData->fields.IsDead;
2727
auto nameText = Component_get_gameObject((Component_1*)player->fields.cosmetics->fields.nameText, NULL);
28+
bool isSeekerBody = player->fields.cosmetics->fields.bodyType == PlayerBodyTypes__Enum::Seeker || player->fields.cosmetics->fields.bodyType == PlayerBodyTypes__Enum::LongSeeker;
2829
if (player->fields.inVent) {
2930
if (!PlayerControl_get_Visible(player, NULL) && State.ShowPlayersInVents && (!isFullyVanished || shouldSeePhantom) && !State.PanicMode) {
3031
PlayerControl_set_Visible(player, true, NULL);
31-
GameObject_SetActive(nameText, true, NULL);
3232
player->fields.invisibilityAlpha = 0.5f;
3333
CosmeticsLayer_SetPhantomRoleAlpha(player->fields.cosmetics, player->fields.invisibilityAlpha, NULL);
34+
if (isSeekerBody) {
35+
SpriteRenderer_set_color(player->fields.cosmetics->fields.skin->fields.layer, Palette__TypeInfo->static_fields->ClearWhite, NULL);
36+
}
3437
}
3538
else if (player->fields.invisibilityAlpha == 0.5f && (!(State.ShowPlayersInVents && (!isFullyVanished || shouldSeePhantom)) || State.PanicMode)) {
3639
PlayerControl_set_Visible(player, false, NULL);
37-
GameObject_SetActive(nameText, false, NULL);
3840
player->fields.invisibilityAlpha = 0.f;
3941
CosmeticsLayer_SetPhantomRoleAlpha(player->fields.cosmetics, player->fields.invisibilityAlpha, NULL);
42+
if (isSeekerBody) {
43+
SpriteRenderer_set_color(player->fields.cosmetics->fields.skin->fields.layer, Palette__TypeInfo->static_fields->ClearWhite, NULL);
44+
}
4045
}
4146
}
4247
else if (!isDead) {
4348
player->fields.invisibilityAlpha = isFullyVanished ? (shouldSeePhantom ? 0.5f : 0.f) : 1.f;
4449
CosmeticsLayer_SetPhantomRoleAlpha(player->fields.cosmetics, player->fields.invisibilityAlpha, NULL);
4550
PlayerControl_set_Visible(player, player->fields.invisibilityAlpha > 0.f, NULL);
46-
GameObject_SetActive(nameText, player->fields.invisibilityAlpha > 0.f, NULL);
51+
if (isSeekerBody) {
52+
SpriteRenderer_set_color(player->fields.cosmetics->fields.skin->fields.layer, Palette__TypeInfo->static_fields->ClearWhite, NULL);
53+
}
4754
}
4855
else if (playerData->fields.IsDead) {
4956
PlayerControl_set_Visible(player, shouldSeeGhost && !State.PanicMode, NULL);
50-
GameObject_SetActive(nameText, shouldSeeGhost && !State.PanicMode, NULL);
57+
player->fields.invisibilityAlpha = shouldSeeGhost && !State.PanicMode ? 1.f : 0.f;
5158
}
59+
GameObject_SetActive(nameText, player->fields.invisibilityAlpha > 0.f, NULL);
5260
}
5361
app::PlayerPhysics_FixedUpdate(__this, method);
5462
}

rpc/RpcSetRole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ void RpcSetRole::Process()
1313
{
1414
if (Player == nullptr) return;
1515

16-
bool isDeadRole = Role == RoleTypes__Enum::CrewmateGhost || Role == RoleTypes__Enum::GuardianAngel || Role == RoleTypes__Enum::ImpostorGhost;
16+
//bool isDeadRole = Role == RoleTypes__Enum::CrewmateGhost || Role == RoleTypes__Enum::GuardianAngel || Role == RoleTypes__Enum::ImpostorGhost;
1717

18-
PlayerControl_RpcSetRole(Player, Role, Player->fields.roleAssigned && !isDeadRole, NULL);
18+
PlayerControl_RpcSetRole(Player, Role, true, NULL);
1919
}
2020

2121
SetRole::SetRole(RoleTypes__Enum role)

0 commit comments

Comments
 (0)