Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 28f2d91c5c | |||
| 2ceda2b809 | |||
| b1fc60cdd9 | |||
| e8340472f8 | |||
| 380cab4176 | |||
| 246b9cc687 | |||
| aba2acbdf3 | |||
| 525ca12c9a | |||
| 5aca78a38e | |||
| 64bb710531 | |||
| 7e29b4b6a2 | |||
| 5b3b0b3f6a | |||
| 8f8d71afcd | |||
| 89dd0fc4e2 | |||
| fa336c6861 | |||
| 5fc43cebe3 | |||
| cd319a3bec | |||
| 4d7868de49 | |||
| f8f63111b0 | |||
| a3f05edd28 | |||
| 67d48b6942 | |||
| 8f9ba8537e | |||
| e34b5a20ce | |||
| 8291f386fa | |||
| 64feca0e04 |
@@ -70,3 +70,11 @@ Temporary Items
|
||||
# Claude Code local settings
|
||||
.claude/
|
||||
|
||||
# Fitxer de records (estat local del jugador)
|
||||
records
|
||||
|
||||
# Binaris del interpret ascii (no son del joc)
|
||||
ascii
|
||||
ascii.exe
|
||||
SDL2.dll
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ El atributo de color de una celda es 1 byte: nibble bajo = INK (tinta), nibble a
|
||||
|
||||
> **Nota**: `whichbtn()` está declarado en `ascii.h` y existe en C++, pero **no está expuesto a Lua** (no aparece en los `lua_setglobal` de `lua.cpp`). Para detectar qué tecla se ha pulsado en un frame hay que iterar con `btnp()` sobre las constantes `KEY_*`.
|
||||
|
||||
> **Bug de `tostr` con negativos**: la implementación de `tostr()` en `lua.cpp` (función `intToStr`) hace `(x % 10) + '0'` que con `x = -1` produce `-1 + 48 = 47`, o sea `'/'`. Por tanto `tostr(-1)` devuelve `"/"`, `tostr(-2)` devuelve `"."`, etc. Si vas a imprimir un número que puede ser negativo, usa `string.format("%d", n)` (que sí maneja signo) o clampa con `max(0, n)` antes de pasar a `tostr`.
|
||||
|
||||
Códigos de tecla — todos definidos como globales `KEY_*` en Lua. Lista completa (de `lua.cpp` 502-608):
|
||||
|
||||
```
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 138 B |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
+123
@@ -0,0 +1,123 @@
|
||||
-- Configuracio del Pepe Runner DX.
|
||||
--
|
||||
-- Aquest fitxer es LA UNICA FUENT DE VERDAT per als valors editables del
|
||||
-- joc (skin, tecles, textos, temps de les animacions, vides, audio).
|
||||
-- El motor del joc (pepe_runner_dx.lua) llig aquestes globals al iniciar
|
||||
-- via dofile("config.lua"); no hi ha defaults amagats al codi.
|
||||
--
|
||||
-- Si vols recuperar un valor "original", consulta la rama de git o este
|
||||
-- mateix fitxer en versions anteriors. Si elimines una clau, el joc petara
|
||||
-- al usar-la — millor que prendre un valor obscur per defecte.
|
||||
|
||||
-- ====================================================================
|
||||
-- INFO
|
||||
-- ====================================================================
|
||||
-- Versio del joc. Apareix centrada a la part baixa de la pantalla de
|
||||
-- titol. Format lliure (mostra el que pose ací).
|
||||
version = "v2.0.0"
|
||||
|
||||
-- ====================================================================
|
||||
-- ASPECTE GRAFIC
|
||||
-- ====================================================================
|
||||
-- Skin: nom del fitxer (sense extensio) dins de la carpeta skins/ que
|
||||
-- aporta els bitmaps i colors del joc. Skins inclosos:
|
||||
--
|
||||
-- "custom" — Estil fidel a l'original de Pascal (CP437: █ ═ ─ ☻ X).
|
||||
-- "native" — Bitmaps copiats del ROM nadiu d'ascii (look "fantasy console").
|
||||
-- "pintor" — Look revisat amb sprites propis (Pepe i 3 enemics diferents,
|
||||
-- escala de ma, pedra que decreix d'altura al cavar...).
|
||||
--
|
||||
-- Cada skin defineix la seua propia paleta i bitmaps. Per a personalitzar
|
||||
-- colors o sprites, edita el fitxer corresponent a skins/<nom>.lua.
|
||||
-- (En tots els casos el char 0 es reescriu a zeros, perque el ROM d'ascii
|
||||
-- hi te una caixa hueca que taparia tot el mapa.)
|
||||
skin = "pintor"
|
||||
|
||||
-- ====================================================================
|
||||
-- JUGABILITAT
|
||||
-- ====================================================================
|
||||
-- Vides inicials. Convencio arcade (com Pac-Man): el numero es de
|
||||
-- "reserves", no de vides totals. 2 reserves = 3 vides totals (la actual +
|
||||
-- les 2 que es veuen al HUD). 0 = una sola oportunitat.
|
||||
VIDES_INI = 2
|
||||
|
||||
-- Fase per la qual arranca una partida nova (1..10).
|
||||
-- Util per a depurar un mapa concret sense haver de jugar des de la 1.
|
||||
LEVEL_INI = 1
|
||||
|
||||
-- ====================================================================
|
||||
-- TECLES
|
||||
-- ====================================================================
|
||||
-- Mapeig per defecte: cursors per a moure's, Z/X per a fer forats.
|
||||
-- Pots usar qualsevol constant KEY_* del intérpret (KEY_A..KEY_Z,
|
||||
-- KEY_UP/DOWN/LEFT/RIGHT, KEY_SPACE, KEY_RETURN, ...).
|
||||
-- Nota: KEY_ESCAPE no es pot usar — l'intérpret la captura per a la seua
|
||||
-- consola de debug abans que Lua la veja.
|
||||
keys = {
|
||||
up = KEY_UP,
|
||||
down = KEY_DOWN,
|
||||
left = KEY_LEFT,
|
||||
right = KEY_RIGHT,
|
||||
dig_left = KEY_Z,
|
||||
dig_right = KEY_X,
|
||||
quit = KEY_Q, -- abandona la partida → game over
|
||||
}
|
||||
|
||||
-- ====================================================================
|
||||
-- TEXTOS DEL JOC
|
||||
-- ====================================================================
|
||||
-- Tots els missatges que veu el jugador. Pots editar per a corregir
|
||||
-- ortografia o traduir a una altra variant sense haver de tocar el .lua.
|
||||
-- (Convencio: Inicial Majuscula, resta minuscula.)
|
||||
textos = {
|
||||
title_press_play = "Prem l'espai per a jugar",
|
||||
game_over = "FI DE JOC",
|
||||
new_record = "Nou record !",
|
||||
score_label = "Punts",
|
||||
level_label = "Nivell",
|
||||
lives_label = "Vides",
|
||||
record_label = "Record",
|
||||
name_label = "Nom:",
|
||||
name_help = "Tecles A-Z",
|
||||
}
|
||||
|
||||
-- ====================================================================
|
||||
-- TEMPS I DURACIONS
|
||||
-- ====================================================================
|
||||
-- Tots els valors van en *frames* (a 60 fps, 60 frames = 1 segon).
|
||||
-- Pots ajustar la sensacio del joc sense tocar el .lua.
|
||||
temps = {
|
||||
score_step = 3, -- frames per cada +1 del comptador animat
|
||||
-- del HUD. 3 = ~20 punts/segon.
|
||||
fade_frames = 18, -- duracio de cada fase del fade (out i in
|
||||
-- son simetrics). 18 = 0.3 s per fase.
|
||||
mort_anim_frames = 30, -- duracio de l'animacio visual de mort
|
||||
-- (Pepe visible parpadejant + careta trista).
|
||||
respawn_delay_frames = 120, -- temps que Pepe queda invisible abans
|
||||
-- del respawn (els malos segueixen).
|
||||
invuln_frames = 180, -- temps que Pepe es invulnerable al
|
||||
-- respawn, parpadejant blanc/groc.
|
||||
escala_step_frames = 6, -- frames entre cada cel·la nova de
|
||||
-- l'escala lateral quan creix.
|
||||
gameover_delay_frames = 15, -- espera abans del typewriter de
|
||||
-- "FI DE JOC" (perque no es solape
|
||||
-- amb sfx_gameover).
|
||||
typewriter_step_frames = 8, -- frames per cada lletra del
|
||||
-- typewriter al game over.
|
||||
gameover_show_frames = 120, -- temps que el text final es queda
|
||||
-- visible abans de la transicio.
|
||||
}
|
||||
|
||||
-- ====================================================================
|
||||
-- AUDIO (jingles dels estats no-jugables)
|
||||
-- ====================================================================
|
||||
-- L'engine d'ascii nomes te 1 canal d'audio: per aixo no hi ha musica
|
||||
-- in-game (les SFX la tallarien). Es reprodueixen una sola vegada per
|
||||
-- entrada al estat (no en bucle).
|
||||
music_on = true -- false desactiva tots els jingles. Les SFX continuen.
|
||||
|
||||
-- Melodies en MML estandard (vore ASCII_API.md §4).
|
||||
musica = {
|
||||
title = "l4o4cegfedcceg",
|
||||
entername = "l2o5cegcegced",
|
||||
}
|
||||
+1218
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
-- Skin "custom" — el look fidel a l'original de Pascal (CP437).
|
||||
-- Per als sprites nous (pepe_mort_a/b, malo2/3) repetim els bitmaps base
|
||||
-- perque la skin original no tenia sprites diferents per a cada cas.
|
||||
--
|
||||
-- Constants de color disponibles (paleta CGA/EGA de 16, vore ASCII_API.md §3):
|
||||
-- COLOR_BLACK=0 COLOR_DARK_GRAY=8
|
||||
-- COLOR_BLUE=1 COLOR_LIGHT_BLUE=9
|
||||
-- COLOR_GREEN=2 COLOR_LIGHT_GREEN=10
|
||||
-- COLOR_CYAN=3 COLOR_LIGHT_CYAN=11
|
||||
-- COLOR_RED=4 COLOR_LIGHT_RED=12
|
||||
-- COLOR_MAGENTA=5 COLOR_LIGHT_MAGENTA=13
|
||||
-- COLOR_BROWN=6 COLOR_YELLOW=14
|
||||
-- COLOR_LIGHT_GRAY=7 COLOR_WHITE=15
|
||||
return {
|
||||
elements = {
|
||||
diners = { cp = 36, bitmap = {0x18,0x3E,0x60,0x3C,0x06,0x7C,0x18,0x00}, color = COLOR_YELLOW },
|
||||
pedra = { cp = 219, bitmap = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, color = COLOR_BROWN },
|
||||
escala = { cp = 205, bitmap = {0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00}, color = COLOR_LIGHT_CYAN },
|
||||
corda = { cp = 196, bitmap = {0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00}, color = COLOR_LIGHT_GRAY },
|
||||
bloc1 = { cp = 176, bitmap = {0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11}, color = COLOR_BROWN },
|
||||
bloc2 = { cp = 177, bitmap = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55}, color = COLOR_BROWN },
|
||||
bloc3 = { cp = 178, bitmap = {0xBB,0xEE,0xBB,0xEE,0xBB,0xEE,0xBB,0xEE}, color = COLOR_BROWN },
|
||||
pepe = { cp = 2, bitmap = {0x7E,0x81,0xA5,0x81,0xBD,0x99,0x81,0x7E}, color = COLOR_WHITE },
|
||||
pepe_mort_a = { cp = 226, bitmap = {0x7E,0x81,0xA5,0x81,0x99,0xBD,0x81,0x7E}, color = COLOR_LIGHT_RED },
|
||||
pepe_mort_b = { cp = 227, bitmap = {0x7E,0x81,0xA5,0x81,0x99,0xBD,0x81,0x7E}, color = COLOR_LIGHT_RED },
|
||||
malo1 = { cp = 247, bitmap = {0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3}, color = COLOR_LIGHT_RED },
|
||||
malo2 = { cp = 248, bitmap = {0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3}, color = COLOR_LIGHT_RED },
|
||||
malo3 = { cp = 249, bitmap = {0x00,0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3}, color = COLOR_LIGHT_RED },
|
||||
},
|
||||
state_colors = {
|
||||
bg = COLOR_BLUE,
|
||||
border = COLOR_BLUE,
|
||||
hud_text = COLOR_WHITE,
|
||||
hud_bg = COLOR_BLACK,
|
||||
title = COLOR_LIGHT_RED,
|
||||
pepe_invuln = COLOR_LIGHT_GREEN,
|
||||
malo_carrega = COLOR_LIGHT_MAGENTA,
|
||||
malo_atrapat = COLOR_BROWN,
|
||||
score_flash = COLOR_YELLOW,
|
||||
gameover_box = COLOR_BLUE, -- fons del cuadre del text "FI DE JOC"
|
||||
version = COLOR_LIGHT_BLUE, -- text de versio a la pantalla de titol
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
-- Skin "native" — bitmaps copiats del ROM nadiu d'ascii (rom.h) als
|
||||
-- code-points reservats per a cada element. Manté la regla "cp idèntics
|
||||
-- en totes les skins" sense haver de dependre que el ROM tinga el glif
|
||||
-- en eixos code-points concrets.
|
||||
--
|
||||
-- Constants de color disponibles (paleta CGA/EGA de 16, vore ASCII_API.md §3):
|
||||
-- COLOR_BLACK=0 COLOR_DARK_GRAY=8
|
||||
-- COLOR_BLUE=1 COLOR_LIGHT_BLUE=9
|
||||
-- COLOR_GREEN=2 COLOR_LIGHT_GREEN=10
|
||||
-- COLOR_CYAN=3 COLOR_LIGHT_CYAN=11
|
||||
-- COLOR_RED=4 COLOR_LIGHT_RED=12
|
||||
-- COLOR_MAGENTA=5 COLOR_LIGHT_MAGENTA=13
|
||||
-- COLOR_BROWN=6 COLOR_YELLOW=14
|
||||
-- COLOR_LIGHT_GRAY=7 COLOR_WHITE=15
|
||||
return {
|
||||
elements = {
|
||||
diners = { cp = 36, bitmap = {0x18,0x3E,0x58,0x3C,0x1A,0x7C,0x18,0x00}, color = COLOR_YELLOW },
|
||||
pedra = { cp = 219, bitmap = {0x00,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x00}, color = COLOR_BROWN },
|
||||
escala = { cp = 205, bitmap = {0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00}, color = COLOR_LIGHT_CYAN },
|
||||
corda = { cp = 196, bitmap = {0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00}, color = COLOR_LIGHT_GRAY },
|
||||
bloc1 = { cp = 176, bitmap = {0xAA,0x55,0xAA,0x55,0x00,0x00,0x00,0x00}, color = COLOR_BROWN },
|
||||
bloc2 = { cp = 177, bitmap = {0x00,0x00,0x00,0x00,0xAA,0x55,0xAA,0x55}, color = COLOR_BROWN },
|
||||
bloc3 = { cp = 178, bitmap = {0xAA,0x54,0xA8,0x50,0xA0,0x40,0x80,0x00}, color = COLOR_BROWN },
|
||||
pepe = { cp = 2, bitmap = {0x7E,0xFF,0x99,0xFF,0xBD,0xC3,0xFF,0x7E}, color = COLOR_WHITE },
|
||||
pepe_mort_a = { cp = 226, bitmap = {0x7E,0xFF,0x99,0xFF,0xC3,0xBD,0xFF,0x7E}, color = COLOR_LIGHT_RED },
|
||||
pepe_mort_b = { cp = 227, bitmap = {0x7E,0xFF,0x99,0xFF,0xC3,0xBD,0xFF,0x7E}, color = COLOR_LIGHT_RED },
|
||||
malo1 = { cp = 247, bitmap = {0xC6,0x6C,0x38,0x38,0x6C,0xC6,0xC6,0x00}, color = COLOR_LIGHT_RED },
|
||||
malo2 = { cp = 248, bitmap = {0xC6,0x6C,0x38,0x38,0x6C,0xC6,0xC6,0x00}, color = COLOR_LIGHT_RED },
|
||||
malo3 = { cp = 249, bitmap = {0xC6,0x6C,0x38,0x38,0x6C,0xC6,0xC6,0x00}, color = COLOR_LIGHT_RED },
|
||||
},
|
||||
state_colors = {
|
||||
bg = COLOR_BLUE,
|
||||
border = COLOR_BLUE,
|
||||
hud_text = COLOR_WHITE,
|
||||
hud_bg = COLOR_BLACK,
|
||||
title = COLOR_LIGHT_RED,
|
||||
pepe_invuln = COLOR_LIGHT_GREEN,
|
||||
malo_carrega = COLOR_LIGHT_MAGENTA,
|
||||
malo_atrapat = COLOR_BROWN,
|
||||
score_flash = COLOR_YELLOW,
|
||||
gameover_box = COLOR_BLUE, -- fons del cuadre del text "FI DE JOC"
|
||||
version = COLOR_LIGHT_BLUE, -- text de versio a la pantalla de titol
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
-- Skin "pintor" — bitmaps i colors creats per a la versio DX.
|
||||
-- Format del fitxer:
|
||||
-- elements = id_logic_string → { cp = code_point, bitmap = {8 bytes}|nil, color = COLOR_X }
|
||||
-- state_colors = nom_estat → COLOR_X (ambient i estats del joc, no lligats a un element)
|
||||
--
|
||||
-- Constants de color disponibles (paleta CGA/EGA de 16, vore ASCII_API.md §3):
|
||||
-- COLOR_BLACK=0 COLOR_DARK_GRAY=8
|
||||
-- COLOR_BLUE=1 COLOR_LIGHT_BLUE=9
|
||||
-- COLOR_GREEN=2 COLOR_LIGHT_GREEN=10
|
||||
-- COLOR_CYAN=3 COLOR_LIGHT_CYAN=11
|
||||
-- COLOR_RED=4 COLOR_LIGHT_RED=12
|
||||
-- COLOR_MAGENTA=5 COLOR_LIGHT_MAGENTA=13
|
||||
-- COLOR_BROWN=6 COLOR_YELLOW=14
|
||||
-- COLOR_LIGHT_GRAY=7 COLOR_WHITE=15
|
||||
return {
|
||||
elements = {
|
||||
diners = { cp = 36, bitmap = {0x18,0x3E,0x60,0x3C,0x06,0x7C,0x18,0x00}, color = COLOR_YELLOW },
|
||||
pedra = { cp = 219, bitmap = {0xFF,0xF6,0xBF,0xFE,0xF7,0xBE,0xFF,0xAA}, color = COLOR_BROWN },
|
||||
escala = { cp = 205, bitmap = {0xC3,0xFF,0xFF,0xC3,0xC3,0xFF,0xFF,0xC3}, color = COLOR_LIGHT_GRAY },
|
||||
corda = { cp = 196, bitmap = {0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00}, color = COLOR_LIGHT_GRAY },
|
||||
-- Bloc 1/2/3: la pedra es cava decrescut en altura, pero mantenint
|
||||
-- la textura de la pedra (les files inferiors de pedra) per a que es
|
||||
-- veja com si la pedra real es va desfent des de dalt.
|
||||
bloc1 = { cp = 176, bitmap = {0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xAA}, color = COLOR_BROWN },
|
||||
bloc2 = { cp = 177, bitmap = {0x00,0x00,0x00,0x00,0xF7,0xBE,0xFF,0xAA}, color = COLOR_BROWN },
|
||||
bloc3 = { cp = 178, bitmap = {0x00,0x00,0xBF,0xFE,0xF7,0xBE,0xFF,0xAA}, color = COLOR_BROWN },
|
||||
pepe = { cp = 2, bitmap = {0x7E,0xFF,0xDB,0xDB,0xFF,0xC3,0xE7,0x7E}, color = COLOR_YELLOW },
|
||||
pepe_mort_a = { cp = 226, bitmap = {0x7E,0xFF,0x93,0xFF,0xFF,0xAB,0xD7,0x7E}, color = COLOR_LIGHT_RED },
|
||||
pepe_mort_b = { cp = 227, bitmap = {0x7E,0xFF,0xC9,0xFF,0xFF,0xD5,0xEB,0x7E}, color = COLOR_LIGHT_MAGENTA },
|
||||
malo1 = { cp = 247, bitmap = {0xC3,0x3C,0x7E,0x72,0x7E,0x72,0x3C,0xC3}, color = COLOR_LIGHT_RED },
|
||||
malo2 = { cp = 248, bitmap = {0xD8,0x33,0x7C,0xFC,0xFC,0x7C,0x33,0xD8}, color = COLOR_LIGHT_RED },
|
||||
malo3 = { cp = 249, bitmap = {0x07,0xEB,0x38,0x38,0x38,0x38,0xEB,0x07}, color = COLOR_LIGHT_RED },
|
||||
},
|
||||
state_colors = {
|
||||
bg = COLOR_BLUE,
|
||||
border = COLOR_BLUE,
|
||||
hud_text = COLOR_WHITE,
|
||||
hud_bg = COLOR_LIGHT_BLUE,
|
||||
title = COLOR_LIGHT_RED,
|
||||
pepe_invuln = COLOR_LIGHT_GREEN,
|
||||
malo_carrega = COLOR_LIGHT_MAGENTA,
|
||||
malo_atrapat = COLOR_BROWN,
|
||||
score_flash = COLOR_YELLOW,
|
||||
gameover_box = COLOR_BLUE, -- fons del cuadre del text "FI DE JOC"
|
||||
version = COLOR_LIGHT_BLUE, -- text de versio a la pantalla de titol
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user