mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-19 12:15:31 +02:00
true color sprites shouldnt show in non color modes
This commit is contained in:
@@ -234,7 +234,11 @@ local imageMeta = setmetatable({}, WEAK_KEYS)
|
||||
-- entirely, so its palette variant collapses back onto the plain path.
|
||||
local function getImage(path, pal, trueColor)
|
||||
if not path then return nil end
|
||||
if trueColor then pal = nil end
|
||||
if trueColor and require("src.render.PaletteFX").honorsTrueColor() then
|
||||
pal = nil
|
||||
else
|
||||
trueColor = nil
|
||||
end
|
||||
local key = pal and (path .. "#" .. pal.name) or path
|
||||
if not imageCache[key] then
|
||||
local img, pad, padL = nil, 0, 0
|
||||
|
||||
@@ -305,6 +305,13 @@ function PaletteFX.usesGbcPack(mode)
|
||||
return mode == "redpp"
|
||||
end
|
||||
|
||||
function PaletteFX.honorsTrueColor()
|
||||
if GameVersion.generation() >= 2 then
|
||||
return require("src.render.GbcPalette").mode == "gbc"
|
||||
end
|
||||
return PaletteFX.mode == "redpp"
|
||||
end
|
||||
|
||||
-- Yellow's authentic GBC look is CGBBasePalettes (per-map), not a boot-ROM
|
||||
-- auto-palette. The shared `ogred` save id wears that table on a Yellow
|
||||
-- playthrough and labels itself "OG YELLOW".
|
||||
|
||||
@@ -641,6 +641,7 @@ end
|
||||
-- or empty zone list is left alone: that already draws the whole canvas
|
||||
-- unshaded, which is what the rects were asking for.
|
||||
local function withTrueColor(zoneList, pass)
|
||||
if not PaletteFX.honorsTrueColor() then return zoneList end
|
||||
local rects = PaletteFX.trueColorRects(pass)
|
||||
if not (rects[1] and zoneList and zoneList[1]) then return zoneList end
|
||||
local merged = {}
|
||||
|
||||
@@ -234,8 +234,12 @@ function SpriteRenderer:gen2Obp()
|
||||
self.objGroup .. "|" .. tostring(GbcPalette.mode)
|
||||
end
|
||||
|
||||
local function liveTrueColor(def)
|
||||
return def and def.trueColor and PaletteFX.honorsTrueColor()
|
||||
end
|
||||
|
||||
function SpriteRenderer:resolveImage()
|
||||
if self.def.trueColor then return self.image end
|
||||
if liveTrueColor(self.def) then return self.image end
|
||||
if self.objColors then
|
||||
return getObpImage(self.def.image, self:gen2Obp())
|
||||
end
|
||||
@@ -289,7 +293,7 @@ function SpriteRenderer:draw(px, py, camX, camY, facing, walkPhase, stepFlip,
|
||||
local redraw = false
|
||||
-- True-color sheets bypass every palette bake; the screen-space exemption
|
||||
-- is recorded below once the final frame/height is known.
|
||||
if self.def.trueColor then
|
||||
if liveTrueColor(self.def) then
|
||||
image = self.image
|
||||
elseif self.objColors then
|
||||
-- Gen 2: the palette came from the caller (setObjPalette). Like RED++
|
||||
@@ -349,7 +353,7 @@ function SpriteRenderer:draw(px, py, camX, camY, facing, walkPhase, stepFlip,
|
||||
drawHeight = math.max(1, self.frameHeight - math.min(8, self.frameHeight))
|
||||
end
|
||||
-- Full-color art claims exactly the portion of the frame that was drawn.
|
||||
if self.def.trueColor then
|
||||
if liveTrueColor(self.def) then
|
||||
PaletteFX.markTrueColor(x, y, self.frameWidth, drawHeight)
|
||||
end
|
||||
blitFrame(image, quad, x, y, flip, redraw, self.frameWidth)
|
||||
@@ -362,7 +366,7 @@ end
|
||||
-- raw DMG shades (#384).
|
||||
function SpriteRenderer:drawTile(path, x, y, flip)
|
||||
local image, redraw = getImage(path), false
|
||||
if self.def.trueColor then
|
||||
if liveTrueColor(self.def) then
|
||||
PaletteFX.markTrueColor(x, y, 16, 8)
|
||||
elseif PaletteFX.usesGbcPack() then
|
||||
local colors, group = PaletteFX.spriteObp(self.def, self.seed)
|
||||
|
||||
@@ -740,7 +740,8 @@ function BattleState:drawPic(mon, back)
|
||||
-- pokemon.sprite's ctx.trueColor, the same flag Gen 1's Sprites.path hands
|
||||
-- back to its own draw site.
|
||||
local function paint()
|
||||
if colors and not trueColor and GbcPalette.available() then
|
||||
if colors and not (trueColor and GbcPalette.mode == "gbc")
|
||||
and GbcPalette.available() then
|
||||
GbcPalette.with(colors, body)
|
||||
else
|
||||
body()
|
||||
|
||||
Reference in New Issue
Block a user