diff --git a/assets/voices/andrea-1eb0b6b09e.mp3 b/assets/voices/andrea-1eb0b6b09e.mp3 new file mode 100644 index 0000000..c33a027 Binary files /dev/null and b/assets/voices/andrea-1eb0b6b09e.mp3 differ diff --git a/assets/voices/andrea-4175b94c54.mp3 b/assets/voices/andrea-4175b94c54.mp3 new file mode 100644 index 0000000..b21c3a9 Binary files /dev/null and b/assets/voices/andrea-4175b94c54.mp3 differ diff --git a/assets/voices/andrea-833a07768c.mp3 b/assets/voices/andrea-833a07768c.mp3 new file mode 100644 index 0000000..f631ac4 Binary files /dev/null and b/assets/voices/andrea-833a07768c.mp3 differ diff --git a/assets/voices/andrea-c77b0c4b4c.mp3 b/assets/voices/andrea-c77b0c4b4c.mp3 deleted file mode 100644 index 2bf138e..0000000 Binary files a/assets/voices/andrea-c77b0c4b4c.mp3 and /dev/null differ diff --git a/assets/voices/arcu-5df7e4b863.mp3 b/assets/voices/arcu-5df7e4b863.mp3 new file mode 100644 index 0000000..c9ed375 Binary files /dev/null and b/assets/voices/arcu-5df7e4b863.mp3 differ diff --git a/assets/voices/arcu-664d65b6d1.mp3 b/assets/voices/arcu-664d65b6d1.mp3 new file mode 100644 index 0000000..e937eef Binary files /dev/null and b/assets/voices/arcu-664d65b6d1.mp3 differ diff --git a/assets/voices/arcu-89d19833e7.mp3 b/assets/voices/arcu-89d19833e7.mp3 new file mode 100644 index 0000000..a4e0a12 Binary files /dev/null and b/assets/voices/arcu-89d19833e7.mp3 differ diff --git a/assets/voices/arcu-8a1840569a.mp3 b/assets/voices/arcu-8a1840569a.mp3 new file mode 100644 index 0000000..a612bbc Binary files /dev/null and b/assets/voices/arcu-8a1840569a.mp3 differ diff --git a/assets/voices/index.json b/assets/voices/index.json index f592f28..b77ec9f 100644 --- a/assets/voices/index.json +++ b/assets/voices/index.json @@ -1635,9 +1635,13 @@ "file": "andrea-5e16aca755.mp3", "sec": 6.33 }, - "andrea|Salgo. Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.": { - "file": "andrea-c77b0c4b4c.mp3", - "sec": 9.24 + "andrea|Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.": { + "file": "andrea-1eb0b6b09e.mp3", + "sec": 7.77 + }, + "arcu|Monto anch'io: davanti, però.": { + "file": "arcu-664d65b6d1.mp3", + "sec": 2.34 }, "andrea|Nessuno ha mai capito davvero il tuo immenso valore.": { "file": "andrea-3e85200509.mp3", @@ -1887,6 +1891,14 @@ "file": "andrea-d32e1a2a87.mp3", "sec": 3.45 }, + "andrea|Si torna nel 2007. Ciao Vannino, ciao Pierino.": { + "file": "andrea-baa95acb36.mp3", + "sec": 4.41 + }, + "arcu|Riportata dove l'ho presa. Se ti riviene voglia di pokerini, chiedi.": { + "file": "arcu-5df7e4b863.mp3", + "sec": 4.24 + }, "andrea|Il Barrettino. Nel 1997. Si sente ancora l'odore del caffè e delle sigarette.": { "file": "andrea-e9ea220852.mp3", "sec": 7.94 @@ -1903,6 +1915,22 @@ "file": "andrea-a1771b44e8.mp3", "sec": 5.22 }, + "andrea|L'Arcu, venuto con me nel 1997. Guarda le carte di tutti e non dice nulla. Per ora.": { + "file": "andrea-4175b94c54.mp3", + "sec": 8.75 + }, + "andrea|Arcu, tu non giochi?": { + "file": "andrea-833a07768c.mp3", + "sec": 1.81 + }, + "arcu|Io guardo. Chi guarda un perde mai.": { + "file": "arcu-8a1840569a.mp3", + "sec": 3.46 + }, + "arcu|E quando vuoi si torna: la macchina è fuori, basta dirlo.": { + "file": "arcu-89d19833e7.mp3", + "sec": 3.71 + }, "andrea|Il televisore a tubo. È il 1997: niente smartphone, solo il televideo.": { "file": "andrea-64b8a38c86.mp3", "sec": 7.87 @@ -1911,10 +1939,6 @@ "file": "andrea-1efd47285d.mp3", "sec": 5.94 }, - "andrea|Si torna nel 2007. Ciao Vannino, ciao Pierino.": { - "file": "andrea-baa95acb36.mp3", - "sec": 4.41 - }, "andrea|Un pino a ombrello enorme. Alla ricreazione, tutti all'ombra lì sotto. Sembra ieri.": { "file": "andrea-0a073729fd.mp3", "sec": 7.3 diff --git a/docs/STATO.md b/docs/STATO.md index b15b85c..d712595 100644 --- a/docs/STATO.md +++ b/docs/STATO.md @@ -22,7 +22,8 @@ Online su 50037.manzolo.it tutto fino agli effetti ambientali di Codex. Aperto, quando qui si faceva i pokerini…»: compare la macchina del tempo in Via Liguri Magelli. Dentro, il cruscotto (Codex) compone 10/07/1997 18:30, poi tremori, lampi e il bianco (primo piano `viaggio`, `src/engine/viaggio.js`, tempi in `TRIP` di `game.js`): si arriva al Barrettino del 1997 (`barrettino_1997`, scena `viaggio: true`: niente mappa né - strade, la porta riporta nel 2007), con Vannino (dalla descrizione di Andrea) e Pierino Parigi (consenso del figlio + strade; la porta o il pulsante «Torna al 2007», `scene.back` e `game.goBack()`, riportano nel 2007 e la macchina + sparisce: per rifare il viaggio si richiede all'Arcu), con l'Arcu che viene a guardare, Vannino (dalla descrizione di Andrea) e Pierino Parigi (consenso del figlio Marco, 29 ottobre), sprite di Codex. Il pokerino (`poker.js`, `poker-render.js`): cinque carte col cambio, mazzo corto dal 7 all'asso (colore sopra il full, A-7-8-9-10 scala), invito 2, punto 5, cinque mani. [DA ANDREA] l'interno del Barrettino (è una proposta di Codex) e le battute. diff --git a/index.html b/index.html index 4c7b596..cdc8a47 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@ +
diff --git a/src/engine/game.js b/src/engine/game.js index 19cc5d9..7096b25 100644 --- a/src/engine/game.js +++ b/src/engine/game.js @@ -270,6 +270,17 @@ export class Game { return true; } + // Il pulsante delle scene fuori dal tempo (scene.back, «Torna al 2007»): le sue azioni partono da dove si è. + goBack() { + const back = this.scene?.back; + if (!back || this.busy || this.dialogue || this.state.ended) return false; + this.task = null; + this.path = []; + this.walking = false; + this.queue = [...back.actions]; + return true; + } + skip() { if (this.speech) { this.speech = null; return true; } return false; diff --git a/src/main.js b/src/main.js index 067c79a..3614911 100644 --- a/src/main.js +++ b/src/main.js @@ -313,6 +313,7 @@ function drawRoads() { } addEventListener('resize', () => { if (!$('map').hidden) drawRoads(); }); $('map-button').addEventListener('click', openMap); +$('back-button').addEventListener('click', () => game.goBack()); // --- «?»: per qualche secondo si vede tutto quello che si può toccare (sul telefono non c'è il mouse da passarci sopra). const SPOTS_TIME = 3500; @@ -1080,6 +1081,9 @@ function updateUi() { if (mg || c?.events) for (const event of c.events.splice(0)) ambience.play(event.kind, { pan: 0, strength: event.power }); // Il pulsante della mappa c'è solo in partita, fuori dai dialoghi, e quando c'è almeno un altro posto dove andare. setProp($('map-button'), 'hidden', !running || !!game.dialogue || !!game.closeup || game.mapPlaces().length < 2); + // «Torna al 2007»: nelle scene fuori dal tempo, finché non si parla con qualcuno. + setProp($('back-button'), 'hidden', !running || !game.scene?.back || !!game.dialogue || !!game.closeup); + setText($('back-button'), game.scene?.back?.label ?? ''); setProp($('pause-button'), 'hidden', !running); setProp($('spots-button'), 'hidden', !running || !!game.closeup); setProp($('notebook-button'), 'hidden', !running || !story.notebook || !!game.closeup); diff --git a/src/story/story.js b/src/story/story.js index 62ff29b..33b9461 100644 --- a/src/story/story.js +++ b/src/story/story.js @@ -43,6 +43,15 @@ const torchHints = [{ }], }]; +// Il ritorno dal 1997, dalla porta o dal pulsante «Torna al 2007»: la macchina del tempo sparisce, e per rifare il +// viaggio si richiede all'Arcu (Andrea, 29 ottobre). +const RITORNO_2007 = [ + { say: 'Si torna nel 2007. Ciao Vannino, ciao Pierino.' }, + { go: 'via_liguri_magelli', at: [212, 280], face: 'down' }, + { unset: 'macchina_trappola' }, + { say: 'Riportata dove l\'ho presa. Se ti riviene voglia di pokerini, chiedi.', who: 'arcu', pose: 'explain' }, +]; + export const story = { title: 'La Leggenda del Regolo', // La mappa (pulsante «Mappa»): ogni scena con `map: [x, y]` (percentuali della pianta) ci compare quando è @@ -2824,8 +2833,8 @@ export const story = { id: 'macchina_tempo', name: 'macchina del tempo', box: [150, 214, 104, 48], at: [212, 280], face: 'up', default: 'use', when: 'macchina_trappola', actions: { look: [{ say: 'La macchina del tempo, parcheggiata davanti al Trappola. Sul cruscotto la data è già pronta.' }], - use: [{ say: 'Salgo. Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.' }, { closeup: 'viaggio' }], - open: [{ say: 'Salgo. Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.' }, { closeup: 'viaggio' }], + use: [{ say: 'Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.' }, { say: 'Monto anch\'io: davanti, però.', who: 'arcu', pose: 'laugh' }, { closeup: 'viaggio' }], + open: [{ say: 'Imposto: 10 luglio 1997, ore 18 e 30. Il pokerino da Vannino.' }, { say: 'Monto anch\'io: davanti, però.', who: 'arcu', pose: 'laugh' }, { closeup: 'viaggio' }], }, }, { @@ -3361,16 +3370,20 @@ export const story = { name: 'Il Barrettino, 10 luglio 1997', // Ci si arriva solo con la macchina del tempo: niente mappa, niente strade (la porta riporta nel 2007). viaggio: true, + // Il pulsante «Torna al 2007», sempre lì in alto: per uscire da quel tempo senza cercare la porta (Andrea, 29 ottobre). + back: { label: 'Torna al 2007', actions: RITORNO_2007 }, background: 'assets/scenes/barrettino-1997.png', indoor: true, walk: [[0, 360], [0, 300], [110, 282], [540, 282], [640, 300], [640, 360]], depth: [[282, 2.1], [360, 2.6]], entry: [320, 330], enter: [{ if: '!visto_1997', then: [{ set: 'visto_1997' }, { say: 'Il Barrettino. Nel 1997. Si sente ancora l\'odore del caffè e delle sigarette.' }] }], - speakers: { vannino: [160, 120], pierino_parigi: [470, 120] }, + speakers: { vannino: [160, 120], pierino_parigi: [470, 120], arcu: [580, 130] }, people: [ { who: 'vannino', at: [160, 300], facing: 1, size: 1, idle: 'stand', talk: ['talk', 'explain'], blink: 'blink', every: 4.1 }, { who: 'pierino_parigi', at: [470, 300], facing: -1, size: 1, idle: 'cards', talk: ['talk', 'explain'], blink: 'blink', every: 3.6 }, + // L'Arcu è venuto con me, a guardare la partita (Andrea, 29 ottobre). [DA ANDREA: le battute] + { who: 'arcu', at: [585, 318], facing: -1, size: 1.05, idle: 'stand', talk: ['talk', 'explain'], blink: 'blink', every: 4.2 }, ], hotspots: [ { @@ -3389,6 +3402,17 @@ export const story = { id: 'pierino', name: 'Pierino', box: [440, 160, 60, 140], at: [410, 320], face: 'right', default: 'talk', actions: { look: [{ say: 'Pierino Parigi, con gli occhiali sul naso, che guarda le carte come se lo tradissero.' }], talk: [{ dialogue: 'pokerino' }] }, }, + { + id: 'arcu', name: 'l\'Arcu', box: [566, 170, 40, 150], at: [540, 320], face: 'right', default: 'talk', + actions: { + look: [{ say: 'L\'Arcu, venuto con me nel 1997. Guarda le carte di tutti e non dice nulla. Per ora.' }], + talk: [ + { say: 'Arcu, tu non giochi?' }, + { say: 'Io guardo. Chi guarda un perde mai.', who: 'arcu', pose: 'explain' }, + { say: 'E quando vuoi si torna: la macchina è fuori, basta dirlo.', who: 'arcu', pose: 'talk' }, + ], + }, + }, { id: 'televisore', name: 'televisore', box: [440, 20, 60, 50], at: [480, 300], face: 'up', actions: { look: [{ say: 'Il televisore a tubo. È il 1997: niente smartphone, solo il televideo.' }] }, @@ -3397,8 +3421,8 @@ export const story = { id: 'porta', name: 'la porta: si torna nel 2007', box: [70, 30, 70, 230], at: [120, 300], face: 'left', default: 'walk', actions: { look: [{ say: 'Fuori c\'è la sera del 1997. E parcheggiata lì, la macchina del tempo.' }], - walk: [{ say: 'Si torna nel 2007. Ciao Vannino, ciao Pierino.' }, { go: 'via_liguri_magelli', at: [212, 280], face: 'down' }], - open: [{ say: 'Si torna nel 2007. Ciao Vannino, ciao Pierino.' }, { go: 'via_liguri_magelli', at: [212, 280], face: 'down' }], + walk: RITORNO_2007, + open: RITORNO_2007, }, }, ], diff --git a/style.css b/style.css index 1c16401..b14f566 100644 --- a/style.css +++ b/style.css @@ -214,8 +214,9 @@ body.full #sound { position: fixed; z-index: 13; top: max(8px, env(safe-area-ins /* Mappa: la pianta del paese a gradini, i posti visti come cartellini, le strade come linee. */ /* In alto a sinistra: Pausa e Mappa. */ #corner { position: absolute; top: 6px; left: 6px; z-index: 2; display: flex; gap: 6px; } -#map-button, #pause-button, #notebook-button, #spots-button { font: bold clamp(8.64px, 1.15vw, 11.52px) var(--font); padding: .35em .8em; +#map-button, #pause-button, #notebook-button, #spots-button, #back-button { font: bold clamp(8.64px, 1.15vw, 11.52px) var(--font); padding: .35em .8em; color: var(--accent); background: rgba(27, 20, 32, .62); border: 0; border-radius: 18px; cursor: pointer; } +#back-button { color: #1b1420; background: #9fd0ff; } #pause { z-index: 3; background: rgba(15, 10, 20, .9); } /* Il player dei video «Come si gioca»: sopra a tutto, il video grande quanto può. */ #tutorial { position: fixed; inset: 0; z-index: 20; background: rgba(10, 8, 14, .97); padding: 8px; } diff --git a/tests/poker.test.mjs b/tests/poker.test.mjs index d2d6960..c80b74d 100644 --- a/tests/poker.test.mjs +++ b/tests/poker.test.mjs @@ -81,6 +81,21 @@ test('la macchina del tempo: l\'Arcu la fa comparire, il viaggio porta al Barret g.closeup.step = 'result'; g.closeup.result = { winner: 'player', chips: { andrea: 200, vannino: 60, pierino: 40 }, top: ['andrea'] }; g.closeupClose(); settle(g); assert.ok(g.state.flags.poker_vinto); + assert.ok(g.hotspot('arcu'), 'l\'Arcu è venuto anche lui'); g.act('walk', 'porta'); settle(g); assert.equal(g.state.scene, 'via_liguri_magelli'); + assert.ok(!g.state.flags.macchina_trappola && !g.hotspot('macchina_tempo'), 'tornati, la macchina sparisce'); + assert.equal(g.goBack(), false, 'nel 2007 il pulsante non c\'è'); + // Per rifare il viaggio si richiede all'Arcu; dal 1997 si torna anche col pulsante «Torna al 2007». + g.act('talk', 'arcu'); settle(g); + g.choose(g.options().findIndex(o => o.text.startsWith('Bei tempi'))); settle(g); + g.choose(g.options().findIndex(o => o.text.startsWith('Ci si vede'))); settle(g); + g.act('use', 'macchina_tempo'); settle(g); + for (let t = 0; t < TRIP.end + 0.5 && g.closeup; t += 0.05) g.update(0.05); + settle(g); + assert.equal(g.state.scene, 'barrettino_1997'); + assert.equal(g.scene.back.label, 'Torna al 2007'); + assert.ok(g.goBack()); settle(g); + assert.equal(g.state.scene, 'via_liguri_magelli'); + assert.ok(!g.hotspot('macchina_tempo')); });