fix animations. ZONKS WORK NOW

well, mostly. but wow
This commit is contained in:
Kistaro Windrider 2024-02-10 22:19:09 -08:00
parent f37476f148
commit 3022d3cb3d
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -605,7 +605,7 @@ function cminskycirc(r,c)
end end
obvious_breather=split"2,3,4,3,2" obvious_breather=split"2,3,4,3,2"
bg_breather=split"1,2,4,2,1" bg_breather=split"1,2,3,2,1"
breather = { breather = {
colors = obvious_breather, colors = obvious_breather,
sep = 8, sep = 8,
@ -619,10 +619,19 @@ function breather:update()
local f = self.f + 1 local f = self.f + 1
if (not self.on) f = 0 if (not self.on) f = 0
if (f >= self.speed) f = -self.speed if (f >= self.speed) f = -self.speed
if f == 0 and self.nextspeed then if f == 0 or f == -self.speed then
if self.nextspeed then
self.speed = self.nextspeed self.speed = self.nextspeed
self.nextspeed = nil self.nextspeed = nil
end end
if self.off_soon then
self.on = false
f=0
end
if self.nextcolors then
self.colors=self.nextcolors
end
end
self.f = f self.f = f
end end
@ -663,16 +672,16 @@ function breather:starting_reverse()
end end
function breather:starting_forward() function breather:starting_forward()
return self.f < self.sep * #self.colors return self.f > 0 and self.f < self.sep * #self.colors
end end
def_z_pal = { def_z_pal = {
[0]=0,129,1,2,4,5,6,7,1,5,6,140,2,13,7,7 [0]=0,129,1,2,4,5,6,7,1,5,6,140,2,13,7,7
} }
def_14_fade = split"0,0,0,0,0,0,0,0,0,128,129,133,141,13,6,15,7" def_14_fade = split"0,0,0,0,0,128,129,133,141,13,6,15,7"
def_15_fade = split"0,0,0,0,0,0,128,129,133,141,13,13,6,6,15,15,7" def_15_fade = split"0,0,128,129,133,141,13,13,6,6,15,15,7"
def_13_fade = split"0,0,0,0,0,0,0,0,0,128,129,133,141,140,140,13,12" def_13_fade = split"0,0,0,0,0,128,129,133,141,140,140,13,12"
def_shd_fade = split"0,0,0,0,0,128,130,141,2" def_shd_fade = split"0,0,0,128,130,141,2"
-- frames per character to wait -- frames per character to wait
-- during zonk text display. -- during zonk text display.
@ -680,7 +689,7 @@ fchr=2
zonk_mode = { zonk_mode = {
files={}, files={},
lnh = 8, lnh = 9,
--space width --space width
spc_w = 2, spc_w = 2,
--text mode --text mode
@ -691,6 +700,8 @@ zonk_mode = {
txf=20, txf=20,
--exit frames --exit frames
exf=60, exf=60,
--exit magnitude
exmg=16,
--character wait multiplier --character wait multiplier
cmul=1, cmul=1,
p=def_z_pal, p=def_z_pal,
@ -712,6 +723,7 @@ mknew(zonk_mode, function(self)
end) end)
function zonk_mode:set(_, field,value) function zonk_mode:set(_, field,value)
pukeboard{field=field, value=value}
self[field]=value self[field]=value
end end
function zonk_mode:g(_, fn, ...) function zonk_mode:g(_, fn, ...)
@ -721,10 +733,23 @@ function zonk_mode:at(_, x, y)
self.txt_frame=scootbox.new{ self.txt_frame=scootbox.new{
x=x, x=x,
from=y, from=y,
to=y-self.exmg,
frames=self.exf, frames=self.exf,
} }
end end
function zonk_mode:bon()
self.brth.on=true
self.brth.off_soon=false
end
function zonk_mode:boff()
self.brth.off_soon=true
end
function zonk_mode:bspd(_, spd)
self.brth.nextspeed=spd
end
function zonk_mode:bpal(_, p)
self.brth.nextcolors= p == 1 and obvious_breather or bg_breather
end
function zonk_mode:activate() function zonk_mode:activate()
clear_alt_pal_bits() clear_alt_pal_bits()
pal() pal()
@ -747,11 +772,14 @@ function zonk_mode:next_item()
if (not self.file or #self.file == 0) return if (not self.file or #self.file == 0) return
if self.expect_cfg_line then if self.expect_cfg_line then
self.expect_cfg_line = false self.expect_cfg_line = false
local cfg_line = split(deli(self.file, 1), " ") local cfg_line = deli(self.file, 1)
for i,cmd in ipairs(cfg_line) do for i,cmd in ipairs(split(cfg_line, " ")) do
if #cmd > 0 then
local frags = split(cmd,":") local frags = split(cmd,":")
assert(type(self[frags[1]])=="function", tostr(i).." - "..cfg_line)
self[frags[1]](self, unpack(frags)) self[frags[1]](self, unpack(frags))
end end
end
return self:next_item() return self:next_item()
end end
local line = deli(self.file, 1) local line = deli(self.file, 1)
@ -771,7 +799,12 @@ function zonk_mode:next_item()
return self:next_item() return self:next_item()
end end
-- parse token -- parse token
local token = tostr(deli(self.line, 1)) local token = tostr(del(self.line, 1))
while #token == 0 and #self.line > 0 do
-- emit extra spaces
self.cx += 1 + self.spc_w
token = tostr(deli(self.line, 1))
end
local pp,cmult=nrm_txt_pal,1 local pp,cmult=nrm_txt_pal,1
if (token[1]=="$") token,cmult=sub(token,2),2 if (token[1]=="$") token,cmult=sub(token,2),2
if (token[1]=="^") token,cmult=sub(token,2),0.5 if (token[1]=="^") token,cmult=sub(token,2),0.5
@ -831,12 +864,14 @@ function zonk_mode:update()
if self.fpfrm > 0 then if self.fpfrm > 0 then
self.fpfrm -= 1 self.fpfrm -= 1
elseif self:empty() then elseif self:empty() then
self.txt_frame=blank
self.d = ditherer.new{di=0.5} self.d = ditherer.new{di=0.5}
else else
self.nextpage = false self.nextpage = false
self.confirmed=false self.confirmed=false
self.txt_frame=blank self.txt_frame=blank
self.playing_text=true self.playing_text=true
self.fpfrm=nil
end end
end end
self.stripes:update() self.stripes:update()
@ -1509,12 +1544,12 @@ end
function start_game() function start_game()
seq = sequencer.new{ seq = sequencer.new{
-- { {
-- f = arcade_level.new, f = arcade_level.new,
-- params = {{ params = {{
-- max_score=2, max_score=5,
-- }} }}
-- }, },
{ {
f = zonk_mode.new, f = zonk_mode.new,
params={{ params={{
@ -1524,6 +1559,17 @@ ZONK TEXT TEST
$ZONK $TEXT $TEST $ZONK $TEXT $TEST
!ZONK !TEXT !TEST !ZONK !TEXT !TEST
^ZONK ^TEXT ^TEST ^ZONK ^TEXT ^TEST
-----
at:30:60 bon bpal:1 set:confirmed:true set:bwt:1 set:txf:2 set:txd:0 set:exd:0 set:exf:10
bREATHE IN...
-----
at:28:60 set:confirmed:true set:bwt:2 bpal:2
bREATHE OUT...
-----
set:bwt:0 set:txd:16 set:txf:20 set:exf:60 at:1:55
gREAT! iT'S LIKE YOU'VE
BEEN DOING THIS YOUR
ENTIRE LIFE.
]], ]],
}}, }},
}, },