From de55ba092e7ad1704bb8660d5f135c232fe11bee Mon Sep 17 00:00:00 2001 From: Matteo Benedetto Date: Fri, 26 Jun 2026 12:24:04 +0200 Subject: [PATCH] Evita che le istruzioni riappaiano ripetendo il livello 1 Aggiunge hint_shown_once: le istruzioni appaiono solo la prima volta che si gioca il livello 1. Se il giocatore muore e riprova, o torna al titolo e ricomincia, le istruzioni non si rimostrano. SELECT in gioco rimane disponibile per rivederle quando si vuole. --- src/engine.c | 4 +++- src/globals.c | 1 + src/globals.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine.c b/src/engine.c index d3ef6fc..237d334 100644 --- a/src/engine.c +++ b/src/engine.c @@ -73,7 +73,8 @@ void engine_init(void) { // la ROM a 32KB e' piena e il linker potrebbe troncare la coda). hint_active = 0; hint_displayed = 0; - if (level == 1) hint_active = 1; + // Mostra le istruzioni SOLO la prima volta che si gioca il livello 1 + if (level == 1 && !hint_shown_once) hint_active = 1; // Carica il font testuale di sistema (IBM) font_init(); @@ -212,6 +213,7 @@ void engine_update(uint8_t keys, uint8_t prev_keys) { if (hint_active) { if (!hint_displayed) { hint_displayed = 1; + hint_shown_once = 1; // segna che le istruzioni sono state mostrate show_instructions(); } // B chiude la schermata e riprende il gioco diff --git a/src/globals.c b/src/globals.c index 6f08a85..a6dc37a 100644 --- a/src/globals.c +++ b/src/globals.c @@ -47,5 +47,6 @@ int16_t enemy_target_px[MAX_ENEMIES], enemy_target_py[MAX_ENEMIES]; uint8_t enemy_cooldown[MAX_ENEMIES] = {0}; volatile uint8_t hint_active = 0; volatile uint8_t hint_displayed = 0; +volatile uint8_t hint_shown_once = 0; volatile uint8_t credits_active = 0; volatile uint8_t intro_active = 0; diff --git a/src/globals.h b/src/globals.h index 6c7fd7b..ee6db24 100644 --- a/src/globals.h +++ b/src/globals.h @@ -81,6 +81,9 @@ extern uint8_t enemy_cooldown[MAX_ENEMIES]; // hint_displayed: 1 = la schermata e' gia' stata renderizzata questo frame. extern volatile uint8_t hint_active; extern volatile uint8_t hint_displayed; +// hint_shown_once: 1 = le istruzioni sono gia' state mostrate una volta +// (evita che riappaiano ripetendo il livello 1) +extern volatile uint8_t hint_shown_once; // --- Credits Screen --- // credits_active: 1 = mostra la schermata crediti (SELECT nel menu titolo)