feat: add temporary hazardous barriers in hard mode

This commit is contained in:
phillip committed 2026-10-03 21:32:02 +02:00
1 parent 08a4b41280
commit 9a3a0bd9fd
8 files changed
+466 -17

No files matched your search

+33 -3
View File
@@ -1,6 +1,7 @@
#ifndef CONSTS_H
#define CONSTS_H
#endif
#include <cstdint>
const int START_LENGTH = 4;
const int START_LENGTH_HARD = 2;
@@ -14,9 +15,36 @@ const uint16_t CURSE_PAL_GLOW = 18;
const uint16_t CURSE_PAL_CORE = 19;
const uint16_t CURSE_PAL_LEAF = 20;
// Barrier palette indices in SPRITE_PALETTE_SUB (animated every VBlank)
const uint16_t BARRIER_PAL_EDGE = 21;
const uint16_t BARRIER_PAL_FILL = 22;
const uint16_t BARRIER_PAL_STRIPE = 23;
const uint16_t BARRIER_PAL_WARN = 24;
// Hard-mode temporary fatal barriers (all timings in 60 Hz VBlank frames,
// so they stay constant in wall-clock time while the tick rate accelerates)
const int BARRIER_START_APPLES = 3; // Barriers only start appearing after eating a few apples
const int BARRIER_MULTI_SPAWN_APPLES_2 = 16; // Apples required to spawn up to 2 barriers at once
const int BARRIER_MULTI_SPAWN_APPLES_3 = 30; // Apples required to spawn up to 3 barriers at once
const int BARRIER_MAX_COUNT = 4; // Max simultaneous barriers (reached at SPEED_APPLES_CAP)
const int BARRIER_MIN_LENGTH = 2;
const int BARRIER_BASE_MAX_LENGTH = 4; // Max length when barriers first appear
const int BARRIER_MAX_LENGTH = 10; // Max length later in the game (reached at SPEED_APPLES_CAP)
const int BARRIER_OAM_SLOTS = BARRIER_MAX_COUNT * BARRIER_MAX_LENGTH; // Reserved OAM ids 0..39
const int BARRIER_WARN_FRAMES = 120; // 2.0 s flashing announcement (harmless)
const int BARRIER_SOLIDIFY_FRAMES = 20; // Last part of warning: flickers to solid look
const int BARRIER_ACTIVE_FRAMES = 240; // 4.0 s fatal phase
const int BARRIER_FADE_FRAMES = 45; // Last part of active phase: slow blink (still fatal)
const int BARRIER_FIRST_SPAWN_FRAMES = 180; // 3.0 s grace period after reaching BARRIER_START_APPLES
const int BARRIER_INTERVAL_MAX_FRAMES = 540; // 9.0 s between spawns at BARRIER_START_APPLES
const int BARRIER_INTERVAL_MIN_FRAMES = 120; // 2.0 s between spawns at SPEED_APPLES_CAP
const int BARRIER_INTERVAL_JITTER = 60; // Random 0..1 s extra delay
const int BARRIER_RETRY_FRAMES = 30; // Retry delay if no valid spot was found
const int BARRIER_HEAD_SAFE_DISTANCE = 5; // Min wrapped Manhattan distance from the snake head
// Speed scaling configuration (gradual acceleration based on consumed apples)
const int SPEED_BASE_NORMAL_MHZ = 5000; // 5.0 Hz (~200 ms per step)
const int SPEED_BASE_HARD_MHZ = 9000; // 9.0 Hz (~111 ms per step)
const int SPEED_BASE_HARD_MHZ = 5000; // 5.0 Hz: hard mode starts as slow as normal mode
const int SPEED_MAX_NORMAL_MHZ = 13000; // 13.0 Hz (~77 ms per step)
const int SPEED_MAX_HARD_MHZ = 17000; // 17.0 Hz (~59 ms per step)
const int SPEED_APPLES_CAP = 40; // Apples consumed to reach max intensity & speed
@@ -69,4 +97,6 @@ const char BITMAP_SEGMENT[] = {
5,6,6,6,6,6,6,5,
5,6,6,6,6,6,6,5,
0,5,5,5,5,5,5,0
};
};
#endif // CONSTS_H