mes granera
This commit is contained in:
42
CLAUDE.md
42
CLAUDE.md
@@ -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:
|
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()`
|
- **JG** (`source/core/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
|
- **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/jail_audio`) — Custom audio mixing using SDL3 audio streams directly (OGG via stb_vorbis, WAV). Manages music and sound channels independently
|
- **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/jinput`) — Input: keyboard state polling, key debouncing, cheat code detection
|
- **JI** (`source/core/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/`)
|
- **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/jshader`) — OpenGL post-processing shader (CRT effect) applied to the back buffer
|
- **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)
|
- **ModuleSequence** — 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
|
- **ModuleGame** — 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`)
|
- **Sprite** — Base class for animated entities (frame/animation data via `Entitat`)
|
||||||
- **Prota** (`prota.cpp/h`) — Player character ("Sam"), extends Sprite
|
- **Prota** — 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
|
- **Mapa** — Level map with tomb grid (16 tombs), items (treasure, keys, pharaoh, mummy, scroll, diamond), door logic
|
||||||
- **Momia** (`momia.cpp/h`) — Enemy: mummies
|
- **Momia** — Enemy: mummies
|
||||||
- **Bola** (`bola.cpp/h`) — Enemy: projectile ball
|
- **Bola** — Enemy: projectile ball
|
||||||
- **Marcador** (`marcador.cpp/h`) — HUD/scoreboard
|
- **Marcador** — HUD/scoreboard
|
||||||
- **info** (`info.cpp/h`) — Global game state namespace (room number, pyramid, money, diamonds, lives, etc.)
|
- **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.
|
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
|
- Graphics loaded from GIF files, palettes extracted from GIF headers
|
||||||
- Music files are numbered OGG files (`00000001.ogg` etc.)
|
- Music files are numbered OGG files (`00000001.ogg` etc.)
|
||||||
- `trick.ini` presence enables the secret character
|
- `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`
|
||||||
|
|||||||
@@ -12,23 +12,28 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
|
|
||||||
# --- LISTA EXPLÍCITA DE FUENTES ---
|
# --- LISTA EXPLÍCITA DE FUENTES ---
|
||||||
set(APP_SOURCES
|
set(APP_SOURCES
|
||||||
|
# Core - Motor "Jail"
|
||||||
|
source/core/jail_audio.cpp
|
||||||
|
source/core/jdraw8.cpp
|
||||||
|
source/core/jfile.cpp
|
||||||
|
source/core/jgame.cpp
|
||||||
|
source/core/jinput.cpp
|
||||||
|
source/core/jshader.cpp
|
||||||
|
|
||||||
|
# Game
|
||||||
|
source/game/bola.cpp
|
||||||
|
source/game/engendro.cpp
|
||||||
|
source/game/info.cpp
|
||||||
|
source/game/mapa.cpp
|
||||||
|
source/game/marcador.cpp
|
||||||
|
source/game/modulegame.cpp
|
||||||
|
source/game/modulesequence.cpp
|
||||||
|
source/game/momia.cpp
|
||||||
|
source/game/prota.cpp
|
||||||
|
source/game/sprite.cpp
|
||||||
|
|
||||||
|
# Main
|
||||||
source/main.cpp
|
source/main.cpp
|
||||||
source/bola.cpp
|
|
||||||
source/engendro.cpp
|
|
||||||
source/info.cpp
|
|
||||||
source/jail_audio.cpp
|
|
||||||
source/jdraw8.cpp
|
|
||||||
source/jfile.cpp
|
|
||||||
source/jgame.cpp
|
|
||||||
source/jinput.cpp
|
|
||||||
source/jshader.cpp
|
|
||||||
source/mapa.cpp
|
|
||||||
source/marcador.cpp
|
|
||||||
source/modulegame.cpp
|
|
||||||
source/modulesequence.cpp
|
|
||||||
source/momia.cpp
|
|
||||||
source/prota.cpp
|
|
||||||
source/sprite.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Configuración de SDL3
|
# Configuración de SDL3
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef JA_USESDLMIXER
|
#ifndef JA_USESDLMIXER
|
||||||
#include "jail_audio.h"
|
#include "core/jail_audio.hpp"
|
||||||
#include "stb_vorbis.h"
|
#include "external/stb_vorbis.h"
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
#include "jfile.h"
|
#include "core/jfile.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "gif.h"
|
#include "external/gif.h"
|
||||||
#include "jshader.h"
|
#include "core/jshader.hpp"
|
||||||
|
|
||||||
#define SCREEN_WIDTH 960
|
#define SCREEN_WIDTH 960
|
||||||
#define SCREEN_HEIGHT 720
|
#define SCREEN_HEIGHT 720
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "jfile.h"
|
#include "core/jfile.hpp"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
|
|
||||||
bool eixir = false;
|
bool eixir = false;
|
||||||
Uint32 updateTicks = 0;
|
Uint32 updateTicks = 0;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "jinput.h"
|
#include "core/jinput.hpp"
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const bool *keystates;// = SDL_GetKeyboardState( NULL );
|
const bool *keystates;// = SDL_GetKeyboardState( NULL );
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "jshader.h"
|
#include "core/jshader.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
0
source/gif.h → source/external/gif.h
vendored
0
source/gif.h → source/external/gif.h
vendored
@@ -1,5 +1,5 @@
|
|||||||
#include "bola.h"
|
#include "game/bola.hpp"
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Bola::Bola( JD8_Surface gfx, Prota* sam ) : Sprite( gfx ) {
|
Bola::Bola( JD8_Surface gfx, Prota* sam ) : Sprite( gfx ) {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "game/sprite.hpp"
|
||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
|
|
||||||
class Bola : public Sprite {
|
class Bola : public Sprite {
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "engendro.h"
|
#include "game/engendro.hpp"
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Engendro::Engendro( JD8_Surface gfx, Uint16 x, Uint16 y ) : Sprite( gfx ) {
|
Engendro::Engendro( JD8_Surface gfx, Uint16 x, Uint16 y ) : Sprite( gfx ) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "game/sprite.hpp"
|
||||||
|
|
||||||
class Engendro : public Sprite {
|
class Engendro : public Sprite {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
|
|
||||||
namespace info
|
namespace info
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "mapa.h"
|
#include "game/mapa.hpp"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include "jinput.h"
|
#include "core/jinput.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Mapa::Mapa( JD8_Surface gfx, Prota* sam ) {
|
Mapa::Mapa( JD8_Surface gfx, Prota* sam ) {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
|
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
|
|
||||||
#define CONTE_RES 0
|
#define CONTE_RES 0
|
||||||
#define CONTE_TRESOR 1
|
#define CONTE_TRESOR 1
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "marcador.h"
|
#include "game/marcador.hpp"
|
||||||
|
|
||||||
Marcador::Marcador( JD8_Surface gfx, Prota* sam ) {
|
Marcador::Marcador( JD8_Surface gfx, Prota* sam ) {
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
|
|
||||||
class Marcador {
|
class Marcador {
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "modulegame.h"
|
#include "game/modulegame.hpp"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
#include "jail_audio.h"
|
#include "core/jail_audio.hpp"
|
||||||
#include "jinput.h"
|
#include "core/jinput.hpp"
|
||||||
#include "jfile.h"
|
#include "core/jfile.hpp"
|
||||||
|
|
||||||
ModuleGame::ModuleGame() {
|
ModuleGame::ModuleGame() {
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
#include "mapa.h"
|
#include "game/mapa.hpp"
|
||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
#include "marcador.h"
|
#include "game/marcador.hpp"
|
||||||
#include "momia.h"
|
#include "game/momia.hpp"
|
||||||
#include "bola.h"
|
#include "game/bola.hpp"
|
||||||
|
|
||||||
class ModuleGame {
|
class ModuleGame {
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "modulesequence.h"
|
#include "game/modulesequence.hpp"
|
||||||
|
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
#include "jinput.h"
|
#include "core/jinput.hpp"
|
||||||
#include "jfile.h"
|
#include "core/jfile.hpp"
|
||||||
#include "jail_audio.h"
|
#include "core/jail_audio.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
|
|
||||||
class ModuleSequence {
|
class ModuleSequence {
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "momia.h"
|
#include "game/momia.hpp"
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Momia::Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
Momia::Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "game/sprite.hpp"
|
||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
#include "engendro.h"
|
#include "game/engendro.hpp"
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
|
|
||||||
class Momia : public Sprite {
|
class Momia : public Sprite {
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "prota.h"
|
#include "game/prota.hpp"
|
||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include "jinput.h"
|
#include "core/jinput.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Prota::Prota( JD8_Surface gfx ) : Sprite( gfx ) {
|
Prota::Prota( JD8_Surface gfx ) : Sprite( gfx ) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "game/sprite.hpp"
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
|
|
||||||
class Prota : public Sprite {
|
class Prota : public Sprite {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "sprite.h"
|
#include "game/sprite.hpp"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Sprite::Sprite( JD8_Surface gfx ) {
|
Sprite::Sprite( JD8_Surface gfx ) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
|
|
||||||
struct Frame {
|
struct Frame {
|
||||||
Uint16 x;
|
Uint16 x;
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "jgame.h"
|
#include "core/jgame.hpp"
|
||||||
#include "jdraw8.h"
|
#include "core/jdraw8.hpp"
|
||||||
#include "jail_audio.h"
|
#include "core/jail_audio.hpp"
|
||||||
#include "jfile.h"
|
#include "core/jfile.hpp"
|
||||||
#include "info.h"
|
#include "game/info.hpp"
|
||||||
#include "modulegame.h"
|
#include "game/modulegame.hpp"
|
||||||
#include "modulesequence.h"
|
#include "game/modulesequence.hpp"
|
||||||
#include "time.h"
|
#include <ctime>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user