mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 04:31:09 +02:00
fix(switch): route remaining generated-art loads through Assets.resolve
Five more places called love.graphics.newImage directly on assets/generated paths, bypassing the NX prefix rewrite: - TradeAnim: cable/ball/bubble art - TownMap: Kanto background, cursor, nest icon - SurfingMinigame: surf bg/ob sheets - BattleState: party ball row, substitute doll All now resolve through Assets.resolve, which maps to the versioned blue/ or yellow/ save-dir prefix on NX only. Desktop and Android keep the mountVersion overlay behavior unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4511,7 +4511,7 @@ end
|
|||||||
local ballQuads
|
local ballQuads
|
||||||
function BattleState:drawBallRow(party, x, y, dx)
|
function BattleState:drawBallRow(party, x, y, dx)
|
||||||
if ballQuads == nil then
|
if ballQuads == nil then
|
||||||
local ok, img = pcall(love.graphics.newImage, "assets/generated/battle/balls.png")
|
local ok, img = pcall(love.graphics.newImage, require("src.render.Assets").resolve("assets/generated/battle/balls.png"))
|
||||||
if ok then
|
if ok then
|
||||||
ballQuads = { img = img }
|
ballQuads = { img = img }
|
||||||
for i = 0, 3 do
|
for i = 0, 3 do
|
||||||
@@ -4587,7 +4587,8 @@ local substDoll
|
|||||||
function BattleState:drawSubstituteDoll(battler)
|
function BattleState:drawSubstituteDoll(battler)
|
||||||
if substDoll == nil then
|
if substDoll == nil then
|
||||||
local ok, img = pcall(love.graphics.newImage,
|
local ok, img = pcall(love.graphics.newImage,
|
||||||
"assets/generated/sprites/monster.png")
|
require("src.render.Assets").resolve(
|
||||||
|
"assets/generated/sprites/monster.png"))
|
||||||
if ok then
|
if ok then
|
||||||
local w, h = img:getDimensions()
|
local w, h = img:getDimensions()
|
||||||
substDoll = { img = img,
|
substDoll = { img = img,
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ function SurfingMinigame.new(game, onDone)
|
|||||||
self.banner = nil -- {quad, frames}: GOOD!/YEAH-/Oh no..
|
self.banner = nil -- {quad, frames}: GOOD!/YEAH-/Oh no..
|
||||||
|
|
||||||
local function sheet(path)
|
local function sheet(path)
|
||||||
local ok, img = pcall(love.graphics.newImage, path)
|
local ok, img = pcall(love.graphics.newImage, require("src.render.Assets").resolve(path))
|
||||||
return ok and img or nil
|
return ok and img or nil
|
||||||
end
|
end
|
||||||
self.bg = sheet("assets/generated/minigame/surf_1a.png")
|
self.bg = sheet("assets/generated/minigame/surf_1a.png")
|
||||||
|
|||||||
+5
-4
@@ -104,7 +104,7 @@ local function loadBackground(game)
|
|||||||
local tm = (game.data.field or {}).townMap or {}
|
local tm = (game.data.field or {}).townMap or {}
|
||||||
local bg = tm.background
|
local bg = tm.background
|
||||||
if not (bg and bg.map and bg.tiles) then return nil end
|
if not (bg and bg.map and bg.tiles) then return nil end
|
||||||
local ok, img = pcall(love.graphics.newImage, bg.tiles.path)
|
local ok, img = pcall(love.graphics.newImage, require("src.render.Assets").resolve(bg.tiles.path))
|
||||||
if not ok then return nil end
|
if not ok then return nil end
|
||||||
local quads = {}
|
local quads = {}
|
||||||
local iw, ih = img:getDimensions()
|
local iw, ih = img:getDimensions()
|
||||||
@@ -115,7 +115,7 @@ local function loadBackground(game)
|
|||||||
end
|
end
|
||||||
local cursor
|
local cursor
|
||||||
if bg.cursor then
|
if bg.cursor then
|
||||||
local okc, c = pcall(love.graphics.newImage, bg.cursor.path)
|
local okc, c = pcall(love.graphics.newImage, require("src.render.Assets").resolve(bg.cursor.path))
|
||||||
cursor = okc and c or nil
|
cursor = okc and c or nil
|
||||||
end
|
end
|
||||||
return { img = img, quads = quads, map = bg.map, cursor = cursor }
|
return { img = img, quads = quads, map = bg.map, cursor = cursor }
|
||||||
@@ -192,8 +192,9 @@ function TownMap.new(game, opts)
|
|||||||
-- field.townMap.nest lifts the icon path out of the engine
|
-- field.townMap.nest lifts the icon path out of the engine
|
||||||
local nest = ((game.data.field or {}).townMap or {}).nest
|
local nest = ((game.data.field or {}).townMap or {}).nest
|
||||||
local ok, img = pcall(love.graphics.newImage,
|
local ok, img = pcall(love.graphics.newImage,
|
||||||
(nest and nest.path)
|
require("src.render.Assets").resolve(
|
||||||
or "assets/generated/townmap/nest.png")
|
(nest and nest.path)
|
||||||
|
or "assets/generated/townmap/nest.png"))
|
||||||
self.nestIcon = ok and img or nil
|
self.nestIcon = ok and img or nil
|
||||||
end
|
end
|
||||||
if opts.fly then
|
if opts.fly then
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ local DEFAULT_ART = {
|
|||||||
|
|
||||||
local function tryImage(path)
|
local function tryImage(path)
|
||||||
if not path then return nil end
|
if not path then return nil end
|
||||||
local ok, img = pcall(love.graphics.newImage, path)
|
local ok, img = pcall(love.graphics.newImage, require("src.render.Assets").resolve(path))
|
||||||
return ok and img or nil
|
return ok and img or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user