mes granera

This commit is contained in:
2026-04-04 12:44:45 +02:00
parent 9e0ab87c76
commit 08ba88ec05
37 changed files with 115 additions and 104 deletions

View File

@@ -28,26 +28,31 @@ The executable is output to the project root. The `data/` folder contains runtim
All engine modules are flat C-style APIs (no classes), prefixed by subsystem:
- **JG** (`source/jgame`) — Game loop timing: init/finalize, fixed-timestep update via `JG_ShouldUpdate()`
- **JD8** (`source/jdraw8`) — 8-bit paletted software renderer. 320x200 screen buffer (`JD8_Surface` = `Uint8*`), palette-indexed blitting with color-key transparency, fade effects. `JD8_Flip()` converts the indexed buffer to ARGB, uploads to SDL texture, and renders through the CRT shader
- **JA** (`source/jail_audio`) — Custom audio mixing using SDL3 audio streams directly (OGG via stb_vorbis, WAV). Manages music and sound channels independently
- **JI** (`source/jinput`) — Input: keyboard state polling, key debouncing, cheat code detection
- **JF** (`source/jfile`) — File I/O: supports loading from filesystem folder or a packed resource file (`.jrf`). Currently uses folder mode (`data/`)
- **shader** (`source/jshader`) — OpenGL post-processing shader (CRT effect) applied to the back buffer
- **JG** (`source/core/jgame`) — Game loop timing: init/finalize, fixed-timestep update via `JG_ShouldUpdate()`
- **JD8** (`source/core/jdraw8`) — 8-bit paletted software renderer. 320x200 screen buffer (`JD8_Surface` = `Uint8*`), palette-indexed blitting with color-key transparency, fade effects. `JD8_Flip()` converts the indexed buffer to ARGB, uploads to SDL texture, and renders through the CRT shader
- **JA** (`source/core/jail_audio`) — Custom audio mixing using SDL3 audio streams directly (OGG via stb_vorbis, WAV). Manages music and sound channels independently
- **JI** (`source/core/jinput`) — Input: keyboard state polling, key debouncing, cheat code detection
- **JF** (`source/core/jfile`) — File I/O: supports loading from filesystem folder or a packed resource file (`.jrf`). Currently uses folder mode (`data/`)
- **shader** (`source/core/jshader`) — OpenGL post-processing shader (CRT effect) applied to the back buffer
### Game Modules
### Game Modules (`source/game/`)
- **ModuleSequence** (`modulesequence.cpp/h`) — Non-gameplay screens: intro, menu, slides, banners, credits, death screen. State machine entry point (state=1)
- **ModuleGame** (`modulegame.cpp/h`) — Core gameplay loop. Owns and orchestrates all game objects. State=0
- **Sprite** (`sprite.cpp/h`) — Base class for animated entities (frame/animation data via `Entitat`)
- **Prota** (`prota.cpp/h`) — Player character ("Sam"), extends Sprite
- **Mapa** (`mapa.cpp/h`) — Level map with tomb grid (16 tombs), items (treasure, keys, pharaoh, mummy, scroll, diamond), door logic
- **Momia** (`momia.cpp/h`) — Enemy: mummies
- **Bola** (`bola.cpp/h`) — Enemy: projectile ball
- **Marcador** (`marcador.cpp/h`) — HUD/scoreboard
- **info** (`info.cpp/h`) — Global game state namespace (room number, pyramid, money, diamonds, lives, etc.)
- **ModuleSequence** — Non-gameplay screens: intro, menu, slides, banners, credits, death screen. State machine entry point (state=1)
- **ModuleGame** — Core gameplay loop. Owns and orchestrates all game objects. State=0
- **Sprite** — Base class for animated entities (frame/animation data via `Entitat`)
- **Prota** — Player character ("Sam"), extends Sprite
- **Mapa** — Level map with tomb grid (16 tombs), items (treasure, keys, pharaoh, mummy, scroll, diamond), door logic
- **Momia** — Enemy: mummies
- **Bola** — Enemy: projectile ball
- **Marcador** — HUD/scoreboard
- **info** — Global game state namespace (room number, pyramid, money, diamonds, lives, etc.)
### Main Loop (`main.cpp`)
### External Libraries (`source/external/`)
- `gif.h` — Header-only GIF decoder
- `stb_vorbis.h` — stb single-header OGG decoder
### Main Loop (`source/main.cpp`)
A state machine alternates between `ModuleSequence` (state 1) and `ModuleGame` (state 0). Each module's `Go()` returns the next state (-1 to quit). Modules are allocated/freed each transition.
@@ -57,4 +62,5 @@ A state machine alternates between `ModuleSequence` (state 1) and `ModuleGame` (
- Graphics loaded from GIF files, palettes extracted from GIF headers
- Music files are numbered OGG files (`00000001.ogg` etc.)
- `trick.ini` presence enables the secret character
- The `gif.h` is a header-only GIF decoder; `stb_vorbis.h` is the stb single-header OGG decoder
- Includes use absolute paths from `source/` (e.g., `#include "core/jgame.hpp"`, `#include "game/info.hpp"`)
- Headers use `.hpp` extension; external third-party headers in `source/external/` keep `.h`