mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #8240 from Robyt3/Ghost-Asan-Fixes
Fix OOB accesses rendering ghosts, fix ghost hook collision line
This commit is contained in:
commit
1b6ad6ba8b
|
@ -214,7 +214,7 @@ void CPlayers::RenderHookCollLine(
|
|||
}
|
||||
}
|
||||
|
||||
if(m_pClient->IntersectCharacter(OldPos, FinishPos, FinishPos, ClientId) != -1)
|
||||
if(ClientId >= 0 && m_pClient->IntersectCharacter(OldPos, FinishPos, FinishPos, ClientId) != -1)
|
||||
{
|
||||
HookCollColor = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClHookCollColorTeeColl));
|
||||
break;
|
||||
|
@ -417,7 +417,7 @@ void CPlayers::RenderPlayer(
|
|||
bool InAir = !Collision()->CheckPoint(Player.m_X, Player.m_Y + 16);
|
||||
bool Running = Player.m_VelX >= 5000 || Player.m_VelX <= -5000;
|
||||
bool WantOtherDir = (Player.m_Direction == -1 && Vel.x > 0) || (Player.m_Direction == 1 && Vel.x < 0);
|
||||
bool Inactive = m_pClient->m_aClients[ClientId].m_Afk || m_pClient->m_aClients[ClientId].m_Paused;
|
||||
bool Inactive = ClientId >= 0 && (m_pClient->m_aClients[ClientId].m_Afk || m_pClient->m_aClients[ClientId].m_Paused);
|
||||
|
||||
// evaluate animation
|
||||
float WalkTime = std::fmod(Position.x, 100.0f) / 100.0f;
|
||||
|
@ -561,7 +561,7 @@ void CPlayers::RenderPlayer(
|
|||
}
|
||||
if(g_pData->m_Weapons.m_aId[CurrentWeapon].m_aSpriteMuzzles[IteX])
|
||||
{
|
||||
if(PredictLocalWeapons)
|
||||
if(PredictLocalWeapons || ClientId < 0)
|
||||
Dir = vec2(pPlayerChar->m_X, pPlayerChar->m_Y) - vec2(pPrevChar->m_X, pPrevChar->m_Y);
|
||||
else
|
||||
Dir = vec2(m_pClient->m_Snap.m_aCharacters[ClientId].m_Cur.m_X, m_pClient->m_Snap.m_aCharacters[ClientId].m_Cur.m_Y) - vec2(m_pClient->m_Snap.m_aCharacters[ClientId].m_Prev.m_X, m_pClient->m_Snap.m_aCharacters[ClientId].m_Prev.m_Y);
|
||||
|
@ -681,6 +681,9 @@ void CPlayers::RenderPlayer(
|
|||
GameClient()->m_Effects.FreezingFlakes(BodyPos, vec2(32, 32), Alpha);
|
||||
}
|
||||
|
||||
if(ClientId < 0)
|
||||
return;
|
||||
|
||||
int QuadOffsetToEmoticon = NUM_WEAPONS * 2 + 2 + 2;
|
||||
if((Player.m_PlayerFlags & PLAYERFLAG_CHATTING) && !m_pClient->m_aClients[ClientId].m_Afk)
|
||||
{
|
||||
|
@ -694,9 +697,6 @@ void CPlayers::RenderPlayer(
|
|||
Graphics()->QuadsSetRotation(0);
|
||||
}
|
||||
|
||||
if(ClientId < 0)
|
||||
return;
|
||||
|
||||
if(g_Config.m_ClAfkEmote && m_pClient->m_aClients[ClientId].m_Afk && !(Client()->DummyConnected() && ClientId == m_pClient->m_aLocalIds[!g_Config.m_ClDummy]))
|
||||
{
|
||||
int CurEmoticon = (SPRITE_ZZZ - SPRITE_OOP);
|
||||
|
|
Loading…
Reference in a new issue