1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-10 16:32:31 +00:00

Remove RenderObject::collisionRects.

Another vector that was always empty, optionally filled when specified
by a skeletal file, but none actually did this. Should be safe to remove.

Also small related optimization in Game::collideSkeletalVsCircle().
This commit is contained in:
fgenesis 2016-05-07 01:00:16 +02:00
commit e7791c5ddc
4 changed files with 4 additions and 82 deletions

View file

@ -8395,21 +8395,15 @@ Bone *Game::collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius)
{
Bone *b = skeletal->skeletalSprite.bones[i];
if (b->alpha.x == 1 && b->renderQuad)
if (b->alpha.x == 1 && b->renderQuad &&
(!b->collisionMask.empty() || b->collideRadius) // check this here to avoid calculating getWorldCollidePosition() if not necessary
)
{
float checkRadius = sqr(radius+b->collisionMaskRadius);
Vector bonePos = b->getWorldCollidePosition();
float dist = (bonePos - pos).getSquaredLength2D();
// BOUND RECT METHOD
if (!b->collisionRects.empty())
{
for (int i = 0; i < b->collisionRects.size(); i++)
{
b->collisionRects[i].isCoordinateInside(pos, radius);
}
}
// MULTIPLE CIRCLES METHOD
else if (!b->collisionMask.empty())
if (!b->collisionMask.empty())
{
if (dist < checkRadius)
{