Files
snakePlus/include/consts.h
T

108 lines
4.3 KiB
C++

#ifndef CONSTS_H
#define CONSTS_H
#include <cstdint>
const int START_LENGTH = 4;
const int START_LENGTH_HARD = 2;
const int APPLE_SCORE = 10;
const int CURSE_DURATION_TICKS = 40;
// Evil item lifetimes (in game ticks, so density stays balanced across speed scaling)
const int BAD_APPLE_LIFETIME_TICKS = 80; // Rotten apple lasts 80 ticks (~8 spawn cycles)
const int CURSED_APPLE_LIFETIME_TICKS = 90; // Cursed apple lasts 90 ticks before despawning
const int EVIL_ITEM_BLINK_TICKS = 20; // Last 20 ticks: flashes to warn player of imminent despawn
const int EVIL_ITEM_FAST_BLINK_TICKS = 8; // Last 8 ticks: rapid strobe before disappearing
// Cursed apple palette indices in SPRITE_PALETTE_SUB
const uint16_t CURSE_PAL_OUTLINE = 16;
const uint16_t CURSE_PAL_FILL = 17;
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 = 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
// Screen size
const int X_MAX = 31;
const int Y_MAX = 23;
//*barf* Dont try this at home...
const char BITMAP_APPLE[] = {
0,0,0,2,2,0,0,0,
0,2,2,2,2,2,2,0,
0,2,2,2,2,2,2,0,
2,2,2,2,2,2,2,2,
2,2,2,2,2,1,2,2,
0,2,2,2,2,1,2,0,
0,2,2,2,2,2,2,0,
0,0,0,2,2,0,0,0
};
const char BITMAP_HEAD_RIGHT[] = {
0,3,3,3,3,3,3,0,
3,4,4,4,4,4,4,3,
3,4,7,4,7,4,4,3,
3,4,4,4,4,7,4,3,
3,4,4,4,4,7,4,3,
3,4,7,4,7,4,4,3,
3,4,4,4,4,4,4,3,
0,3,3,3,3,3,3,0
};
const char BITMAP_HEAD_UP[] = {
0,3,3,3,3,3,3,0,
3,4,4,4,4,4,4,3,
3,4,4,7,7,4,4,3,
3,4,7,4,4,7,4,3,
3,4,4,4,4,4,4,3,
3,4,7,4,4,7,4,3,
3,4,4,4,4,4,4,3,
0,3,3,3,3,3,3,0
};
const char BITMAP_SEGMENT[] = {
0,5,5,5,5,5,5,0,
5,6,6,6,6,6,6,5,
5,6,6,6,6,6,6,5,
5,6,6,6,6,6,6,5,
5,6,6,6,6,6,6,5,
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