fix some inputs
This commit is contained in:
parent
5201b75509
commit
ce64801368
1 changed files with 12 additions and 7 deletions
19
main.lua
19
main.lua
|
@ -132,6 +132,11 @@ local function boolean_xor(a, b)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function signbyte(x)
|
||||||
|
if x >= 128 then x = 256 - x end
|
||||||
|
return x
|
||||||
|
end
|
||||||
|
|
||||||
local _invlog2 = 1 / log(2)
|
local _invlog2 = 1 / log(2)
|
||||||
local function log2(x) return log(x) * _invlog2 end
|
local function log2(x) return log(x) * _invlog2 end
|
||||||
|
|
||||||
|
@ -309,7 +314,7 @@ local function getxy(i, x_addr, y_addr, pageloc_addr, hipos_addr)
|
||||||
end
|
end
|
||||||
if hipos_addr ~= nil then
|
if hipos_addr ~= nil then
|
||||||
local hipos = S(hipos_addr + i)
|
local hipos = S(hipos_addr + i)
|
||||||
sy = sy + (hipos - 1) * 256
|
sy = sy + (signbyte(hipos) - 1) * 256
|
||||||
end
|
end
|
||||||
|
|
||||||
return sx, sy
|
return sx, sy
|
||||||
|
@ -414,9 +419,7 @@ local function handle_hammers()
|
||||||
x, y = x + 8, y + 8
|
x, y = x + 8, y + 8
|
||||||
local state = R(0x2A + i)
|
local state = R(0x2A + i)
|
||||||
-- skip coin effect states. not interactable; we don't care!
|
-- skip coin effect states. not interactable; we don't care!
|
||||||
if state ~= 0
|
if state ~= 0 and state >= 0x30 then
|
||||||
and state >= 0x30
|
|
||||||
then
|
|
||||||
mark_sprite(x, y, state + 1)
|
mark_sprite(x, y, state + 1)
|
||||||
else
|
else
|
||||||
mark_sprite(0, 0, 0)
|
mark_sprite(0, 0, 0)
|
||||||
|
@ -933,12 +936,14 @@ local function doit(dummy)
|
||||||
mark_sprite(x + 8, y + 24, -powerup - 1)
|
mark_sprite(x + 8, y + 24, -powerup - 1)
|
||||||
|
|
||||||
local vx, vy = S(0x57), S(0x9F)
|
local vx, vy = S(0x57), S(0x9F)
|
||||||
insert(extra_input, vx)
|
-- i shouldn't need to do this if it's signed, but apparently...
|
||||||
insert(extra_input, vy)
|
insert(extra_input, signbyte(vx) * 16)
|
||||||
|
insert(extra_input, signbyte(vy) * 16)
|
||||||
|
|
||||||
if cfg.time_inputs then
|
if cfg.time_inputs then
|
||||||
for i=2,5 do
|
for i=2,5 do
|
||||||
insert(extra_input, band(total_frames, lshift(1, i)))
|
local v = band(total_frames, lshift(1, i)) == 0 and -256 or 256
|
||||||
|
insert(extra_input, v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue