Files
ascreamfromthedark-gb/src/globals.c
T
enne2 36e52d4d1a Implement run mechanic and level progression with top-left HUD indicator
Run (B + direction):
- player_logic.c: while holding B + direction with stamina >= 10, each tile
  takes 8 frames instead of 16 (move_progress += 2, LERP >>4 unchanged) and
  costs 10 stamina per tile. DAS_REPEAT_RUN=2 chains tiles fluidly.
- Falls back silently to normal walk when stamina < 10.

Level progression:
- New global 'level' (starts at 1). title->game resets to 1; reaching the
  hatch (victory/Going Deeper) + START increments before engine_init (new
  maze); defeat + START resets to 1.
- Top-left HUD 'L<n>' via 3 sprites (OAM 23-25) from new level.png asset
  (glyphs L, 0-9), generated by scripts/generate_level.py and converted
  with png2asset -keep_duplicate_tiles for predictable tile ordering.
- VRAM base aligned to an EVEN index (8x16 hardware ignores tile LSB) and
  placed after the stamina load claim to avoid the shared BG tile block.
- update_level_display() called every frame; hides during game over/title.

Docs: README, doc/gameplay.md and the technical report updated.
2026-06-24 11:56:19 +02:00

42 lines
968 B
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 maze[MAP_SIZE][MAP_SIZE];
uint8_t map_buffer[32 * 32];
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 level = 1;
uint8_t enemy_lx = 0;
uint8_t enemy_ly = 0;
uint8_t enemy_is_moving = 0;
uint8_t enemy_move_progress = 0;
int8_t enemy_start_lx, enemy_start_ly;
int8_t enemy_target_lx, enemy_target_ly;
int16_t enemy_start_px, enemy_start_py;
int16_t enemy_target_px, enemy_target_py;
uint8_t enemy_cooldown = 0;