mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-19 12:15:31 +02:00
CLOSES #1396, CLOSES #1398, CLOSES #1400, CLOSES #1401, CLOSES #1406, CLOSES #1407, CLOSES #1411, CLOSES #1413, CLOSES #1415, CLOSES #1416, CLOSES #1417, CLOSES #1419, CLOSES #1421, CLOSES #1422, CLOSES #1423, CLOSES #1424, CLOSES #1425, CLOSES #1427, CLOSES #1428, CLOSES #1429, CLOSES #1431, CLOSES #1432, CLOSES #1433, CLOSES #1435, CLOSES #1437, CLOSES #1440, CLOSES #1441, CLOSES #1442, CLOSES #1443, CLOSES #1447, CLOSES #1449, CLOSES #1456, CLOSES #1464, CLOSES #1465, CLOSES #1468, CLOSES #1469, CLOSES #1470
This commit is contained in:
@@ -939,6 +939,8 @@ function Game2:load()
|
||||
self.data.gen2Maps = loadGenerated("data/generated/maps.lua")
|
||||
self.data.gen2Tilesets = loadGenerated("data/generated/tilesets.lua")
|
||||
self.data.gen2Roofs = loadGenerated("data/generated/roofs.lua")
|
||||
-- engine/events/magnet_train.asm:165 DrawMagnetTrain
|
||||
self.data.gen2Field = loadGenerated("data/generated/field.lua")
|
||||
self.data.gen2Marts = loadGenerated("data/generated/marts.lua")
|
||||
self.data.gen2Scripts = loadGenerated("data/generated/scripts.lua")
|
||||
self.data.gen2StdScripts = loadGenerated("data/generated/std_scripts.lua")
|
||||
@@ -1965,6 +1967,7 @@ function Game2:applyOptions()
|
||||
haptics = options.haptics,
|
||||
})
|
||||
require("src.core.VideoMode").applyOptions(options)
|
||||
require("src.core.FrameCap").applyOptions(options)
|
||||
local GBCFX = require("src.render.GBCFX")
|
||||
if GBCFX.applyOptions(options) and self.save then
|
||||
-- applyOptions returns true when it had to clear an unsupported level.
|
||||
|
||||
+17
-5
@@ -6,11 +6,14 @@ local HostShell = {}
|
||||
-- spawn tries to link against the libraries we're shipping instead of the
|
||||
-- system ones. We want to unset the var so that any system tools can find
|
||||
-- their proper libraries. Only needed when running in an AppImage.
|
||||
-- LD_PRELOAD is Steam's overlay (#1470): its 32-bit half cannot load into a
|
||||
-- 64-bit child, so ld.so prints an error into that child's output.
|
||||
function HostShell.envPrefix()
|
||||
if os.getenv("APPIMAGE") then
|
||||
return "env -u LD_LIBRARY_PATH "
|
||||
end
|
||||
return ""
|
||||
local unset = ""
|
||||
if os.getenv("APPIMAGE") then unset = unset .. "-u LD_LIBRARY_PATH " end
|
||||
if os.getenv("LD_PRELOAD") then unset = unset .. "-u LD_PRELOAD " end
|
||||
if unset == "" then return "" end
|
||||
return "env " .. unset
|
||||
end
|
||||
|
||||
-- Windows: every host tool we shell out to (curl for the update and mod-index
|
||||
@@ -222,11 +225,20 @@ end
|
||||
local HTTP_MARK = "\n__gen1recomp_http__"
|
||||
local HTTP_MARK_FMT = "\\n__gen1recomp_http__%{http_code}"
|
||||
|
||||
local function stripLoaderNoise(out)
|
||||
while out:find("^ERROR: ld%.so:") do
|
||||
local nl = out:find("\n", 1, true)
|
||||
if not nl then return "" end
|
||||
out = out:sub(nl + 1)
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
-- Split a curl pipe's output into (body, status, noise). `status` is nil
|
||||
-- when curl never got far enough to have one (DNS failure, no route, a
|
||||
-- timeout), in which case `noise` carries curl's own complaint.
|
||||
local function splitCurlOutput(out)
|
||||
out = tostring(out or "")
|
||||
out = stripLoaderNoise(tostring(out or ""))
|
||||
local at = nil
|
||||
local from = 1
|
||||
while true do
|
||||
|
||||
@@ -666,11 +666,10 @@ function SaveData.setModEnabled(options, id, enabled, version)
|
||||
options.modsByVersion = options.modsByVersion or {}
|
||||
local bucket = options.modsByVersion[version] or {}
|
||||
options.modsByVersion[version] = bucket
|
||||
-- no shared flag reads as enabled, the same default the loader applies to a
|
||||
-- missing entry, so a fresh install never fills the overlay with agreement
|
||||
-- with no shared flag the default is the caller's (experimental mods read as
|
||||
-- disabled), so the answer is stored outright rather than judged against one
|
||||
local shared = options.mods and options.mods[id]
|
||||
if type(shared) ~= "boolean" then shared = true end
|
||||
if shared == enabled then
|
||||
if type(shared) == "boolean" and shared == enabled then
|
||||
bucket[id] = nil
|
||||
else
|
||||
bucket[id] = enabled
|
||||
|
||||
@@ -101,6 +101,14 @@ function Boxes.canDeposit(save, partyIndex, boxIndex)
|
||||
return true
|
||||
end
|
||||
|
||||
-- RestorePPOfDepositedPokemon (engine/pokemon/move_mon.asm:711-773): every
|
||||
-- slot back to GetMaxPPOfMove, which already carries its own PP Up count.
|
||||
function Boxes.restorePP(mon)
|
||||
for _, move in ipairs((mon and mon.moves) or {}) do
|
||||
if type(move) == "table" then move.pp = move.maxPp or move.pp end
|
||||
end
|
||||
end
|
||||
|
||||
function Boxes.deposit(save, partyIndex, boxIndex)
|
||||
local ok, reason = Boxes.canDeposit(save, partyIndex, boxIndex)
|
||||
if not ok then return false, reason end
|
||||
@@ -112,6 +120,9 @@ function Boxes.deposit(save, partyIndex, boxIndex)
|
||||
Mail.removeSlot(save, partyIndex)
|
||||
local box = Boxes.box(save, boxIndex)
|
||||
box[#box + 1] = mon
|
||||
-- SendGetMonIntoFromBox's PC_DEPOSIT arm ends in RestorePPOfDepositedPokemon
|
||||
-- (engine/pokemon/move_mon.asm:633-635, :696-700).
|
||||
Boxes.restorePP(mon)
|
||||
return true, mon
|
||||
end
|
||||
|
||||
@@ -129,6 +140,15 @@ function Boxes.withdraw(save, boxIndex, slot)
|
||||
local ok, reason = Boxes.canWithdraw(save, boxIndex, slot)
|
||||
if not ok then return false, reason end
|
||||
local mon = table.remove(Boxes.box(save, boxIndex), slot)
|
||||
-- The `get mon into Party` arm alone heals: status cleared and MON_MAXHP
|
||||
-- copied over MON_HP, an egg's staying 0 (move_mon.asm:666-693).
|
||||
mon.status = nil
|
||||
mon.statusTurns = nil
|
||||
if mon.isEgg then
|
||||
mon.hp = 0
|
||||
else
|
||||
mon.hp = mon.maxHp or mon.hp
|
||||
end
|
||||
save.party = save.party or {}
|
||||
save.party[#save.party + 1] = mon
|
||||
return true, mon
|
||||
@@ -142,6 +162,16 @@ function Boxes.release(save, boxIndex, slot)
|
||||
return true, table.remove(box, slot)
|
||||
end
|
||||
|
||||
-- RELEASE off the DEPOSIT screen, whose list is the party: it is
|
||||
-- RemoveMonFromPartyOrBox's REMOVE_PARTY arm (bills_pc.asm:204-207).
|
||||
function Boxes.releaseFromParty(save, slot)
|
||||
local party = (save and save.party) or {}
|
||||
if not party[slot] then return false, "There is no POKéMON there." end
|
||||
local mon = table.remove(party, slot)
|
||||
Mail.removeSlot(save, slot)
|
||||
return true, mon
|
||||
end
|
||||
|
||||
-- Move a boxed mon to another box (MOVE PKMN W/O MAIL's box-to-box case).
|
||||
function Boxes.move(save, fromBox, slot, toBox)
|
||||
if fromBox == toBox then return false, "It's already there." end
|
||||
|
||||
@@ -159,6 +159,13 @@ function NpcTrade.perform(data, save, row, index)
|
||||
-- that slot inheriting it (src/core/gen2/Mail.lua).
|
||||
Mail.removeSlot(save, index)
|
||||
party[#party + 1] = received
|
||||
-- TryAddMonToParty's SetSeenAndCaughtMon (engine/pokemon/move_mon.asm:196),
|
||||
-- which the `predef` at engine/events/npc_trade.asm:168 runs like any other.
|
||||
save.pokedex = save.pokedex or {}
|
||||
save.pokedex.seen = save.pokedex.seen or {}
|
||||
save.pokedex.caught = save.pokedex.caught or {}
|
||||
save.pokedex.seen[received.species] = true
|
||||
save.pokedex.caught[received.species] = true
|
||||
return given, received
|
||||
end
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ Save.DEFAULT_OPTIONS = {
|
||||
-- means something different, hence the different name.
|
||||
color = "gbc",
|
||||
videoMode = "windowed",
|
||||
fpsCap = 60,
|
||||
musicVol = 7, -- 0-7, like the GB's NR50 master volume
|
||||
sfxVol = 7, -- 0-7
|
||||
musicFilter = 0, -- low-pass steps, 0 = off
|
||||
|
||||
Reference in New Issue
Block a user