Fix showothers for specchar

This commit is contained in:
Edgar 2020-06-30 11:43:06 +02:00
parent 8c8f292b52
commit eb1779f58c
No known key found for this signature in database
GPG key ID: 8731E6C0166EAA85
3 changed files with 19 additions and 3 deletions

View file

@ -177,7 +177,9 @@ void CNamePlates::OnRender()
if(m_pClient->m_aClients[i].m_SpecCharPresent)
{
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, 0.4f);
bool OtherTeam = m_pClient->IsOtherTeam(i);
float Alpha = 0.4f * (OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, Alpha);
}
// only render active characters

View file

@ -675,8 +675,10 @@ void CPlayers::OnRender()
{
continue;
}
bool OtherTeam = m_pClient->IsOtherTeam(i);
float Alpha = OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
vec2 Pos = m_pClient->m_aClients[i].m_SpecChar;
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos, 1.0f);
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos, Alpha);
}
else
{

View file

@ -404,7 +404,19 @@ void CPlayer::Snap(int SnappingClient)
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
}
if(m_pCharacter && m_pCharacter->IsPaused())
bool ShowSpec = m_pCharacter && m_pCharacter->IsPaused();
if(SnappingClient >= 0)
{
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
ShowSpec = ShowSpec && (
GameServer()->GetDDRaceTeam(id) == GameServer()->GetDDRaceTeam(SnappingClient)
|| pSnapPlayer->m_ShowOthers
|| (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused())
);
}
if(ShowSpec)
{
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;