Aggiungi schermata introduttiva alla storia (dopo START, prima del gioco)
Premendo START nel menu titolo appare l'introduzione narrativa: 'You were walking alone in the dead of night. Without warning, an unnatural darkness consumed the world around you. Your only comfort is a faint torch. The path behind you is gone. Descend deeper into the unknown.' Si chiude con un tasto qualsiasi, poi avvia la partita. Usa il Window layer come le altre schermate testuali. Ripristina anche death.c e instructions.c dai commit precedenti.
This commit is contained in:
@@ -9,7 +9,7 @@ SCRIPTS_DIR = scripts
|
|||||||
BUILD_DIR = build
|
BUILD_DIR = build
|
||||||
|
|
||||||
# C source files
|
# C source files
|
||||||
SRCS = $(SRC_DIR)/main.c $(SRC_DIR)/engine.c $(SRC_DIR)/globals.c $(SRC_DIR)/maze.c $(SRC_DIR)/sound.c $(SRC_DIR)/render.c $(SRC_DIR)/player_logic.c $(SRC_DIR)/enemy_logic.c $(SRC_DIR)/tiles.c $(SRC_DIR)/player.c $(SRC_DIR)/enemy.c $(SRC_DIR)/gameover.c $(SRC_DIR)/stamina.c $(SRC_DIR)/level.c $(SRC_DIR)/title_bg.c $(SRC_DIR)/screens/screens.c $(SRC_DIR)/screens/instructions.c $(SRC_DIR)/screens/death.c $(SRC_DIR)/screens/going_deeper.c $(SRC_DIR)/screens/finale.c $(SRC_DIR)/screens/credits.c
|
SRCS = $(SRC_DIR)/main.c $(SRC_DIR)/engine.c $(SRC_DIR)/globals.c $(SRC_DIR)/maze.c $(SRC_DIR)/sound.c $(SRC_DIR)/render.c $(SRC_DIR)/player_logic.c $(SRC_DIR)/enemy_logic.c $(SRC_DIR)/tiles.c $(SRC_DIR)/player.c $(SRC_DIR)/enemy.c $(SRC_DIR)/gameover.c $(SRC_DIR)/stamina.c $(SRC_DIR)/level.c $(SRC_DIR)/title_bg.c $(SRC_DIR)/screens/screens.c $(SRC_DIR)/screens/instructions.c $(SRC_DIR)/screens/death.c $(SRC_DIR)/screens/going_deeper.c $(SRC_DIR)/screens/finale.c $(SRC_DIR)/screens/credits.c $(SRC_DIR)/screens/intro.c
|
||||||
|
|
||||||
all: $(BUILD_DIR)/hello_iso.gb $(BUILD_DIR)/test_gameover.gb $(BUILD_DIR)/test_finale.gb
|
all: $(BUILD_DIR)/hello_iso.gb $(BUILD_DIR)/test_gameover.gb $(BUILD_DIR)/test_finale.gb
|
||||||
|
|
||||||
@@ -52,4 +52,4 @@ clean:
|
|||||||
rm -f $(SRC_DIR)/gameover.c $(SRC_DIR)/gameover.h
|
rm -f $(SRC_DIR)/gameover.c $(SRC_DIR)/gameover.h
|
||||||
rm -f $(SRC_DIR)/stamina.c $(SRC_DIR)/stamina.h
|
rm -f $(SRC_DIR)/stamina.c $(SRC_DIR)/stamina.h
|
||||||
rm -f $(SRC_DIR)/level.c $(SRC_DIR)/level.h
|
rm -f $(SRC_DIR)/level.c $(SRC_DIR)/level.h
|
||||||
rm -f $(SRC_DIR)/title_bg.c $(SRC_DIR)/screens/screens.c $(SRC_DIR)/screens/instructions.c $(SRC_DIR)/screens/death.c $(SRC_DIR)/screens/going_deeper.c $(SRC_DIR)/screens/finale.c $(SRC_DIR)/screens/credits.c $(SRC_DIR)/title_bg.h
|
rm -f $(SRC_DIR)/title_bg.c $(SRC_DIR)/screens/screens.c $(SRC_DIR)/screens/instructions.c $(SRC_DIR)/screens/death.c $(SRC_DIR)/screens/going_deeper.c $(SRC_DIR)/screens/finale.c $(SRC_DIR)/screens/credits.c $(SRC_DIR)/screens/intro.c $(SRC_DIR)/title_bg.h
|
||||||
|
|||||||
@@ -48,3 +48,4 @@ uint8_t enemy_cooldown[MAX_ENEMIES] = {0};
|
|||||||
volatile uint8_t hint_active = 0;
|
volatile uint8_t hint_active = 0;
|
||||||
volatile uint8_t hint_displayed = 0;
|
volatile uint8_t hint_displayed = 0;
|
||||||
volatile uint8_t credits_active = 0;
|
volatile uint8_t credits_active = 0;
|
||||||
|
volatile uint8_t intro_active = 0;
|
||||||
|
|||||||
@@ -86,4 +86,8 @@ extern volatile uint8_t hint_displayed;
|
|||||||
// credits_active: 1 = mostra la schermata crediti (SELECT nel menu titolo)
|
// credits_active: 1 = mostra la schermata crediti (SELECT nel menu titolo)
|
||||||
extern volatile uint8_t credits_active;
|
extern volatile uint8_t credits_active;
|
||||||
|
|
||||||
|
// --- Intro Screen ---
|
||||||
|
// intro_active: 1 = mostra l'introduzione alla storia (dopo START, prima del gioco)
|
||||||
|
extern volatile uint8_t intro_active;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+16
-7
@@ -20,24 +20,33 @@ void main(void) {
|
|||||||
uint8_t keys = joypad();
|
uint8_t keys = joypad();
|
||||||
|
|
||||||
if (app_state == 0) {
|
if (app_state == 0) {
|
||||||
// Schermata crediti attiva: B per tornare al titolo
|
|
||||||
if (credits_active) {
|
if (credits_active) {
|
||||||
|
// Credits: B per tornare al titolo
|
||||||
if ((keys & J_B) && !(prev_keys & J_B)) {
|
if ((keys & J_B) && !(prev_keys & J_B)) {
|
||||||
HIDE_WIN;
|
HIDE_WIN;
|
||||||
BGP_REG = 0xE4;
|
BGP_REG = 0xE4;
|
||||||
// Ripristina i tile del titolo (font li aveva sovrascritti)
|
|
||||||
set_bkg_data(0, title_bg_TILE_COUNT, title_bg_tiles);
|
set_bkg_data(0, title_bg_TILE_COUNT, title_bg_tiles);
|
||||||
set_bkg_tiles(0, 0, title_bg_WIDTH / 8, title_bg_HEIGHT / 8, title_bg_map);
|
set_bkg_tiles(0, 0, title_bg_WIDTH / 8, title_bg_HEIGHT / 8, title_bg_map);
|
||||||
credits_active = 0;
|
credits_active = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (intro_active) {
|
||||||
title_update(keys, prev_keys);
|
// Intro: un tasto qualsiasi avvia la partita
|
||||||
if ((keys & J_START) && !(prev_keys & J_START)) {
|
if (keys && !prev_keys) {
|
||||||
|
HIDE_WIN;
|
||||||
|
BGP_REG = 0xE4;
|
||||||
app_state = 1;
|
app_state = 1;
|
||||||
level = 1; // Nuova partita dal livello 1
|
level = 1;
|
||||||
|
intro_active = 0;
|
||||||
engine_init();
|
engine_init();
|
||||||
}
|
}
|
||||||
// SELECT nel titolo: mostra i crediti
|
} else {
|
||||||
|
title_update(keys, prev_keys);
|
||||||
|
// START: mostra l'introduzione alla storia
|
||||||
|
if ((keys & J_START) && !(prev_keys & J_START)) {
|
||||||
|
intro_active = 1;
|
||||||
|
show_intro();
|
||||||
|
}
|
||||||
|
// SELECT: mostra i crediti
|
||||||
if ((keys & J_SELECT) && !(prev_keys & J_SELECT)) {
|
if ((keys & J_SELECT) && !(prev_keys & J_SELECT)) {
|
||||||
show_credits();
|
show_credits();
|
||||||
credits_active = 1;
|
credits_active = 1;
|
||||||
|
|||||||
+4
-6
@@ -12,11 +12,9 @@ void show_death(void) {
|
|||||||
font_t dead_font = font_load(font_ibm);
|
font_t dead_font = font_load(font_ibm);
|
||||||
font_set(dead_font);
|
font_set(dead_font);
|
||||||
memset(map_buffer, 0, sizeof(map_buffer));
|
memset(map_buffer, 0, sizeof(map_buffer));
|
||||||
ending_puttext(5, 3, "YOU DIED");
|
ending_puttext(2, 5, "THE DARK CLAIMED");
|
||||||
ending_puttext(2, 5, "THE DARK CLAIMS");
|
ending_puttext(8, 7, "YOU");
|
||||||
ending_puttext(5, 6, "ANOTHER");
|
ending_puttext(4, 14, "PRESS START");
|
||||||
ending_puttext(2, 9, "JUST ANOTHER SCREAM");
|
ending_puttext(5, 15, "AND RETRY");
|
||||||
ending_puttext(3, 10, "FROM THE DARK.");
|
|
||||||
ending_puttext(5, 14, "GAME OVER");
|
|
||||||
set_bkg_tiles(0, 0, 32, 32, map_buffer);
|
set_bkg_tiles(0, 0, 32, 32, map_buffer);
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,13 @@ void show_instructions(void) {
|
|||||||
font_set(hint_font);
|
font_set(hint_font);
|
||||||
BGP_REG = 0x1B; // palette invertita (sfondo nero, testo chiaro)
|
BGP_REG = 0x1B; // palette invertita (sfondo nero, testo chiaro)
|
||||||
memset(map_buffer, 0, sizeof(map_buffer));
|
memset(map_buffer, 0, sizeof(map_buffer));
|
||||||
ending_puttext(3, 3, "FIND THE HATCH");
|
|
||||||
ending_puttext(5, 7, "DPAD WALK");
|
ending_puttext(3, 2, "FIND THE HATCH");
|
||||||
ending_puttext(2, 9, "A + DPAD JUMP");
|
ending_puttext(4, 8, "DPAD WALK");
|
||||||
|
ending_puttext(2, 9, "A + DPAD JUMP");
|
||||||
ending_puttext(2, 10, "B + DPAD RUN");
|
ending_puttext(2, 10, "B + DPAD RUN");
|
||||||
ending_puttext(2, 13, "PRESS B TO CONTINUE");
|
ending_puttext(2, 12, "PRESS B");
|
||||||
ending_puttext(4, 14, "SELECT: HELP");
|
ending_puttext(2, 13, "TO CONTINUE");
|
||||||
// Window layer: tile map separato (0x9C00) dal BG (0x9800)
|
// Window layer: tile map separato (0x9C00) dal BG (0x9800)
|
||||||
set_win_tiles(0, 0, 32, 32, map_buffer);
|
set_win_tiles(0, 0, 32, 32, map_buffer);
|
||||||
move_win(7, 0); // -7 pixel offset: allinea a sinistra
|
move_win(7, 0); // -7 pixel offset: allinea a sinistra
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "screens.h"
|
||||||
|
#include "../globals.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// Schermata di introduzione alla storia (dopo START, prima del gioco).
|
||||||
|
// Si chiude con un tasto qualsiasi. Usa il Window layer.
|
||||||
|
void show_intro(void) {
|
||||||
|
HIDE_SPRITES;
|
||||||
|
font_init();
|
||||||
|
font_t intro_font = font_load(font_ibm);
|
||||||
|
font_set(intro_font);
|
||||||
|
BGP_REG = 0x1B;
|
||||||
|
memset(map_buffer, 0, sizeof(map_buffer));
|
||||||
|
ending_puttext(2, 1, "You were walking");
|
||||||
|
ending_puttext(1, 2, "alone in the dead");
|
||||||
|
ending_puttext(6, 3, "of night.");
|
||||||
|
ending_puttext(1, 5, "Without warning, an");
|
||||||
|
ending_puttext(1, 6, "unnatural darkness");
|
||||||
|
ending_puttext(0, 7, "consumed the world.");
|
||||||
|
ending_puttext(1, 9, "Your only comfort:");
|
||||||
|
ending_puttext(3, 10, "a faint torch.");
|
||||||
|
ending_puttext(0, 12, "The path behind you");
|
||||||
|
ending_puttext(6, 13, "is gone.");
|
||||||
|
ending_puttext(0, 15, "Descend deeper into");
|
||||||
|
ending_puttext(6, 16, "the unknown.");
|
||||||
|
set_win_tiles(0, 0, 32, 32, map_buffer);
|
||||||
|
move_win(7, 0);
|
||||||
|
SHOW_WIN;
|
||||||
|
}
|
||||||
@@ -29,6 +29,9 @@ void show_finale(void);
|
|||||||
// Schermata dei crediti (SELECT nel menu titolo)
|
// Schermata dei crediti (SELECT nel menu titolo)
|
||||||
void show_credits(void);
|
void show_credits(void);
|
||||||
|
|
||||||
|
// Schermata di introduzione alla storia (dopo START, prima del gioco)
|
||||||
|
void show_intro(void);
|
||||||
|
|
||||||
// Helper condivisi (definiti in screens.c)
|
// Helper condivisi (definiti in screens.c)
|
||||||
void ending_puttext(uint8_t col, uint8_t row, const char *s);
|
void ending_puttext(uint8_t col, uint8_t row, const char *s);
|
||||||
void ending_putdigit(uint8_t col, uint8_t row, uint8_t digit);
|
void ending_putdigit(uint8_t col, uint8_t row, uint8_t digit);
|
||||||
|
|||||||
Reference in New Issue
Block a user