forked from pyrex/chameleonic
Code review feedback, debug mode
This commit is contained in:
parent
a2212c342f
commit
8a192f87a2
@ -26,6 +26,13 @@ function music_off()
|
||||
menuitem(3, "music: off", music_on)
|
||||
end
|
||||
|
||||
function gsv(s)
|
||||
local ret=split(s,"\n")
|
||||
for i,v in ipairs(ret) do
|
||||
ret[i] = type(v) == "string" and split(v,"`") or {v} end
|
||||
return ret
|
||||
end
|
||||
|
||||
mnames={}
|
||||
function names(root)
|
||||
local n=mnames[root]
|
||||
@ -1728,13 +1735,6 @@ end
|
||||
|
||||
-->8
|
||||
--hint system
|
||||
function gsv(s)
|
||||
local ret=split(s,"\n")
|
||||
for i,v in ipairs(ret) do
|
||||
ret[i] = type(v) == "string" and split(v,"`") or {v} end
|
||||
return ret
|
||||
end
|
||||
|
||||
function rot13(s)
|
||||
local sord = pack(ord(s,1,#s))
|
||||
for i,c in ipairs(sord) do
|
||||
@ -1758,21 +1758,29 @@ function hints:init()
|
||||
for rec in all(h) do
|
||||
rec[4]=rot13(rec[4])
|
||||
local lh = self[rec[1]]
|
||||
if not lh then
|
||||
lh = {rec}
|
||||
self[rec[1]] = lh
|
||||
else
|
||||
if lh then
|
||||
add(lh,rec)
|
||||
else
|
||||
self[rec[1]] = {rec}
|
||||
end
|
||||
end
|
||||
menuitem(1,"get hint",function() level.hintlevel+=1 end)
|
||||
menuitem(2,"hide hints",function() level.hintlevel=0 end)
|
||||
-- debug mode: enable mouse
|
||||
poke(0x5f2d,1)
|
||||
end
|
||||
|
||||
hintflicker={7,10,9,8,8,9,10,7}
|
||||
function hints:draw2()
|
||||
pal()
|
||||
local c=hintflicker[t()%1*#hintflicker\1+1]
|
||||
-- debug mode: mouse coord display
|
||||
if stat(34) != 0 then
|
||||
local mousex, mousey = stat(32), stat(33)
|
||||
print("x ("..mousex..", "..mousey..")",mousex,mousey,c)
|
||||
end
|
||||
|
||||
|
||||
for i,h in ipairs(self[level.ix]) do
|
||||
if (i > level.hintlevel) return
|
||||
local _,x,y,txt=unpack(h)
|
||||
|
Loading…
Reference in New Issue
Block a user