mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
reintroduce shotgun bug
This commit is contained in:
parent
59acac221c
commit
04f1bbf59f
|
@ -26,6 +26,7 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
|
|||
|
||||
bool CLaser::HitCharacter(vec2 From, vec2 To)
|
||||
{
|
||||
static const vec2 StackedLaserShotgunBugSpeed = vec2(-2147483648.0f, -2147483648.0f);
|
||||
vec2 At;
|
||||
CCharacter *pOwnerChar = GameWorld()->GetCharacterByID(m_Owner);
|
||||
CCharacter *pHit;
|
||||
|
@ -44,15 +45,37 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
|
|||
if(m_Type == WEAPON_SHOTGUN)
|
||||
{
|
||||
vec2 Temp;
|
||||
|
||||
float Strength = GetTuning(m_TuneZone)->m_ShotgunStrength;
|
||||
|
||||
if(g_Config.m_SvOldLaser && pOwnerChar)
|
||||
Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - pHit->Core()->m_Pos) * Strength;
|
||||
else
|
||||
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
|
||||
vec2 &HitPos = pHit->Core()->m_Pos;
|
||||
if(!g_Config.m_SvOldLaser)
|
||||
{
|
||||
if(m_PrevPos != HitPos)
|
||||
{
|
||||
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - HitPos) * Strength;
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, Temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = StackedLaserShotgunBugSpeed;
|
||||
}
|
||||
}
|
||||
else if(g_Config.m_SvOldLaser && pOwnerChar)
|
||||
{
|
||||
if(pOwnerChar->Core()->m_Pos != HitPos)
|
||||
{
|
||||
Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - HitPos) * Strength;
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, Temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = StackedLaserShotgunBugSpeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, pHit->Core()->m_Vel);
|
||||
}
|
||||
}
|
||||
else if(m_Type == WEAPON_LASER)
|
||||
{
|
||||
pHit->UnFreeze();
|
||||
|
|
|
@ -34,6 +34,7 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
|
|||
|
||||
bool CLaser::HitCharacter(vec2 From, vec2 To)
|
||||
{
|
||||
static const vec2 StackedLaserShotgunBugSpeed = vec2(-2147483648.0f, -2147483648.0f);
|
||||
vec2 At;
|
||||
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
||||
CCharacter *pHit;
|
||||
|
@ -59,14 +60,36 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
|
|||
else
|
||||
Strength = GameServer()->TuningList()[m_TuneZone].m_ShotgunStrength;
|
||||
|
||||
vec2 &HitPos = pHit->Core()->m_Pos;
|
||||
if(!g_Config.m_SvOldLaser)
|
||||
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
|
||||
else if(pOwnerChar)
|
||||
Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - pHit->Core()->m_Pos) * Strength;
|
||||
else
|
||||
Temp = pHit->Core()->m_Vel;
|
||||
{
|
||||
if(m_PrevPos != HitPos)
|
||||
{
|
||||
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - HitPos) * Strength;
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, Temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = StackedLaserShotgunBugSpeed;
|
||||
}
|
||||
}
|
||||
else if(g_Config.m_SvOldLaser && pOwnerChar)
|
||||
{
|
||||
if(pOwnerChar->Core()->m_Pos != HitPos)
|
||||
{
|
||||
Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - HitPos) * Strength;
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, Temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = StackedLaserShotgunBugSpeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, pHit->Core()->m_Vel);
|
||||
}
|
||||
}
|
||||
else if(m_Type == WEAPON_LASER)
|
||||
{
|
||||
pHit->UnFreeze();
|
||||
|
|
Loading…
Reference in a new issue