Compare commits
3 Commits
6a18d880f2
...
3550f26c45
| Author | SHA1 | Date | |
|---|---|---|---|
| 3550f26c45 | |||
| c0905adc62 | |||
| f9b8edc23c |
@@ -22,7 +22,8 @@
|
||||
"WebFetch(domain:raw.githubusercontent.com)",
|
||||
"Bash(curl:*)",
|
||||
"WebFetch(domain:fktn-k.github.io)",
|
||||
"Bash(./jaildoctors_dilemma)"
|
||||
"Bash(./jaildoctors_dilemma)",
|
||||
"Bash(timeout 5 ./jaildoctors_dilemma:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
.vscode/
|
||||
*data/config/config.txt
|
||||
*data/config/config.yaml
|
||||
*stats.txt
|
||||
*.DS_Store
|
||||
thumbs.db
|
||||
|
||||
87
CLAUDE.md
87
CLAUDE.md
@@ -261,7 +261,7 @@ source/
|
||||
└── main.cpp # Application entry point
|
||||
|
||||
config/ # Configuration files
|
||||
└── assets.txt # Asset registry (text-based configuration)
|
||||
└── assets.yaml # Asset registry (text-based configuration)
|
||||
|
||||
data/ # Game assets
|
||||
├── font/ # Bitmap fonts + descriptors
|
||||
@@ -469,7 +469,7 @@ Game::run() {
|
||||
```
|
||||
Director::setFileList()
|
||||
├─ Asset::loadFromFile(config_path, PREFIX, system_folder_)
|
||||
│ ├─ Read config/assets.txt - Parse text configuration file
|
||||
│ ├─ Read config/assets.yaml - Parse text configuration file
|
||||
│ ├─ Parse each line: TYPE|PATH|OPTIONS - Extract asset information
|
||||
│ ├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER})
|
||||
│ └─ Store in unordered_map (O(1) lookup) - Fast asset path retrieval
|
||||
@@ -587,7 +587,7 @@ namespace Options {
|
||||
inline Stats stats{}; // Game statistics
|
||||
}
|
||||
|
||||
Options::loadFromFile(path); // Load from config.txt
|
||||
Options::loadFromFile(path); // Load from config.yaml
|
||||
Options::saveToFile(path); // Save on exit
|
||||
```
|
||||
|
||||
@@ -654,7 +654,7 @@ Achievements trigger notifications on unlock.
|
||||
| `Input` | Keyboard & gamepad input | Singleton |
|
||||
| `Audio` | Music and SFX playback | Singleton |
|
||||
| `Resource` | Asset caching and loading | Singleton |
|
||||
| `Asset` | Asset path registry from config/assets.txt, O(1) lookups, variable substitution | Singleton |
|
||||
| `Asset` | Asset path registry from config/assets.yaml, O(1) lookups, variable substitution | Singleton |
|
||||
| `Debug` | Debug overlay information | Singleton |
|
||||
| `globalEvents` | Global SDL event handling (quit, device reset, mouse) | Namespace |
|
||||
|
||||
@@ -717,16 +717,25 @@ Achievements trigger notifications on unlock.
|
||||
### Adding Game Assets
|
||||
|
||||
1. Place file in `data/` directory
|
||||
2. Add entry to `config/assets.txt`:
|
||||
2. Add entry to `config/assets.yaml` under the appropriate category:
|
||||
```yaml
|
||||
assets:
|
||||
category_name: # e.g., player, enemies, music, etc.
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/path/file.ext
|
||||
```
|
||||
TYPE|${PREFIX}/data/path/file.ext
|
||||
Available types: `DATA`, `BITMAP`, `ANIMATION`, `MUSIC`, `SOUND`, `FONT`, `ROOM`, `PALETTE`
|
||||
3. Optional flags can be added:
|
||||
```yaml
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/file.txt
|
||||
required: false # Don't fail if missing
|
||||
absolute: true # Path is absolute
|
||||
```
|
||||
Available types: `DATA`, `BITMAP`, `ANIMATION`, `MUSIC`, `SOUND`, `FONT`, `ROOM`, `TILEMAP`, `PALETTE`
|
||||
3. Optional flags can be added: `TYPE|${PREFIX}/path/file.ext|optional,absolute`
|
||||
4. Resource loads automatically during `Resource::init()`
|
||||
5. Access via: `Resource::Cache::get()->getSurface("name")`
|
||||
|
||||
**Note:** No recompilation needed when adding/removing/modifying assets in `config/assets.txt`
|
||||
**Note:** No recompilation needed when adding/removing/modifying assets in `config/assets.yaml`
|
||||
|
||||
### Modifying Collision Detection
|
||||
|
||||
@@ -782,36 +791,58 @@ In debug builds (`#ifdef DEBUG`), renders:
|
||||
|
||||
## 11. File Format Reference
|
||||
|
||||
### Asset Configuration File (config/assets.txt)
|
||||
Text-based asset registry with pipe-delimited format:
|
||||
```
|
||||
# Format: TYPE|PATH [|OPTIONS]
|
||||
# Comments start with # or ;
|
||||
### Asset Configuration File (config/assets.yaml)
|
||||
YAML-based asset registry with grouped structure:
|
||||
```yaml
|
||||
# JailDoctor's Dilemma - Asset Configuration
|
||||
# Variables: ${PREFIX}, ${SYSTEM_FOLDER}
|
||||
# Options: optional, absolute (comma-separated)
|
||||
|
||||
# Example entries:
|
||||
BITMAP|${PREFIX}/data/player/player.gif
|
||||
ANIMATION|${PREFIX}/data/player/player.ani
|
||||
MUSIC|${PREFIX}/data/music/title.ogg
|
||||
DATA|${SYSTEM_FOLDER}/config.txt|optional,absolute
|
||||
assets:
|
||||
# FONTS
|
||||
fonts:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/smb2.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/smb2.txt
|
||||
|
||||
# PLAYER
|
||||
player:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/player/player.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/player/player.yaml
|
||||
|
||||
# MUSIC
|
||||
music:
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/title.ogg
|
||||
|
||||
# SYSTEM FILES (optional, absolute paths)
|
||||
system:
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/config.yaml
|
||||
required: false
|
||||
absolute: true
|
||||
```
|
||||
|
||||
**Asset Structure:**
|
||||
- Assets are organized into categories (fonts, palettes, shaders, player, enemies, etc.)
|
||||
- Each asset entry contains:
|
||||
- `type` - Asset type (required)
|
||||
- `path` - File path with variable substitution (required)
|
||||
- `required` - Whether file must exist (optional, default: `true`)
|
||||
- `absolute` - Whether path is absolute (optional, default: `false`)
|
||||
|
||||
**Available Asset Types:**
|
||||
- `DATA` - General data files (text, JSON, etc.)
|
||||
- `BITMAP` - Images (GIF, PNG)
|
||||
- `ANIMATION` - Animation definition files (.ani)
|
||||
- `ANIMATION` - Animation definition files (.yaml)
|
||||
- `MUSIC` - Music files (OGG)
|
||||
- `SOUND` - Sound effects (WAV)
|
||||
- `FONT` - Font definition files
|
||||
- `ROOM` - Room data files (.room)
|
||||
- `TILEMAP` - Tilemap files (.tmx)
|
||||
- `ROOM` - Room data files (.yaml)
|
||||
- `PALETTE` - Color palette files (.pal)
|
||||
|
||||
**Options:**
|
||||
- `optional` - File is not required (won't fail check if missing)
|
||||
- `absolute` - Path is absolute (not relative to executable)
|
||||
|
||||
**Variables:**
|
||||
- `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise
|
||||
- `${SYSTEM_FOLDER}` - Replaced with user's system config folder
|
||||
@@ -865,7 +896,7 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
||||
- `Player::update()` - Physics and movement
|
||||
|
||||
### For Asset Management
|
||||
- `config/assets.txt` - Asset configuration file (text-based, no recompilation needed)
|
||||
- `config/assets.yaml` - Asset configuration file (text-based, no recompilation needed)
|
||||
- `Asset::loadFromFile()` - Loads assets from config file
|
||||
- `Resource::List::get()` - Retrieves asset path (O(1) lookup with unordered_map)
|
||||
- `Resource::load()` - Asset loading
|
||||
|
||||
36
README.md
36
README.md
@@ -30,21 +30,25 @@ Quan hages recuperat la major part de les peces, dirigeix-te a la Jail per mostr
|
||||
|
||||
El joc permet tant l'ús del teclat com d'un comandament. Les tecles per a jugar són les següents:
|
||||
|
||||
- **Cursors**: Per moure's a l'esquerra o dreta i per saltar. Es poden modificar les tecles en el fitxer de configuració, triant entre aquestes opcions:
|
||||
- O, P per moure's i Q per saltar.
|
||||
- A, D per moure's i W per saltar.
|
||||
| Tecla | Acció |
|
||||
|-------|-------|
|
||||
| **←, →** | Moure's a l'esquerra o dreta |
|
||||
| **↑** | Saltar |
|
||||
| **Enter** | Eixir dels projectes |
|
||||
| **ESC** | Cancelar / Eixir del joc |
|
||||
| **F1** | Disminuir la mida de la finestra |
|
||||
| **F2** | Augmentar la mida de la finestra |
|
||||
| **F3** | Alternar pantalla completa |
|
||||
| **F4** | Activar/desactivar els shaders |
|
||||
| **F5** | Següent paleta de colors |
|
||||
| **F6** | Paleta de colors anterior |
|
||||
| **F7** | Activar/desactivar l'escalat exacte |
|
||||
| **F8** | Activar/desactivar la música |
|
||||
| **F9** | Activar/desactivar el marge de colors |
|
||||
| **F10** | Activar/desactivar VSync |
|
||||
| **F11** | Pausar el joc |
|
||||
|
||||
- **Tecla M**: Activa o desactiva la música.
|
||||
- **Tecla P**: Pausa el joc.
|
||||
- **Tecla ESC**: Ix del joc si estàs jugant. Tanca el programa en qualsevol altra circumstància.
|
||||
- **Tecla F1**: Disminueix la mida de la finestra.
|
||||
- **Tecla F2**: Augmenta la mida de la finestra.
|
||||
- **Tecla F3**: Alterna entre el mode de pantalla completa i el mode finestra.
|
||||
- **Tecla F4**: Activa o desactiva els shaders.
|
||||
- **Tecla F5**: Estableix la següent paleta de colors.
|
||||
- **Tecla F6**: Estableix la paleta de colors prèvia.
|
||||
- **Tecla F7**: Activa o desactiva el escalat exacte.
|
||||
- **Tecla B**: Activa o desactiva el marge de colors.
|
||||
**Nota:** Les tecles de moviment (←, →, ↑) es poden redefinir des del menú del joc.
|
||||
|
||||

|
||||
|
||||
@@ -56,9 +60,9 @@ El programa guarda automàticament la configuració del mode de vídeo i les est
|
||||
|
||||
- **Windows**: `C:\Users\<nom_d'usuari>\AppData\Roaming\jailgames\jaildoctors_dilemma`
|
||||
- **MacOS**: `~/Library/Application Support/jailgames/jaildoctors_dilemma`
|
||||
- **Linux**: `~/.jailgames/jaildoctors_dilemma`
|
||||
- **Linux**: `~/.config/jailgames/jaildoctors_dilemma`
|
||||
|
||||
Dins de la carpeta es troba el fitxer de configuració `config.txt`, on es pot modificar la configuració per connectar-se al servei en línia, i els fitxers `stats.csv` i `stats_buffer.csv`, que contenen informació sobre les estadístiques del joc.
|
||||
Dins de la carpeta es troba el fitxer de configuració `config.yaml`, on es pot modificar la configuració per connectar-se al servei en línia, i els fitxers `stats.csv` i `stats_buffer.csv`, que contenen informació sobre les estadístiques del joc.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
# JailDoctor's Dilemma - Asset Configuration
|
||||
# Format: TYPE|PATH [|OPTIONS]
|
||||
# Options: optional, absolute (comma-separated)
|
||||
# Variables: ${PREFIX}, ${SYSTEM_FOLDER}
|
||||
|
||||
# ===================================================================
|
||||
# FONTS
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/font/smb2.gif
|
||||
FONT|${PREFIX}/data/font/smb2.txt
|
||||
BITMAP|${PREFIX}/data/font/aseprite.gif
|
||||
FONT|${PREFIX}/data/font/aseprite.txt
|
||||
BITMAP|${PREFIX}/data/font/gauntlet.gif
|
||||
FONT|${PREFIX}/data/font/gauntlet.txt
|
||||
BITMAP|${PREFIX}/data/font/subatomic.gif
|
||||
FONT|${PREFIX}/data/font/subatomic.txt
|
||||
BITMAP|${PREFIX}/data/font/8bithud.gif
|
||||
FONT|${PREFIX}/data/font/8bithud.txt
|
||||
|
||||
# ===================================================================
|
||||
# PALETTES
|
||||
# ===================================================================
|
||||
PALETTE|${PREFIX}/data/palette/zx-spectrum.pal
|
||||
PALETTE|${PREFIX}/data/palette/zx-spectrum-adjusted.pal
|
||||
PALETTE|${PREFIX}/data/palette/zxarne-5-2.pal
|
||||
PALETTE|${PREFIX}/data/palette/black-and-white.pal
|
||||
PALETTE|${PREFIX}/data/palette/green-phosphor.pal
|
||||
PALETTE|${PREFIX}/data/palette/orange-screen.pal
|
||||
PALETTE|${PREFIX}/data/palette/ruzx-spectrum.pal
|
||||
PALETTE|${PREFIX}/data/palette/ruzx-spectrum-revision-2.pal
|
||||
PALETTE|${PREFIX}/data/palette/pico-8.pal
|
||||
PALETTE|${PREFIX}/data/palette/sweetie-16.pal
|
||||
PALETTE|${PREFIX}/data/palette/island-joy-16.pal
|
||||
PALETTE|${PREFIX}/data/palette/lost-century.pal
|
||||
PALETTE|${PREFIX}/data/palette/na16.pal
|
||||
PALETTE|${PREFIX}/data/palette/steam-lords.pal
|
||||
|
||||
# ===================================================================
|
||||
# SHADERS
|
||||
# ===================================================================
|
||||
DATA|${PREFIX}/data/shaders/crtpi_vertex.glsl
|
||||
DATA|${PREFIX}/data/shaders/crtpi_fragment.glsl
|
||||
DATA|${PREFIX}/data/shaders/crtpi_vertex_es.glsl
|
||||
DATA|${PREFIX}/data/shaders/crtpi_fragment_es.glsl
|
||||
|
||||
# ===================================================================
|
||||
# INPUT DATA (in root, not packed - SDL needs filesystem access)
|
||||
# ===================================================================
|
||||
DATA|${PREFIX}/gamecontrollerdb.txt
|
||||
|
||||
# ===================================================================
|
||||
# SYSTEM FILES (optional, absolute paths)
|
||||
# ===================================================================
|
||||
DATA|${SYSTEM_FOLDER}/config.txt|optional,absolute
|
||||
DATA|${SYSTEM_FOLDER}/stats_buffer.csv|optional,absolute
|
||||
DATA|${SYSTEM_FOLDER}/stats.csv|optional,absolute
|
||||
DATA|${SYSTEM_FOLDER}/cheevos.bin|optional,absolute
|
||||
|
||||
# ===================================================================
|
||||
# ROOMS (60 rooms - formato YAML unificado con tilemap embebido)
|
||||
# ===================================================================
|
||||
ROOM|${PREFIX}/data/room/01.yaml
|
||||
ROOM|${PREFIX}/data/room/02.yaml
|
||||
ROOM|${PREFIX}/data/room/03.yaml
|
||||
ROOM|${PREFIX}/data/room/04.yaml
|
||||
ROOM|${PREFIX}/data/room/05.yaml
|
||||
ROOM|${PREFIX}/data/room/06.yaml
|
||||
ROOM|${PREFIX}/data/room/07.yaml
|
||||
ROOM|${PREFIX}/data/room/08.yaml
|
||||
ROOM|${PREFIX}/data/room/09.yaml
|
||||
ROOM|${PREFIX}/data/room/10.yaml
|
||||
ROOM|${PREFIX}/data/room/11.yaml
|
||||
ROOM|${PREFIX}/data/room/12.yaml
|
||||
ROOM|${PREFIX}/data/room/13.yaml
|
||||
ROOM|${PREFIX}/data/room/14.yaml
|
||||
ROOM|${PREFIX}/data/room/15.yaml
|
||||
ROOM|${PREFIX}/data/room/16.yaml
|
||||
ROOM|${PREFIX}/data/room/17.yaml
|
||||
ROOM|${PREFIX}/data/room/18.yaml
|
||||
ROOM|${PREFIX}/data/room/19.yaml
|
||||
ROOM|${PREFIX}/data/room/20.yaml
|
||||
ROOM|${PREFIX}/data/room/21.yaml
|
||||
ROOM|${PREFIX}/data/room/22.yaml
|
||||
ROOM|${PREFIX}/data/room/23.yaml
|
||||
ROOM|${PREFIX}/data/room/24.yaml
|
||||
ROOM|${PREFIX}/data/room/25.yaml
|
||||
ROOM|${PREFIX}/data/room/26.yaml
|
||||
ROOM|${PREFIX}/data/room/27.yaml
|
||||
ROOM|${PREFIX}/data/room/28.yaml
|
||||
ROOM|${PREFIX}/data/room/29.yaml
|
||||
ROOM|${PREFIX}/data/room/30.yaml
|
||||
ROOM|${PREFIX}/data/room/31.yaml
|
||||
ROOM|${PREFIX}/data/room/32.yaml
|
||||
ROOM|${PREFIX}/data/room/33.yaml
|
||||
ROOM|${PREFIX}/data/room/34.yaml
|
||||
ROOM|${PREFIX}/data/room/35.yaml
|
||||
ROOM|${PREFIX}/data/room/36.yaml
|
||||
ROOM|${PREFIX}/data/room/37.yaml
|
||||
ROOM|${PREFIX}/data/room/38.yaml
|
||||
ROOM|${PREFIX}/data/room/39.yaml
|
||||
ROOM|${PREFIX}/data/room/40.yaml
|
||||
ROOM|${PREFIX}/data/room/41.yaml
|
||||
ROOM|${PREFIX}/data/room/42.yaml
|
||||
ROOM|${PREFIX}/data/room/43.yaml
|
||||
ROOM|${PREFIX}/data/room/44.yaml
|
||||
ROOM|${PREFIX}/data/room/45.yaml
|
||||
ROOM|${PREFIX}/data/room/46.yaml
|
||||
ROOM|${PREFIX}/data/room/47.yaml
|
||||
ROOM|${PREFIX}/data/room/48.yaml
|
||||
ROOM|${PREFIX}/data/room/49.yaml
|
||||
ROOM|${PREFIX}/data/room/50.yaml
|
||||
ROOM|${PREFIX}/data/room/51.yaml
|
||||
ROOM|${PREFIX}/data/room/52.yaml
|
||||
ROOM|${PREFIX}/data/room/53.yaml
|
||||
ROOM|${PREFIX}/data/room/54.yaml
|
||||
ROOM|${PREFIX}/data/room/55.yaml
|
||||
ROOM|${PREFIX}/data/room/56.yaml
|
||||
ROOM|${PREFIX}/data/room/57.yaml
|
||||
ROOM|${PREFIX}/data/room/58.yaml
|
||||
ROOM|${PREFIX}/data/room/59.yaml
|
||||
ROOM|${PREFIX}/data/room/60.yaml
|
||||
|
||||
# ===================================================================
|
||||
# TILESETS
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/tilesets/standard.gif
|
||||
|
||||
# ===================================================================
|
||||
# ENEMIES
|
||||
# ===================================================================
|
||||
ANIMATION|${PREFIX}/data/enemies/abad_bell.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/abad_bell.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/abad.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/abad.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/amstrad_cs.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/amstrad_cs.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/flying_arounder.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/flying_arounder.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/stopped_arounder.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/stopped_arounder.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/walking_arounder.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/walking_arounder.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/arounders_door.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/arounders_door.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/arounders_machine.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/arounders_machine.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/bat.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/bat.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/batman_bell.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/batman_bell.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/batman_fire.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/batman_fire.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/batman.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/batman.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/bell.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/bell.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/bin.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/bin.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/bird.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/bird.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/breakout.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/breakout.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/bry.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/bry.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/chip.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/chip.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/code.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/code.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/congo.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/congo.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/crosshair.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/crosshair.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/demon.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/demon.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/dimallas.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/dimallas.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/floppy.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/floppy.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/dong.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/dong.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/guitar.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/guitar.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/heavy.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/heavy.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jailer_#1.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jailer_#1.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jailer_#2.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jailer_#2.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jailer_#3.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jailer_#3.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jailbattle_alien.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jailbattle_alien.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jailbattle_human.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jailbattle_human.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/jeannine.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/jeannine.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/lamp.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/lamp.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/lord_abad.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/lord_abad.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/matatunos.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/matatunos.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/mummy.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/mummy.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/paco.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/paco.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/elsa.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/elsa.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/qvoid.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/qvoid.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/robot.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/robot.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/sam.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/sam.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/shock.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/shock.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/sigmasua.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/sigmasua.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/spark.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/spark.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/special/aerojailer.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/special/aerojailer.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/special/arounder.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/special/arounder.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/special/pepe_rosita_job.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/special/pepe_rosita_job.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/special/shooting_star.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/special/shooting_star.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/spider.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/spider.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/tree_thing.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/tree_thing.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/tuno.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/tuno.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/tv_panel.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/tv_panel.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/tv.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/tv.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/upv_student.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/upv_student.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/wave.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/wave.gif
|
||||
ANIMATION|${PREFIX}/data/enemies/z80.yaml
|
||||
BITMAP|${PREFIX}/data/enemies/z80.gif
|
||||
|
||||
# ===================================================================
|
||||
# PLAYER
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/player/player.gif
|
||||
ANIMATION|${PREFIX}/data/player/player.yaml
|
||||
BITMAP|${PREFIX}/data/player/player2.gif
|
||||
ANIMATION|${PREFIX}/data/player/player2.yaml
|
||||
BITMAP|${PREFIX}/data/player/player_game_over.gif
|
||||
ANIMATION|${PREFIX}/data/player/player_game_over.yaml
|
||||
|
||||
# ===================================================================
|
||||
# ITEMS
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/items/items.gif
|
||||
|
||||
# ===================================================================
|
||||
# MUSIC
|
||||
# ===================================================================
|
||||
MUSIC|${PREFIX}/data/music/title.ogg
|
||||
MUSIC|${PREFIX}/data/music/game.ogg
|
||||
MUSIC|${PREFIX}/data/music/loading_data1.ogg
|
||||
MUSIC|${PREFIX}/data/music/loading_data2.ogg
|
||||
MUSIC|${PREFIX}/data/music/loading_header.ogg
|
||||
MUSIC|${PREFIX}/data/music/loading_screen_color.ogg
|
||||
MUSIC|${PREFIX}/data/music/loading_screen_data.ogg
|
||||
MUSIC|${PREFIX}/data/music/ending1.ogg
|
||||
MUSIC|${PREFIX}/data/music/ending2.ogg
|
||||
MUSIC|${PREFIX}/data/music/game_over.ogg
|
||||
|
||||
# ===================================================================
|
||||
# SOUND EFFECTS
|
||||
# ===================================================================
|
||||
SOUND|${PREFIX}/data/sound/item.wav
|
||||
SOUND|${PREFIX}/data/sound/death.wav
|
||||
SOUND|${PREFIX}/data/sound/notify.wav
|
||||
|
||||
# Jump sounds (1-24)
|
||||
SOUND|${PREFIX}/data/sound/jump1.wav
|
||||
SOUND|${PREFIX}/data/sound/jump2.wav
|
||||
SOUND|${PREFIX}/data/sound/jump3.wav
|
||||
SOUND|${PREFIX}/data/sound/jump4.wav
|
||||
SOUND|${PREFIX}/data/sound/jump5.wav
|
||||
SOUND|${PREFIX}/data/sound/jump6.wav
|
||||
SOUND|${PREFIX}/data/sound/jump7.wav
|
||||
SOUND|${PREFIX}/data/sound/jump8.wav
|
||||
SOUND|${PREFIX}/data/sound/jump9.wav
|
||||
SOUND|${PREFIX}/data/sound/jump10.wav
|
||||
SOUND|${PREFIX}/data/sound/jump11.wav
|
||||
SOUND|${PREFIX}/data/sound/jump12.wav
|
||||
SOUND|${PREFIX}/data/sound/jump13.wav
|
||||
SOUND|${PREFIX}/data/sound/jump14.wav
|
||||
SOUND|${PREFIX}/data/sound/jump15.wav
|
||||
SOUND|${PREFIX}/data/sound/jump16.wav
|
||||
SOUND|${PREFIX}/data/sound/jump17.wav
|
||||
SOUND|${PREFIX}/data/sound/jump18.wav
|
||||
SOUND|${PREFIX}/data/sound/jump19.wav
|
||||
SOUND|${PREFIX}/data/sound/jump20.wav
|
||||
SOUND|${PREFIX}/data/sound/jump21.wav
|
||||
SOUND|${PREFIX}/data/sound/jump22.wav
|
||||
SOUND|${PREFIX}/data/sound/jump23.wav
|
||||
SOUND|${PREFIX}/data/sound/jump24.wav
|
||||
|
||||
# ===================================================================
|
||||
# LOGO
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/logo/jailgames.gif
|
||||
BITMAP|${PREFIX}/data/logo/since_1998.gif
|
||||
|
||||
# ===================================================================
|
||||
# LOADING SCREEN
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/loading/loading_screen_bn.gif
|
||||
BITMAP|${PREFIX}/data/loading/loading_screen_color.gif
|
||||
BITMAP|${PREFIX}/data/loading/program_jaildoc.gif
|
||||
|
||||
# ===================================================================
|
||||
# TITLE SCREEN
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/title/title_logo.gif
|
||||
|
||||
# ===================================================================
|
||||
# ENDING SCREENS
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/ending/ending1.gif
|
||||
BITMAP|${PREFIX}/data/ending/ending2.gif
|
||||
BITMAP|${PREFIX}/data/ending/ending3.gif
|
||||
BITMAP|${PREFIX}/data/ending/ending4.gif
|
||||
BITMAP|${PREFIX}/data/ending/ending5.gif
|
||||
|
||||
# ===================================================================
|
||||
# CREDITS
|
||||
# ===================================================================
|
||||
BITMAP|${PREFIX}/data/credits/shine.gif
|
||||
ANIMATION|${PREFIX}/data/credits/shine.yaml
|
||||
593
config/assets.yaml
Normal file
593
config/assets.yaml
Normal file
@@ -0,0 +1,593 @@
|
||||
# JailDoctor's Dilemma - Asset Configuration
|
||||
# Migrated from assets.txt to YAML format
|
||||
# Variables: ${PREFIX}, ${SYSTEM_FOLDER}
|
||||
|
||||
assets:
|
||||
# FONTS
|
||||
fonts:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/smb2.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/smb2.txt
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/aseprite.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/aseprite.txt
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/gauntlet.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/gauntlet.txt
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/subatomic.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/subatomic.txt
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/8bithud.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/8bithud.txt
|
||||
|
||||
# PALETTES
|
||||
palettes:
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/zx-spectrum.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/zx-spectrum-adjusted.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/zxarne-5-2.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/black-and-white.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/green-phosphor.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/orange-screen.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/ruzx-spectrum.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/ruzx-spectrum-revision-2.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/pico-8.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/sweetie-16.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/island-joy-16.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/lost-century.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/na16.pal
|
||||
- type: PALETTE
|
||||
path: ${PREFIX}/data/palette/steam-lords.pal
|
||||
|
||||
# SHADERS
|
||||
shaders:
|
||||
- type: DATA
|
||||
path: ${PREFIX}/data/shaders/crtpi_vertex.glsl
|
||||
- type: DATA
|
||||
path: ${PREFIX}/data/shaders/crtpi_fragment.glsl
|
||||
- type: DATA
|
||||
path: ${PREFIX}/data/shaders/crtpi_vertex_es.glsl
|
||||
- type: DATA
|
||||
path: ${PREFIX}/data/shaders/crtpi_fragment_es.glsl
|
||||
|
||||
# INPUT
|
||||
input:
|
||||
- type: DATA
|
||||
path: ${PREFIX}/gamecontrollerdb.txt
|
||||
|
||||
# SYSTEM
|
||||
system:
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/config.yaml
|
||||
required: false
|
||||
absolute: true
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/stats_buffer.csv
|
||||
required: false
|
||||
absolute: true
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/stats.csv
|
||||
required: false
|
||||
absolute: true
|
||||
- type: DATA
|
||||
path: ${SYSTEM_FOLDER}/cheevos.bin
|
||||
required: false
|
||||
absolute: true
|
||||
|
||||
# ROOMS
|
||||
rooms:
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/01.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/02.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/03.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/04.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/05.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/06.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/07.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/08.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/09.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/10.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/11.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/12.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/13.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/14.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/15.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/16.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/17.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/18.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/19.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/20.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/21.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/22.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/23.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/24.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/25.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/26.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/27.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/28.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/29.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/30.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/31.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/32.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/33.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/34.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/35.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/36.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/37.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/38.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/39.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/40.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/41.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/42.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/43.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/44.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/45.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/46.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/47.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/48.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/49.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/50.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/51.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/52.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/53.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/54.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/55.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/56.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/57.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/58.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/59.yaml
|
||||
- type: ROOM
|
||||
path: ${PREFIX}/data/room/60.yaml
|
||||
|
||||
# TILESETS
|
||||
tilesets:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/tilesets/standard.gif
|
||||
|
||||
# ENEMIES
|
||||
enemies:
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/abad_bell.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/abad_bell.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/abad.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/abad.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/amstrad_cs.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/amstrad_cs.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/flying_arounder.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/flying_arounder.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/stopped_arounder.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/stopped_arounder.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/walking_arounder.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/walking_arounder.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/arounders_door.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/arounders_door.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/arounders_machine.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/arounders_machine.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/bat.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/bat.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/batman_bell.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/batman_bell.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/batman_fire.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/batman_fire.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/batman.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/batman.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/bell.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/bell.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/bin.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/bin.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/bird.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/bird.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/breakout.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/breakout.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/bry.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/bry.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/chip.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/chip.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/code.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/code.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/congo.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/congo.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/crosshair.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/crosshair.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/demon.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/demon.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/dimallas.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/dimallas.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/floppy.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/floppy.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/dong.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/dong.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/guitar.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/guitar.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/heavy.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/heavy.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jailer_#1.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jailer_#1.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jailer_#2.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jailer_#2.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jailer_#3.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jailer_#3.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jailbattle_alien.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jailbattle_alien.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jailbattle_human.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jailbattle_human.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/jeannine.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/jeannine.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/lamp.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/lamp.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/lord_abad.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/lord_abad.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/matatunos.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/matatunos.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/mummy.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/mummy.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/paco.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/paco.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/elsa.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/elsa.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/qvoid.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/qvoid.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/robot.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/robot.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/sam.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/sam.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/shock.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/shock.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/sigmasua.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/sigmasua.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/spark.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/spark.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/special/aerojailer.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/special/aerojailer.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/special/arounder.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/special/arounder.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/special/pepe_rosita_job.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/special/pepe_rosita_job.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/special/shooting_star.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/special/shooting_star.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/spider.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/spider.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/tree_thing.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/tree_thing.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/tuno.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/tuno.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/tv_panel.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/tv_panel.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/tv.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/tv.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/upv_student.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/upv_student.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/wave.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/wave.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/enemies/z80.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/enemies/z80.gif
|
||||
|
||||
# PLAYER
|
||||
player:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/player/player.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/player/player.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/player/player2.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/player/player2.yaml
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/player/player_game_over.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/player/player_game_over.yaml
|
||||
|
||||
# ITEMS
|
||||
items:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/items/items.gif
|
||||
|
||||
# MUSIC
|
||||
music:
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/title.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/game.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/loading_data1.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/loading_data2.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/loading_header.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/loading_screen_color.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/loading_screen_data.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/ending1.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/ending2.ogg
|
||||
- type: MUSIC
|
||||
path: ${PREFIX}/data/music/game_over.ogg
|
||||
|
||||
# SOUNDS
|
||||
sounds:
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/item.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/death.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/notify.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump1.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump2.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump3.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump4.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump5.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump6.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump7.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump8.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump9.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump10.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump11.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump12.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump13.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump14.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump15.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump16.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump17.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump18.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump19.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump20.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump21.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump22.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump23.wav
|
||||
- type: SOUND
|
||||
path: ${PREFIX}/data/sound/jump24.wav
|
||||
|
||||
# LOGO
|
||||
logo:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/logo/jailgames.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/logo/since_1998.gif
|
||||
|
||||
# LOADING
|
||||
loading:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/loading/loading_screen_bn.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/loading/loading_screen_color.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/loading/program_jaildoc.gif
|
||||
|
||||
# TITLE
|
||||
title:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/title/title_logo.gif
|
||||
|
||||
# ENDING
|
||||
ending:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/ending/ending1.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/ending/ending2.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/ending/ending3.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/ending/ending4.gif
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/ending/ending5.gif
|
||||
|
||||
# CREDITS
|
||||
credits:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/credits/shine.gif
|
||||
- type: ANIMATION
|
||||
path: ${PREFIX}/data/credits/shine.yaml
|
||||
@@ -51,8 +51,8 @@ Input::Input(std::string game_controller_db_path, std::string gamepad_configs_fi
|
||||
{Action::TOGGLE_MUSIC, KeyState{SDL_SCANCODE_F8}},
|
||||
{Action::TOGGLE_BORDER, KeyState{SDL_SCANCODE_F9}},
|
||||
{Action::TOGGLE_VSYNC, KeyState{SDL_SCANCODE_F10}},
|
||||
{Action::TOGGLE_DEBUG, KeyState{SDL_SCANCODE_F12}},
|
||||
{Action::SHOW_DEBUG_INFO, KeyState{SDL_SCANCODE_F11}}
|
||||
{Action::PAUSE, KeyState{SDL_SCANCODE_F11}},
|
||||
{Action::TOGGLE_DEBUG, KeyState{SDL_SCANCODE_F12}}
|
||||
};
|
||||
|
||||
initSDLGamePad(); // Inicializa el subsistema SDL_INIT_GAMEPAD
|
||||
|
||||
@@ -149,7 +149,7 @@ auto shouldUseResourcePack(const std::string& filepath) -> bool {
|
||||
std::string path = filepath;
|
||||
std::ranges::replace(path, '\\', '/');
|
||||
|
||||
// Don't use pack for most config files (except config/assets.txt which is loaded
|
||||
// Don't use pack for most config files (except config/assets.yaml which is loaded
|
||||
// directly via Loader::loadAssetsConfig() in release builds)
|
||||
if (path.find("config/") != std::string::npos) {
|
||||
return false;
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include <sstream> // Para istringstream
|
||||
#include <stdexcept> // Para runtime_error
|
||||
|
||||
#include "utils/utils.hpp" // Para getFileName, printWithDots
|
||||
#include "external/fkyaml_node.hpp" // Para parsear YAML
|
||||
#include "utils/utils.hpp" // Para getFileName, printWithDots
|
||||
|
||||
namespace Resource {
|
||||
|
||||
@@ -71,70 +72,87 @@ void List::loadFromFile(const std::string& config_file_path, const std::string&
|
||||
|
||||
// Carga recursos desde un string de configuración (para release con pack)
|
||||
void List::loadFromString(const std::string& config_content, const std::string& prefix, const std::string& system_folder) {
|
||||
std::istringstream stream(config_content);
|
||||
std::string line;
|
||||
int line_number = 0;
|
||||
try {
|
||||
// Parsear YAML
|
||||
auto yaml = fkyaml::node::deserialize(config_content);
|
||||
|
||||
while (std::getline(stream, line)) {
|
||||
++line_number;
|
||||
|
||||
// Limpiar espacios en blanco al principio y final
|
||||
line.erase(0, line.find_first_not_of(" \t\r"));
|
||||
line.erase(line.find_last_not_of(" \t\r") + 1);
|
||||
|
||||
// Ignorar líneas vacías y comentarios
|
||||
if (line.empty() || line[0] == '#' || line[0] == ';') {
|
||||
continue;
|
||||
// Verificar estructura básica
|
||||
if (!yaml.contains("assets")) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: Invalid assets.yaml format - missing 'assets' key");
|
||||
return;
|
||||
}
|
||||
|
||||
// Dividir la línea por el separador '|'
|
||||
std::vector<std::string> parts;
|
||||
std::istringstream iss(line);
|
||||
std::string part;
|
||||
const auto& assets = yaml["assets"];
|
||||
|
||||
while (std::getline(iss, part, '|')) {
|
||||
parts.push_back(part);
|
||||
}
|
||||
// Iterar sobre cada categoría (fonts, palettes, etc.)
|
||||
for (auto it = assets.begin(); it != assets.end(); ++it) {
|
||||
const std::string& category = it.key().get_value<std::string>();
|
||||
const auto& category_assets = it.value();
|
||||
|
||||
// Verificar que tenemos al menos tipo y ruta
|
||||
if (parts.size() < 2) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Warning: Malformed line %d in config (insufficient fields)",
|
||||
line_number);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
const std::string& type_str = parts[0];
|
||||
std::string path = parts[1];
|
||||
|
||||
// Valores por defecto
|
||||
bool required = true;
|
||||
bool absolute = false;
|
||||
|
||||
// Si hay opciones en el tercer campo, parsearlas
|
||||
if (parts.size() >= 3) {
|
||||
parseOptions(parts[2], required, absolute);
|
||||
// Verificar que es un array
|
||||
if (!category_assets.is_sequence()) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Warning: Category '%s' is not a sequence, skipping",
|
||||
category.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reemplazar variables en la ruta
|
||||
path = replaceVariables(path, prefix, system_folder);
|
||||
// Procesar cada asset en la categoría
|
||||
for (const auto& asset : category_assets) {
|
||||
try {
|
||||
// Verificar campos obligatorios
|
||||
if (!asset.contains("type") || !asset.contains("path")) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Warning: Asset in category '%s' missing 'type' or 'path', skipping",
|
||||
category.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parsear el tipo de asset
|
||||
Type type = parseAssetType(type_str);
|
||||
// Extraer campos
|
||||
std::string type_str = asset["type"].get_value<std::string>();
|
||||
std::string path = asset["path"].get_value<std::string>();
|
||||
|
||||
// Añadir al mapa
|
||||
addToMap(path, type, required, absolute);
|
||||
// Valores por defecto
|
||||
bool required = true;
|
||||
bool absolute = false;
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Error parsing line %d in config: %s",
|
||||
line_number,
|
||||
e.what());
|
||||
// Campos opcionales
|
||||
if (asset.contains("required")) {
|
||||
required = asset["required"].get_value<bool>();
|
||||
}
|
||||
if (asset.contains("absolute")) {
|
||||
absolute = asset["absolute"].get_value<bool>();
|
||||
}
|
||||
|
||||
// Reemplazar variables en la ruta
|
||||
path = replaceVariables(path, prefix, system_folder);
|
||||
|
||||
// Parsear el tipo de asset
|
||||
Type type = parseAssetType(type_str);
|
||||
|
||||
// Añadir al mapa
|
||||
addToMap(path, type, required, absolute);
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Error parsing asset in category '%s': %s",
|
||||
category.c_str(),
|
||||
e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Loaded " << file_list_.size() << " assets from config" << '\n';
|
||||
std::cout << "Loaded " << file_list_.size() << " assets from YAML config" << '\n';
|
||||
|
||||
} catch (const fkyaml::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"YAML parsing error: %s",
|
||||
e.what());
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Error loading assets: %s",
|
||||
e.what());
|
||||
}
|
||||
}
|
||||
|
||||
// Devuelve la ruta completa a un fichero (búsqueda O(1))
|
||||
|
||||
@@ -167,30 +167,30 @@ auto Loader::validatePack() const -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load assets.txt from pack
|
||||
// Load assets.yaml from pack
|
||||
auto Loader::loadAssetsConfig() const -> std::string {
|
||||
if (!initialized_ || !resource_pack_ || !resource_pack_->isLoaded()) {
|
||||
std::cerr << "Loader: Cannot load assets config - pack not loaded\n";
|
||||
return "";
|
||||
}
|
||||
|
||||
// Try to load config/assets.txt from pack
|
||||
std::string config_path = "config/assets.txt";
|
||||
// Try to load config/assets.yaml from pack
|
||||
std::string config_path = "config/assets.yaml";
|
||||
|
||||
if (!resource_pack_->hasResource(config_path)) {
|
||||
std::cerr << "Loader: assets.txt not found in pack: " << config_path << '\n';
|
||||
std::cerr << "Loader: assets.yaml not found in pack: " << config_path << '\n';
|
||||
return "";
|
||||
}
|
||||
|
||||
auto data = resource_pack_->getResource(config_path);
|
||||
if (data.empty()) {
|
||||
std::cerr << "Loader: Failed to load assets.txt from pack\n";
|
||||
std::cerr << "Loader: Failed to load assets.yaml from pack\n";
|
||||
return "";
|
||||
}
|
||||
|
||||
// Convert bytes to string
|
||||
std::string config_content(data.begin(), data.end());
|
||||
std::cout << "Loader: Loaded assets.txt from pack (" << data.size()
|
||||
std::cout << "Loader: Loaded assets.yaml from pack (" << data.size()
|
||||
<< " bytes)\n";
|
||||
|
||||
return config_content;
|
||||
|
||||
@@ -36,7 +36,7 @@ class Loader {
|
||||
// Validate pack integrity (checksum)
|
||||
[[nodiscard]] auto validatePack() const -> bool;
|
||||
|
||||
// Load assets.txt from pack (for release builds)
|
||||
// Load assets.yaml from pack (for release builds)
|
||||
[[nodiscard]] auto loadAssetsConfig() const -> std::string;
|
||||
|
||||
// Cleanup
|
||||
|
||||
@@ -19,21 +19,21 @@
|
||||
#include "core/resources/resource_list.hpp" // Para Asset, AssetType
|
||||
#include "core/resources/resource_loader.hpp" // Para ResourceLoader
|
||||
#ifdef _DEBUG
|
||||
#include "core/system/debug.hpp" // Para Debug
|
||||
#include "core/system/debug.hpp" // Para Debug
|
||||
#endif
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
||||
#include "game/options.hpp" // Para Options, options, OptionsVideo
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/scenes/credits.hpp" // Para Credits
|
||||
#include "game/scenes/ending.hpp" // Para Ending
|
||||
#include "game/scenes/ending2.hpp" // Para Ending2
|
||||
#include "game/scenes/game.hpp" // Para Game, GameMode
|
||||
#include "game/scenes/game_over.hpp" // Para GameOver
|
||||
#include "game/scenes/loading_screen.hpp" // Para LoadingScreen
|
||||
#include "game/scenes/logo.hpp" // Para Logo
|
||||
#include "game/scenes/title.hpp" // Para Title
|
||||
#include "game/ui/notifier.hpp" // Para Notifier
|
||||
#include "utils/defines.hpp" // Para WINDOW_CAPTION
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
||||
#include "game/options.hpp" // Para Options, options, OptionsVideo
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/scenes/credits.hpp" // Para Credits
|
||||
#include "game/scenes/ending.hpp" // Para Ending
|
||||
#include "game/scenes/ending2.hpp" // Para Ending2
|
||||
#include "game/scenes/game.hpp" // Para Game, GameMode
|
||||
#include "game/scenes/game_over.hpp" // Para GameOver
|
||||
#include "game/scenes/loading_screen.hpp" // Para LoadingScreen
|
||||
#include "game/scenes/logo.hpp" // Para Logo
|
||||
#include "game/scenes/title.hpp" // Para Title
|
||||
#include "game/ui/notifier.hpp" // Para Notifier
|
||||
#include "utils/defines.hpp" // Para WINDOW_CAPTION
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
@@ -83,18 +83,18 @@ Director::Director(std::vector<std::string> const& args) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// 3. Load assets.txt from pack
|
||||
// 3. Load assets.yaml from pack
|
||||
std::cout << "Loading assets configuration from pack..." << '\n';
|
||||
std::string assets_config = Resource::Loader::get().loadAssetsConfig();
|
||||
if (assets_config.empty()) {
|
||||
std::cerr << "ERROR: Failed to load assets.txt from pack\n";
|
||||
std::cerr << "ERROR: Failed to load assets.yaml from pack\n";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// 4. Initialize Asset system with config from pack
|
||||
// NOTE: In release, don't use executable_path or PREFIX - paths in pack are relative
|
||||
// Pass empty string to avoid issues when running from different directories
|
||||
Resource::List::init(""); // Empty executable_path in release
|
||||
Resource::List::init(""); // Empty executable_path in release
|
||||
Resource::List::get()->loadFromString(assets_config, "", system_folder_); // Empty PREFIX for pack
|
||||
std::cout << "Asset system initialized from pack\n";
|
||||
|
||||
@@ -118,8 +118,9 @@ Director::Director(std::vector<std::string> const& args) {
|
||||
|
||||
#endif
|
||||
|
||||
// Carga las opciones desde un fichero
|
||||
Options::loadFromFile(Resource::List::get()->get("config.txt"));
|
||||
// Configura la ruta y carga las opciones desde un fichero
|
||||
Options::setConfigFile(Resource::List::get()->get("config.yaml"));
|
||||
Options::loadFromFile();
|
||||
|
||||
// Inicializa JailAudio
|
||||
Audio::init();
|
||||
@@ -160,7 +161,7 @@ Director::Director(std::vector<std::string> const& args) {
|
||||
|
||||
Director::~Director() {
|
||||
// Guarda las opciones a un fichero
|
||||
Options::saveToFile(Resource::List::get()->get("config.txt"));
|
||||
Options::saveToFile();
|
||||
|
||||
// Destruye los singletones
|
||||
Cheevos::destroy();
|
||||
@@ -267,7 +268,7 @@ auto Director::setFileList() -> bool {
|
||||
#endif
|
||||
|
||||
// Construir ruta al archivo de configuración de assets
|
||||
std::string config_path = executable_path_ + PREFIX + "/config/assets.txt";
|
||||
std::string config_path = executable_path_ + PREFIX + "/config/assets.yaml";
|
||||
|
||||
// Cargar todos los assets desde el archivo de configuración
|
||||
Resource::List::get()->loadFromFile(config_path, PREFIX, system_folder_);
|
||||
|
||||
@@ -2,27 +2,14 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <algorithm> // Para find_if
|
||||
#include <cctype> // Para isspace
|
||||
#include <fstream> // Para basic_ostream, operator<<, basic_ofstream
|
||||
#include <functional> // Para function
|
||||
#include <iostream> // Para cout, cerr
|
||||
#include <ranges>
|
||||
#include <sstream> // Para basic_istringstream
|
||||
#include <string> // Para char_traits, string, operator<<, hash
|
||||
#include <unordered_map> // Para unordered_map, operator==, _Node_const_i...
|
||||
#include <utility> // Para pair
|
||||
#include <fstream> // Para ifstream, ofstream
|
||||
#include <iostream> // Para cout, cerr
|
||||
#include <string> // Para string
|
||||
|
||||
#include "game/defaults.hpp" // Para GameDefaults::VERSION
|
||||
#include "utils/utils.hpp" // Para stringToBool, boolToString, safeStoi
|
||||
#include "external/fkyaml_node.hpp" // Para fkyaml::node
|
||||
#include "game/defaults.hpp" // Para GameDefaults::VERSION
|
||||
|
||||
namespace Options {
|
||||
// Declaración de funciones internas
|
||||
auto setOptions(const std::string& var, const std::string& value) -> bool;
|
||||
auto trimLine(const std::string& line) -> std::string;
|
||||
auto isCommentOrEmpty(const std::string& line) -> bool;
|
||||
auto processConfigLine(const std::string& line) -> bool;
|
||||
auto readConfigFile(const std::string& file_path) -> bool;
|
||||
|
||||
// Crea e inicializa las opciones del programa
|
||||
void init() {
|
||||
@@ -33,245 +20,253 @@ void init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Elimina espacios en blanco al inicio y final de una línea
|
||||
auto trimLine(const std::string& line) -> std::string {
|
||||
auto start = std::ranges::find_if(line, [](int ch) { return !std::isspace(ch); });
|
||||
auto end = std::ranges::find_if(std::ranges::reverse_view(line), [](int ch) { return !std::isspace(ch); }).base();
|
||||
return {start, end};
|
||||
// Establece la ruta del fichero de configuración
|
||||
void setConfigFile(const std::string& path) {
|
||||
config_file_path_ = path;
|
||||
}
|
||||
|
||||
// Verifica si una línea es comentario o está vacía
|
||||
auto isCommentOrEmpty(const std::string& line) -> bool {
|
||||
return line.empty() || line[0] == '#';
|
||||
}
|
||||
|
||||
// Procesa una línea de configuración individual
|
||||
auto processConfigLine(const std::string& line) -> bool {
|
||||
std::istringstream iss(line);
|
||||
std::string key;
|
||||
std::string value;
|
||||
|
||||
if (iss >> key >> value) {
|
||||
if (!setOptions(key, value)) {
|
||||
if (console) {
|
||||
std::cout << "Warning: file config.txt\n";
|
||||
std::cout << "unknown parameter " << key << '\n';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Lee y procesa el fichero de configuración
|
||||
auto readConfigFile(const std::string& file_path) -> bool {
|
||||
std::ifstream file(file_path);
|
||||
if (!file.good()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
if (console) {
|
||||
std::cout << "Reading file config.txt\n";
|
||||
}
|
||||
|
||||
std::string line;
|
||||
while (std::getline(file, line)) {
|
||||
line = trimLine(line);
|
||||
|
||||
if (isCommentOrEmpty(line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!processConfigLine(line)) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (console) {
|
||||
std::cout << "Closing file config.txt\n\n";
|
||||
}
|
||||
file.close();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Carga las opciones desde un fichero
|
||||
auto loadFromFile(const std::string& file_path) -> bool {
|
||||
// Carga las opciones desde el fichero configurado
|
||||
auto loadFromFile() -> bool {
|
||||
// Versión esperada del fichero
|
||||
const std::string CONFIG_VERSION = GameDefaults::VERSION;
|
||||
version = "";
|
||||
|
||||
// Intenta leer el fichero
|
||||
bool success = readConfigFile(file_path);
|
||||
|
||||
// Si no se pudo leer, crea el fichero con valores por defecto
|
||||
if (!success) {
|
||||
saveToFile(file_path);
|
||||
success = true;
|
||||
}
|
||||
|
||||
// Si la versión de fichero no coincide, crea un fichero nuevo con los valores por defecto
|
||||
if (CONFIG_VERSION != version) {
|
||||
init();
|
||||
saveToFile(file_path);
|
||||
// Intenta abrir y leer el fichero
|
||||
std::ifstream file(config_file_path_);
|
||||
if (!file.good()) {
|
||||
if (console) {
|
||||
std::cout << "Wrong config file: initializing \n\n";
|
||||
std::cout << "Config file not found, creating default: " << config_file_path_ << '\n';
|
||||
}
|
||||
saveToFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
return success;
|
||||
// Lee todo el contenido del fichero
|
||||
std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
file.close();
|
||||
|
||||
try {
|
||||
if (console) {
|
||||
std::cout << "Reading config file: " << config_file_path_ << '\n';
|
||||
}
|
||||
|
||||
// Parsea el YAML
|
||||
auto yaml = fkyaml::node::deserialize(content);
|
||||
|
||||
// Lee la versión
|
||||
if (yaml.contains("version")) {
|
||||
version = yaml["version"].get_value<std::string>();
|
||||
}
|
||||
|
||||
// Si la versión no coincide, crea un fichero nuevo con valores por defecto
|
||||
if (CONFIG_VERSION != version) {
|
||||
if (console) {
|
||||
std::cout << "Config version mismatch (expected: " << CONFIG_VERSION << ", got: " << version << "), creating new config\n";
|
||||
}
|
||||
init();
|
||||
saveToFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Lee window
|
||||
if (yaml.contains("window")) {
|
||||
const auto& win = yaml["window"];
|
||||
if (win.contains("zoom")) {
|
||||
int val = win["zoom"].get_value<int>();
|
||||
window.zoom = (val > 0) ? val : GameDefaults::WINDOW_ZOOM;
|
||||
}
|
||||
}
|
||||
|
||||
// Lee video
|
||||
if (yaml.contains("video")) {
|
||||
const auto& vid = yaml["video"];
|
||||
|
||||
if (vid.contains("mode")) {
|
||||
video.fullscreen = vid["mode"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (vid.contains("filter")) {
|
||||
int val = vid["filter"].get_value<int>();
|
||||
if (val == static_cast<int>(Screen::Filter::NEAREST) || val == static_cast<int>(Screen::Filter::LINEAR)) {
|
||||
video.filter = static_cast<Screen::Filter>(val);
|
||||
}
|
||||
}
|
||||
|
||||
if (vid.contains("shaders")) {
|
||||
video.shaders = vid["shaders"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (vid.contains("vertical_sync")) {
|
||||
video.vertical_sync = vid["vertical_sync"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (vid.contains("integer_scale")) {
|
||||
video.integer_scale = vid["integer_scale"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (vid.contains("keep_aspect")) {
|
||||
video.keep_aspect = vid["keep_aspect"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (vid.contains("palette")) {
|
||||
video.palette = vid["palette"].get_value<std::string>();
|
||||
}
|
||||
|
||||
// Lee border
|
||||
if (vid.contains("border")) {
|
||||
const auto& border = vid["border"];
|
||||
|
||||
if (border.contains("enabled")) {
|
||||
video.border.enabled = border["enabled"].get_value<bool>();
|
||||
}
|
||||
|
||||
if (border.contains("width")) {
|
||||
float val = border["width"].get_value<float>();
|
||||
video.border.width = (val > 0) ? val : GameDefaults::BORDER_WIDTH;
|
||||
}
|
||||
|
||||
if (border.contains("height")) {
|
||||
float val = border["height"].get_value<float>();
|
||||
video.border.height = (val > 0) ? val : GameDefaults::BORDER_HEIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lee controls
|
||||
if (yaml.contains("controls")) {
|
||||
const auto& ctrl = yaml["controls"];
|
||||
|
||||
if (ctrl.contains("left")) {
|
||||
int val = ctrl["left"].get_value<int>();
|
||||
controls.key_left = static_cast<SDL_Scancode>(val);
|
||||
}
|
||||
|
||||
if (ctrl.contains("right")) {
|
||||
int val = ctrl["right"].get_value<int>();
|
||||
controls.key_right = static_cast<SDL_Scancode>(val);
|
||||
}
|
||||
|
||||
if (ctrl.contains("jump")) {
|
||||
int val = ctrl["jump"].get_value<int>();
|
||||
controls.key_jump = static_cast<SDL_Scancode>(val);
|
||||
}
|
||||
}
|
||||
|
||||
// Lee gamepad_controls
|
||||
if (yaml.contains("gamepad_controls")) {
|
||||
const auto& gp = yaml["gamepad_controls"];
|
||||
|
||||
if (gp.contains("left")) {
|
||||
gamepad_controls.button_left = gp["left"].get_value<int>();
|
||||
}
|
||||
|
||||
if (gp.contains("right")) {
|
||||
gamepad_controls.button_right = gp["right"].get_value<int>();
|
||||
}
|
||||
|
||||
if (gp.contains("jump")) {
|
||||
gamepad_controls.button_jump = gp["jump"].get_value<int>();
|
||||
}
|
||||
}
|
||||
|
||||
if (console) {
|
||||
std::cout << "Config file loaded successfully\n\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} catch (const fkyaml::exception& e) {
|
||||
if (console) {
|
||||
std::cerr << "Error parsing YAML config: " << e.what() << '\n';
|
||||
std::cerr << "Creating new config with defaults\n";
|
||||
}
|
||||
init();
|
||||
saveToFile();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Guarda las opciones en un fichero
|
||||
auto saveToFile(const std::string& file_path) -> bool {
|
||||
// Crea y abre el fichero de texto
|
||||
std::ofstream file(file_path);
|
||||
bool success = file.is_open(); // Verifica si el archivo se abrió correctamente
|
||||
// Guarda las opciones al fichero configurado
|
||||
auto saveToFile() -> bool {
|
||||
// Crea el nodo YAML raíz como mapping
|
||||
fkyaml::node yaml(fkyaml::node_type::MAPPING);
|
||||
|
||||
if (!success) // Si no se pudo abrir el archivo, muestra un mensaje de error y devuelve false
|
||||
{
|
||||
// Establece la versión
|
||||
yaml["version"] = GameDefaults::VERSION;
|
||||
|
||||
// Window
|
||||
fkyaml::node window_node(fkyaml::node_type::MAPPING);
|
||||
window_node["zoom"] = window.zoom;
|
||||
yaml["window"] = window_node;
|
||||
|
||||
// Video
|
||||
fkyaml::node video_node(fkyaml::node_type::MAPPING);
|
||||
video_node["mode"] = video.fullscreen;
|
||||
video_node["filter"] = static_cast<int>(video.filter);
|
||||
video_node["shaders"] = video.shaders;
|
||||
video_node["vertical_sync"] = video.vertical_sync;
|
||||
video_node["integer_scale"] = video.integer_scale;
|
||||
video_node["keep_aspect"] = video.keep_aspect;
|
||||
video_node["palette"] = video.palette;
|
||||
|
||||
// Video border
|
||||
fkyaml::node border_node(fkyaml::node_type::MAPPING);
|
||||
border_node["enabled"] = video.border.enabled;
|
||||
border_node["width"] = video.border.width;
|
||||
border_node["height"] = video.border.height;
|
||||
video_node["border"] = border_node;
|
||||
|
||||
yaml["video"] = video_node;
|
||||
|
||||
// Controls
|
||||
fkyaml::node controls_node(fkyaml::node_type::MAPPING);
|
||||
controls_node["left"] = static_cast<int>(controls.key_left);
|
||||
controls_node["right"] = static_cast<int>(controls.key_right);
|
||||
controls_node["jump"] = static_cast<int>(controls.key_jump);
|
||||
yaml["controls"] = controls_node;
|
||||
|
||||
// Gamepad controls
|
||||
fkyaml::node gamepad_node(fkyaml::node_type::MAPPING);
|
||||
gamepad_node["left"] = gamepad_controls.button_left;
|
||||
gamepad_node["right"] = gamepad_controls.button_right;
|
||||
gamepad_node["jump"] = gamepad_controls.button_jump;
|
||||
yaml["gamepad_controls"] = gamepad_node;
|
||||
|
||||
// Serializa a string
|
||||
std::string yaml_content = fkyaml::node::serialize(yaml);
|
||||
|
||||
// Abre el fichero para escritura
|
||||
std::ofstream file(config_file_path_);
|
||||
if (!file.is_open()) {
|
||||
if (console) {
|
||||
std::cerr << "Error: Unable to open file " << file_path << " for writing." << '\n';
|
||||
std::cerr << "Error: Unable to open file " << config_file_path_ << " for writing\n";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (console) {
|
||||
std::cout << file_path << " open for writing" << '\n';
|
||||
std::cout << "Writing config file: " << config_file_path_ << '\n';
|
||||
}
|
||||
|
||||
// Escribe en el fichero
|
||||
file << "# Versión de la configuración\n";
|
||||
file << "version " << version << "\n";
|
||||
// Escribe el encabezado con comentarios
|
||||
file << "# JailDoctor's Dilemma - Configuration File\n";
|
||||
file << "# This file is automatically generated and managed by the game\n";
|
||||
file << "#\n";
|
||||
file << "# Video filters: 0 = Nearest (pixel perfect), 1 = Linear (smooth)\n";
|
||||
file << "# SDL_Scancode values for keyboard controls (see SDL documentation)\n";
|
||||
file << "# Gamepad button values: 0-20+ = SDL_GamepadButton, 100 = L2, 101 = R2, 200+ = Axes\n";
|
||||
file << "\n";
|
||||
|
||||
file << "\n## WINDOW\n";
|
||||
file << "# Zoom de la ventana: 1 = Normal, 2 = Doble, 3 = Triple, ...\n";
|
||||
file << "window.zoom " << window.zoom << "\n";
|
||||
// Escribe el contenido YAML
|
||||
file << yaml_content;
|
||||
|
||||
file << "\n## VIDEO\n";
|
||||
file << "# Modo de video: 0 = Ventana, 1 = Pantalla completa, 2 = Pantalla completa (escritorio)\n";
|
||||
file << "video.mode " << video.fullscreen << "\n\n";
|
||||
file << "# Filtro de pantalla: 0 = Nearest, 1 = Linear\n";
|
||||
file << "video.filter " << static_cast<int>(video.filter) << "\n\n";
|
||||
file << "# Shaders: 1 = Activado, 0 = Desactivado\n";
|
||||
file << "video.shaders " << boolToString(video.shaders) << "\n\n";
|
||||
file << "# Sincronización vertical: 1 = Activado, 0 = Desactivado\n";
|
||||
file << "video.vertical_sync " << boolToString(video.vertical_sync) << "\n\n";
|
||||
file << "# Escalado entero: 1 = Activado, 0 = Desactivado\n";
|
||||
file << "video.integer_scale " << boolToString(video.integer_scale) << "\n\n";
|
||||
file << "# Mantener aspecto: 1 = Activado, 0 = Desactivado\n";
|
||||
file << "video.keep_aspect " << boolToString(video.keep_aspect) << "\n\n";
|
||||
file << "# Borde: 1 = Activado, 0 = Desactivado\n";
|
||||
file << "video.border.enabled " << boolToString(video.border.enabled) << "\n\n";
|
||||
file << "# Ancho del borde\n";
|
||||
file << "video.border.width " << video.border.width << "\n\n";
|
||||
file << "# Alto del borde\n";
|
||||
file << "video.border.height " << video.border.height << "\n\n";
|
||||
file << "# Paleta\n";
|
||||
file << "video.palette " << video.palette << "\n";
|
||||
|
||||
file << "\n## CONTROLS\n";
|
||||
file << "# Tecla para mover a la izquierda (SDL_Scancode)\n";
|
||||
file << "controls.left " << static_cast<int>(controls.key_left) << "\n\n";
|
||||
file << "# Tecla para mover a la derecha (SDL_Scancode)\n";
|
||||
file << "controls.right " << static_cast<int>(controls.key_right) << "\n\n";
|
||||
file << "# Tecla para saltar (SDL_Scancode)\n";
|
||||
file << "controls.jump " << static_cast<int>(controls.key_jump) << "\n";
|
||||
|
||||
file << "\n## GAMEPAD CONTROLS\n";
|
||||
file << "# Botón del gamepad para mover a la izquierda\n";
|
||||
file << "# Valores: 0-20+ = Botones SDL_GamepadButton, 100 = L2, 101 = R2, 200+ = Ejes\n";
|
||||
file << "gamepad_controls.left " << gamepad_controls.button_left << "\n\n";
|
||||
file << "# Botón del gamepad para mover a la derecha\n";
|
||||
file << "gamepad_controls.right " << gamepad_controls.button_right << "\n\n";
|
||||
file << "# Botón del gamepad para saltar\n";
|
||||
file << "gamepad_controls.jump " << gamepad_controls.button_jump << "\n";
|
||||
|
||||
// Cierra el fichero
|
||||
file.close();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
auto setOptions(const std::string& var, const std::string& value) -> bool {
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> OPTION_HANDLERS = {
|
||||
{"version", [](const std::string& v) { version = v; }},
|
||||
{"keys", [](const std::string& v) {
|
||||
// Parámetro obsoleto, se ignora silenciosamente para compatibilidad con archivos antiguos
|
||||
(void)v;
|
||||
}},
|
||||
{"window.zoom", [](const std::string& v) {
|
||||
int val = safeStoi(v, GameDefaults::WINDOW_ZOOM);
|
||||
if (val > 0) {
|
||||
window.zoom = val;
|
||||
} else {
|
||||
window.zoom = GameDefaults::WINDOW_ZOOM;
|
||||
}
|
||||
}},
|
||||
{"video.mode", [](const std::string& v) { video.fullscreen = stringToBool(v); }},
|
||||
{"video.filter", [](const std::string& v) {
|
||||
int val = safeStoi(v, static_cast<int>(GameDefaults::VIDEO_FILTER));
|
||||
if (val == static_cast<int>(Screen::Filter::NEAREST) || val == static_cast<int>(Screen::Filter::LINEAR)) {
|
||||
video.filter = static_cast<Screen::Filter>(val);
|
||||
} else {
|
||||
video.filter = GameDefaults::VIDEO_FILTER;
|
||||
}
|
||||
}},
|
||||
{"video.shaders", [](const std::string& v) { video.shaders = stringToBool(v); }},
|
||||
{"video.vertical_sync", [](const std::string& v) { video.vertical_sync = stringToBool(v); }},
|
||||
{"video.integer_scale", [](const std::string& v) { video.integer_scale = stringToBool(v); }},
|
||||
{"video.keep_aspect", [](const std::string& v) { video.keep_aspect = stringToBool(v); }},
|
||||
{"video.border.enabled", [](const std::string& v) { video.border.enabled = stringToBool(v); }},
|
||||
{"video.border.width", [](const std::string& v) {
|
||||
int val = safeStoi(v, GameDefaults::BORDER_WIDTH);
|
||||
if (val > 0) {
|
||||
video.border.width = val;
|
||||
} else {
|
||||
video.border.width = GameDefaults::BORDER_WIDTH;
|
||||
}
|
||||
}},
|
||||
{"video.border.height", [](const std::string& v) {
|
||||
int val = safeStoi(v, GameDefaults::BORDER_HEIGHT);
|
||||
if (val > 0) {
|
||||
video.border.height = val;
|
||||
} else {
|
||||
video.border.height = GameDefaults::BORDER_HEIGHT;
|
||||
}
|
||||
}},
|
||||
{"video.palette", [](const std::string& v) {
|
||||
video.palette = v;
|
||||
}},
|
||||
{"controls.left", [](const std::string& v) {
|
||||
int val = safeStoi(v, SDL_SCANCODE_LEFT);
|
||||
controls.key_left = static_cast<SDL_Scancode>(val);
|
||||
}},
|
||||
{"controls.right", [](const std::string& v) {
|
||||
int val = safeStoi(v, SDL_SCANCODE_RIGHT);
|
||||
controls.key_right = static_cast<SDL_Scancode>(val);
|
||||
}},
|
||||
{"controls.jump", [](const std::string& v) {
|
||||
int val = safeStoi(v, SDL_SCANCODE_UP);
|
||||
controls.key_jump = static_cast<SDL_Scancode>(val);
|
||||
}},
|
||||
{"gamepad_controls.left", [](const std::string& v) {
|
||||
int val = safeStoi(v, static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_LEFT));
|
||||
gamepad_controls.button_left = val;
|
||||
}},
|
||||
{"gamepad_controls.right", [](const std::string& v) {
|
||||
int val = safeStoi(v, static_cast<int>(SDL_GAMEPAD_BUTTON_DPAD_RIGHT));
|
||||
gamepad_controls.button_right = val;
|
||||
}},
|
||||
{"gamepad_controls.jump", [](const std::string& v) {
|
||||
int val = safeStoi(v, static_cast<int>(SDL_GAMEPAD_BUTTON_WEST));
|
||||
gamepad_controls.button_jump = val;
|
||||
}}};
|
||||
|
||||
auto it = OPTION_HANDLERS.find(var);
|
||||
if (it != OPTION_HANDLERS.end()) {
|
||||
it->second(value);
|
||||
return true;
|
||||
if (console) {
|
||||
std::cout << "Config file saved successfully\n\n";
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace Options
|
||||
|
||||
} // namespace Options
|
||||
|
||||
@@ -258,9 +258,13 @@ inline Audio audio{}; // Opciones relativas al audio
|
||||
inline ControlScheme controls{}; // Teclas usadas para jugar
|
||||
inline GamepadControlScheme gamepad_controls{}; // Botones del gamepad usados para jugar
|
||||
|
||||
// Ruta completa del fichero de configuración (establecida mediante setConfigFile)
|
||||
inline std::string config_file_path_{};
|
||||
|
||||
// --- Funciones ---
|
||||
void init(); // Crea e inicializa las opciones del programa
|
||||
auto loadFromFile(const std::string& file_path) -> bool; // Carga las opciones desde un fichero
|
||||
auto saveToFile(const std::string& file_path) -> bool; // Guarda las opciones a un fichero
|
||||
void init(); // Crea e inicializa las opciones del programa
|
||||
void setConfigFile(const std::string& path); // Establece la ruta del fichero de configuración
|
||||
auto loadFromFile() -> bool; // Carga las opciones desde el fichero configurado
|
||||
auto saveToFile() -> bool; // Guarda las opciones al fichero configurado
|
||||
|
||||
} // namespace Options
|
||||
@@ -45,7 +45,7 @@ Title::Title()
|
||||
initMarquee(); // Inicializa la marquesina
|
||||
createCheevosTexture(); // Crea y rellena la textura para mostrar los logros
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
|
||||
Audio::get()->playMusic("title.ogg"); // Inicia la musica
|
||||
Audio::get()->playMusic("title.ogg"); // Inicia la musica
|
||||
}
|
||||
|
||||
// Inicializa la marquesina
|
||||
@@ -653,7 +653,7 @@ void Title::applyKeyboardRemap() {
|
||||
Input::get()->applyKeyboardBindingsFromOptions();
|
||||
|
||||
// Guardar a archivo de configuracion
|
||||
Options::saveToFile(Resource::List::get()->get("config.txt"));
|
||||
Options::saveToFile();
|
||||
}
|
||||
|
||||
// Dibuja la pantalla de redefinir teclado
|
||||
@@ -836,7 +836,7 @@ void Title::applyJoystickRemap() {
|
||||
Input::get()->applyGamepadBindingsFromOptions();
|
||||
|
||||
// Guardar a archivo de configuracion
|
||||
Options::saveToFile(Resource::List::get()->get("config.txt"));
|
||||
Options::saveToFile();
|
||||
}
|
||||
|
||||
// Retorna el nombre amigable del botón del gamepad
|
||||
|
||||
@@ -35,10 +35,10 @@ auto handleDefaultPack() -> int {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Add config/assets.txt to pack (required for release builds)
|
||||
// Add config/assets.yaml to pack (required for release builds)
|
||||
std::cout << "\nAdding config files...\n";
|
||||
if (!pack.addFile("config/assets.txt", "config/assets.txt")) {
|
||||
std::cerr << "Warning: Failed to add config/assets.txt (optional)\n";
|
||||
if (!pack.addFile("config/assets.yaml", "config/assets.yaml")) {
|
||||
std::cerr << "Warning: Failed to add config/assets.yaml (optional)\n";
|
||||
}
|
||||
|
||||
if (!pack.savePack(output_file)) {
|
||||
@@ -86,10 +86,10 @@ auto handlePackDirectory(const std::string& input_dir, const std::string& output
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Add config/assets.txt to pack (required for release builds)
|
||||
// Add config/assets.yaml to pack (required for release builds)
|
||||
std::cout << "\nAdding config files...\n";
|
||||
if (!pack.addFile("config/assets.txt", "config/assets.txt")) {
|
||||
std::cerr << "Warning: Failed to add config/assets.txt (optional)\n";
|
||||
if (!pack.addFile("config/assets.yaml", "config/assets.yaml")) {
|
||||
std::cerr << "Warning: Failed to add config/assets.yaml (optional)\n";
|
||||
}
|
||||
|
||||
if (!pack.savePack(output_file)) {
|
||||
|
||||
Reference in New Issue
Block a user