summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-30 01:02:57 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-30 01:02:57 (EDT)
commit1c5f2fa86286137a86da01cbc3f67e204442b558 (patch)
tree3fbaa866b0487cc900c2bae6b32f7b4f41fc41d5
parentf691e5f266a42aac8a14eb6c71e59111cc9fa16f (diff)
downloaddodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.zip
dodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.tar.gz
dodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.tar.bz2
ball: Undo bounce reduction
-rw-r--r--src/ball.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/ball.c b/src/ball.c
index 552aadd..5c0497d 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -118,7 +118,6 @@ db_balls_collisions(struct db_ball *ball)
int x_max;
int y_min;
int y_max;
- SDL_bool bounce;
int x;
int y;
double col_x;
@@ -131,7 +130,6 @@ db_balls_collisions(struct db_ball *ball)
x_max = ceil ((ball->x + ball->r) / map_tw);
y_min = floor((ball->y - ball->r) / map_th);
y_max = ceil ((ball->y + ball->r) / map_th);
- bounce = SDL_FALSE;
for (y = y_min; y < y_max; ++y) {
for (x = x_min; x < x_max; ++x) {
if (db_map_tile_ball_collides(ball->map, x, y)) {
@@ -139,14 +137,11 @@ db_balls_collisions(struct db_ball *ball)
wall.y = y * map_th;
if (db_col_cir_rect(ball->x, ball->y, ball->r,
&wall, &col_x, &col_y)){
- bounce = SDL_TRUE;
+ _db_ball_bounce(ball, col_x, col_y);
}
}
}
}
- if (bounce) {
- _db_ball_bounce(ball, col_x, col_y);
- }
/* Spinning balls shouldn't collide with any other balls */
if (ball->sr == 0) {