CLOSES #2235, CLOSES #2245, CLOSES #2252, CLOSES #2253, CLOSES #2257, CLOSES #2261, CLOSES #2262, CLOSES #2263, CLOSES #2264, CLOSES #2267, CLOSES #2268, CLOSES #2272, CLOSES #2273, CLOSES #2274, CLOSES #2275

This commit is contained in:
bryanthaboi
2026-09-13 11:49:05 -04:00
parent 2cc86d599d
commit feec1d43fd
53 changed files with 3705 additions and 164 deletions
+17
View File
@@ -385,6 +385,16 @@ local function decodeVariableSprites(bytes, at, count)
return out
end
-- data/maps/scenes.asm:7
local function decodeMapScenes(bytes, L)
local out = {}
for mapId, at in pairs(L.sceneVars or {}) do
local b = u8(bytes, at)
if b and b ~= 0 then out[mapId] = b end
end
return out
end
Gen2Save.NUM_SPECIES = 251
Gen2Save.EVENT_BYTES = 256
@@ -458,6 +468,7 @@ function Gen2Save.decode(bytes, gameVersion, data)
seen = decodeDex(bytes, L.wPokedexSeen, x),
},
events = decodeFlagBytes(bytes, L.wEventFlags, Gen2Save.EVENT_BYTES),
mapScenes = decodeMapScenes(bytes, L),
engineFlags = decodeEngineFlags(bytes, L, gameVersion),
variableSprites = decodeVariableSprites(bytes, L.wVariableSprites,
Gen2Save.VARIABLE_SPRITES),
@@ -784,6 +795,12 @@ function Gen2Save.encode(save, gameVersion, template, data)
local byte = (save.events or {})[i]
if type(byte) == "number" then putU8(t, L.wEventFlags + i, byte) end
end
if L.sceneVars and type(save.mapScenes) == "table" then
for mapId, at in pairs(L.sceneVars) do
local scene = tonumber(save.mapScenes[mapId])
if scene then putU8(t, at, math.floor(scene)) end
end
end
if type(save.engineFlags) == "table" then
putEngineFlags(t, L, save.engineFlags, gameVersion)
end