From cc0e092c1d23de7ea6f06b7ec7568b8d10a2e4e1 Mon Sep 17 00:00:00 2001 From: jwinterm Date: Sun, 12 Jul 2026 10:30:19 -0400 Subject: [PATCH] fix(sp): revert dungeon to legacy renderer + fix splash (working game restored) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The render-kit SP dungeon shipped without a player-centered camera or entity sprites, so it drew the whole level tiny in a corner with a red-dot monster. Disable it and fall back to the proven legacy renderer (original tiles, real monster, centered view) until the kit has a camera + sprites. RK.SPGame/spRenderPicker kept but dormant (one flag to re-enable). Splash legend: draw every icon (incl. the player) as a uniform grid tile — no avatar overlay — so the four rows align AND the player shows the original hero tile. --- html/js/core/game.js | 34 ++++++++++---------------------- html/js/display/screenManager.js | 22 +++++---------------- html/js/ui/spRenderPicker.js | 5 +++++ 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/html/js/core/game.js b/html/js/core/game.js index ceafdf7..84fb646 100644 --- a/html/js/core/game.js +++ b/html/js/core/game.js @@ -288,31 +288,17 @@ var Game = { }, _drawGameScreen: function() { + // The render-kit dungeon path (RK.SPGame) is DISABLED until it has a player-centered camera + // + real monster/entity sprites — without those it rendered the whole level tiny in a corner + // with a red-dot monster. Until then the single-player game uses the proven legacy renderer. + if (window.RK && RK.SPGame && RK.SPGame.hide) RK.SPGame.hide(); + if (!this._ensureDisplay()) return; const gameState = GameState.getGameStateForRender(); - - // Prefer the render kit (Tiled / ASCII / Iso / 3D + unlocked packs) for the dungeon — it - // draws its own lighting/FX and the player sprite. The legacy ROT renderer is the fallback - // (returns here only if the kit is unavailable or a render throws), so the game never blanks. - var rk = false; - if (window.RK && RK.SPGame && RK.SPGame.available()) { - RK.SPGame.show(); - rk = RK.SPGame.render(gameState, { - cryptoType: (window.ScreenManager && ScreenManager._cryptoType) || undefined, - playerAppearance: (window.SinglePlayerAvatar && SinglePlayerAvatar.currentAppearance) - ? SinglePlayerAvatar.currentAppearance() : null, - isSpectating: this._isSpectating - }); - } - - if (!rk) { - if (window.RK && RK.SPGame) RK.SPGame.hide(); - if (!this._ensureDisplay()) return; - RenderEngine.drawGameScreen(gameState); - // JUICE: keep the FX overlay aligned to the base canvas and feed it the player's - // screen-space position so its torch lighting tracks the camera. - if (window.FX) { - try { this._fxSyncLighting(); } catch (e) { /* best-effort */ } - } + RenderEngine.drawGameScreen(gameState); + // JUICE: keep the FX overlay aligned to the base canvas and feed it the player's screen-space + // position so its torch lighting tracks the camera. + if (window.FX) { + try { this._fxSyncLighting(); } catch (e) { /* best-effort */ } } }, diff --git a/html/js/display/screenManager.js b/html/js/display/screenManager.js index b017e19..6a0a500 100644 --- a/html/js/display/screenManager.js +++ b/html/js/display/screenManager.js @@ -175,23 +175,11 @@ var ScreenManager = { const centerX = Math.floor(this._screenWidth / 2) - 10; const textX = centerX + ICON_COLS + 1; // one fixed text column for every row for (let item of legendItems) { - let iconDrawn = false; - - if (item.role === "player" && window.SinglePlayerAvatar && window.SinglePlayerAvatar.drawLegendIcon) { - iconDrawn = window.SinglePlayerAvatar.drawLegendIcon(centerX, y, { - fallbackTile: item.tile, - cols: ICON_COLS - }); - } - - // Grid-tile icons: centre the (1-cell) glyph within the 2-cell slot so it aligns under - // the player sprite above it. - if (!iconDrawn) { - const glyph = window.options?.tileMap?.hasOwnProperty(item.tile) ? item.tile : "?"; - const gx = centerX + Math.floor((ICON_COLS - (glyph.length || 1)) / 2); - display.draw(gx, y, glyph, "transparent", "transparent"); - } - + // Draw EVERY icon (incl. the player's original hero tile) as a grid tile — no avatar + // overlay — so all four share a left edge + baseline and the hero is the plain tile. + const glyph = window.options?.tileMap?.hasOwnProperty(item.tile) ? item.tile : "?"; + const gx = centerX + Math.floor((ICON_COLS - (glyph.length || 1)) / 2); + display.draw(gx, y, glyph, "transparent", "transparent"); this.drawText(textX, y, item.text); y++; } diff --git a/html/js/ui/spRenderPicker.js b/html/js/ui/spRenderPicker.js index ce71b83..e1b063a 100644 --- a/html/js/ui/spRenderPicker.js +++ b/html/js/ui/spRenderPicker.js @@ -30,8 +30,13 @@ doc().head.appendChild(s); } + // Disabled until the single-player render-kit path (RK.SPGame) has a camera + entity sprites. + // Keeping the module wired so re-enabling is a one-line flip. + var ENABLED = false; + function build() { var h = host(); + if (!ENABLED) { if (h) h.classList.add('hidden'); return; } if (!h || !RK.RENDER_MODES || !RK.SPGame) return; ensureStyle(); h.innerHTML = '';