reintroduce shotgun bug

This commit is contained in:
c0d3d3v 2022-05-28 00:58:33 +02:00
parent 59acac221c
commit 04f1bbf59f
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
2 changed files with 57 additions and 11 deletions

View file

@ -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();

View file

@ -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();