mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 19:24:01 +02:00
so many bugs i cannot even breathe
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
-- under the player's feet (#265). home/overworld.asm:391 CheckWarpsNoCollision
|
||||
-- runs on EVERY completed step with no first-step-after-a-warp counter, so the
|
||||
-- arrival disable is POSITIONAL (the cell you came in on is inert until you
|
||||
-- leave it), which is what warpEntryCell models. #230's stand-still bonk guard,
|
||||
-- still backed by justWarped, is asserted here too.
|
||||
-- leave it), which is what warpEntryCell models. The two STAND-STILL triggers
|
||||
-- answer to BIT_STANDING_ON_WARP instead, which the departing tile decides and
|
||||
-- the warp carries over: cleared by a staircase (#230), kept by a door tile so
|
||||
-- an exit mat works on the tile you land on (#378). Both are asserted here.
|
||||
package.path = "./?.lua;./?/init.lua;" .. package.path
|
||||
if not _G.love then _G.love = require("tests.love_stub") end
|
||||
|
||||
@@ -48,15 +50,18 @@ Game.overworld = OW
|
||||
-- these two fields once setMap has placed the player (OverworldController.lua,
|
||||
-- inside the Transition callback). takeWarp is stubbed per instance so the
|
||||
-- assertion is which warp the engine decided to take, with no Transition to pump.
|
||||
local function arriveOn(mapId, x, y, facing)
|
||||
local function arriveOn(mapId, x, y, facing, standingOnWarp)
|
||||
Input:reset()
|
||||
while Game.stack:top() do Game.stack:pop() end
|
||||
Game.stack:push(OW, mapId, x, y, facing or "down")
|
||||
local ow = Game.stack:top()
|
||||
ow.player.moving = false
|
||||
ow.player.turnTimer = 0
|
||||
ow.justWarped = true
|
||||
ow.warpEntryCell = { x = x, y = y }
|
||||
-- BIT_STANDING_ON_WARP is whatever the tile we LEFT made it: a door tile
|
||||
-- leaves it set, a stair/ladder tile clears it, and the map change does not
|
||||
-- touch wMovementFlags.
|
||||
ow.standingOnWarp = standingOnWarp and true or false
|
||||
ow.taken = nil
|
||||
ow.takeWarp = function(self, def) self.taken = def end
|
||||
return ow
|
||||
@@ -77,16 +82,16 @@ end
|
||||
-- onto the adjacent ladder at (25,4).
|
||||
do
|
||||
local ow = arriveOn("SEAFOAM_ISLANDS_B3F", 25, 3, "down")
|
||||
check(ow:onWarpArrivalCell(), "the cell just arrived on is inert")
|
||||
check(ow.warpEntryCell ~= nil, "the cell just arrived on is inert")
|
||||
stepTo(ow, 25, 4, "down")
|
||||
check(ow.taken ~= nil, "the step onto (25,4) fires a warp")
|
||||
eq(ow.taken and ow.taken.destMap, "SEAFOAM_ISLANDS_B4F",
|
||||
"and it is the ladder down to B4F")
|
||||
check(ow.justWarped == false, "the arrival record is cleared by that step")
|
||||
check(ow.warpEntryCell == nil, "the arrival record is cleared by that step")
|
||||
end
|
||||
|
||||
-- The arrival cell stays inert while you stand on it, even if a scripted nudge
|
||||
-- re-runs the step handler there. That is warpEntryCell's job, not justWarped's.
|
||||
-- re-runs the step handler there. That is warpEntryCell's job.
|
||||
do
|
||||
local ow = arriveOn("SEAFOAM_ISLANDS_B3F", 25, 3, "down")
|
||||
stepTo(ow, 25, 3, "down")
|
||||
@@ -106,12 +111,14 @@ do
|
||||
eq(ow.taken and ow.taken.destMap, "SEAFOAM_ISLANDS_B2F", "back up to B2F")
|
||||
end
|
||||
|
||||
-- #230 must not come back: justWarped still guards the two STAND-STILL warp
|
||||
-- triggers, where no step ever completes. Red's house 2F staircase is on the
|
||||
-- map's east edge, so pushing into that edge has to bonk, not bounce floors.
|
||||
-- #230 must not come back: the staircase tile ($1A/$1C, a warp tile that is
|
||||
-- not a door tile) clears BIT_STANDING_ON_WARP on the step that takes it, so
|
||||
-- the two STAND-STILL triggers stay shut on arrival. Red's house 2F staircase
|
||||
-- is on the map's east edge, so pushing into that edge has to bonk, not bounce.
|
||||
do
|
||||
local ow = arriveOn("REDS_HOUSE_2F", 7, 1, "down")
|
||||
check(ow:onWarpArrivalCell(), "the staircase arrival cell reports inert")
|
||||
local ow = arriveOn("REDS_HOUSE_2F", 7, 1, "down", false)
|
||||
check(ow:canCollisionWarp() == false,
|
||||
"the staircase arrival leaves BIT_STANDING_ON_WARP clear")
|
||||
check(ow:checkEdgeExit("right") == false,
|
||||
"pushing east off the map edge from it does not warp (#230)")
|
||||
Input.state.right = true
|
||||
@@ -138,4 +145,21 @@ do
|
||||
Input:reset()
|
||||
end
|
||||
|
||||
-- #378: the exit mat you warped IN on is NOT inert for the collision paths.
|
||||
-- REDS_HOUSE_1F's mat (2,7) is tile $14 -- neither a door tile nor a warp tile,
|
||||
-- so nothing clears the flag that Pallet Town's door tile ($1B, a door tile)
|
||||
-- set on the way in, and the first press of DOWN walks straight back outside.
|
||||
do
|
||||
local reds1 = MapLoader.load(Data, "REDS_HOUSE_1F")
|
||||
eq(reds1:cellTile(2, 7), 0x14, "REDS_HOUSE_1F (2,7) is the exit mat tile")
|
||||
check(not reds1:isWarpTileCell(2, 7), "the mat is not a warp-activating tile")
|
||||
eq(reds1.def.height * 2, 8,
|
||||
"REDS_HOUSE_1F is 8 cells tall, so y=7 is the south edge")
|
||||
|
||||
local ow = arriveOn("REDS_HOUSE_1F", 2, 7, "down", true)
|
||||
check(ow:checkEdgeExit("down") == true,
|
||||
"pressing DOWN on the mat just arrived on exits the house (#378)")
|
||||
eq(ow.taken and ow.taken.destMap, "LAST_MAP", "back out the way we came")
|
||||
end
|
||||
|
||||
S.finish()
|
||||
|
||||
Reference in New Issue
Block a user