removed unnecessary
This commit is contained in:
parent
a0cec98aa7
commit
5ed3450d6f
10 changed files with 17 additions and 119 deletions
|
|
@ -1,5 +1,4 @@
|
|||
#include "01_automato.h"
|
||||
#include "../../logging.h"
|
||||
|
||||
void userInput(UserAction_t action, bool hold) {
|
||||
(void)hold; // заглушка
|
||||
|
|
@ -14,12 +13,10 @@ void userInput(UserAction_t action, bool hold) {
|
|||
|
||||
switch (action) {
|
||||
case Start:
|
||||
// Загружаем рекорд при старте игры
|
||||
state->info->high_score = load_high_score();
|
||||
state->state = Init;
|
||||
break;
|
||||
case Terminate:
|
||||
// Сохраняем рекорд при выходе, если текущий рекорд побит
|
||||
if (state->info->score > state->info->high_score) {
|
||||
state->info->high_score = state->info->score;
|
||||
save_high_score(state->info->high_score);
|
||||
|
|
@ -51,13 +48,10 @@ void userInput(UserAction_t action, bool hold) {
|
|||
}
|
||||
|
||||
GameInfo_t updateCurrentState() {
|
||||
LOG_FUNCTION_START("updateCurrentState", "");
|
||||
|
||||
GameState_t* state = get_game_state();
|
||||
|
||||
state->frame_count++;
|
||||
|
||||
// Обновляем логику игры только если игра не на паузе (кроме GameOver)
|
||||
if (!state->info->pause || state->state == GameOver) {
|
||||
switch (state->state) {
|
||||
case Init:
|
||||
|
|
@ -81,14 +75,12 @@ GameInfo_t updateCurrentState() {
|
|||
}
|
||||
}
|
||||
|
||||
// Подготовка данных для отображения
|
||||
for (int i = 0; i < FIELD_HEIGHT; i++) {
|
||||
for (int j = 0; j < FIELD_WIDTH; j++) {
|
||||
state->info->field[i][j] = state->field[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
// Накладываем активную фигуру на поле
|
||||
Figure_t* fig = &state->curr;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
|
|
@ -102,15 +94,11 @@ GameInfo_t updateCurrentState() {
|
|||
}
|
||||
}
|
||||
|
||||
// Копируем next
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
state->info->next[i][j] = state->next.mtrx[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
LOG_FUNCTION_END("updateCurrentState", "score=%d, level=%d, state=%d",
|
||||
state->info->score, state->info->level, state->state);
|
||||
|
||||
return *state->info;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue