forked from pyrex/chameleonic
Compare commits
6 Commits
f052186c97
...
better_deb
Author | SHA1 | Date | |
---|---|---|---|
60c1ccd85d
|
|||
7c1b12e9ac
|
|||
6d8ac03f48 | |||
8b1d12f152 | |||
a6debc3974 | |||
693cdaa11d |
206
chameleonic.p8
206
chameleonic.p8
@ -8,6 +8,7 @@ real_modules={}
|
||||
frame=0
|
||||
function _init()
|
||||
-- printh("restarting")
|
||||
music_on()
|
||||
_doall("init") end
|
||||
function _update()
|
||||
frame+=1
|
||||
@ -15,6 +16,28 @@ function _update()
|
||||
function _draw()
|
||||
_doall("draw") end
|
||||
|
||||
function music_on()
|
||||
music(0)
|
||||
menuitem(3, "music: on", music_off)
|
||||
end
|
||||
|
||||
function music_off()
|
||||
music(-1)
|
||||
menuitem(3, "music: off", music_on)
|
||||
end
|
||||
|
||||
function gsv(s,sep1,sep2)
|
||||
local ret=split(s,sep1 or "\n")
|
||||
for i,v in ipairs(ret) do
|
||||
ret[i] = type(v) == "string" and split(v,sep2 or "`") or {v} end
|
||||
return ret
|
||||
end
|
||||
|
||||
function cycle(tbl,period)
|
||||
period = period or 1
|
||||
return tbl[t()%period*#tbl\period+1]
|
||||
end
|
||||
|
||||
mnames={}
|
||||
function names(root)
|
||||
local n=mnames[root]
|
||||
@ -97,6 +120,15 @@ function sgn0(x)
|
||||
return x!=0 and sgn(x) or 0
|
||||
end
|
||||
|
||||
function inorder(tbl)
|
||||
local prev
|
||||
for v in all(tbl) do
|
||||
if (prev and v < prev) return
|
||||
prev = v
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function _mnmx(x,y)
|
||||
if (x>y)return y,x
|
||||
return x,y
|
||||
@ -266,6 +298,7 @@ function level:init()
|
||||
end
|
||||
|
||||
function level:reinit(n)
|
||||
self.hintlevel=255
|
||||
self.ix=n
|
||||
self.todo={}
|
||||
self.bigx,self.bigy=n%8,n\8
|
||||
@ -1704,6 +1737,133 @@ function level_text:draw()
|
||||
print(xys[4],xys[2],xys[3],6)
|
||||
end
|
||||
end
|
||||
|
||||
-->8
|
||||
--hint system
|
||||
function rot13(s)
|
||||
local sord = pack(ord(s,1,#s))
|
||||
for i,c in ipairs(sord) do
|
||||
if (inorder{65, c, 77} or inorder{97, c, 109}) sord[i]=c+13
|
||||
if (inorder{78, c, 90} or inorder{110, c, 122}) sord[i]=c-13
|
||||
end
|
||||
return chr(unpack(sord))
|
||||
end
|
||||
|
||||
--hint file format:
|
||||
-- each row is one hint.
|
||||
-- 4 or 5 columns
|
||||
-- separated with a
|
||||
-- grave (`) character
|
||||
-- [1] room#
|
||||
-- [2] x coord
|
||||
-- [3] y coord
|
||||
-- [4] message line 1 (rot13)
|
||||
-- [5] message llne 2 (rot13)
|
||||
-- [6] arrow (semicolon separated list: each element is two comma-separated integers)
|
||||
-- row 5 can be omitted
|
||||
-- for a 1-line hint
|
||||
-- row 6 can be omitted if there is no arrow
|
||||
--
|
||||
-- multiple hints for the same
|
||||
-- room are revealed in order
|
||||
|
||||
hints = {}
|
||||
add(real_modules,hints)
|
||||
|
||||
function hints:init()
|
||||
local h = gsv[[0`42`57`🅾️ yVPX` ■
|
||||
0`42`73`❎, ❎ cHYY``69,67;55,67
|
||||
1`35`33`⁘` cHYY`62,35;41,35
|
||||
1`79`82`cHYY ■``100,94;100,88
|
||||
1`42`98`⁘`VTABER`66,99;52,99;52,75;28,75;28,120
|
||||
2`75`65` `⁘`86,67;76,67;76,71
|
||||
2`104`73` ■`cHYY`81,75;86,75
|
||||
2`27`42`⁘``36,16;36,44;31,44
|
||||
3`51`106`■``52,97;52,104
|
||||
3`-1`-1```28,78;28,45
|
||||
3`-1`-1```65,35;83,35
|
||||
3`-1`-1```97,35;105,35]]
|
||||
for rec in all(h) do
|
||||
rec[4]=rot13(rec[4])
|
||||
if(rec[5]) rec[5]=rot13(rec[5])
|
||||
if(rec[6]) rec[6]=gsv(rec[6],";",",")
|
||||
local lh = self[rec[1]]
|
||||
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)
|
||||
end
|
||||
|
||||
hintflicker=split"7,10,9,8,8,9,10,7"
|
||||
function hints:draw2()
|
||||
pal()
|
||||
local c=cycle(hintflicker)
|
||||
|
||||
local function body()
|
||||
for i,h in ipairs(self[level.ix]) do
|
||||
if (i > level.hintlevel) return
|
||||
local _,x,y,txt,txt2,arrow=unpack(h)
|
||||
|
||||
print(txt,x,y)
|
||||
if (txt2) print(txt2,x,y+8)
|
||||
|
||||
if arrow then
|
||||
line()
|
||||
local x0,y0,x1,y1
|
||||
for i=1,#arrow do
|
||||
x0,y0,x1,y1=x1,y1,unpack(arrow[i])
|
||||
line(x1,y1)
|
||||
end
|
||||
local dir=atan2(x1-x0,y1-y0)
|
||||
local function _ahead(d,r)
|
||||
line(x1+r*sgn0(cos(dir+d)),y1+r*sgn0(sin(dir+d)))
|
||||
end
|
||||
_ahead(0.375,2) _ahead(0.625,2) _ahead(0,0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
color(7)
|
||||
camera(1,-1) pal(7,1) body()
|
||||
camera() pal(7,c) body()
|
||||
pal()
|
||||
end
|
||||
|
||||
-->8
|
||||
-- debug mouse support
|
||||
|
||||
debugmouse = {}
|
||||
|
||||
-- comment this out to disable debug mode
|
||||
add(real_modules, debugmouse)
|
||||
|
||||
function debugmouse:init()
|
||||
poke(0x5f2d,1)
|
||||
end
|
||||
|
||||
debugflicker=split"5,6,7,15,14,8,2,4,9,10,11,3,12,13"
|
||||
debugchs = split" ,□,x"
|
||||
|
||||
function debugmouse:draw3()
|
||||
if (stat(34) == 0) return
|
||||
pal(15,cycle(debugflicker,1.5))
|
||||
local x, y, c = stat(32), stat(33), debugchs[stat(34) & 0x3]
|
||||
if not c or c == " " then
|
||||
spr(50,x,y)
|
||||
else
|
||||
print(c,x,y,15)
|
||||
end
|
||||
print(x..", "..y,
|
||||
mid(0,x,97),
|
||||
mid(0, y > 117 and y - 6 or y + 6, 117),
|
||||
15)
|
||||
pal()
|
||||
end
|
||||
|
||||
__gfx__
|
||||
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110005000000000000
|
||||
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110000500000000000
|
||||
@ -1729,10 +1889,10 @@ eeee0000cc04405500444400efeeee5e11111111e5eeeefeeeeeeeeeeeeeeeeeffffffffffffffff
|
||||
0a000aa4441a91a1bbabbbbbeffeeeeeeeeeeeeeeeeeeffeff1ff1ff11111111ff1111ff00000000000000000000000000000000000000000000000000000000
|
||||
00a0044449a110a1bbbbbbbbeeffffffffffffffffffffeeff1ff1ffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
000aa111991111103bbbbbb3eeeeeeeeeeeeeeeeeeeeeeeeff1ff1ffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000991000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111999999111111111
|
||||
00000000990000000000000000000000000000000000000000000000000000000000000000000000000000000000000019911991999999911999999119999999
|
||||
00000000990000000000000000000000000000000000000000000000000000000000000000000000000000000000000019977991999999911999999119999999
|
||||
00000000090000000000000000000000000000000000000000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
||||
0000000099100000f765000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111999999111111111
|
||||
00000000990000007700000000000000000000000000000000000000000000000000000000000000000000000000000019911991999999911999999119999999
|
||||
00000000990000006060000000000000000000000000000000000000000000000000000000000000000000000000000019977991999999911999999119999999
|
||||
00000000090000005005000000000000000000000000000000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
||||
00000000aa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
||||
0000000077a000000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991999999911997799119999999
|
||||
00000007777a00000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991999999911991199119999999
|
||||
@ -1802,37 +1962,37 @@ eeee0000cc04405500444400efeeee5e11111111e5eeeefeeeeeeeeeeeeeeeeeffffffffffffffff
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c021c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c021c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c100c0c000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c000c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c1002400c1c100c0c0c0c0c0c0c0c0c0c0c0c0c0c000c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c00000e300c00000c0c0c0c0c0c0c0c0c0c0c10000c000c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c000000000c000c0c0c0c0c0c0c0c0c0c000000000c100c100f3c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000001000340000c000c0c0c0c0c0c0c0c0c01000c034c1c1c1c100c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c000000000c100f3c0c0c0c0c0c0c0c0c00000000000000000c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000212000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000212000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000313000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000313000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0100000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c00000000000000000000000000000c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000c0
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
|
||||
__label__
|
||||
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||
@ -1967,9 +2127,9 @@ __gff__
|
||||
000000c0c0c0c0c0c0c0c0c0c0c00000000000c0c0c0c0c0c0c0c0c0202020200040c0c0c0c0c0c0c008080800000000404000000808080808080808c0c0c0c000000000080808080808080800000008000000000808080808080808000000000008080808080808080808080000000000080808080808080808080800000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
__map__
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d1203040404050d0d0d0d010d0d0d0d0d0d0d0d0d0d0d0d0d0d120d0d0d0d0d0d0d0d0d0d0d0d0d03043e0a040404050d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0a0d0d0d0d0a0d0304040405140013004f00150d0d0d1400140d0d0d0d0d0d0d0d0d0d0d0d1400140d0d0d0d0d0304040404040417000026000000150d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d030404043e050d0d0d0d0d0d033e0404040404050d0d0d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d03042604040404260417000000151400001e0000150304040400040404050d0d0d0d0d03040404050003040404050d1300000000000000000018000000150d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0304041700000000150d0d0d0d0d0d134400000000001514140d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d1203040404050d0d0d0d010d0d0d0d0d0d0d0d0d0d0d0d0d0d120d0d0d0d0d0d0d0d0d0d0d0d0d03043e0a00000000000000000000000000000000000000000000000000000000000000000d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0a0d0d0d0d0a0d0304040405140013004f00150d0d0d1400140d0d0d0d0d0d0d0d0d0d0d0d1400140d0d0d0d0d030404040404041700002600000000000000000000000000000000000000000000000000000000000000000d0d0d0d0d033e0404040404050d0d0d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d03042604040404260417000000151400001e0000150304040400040404050d0d0d0d0d03040404050003040404050d130000000000000000001800000000000000000000000000000000000000000000000000000000000000000d0d0d0d0d134400000000001514140d0d0d0d0d
|
||||
0d0d0d0d0d0d0d0d0d0a0d0d0d0d0d0d0d14130018000000001800000000001514141300000015130000000000000015030404040513000000160017000000150d1300000000000000421e00000000150d0d0d0d0d0d0d0d0d0a0d0d0d0d0d0d0d0d1300000000000000150d0d0d0d0d12001d0000000000000003040404050d
|
||||
0d0d0d0d0d0d0d0d0d260d0d0d0d0d0d010000001e0000004f000000000000150d031700000015130000000000000015130000001513004200001e43000000150d130000000000000000001a000041150d0d0d0d0d0d0d0d0d260d0d0d0d0d0d0d0d13000000001d1d00150d0d0d0d0d0d131c0000000000150013000000150d
|
||||
0d0d0d0d0d0d0d0d0d260d0d0d0d0d0d0d1413001a000000001a0000000000150d13000000001513000000000000001513001d1d0000000000000000000000150d232424002424240700002600001e150d0d0d0d0d0d0d0d0d260d0d0d0d0d0d0d0d1346062407471c00150d0d0d0d0d0d231c24241d2424250000000000150d
|
||||
|
Reference in New Issue
Block a user