Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Sep 19, 2022
2 parents 65f16a1 + 90500cf commit 94eae4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cl_dll/particleman/CMiniMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void CMiniMem::Deallocate(void* memory, std::size_t sizeInBytes, std::size_t ali
return;
}

_particles.erase(std::find(_particles.begin(), _particles.end(), memory), _particles.end());
_particles.erase(std::find(_particles.begin(), _particles.end(), memory));

_pool.deallocate(memory, sizeInBytes, alignment);
}
Expand Down
21 changes: 13 additions & 8 deletions dlls/func_tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,22 +635,27 @@ void CFuncTank::TrackTarget()
// If barrel is offset, add in additional rotation
void CFuncTank::AdjustAnglesForBarrel(Vector& angles, float distance)
{
float r2, d2;


if (m_barrelPos.y != 0 || m_barrelPos.z != 0)
{
distance -= m_barrelPos.z;
d2 = distance * distance;
const float d2 = distance * distance;
if (0 != m_barrelPos.y)
{
r2 = m_barrelPos.y * m_barrelPos.y;
angles.y += (180.0 / M_PI) * atan2(m_barrelPos.y, sqrt(d2 - r2));
const float r2 = m_barrelPos.y * m_barrelPos.y;

if (d2 > r2)
{
angles.y += (180.0 / M_PI) * atan2(m_barrelPos.y, sqrt(d2 - r2));
}
}
if (0 != m_barrelPos.z)
{
r2 = m_barrelPos.z * m_barrelPos.z;
angles.x += (180.0 / M_PI) * atan2(-m_barrelPos.z, sqrt(d2 - r2));
const float r2 = m_barrelPos.z * m_barrelPos.z;

if (d2 > r2)
{
angles.x += (180.0 / M_PI) * atan2(-m_barrelPos.z, sqrt(d2 - r2));
}
}
}
}
Expand Down

0 comments on commit 94eae4d

Please sign in to comment.