vacation/vacation.p8

1173 lines
52 KiB
Lua

pico-8 cartridge // http://www.pico-8.com
version 41
__lua__
-- vacation (18+)
-- kistaro windrider
--------------------------------
-- copyright (C) 2024 kistaro windrider
--
-- this program is free software; you can redistribute it and/or modify
-- it under the terms of the gnu general public license as published by
-- the free software foundation; either version 2 of the license, or
-- (at your option) any later version.
--
-- this program is distributed in the hope that it will be useful,
-- but without any warranty; without even the implied warranty of
-- merchantability or fitness for a particular purpose. see the
-- gnu general public license for more details.
--------------------------------
-- addtional credits
-- dogica font by roberto mocci
-- https://www.dafont.com/es/dogica.font
--
-- converted by josれた aular
-- https://jaular.itch.io/pico-8-dogica-font
-- tab 0: library
-- tab 1: p8 entry points
-- tabs 2...F: actual code
function usplit(str)
return unpack(split(str))
end
function csv(s)
local ret = split(s, "\n")
for i, v in ipairs(ret) do
ret[i] = type(v) == "string" and split(v) or { v }
end
return ret
end
-- generate standard "overlay"
-- constructor for type tt.
-- if more is defined, generated
-- new calls more(ret) after
-- ret is definitely not nil
-- before calling setmetatable.
-- use to initialize mutables.
--
-- if there was a previous new,
-- it is invoked on the new
-- object *after* more, because
-- this works better with the
-- `more` impls i use.
function mknew(tt, more)
local mt, oldnew={__index=tt},tt.new
tt.new=function(ret)
if (not ret) ret = {}
if (more) more(ret)
if (oldnew) oldnew(ret)
setmetatable(ret, mt)
return ret
end
end
event_list = {is_event_list=true}
mknew(event_list, function(x)
x.next=nil
x.tail=x
end)
function event_list:push_back(x)
self.tail.next = x
self.tail = x
end
function event_list:strip(f)
local p, n = self, self.next
while n do
if f(n) then
p.next = n.next
else
p = n
end
n = n.next
end
self.tail = p
return p
end
function event_list:update()
local p, n = self, self.next
while n do
if n:update() then
p.next = n.next
else
p = n
end
n = n.next
end
self.tail = p
return p
end
function event_list:draw()
local n = self.next
while n do
n:draw()
n = n.next
end
end
-- if t[mname] is a thing,
-- invoke it as a method. else,
-- try each object in t
function outer_or_each_opt(t, mname)
local fun = t[mname]
if fun then
fun(t)
return
end
foreach(t, function(o)
local f = o[mname]
if(f) f(o)
end)
end
function nop() end
-- puke emits a verbose string
-- describing item, indented to
-- the specified depth (0 by
-- default). used for table
-- debugging. table-type keys
-- are not legible here
function puke(item, indent, seen, hidekey)
if (type(item) ~= "table") return tostr(item)
seen = seen or {}
if (seen[item]) return "<<...>>"
seen[item] = true
indent = indent or 0
local pfx = "\n"
for _=1,indent do
pfx ..= " "
end
local xpfx = pfx.." "
if item.is_event_list then
local ret,n = "event_list <",0
item:strip(function(x)
n += 1
ret ..= xpfx..tostr(n)..": "..puke(x, indent+2, seen, "next")
end)
return ret..pfx..">"
end
local ret = "{"
for k, v in pairs(item) do
if (k ~= hidekey) ret ..= xpfx..tostr(k)..": "..puke(v, indent+2, seen)
end
return ret..pfx.."}"
end
-- convenience for debugging
function puketh(item, ...)
printh(puke(item), ...)
end
function pukeboard(item)
puketh(item, "@clip")
end
-------------------------------
-- view
-------------------------------
-- composits drawable items.
-- add items to .views to
-- composit them. x and y are
-- relative reverse camera
-- offsets. drawable items will
-- observe appropriate incoming
-- camera and clip state.
-- clipping respects existing
-- clipping so stacked views
-- intersect.
-------------------------------
view = {
x=0,
y=0,
w=128,
h=128,
}
mknew(view, function(x)
if (not x.views) x.views = {}
end)
function view.of(subviews)
return view.new{views=subviews}
end
function view:update()
outer_or_each_opt(self.views, "update")
end
function view:draw()
local oldcam, oldclip = $0x5f28, $0x5f20
poke2(0x5f28, %0x5f28-self.x)
poke2(0x5f2a, %0x5f2a-self.y)
clip(-%0x5f28, -%0x5f2a, self.w, self.h, true)
outer_or_each_opt(self.views, "draw")
poke4(0x5f20, oldclip)
poke4(0x5f28, oldcam)
end
-- draws opaque rectangles.
-- default bg is equivalent to
-- clip-aware cls.
-- restores prior fill pattern.
bg = {
x=0,y=0,w=128,h=128,fp=0,c=0
}
mknew(bg)
function bg:draw()
local oldfp=fillp(self.fp)
rectfill(self.x,self.y,self.x+self.w,self.y+self.h,self.c)
fillp(oldfp)
end
-->8
-- setup and p8 entry points
function _init()
-- custom font: dogica
poke(0x5600,unpack(split"6,8,9,0,0,1,0,0,0,0,0,0,0,0,0,0,69,16,32,81,85,0,117,116,0,0,0,0,0,84,22,6,2,0,0,0,96,6,38,0,0,7,7,16,112,87,80,16,5,0,1,0,112,7,39,0,0,0,0,32,0,112,116,1,0,0,96,102,96,0,96,96,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,10,10,5,0,0,0,0,0,18,63,18,18,63,18,0,0,14,21,5,14,20,21,14,34,21,21,10,40,84,84,34,6,9,9,6,41,17,46,0,0,2,2,1,0,0,0,0,2,1,1,1,1,1,2,0,1,2,2,2,2,2,1,0,0,4,21,10,21,4,0,0,0,4,4,31,4,4,0,0,0,0,0,0,0,2,2,1,0,0,0,0,15,0,0,0,0,0,0,0,0,0,1,0,8,8,4,4,2,2,1,1,14,17,21,21,21,17,14,0,4,7,4,4,4,4,31,0,14,17,16,8,4,2,31,0,15,16,16,14,16,16,15,0,8,12,10,9,31,8,8,0,31,1,15,16,16,17,14,0,14,17,1,15,17,17,14,0,31,17,16,8,4,2,2,0,14,17,17,14,17,17,14,0,14,17,17,30,16,8,6,0,0,0,1,0,0,1,0,0,0,0,0,2,0,2,2,1,0,4,2,1,2,4,0,0,0,0,63,0,63,0,0,0,0,1,2,4,2,1,0,0,14,17,16,12,2,0,4,0,30,33,45,41,29,65,62,0,0,14,16,30,17,17,30,0,1,1,15,17,17,17,15,0,0,14,17,1,1,1,30,0,16,16,30,17,17,17,30,0,0,14,17,31,1,1,30,0,28,2,2,15,2,2,2,0,0,30,17,17,17,30,16,14,1,1,13,19,17,17,17,0,2,0,3,2,2,2,7,0,0,7,2,2,2,2,2,1,0,17,9,5,7,9,17,0,0,1,1,1,1,1,6,0,0,54,73,73,73,73,73,0,0,12,19,17,17,17,17,0,0,14,17,17,17,17,14,0,0,15,17,17,17,15,1,1,0,30,17,17,17,30,16,16,0,13,3,1,1,1,1,0,0,14,1,14,16,17,14,0,1,1,15,1,1,1,14,0,0,17,17,17,17,25,22,0,0,17,17,17,10,10,4,0,0,32,37,37,37,37,26,0,0,17,10,4,4,10,17,0,0,0,9,9,9,6,4,3,0,15,8,4,2,1,15,0,3,1,1,1,1,1,3,0,1,1,2,2,4,4,8,8,3,2,2,2,2,2,3,0,4,10,17,0,0,0,0,0,0,0,0,0,0,0,0,63,0,1,2,2,0,0,0,0,14,17,17,17,31,17,17,0,15,17,17,15,17,17,15,0,14,17,1,1,1,17,14,0,31,34,34,34,34,34,30,0,31,1,1,15,1,1,31,0,31,1,1,15,1,1,1,0,30,1,1,25,17,17,30,0,17,17,17,31,17,17,17,0,7,2,2,2,2,2,7,0,15,4,4,4,4,4,3,0,17,9,5,7,9,9,17,0,1,1,1,1,1,1,15,0,33,33,51,45,33,33,33,0,17,19,21,25,17,17,17,0,14,17,17,17,17,17,14,0,15,17,17,15,1,1,1,0,14,17,17,17,21,9,22,0,15,17,17,15,9,17,17,0,14,17,1,14,16,17,14,0,31,4,4,4,4,4,4,0,17,17,17,17,17,17,14,0,17,17,17,17,10,10,4,0,65,65,73,73,73,85,34,0,17,17,10,4,10,17,17,0,17,17,17,10,4,4,4,0,31,16,8,4,2,1,31,0,4,10,2,1,1,2,10,4,1,1,1,1,1,1,1,1,2,5,4,8,8,4,5,2,0,0,0,38,25,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,0,0,0,85,42,85,42,85,0,0,0,65,127,93,93,62,0,0,0,62,99,99,119,62,0,0,0,17,68,17,68,17,0,0,0,2,30,14,15,8,0,0,0,14,23,31,31,14,0,0,0,27,31,31,14,4,0,0,0,28,54,119,54,28,0,0,0,14,14,31,14,10,0,0,0,28,62,127,42,58,0,0,0,62,103,99,103,62,0,0,0,127,93,127,65,127,0,0,0,28,4,4,7,7,0,0,0,62,99,107,99,62,0,0,0,4,14,31,14,4,0,0,0,0,0,85,0,0,0,0,0,62,115,99,115,62,0,0,0,8,28,127,62,34,0,0,0,31,14,4,14,31,0,0,0,62,119,99,99,62,0,0,0,0,5,82,32,0,0,0,0,0,17,42,68,0,0,0,0,62,107,119,107,62,0,0,0,127,0,127,0,127,0,0,0,85,85,85,85,85,0"))
-- to use custom fonts, poke(0x5f58, 0x81)
-- disable btnp repeat
-- TODO: set back to 30 frames
-- outside of game mode
poke(0x5f5c, 255)
-- complex fill API mode
poke(0x5f34, 1)
mainview = newtitle()
mainview:on_focus()
end
function _update60()
mainview:update()
end
function _draw()
mainview:draw()
end
-->8
-- text rendering
-- text colors for zonk mode:
-- 8 -- standard
-- 9 -- delayed fade
-- 10 -- currently fading in
txtbox = {
x=0,
y=0,
text="???",
col=8,
mode=0x81,
}
mknew(txtbox)
function txtbox:update() end
function txtbox:draw()
poke(0x5f58, self.mode)
print(self.text, self.x, self.y, self.col)
end
function txtbox:xmax()
return print(self.text, self.x, -9999)
end
spring = {
from = 128,
to = 0,
frames=120,
f = 0,
}
mknew(spring)
function spring:update()
local v = self.v
self.v:update()
if self.f >= self.frames then
v.y=self.to
return true
end
local t, range = self.f/self.frames, self.to - self.from
v.y = self.to-range*(2^(-10*t)*cos(2*t))
self.f += 1
end
function spring:draw()
self.v:draw()
end
scoot = {
from=0,
to=-128,
frames=60,
f=0,
}
mknew(scoot)
function scoot:update()
local v = self.v
self.v:update()
if self.f >= self.frames then
v.y=self.to
return true
end
self.f += 1
if self.f < 0 then
v.y=self.from
return
end
local t, range = self.f/self.frames, self.to - self.from
v.y = self.from + range * t * t * t
end
function scoot:draw()
self.v:draw()
end
scootbox = {}
mknew(scootbox, function(x)
x.v = view.new()
x.s = scoot.new{
from=x.from or scoot.from,
to=x.to or scoot.to,
frames=x.frames or scoot.frames,
v=x.v
}
end)
function scootbox:update()
if self.go then
self.s:update()
else
self.v:update()
end
end
function scootbox:push(drawable)
add(self.v.views, drawable)
end
function scootbox:done()
return self.s.f >= self.s.frames
end
function scootbox:draw()
return self.v:draw()
end
-->8
-- zonk renderer
-->8
-- awakener
-->8
-- consent screens
-->8
-- title screen
title_screen = {
}
mknew(title_screen)
function title_screen:draw()
pal()
cls(12)
print("title screen", 30, 58, 0)
print("press right arrow", 20, 65, 0)
end
function title_screen:on_focus()
self.active = true
end
function title_screen:update()
if (self.sq or not self.active or not btnp(1)) return
self.sq = sequencer.new{
{
activate = function(self, sq)
return arcade_level.new{
maxscore=2,
sq = sq,
}
end,
dir=slide_left,
},
}
self.sq:do_it()
end
-- currently just loading
-- whatever view I want to debug
function newtitle()
return title_screen.new()
end
-->8
-- dolphin sprite renderer
phinstate_nrm = {
--s={4, 36, 4, 9},
s={4},
ws=3,
hs=2,
idle=true,
xo=-12,
yo=-8,
}
phinstate_jump_full = {
s={64},
ws=2,
hs=3,
xo=-4,
yo=-8,
}
phinstate_jump_wane = {
s={69},
ws=3,
hs=3,
xo=-12,
yo=-8,
}
phinstate_crest = {
s={72},
ws=3,
hs=2,
xo=-12,
yo=-8,
}
phinstate_fall_wax = {
s={128},
ws=3,
hs=3,
xo=-12,
yo=-16,
}
phinstate_fall_full = {
s={77},
ws=2,
hs=3,
xo=-4,
yo=-16,
}
phinstate_dive_full = phinstate_fall_full
phinstate_dive_wane = {
s={128},
ws=3,
hs=3,
xo=-12,
yo=-16,
}
phinstate_return = {
s={104},
ws=3,
hs=2,
xo=-12,
yo=-8,
}
phinstate_rise_wax = phinstate_jump_wane
phinstate_rise_full = phinstate_jump_full
phinstate_error = {
s={0},
ws=1,
hs=2,
}
-- coordinates are the notional
-- center point of the dolphin.
-- many states are off-center.
toyphin = {
x=-48,
y=64,
dy=0,
state=phinstate_nrm,
}
mknew(toyphin)
function toyphin:update()
local x, y, dy, splash = self.x, self.y, self.dy, self.splasher
-- entry mode?
if not self.entered then
x += 1
self.entered = x >= 16
elseif self.exiting then
if x > 128 then
self.exited = true
else
x += 1
end
end
-- button handling
if self.entered and not self.exiting then
if y >= 61 and y <= 67 then
if (btn(2)) and dy < 1 then
splash:jump_splash(x)
dy=-3.8
elseif (btn(3)) and dy > -1 then
splash:dive_splash(x)
dy=3.8
end
else
dy += (btn(3) and 0.125 or 0) - (btn(2) and 0.125 or 0)
end
end
if (y > 64) dy -= 0.3
if (y < 64) dy += 0.3
local new_y = y + dy
if new_y <= 64 and y > 64 then
-- surfacing
splash:surfacing_splash(x, -dy, btn(2) and (dy > -3.8))
if btn(2) then
-- maybe boost
if dy > -3.8 then
new_y = 64 + ((dy + y - 64)/dy * -3.8)
dy = -3.8
else
dy = (dy - 7.6) / 3
end
else
-- brake
if dy > -0.75 then
--stabilize
new_y = 64
dy = 0
else
dy /= 2
end
end
elseif new_y >= 64 and y < 64 then
-- landing
splash:landing_splash(x, dy, btn(3) and (dy < 3.8))
if btn(3) then
-- maybe boost
if dy < 3.8 then
new_y = 64 - ((dy - y + 64)/dy * 3.8)
dy = 3.8
else
dy = (7.6 + dy) / 3
end
else
--brake
if dy < 0.75 then
--stabilize
new_y = 64
dy = 0
else
dy /= 2
end
end
end
y=new_y
local wet, st = y > 64, phinstate_error
if dy < -2.15 then
st = wet and phinstate_rise_full or phinstate_jump_full
elseif dy <= -1 and (y < 60 or y > 68) then
st = wet and phinstate_rise_wax or phinstate_jump_wane
elseif dy <= -1 then
st = phinstate_nrm
elseif dy < 1 then
-- handle idle special case later
st = wet and phinstate_return or phinstate_crest
elseif dy <= 2.15 and (y < 60 or y < 68) then
st = wet and phinstate_dive_wane or phinstate_fall_wax
elseif dy <= 2.15 then
st = phinstate_nrm
else
st = wet and phinstate_dive_full or phinstate_fall_full
end
if (y == 64 and dy == 0) st = phinstate_nrm
-- test mode
--if (btn(5)) self.exiting = true
self.x, self.y, self.dy, self.state = x, y, dy, st
end
-- hitbox for current state
function toyphin:box()
local st = self.state
return {self.x + st.xo, self.y + st.yo, st.ws * 8, st.hs * 8}
end
function toyphin:draw()
local st, y = self.state, self.y
if (st.idle) y += wave()
spr(st.s[1+(((t()<<1)&0x0.FFFF*#st.s)&0x7FFF)], self.x + st.xo, y + st.yo, self.state.ws, self.state.hs)
end
-->8 word target
wordtarget = {
x = 129,
y = 60,
str = "GOOD TOY!",
on_hit = nop,
}
mknew(wordtarget, function(x)
poke(0x5f58, 0x81)
x.w = print(x.str or wordtarget.str, 0, -9999)-1
end)
function collides(b1, b2)
if (b1[1] > b2[1] + b2[3]) return false
if (b1[1] + b1[3] < b2[1]) return false
if (b1[2] > b2[2] + b2[4]) return false
return not (b1[2] + b1[4] < b2[2])
end
function wordtarget:update()
if collides({self.x, self.y, self.w, 6}, self.phin:box()) then
self:on_hit()
return true
end
self.x -= 1
return self.x < -self.w
end
function wordtarget:draw()
poke(0x5f58, 0x81)
-- debug: show hitbox
--rect(self.x-1, self.y-1, self.x+self.w+1, self.y + 8, 0x10F1.5a5a)
print(self.str, self.x+1, self.y+1, 0x100b)
print(self.str, self.x, self.y, 0x100a)
end
-->8
-- arcade mode
-- palette use:
-- 0: shallow sea blue (1)
-- 1: black (for sprites)
-- 2: dolphin shading
-- 3: azure water, maybe score display? (140)
-- 4, 5: unassigned, layer-specific
-- 6: dolphin specular highlights
-- 7: dolphin white paint
-- 8, 9: unassigned, layer specific
-- 10: word primary (yellow 10?)
-- 11: word shadow (wood 132?)
-- 12: dolphin eye
-- 13: common sky color
-- 14: dolphin primary color
-- 15: highlight white (all layers)
--
-- dolphin colors are different
-- between zones; correlated.
-- wave, text, and black colors
-- are the same between zones.
-- other colors are for
-- elements that only ever
-- appear in one zone.
--
-- TODO: consider changing sky
-- colors in different stages;
-- document what colors those
-- are (nrm_pal) if so.
game_nrm_pal = {
[0] = 1, 0, 2, 140, 4, 5, 7, 7, 8, 9, 10, 132, 12, 12, 14, 7
}
-- undersea palette local decisions:
-- 4: deeper sea blue (129)
game_uw_pal = {
[0]=1, 0, 130, 140, 129, 5, 141, 13, 8, 9, 10, 132, 131, 12, 141, 7
}
function setup_arcade_pal()
-- per-line color mode
poke(0x5f5f, 0x10)
-- rows 72 and lower: sea
memset(0x5f79,0xff,7)
pal()
pal(game_nrm_pal, 1)
pal(game_uw_pal, 2)
end
-- global wave amplitude clock
-- wave per 2 seconds
-- optional toff: offset. at
-- toff==0 draw directly under
-- the dolphin
function wave(toff)
toff = toff or 0
return 2.5 * sin((t()+toff)>>1)
end
sea = {}
mknew(sea)
function sea:draw()
local w = wave()
rectfill(0, 66+w, 128, 77+w, 0)
poke2(0x5f78, 0xffe0.00ff <<> w)
rectfill(0, 78+w, 128, 89+w, 0x1040.a842)
rectfill(0, 90+w, 128, 97+(w>>1), 0x1004.e169)
rectfill(0, 98+(w>>1), 128, 104+(w>>2), 0x1004.a842)
rectfill(0, 104+(w>>2), 128, 110+(w>>2), 0x1004)
rectfill(0, 111+(w>>2), 128, 118+(w>>3), 0x1041.e169)
rectfill(0, 119+(w>>3), 128, 124+(w>>3), 0x1041.a842)
rectfill(0, 125+(w>>3), 128, 128, 0x1001)
end
arcade_level = {
score=0,
maxscore=999,
wordwait = 90,
-- sq: sequencer to call when done
}
mknew(arcade_level, function(x)
x.phin = toyphin.new{splasher=x}
-- TODO: decent looking sky and sea
x.sky = bg.new{c=13}
x.sea = sea.new()
x.bg = event_list.new()
x.fg = event_list.new()
x.words = event_list.new()
x.t0 = t()
x.wordremain = x.maxscore or arcade_level.maxscore
x.wordtimer = x.wordwait or arcade_level.wordwait
x.v = view.of{
x.sky,
x.sea,
x.waves,
{draw=function()
poke(0x5f58, 0)
local s = tostr(x.score)
print(s,1,2,3)
print(s,2,1,3)
print(s,0,1,3)
print(s,1,0,3)
print(s,1,1,15)
end},
x.bg,
x.phin,
x.fg,
x.words,
}
x.s = scootbox.new()
x.s:push(x.v)
-- TODO: fade in level music
-- Switch to small font
-- (Dogica is too large to ever miss!)
?"\^@56000800⁴⁵⁷\0\0¹\0\0\0\0\0\0\0`w\0g \0aw\0⁶⁶\0\0\0\0\0fw⁷¹\0\0\0`⁷'\0\0\0\0pp\0\0\0¹▮`\0 ■▮\0▮!\0\0⁶q33⁙■⁙3□⁙3▮33■wf\0V\0ヨu◆▶g○w☉vP●「\"s◝◆◝¹◝◝メ◝▒◝◆○▒☉ヲ\0◝◆◝¹◝◝モ◝☉☉☉⁸▒☉☉ユ\0⁷⁷⁷⁷⁷\0\0\0\0⁷⁷⁷\0\0\0\0\0⁷⁵⁷\0\0\0\0\0⁵²⁵\0\0\0\0\0\0\0\0\0\0\0⁵⁵⁵\0\0\0\0⁴⁶⁷⁶⁴\0\0\0¹³⁷³¹\0\0\0⁷¹¹¹\0\0\0\0\0⁴⁴⁴⁷\0\0\0⁵⁷²⁷²\0\0\0\0\0¹\0\0\0\0\0\0\0\0¹²\0\0\0\0\0\0³³\0\0\0⁵⁵\0\0\0\0\0\0²⁵²\0\0\0\0\0\0\0\0\0\0\0\0\0¹¹¹\0¹\0\0\0⁵⁵\0\0\0\0\0\0\n\n\n\0\0\0²⁷³⁶⁷²\0\0⁵⁴²¹⁵\0\0\0²⁵ᵉ⁵ᵉ\0\0\0¹¹\0\0\0\0\0\0²¹¹¹²\0\0\0¹²²²¹\0\0\0⁵²⁷²⁵\0\0\0\0²⁷²\0\0\0\0\0\0\0\0¹¹\0\0\0\0\0\0\0\0\0\0\0\0\0¹\0\0\0⁴⁴²¹¹\0\0\0²⁵⁵⁵²\0\0\0²³²²⁷\0\0\0³⁴²¹⁷\0\0\0³⁴²⁴³\0\0\0⁵⁵⁷⁴⁴\0\0\0⁷¹³⁴³\0\0\0⁶¹³⁵²\0\0\0⁷⁴⁴²²\0\0\0²⁵²⁵²\0\0\0²⁵⁶⁴³\0\0\0\0¹\0¹\0\0\0\0\0\0¹\0¹¹\0\0\0²¹²\0\0\0\0\0³\0³\0\0\0\0\0¹²¹\0\0\0\0³⁴²\0²\0\0\0\t\r¹⁶\0\0\0\0³⁶⁵⁷\0\0\0¹³⁵⁵³\0\0\0\0⁶¹¹⁶\0\0\0⁴⁶⁵⁵⁶\0\0\0\0²⁵³⁶\0\0\0⁴²⁷²²\0\0\0\0⁶⁵⁶⁴³\0\0¹¹³⁵⁵\0\0\0¹\0¹¹¹\0\0\0²\0²²²¹\0\0¹⁵³⁵⁵\0\0\0¹¹¹¹²\0\0\0\0ᶠ‖‖‖\0\0\0\0³⁵⁵⁵\0\0\0\0²⁵⁵²\0\0\0\0³⁵⁵³¹\0\0\0⁶⁵⁵⁶⁴\0\0\0³⁵¹¹\0\0\0\0⁶³⁶³\0\0\0²⁷²²⁶\0\0\0\0\t\t\t\0\0\0\0⁵⁵⁵³\0\0\0\0■■‖\n\0\0\0\0⁵²⁵⁵\0\0\0\0⁵⁵⁵⁶³\0\0\0⁷⁶³⁷\0\0\0³¹¹¹³\0\0\0¹²²²⁴\0\0\0³²²²³\0\0\0²⁵\0\0\0\0\0\0\0\0\0\0\0\0\0²⁴\0\0\0\0\0\0²⁵⁷⁵⁵\0\0\0³⁵³⁵³\0\0\0⁶¹¹¹⁶\0\0\0\t\t\t\0\0\0⁷¹³¹⁷\0\0\0⁷¹³¹¹\0\0\0ᵉ¹\r\t\0\0\0⁵⁵⁷⁵⁵\0\0\0¹¹¹¹¹\0\0\0⁴⁴⁴⁴⁵²\0\0⁵⁵³⁵⁵\0\0\0¹¹¹¹⁷\0\0\0■•‖■■\0\0\0\tᵇᶠ\r\t\0\0\0\t\t\t\0\0\0³⁵³¹¹\0\0\0\t\t\r⁶⁸\0\0³⁵³⁵⁵\0\0\0⁶¹²⁴³\0\0\0⁷²²²²\0\0\0\t\t\t\t\0\0\0\t\t\t⁵³\0\0\0■■‖•■\0\0\0⁵⁵²⁵⁵\0\0\0⁵⁵²²²\0\0\0⁷⁴²¹⁷\0\0\0⁶²¹²⁶\0\0\0¹¹\0¹¹\0\0\0³²⁴²³\0\0\0\0\0\n\0\0\0\0³³\0\0\0\0\0\0○○○○○○\0\0U*U*U*\0\0A○]]>\0\0\0>ccw>\0\0\0■D■D■D\0\0²゛ᵉᶠ⁸\0\0\0ᵉ▶゜゜ᵉ\0\0\0•゜゜ᵉ⁴\0\0\0、6w6、\0\0\0ᵉᵉ゜ᵉ\n\0\0\0、>○*:\0\0\0>gcg>\0\0\0?-?!?\0\0\0、⁴⁴⁷⁷\0\0\0>ckc>\0\0\0⁴ᵉ゜ᵉ⁴\0\0\0\0\0U\0\0\0\0\0>scs>\0\0\0⁸、○>\"\0\0\0゜ᵉ⁴ᵉ゜\0\0\0>wcc>\0\0\0\0⁵R \0\0\0\0\0■*D\0\0\0\0>kwk>\0\0\0\0\0\0\0\0‖‖‖‖‖\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0¹\0¹¹¹\0\0\0⁴ᵉ⁵ᵉ⁴\0\0ᶜ²⁷²ᶠ\0\0\0■ᵉ\nᵉ■\0\0\0⁵⁵²⁷²\0\0\0¹¹\0¹¹\0\0\0⁶³⁵⁶³\0\0\0\0\0\0\0\0\0\0\t\r\t\0\0\0³⁶⁵⁷\0\0\0\0\0\t\0\0\0\0\0\0⁷⁴\0\0\0\0\0\0\0\0\0\0\0\0³⁵³⁵\0\0\0\0\0\0\0\0\0\0\0²⁵²\0\0\0\0\0²⁷²\0\0\0\0³²¹³\0\0\0\0¹³²¹\0\0\0\0²¹\0\0\0\0\0\0\0\0⁵⁵³¹\0\0ᶠᵇᵇ\n\n\0\0\0\0\0¹\0\0\0\0\0\0\0\0\0²³\0\0²³²²\0\0\0\0²⁵²\0\0\0\0\0\0\t\t\0\0\0\0\t⁵*9 \0\0\t。□\t\0\0!⁙\nUr@\0\0\0²\0²¹⁶\0\0²⁴³⁶⁵⁷\0\0²¹³⁶⁵⁷\0\0²⁵³⁶⁵⁷\0\0\n⁵³⁶⁵⁷\0\0\0³⁶⁵⁷\0\0²\0³⁶⁵⁷\0\0\0ᵇ◀\r\0\0\0\0\0ᵉ¹ᵉ⁴\0\0²⁴²⁵³⁶\0\0²¹²⁵³⁶\0\0²⁵²⁵³⁶\0\0\0²⁵³⁶\0\0¹²\0\0²²\0\0²¹\0\0¹¹\0\0²⁵\0\0²²\0\0\0\0\0²²\0\0ᵉ□▶□ᵉ\0\0\0\n\0\t\t\0\0¹²\0²⁵²\0\0⁴²\0²⁵²\0\0²⁵\0²⁵²\0\0\n\0\t\0\0\0\0²⁵²\0\0\0⁵²⁵\0\0\0\0▮ᵉ‖□\r\0\0\0²⁴\0\t\t\0\0⁴²\0\t\t\0\0\t\0\t\t\0\0\t\0\0\t\t\0\0⁴²\0⁵⁵⁶³\0¹⁵ᵇᵇ⁵¹\0\0\t\t\0\0\0²⁴²⁵⁷⁵\0\0²¹²⁵⁷⁵\0\0²⁵²⁵⁷⁵\0\0\n⁵⁶\t\t\0\0\0²⁵⁷⁵\0\0²\0²⁵⁷⁵\0\0゛⁵ᶠ⁵。\0\0\0ᵉ¹¹¹ᵉ⁴\0\0²⁴⁷³¹⁷\0\0²¹⁷³¹⁷\0\0²⁵⁷³¹⁷\0\0\0⁷³¹⁷\0\0¹²\0²²²\0\0²¹\0¹¹¹\0\0²⁵\0²²²\0\0\0\0²²²\0\0²⁵ᵉ\t\t\0\0\n\t\r\t\0\0²⁴⁶\t\t\0\0⁴²⁶\t\t\0\0²⁵⁶\t\t\0\0\n⁵⁶\t\t\0\0\t\0\t\t\0\0²\0\0²\0\0\0\t‖□\r\0\0\0²⁴\t\t\t\0\0⁴²\t\t\t\0\0²⁵⁸\t\t\0\0\t\0\t\t\t\0\0⁴²⁵⁵²²\0\0¹⁷\t\t⁷¹\0\0\0⁵⁵²²\0"
poke(0x5f58,0x81) -- enable custom font
end)
function arcade_level:update()
if self.phin.entered then
if self.wordtimer <= 0 and self.wordremain > 0 then
self:spawn_word()
self.wordtimer = self.wordwait
self.wordremain -= 1
end
self.wordtimer -= 1
end
if self.wordremain <= 0 and self.words.next == nil then
self.phin.exiting = true
end
if self.phin.x > 90 and not self.leaving then
self.sq:do_it()
self.leaving = true
end
-- TODO: timers, word loop,
-- level state tracking and
-- progression, etc.
self.s:update()
end
function arcade_level:spawn_word()
-- TODO: basically everything.
-- word lists
-- pattern generator
self.words:push_back(wordtarget.new{
y=32+rnd(64), -- real game uses pattern generator!
phin=self.phin,
on_hit = function(word)
self:word_hit(word)
end,
})
end
function arcade_level:word_hit(word)
self.score += 1
-- TODO: sfx
-- TODO: sparkle
end
function arcade_level:draw()
setup_arcade_pal()
self.s:draw()
end
function arcade_level:draw_splash(x, force)
if (force < 0.5) return
local n = (force + rnd(force)) & 0x7FF
for i=0,n do
local d = droplet.new{x=x, force=force, y=72+wave(), f=i/n-0.5}
if rnd() < 0.5 then
self.bg:push_back(d)
else
self.fg:push_back(d)
end
end
end
function arcade_level:dive_splash(x)
-- TODO: sfx, vfx for dive input
self:draw_splash(x, 3.8)
end
function arcade_level:jump_splash(x)
-- TODO: sfx, vfx for jump input
self:draw_splash(x, 3.8)
end
function arcade_level:surfacing_splash(x, force, harder)
-- TODO: sfx, vfx for surfacing from a dive
self:draw_splash(x, force)
end
function arcade_level:landing_splash(x, force, harder)
-- TODO: sfx, vfx for landing from a jump
self:draw_splash(x, force)
end
splashcols = {0x1003, 0x103d.a5a5}
droplet = {}
mknew(droplet, function(d)
d.dx = (d.f * d.force >> 2) - 0.75
d.x += 16 * d.f
d.dy = -rnd(d.force*0.66)
d.r = 1 + rnd(0.75 + (d.force >> 4))
d.c = rnd(splashcols)
end)
function droplet:update()
self.x += self.dx
self.y += self.dy
self.dy += 0.3
return self.y >72 + wave()
end
function droplet:draw()
circfill(self.x, self.y, self.r, self.c)
local r2 = self.r >> 1
pset(self.x+r2, self.y-r2, 0x100F)
end
-->8
-- game sequencer
slider = {}
mknew(slider, function(x)
x.vf = view.of{x.from}
x.vt = view.of{x.to}
x.vt.x = x.dir.x
x.vt.y = x.dir.y
end)
function slider:update()
local vf, vt = self.vf, self.vt
vf:update()
vt:update()
if vt.x == 0 and vt.y == 0 then
mainview = vt
if (vt.on_focus) vt:on_focus()
if (self.sq) self.sq:progress()
return true
end
local dx, dy = self.dir.dx, self.dir.dy
vt.x += dx
vt.y += dy
vf.x += dx
vf.y += dy
end
function slider:draw()
self.vf:draw()
self.vt:draw()
end
slide_left = {
x = 128, y = 0, dx = -4, dy = 0
}
slide_right = {
x = -128, y = 0, dx = 4, dy = 0
}
sequencer = {
next_idx = 1,
score = 0,
maxscore = 0,
}
mknew(sequencer)
function sequencer:do_it()
local n = self[self.next_idx]
if n then
if (n.maxscore) self.maxscore += n.maxscore
if (mainview.score) self.score += mainview.score
mainview = slider.new{
from = mainview,
to = n:activate(self),
dir = n.dir,
sq = self,
}
return
end
mainview = slider.new{
from = mainview,
to = newtitle(),
dir = slide_right,
}
end
function sequencer:progress()
self.next_idx += 1
end
__gfx__
00888800777777777777777777777777000000000000000000000000777777777777777700000000000000000000000000000000000000000000000000000000
0888e780700000000000000000000007000000000000000000000000700000000000000700000000000000000000000000000000000000000000000000000000
88888878700000000000000000000007000000000000000000000000700002222220000700000000000000000000000000000000000000000000000000000000
88a8a8e8700000000000000000000007000000000000000000000000700002eeee2000070000000000ee00000000000000000000000000000000000000000000
888a888870000000000000000000000700000000022260000000000070000222e22000070000000000e7e00000000000000000000eee70000000000000000000
88a8a888700000000000000000000007000000000022260000000000700002eeee20000700000000002e7e00000000000000000000eee7000000000000000000
08888880700000000000000000000007000000000002222600000000700002222220000700000000000ee7ee0000000000000000000eeee70000000000000000
008888007000000000000000000000070220000000266222662000007000022e2200000700000000e7eee7e77ee000000ee0000000ee7eee77e0000000000000
00000000700000000000000000000007226200002662222222222000700002e2e22000070e00000eee7eeeeeeeeee000ee7e0000e77eeeeeeeeee00000000000
00000000702222022222222222222207022626622222222227772620700002eeee200007e77e0e7eeeee77eee777e7e00e77eeeeeeeeeeeee777e7e000000000
00000000702ee222e22e22ee22e2e2070e2622222222222227c122627000022222200007eee7eee7e222eeeee7c1ee7e02e7ee77eeeeeeeee7c1ee7e00000000
00000000702e2e2e2e2e22e2e2e2e207222222eee222222222eee262700002222e20000702eeeee2222222eeee222e7eeeeeee222eeeeeeeee222e7e00000000
00000000702e2e2e2e2e22ee22eee207222eeeeeeeeee2222eeeeee0700002eeee2000072e7ee20000022eeee2222220eee2222222222eeee222222000000000
00000000702eee22e22ee2e222e2e2072eee0000eeee22262eeee0007000022222200007eeee20000000ee7e22222000e22200002222ee7e2222200000000000
00000000702222222222222202222207ee00000000022262000000007000022ee2200007ee220000000eeee70000000022000000000eeee70000000000000000
00000000700000000000000000000007000000000022220000000000700002e22e200007020000000eee220000000000000000000eee22000000000000000000
000000007000000000000000000000070000000000000000000000007000022ee220000700000000000000000000000000000000000000000000000000000000
00000000700000000000000000000007000000000000000000000000700000222220000700000000000000000000000000000000000000000000000000000000
000000007000000000000000000000070000000000000000000000007000022eee20000700000000000000000000000000000000000000000000000000000000
000000007000000000000000000000070000000000ee000000000000700002e22e20000700000000000000000000000000000000000000000000000000000000
000000007000000000000000000000070000000000e7e00000000000700002eeee200007000000000222e0000000000000000000022270000000000000000000
0000000070000000000000000000000700e00000002e7e000000000070000222222000070000000000222e000000000000000000002227000000000000000000
000000007000000000000000000000070eee0000000ee7ee000000007000000000000007000000000002222e0000000000000000000222270000000000000000
000000007777777777777777777777770e7e0000002ee7e77ee000007777777777777777022000000022e222ee20000002200000002272227720000000000000
0000000000000000000000000000000002e7ee0002ee7eeeeeeee000000000000000000022e200002ee222222222200022720000277222222222200000000000
00000000000000000000000000000000eeeee7eeee777eeee777e7e0000000000000000002ee22222222222227772e2002772222222222222777272000000000
00000000000000000000000000000000eee22e77eeeeeeeee7c1ee7e0000000000000000022e22ee2222222227c122e20e2722772222222227c1227200000000
00000000000000000000000000000000220022222eeeeeeeee222e7e00000000000000002222227772222222227772e2222222eee222222222eee27200000000
000000000000000000000000000000000000002222222eeee22222200000000000000000222777777777722227777770222eeeeeeeeee2222eeeeee000000000
00000000000000000000000000000000000000002222ee7e22222000000000000000000027770000777722e2777770002eee0000eeee2272eeeee00000000000
0000000000000000000000000000000000000000000eeee7000000000000000000000000770000000002222e00000000ee000000000222270000000000000000
00000000000000000000000000000000000000000eee2200000000000000000000000000000000000222770000000000000000000222ee000000000000000000
00000000000066000000000000000000000002200000000000000000000002200000000000000000000000000000000000000000000000000000000000000000
0000000000022260000000000000000000222662000000000000000000222662000000000000000000000000000070220000000000220e220000000000000000
00000000002222e000000000000000006227222e00000000000000002227222e0000000000000000000000000222026200000000022262220000000000000000
0000000002712ee00000000000060026227c1eee0000000000006622227c1eee0000000000220000000000000e22e262000000000e2226220000000000000000
00000000627ceee00000000000222222227ceee000000000006622266272eee000000000002620000000000000ee26220000000000ee22260000000000000000
000000022277eee000000000022226222222eee000000000022222622222eee0000000000022620000000000000ee22600000000000ee2220000000000000000
000000222222ee0000000000000062222222ee0000000000000022222222ee000000000000022622000000000000e226000000000000e2220000000000000000
000066226622ee000000000000006222222220000000000000002222222220000000000026222626622000000000eee2200002000000ee222000000000000000
0006222622226e0000000000000622222226000000000000000222222226000002000002622222222222200000000ee22200020000000ee26200000000000000
00022222222226000000000000022222e22600000000000000022222e226000026620222222222222777262000000ee22266022000000ee22620002000000000
0022002222222200000000000062222ee000000000000000002222eee22e0000222622222eee222227c1226200000ee22226226000000ee22222022000000000
0000002226ee2600000000000662eeee000000000000000002222eee022e00000e22222eeeeeee2222eee26200000ee22222226000020ee22226262000000000
0000002226ee2260000000222222eee000000000000000662222ee0002e00000e2622e00000ee2222eeeeee2000022ee22222200000266ee2222622000000000
000000222ee0022000000226622ee0000000000000000222622ee000000000002222e00000002262eeeeee000000222222222600000222226222260000000000
00000022eee0022000000222222e00000000000000000222222e00000000000022ee000000022226000000000000222222222600000022222622220000000000
0000022eee0000200000000e22e00000000000000000000e22e00000000000000e00000002222200000000000000006622222260000000222222220000000000
0000022ee00000000000000222e00000000000000000000226e000000000000000000000000000000000000000000002222772200000000ee227720000000000
0000022e00000000000000002ee0000000000000000000002ee000000000000000000000000000000000000000000000eeec720000000000eeec720000000000
0006622e00000000000000000ee0000000000000000000000ee000000000000000000000000000000000000000000000eeee1200000000000ee1720000000000
0022226e00000000000000000000000000000000000000000000000000000000000000000022000000000000000000000eee2600000000000ee2220000000000
02222226000000000000000000000000000000000000000000000000000000000000000000262000000000000000000000ee26000000000000ee220000000000
022e022e0000000000000000000000000000000000000000000000000000000000200000002262000000000000000000000e620000000000000e200000000000
0200022e000000000000000000000000000000000000000000000000000000000222000000022622000000000000000000002200000000000000000000000000
00000020000000000000000000000000000000000000000000000000000000000262000000222626622000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000e26220002226222222220000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000002222262222666222277726200000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000222ee2662222222227c122620000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000ee00eeeee222222222eee2620000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000eeeeeee2222eeeeee00000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000eeee2262eeeee0000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000022226000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000222ee00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000026000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000022600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000002e22600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000022222200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000ee6622220000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000eeee22226000026000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000ee622620026000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000ee22222222600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000ee2222222200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000ee222266200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000ee222622200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000ee22222660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000222662222220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000e22222227722000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000eee22222c72000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000002eee122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000eeee26200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000eee22600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000ee2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__label__
cssscccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
s777sccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
s7s7sccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
s7s7sccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
s7s7sccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
s777sccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cssscccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
2ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
222ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
77272ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c0227211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
eee27211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
eeeee111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
ttt11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1
h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111
1h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h11
11h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h1
h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1
h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111
1h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h11
11h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h1
h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1
h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111
1h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h11
11h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h1
111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h
hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1
h11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11h
1hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh1
111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h
hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1
h11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11h
1hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh11hh1
111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h111h
1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh
h1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hh
hh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1h
1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h1h
1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh
h1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hhh1hh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
0hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh0
h00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00h
hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0
000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h
0hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh0
h00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00hh00h
hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0hhh0
000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h
0h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h00
00h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h0
h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0h0
h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000
0h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h00
00h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h000h0
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000