[Fix] Ignore weird collisions in lines.
This commit is contained in:
parent
f0f3f1bfc4
commit
da98ff806d
@ -163,14 +163,14 @@ int CollideLineSprite(const Vec2* ap, double ad, double al,
|
|||||||
|
|
||||||
/* Left border. */
|
/* Left border. */
|
||||||
if(CollideLineLine(ap->x, ap->y, ep[0], ep[1],
|
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].x = tmp_crash.x;
|
||||||
border[hits].y = tmp_crash.y;
|
border[hits].y = tmp_crash.y;
|
||||||
hits++;
|
hits++;
|
||||||
}
|
}
|
||||||
/* Top border. */
|
/* Top border. */
|
||||||
if(CollideLineLine(ap->x, ap->y, ep[0], ep[1],
|
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].x = tmp_crash.x;
|
||||||
border[hits].y = tmp_crash.y;
|
border[hits].y = tmp_crash.y;
|
||||||
hits++;
|
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. */
|
/* Now we are going to have to make sure hits isn't 2. */
|
||||||
/* Right border. */
|
/* Right border. */
|
||||||
if((hits < 2) && CollideLineLine(ap->x, ap->y, ep[0], ep[1],
|
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].x = tmp_crash.x;
|
||||||
border[hits].y = tmp_crash.y;
|
border[hits].y = tmp_crash.y;
|
||||||
hits++;
|
hits++;
|
||||||
}
|
}
|
||||||
/* Bottom border. */
|
/* Bottom border. */
|
||||||
if((hits < 2) && CollideLineLine(ap->x, ap->y, ep[0], ep[1],
|
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].x = tmp_crash.x;
|
||||||
border[hits].y = tmp_crash.y;
|
border[hits].y = tmp_crash.y;
|
||||||
hits++;
|
hits++;
|
||||||
|
Loading…
Reference in New Issue
Block a user