summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2018-07-09 02:43:50 +0300
committerOxore <oxore@protonmail.com>2018-07-09 02:43:50 +0300
commita9e7132e6a430e86e8a69d1301252e38daf6e593 (patch)
tree08e7865c55883e40db966a9851b546b95bc4524b /include
parent67186f876e17696858495a2a7a699344b0f94178 (diff)
Introduce phantom shape, refactor field
Introduce phantom shape feature, yay! Refactor field: rename attribute of invisible empty cells, remove "color" member from struct shape, introduce shape movement functions with embedded collision checking and success reporting,
Diffstat (limited to 'include')
-rw-r--r--include/field.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/field.h b/include/field.h
index 30ed56b..52b4de8 100644
--- a/include/field.h
+++ b/include/field.h
@@ -1,5 +1,7 @@
-#define FLD_ATTR_INVISIBLE (1 << 0)
-#define FLD_ATTR_TRANSPARENT (1 << 1)
+#define FLD_ATTR_INVISIBLE (1 << 0)
+#define FLD_ATTR_HIDE_EMPTY_CELLS (1 << 1)
+
+#define SHP_ATTR_GHOST (1 << 0)
struct cell {
char a; // active/empty state of cell
@@ -24,11 +26,10 @@ struct cell {
*/
struct shape {
- int x; // x coord of shape's left side
- int y; // y coord of shape's bottom
+ struct vector2i; // position
int t; // shape type
- unsigned int color; // shape color
- char c[4][4]; // array of logic shape cells
+ unsigned int attr;
+ char c[4][4];
};
struct field {
@@ -47,6 +48,9 @@ void field_deinit(struct field *fld);
void field_fill_random(struct field *fld);
void field_clear(struct field *fld);
void field_rotate_shape(struct field *fld, unsigned int index);
+int field_move_shape_down(struct field *fld, unsigned int index);
+int field_move_shape_left(struct field *fld, unsigned int index);
+int field_move_shape_right(struct field *fld, unsigned int index);
void field_put_shape(struct field *fld, struct shape *shape);
void field_reset_walking_shape(struct field *fld, unsigned int index);
int field_rm_lines(struct field *fld);