defines
This commit is contained in:
parent
411b2e4bb3
commit
31562af99d
6 changed files with 193 additions and 111 deletions
|
|
@ -8,6 +8,21 @@
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
// Константы времени
|
||||
#define ATTACH_DELAY_MS 350
|
||||
#define INSTANT_DROP_DELAY_MS 30
|
||||
#define BASE_FALL_DELAY_MS 1100
|
||||
#define SPEED_MULTIPLIER_MS 100
|
||||
#define MAX_LEVEL 10
|
||||
|
||||
// Константы очков
|
||||
#define SCORE_PER_LEVEL 600
|
||||
#define POINTS_ONE_LINE 100
|
||||
#define POINTS_TWO_LINES 300
|
||||
#define POINTS_THREE_LINES 700
|
||||
#define POINTS_FOUR_LINES 1500
|
||||
|
||||
|
||||
typedef enum {
|
||||
Init,
|
||||
Spawn,
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ int get_milliseconds_to_wait(void) {
|
|||
int result = 0;
|
||||
|
||||
if (state->moving_type == ToDown) {
|
||||
result = 30;
|
||||
result = INSTANT_DROP_DELAY_MS;
|
||||
} else {
|
||||
int base_delay = 1100 - (state->info->speed * 100);
|
||||
result = (base_delay > 100) ? base_delay : 100;
|
||||
int base_delay = BASE_FALL_DELAY_MS - (state->info->speed * SPEED_MULTIPLIER_MS);
|
||||
result = (base_delay > SPEED_MULTIPLIER_MS) ? base_delay : SPEED_MULTIPLIER_MS;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void do_attaching(void) {
|
|||
}
|
||||
|
||||
// Проверяем, прошло ли 350мс
|
||||
if (current_time - state->attach_start_time >= 350) {
|
||||
if (current_time - state->attach_start_time >= ATTACH_DELAY_MS) {
|
||||
state->attach_completed = 1;
|
||||
state->attach_start_time = 0; // Сбрасываем таймер
|
||||
|
||||
|
|
@ -108,21 +108,21 @@ void clear_lines() {
|
|||
}
|
||||
|
||||
if (lines_cleared > 0) {
|
||||
int points[] = {0, 100, 300, 700, 1500};
|
||||
int points[] = {0, POINTS_ONE_LINE, POINTS_TWO_LINES, POINTS_THREE_LINES, POINTS_FOUR_LINES};
|
||||
state->info->score += points[lines_cleared];
|
||||
|
||||
if (state->info->score > state->info->high_score) {
|
||||
state->info->high_score = state->info->score;
|
||||
}
|
||||
|
||||
int new_level = (state->info->score / 600) + 1;
|
||||
if (new_level > 10) {
|
||||
new_level = 10;
|
||||
int new_level = (state->info->score / SCORE_PER_LEVEL) + 1;
|
||||
if (new_level > MAX_LEVEL) {
|
||||
new_level = MAX_LEVEL;
|
||||
}
|
||||
|
||||
if (new_level > state->info->level) {
|
||||
state->info->level = new_level;
|
||||
state->info->speed = new_level * 3;
|
||||
state->info->speed = new_level + (new_level / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue