[Fix] Ignore weird collisions in lines.

This commit is contained in:
Allanis 2014-03-07 19:35:09 +00:00
parent f0f3f1bfc4
commit da98ff806d

View File

@ -163,14 +163,14 @@ int CollideLineSprite(const Vec2* ap, double ad, double al,
/* Left border. */
if(CollideLineLine(ap->x, ap->y, ep[0], ep[1],
bl[0], bl[1], bl[0], tr[1], &tmp_crash) != 0) {
bl[0], bl[1], bl[0], tr[1], &tmp_crash) == 0) {
border[hits].x = tmp_crash.x;
border[hits].y = tmp_crash.y;
hits++;
}
/* Top border. */
if(CollideLineLine(ap->x, ap->y, ep[0], ep[1],
bl[0], tr[1], tr[0], tr[1], &tmp_crash) != 0) {
bl[0], tr[1], tr[0], tr[1], &tmp_crash) == 0) {
border[hits].x = tmp_crash.x;
border[hits].y = tmp_crash.y;
hits++;
@ -178,14 +178,14 @@ int CollideLineSprite(const Vec2* ap, double ad, double al,
/* Now we are going to have to make sure hits isn't 2. */
/* Right border. */
if((hits < 2) && CollideLineLine(ap->x, ap->y, ep[0], ep[1],
tr[0], tr[1], tr[0], bl[1], &tmp_crash) != 0) {
tr[0], tr[1], tr[0], bl[1], &tmp_crash) == 0) {
border[hits].x = tmp_crash.x;
border[hits].y = tmp_crash.y;
hits++;
}
/* Bottom border. */
if((hits < 2) && CollideLineLine(ap->x, ap->y, ep[0], ep[1],
tr[0], bl[1], bl[0], bl[1], &tmp_crash) != 0) {
tr[0], bl[1], bl[0], bl[1], &tmp_crash) == 0) {
border[hits].x = tmp_crash.x;
border[hits].y = tmp_crash.y;
hits++;