mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix specchar transparency and move spec-char to character snap
This commit is contained in:
parent
b851d74f54
commit
73a21cab62
|
@ -37,7 +37,7 @@ void CNamePlates::RenderNameplate(
|
|||
RenderNameplatePos(Position, pPlayerInfo, 1.0f);
|
||||
}
|
||||
|
||||
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha)
|
||||
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha)
|
||||
{
|
||||
int ClientID = pPlayerInfo->m_ClientID;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
STextRenderColor TColor;
|
||||
STextRenderColor TOutlineColor;
|
||||
|
||||
if(OtherTeam)
|
||||
if(OtherTeam && !ForceAlpha)
|
||||
{
|
||||
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.2f * g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
|
@ -238,9 +238,7 @@ void CNamePlates::OnRender()
|
|||
|
||||
if(m_pClient->m_aClients[i].m_SpecCharPresent)
|
||||
{
|
||||
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);
|
||||
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, 0.4f, true);
|
||||
}
|
||||
|
||||
// only render active characters
|
||||
|
|
|
@ -43,7 +43,7 @@ class CNamePlates : public CComponent
|
|||
const CNetObj_Character *pPrevChar,
|
||||
const CNetObj_Character *pPlayerChar,
|
||||
const CNetObj_PlayerInfo *pPlayerInfo);
|
||||
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha);
|
||||
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha = false);
|
||||
|
||||
SPlayerNamePlate m_aNamePlates[MAX_CLIENTS];
|
||||
class CPlayers *m_pPlayers;
|
||||
|
|
|
@ -691,10 +691,8 @@ 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, Alpha);
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1289,6 +1289,24 @@ void CCharacter::Snap(int SnappingClient)
|
|||
}
|
||||
}
|
||||
|
||||
bool ShowSpec = IsPaused();
|
||||
|
||||
if(SnappingClient >= 0)
|
||||
{
|
||||
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
|
||||
ShowSpec = ShowSpec && (GameServer()->GetDDRaceTeam(m_pPlayer->GetCID()) == GameServer()->GetDDRaceTeam(SnappingClient) || pSnapPlayer->m_ShowOthers == 1 || (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused()));
|
||||
}
|
||||
|
||||
if(ShowSpec)
|
||||
{
|
||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, ID, sizeof(CNetObj_SpecChar)));
|
||||
if(!pSpecChar)
|
||||
return;
|
||||
|
||||
pSpecChar->m_X = Core()->m_Pos.x;
|
||||
pSpecChar->m_Y = Core()->m_Pos.y;
|
||||
}
|
||||
|
||||
CNetObj_DDNetCharacter *pDDNetCharacter = static_cast<CNetObj_DDNetCharacter *>(Server()->SnapNewItem(NETOBJTYPE_DDNETCHARACTER, ID, sizeof(CNetObj_DDNetCharacter)));
|
||||
if(!pDDNetCharacter)
|
||||
return;
|
||||
|
|
|
@ -424,24 +424,6 @@ void CPlayer::Snap(int SnappingClient)
|
|||
return;
|
||||
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
||||
}
|
||||
|
||||
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 == 1 || (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused()));
|
||||
}
|
||||
|
||||
if(ShowSpec)
|
||||
{
|
||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
||||
if(!pSpecChar)
|
||||
return;
|
||||
|
||||
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
||||
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::FakeSnap()
|
||||
|
|
Loading…
Reference in a new issue