From d64514659c38c672e65ffccd6f44a64143a4dbfd Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Mon, 19 Aug 2019 15:53:22 -0400 Subject: remove das code and simplify some other stuff --- core/include/cetris.h | 112 -------------------------------------------------- core/include/input.h | 9 ---- core/include/matrix.h | 14 ------- core/include/test.h | 8 ---- core/include/types.h | 29 ------------- 5 files changed, 172 deletions(-) delete mode 100644 core/include/cetris.h delete mode 100644 core/include/input.h delete mode 100644 core/include/matrix.h delete mode 100644 core/include/test.h delete mode 100644 core/include/types.h (limited to 'core/include') diff --git a/core/include/cetris.h b/core/include/cetris.h deleted file mode 100644 index 4a1c1fa..0000000 --- a/core/include/cetris.h +++ /dev/null @@ -1,112 +0,0 @@ -#pragma once - -#include -#include - -#include "types.h" - -#define CETRIS_BOARD_X 10 -#define CETRIS_BOARD_Y 40 -#define CETRIS_BOARD_VISABLE 20 - -#define CETRIS_HZ 60 -#define CETRIS_DAS_DELAY 11 -#define CETRIS_DAS_PERIOD 3 -#define CETRIS_DROP_PERIOD 2 -#define CETRIS_NEXT_PIECE_DELAY 40 -#define CETRIS_LINE_CLEAR_DELAY 40 -#define CETRIS_LOCK_DELAY 30 -#define CETRIS_WAIT_ON_CLEAR 0 - -#define CETRIS_STARTING_LEVEL 1 - -typedef enum { - O, I, S, Z, L, J, T -} type; - -typedef enum { - COLOR_NONE, - COLOR_O, // yellow - COLOR_I, // cyan - COLOR_S, // green - COLOR_Z, // red - COLOR_L, // orange - COLOR_J, // blue - COLOR_T // purple -} color; - -typedef enum { - INIT, - ONCE_RIGHT, - ONCE_LEFT, - TWICE -} rstate; - -typedef struct { - type t; - rstate r; - color c; - piece_matrix m; - i8 ghost_y; - vec2 pos; - u32 lock_tick; - bool locked; -} tetrimino; - -typedef struct { - bool occupied; - bool ghost; - bool constant; - u32 remove_tick; - color c; -} slot; - -typedef struct { - /* playfield represented by a 2d array */ - slot board[CETRIS_BOARD_X][CETRIS_BOARD_Y]; - - /* constant queue of all 7 possible tetrimino */ - tetrimino piece_queue[7]; - - /* current tetrimino */ - tetrimino current; - tetrimino held; - bool piece_held; - u8 current_index; - - /* input_manager */ - bool held_moves[7]; - input_t prev_das_move; - u8 das_repeat; - u32 das_move_tick; - u32 down_move_tick; - - /* internal game tick */ - u32 tick; - u32 next_drop_tick; - u32 next_piece_tick; - - /* progress trackers */ - u32 lines; - u32 level; - bool game_over; - - /* scoring flags */ - bool tspin; - bool mini_tspin; - - /* score counter */ - u32 score; -} cetris_game; - -void next_piece(cetris_game* g); -void update_board(cetris_game* g); -void lock_current(cetris_game* g); - -/* API PROTOTYPES FUNCTIONS */ - -void init_game(cetris_game* g); -void update_game_tick(cetris_game* g); -void move_piece(cetris_game* g, input_t move, bool hold); -void hold_piece(cetris_game* g); -void stop_holding(cetris_game* g, input_t move); diff --git a/core/include/input.h b/core/include/input.h deleted file mode 100644 index 95cb2aa..0000000 --- a/core/include/input.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include - -#include "cetris.h" - -bool handle_inputs(cetris_game *g); -void clear_held_key(cetris_game *g); diff --git a/core/include/matrix.h b/core/include/matrix.h deleted file mode 100644 index eb9e272..0000000 --- a/core/include/matrix.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -#include "types.h" -#include "cetris.h" - -extern const piece_matrix default_matrices[7]; - -void move_current(cetris_game* g, input_t move); -void hard_drop(cetris_game* g); -void rotate_matrix(cetris_game* g, bool clockwise); -void set_matrix(cetris_game* g, piece_matrix* m); -i8 check_matrix(cetris_game* g, piece_matrix* m); diff --git a/core/include/test.h b/core/include/test.h deleted file mode 100644 index 4b8622e..0000000 --- a/core/include/test.h +++ /dev/null @@ -1,8 +0,0 @@ -#include "cetris.h" - -typedef enum { - TSPIN, - TSPIN_NO_LINES -} test; - -void apply_test_board( cetris_game* g, test t); diff --git a/core/include/types.h b/core/include/types.h deleted file mode 100644 index 3471f3c..0000000 --- a/core/include/types.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -#define u8 uint8_t -#define u16 uint16_t -#define u32 uint32_t -#define u64 uint64_t -#define i8 int8_t -#define i16 int16_t -#define i32 int32_t -#define i64 int64_t - -typedef struct { - i8 x; - i8 y; -} vec2; - -typedef u8 piece_matrix[4][4]; - -typedef enum { - DOWN = 1, - USER_DOWN = 2, - RIGHT = 3, - LEFT = 4, - ROTATE_CCW = 5, - ROTATE_CW = 6, - HARD_DROP = 7 -} input_t; -- cgit v1.2.3-101-g0448