diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 48cf9ae..7efaaec 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -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) { diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index 9b3ae0c..7dcbf6a 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -937,46 +937,6 @@ void RenderObject::renderCall() void RenderObject::renderCollision() { - if (!collisionRects.empty()) - { -#ifdef BBGE_BUILD_OPENGL - glPushAttrib(GL_ALL_ATTRIB_BITS); - glPushMatrix(); - glBindTexture(GL_TEXTURE_2D, 0); - - //glLoadIdentity(); - //core->setupRenderPositionAndScale(); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(1.0f, 0.5f, 1.0f, 0.5f); - glPointSize(5); - - for (int i = 0; i < collisionRects.size(); i++) - { - RectShape *r = &collisionRects[i]; - - glBegin(GL_QUADS); - glVertex3f(r->x1, r->y1, 0); - glVertex3f(r->x1, r->y2, 0); - glVertex3f(r->x2, r->y2, 0); - glVertex3f(r->x2, r->y1, 0); - glEnd(); - glBegin(GL_POINTS); - glVertex3f(r->x1, r->y1, 0); - glVertex3f(r->x1, r->y2, 0); - glVertex3f(r->x2, r->y2, 0); - glVertex3f(r->x2, r->y1, 0); - glEnd(); - } - - glPopMatrix(); - glDisable(GL_BLEND); - - glPopAttrib(); -#endif - } - if (!collisionMask.empty()) { #ifdef BBGE_BUILD_OPENGL diff --git a/BBGE/RenderObject.h b/BBGE/RenderObject.h index c25c0d8..3fac577 100644 --- a/BBGE/RenderObject.h +++ b/BBGE/RenderObject.h @@ -68,8 +68,6 @@ struct MotionBlurFrame float rotz; }; -typedef std::vector CollideRects; - class RenderObjectLayer; class RenderObject : public ScriptObject @@ -285,7 +283,6 @@ public: std::vector collisionMask; std::vector transformedCollisionMask; - CollideRects collisionRects; float collisionMaskRadius; float alphaMod; diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index c83f228..52350c2 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -956,19 +956,6 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn) { bone->SetAttribute("sel", this->bones[i]->selectable); } - if (!this->bones[i]->collisionRects.empty()) - { - std::ostringstream os; - os << this->bones[i]->collisionRects.size() << " "; - for (int j = 0; j < this->bones[i]->collisionRects.size(); j++) - { - RectShape *r = &this->bones[i]->collisionRects[j]; - int x, y, w, h; - r->getCWH(&x, &y, &w, &h); - os << x << " " << y << " " << w << " " << h << " "; - } - bone->SetAttribute("crects", os.str().c_str()); - } if (this->bones[i]->rbp) bone->SetAttribute("rbp", this->bones[i]->rbp); if (this->bones[i]->originalRenderPass) @@ -1398,22 +1385,6 @@ void SkeletalSprite::loadSkeletal(const std::string &fn) if (bone->Attribute("offy")) newb->offset.y = atoi(bone->Attribute("offy")); - if (bone->Attribute("crects")) - { - SimpleIStringStream is(bone->Attribute("crects")); - int num = 0; - is >> num; - for (int i = 0; i < num; i++) - { - RectShape r; - int x, y, w, h; - is >> x >> y >> w >> h; - r.setCWH(x, y, w, h); - - newb->collisionRects.push_back(r); - } - } - if (bone->Attribute("prt")) { newb->prt = bone->Attribute("prt");