From 2de3539f4fc474a41ce379a9ecef10359b846614 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 00:40:14 +0000 Subject: [PATCH] Fix trainer sprites by adding front pic display from trainers/front_pics The previous fix only changed object event sprite paths. The actual issue was that trainer cards and the trainer edit modal had no sprite display at all. Added getTrainerPicUrl/getTrainerPicHtml functions that map trainer pic names (e.g. "Aqua Admin F") to graphics/trainers/front_pics/ PNGs, and wired them into the trainer card grid and edit modal. https://claude.ai/code/session_018zt8hfr7cTT6cbZmZC8thT --- editor/app.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/editor/app.js b/editor/app.js index 639a58c48f..1c7162e3bb 100644 --- a/editor/app.js +++ b/editor/app.js @@ -1044,6 +1044,7 @@ async function renderTrainers() { grid.innerHTML += `
+ ${getTrainerPicHtml(t.pic, 48)}

${escHtml(t.name || '(unnamed)')}

${escHtml(t.id)}
@@ -1125,6 +1126,13 @@ function openTrainerModal(trainer, isNew) { function renderModalBody() { const body = $('#trainer-modal-body'); body.innerHTML = ` +
+ ${getTrainerPicHtml(trainer.pic, 64)} +
+
${escHtml(trainer.name || '(unnamed)')}
+
${escHtml(trainer.pic || 'No pic set')}
+
+
@@ -2133,6 +2141,20 @@ function getSpriteHtml(graphicsId, size = 32) {
`; } +function getTrainerPicUrl(pic) { + const name = (pic || '').toLowerCase().replace(/\s+/g, '_'); + return `../graphics/trainers/front_pics/${name}.png`; +} + +function getTrainerPicHtml(pic, size = 64) { + const url = getTrainerPicUrl(pic); + const name = pic || ''; + return `
+ ${escAttr(name)} + +
`; +} + function getPreviewUrl(dirName) { return `previews/${encodeURIComponent(dirName)}.png`; }