mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 08:11:35 +02:00
CLOSES #806, CLOSES #809, CLOSES #853, CLOSES #854, CLOSES #860, CLOSES #862, CLOSES #865, CLOSES #866
This commit is contained in:
+18
-8
@@ -2,10 +2,13 @@
|
||||
-- dex description (data/pokemon/dex_entries.asm + dex_text.asm).
|
||||
--
|
||||
-- `species` may be a species id string, or a table
|
||||
-- `{ species = id, forceOwned = true }`. forceOwned mirrors pret's
|
||||
-- StarterDex (engine/events/starter_dex.asm), which temporarily sets the
|
||||
-- owned bit so Oak's lab ball previews show height/weight/description
|
||||
-- without permanently marking the mon owned.
|
||||
-- `{ species = id, forceOwned = true, onClose = fn }`. forceOwned mirrors
|
||||
-- pret's StarterDex (engine/events/starter_dex.asm), which temporarily sets
|
||||
-- the owned bit so Oak's lab ball previews show height/weight/description
|
||||
-- without permanently marking the mon owned. onClose fires once the page
|
||||
-- is dismissed, for callers that push this screen from a plain callback
|
||||
-- instead of a script runner (the push_screen command yields on the runner
|
||||
-- instead, src/script/Commands.lua).
|
||||
|
||||
local Font = require("src.render.Font")
|
||||
local Strings = require("src.core.Strings")
|
||||
@@ -26,14 +29,16 @@ end
|
||||
local function resolveArgs(speciesOrOpts)
|
||||
if type(speciesOrOpts) == "table" then
|
||||
return speciesOrOpts.species or speciesOrOpts[1],
|
||||
speciesOrOpts.forceOwned and true or false
|
||||
speciesOrOpts.forceOwned and true or false,
|
||||
speciesOrOpts.onClose
|
||||
end
|
||||
return speciesOrOpts, false
|
||||
return speciesOrOpts, false, nil
|
||||
end
|
||||
|
||||
function DexEntryMenu.new(game, speciesOrOpts)
|
||||
local species, forceOwned = resolveArgs(speciesOrOpts)
|
||||
local self = setmetatable({ game = game, forceOwned = forceOwned }, DexEntryMenu)
|
||||
local species, forceOwned, onClose = resolveArgs(speciesOrOpts)
|
||||
local self = setmetatable({ game = game, forceOwned = forceOwned,
|
||||
onClose = onClose }, DexEntryMenu)
|
||||
self.def = game.data.pokemon[species]
|
||||
local path, trueColor = require("src.pokemon.Sprites").path(
|
||||
game.data, species, "front", { kind = "dex" })
|
||||
@@ -52,6 +57,11 @@ function DexEntryMenu:update(dt)
|
||||
local input = self.game.input
|
||||
if input:wasPressed("a") or input:wasPressed("b") then
|
||||
self.game.stack:pop()
|
||||
-- onClose resumes a callback-style caller after the page closes: the
|
||||
-- dojo prize balls print their offer only once DisplayPokedex returns
|
||||
-- (data/scripts/story4.lua, #853). Script rows do not need it, they
|
||||
-- yield on push_screen's waitingCheck instead.
|
||||
if self.onClose then self.onClose() end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+26
-3
@@ -437,6 +437,25 @@ local function buildRows(game)
|
||||
require("src.core.TouchControls"):applyOptions(o)
|
||||
return true
|
||||
end },
|
||||
-- Haptic feedback for on-screen pad presses (#806): OFF / LIGHT /
|
||||
-- MEDIUM / HEAVY, where the intensity is a vibration duration --
|
||||
-- love.system.vibrate takes nothing else. Hidden with TOUCH PAD below,
|
||||
-- since the only thing that buzzes is a virtual button press.
|
||||
{ id = "haptics", label = Strings("VIBRATION"),
|
||||
value = function(g)
|
||||
local TC = require("src.core.TouchControls")
|
||||
return Strings(TC.hapticLabel(g.save.options.haptics))
|
||||
end,
|
||||
step = function(g, dir)
|
||||
local o = g.save.options
|
||||
local TC = require("src.core.TouchControls")
|
||||
o.haptics = TC.cycleHaptics(o.haptics, dir)
|
||||
TC:applyOptions(o)
|
||||
-- sample the level being selected: stepping the row is the only way
|
||||
-- to compare LIGHT against HEAVY without leaving the menu
|
||||
TC.buzz(o.haptics)
|
||||
return true
|
||||
end },
|
||||
}
|
||||
-- issue #136: hide GBC FX on Android/iOS -- the present shader soft-bricks
|
||||
if not GBCFX.isSupported() then
|
||||
@@ -454,8 +473,10 @@ local function buildRows(game)
|
||||
end
|
||||
rows = filtered
|
||||
end
|
||||
-- TOUCH PAD only where the overlay can appear (mobile, or desktop with
|
||||
-- POKEPORT_TOUCH=1). POKEPORT_TOUCH=0 forces it off everywhere.
|
||||
-- TOUCH PAD and VIBRATION only where the overlay can appear (mobile, or
|
||||
-- desktop with POKEPORT_TOUCH=1). POKEPORT_TOUCH=0 forces it off
|
||||
-- everywhere. VIBRATION rides the same gate: nothing else in the port
|
||||
-- vibrates, and love.system.vibrate is a no-op on desktop anyway.
|
||||
do
|
||||
local env = os.getenv("POKEPORT_TOUCH")
|
||||
local osName = love.system and love.system.getOS and love.system.getOS()
|
||||
@@ -464,7 +485,9 @@ local function buildRows(game)
|
||||
if not show then
|
||||
local filtered = {}
|
||||
for _, row in ipairs(rows) do
|
||||
if row.id ~= "touchControls" then filtered[#filtered + 1] = row end
|
||||
if row.id ~= "touchControls" and row.id ~= "haptics" then
|
||||
filtered[#filtered + 1] = row
|
||||
end
|
||||
end
|
||||
rows = filtered
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user