Files
major_tom/include/config.h
LeSerjant 3b45572d38
All checks were successful
CI / build (pull_request) Successful in 32s
Deploy / deploy (push) Successful in 1m17s
Add game state debug log with binary ring buffer
Implement src/engine/debuglog module that records a comprehensive
snapshot of game state every tick into a 4 MB in-memory ring buffer.

Activated by --debug-log command-line flag. Press F12 during gameplay
to dump the ring buffer to a human-readable debug_log.txt file. The
buffer also auto-flushes every 10 seconds as a safety net.

Each tick snapshot captures: input state (held/pressed/released bitmasks),
full player state (position, velocity, health, dash, aim, timers),
camera position, physics globals, level name, and a variable-length
list of all active entity positions/velocities/health.

New files:
- src/engine/debuglog.h — API and snapshot data structures
- src/engine/debuglog.c — ring buffer, record, and dump logic

Modified files:
- include/config.h — DEBUGLOG_BUFFER_SIZE constant
- src/engine/input.h/c — input_get_snapshot() to pack input bitmasks
- src/engine/core.c — debuglog_record_tick() call after update
- src/main.c — CLI flag, init/shutdown, F12 hotkey, set_level calls

Closes #19
2026-03-16 20:33:03 +00:00

56 lines
3.0 KiB
C

#ifndef JNR_CONFIG_H
#define JNR_CONFIG_H
/* ── Window ─────────────────────────────────────────── */
#define WINDOW_TITLE "Jump 'n Run"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 360
#define WINDOW_SCALE 2 /* integer scale for crisp pixels */
/* ── Timing ─────────────────────────────────────────── */
#define TICK_RATE 60 /* physics updates per second */
#define DT (1.0f / TICK_RATE)
#define MAX_FRAME_SKIP 5 /* prevent spiral of death */
/* ── Physics ────────────────────────────────────────── */
#define DEFAULT_GRAVITY 980.0f /* pixels/s^2 (Earth-like) */
#define MAX_FALL_SPEED 600.0f /* terminal velocity */
/* ── Tiles ──────────────────────────────────────────── */
#define TILE_SIZE 16 /* pixels per tile */
#define MAX_TILE_DEFS 256 /* unique tile types */
#define MAX_MAP_SIZE 8192 /* max width or height in tiles */
/* ── Entities ───────────────────────────────────────── */
#define MAX_ENTITIES 512
#define MAX_ENTITY_SPAWNS 512 /* max entity spawns per level */
/* ── Level transitions ─────────────────────────────── */
#define MAX_EXIT_ZONES 16 /* max exit zones per level */
typedef enum TransitionStyle {
TRANS_NONE, /* instant cut (default) */
TRANS_SPACECRAFT, /* handled by spacecraft entity */
TRANS_ELEVATOR, /* doors close, rumble, doors open */
TRANS_TELEPORTER, /* scanline dissolve, flash, materialize */
TRANS_STYLE_COUNT
} TransitionStyle;
/* ── Rendering ──────────────────────────────────────── */
#define MAX_SPRITES 2048 /* max queued sprites per frame */
/* ── Audio ──────────────────────────────────────────── */
#define AUDIO_FREQUENCY 48000
#define AUDIO_CHANNELS 2
#define AUDIO_CHUNK_SIZE 4096
#define MAX_SFX_CHANNELS 16
/* ── Assets ─────────────────────────────────────────── */
#define MAX_ASSETS 128
#define ASSET_PATH_MAX 256
/* ── Debug log ──────────────────────────────────────── */
#define DEBUGLOG_BUFFER_SIZE (4 * 1024 * 1024) /* 4 MB ring buffer */
#endif /* JNR_CONFIG_H */