CLOSES #455, CLOSES #487, CLOSES #501, CLOSES #540, CLOSES #585, CLOSES #591, CLOSES #593, CLOSES #595, CLOSES #597, CLOSES #599, CLOSES #600, CLOSES #606, CLOSES #607, CLOSES #610, CLOSES #613, CLOSES #616, CLOSES #620, CLOSES #626, CLOSES #632, CLOSES #633, CLOSES #647

This commit is contained in:
bryanthaboi
2026-08-02 08:17:16 -04:00
parent ebbc55c4d0
commit 35b3fa6d9c
87 changed files with 6349 additions and 285 deletions
+25
View File
@@ -123,8 +123,10 @@ function BindingsMenu:beginCapture(item)
self.pending = nil
self.onKeyPressed = BindingsMenu.captureKey
self.onGamepadPressed = BindingsMenu.capturePad
self.onJoystickPressed = BindingsMenu.captureJoy
self.onKeyReleased = BindingsMenu.captureKeyRelease
self.onGamepadReleased = BindingsMenu.capturePadRelease
self.onJoystickReleased = BindingsMenu.captureJoyRelease
end
function BindingsMenu:endCapture()
@@ -132,8 +134,10 @@ function BindingsMenu:endCapture()
self.pending = nil
self.onKeyPressed = nil
self.onGamepadPressed = nil
self.onJoystickPressed = nil
self.onKeyReleased = nil
self.onGamepadReleased = nil
self.onJoystickReleased = nil
end
-- Escape is the capture's way out, so it is never captured: every other
@@ -169,6 +173,27 @@ function BindingsMenu:capturePadRelease(button)
end
end
-- A stick SDL has no game-controller-database entry for reports plain
-- button numbers instead of names, so its capture stores "joyN" in the
-- SAME pad slot every other controller uses (#632). The row's right
-- column, storeBinding's swap and START's reset-all then need no special
-- case, and src/core/Input.lua's applyBindings is the only place that has
-- to decode the name. `raw` keeps the two release hooks apart: p.value is
-- "joy3" here and an SDL button name there, so neither can claim the
-- other's release. Game only routes a raw stick to these hooks, so a
-- recognized pad still records its readable SDL name.
function BindingsMenu:captureJoy(button)
if self.pending then return self:endCapture() end
self.pending = { slot = "pad", value = "joy" .. button, raw = true }
end
function BindingsMenu:captureJoyRelease(button)
local p = self.pending
if p and p.raw and p.value == "joy" .. button then
self:storeBinding("pad", p.value)
end
end
function BindingsMenu:storeBinding(slot, value)
local item = self.capture
self:endCapture()
+11 -3
View File
@@ -373,9 +373,17 @@ function PartyMenu:update(dt)
or Strings("A blinding FLASH\nlights the area!"), function()
self:close()
-- setDark, not a bare field write: ADVANCED carries the darkness
-- in a baked atlas, so lighting the cave rebuilds it (#383)
self.game.stack:push(Transition.whiteFlash(self.game, nil,
function() ow:setDark(false) end))
-- in a baked atlas, so lighting the cave drops every resident map
-- and rebakes this one (#383). It runs HERE, before the blink,
-- because start_sub_menus.asm .flash clears wMapPalOffset before
-- PrintText and blinks last of all: the cave is already lit by the
-- time GBPalWhiteOutWithDelay3 runs. Hanging the rebuild off the
-- blink's completion instead left that rebuild's whole cost --
-- seconds of per-pixel atlas baking on a phone -- on screen as a
-- solid white frame with nothing under it, which reads as a
-- lockup (#610).
ow:setDark(false)
self.game.stack:push(Transition.whiteFlash(self.game))
end))
return
elseif action == "surf" then
+10 -3
View File
@@ -149,9 +149,16 @@ function StartMenu.new(game)
end
-- inside the Safari Zone the start menu also shows remaining steps and
-- SAFARI BALLs (PrintSafariZoneSteps): a 9x5 border at the top-left with
-- "steps/500" and "BALL xx"
if game.save.safari then
-- SAFARI BALLs (PrintSafariZoneSteps, engine/overworld/player_state.asm:
-- 219-224): a 9x5 border at the top-left with "steps/500" and "BALL xx".
-- It opens with `cp SAFARI_ZONE_EAST / ret c`, so only the nine interior
-- maps ($D9..$E1) get it -- SAFARI_ZONE_GATE is $9C and falls under that
-- early out, and used to show "502/500" while the player was still
-- standing at the counter (#540). Same map set as the step counter's
-- (FieldDefaults safari.stepMaps via OverworldState:inSafariStepZone).
local ow = game.overworld
if game.save.safari and ow and ow.map and ow.inSafariStepZone
and ow:inSafariStepZone() then
local baseDraw = menu.draw
menu.draw = function(self)
baseDraw(self)
+55 -7
View File
@@ -1,8 +1,13 @@
-- Launcher touch-controls editor (#327): drag each on-screen button to a
-- new spot, toggle the overlay off entirely, Reset to defaults, Done to
-- persist into options.lua. Opened from the game panel's "Touch Controls"
-- button; main.lua suspends the launcher the same way it does for the
-- save editor.
-- new spot, resize them, toggle the overlay off entirely, Reset to
-- defaults, Done to persist into options.lua. Opened from the game
-- panel's "Touch Controls" button; main.lua suspends the launcher the same
-- way it does for the save editor.
--
-- Everything edited here belongs to the orientation currently on screen
-- (#633): portrait and landscape keep separate positions and sizes, so a
-- player lays out each rotation once. Rotate the device (or resize the
-- desktop window past square) and the editor switches buckets live.
--
-- Draws in full window LOVE units -- the same space TouchControls uses
-- after Renderer:endFrame -- so what you drag here is what you get in play.
@@ -63,9 +68,11 @@ end
local function persist()
local opts = SaveData.loadOptions()
local cfg = TouchControls:config()
-- replaces the whole table, so a pre-#633 top-level positions key is
-- dropped once the player saves under the new shape
opts.touchControls = {
enabled = cfg.enabled,
positions = cfg.positions,
layouts = cfg.layouts,
}
SaveData.saveOptions(opts)
end
@@ -113,6 +120,8 @@ function Editor.draw()
local fullW, fullH = love.graphics.getDimensions()
local ox, oy, ww, wh = SafeArea.rect()
local s = math.max(0.75, math.min(1.4, wh / 768))
-- resolve the orientation bucket before any chrome reads scale (#633)
local bucket = TouchControls:currentBucket()
Editor.rects = {}
-- radial-ish navy field (two stacked fills; matches launcher atmosphere)
@@ -186,13 +195,41 @@ function Editor.draw()
chromeBtn(toggle, on and "Disable" or "Enable",
on and PAL.red or PAL.green)
-- size card (#633): -/+ resize every control in the orientation on
-- screen; the heading names it so it is plain the other one is untouched
local sizeY = cardY + cardH + 10 * s
col(PAL.card, 0.88)
roundRect("fill", cardX, sizeY, cardW, cardH, 12 * s)
col(PAL.stroke, 0.4)
roundRect("line", cardX, sizeY, cardW, cardH, 12 * s)
love.graphics.setFont(Editor.fonts.body)
col(PAL.label)
local orient = TouchControls.orientation == "landscape"
and "Landscape" or "Portrait"
love.graphics.print("Button size (" .. orient .. ")",
cardX + 16 * s, sizeY + 12 * s)
love.graphics.setFont(Editor.fonts.btn)
col(PAL.white)
love.graphics.print(
string.format("%d%%", math.floor((bucket.scale or 1) * 100 + 0.5)),
cardX + 16 * s, sizeY + 34 * s)
local stepW = 52 * s
local plus = { x = cardX + cardW - 16 * s - stepW,
y = sizeY + (cardH - btnH) / 2, w = stepW, h = btnH }
local minus = { x = plus.x - 10 * s - stepW, y = plus.y, w = stepW, h = btnH }
Editor.rects.sizeUp, Editor.rects.sizeDown = plus, minus
chromeBtn(minus, "-", { 60, 70, 110 })
chromeBtn(plus, "+", { 60, 70, 110 })
-- hint
love.graphics.setFont(Editor.fonts.body)
col(PAL.label, 0.9)
local hint = on
and "Drag each button to reposition. Layout is saved when you tap Done."
and "Drag each button to reposition, -/+ to resize. Portrait and landscape are saved separately when you tap Done."
or "Controls are hidden in-game. Enable them to show and edit the layout."
love.graphics.printf(hint, ox + pad, cardY + cardH + 12 * s, ww - 2 * pad, "left")
love.graphics.printf(hint, ox + pad, sizeY + cardH + 12 * s, ww - 2 * pad, "left")
-- the overlay itself (preview mode; dimmed when disabled)
TouchControls:draw()
@@ -214,6 +251,12 @@ local function beginDrag(id, x, y)
if inside(Editor.rects.done, x, y) then close(); return end
if inside(Editor.rects.reset, x, y) then resetLayout(); return end
if inside(Editor.rects.toggle, x, y) then toggleEnabled(); return end
if inside(Editor.rects.sizeDown, x, y) then
TouchControls:nudgeScale(-TouchControls.SCALE_STEP); return
end
if inside(Editor.rects.sizeUp, x, y) then
TouchControls:nudgeScale(TouchControls.SCALE_STEP); return
end
local name = TouchControls:hitTest(x, y)
if not name then return end
@@ -271,6 +314,11 @@ function Editor.keypressed(key)
close()
elseif key == "r" then
resetLayout()
-- desktop shortcuts for the size -/+ (POKEPORT_TOUCH=1 testing, #633)
elseif key == "-" or key == "kp-" then
TouchControls:nudgeScale(-TouchControls.SCALE_STEP)
elseif key == "=" or key == "+" or key == "kp+" then
TouchControls:nudgeScale(TouchControls.SCALE_STEP)
end
end