Compare commits

..

3 Commits

Author SHA1 Message Date
dca00e4fb6
fix many zonk mode display bugs!
* fix off-by-one error in spacing
* fix instant advancement in back-to-back edge-triggered pages with
  very little text
* fix failure to reset cursor position during file change
* fix fix fuzzy reconfiguration in fuzzy_stripey
* give up trying to make default text render well in zonk mode, it's
  not important enough to troubleshoot
2024-02-11 18:27:53 -08:00
aead4ad536
awakener prototype, with bugs 2024-02-11 17:35:49 -08:00
b13a5550ee
allow hiding bg layers; hide it in tutorial 2024-02-11 16:46:14 -08:00

View File

@ -481,7 +481,7 @@ function zonk_txt(s, x, y, p, md, amt, frms)
frames=frms, frames=frms,
v=v, v=v,
} }
itv.eff_w=t1:xmax() itv.eff_w=t1:xmax()-1
return itv return itv
end end
@ -566,16 +566,20 @@ fuzzy_stripey = {
mknew(fuzzy_stripey, function(f) mknew(fuzzy_stripey, function(f)
f.fuzz = fuzzy.new{ f.fuzz = fuzzy.new{
weight = f.weight or fuzzy_stripey.weight, weight = f.weight or fuzzy_stripey.weight,
interval = f.interval or fuzzy.interval, interval = f.interval,
tries = f.tries or fuzzy.tries, tries = f.tries,
} }
end) end)
function fuzzy_stripey:update() function fuzzy_stripey:update()
local fz = self.fuzz
fz.weight = self.weight
fz.interval = self.interval
fz.tries = self.tries
self.y += self.dy self.y += self.dy
if (self.y <= -self.gap) self.y += self.gap if (self.y <= -self.gap) self.y += self.gap
if (self.y >= self.gap) self.y -= self.gap if (self.y >= self.gap) self.y -= self.gap
self.fuzz:update() fz:update()
end end
function fuzzy_stripey:draw() function fuzzy_stripey:draw()
@ -666,11 +670,11 @@ function breather:draw()
end end
end end
function breather:matches(x) function breather:matches(x, alwaysmatched)
if (not x or not self.on) return true if (not self.on) return true
if (x==1) return self:starting_reverse() if (x==1) return not alwaysmatched and self:starting_reverse()
if (x==2) return self:starting_forward() if (x==2) return not alwaysmatched and self:starting_forward()
if (x==3) return self:starting_reverse() or self:starting_forward() if (x==3) return not alwaysmatched and self:starting_reverse() or self:starting_forward()
return true return true
end end
@ -698,7 +702,6 @@ zonk_mode = {
files={}, files={},
lnh = 9, lnh = 9,
--space width --space width
spc_w = 0,
spc_full=6, spc_full=6,
--text mode --text mode
txmd=0x81, txmd=0x81,
@ -736,6 +739,7 @@ mknew(zonk_mode, function(self)
sep=self.br_sep, sep=self.br_sep,
speed=self.br_spd, speed=self.br_spd,
} }
self.alwaysmatched=true
end) end)
function zonk_mode:set(_, field,value) function zonk_mode:set(_, field,value)
@ -746,10 +750,8 @@ function zonk_mode:g(_, fn, ...)
return _ENV[fn](...) return _ENV[fn](...)
end end
function zonk_mode:at(_, x, y) function zonk_mode:at(_, x, y)
--i don't know why i need the
--spc_full offset but i do
self.txt_frame=scootbox.new{ self.txt_frame=scootbox.new{
x=x-self.spc_full, x=x,
from=y-5, from=y-5,
to=y-5-self.exmg, to=y-5-self.exmg,
frames=self.exf, frames=self.exf,
@ -772,6 +774,13 @@ end
function zonk_mode:bpal(_, p) function zonk_mode:bpal(_, p)
self.brth.nextcolors= p == 1 and obvious_breather or bg_breather self.brth.nextcolors= p == 1 and obvious_breather or bg_breather
end end
function zonk_mode:bgdy(_, dy)
self.stripes.dy = dy
end
function zonk_mode:bgwt(_, w)
self.stripes.weight = w
end
function zonk_mode:activate() function zonk_mode:activate()
clear_alt_pal_bits() clear_alt_pal_bits()
pal() pal()
@ -784,6 +793,8 @@ function zonk_mode:next_file()
if #self.files > 0 then if #self.files > 0 then
self.file=split(deli(self.files,1), "\n") self.file=split(deli(self.files,1), "\n")
self.expect_cfg_line=true self.expect_cfg_line=true
self.cy=5
self.cx=0
end end
end end
@ -822,7 +833,7 @@ function zonk_mode:next_item()
return self:next_item() return self:next_item()
end end
-- parse token -- parse token
local token = tostr(del(self.line, 1)) local token = tostr(deli(self.line, 1))
while #token == 0 and #self.line > 0 do while #token == 0 and #self.line > 0 do
-- emit extra spaces -- emit extra spaces
self.cx += self.spc_full self.cx += self.spc_full
@ -835,7 +846,7 @@ function zonk_mode:next_item()
if (token[1]=="!") token,pp=sub(token,2),sfd_txt_pal if (token[1]=="!") token,pp=sub(token,2),sfd_txt_pal
if (token[1]=="#") token,pp=sub(token,2),hlt_txt_pal if (token[1]=="#") token,pp=sub(token,2),hlt_txt_pal
local ret = zonk_txt(token,self.cx,self.cy,pp,self.txmd,self.txf,self.txd*cmult) local ret = zonk_txt(token,self.cx,self.cy,pp,self.txmd,self.txf,self.txd*cmult)
self.cx = ret.eff_w+self.spc_w self.cx = ret.eff_w+self.spc_full
return #token,ret return #token,ret
end end
@ -849,6 +860,7 @@ function fadetbl(col, tbl, frac)
end end
function zonk_mode:update() function zonk_mode:update()
if (not self.brth:matches(self.bwt)) self.alwaysmatched=false
if self.playing_text then if self.playing_text then
self.twt -= 1 self.twt -= 1
if self.twt <= 0 then if self.twt <= 0 then
@ -875,10 +887,11 @@ function zonk_mode:update()
end end
if self.twt <= 0 then if self.twt <= 0 then
if (btnp(1)) self.confirmed=true if (btnp(1)) self.confirmed=true
if not self.nextpage and self.confirmed and self.brth:matches(self.bwt) then if not self.nextpage and self.confirmed and self.brth:matches(self.bwt, self.alwaysmatched) then
self.nextpage = true self.nextpage = true
self.txt_frame.go = true self.txt_frame.go = true
self.fpfrm = self.exf self.fpfrm = self.exf
self.alwaysmatched=true
end end
else else
self.twt -= 1 self.twt -= 1
@ -907,8 +920,8 @@ end
function zonk_mode:draw() function zonk_mode:draw()
cls(0) cls(0)
pal(self.p, 1) pal(self.p, 1)
self.stripes:draw() if (not self.hide_stripes) self.stripes:draw()
self.brth:draw() if (not self.hide_breath) self.brth:draw()
if self.fpfrm then if self.fpfrm then
local ffrac = self.fpfrm/self.exf local ffrac = self.fpfrm/self.exf
fadetbl(12, self.fd12, ffrac) fadetbl(12, self.fd12, ffrac)
@ -949,6 +962,78 @@ function fast_awakener:draw()
print("placeholder", 45, 61, 8) print("placeholder", 45, 61, 8)
end end
count_up=[[bgdy:-0.1 bspd:240 center:3:18
>wITH EVERY COUNT
FROM 1 !UP TO 5,
YOU !WAKE FURTHER.
-----
bgdy:0 center:5:19
>aS YOU !WAKE !UP,
THE WORLD RETURNS.
YOUR MIND IS !NOW
RETURNING TO ITS
USUAL FLOW.
-----
bpal:1 set:bwt:2 center:3:19
!aWAKEN, BECOMING
FULLY ALERT AT THE
>COUNT OF #5...
-----
set:exf:10 set:txf:30 set:txd:45 set:confirmed:1 bgdy:0.1 bspd:225 center:1:1
1
-----
set:confirmed:1 bspd:210 bgdy:0.15 bgwt:10 center:1:1
2
-----
set:confirmed:1 bspd:180 bgdy:0.2 bgwt:12 center:1:1
3
-----
set:confirmed:1 bgdy:0.25 bpal:2 bgwt:14 center:1:1
4
-----
set:confirmed:1 bgdy:0.4 bgwt:16 center:1:1
5
-----
set:hide_breath:1 set:hide_stripes:1 boff set:txf:1 set:txd:0 set:exd:0 set:exf:1 set:bwt:0 center:1:12
wide awake!
]]
function normal_awakener()
return zonk_mode.new{
br_spd=300,
br_cols=bg_breather,
file=[[center:2:15 bon
yOU'VE LEARNED
SO WELL!
-----
center:2:14
yOU'RE SUCH A
!GOOD !TOY!
-----
center:4:19
tAKE A MOMENT TO
JUST !ENJOY HOW
>IT FEELS, TO BE
#VINYL FULL OF #AIR.
-----
center:6:20 bgdy:-0.2
bECAUSE, NEXT, IT'S
>TIME TO #WAKE #UP.
yOU GET TO TAKE YOUR
!HAPPY MOOD AND !VIVID
!MEMORIES OF THIS
EXPERIENCE WITH YOU,
-----
center:4:20 bgdy:-0.15 bspd:270
BUT !ALL THE HYPNOTIC
!SUGGESTIONS FROM
>THIS GAME WILL !FADE
>AS YOU #WAKE #UP.
]],
files={count_up},
}
end
-->8 -->8
-- consent screens -- consent screens
@ -1664,6 +1749,7 @@ end
function create_game() function create_game()
seq = sequencer.new{ seq = sequencer.new{
{f=normal_awakener},
{ {
f=zonk_mode.new, f=zonk_mode.new,
params={{ params={{
@ -1674,6 +1760,7 @@ BE A TUTORIAL HERE.]],
txd=0, txd=0,
txf=1, txf=1,
cmul=0.25, cmul=0.25,
hide_stripes=true,
}}, }},
}, },
{ {
@ -1710,6 +1797,7 @@ set:bwt:0 set:txd:16 set:txf:20 set:exf:60 center:3:19
THIS ALL YOUR LIFE.]], THIS ALL YOUR LIFE.]],
}}, }},
}, },
{f=normal_awakener},
} }
end end