mirror of
https://github.com/thepigeongenerator/tetris_clone.git
synced 2025-12-17 14:05:45 +01:00
fix: shape_ prefix to is_set
This commit is contained in:
@@ -68,7 +68,7 @@ static void set_shape_i(row const* const row, shape_id const id, int8_t const po
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (int8_t x = 0; x < SHAPE_WIDTH; x++)
|
for (int8_t x = 0; x < SHAPE_WIDTH; x++)
|
||||||
if (is_set(shape_row, x))
|
if (shape_is_set(shape_row, x))
|
||||||
row[y][x + pos_x] = colour;
|
row[y][x + pos_x] = colour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ static bool shape_intersects(row const* const rows, shape_id const id, int8_t co
|
|||||||
if (shape_row == 0) continue; // if the row doesn't contain data; continue
|
if (shape_row == 0) continue; // if the row doesn't contain data; continue
|
||||||
|
|
||||||
for (int8_t x0 = 0; x0 < SHAPE_WIDTH; x0++) {
|
for (int8_t x0 = 0; x0 < SHAPE_WIDTH; x0++) {
|
||||||
if (is_set(shape_row, x0) == false) continue; // if the bit isn't set at this index; continue
|
if (shape_is_set(shape_row, x0) == false) continue; // if the bit isn't set at this index; continue
|
||||||
int8_t const x1 = x + x0;
|
int8_t const x1 = x + x0;
|
||||||
int8_t const y1 = y + y0;
|
int8_t const y1 = y + y0;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ static inline shape_row shape_get_row(shape const shape, uint8_t const index) {
|
|||||||
return shape >> (((SHAPE_HEIGHT - 1) - index) * SHAPE_WIDTH) & 0xF;
|
return shape >> (((SHAPE_HEIGHT - 1) - index) * SHAPE_WIDTH) & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_set(shape_row const row, uint8_t const index) {
|
static inline bool shape_is_set(shape_row const row, uint8_t const index) {
|
||||||
return (row >> ((SHAPE_WIDTH - 1) - index) & 1) != 0;
|
return (row >> ((SHAPE_WIDTH - 1) - index) & 1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static void draw_shape(SDL_Renderer* const renderer, shape_id const id, int8_t c
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (int8_t x = 0; x < SHAPE_WIDTH; x++)
|
for (int8_t x = 0; x < SHAPE_WIDTH; x++)
|
||||||
if (is_set(shape_row, x))
|
if (shape_is_set(shape_row, x))
|
||||||
draw_block(renderer, pos_x + x, pos_y + y);
|
draw_block(renderer, pos_x + x, pos_y + y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user