crawl was redesigned to crwal1 and crawl2

This commit is contained in:
Filipriec
2025-11-16 22:40:09 +01:00
parent cf07c9c47a
commit 42ad5ee7a2
7 changed files with 75 additions and 36 deletions

View File

@@ -54,8 +54,20 @@ void render_loop(int speed) {
}
if (uart_event == UartEvent::Triggered) {
// start crawl frame for x time
player_state.start_crawl();
const char* msg = uart.get_message();
PlayerState current = player_state.get_state();
if (msg && strstr(msg, "crawl2")) {
// enter Crawl2 only if currently crawling in crawl1
if (current == PlayerState::Crawl1)
player_state.start_crawl(PlayerState::Crawl2);
}
else if (msg && strstr(msg, "crawl")) {
// trigger normal crawl from walk/run
if (current == PlayerState::Walk || current == PlayerState::Run)
player_state.start_crawl(PlayerState::Crawl1);
}
need_redraw = true;
}