IT WORKS NOW

This commit is contained in:
Rorikstr | Rust Dev 2025-09-29 19:23:14 +03:00
parent f5b65a390b
commit 0f2d03526e
14 changed files with 19477 additions and 31 deletions

View file

@ -1,14 +1,18 @@
#include "01_automato.h"
#include <stdlib.h>
#include "../../logging.h"
void do_spawn(void) {
LOG_FUNCTION_START("do_spawn", "");
GameState_t* state = get_game_state();
// Присваиваем curr = next
// Устанавливаем текущую фигуру из следующей (или генерируем первую)
state->curr = state->next;
state->curr.x = FIELD_WIDTH / 2 - 2;
state->curr.y = 0;
// Генерим следующую фигуру
// Генерим новую следующую фигуру
state->next.sprite = rand() % FIGURE_COUNT;
state->next.rotation = 0;
const int (*shape)[4] = get_figure_shape(state->next.sprite, 0);
@ -19,8 +23,12 @@ void do_spawn(void) {
// Проверка на GameOver
if (check_collision()) {
state->state = GameOver;
LOG_FUNCTION_END("do_spawn", "collision detected, state=%d", state->state);
return;
}
state->state = Move;
LOG_FUNCTION_END("do_spawn", "curr=(%d,%d), next_sprite=%d, state=%d",
state->curr.x, state->curr.y, state->next.sprite, state->state);
}