mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #4771
4771: fix Alpha of Muzzle r=def- a=C0D3D3V In principle https://github.com/ddnet/ddnet/issues/4207 has already been fixed with https://github.com/ddnet/ddnet/pull/4770 But I don't know if the bug has influence on another part. The faulty animation code is hereby fixed. The problem is that when you shoot with the Rifle or the Shotgun the Muzzle animation is executed. This manipulates Alpha, Alpha itself is actually redefined in the condition, but apparently it overwrites the Alpha used for RenderHand since it is in the same code block (from line 279 to 537). Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
commit
ac05c14c78
|
@ -487,11 +487,11 @@ void CPlayers::RenderPlayer(
|
|||
// check if we're firing stuff
|
||||
if(g_pData->m_Weapons.m_aId[iw].m_NumSpriteMuzzles) //prev.attackticks)
|
||||
{
|
||||
float Alpha = 0.0f;
|
||||
float AlphaMuzzle = 0.0f;
|
||||
if(AttackTicksPassed < g_pData->m_Weapons.m_aId[iw].m_Muzzleduration + 3)
|
||||
{
|
||||
float t = AttackTicksPassed / g_pData->m_Weapons.m_aId[iw].m_Muzzleduration;
|
||||
Alpha = mix(2.0f, 0.0f, minimum(1.0f, maximum(0.0f, t)));
|
||||
AlphaMuzzle = mix(2.0f, 0.0f, minimum(1.0f, maximum(0.0f, t)));
|
||||
}
|
||||
|
||||
int IteX = rand() % g_pData->m_Weapons.m_aId[iw].m_NumSpriteMuzzles;
|
||||
|
@ -511,7 +511,7 @@ void CPlayers::RenderPlayer(
|
|||
else
|
||||
s_LastIteX = IteX;
|
||||
}
|
||||
if(Alpha > 0.0f && g_pData->m_Weapons.m_aId[iw].m_aSpriteMuzzles[IteX])
|
||||
if(AlphaMuzzle > 0.0f && g_pData->m_Weapons.m_aId[iw].m_aSpriteMuzzles[IteX])
|
||||
{
|
||||
float OffsetY = -g_pData->m_Weapons.m_aId[iw].m_Muzzleoffsety;
|
||||
int QuadOffset = IteX * 2 + (Direction.x < 0 ? 1 : 0);
|
||||
|
|
Loading…
Reference in a new issue