forked from pyrex/chameleonic
Add arrow hints and use them
This commit is contained in:
parent
a6debc3974
commit
8b1d12f152
@ -26,10 +26,10 @@ function music_off()
|
|||||||
menuitem(3, "music: off", music_on)
|
menuitem(3, "music: off", music_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gsv(s)
|
function gsv(s,sep1,sep2)
|
||||||
local ret=split(s,"\n")
|
local ret=split(s,sep1 or "\n")
|
||||||
for i,v in ipairs(ret) do
|
for i,v in ipairs(ret) do
|
||||||
ret[i] = type(v) == "string" and split(v,"`") or {v} end
|
ret[i] = type(v) == "string" and split(v,sep2 or "`") or {v} end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ function level:init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function level:reinit(n)
|
function level:reinit(n)
|
||||||
self.hintlevel = 0
|
self.hintlevel=255
|
||||||
self.ix=n
|
self.ix=n
|
||||||
self.todo={}
|
self.todo={}
|
||||||
self.bigx,self.bigy=n%8,n\8
|
self.bigx,self.bigy=n%8,n\8
|
||||||
@ -1754,8 +1754,10 @@ end
|
|||||||
-- [3] y coord
|
-- [3] y coord
|
||||||
-- [4] message line 1 (rot13)
|
-- [4] message line 1 (rot13)
|
||||||
-- [5] message llne 2 (rot13)
|
-- [5] message llne 2 (rot13)
|
||||||
|
-- [6] arrow (semicolon separated list: each element is two comma-separated integers)
|
||||||
-- row 5 can be omitted
|
-- row 5 can be omitted
|
||||||
-- for a 1-line hint
|
-- for a 1-line hint
|
||||||
|
-- row 6 can be omitted if there is no arrow
|
||||||
--
|
--
|
||||||
-- multiple hints for the same
|
-- multiple hints for the same
|
||||||
-- room are revealed in order
|
-- room are revealed in order
|
||||||
@ -1765,19 +1767,21 @@ add(real_modules,hints)
|
|||||||
|
|
||||||
function hints:init()
|
function hints:init()
|
||||||
local h = gsv[[0`42`57`🅾️ yVPX` ■
|
local h = gsv[[0`42`57`🅾️ yVPX` ■
|
||||||
0`42`73`❎, ❎ cHYY
|
0`42`73`❎, ❎ cHYY``69,67;55,67
|
||||||
1`35`34`⁘ sVYY
|
1`35`33`⁘` cHYY`62,35;41,35
|
||||||
1`99`82`■ cHYY
|
1`79`82`cHYY ■``100,94;100,88
|
||||||
1`42`98`⁘`VTABER
|
1`42`98`⁘`VTABER`66,99;52,99;52,75;28,75;28,120
|
||||||
2`75`65`i <`⁘
|
2`75`65` `⁘`86,67;76,67;76,71
|
||||||
2`104`73` ■`cHYY
|
2`104`73` ■`cHYY`81,75;86,75
|
||||||
2`27`42`⁘
|
2`27`42`⁘``36,16;36,44;31,44
|
||||||
3`51`106`■ cHYY
|
3`51`106`■``52,97;52,104
|
||||||
3`27`81`⁘ HAOYBPX ZR
|
3`-1`-1```28,78;28,45
|
||||||
3`91`33`■ FGNAQ` URER]]
|
3`-1`-1```65,35;83,35
|
||||||
|
3`-1`-1```97,35;105,35]]
|
||||||
for rec in all(h) do
|
for rec in all(h) do
|
||||||
rec[4]=rot13(rec[4])
|
rec[4]=rot13(rec[4])
|
||||||
if(rec[5]) rec[5]=rot13(rec[5])
|
if(rec[5]) rec[5]=rot13(rec[5])
|
||||||
|
if(rec[6]) rec[6]=gsv(rec[6],";",",")
|
||||||
local lh = self[rec[1]]
|
local lh = self[rec[1]]
|
||||||
if lh then
|
if lh then
|
||||||
add(lh,rec)
|
add(lh,rec)
|
||||||
@ -1791,11 +1795,6 @@ function hints:init()
|
|||||||
poke(0x5f2d,1)
|
poke(0x5f2d,1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function shdprint(txt,x,y,c)
|
|
||||||
print(txt,x-1,y+1,1)
|
|
||||||
print(txt,x,y,c)
|
|
||||||
end
|
|
||||||
|
|
||||||
hintflicker={7,10,9,8,8,9,10,7}
|
hintflicker={7,10,9,8,8,9,10,7}
|
||||||
function hints:draw2()
|
function hints:draw2()
|
||||||
pal()
|
pal()
|
||||||
@ -1807,12 +1806,34 @@ function hints:draw2()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function body()
|
||||||
for i,h in ipairs(self[level.ix]) do
|
for i,h in ipairs(self[level.ix]) do
|
||||||
if (i > level.hintlevel) return
|
if (i > level.hintlevel) return
|
||||||
local _,x,y,txt,txt2=unpack(h)
|
local _,x,y,txt,txt2,arrow=unpack(h)
|
||||||
shdprint(txt,x,y,c)
|
|
||||||
if (txt2) shdprint(txt2,x,y+8,c)
|
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
|
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
|
end
|
||||||
|
|
||||||
__gfx__
|
__gfx__
|
||||||
|
Loading…
Reference in New Issue
Block a user