From c302af0f6bd164aa99d241864b2d1f18c9c599b5 Mon Sep 17 00:00:00 2001 From: candle Date: Sat, 1 Jun 2024 16:09:22 +0100 Subject: [PATCH] split out more --- src/scripts/playback.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/scripts/playback.js b/src/scripts/playback.js index 574d2db..2d7f08f 100644 --- a/src/scripts/playback.js +++ b/src/scripts/playback.js @@ -587,17 +587,21 @@ class BipsiPlayback extends EventTarget { scene.push({ layer: 3, func: () => dest.drawImage(this.dialoguePlayback.dialogueRendering.canvas, 0, 0) }); } + addLayersToScene(scene, dest, frame) { + if (!this.ended) { + this.addRoomToScene(scene, dest, frame); + this.addDialogueToScene(scene, dest, frame); + this.addImagesToScene(scene, dest, frame); + } + } + render(frame=undefined) { frame = frame ?? this.frameCount; const scene = []; // add visual layers to scene - if (!this.ended) { - this.addImagesToScene(scene, this.rendering, frame); - this.addRoomToScene(scene, this.rendering, frame); - this.addDialogueToScene(scene, this.rendering, frame); - } + this.addLayersToScene(scene, this.rendering, frame); // sort visual layers scene.sort((a, b) => a.layer - b.layer);