mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Make LimitVel
a proper function
This commit is contained in:
parent
66ccd808aa
commit
bcd1559c5e
|
@ -325,7 +325,7 @@ void CCharacter::FireWeapon()
|
|||
float Strength = GetTuning(m_TuneZone)->m_HammerStrength;
|
||||
|
||||
vec2 Temp = pTarget->m_Core.m_Vel + normalize(Dir + vec2(0.f, -1.1f)) * 10.0f;
|
||||
pTarget->Core()->LimitVel(&Temp);
|
||||
Temp = pTarget->Core()->LimitVel(Temp);
|
||||
Temp -= pTarget->m_Core.m_Vel;
|
||||
|
||||
vec2 Force = vec2(0.f, -1.0f) + Temp;
|
||||
|
@ -649,8 +649,7 @@ void CCharacter::HandleSkippableTiles(int Index)
|
|||
}
|
||||
else
|
||||
TempVel += Direction * Force;
|
||||
m_Core.LimitVel(&TempVel);
|
||||
m_Core.m_Vel = TempVel;
|
||||
m_Core.m_Vel = m_Core.LimitVel(TempVel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -601,14 +601,12 @@ bool CCharacterCore::IsSwitchActiveCb(int Number, void *pUser)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CCharacterCore::LimitVel(vec2 *pVel)
|
||||
vec2 CCharacterCore::LimitVel(vec2 Vel)
|
||||
{
|
||||
*pVel = ClampVel(m_MoveRestrictions, *pVel);
|
||||
return ClampVel(m_MoveRestrictions, Vel);
|
||||
}
|
||||
|
||||
void CCharacterCore::ApplyForce(vec2 Force)
|
||||
{
|
||||
vec2 Temp = m_Vel + Force;
|
||||
LimitVel(&Temp);
|
||||
m_Vel = Temp;
|
||||
m_Vel = LimitVel(m_Vel + Force);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,9 @@ public:
|
|||
int m_FreezeEnd;
|
||||
bool m_DeepFrozen;
|
||||
|
||||
void LimitVel(vec2 *pVel);
|
||||
// Caps the given velocity according to the current set of stoppers
|
||||
// that the character is affected by.
|
||||
vec2 LimitVel(vec2 Vel);
|
||||
void ApplyForce(vec2 Force);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue