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
This commit is contained in:
Kistaro Windrider 2024-02-11 18:27:53 -08:00
parent aead4ad536
commit dca00e4fb6
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

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,
@ -791,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
@ -829,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
@ -842,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
@ -856,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
@ -882,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
@ -976,19 +982,19 @@ FULLY ALERT AT THE
set:exf:10 set:txf:30 set:txd:45 set:confirmed:1 bgdy:0.1 bspd:225 center:1:1 set:exf:10 set:txf:30 set:txd:45 set:confirmed:1 bgdy:0.1 bspd:225 center:1:1
1 1
----- -----
set:confirmed:1 bspd:210 bgdy:0.15 center:1:1 set:confirmed:1 bspd:210 bgdy:0.15 bgwt:10 center:1:1
2 2
----- -----
set:confirmed:1 bspd:180 bgdy:0.2 center:1:1 set:confirmed:1 bspd:180 bgdy:0.2 bgwt:12 center:1:1
3 3
----- -----
set:confirmed:1 bgdy:0.25 bpal:2 center:1:1 set:confirmed:1 bgdy:0.25 bpal:2 bgwt:14 center:1:1
4 4
----- -----
set:confirmed:1 bgdy:0.4 center:1:1 set:confirmed:1 bgdy:0.4 bgwt:16 center:1:1
5 5
----- -----
set:hide_breath:1 set:hide_stripes:1 boff set:txf:1 set:txd:0 set:exd:0 set:exf:1 set:lnh:6 set:spc_w:4 set:txmd:128 set:bwt:0 center:1:12 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! wide awake!
]] ]]