Files
ascreamfromthedark-gb/src/globals.c
T
enne2 4968d2e885 8-level progression with scaling difficulty and a finale
Maze size grows +2/level from 7x7 to 21x21 (cap MAX_MAP_SIZE=21, reached
at level 8). Additional difficulty axes scale with level:
- +1 ghost per level (up to MAX_ENEMIES=8); enemy state moved to arrays,
  enemy_logic.c rewritten as a multi-entity loop (own AI, render at OAM
  2+i*2, staggered cooldowns).
- Ghost cooldown shrinks: 60 -> ~11 frames between steps.
- Stamina recharge slows: 60 -> 144 frames per point.
- Fog tightens to 3x3 (fog_radius=1) from level 7.
Fog rendering uses a dynamic 16-row centered flush (with wrap) instead of
the fixed rows 2-17 / full 32x32, so the fog stays correct on big mazes
without the multi-frame stall of the full flush.

Game ends after level 8: reaching the hatch at level 8 sets game_over=3
(finale) instead of 2. Finale screen reloads the IBM font and writes
'YOU ESCAPED / THE DARKNESS / LEVEL 8 CLEARED / PRESS START' into the BG
map; START returns to the title (new game starts at level 1).

Verified via PyBoy: sizes 7..21, fog 2->1 at L7, enemies 1..8 (distinct,
on floor, can catch the player), cooldown/recharge scaling, L1 hatch ->
game_over=2, L8 hatch -> game_over=3, finale renders + START->title->L1.
2026-06-24 13:04:39 +02:00

47 lines
1.3 KiB
C

#include "globals.h"
// Define the actual memory storage for all global variables
volatile uint8_t game_over = 0;
volatile uint8_t game_over_timer = 0;
uint8_t map_size = MAP_SIZE;
uint8_t maze[MAX_MAP_SIZE][MAX_MAP_SIZE];
uint8_t map_buffer[32 * 32];
uint8_t fog_radius = 2;
uint8_t player_lx = 1;
uint8_t player_ly = 1;
uint8_t player_dir = 0;
uint8_t scroll_x = 0;
int8_t scroll_y = 0;
uint8_t stairs_lx = 0;
uint8_t stairs_ly = 0;
uint8_t is_moving = 0;
uint8_t is_jumping = 0;
uint8_t is_running = 0;
uint8_t move_progress = 0;
int8_t start_lx, start_ly;
int8_t target_lx, target_ly;
int16_t start_px, start_py;
int16_t target_px, target_py;
uint8_t stamina = 100;
uint8_t stamina_recharge_timer = 0;
uint8_t stamina_recharge_rate = 60;
uint8_t level = 1;
uint8_t num_enemies = 1;
uint8_t enemy_step_cooldown = 60;
uint8_t enemy_lx[MAX_ENEMIES] = {0};
uint8_t enemy_ly[MAX_ENEMIES] = {0};
uint8_t enemy_is_moving[MAX_ENEMIES] = {0};
uint8_t enemy_move_progress[MAX_ENEMIES] = {0};
int8_t enemy_start_lx[MAX_ENEMIES], enemy_start_ly[MAX_ENEMIES];
int8_t enemy_target_lx[MAX_ENEMIES], enemy_target_ly[MAX_ENEMIES];
int16_t enemy_start_px[MAX_ENEMIES], enemy_start_py[MAX_ENEMIES];
int16_t enemy_target_px[MAX_ENEMIES], enemy_target_py[MAX_ENEMIES];
uint8_t enemy_cooldown[MAX_ENEMIES] = {0};