localize a couple more things

This commit is contained in:
Connor Olding 2018-05-12 23:08:00 +02:00
parent 15f0292485
commit ec19774af5
2 changed files with 11 additions and 8 deletions

1
nn.lua
View File

@ -1,3 +1,4 @@
local assert = assert
local ceil = math.ceil
local cos = math.cos
local exp = math.exp

18
smb.lua
View File

@ -1,6 +1,16 @@
-- disassembly used for reference:
-- https://gist.githubusercontent.com/1wErt3r/4048722/raw/59e88c0028a58c6d7b9156749230ccac647bc7d4/SMBDIS.ASM
local band = bit.band
local floor = math.floor
local emu = emu
local gui = gui
local util = require("util")
local R = memory.readbyteunsigned
local W = memory.writebyte
local function S(addr) return util.signbyte(R(addr)) end
local rotation_offsets = { -- FIXME: not all of these are pixel-perfect.
0, -40, -- 0x00
6, -38,
@ -36,11 +46,6 @@ local rotation_offsets = { -- FIXME: not all of these are pixel-perfect.
-8, -38,
}
local util = require("util")
local R = memory.readbyteunsigned
local W = memory.writebyte
local function S(addr) return util.signbyte(R(addr)) end
-- TODO: reinterface to one "input" array visible to main.lua.
local sprite_input = {}
local tile_input = {}
@ -48,9 +53,6 @@ local extra_input = {}
local overlay = false
local band = bit.band
local floor = math.floor
local function get_timer()
return R(0x7F8) * 100 + R(0x7F9) * 10 + R(0x7FA)
end