94 lines
2.1 KiB
Lua
94 lines
2.1 KiB
Lua
state_archaeology=klass()
|
|
function state_archaeology:init(tips_mode)
|
|
self.tips_mode=tips_mode
|
|
self.n_holy_books=#liturgy.holy_book
|
|
self:select_book(1)
|
|
end
|
|
function state_archaeology:enter() end
|
|
function state_archaeology:exit(new_top) end
|
|
|
|
function state_archaeology:reenter() end
|
|
function state_archaeology:suspend() end
|
|
|
|
function state_archaeology:select_book(n)
|
|
self.selection=n
|
|
if (self.tips_mode) self.title="tips" self.full_text=archaeology_tips return
|
|
local lines={}
|
|
local hb=liturgy.holy_book[self.selection]
|
|
self.title=hb[1]
|
|
printh()
|
|
for source in all(split(hb[2])) do
|
|
for line in all(liturgy.sacred_text_lines) do
|
|
if (line[1]==source) add(lines,self:_censor(source,line[2]))
|
|
end
|
|
end
|
|
|
|
self.full_text=""
|
|
for i=1,#lines do
|
|
if (i>1) self.full_text..="\n"
|
|
self.full_text..=lines[i]
|
|
end
|
|
end
|
|
|
|
function state_archaeology:_censor(src,line)
|
|
if (completion_tracker:was_seen(src)) return line
|
|
local line2=""
|
|
for i=1,#line do
|
|
local c=sub(line,i,i)
|
|
if ("a"<=c and c<="z") c="?"
|
|
line2..=c
|
|
end
|
|
return "\f6"..line2.."\ff"
|
|
end
|
|
|
|
function state_archaeology:update()
|
|
local vel=0
|
|
if (btnp(0)) vel-=1
|
|
if (btnp(1)) vel+=1
|
|
if (btnp(5)) sounds:menu() self.done=true
|
|
if (vel!=0) sounds:menu() self:select_book((self.selection+vel-1)%self.n_holy_books+1)
|
|
end
|
|
function state_archaeology:draw()
|
|
local fullw,fullh=measure_text(self.full_text)
|
|
local total_height=fullh+16
|
|
|
|
cls(13)
|
|
local y=64-total_height\2
|
|
local tw=measure_text(self.title)-1
|
|
local x=64-tw\2
|
|
local tx=x
|
|
print(self.title,x,y,15)
|
|
y+=6
|
|
line(x,y,x+tw-1,y,15)
|
|
y+=3
|
|
|
|
local x=64-fullw\2
|
|
rectfill(x-1,y-1,x+fullw,y+fullh-1,4)
|
|
print(self.full_text,x,y,15)
|
|
y+=fullh+1
|
|
|
|
line(tx,y,tx+tw-1,y,15)
|
|
y+=2
|
|
|
|
if not self.tips_mode then
|
|
print("⬅️",tx,y)
|
|
print("➡️",tx+tw-7,y)
|
|
end
|
|
print("❎ go back",1,122,15)
|
|
end
|
|
|
|
archaeology_tips=[[
|
|
wise archaeologists know these
|
|
secrets:
|
|
|
|
- hold ❎ to get a new board.
|
|
- hold 🅾️ to pick up more than
|
|
one card.
|
|
- updates and other games by
|
|
pyrex and nyeo are
|
|
available at nyeogmi.itch.io
|
|
and lexaloffle.
|
|
|
|
only diligent research can
|
|
uncover sacred mysteries!
|
|
- p & n]] |