prepare to merge into develop
This commit is contained in:
parent
8886f12761
commit
c473bf3f7e
3 changed files with 2 additions and 14 deletions
|
|
@ -8,14 +8,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
// Константы времени
|
|
||||||
#define ATTACH_DELAY_MS 350
|
#define ATTACH_DELAY_MS 350
|
||||||
#define INSTANT_DROP_DELAY_MS 30
|
#define INSTANT_DROP_DELAY_MS 30
|
||||||
#define BASE_FALL_DELAY_MS 1100
|
#define BASE_FALL_DELAY_MS 1100
|
||||||
#define SPEED_MULTIPLIER_MS 100
|
#define SPEED_MULTIPLIER_MS 100
|
||||||
#define MAX_LEVEL 10
|
#define MAX_LEVEL 10
|
||||||
|
|
||||||
// Константы очков
|
|
||||||
#define SCORE_PER_LEVEL 600
|
#define SCORE_PER_LEVEL 600
|
||||||
#define POINTS_ONE_LINE 100
|
#define POINTS_ONE_LINE 100
|
||||||
#define POINTS_TWO_LINES 300
|
#define POINTS_TWO_LINES 300
|
||||||
|
|
@ -67,14 +65,13 @@ typedef struct {
|
||||||
GameInfo_t* info;
|
GameInfo_t* info;
|
||||||
long long last_move_time;
|
long long last_move_time;
|
||||||
long long pause_start_time;
|
long long pause_start_time;
|
||||||
long long attach_start_time; // Время начала attach
|
long long attach_start_time;
|
||||||
int attach_completed; // Флаг завершения attach (фигура размещена)
|
int attach_completed;
|
||||||
int down_key_was_released;
|
int down_key_was_released;
|
||||||
} GameState_t;
|
} GameState_t;
|
||||||
|
|
||||||
GameState_t* get_game_state(void);
|
GameState_t* get_game_state(void);
|
||||||
|
|
||||||
// Функции состояний
|
|
||||||
void do_init(void);
|
void do_init(void);
|
||||||
int load_high_score();
|
int load_high_score();
|
||||||
void save_high_score(int score);
|
void save_high_score(int score);
|
||||||
|
|
@ -83,26 +80,20 @@ void terminate_and_free(void);
|
||||||
|
|
||||||
long long get_current_time_ms(void);
|
long long get_current_time_ms(void);
|
||||||
|
|
||||||
// spawn
|
|
||||||
void do_spawn(void);
|
void do_spawn(void);
|
||||||
|
|
||||||
// move
|
|
||||||
void do_move(void);
|
void do_move(void);
|
||||||
|
|
||||||
//moving
|
|
||||||
void do_moving(void);
|
void do_moving(void);
|
||||||
|
|
||||||
// attaching
|
|
||||||
void do_attaching(void);
|
void do_attaching(void);
|
||||||
int check_collision();
|
int check_collision();
|
||||||
void place_figure();
|
void place_figure();
|
||||||
void clear_lines();
|
void clear_lines();
|
||||||
|
|
||||||
// gameover
|
|
||||||
void do_gameover(void);
|
void do_gameover(void);
|
||||||
int is_game_over();
|
int is_game_over();
|
||||||
|
|
||||||
// Функции фигур
|
|
||||||
const int (*get_figure_shape(Sprite_t sprite, int rotation))[4];
|
const int (*get_figure_shape(Sprite_t sprite, int rotation))[4];
|
||||||
|
|
||||||
const int (*i_fig_up())[4];
|
const int (*i_fig_up())[4];
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ void userInput(UserAction_t action, bool hold) {
|
||||||
|
|
||||||
int should_process = 1;
|
int should_process = 1;
|
||||||
|
|
||||||
// Проверка паузы
|
|
||||||
if (state->info->pause) {
|
if (state->info->pause) {
|
||||||
if (action == Left || action == Right || action == Down || action == Up ||
|
if (action == Left || action == Right || action == Down || action == Up ||
|
||||||
action == Action || action == Start) {
|
action == Action || action == Start) {
|
||||||
|
|
@ -14,7 +13,6 @@ void userInput(UserAction_t action, bool hold) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Блокируем движения во время Attaching (до завершения задержки)
|
|
||||||
if (state->state == Attaching && !state->attach_completed) {
|
if (state->state == Attaching && !state->attach_completed) {
|
||||||
if (action == Left || action == Right || action == Down || action == Up ||
|
if (action == Left || action == Right || action == Down || action == Up ||
|
||||||
action == Action) {
|
action == Action) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ void do_attaching(void) {
|
||||||
GameState_t *state = get_game_state();
|
GameState_t *state = get_game_state();
|
||||||
long long current_time = get_current_time_ms();
|
long long current_time = get_current_time_ms();
|
||||||
|
|
||||||
// Если только что вошли в Attaching - размещаем фигуру и запускаем таймер
|
|
||||||
if (!state->attach_completed) {
|
if (!state->attach_completed) {
|
||||||
// Первый вход в Attaching
|
// Первый вход в Attaching
|
||||||
if (state->attach_start_time == 0) {
|
if (state->attach_start_time == 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue