mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
a9ce423bdc
CLOSES #1275, CLOSES #1295, CLOSES #1384, CLOSES #1628, CLOSES #1677, CLOSES #1682, CLOSES #1691, CLOSES #1813, CLOSES #1822, CLOSES #1861, CLOSES #1867, CLOSES #1868, CLOSES #1869, CLOSES #1870, CLOSES #1871, CLOSES #1872, CLOSES #1874, CLOSES #1876, CLOSES #1878, CLOSES #1880, CLOSES #1881, CLOSES #1882, CLOSES #1884, CLOSES #1885, CLOSES #1886, CLOSES #1887, CLOSES #1888, CLOSES #1889, CLOSES #1890, CLOSES #1891, CLOSES #1892, CLOSES #1893, CLOSES #1894, CLOSES #1895, CLOSES #1896, CLOSES #1899, CLOSES #1900, CLOSES #1901
87 lines
3.0 KiB
Lua
87 lines
3.0 KiB
Lua
-- pokegold engine/overworld/map_objects.asm:1995, :879-893 (#1888)
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
local T = require("tests.harness")
|
|
|
|
love = require("tests.love_stub")
|
|
|
|
local Player = require("src.world.gen2.Player")
|
|
local World = require("src.world.gen2.World")
|
|
|
|
local SHEET = {}
|
|
|
|
local function newWorld()
|
|
return setmetatable({ jumpShadowImage = SHEET, palettes = nil }, {
|
|
__index = World,
|
|
})
|
|
end
|
|
|
|
local function record(fn)
|
|
local G = love.graphics
|
|
local realDraw, realEllipse = G.draw, G.ellipse
|
|
local draws, ellipses = {}, 0
|
|
G.draw = function(image, x, y, r, sx, sy)
|
|
draws[#draws + 1] = { image = image, x = x, y = y, sx = sx, sy = sy }
|
|
end
|
|
G.ellipse = function() ellipses = ellipses + 1 end
|
|
local ok, err = pcall(fn)
|
|
G.draw, G.ellipse = realDraw, realEllipse
|
|
if not ok then error(err, 0) end
|
|
return draws, ellipses
|
|
end
|
|
|
|
do
|
|
local world = newWorld()
|
|
local jumper = { jumping = true, facing = "down", px = 32, py = 48 }
|
|
local draws = record(function() world:drawJumpShadow(jumper, 0, 0, 1) end)
|
|
T.eq(#draws, 2, "FacingShadow's `db 2` is two OAM entries, so two blits")
|
|
T.eq(draws[1].image, SHEET, "both of them the ripped JumpShadowGFX tile")
|
|
T.eq(draws[2].image, SHEET, "not an invented shape")
|
|
T.eq(draws[1].sx, 1, "the first entry draws unflipped")
|
|
T.eq(draws[2].sx, -1, "the second carries OAM_XFLIP")
|
|
T.eq(draws[1].x, 32, "at the jumper's own cell x")
|
|
T.eq(draws[2].x, 48, "and the flip hangs off the far edge of the 16px pair")
|
|
T.eq(draws[1].y, 58, "DOWN puts it 10 pixels under the ground cell's top")
|
|
T.eq(draws[2].y, 58, "both entries share the row")
|
|
end
|
|
|
|
do
|
|
local world = newWorld()
|
|
for _, facing in ipairs({ "left", "right" }) do
|
|
local jumper = { jumping = true, facing = facing, px = 0, py = 0 }
|
|
local draws = record(function() world:drawJumpShadow(jumper, 0, 0, 1) end)
|
|
T.eq(draws[1].y, 8,
|
|
facing .. " takes MovementFunction_Shadow's 1 * TILE_WIDTH + 4 arm")
|
|
end
|
|
end
|
|
|
|
do
|
|
local world = newWorld()
|
|
local standing = { jumping = false, facing = "down", px = 0, py = 0 }
|
|
local draws = record(function() world:drawJumpShadow(standing, 0, 0, 1) end)
|
|
T.eq(#draws, 0, "SpawnShadow only runs from JumpStep, so no hop no shadow")
|
|
end
|
|
|
|
do
|
|
local world = newWorld()
|
|
world.jumpShadowImage = nil
|
|
local jumper = { jumping = true, facing = "down", px = 0, py = 0 }
|
|
local draws, ellipses = record(function()
|
|
world:drawJumpShadow(jumper, 0, 0, 1)
|
|
end)
|
|
T.eq(#draws, 0, "a cache from before the tile was extracted has no shadow")
|
|
T.eq(ellipses, 0, "and does not fall back to a drawn oval")
|
|
end
|
|
|
|
do
|
|
local player = setmetatable({
|
|
jumping = true, facing = "down", px = 0, py = 0, spriteYOffset = -12,
|
|
turnTimer = 0, moving = false, animClock = 0,
|
|
sprite = { draw = function() end },
|
|
}, { __index = Player })
|
|
local _, ellipses = record(function() player:draw(0, 0, 1) end)
|
|
T.eq(ellipses, 0, "the 40%-black love.graphics.ellipse placeholder is gone")
|
|
end
|
|
|
|
T.finish("gen2_ledge_shadow_bug1888")
|