4924: fix gohst transparency of hook hand and ninja skin r=def- a=C0D3D3V

 https://streamable.com/oquu51
 
 reported by lomination 
fixes #4207 again

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
bors[bot] 2022-03-30 21:35:20 +00:00 committed by GitHub
commit ebb092211a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 8 deletions

View file

@ -343,9 +343,37 @@ void CGhost::OnRender()
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
m_pClient->m_Players.RenderHook(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
CTeeRenderInfo *RenderInfo = &Ghost.m_RenderInfo;
CTeeRenderInfo GhostNinjaRenderInfo;
if(Player.m_Weapon == WEAPON_NINJA && g_Config.m_ClShowNinja)
{
// change the skin for the ghost to the ninja
int Skin = m_pClient->m_Skins.Find("x_ninja");
if(Skin != -1)
{
bool IsTeamplay = false;
if(m_pClient->m_Snap.m_pGameInfoObj)
IsTeamplay = (m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS) != 0;
GhostNinjaRenderInfo = Ghost.m_RenderInfo;
const CSkin *pSkin = m_pClient->m_Skins.Get(Skin);
GhostNinjaRenderInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
GhostNinjaRenderInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
GhostNinjaRenderInfo.m_BloodColor = pSkin->m_BloodColor;
GhostNinjaRenderInfo.m_SkinMetrics = pSkin->m_Metrics;
GhostNinjaRenderInfo.m_CustomColoredSkin = IsTeamplay;
if(!IsTeamplay)
{
GhostNinjaRenderInfo.m_ColorBody = ColorRGBA(1, 1, 1);
GhostNinjaRenderInfo.m_ColorFeet = ColorRGBA(1, 1, 1);
}
RenderInfo = &GhostNinjaRenderInfo;
}
}
m_pClient->m_Players.RenderHook(&Prev, &Player, RenderInfo, -2, IntraTick);
m_pClient->m_Players.RenderHookCollLine(&Prev, &Player, -2, IntraTick);
m_pClient->m_Players.RenderPlayer(&Prev, &Player, &Ghost.m_RenderInfo, -2, IntraTick);
m_pClient->m_Players.RenderPlayer(&Prev, &Player, RenderInfo, -2, IntraTick);
}
}

View file

@ -265,7 +265,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
static int s_VoteList = 0;
static float s_ScrollValue = 0;
CUIRect List = Options;
//List.HSplitTop(28.0f, 0, &List);
// List.HSplitTop(28.0f, 0, &List);
UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", TotalPlayers, 1, -1, s_ScrollValue);
// options
@ -317,8 +317,8 @@ void CMenus::RenderPlayers(CUIRect MainView)
Cursor.m_LineWidth = Button.w;
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[Index].m_aClan, -1);
//TextRender()->SetCursor(&Cursor, Button2.x,Button2.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
//Cursor.m_LineWidth = Button.w;
// TextRender()->SetCursor(&Cursor, Button2.x,Button2.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
// Cursor.m_LineWidth = Button.w;
ColorRGBA Color(1.0f, 1.0f, 1.0f, 0.5f);
m_pClient->m_CountryFlags.Render(m_pClient->m_aClients[Index].m_Country, &Color,
Button2.x, Button2.y + Button2.h / 2.0f - 0.75f * Button2.h / 2.0f, 1.5f * Button2.h, 0.75f * Button2.h);

View file

@ -249,6 +249,7 @@ void CPlayers::RenderHook(
IntraTick = (m_pClient->m_aClients[ClientID].m_IsPredicted) ? Client()->PredIntraGameTick(g_Config.m_ClDummy) : Client()->IntraGameTick(g_Config.m_ClDummy);
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
float Alpha = (OtherTeam || ClientID < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
RenderInfo.m_Size = 64.0f;
@ -280,8 +281,7 @@ void CPlayers::RenderHook(
Graphics()->QuadsSetRotation(angle(Dir) + pi);
// render head
int QuadOffset = NUM_WEAPONS * 2 + 2;
if(OtherTeam)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha);
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookPos.x, HookPos.y);
// render chain
@ -303,7 +303,7 @@ void CPlayers::RenderHook(
Graphics()->QuadsSetRotation(0);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderHand(&RenderInfo, Position, normalize(HookPos - Pos), -pi / 2, vec2(20, 0), OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
RenderHand(&RenderInfo, Position, normalize(HookPos - Pos), -pi / 2, vec2(20, 0), Alpha);
}
}