diff --git a/vacation.p8 b/vacation.p8 index f095baf..07bb499 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -605,7 +605,7 @@ function cminskycirc(r,c) end 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 = { colors = obvious_breather, sep = 8, @@ -619,9 +619,18 @@ function breather:update() local f = self.f + 1 if (not self.on) f = 0 if (f >= self.speed) f = -self.speed - if f == 0 and self.nextspeed then - self.speed = self.nextspeed - self.nextspeed = nil + if f == 0 or f == -self.speed then + if self.nextspeed then + self.speed = self.nextspeed + self.nextspeed = nil + 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 end @@ -663,16 +672,16 @@ function breather:starting_reverse() end function breather:starting_forward() - return self.f < self.sep * #self.colors + return self.f > 0 and self.f < self.sep * #self.colors end def_z_pal = { [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_15_fade = split"0,0,0,0,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_shd_fade = split"0,0,0,0,0,128,130,141,2" +def_14_fade = split"0,0,0,0,0,128,129,133,141,13,6,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,128,129,133,141,140,140,13,12" +def_shd_fade = split"0,0,0,128,130,141,2" -- frames per character to wait -- during zonk text display. @@ -680,7 +689,7 @@ fchr=2 zonk_mode = { files={}, - lnh = 8, + lnh = 9, --space width spc_w = 2, --text mode @@ -691,6 +700,8 @@ zonk_mode = { txf=20, --exit frames exf=60, + --exit magnitude + exmg=16, --character wait multiplier cmul=1, p=def_z_pal, @@ -712,6 +723,7 @@ mknew(zonk_mode, function(self) end) function zonk_mode:set(_, field,value) + pukeboard{field=field, value=value} self[field]=value end function zonk_mode:g(_, fn, ...) @@ -721,10 +733,23 @@ function zonk_mode:at(_, x, y) self.txt_frame=scootbox.new{ x=x, from=y, + to=y-self.exmg, frames=self.exf, } 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() clear_alt_pal_bits() pal() @@ -747,10 +772,13 @@ function zonk_mode:next_item() if (not self.file or #self.file == 0) return if self.expect_cfg_line then self.expect_cfg_line = false - local cfg_line = split(deli(self.file, 1), " ") - for i,cmd in ipairs(cfg_line) do - local frags = split(cmd,":") - self[frags[1]](self, unpack(frags)) + local cfg_line = deli(self.file, 1) + for i,cmd in ipairs(split(cfg_line, " ")) do + if #cmd > 0 then + local frags = split(cmd,":") + assert(type(self[frags[1]])=="function", tostr(i).." - "..cfg_line) + self[frags[1]](self, unpack(frags)) + end end return self:next_item() end @@ -771,7 +799,12 @@ function zonk_mode:next_item() return self:next_item() end -- 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 if (token[1]=="$") token,cmult=sub(token,2),2 if (token[1]=="^") token,cmult=sub(token,2),0.5 @@ -831,12 +864,14 @@ function zonk_mode:update() if self.fpfrm > 0 then self.fpfrm -= 1 elseif self:empty() then + self.txt_frame=blank self.d = ditherer.new{di=0.5} else self.nextpage = false self.confirmed=false self.txt_frame=blank self.playing_text=true + self.fpfrm=nil end end self.stripes:update() @@ -1509,14 +1544,14 @@ end function start_game() seq = sequencer.new{ --- { --- f = arcade_level.new, --- params = {{ --- max_score=2, --- }} --- }, { - f = zonk_mode.new, + f = arcade_level.new, + params = {{ + max_score=5, + }} + }, + { + f = zonk_mode.new, params={{ file=[[at:15:15 ZONK TEXT TEST @@ -1524,6 +1559,17 @@ 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. ]], }}, },