12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
--advanced micro platformer
--@matthughson
--if you make a game with this
--starter kit, please consider
--linking back to the bbs post
--for this cart, so that others
--can learn from it too!
--enjoy!
--@matthughson
-- 1-1 features remaing:
--
-- [!]lives/game over/press start
-- [!]transition to next level
-- [!]flag pole
-- [!]items in blocks
-- [!]mushroom
-- [!]flower
-- [!]star
-- [!]coin blocks
-- [!]default coin
-- [!]dont smash bricks that contain stuff.
-- [!]1up
-- [!]flower power
-- [!]star
-- [!]pipe travel
-- [!]turtle enemy
-- [!]coins
-- checkpoints
-- [!]hidden blocks
-- [?]points
-- [!]palette swap level tiles
-- [!]bounce mushrooms
--
-- offscreen markers for pits
-- offscreen markers for items
-- jump height tuning
-- [!]prevent movement off edge of map
-- [!]prevent walking backwards too far
-- 1-2 features remaining:
--
-- [!] pipes
-- level end
-- warp zone (maybe later?)
-- [!]turtle should collide at shell level.
-- shell should kill other shells
-- [!]turtle should turn when walking into other shells.
-- elevator
-- [!]red turtle
-- [!]8x8 collision (landing at feet) for all enemies.
-- [!] remember to remove extra logic for stomping bottom half
--[[
possible optimizations:
* store level data in map
* [!]convert player to m_obj
--]]
--log
--printh("\n\n-------\n-start-\n-------")
--redefine
--------------------------------
-- { tile, flipx, flipy }
local map_data = { }
_mget=mget
function mget(x,y)
x=flr(x)
y=flr(y)
if map_data[x] and map_data[x][y] then
return map_data[x][y].tile
end
return 0
end
_mset=mset
function mset(x,y,t)
if not map_data[x] then
map_data[x] = {}
end
if not map_data[x][y] then
map_data[x][y] = {}
end
--printh("mset: " .. x .. "," .. y .. ", " .. t)
map_data[x][y].tile = t
--_mset(x,y,t)
end
_map=map
function map( celx, cely, sx, sy, celw, celh, layer )
--local cam_x,cam_y = cam:cam_pos()
local cam_x=peek(0x5f29)
cam_x=bor(shl(cam_x,8),peek(0x5f28))
local cam_y=peek(0x5f2b)
cam_y=bor(shl(cam_y,8),peek(0x5f2a))
--printh("camx/y:" .. cam_x .. "," .. cam_y)
--printh(#map_data[1])
local start_x=flr(cam_x/8)
local start_y=flr(cam_y/8)
local end_x=start_x+16
local end_y=flr(cam_y/8)+16
--30% below
--local cell=map_data[26][26]
for i=start_x,end_x do
local ct=map_data[celx+i]
if ct then
for j=start_y,end_y do
--30% below
local cell=ct[cely+j]
if cell then
if cell.tile!=0 then
local dx=sx+(i*8)
local dy=sy+(j*8)
local pop=false
--pal==3%
if fget(cell.tile,7) then
set_coin_pal()
pop=true
elseif cell.bgpal!=nil then
push_pal(pals[cell.bgpal])
pop=true
end
spr(cell.tile,dx,dy,1,1,cell.flipx,cell.flipy) --13%
if(pop)pop_pal()
end
end
end
end
end
end
--config
--------------------------------
--level pals
pals=
{
{1,0,4,1,15,13}, --underground
--{4,3,15,12,},
{7,11,12,3}, --bush
}
mus={0,19,28}--overworld,under,castle
core_lvls={1,3}
--begin lvls
lvls={
{
w=446,
h=30,
cls=12,
mus=1,
bg="ff00d2000101010201030e000101020201031b000101010201030e000101020201031b000101010201030e000101020201031b000101010201030e000101020201030e0001040c0001010102010311000101010201030800010501060107050001010302010304000105020601071000010101020103080001050106010705000101030201030400010502060107100001010102010308000105010601070500010103020103040001050206010710000101010201030800010501060107050001010302010304000105020601070e0001080100010101020103080001050106010705000101030208000105010601071000010503060107180001050106010710000105030601071800010501060107100001050306010718000105010601071000010503060107160001080100010501060107100001050306160001093900080a0300030a01090e0001090b00030a0400010a0209010a3800020b08000108d300030b08000108d200040b08000108d100050b080001081a000109010002090a0001090300010a0109010a0109010a1500010c010d0900010c010d1200010a0109010a0e00010a0500020a0400010902000109020001090500010a0a00020a0600010b0200010b0a00020b0200010b0c00020a0109010a0c00060b080001081a00010e2300010c010d0600010f01100200010e0600010f01102700010e2500020b0200020b0400010e0300030b0200020b1a00070b0400010e030001081900011101120113010a0c00010e0a00010c010d0800010f01100600010f011001000111011201130500010f01100600010e1f000111011201130d00010e1500030b0200030b02000111011201130100040b0200030b0300010e0100010c010d0e00010c010d0100080b0300011101120113020001080a00010e0d0001110112011401150113060001010302010301110112011304000101010201030200010f01100800010f011001000101020201030100010f0110011101120114011501130400010f011001010302010301110112011304000101010201030f00010102020103030001110112011401150113060001010302010301110112011304000101010201030c00040b0202040b0111011201140115050b0200040b0103011101120113010f011002000101010201030900010f0110090b0200011101120114011501130100010b090001110112011304000101010201030500451602000f16030040160200891602000f160300401602004416",
lookup="000000000000007b6c6d6b6b00007c0000007575008b00008c8d00007d000000767676766768777863636464696a797a818291928384939400008787a1a2a1a2a3a4a3a4008686a3a385a3a38600a386a3a3a3a385a3a3a361627172",
bgflip="98c00598c00698c00798c00898c00998c00a98c00b98c00c98c00d98c00e98c00f98c01098c01198c01298c01398c0148050158650158c501592501598501598c0158060168660168c601692601698601698c0168070178230178670178830178c70178e301792701794301798701798c0179a30178080188240188680188840188c80188e40189440189880189a40188090198250198690198850198c90198e50199450199890199a5019",
objs="18b006650a00080c0a40080c0da00a9400a00f2f08001095004012940060129500a0129702a0129409c012940bc012990ca012970100172d0d60172d02c0180c0500180c0660180c0690180c0c20180c0c50180c0e40180c0e70180c0f80180c0fb0180c1000180c1030180c15c0180c15f0180c00e01ab0",
pipes={
{116,18,2,4,0,0},
},
bgpal="0171882202f18422053186220771882208f184220b3186220d7188220ef184221141842214f184221af1842213e19112",
},
{
w=34,
h=30,
pal=1,
mus=2,
bg="01000301070004010102010301000301070004010102010301000301070004010102010301000e010102010301000e010102010301000401050405010102010301000e010102010301000301070404010102010301000e010102010301000301070404010102010301000301070504010102010301000301070002010106010701020103010003010700020101080109010201030d0a01080109010201030d0a0108010901020103",
lookup="6464646400000000a4a3a4a3a2a1a2a1999aa9aa636364648182919283849394a1a2a1a2a3a4a3a461627172",
bgflip="81e00081f00082000082100081e00181f00182000182100181e00281f00282000282100281e00381f00382000382100381e00481f00482000482100481e00581f00582000582100581e00681f00682000682100681e00781f00782000782100781e00881f00882000882100881e00981f00982000982100981e00a81f00a82000a82100a81e00b81f00b82000b82100b81e00c81f00c82000c82100c81e00d81f00d82000d82100d81e00e81f00e82000e82100e81e00f81f00f82000f82100f81e01081f01082001082101081e01181f01182001182101181e01281f01282001282101281e01381f01382001382101381e01481f01482001482101481e01581f01582001582101581e01681f01682001682101681e01781f01782001782101781e01881f01882001882101881e01981f01982001982101981e01a81f01a82001a82101a81e01b81f01b82001b82101b81e01c81f01c82001c82101c81e01d81f01d82001d82101d",
objs="",
pipes={
{28,22,1,328,22,2},
},
},
{
w=384,
h=30,
pal=1,
mus=2,
bg="ff00810001010500840117000701010201031101030003013500020102000601020004010600040158000102010307010d0003013500020102000601020004010600040158000102010307010d00030128000404070002010800020103000101040002010a0006044e000102010307010d000301330002010800020103000101040002015e000102010307010d000301260001010100040101000101050002010800020103000101040002010a0006014e000102010307010d0003011c00010109000101010401010200010101040101050002010400040402010300010101040101020002010a000601370006010f00010501060102010307010d0003010900050708000108010001080d0003010200030105000401020006010300030102000201020004011d0001050106190002081c00010201030102010307010d000301030001011000010801000108010001080100010803000108160002012f00010501060400010201030b0002010b00030816000601010201030102010307010100010501060200010501060200010501060200030112000108010001080100010801000108010001080300010801000108140002012f0001020103040001020103040001050106050002010a000408160006010102010301020103070101000102010302000102010302000102010302000301100001080100010801000108010001080100010801000108030001080100010845000102010304000102010304000102010305000201090005081600060101020103010201030701010001020103020001020103020001020103020002015009030025090200020902000c09070008090700060901020103010201036609030025090200020902000c09070008090700060901020103010201031609",
lookup="0000000064646464a1a2a1a2a3a4a3a4999aa9aa818291928384939467687778696a797a61627172",
bgflip="",
objs="0b2004950920080c05c00e9703a0109908a01094092010990980100c09b0100c1110100c12c01094014012940db012b010e0120c0cf014b00220160c0e7016b000c0172d0100172d0580172d05b0172d0760172d1240172f0200180c03a0180c07c0180c0800180c0c60180c0c90180c0cc0180c0e20180c",
pipes={
{208,20,4,4,0,0},
},
},
{
w=34,
h=30,
pal=1,
mus=2,
bg="01000e010102010301000e0101020103010002010c0001020103010002010c0001020103010002010c0001020103010002010c000102010301000c0102000102010301000c010200010201030100030108040101020001020103010002010c000102010301000c0102000102010301000e01010201030100020109040301010201030d0501060107010201030d050108010901020103",
lookup="6464646400000000a4a3a4a3a2a1a2a1999aa9aa616271728182919283849394a1a2a1a2a3a4a3a4",
bgflip="81e00081f00082000082100081e00181f00182000182100181e00281f00282000282100281e00381f00382000382100381e00481f00482000482100481e00581f00582000582100581e00681f00682000682100681e00781f00782000782100781e00881f00882000882100881e00981f00982000982100981e00a81f00a82000a82100a81e00b81f00b82000b82100b81e00c81f00c82000c82100c81e00d81f00d82000d82100d81e00e81f00e82000e82100e81e00f81f00f82000f82100f81e01081f01082001082101081e01181f01182001182101181e01281f01282001282101281e01381f01382001382101381e01481f01482001482101481e01581f01582001582101581e01681f01682001682101681e01781f01782001782101781e01881f01882001882101881e01981f01982001982101981e01a81f01a82001a82101a81e01b81f01b82001b82101b81e01c81f01c82001c82101c81e01d81f01d82001d82101d",
objs="01801299",
pipes={
{28,26,3,232,22,2},
},
},
}
--end lvls
--states
s_title=0
s_lvl_intro=1
s_gameplay=2
s_gameover=3
function set2by2(start_x,start_y,t)
if type(t)!="table" then
t={t,t+1,t+16,t+17}
end
local count=1
for j=0,1 do
for i=0,1 do
mset(start_x+i,start_y+j,t[count])
count+=1
end
end
end
function hex_map_load(m)
--w3,h2,pal1,clear1,mus1,
--[[
for i=1,#m.conf,8 do
m.w=parse_hex_num(m.conf,i,2)
i+=3
m.h=parse_hex_num(m.conf,i,1)
i+=2
m.pal=parse_hex_num(m.conf,i,0)
i+=1
m.cls=parse_hex_num(m.conf,i,0)
i+=1
m.mus=parse_hex_num(m.conf,i,0)
i+=1
end]]
for i=1,#m.objs,8 do
local x=parse_hex_num(m.objs,i,2)
i+=3
local y=parse_hex_num(m.objs,i,2)
i+=3
local id=parse_hex_num(m.objs,i,1)
local t=
{
[12]=m_goomba,
[176]=m_plant,
[45]=m_koopa,
[47]=m_koopa_red,
[101]=m_flag,
[148]=m_hidden_item,--mushroom
[149]=m_hidden_item,--1up
[151]=m_hidden_item,--star
[152]=m_hidden_item,--coin
[153]=m_hidden_item,--multi-coin
}
if t[id]!=nil then
local o = t[id](x*8,y*8,id)
o.x=x*8+(o:w_half())
o.y=y*8+(o:h_half())
end
end
local x=0
local y=0
--load background
for i=1,#m.bg,4 do
local count=parse_hex_num(m.bg,i,1)
local lookup=parse_hex_num(m.bg,i+2,1)
lookup = (lookup * 8) + 1
--printh(count)
for j=0,count-1 do
local t={}
for k=0,6,2 do
local n=parse_hex_num(m.lookup,lookup+k,1)
add(t,max(0,n-1))
end
--printh(x .. "," .. y)
set2by2(x,y,t)
if t[1]==102 and find_hidden_item(x*8,y*8)==nil then
o = m_hidden_item(x*8+8,y*8+8,152)
end
x+=2
if x>=m.w then
x=0
y+=2
end
end
end
--load flip info
for i=1,#m.bgflip,6 do
--printh("str: "..sub(m.bgflip,i,i+2))
local xfull=parse_hex_num(m.bgflip,i,2)
local yfull=parse_hex_num(m.bgflip,i+3,2)
--[0][000 0000 0000] <-position of tile in question.
-- ^-flip tile in this direction
--right 11 bits are used for position.
local x=band(xfull,0x7ff)
local y=band(yfull,0x7ff)
--left most bit is used for flip on/off.
map_data[x][y].flipx = band(xfull,0x800)!=0
map_data[x][y].flipy = band(yfull,0x800)!=0
end
--load pal swap data
local bgpal=m.bgpal
if bgpal then
for i=1,#bgpal,8 do
--x3,y2,w1,h1,p1
local px=parse_hex_num(bgpal,i,2)
local py=parse_hex_num(bgpal,i+3,1)
local pw=parse_hex_num(bgpal,i+5,0)
local ph=parse_hex_num(bgpal,i+6,0)
local pp=parse_hex_num(bgpal,i+7,0)
for y=py,py+ph-1 do
for x=px,px+pw-1 do
map_data[x][y].bgpal=pp
end
end
end
end
for v in all(m.pipes) do
--(x,y,w,h,dest_lvl,dest_x,dest_y,dest_dir)
local dir=0
if v[6] == 1 then
dir=1
elseif v[6]==2 then
dir=-1
end
m_pipe(v,dir)
end
end
function parse_hex_num(str,i,l)
return tonum("0x"..sub(str,i,i+l))
end
--math
--------------------------------
function intersects_obj_obj(a, b)
--return intersects_box_box(a.x,a.y,a.w,a.h,b.x,b.y,b.w,b.h)
local box_x_a,box_y_a,box_w_half_a,box_h_half_a=a:col_box()
local box_x_b,box_y_b,box_w_half_b,box_h_half_b=b:col_box()
return intersects_box_box(
box_x_a,box_y_a,box_w_half_a,box_h_half_a,
box_x_b,box_y_b,box_w_half_b,box_h_half_b)
end
function intersects_obj_box(a, x1, y1, w1, h1)
local box_x_a,box_y_a,box_w_half_a,box_h_half_a=a:col_box()
return intersects_box_box(box_x_a,box_y_a,box_w_half_a,box_h_half_a,x1,y1,w1,h1)
end
function intersects_point_obj(px,py,b)
local box_x_b,box_y_b,box_w_half_b,box_h_half_b=b:col_box()
return intersects_point_box(px,py,box_x_b,box_y_b,box_w_half_b,box_h_half_b)
end
--point to box intersection.
function intersects_point_box(px,py,x,y,w,h)
if flr(px)>=flr(x-(w)) and flr(px)<flr(x+(w)) and
flr(py)>=flr(y-(h)) and flr(py)<flr(y+(h)) then
return true
else
return false
end
end
--box to box intersection
function intersects_box_box(
x1,y1,
w1,h1,
x2,y2,
w2,h2)
local xd=x1-x2
local xs=w1+w2
if(abs(xd)>=xs)return false
local yd=y1-y2
local ys=h1+h2
if(abs(yd)>=ys)return false
return true
end
--check if pushing into side tile and resolve.
--requires self.dx,self.x,self.y, and
--assumes tile flag 0 == solid
--assumes sprite size of 8x8
function collide_side(self)
local box_x,box_y,box_w_half,box_h_half=self:col_box()
local offset=box_w_half
local finaloffset=0
if self.dx<0 then
offset*=-1
finaloffset=8
elseif self.dx==0 then
return
end
local x=(box_x+offset)/8
for yoffset=-(box_h_half)+1,(box_h_half)-1,2 do
local y=(box_y+yoffset)/8
--add(debug_points, {x*8,y*8})
if fget(mget(x,y),0) then
if self.on_collide_side!=nil then
self:on_collide_side()
else
self.dx=0
self.x=(flr((x))*8)+finaloffset-offset
end
return true
elseif self.dead_time==-1 and self.solid and self.bounces then
for v in all(objs) do
if v!=self and v.solid and v.bounces and v.is_enemy then
--[[(v.dx==0 or self.dx==0 or sgn(v.dx)!=sgn(self.dx)) and]]
if intersects_point_obj(x*8,y*8,v) then
self.dx*=-1
--v.dx*=-1
--self.x+=self.dx
return true
end
end
end
end
end
return false
end
--check if pushing into floor tile and resolve.
--requires self.dx,self.x,self.y,self.grounded,self.airtime and
--assumes tile flag 0 or 1 == solid
function collide_floor(self)
--only check for ground when falling.
if self.dy<0 then
return false
end
local box_x,box_y,box_w_half,box_h_half=self:col_box()
local y=(box_y+box_h_half)/8
--local landed=false
--check for collision at multiple points along the bottom
--of the sprite: left, center, and right.
for i=-(box_w_half)+2,(box_w_half)-2,2 do
--add(debug_points, { (box_x+i),(box_y+(box_h_half)) })
local new_y=nil
if fget(mget((box_x+i)/8,y),0) then
new_y=(flr(y)*8)-(self:h_half())
else
for v in all(objs) do
if v!=self and v.platform then
--[[(v.dx==0 or self.dx==0 or sgn(v.dx)!=sgn(self.dx)) and]]
if intersects_obj_obj(self,v) then
new_y=(flr(v.y-v:h_half()))-(self:h_half())+1
break
end
end
end
end
if new_y then
if self.on_collide_floor!=nil then
self:on_collide_floor(new_y)
else
self.dy=0
self.y=new_y
self.grounded=true
self.airtime=0
end
return true
end
end
if self.stay_on then
self.dx*=-1
self.x+=self.dx
end
return false
end
--check if pushing into roof tile and resolve.
--requires self.dy,self.x,self.y, and
--assumes tile flag 0 == solid
function collide_roof(self)
if self.dy>=0 then
return
end
hits={}
local y=flr((self.y-(self:h_half()))/8)
--check for collision at multiple points along the top
--of the sprite: left, center, and right.
for i=-(self:w_half())+2,(self:w_half())-2,2 do
local x=flr((self.x+i)/8)
--add(debug_points, {self.x+i,(self.y-(self:h_half()))})
item=nil
if self==p1 then
item=find_hidden_item(x*8,y*8)
end
local map_item=mget(x,y)
if fget(map_item,0) or item!=nil then
--printh("::adding tile: " ..map_item.."("..(item!=nil and "true" or "false")..")")
add(hits,{map_item,x,y,item})
end
end
if #hits>0 then
self.dy=0
self.y=flr(y)*8+8+(self:h_half())
self.jump_hold_time=0
local item = hits[flr(#hits/2)+1]
if self==p1 then
if item[4]!=nil then
item[4]:on_reveal(self)
else
--return item[1], item[2], item[3]
map_item=item[1]
x=item[2]
y=item[3]
if (fget(map_item,1))bounce_tile(x,y,104)
if (fget(map_item,2)) then
if p1.isbig then
--printh("::destroying tile")
bounce_tile(x,y,0)
else
bounce_tile(x,y)
end
end
end
end
--printh("---")
else
return nil
end
end
--make 2d vector
function m_vec(x,y)
local v=
{
x=x,
y=y,
--get the length of the vector
get_length=function(self)
return sqrt(self.x^2+self.y^2)
end,
--get the normal of the vector
get_norm=function(self)
local l = self:get_length()
return m_vec(self.x / l, self.y / l),l;
end,
}
return v
end
--square root.
function sqr(a) return a*a end
--round to the nearest whole number.
function round(a) return flr(a+0.5) end
--[[
function backinquart(t,b,c,d)
t/=d
ts=(t)*t
tc=ts*t
return b+c*(-11.3475*tc*ts + 19.4475*ts*ts + -7.8*tc + 0.8*ts + -0.2*t)
end
--]]
--[[
function easeoutquint(t,b,c,d)
t/=d;
t-=1;
return c*(t*t*t*t*t+1)+b;
end
--]]
--[[
function easeoutelastic(t,b,c,d)
t/=d
ts=(t)*t;
tc=ts*t;
return b+c*(33*tc*ts+-106*ts*ts+126*tc+-67*ts+15*t);
end
--]]
--utils
--------------------------------
function map_pos_to_16x16(x,y)
function temp(a)
return (a%2==0) and a or a-1
end
return temp(x),temp(y)
end
function find_hidden_item(x,y)
for v in all(objs) do
if v.is_hidden_item == true and intersects_point_obj(x,y,v) then
return v
end
end
return nil
end
function bounce_tile(x,y,tile)
----printh("btile a: " ..x..","..y)
local start_x,start_y=map_pos_to_16x16(x,y)
--printh("btile b: " ..x..","..y)
for v in all(objs) do
if v.on_bounce!=nil and intersects_obj_box(v,start_x*8+8,start_y*8+8-16,8,8) then
v:on_bounce({["x"]=start_x*8+8,["y"]=start_y*8+8 })
end
end
if fget(mget(start_x,start_y-1),7) then
local coin_x,coin_y=map_pos_to_16x16(flr(start_x),flr(start_y-1))
set2by2(coin_x,coin_y,{0,0,0,0})
p1:on_get_coin()
m_fx_coin(coin_x*8+8,coin_y*8+8)
end
--special case for smashing tiles.
if tile==0 then
for i=0,1 do
for j=0,1 do
m_part(
(start_x+i)*8+4,
(start_y+j)*8+4,
-1+(i*2),((1-j+1)*-3),mget(start_x+i,start_y+j))
end
end
set2by2(start_x,start_y,{0,0,0,0})
sfx(55)
return
end
--just bounce the tiles at x,y
if tile==nil then
tile={}
for y=0,1 do
for x=0,1 do
add(tile,mget(start_x+x,start_y+y))
--tile=mget(start_x,start_y)
end
end
--printh("btile tile[1]: " ..tile[1])
end
m_bounce_obj(start_x*8+8,start_y*8+8,tile)
sfx(52)
set2by2(start_x,start_y,{127,127,127,127})
end
--print string with outline.
function printo(str,startx,
starty,col,
col_bg)
for y=-1,1 do
for x=-1,1 do
print(str,startx+x,starty+y,col_bg)
end
end
print(str,startx,starty,col)
end
--print string centered with
--outline.
function printc(
str,x,y,
col,col_bg,
special_chars)
local len=(#str*4)+(special_chars*3)
local startx=x-(len/2)
local starty=y-2
printo(str,startx,starty,col,col_bg)
end
--objects
--------------------------------
function m_obj(x,y)
local o =
{
x=x,
y=y,
dx=0,
dy=0,
w=16,
h=16,
w_half=function(self)
return self.w*0.5
end,
h_half=function(self)
return self.h*0.5
end,
col_box=function(self)
if self.ch and self.cw then
return
self.x,
self.y+self:h_half()-self.ch/2,
self.cw/2,self.ch/2
else
return self.x,self.y,self.w/2,self.h/2
end
end,
scaley=1,
max_dx=9999,--max x speed
max_dy=9999,--max y speed
grav=0,
flipx=false,--show sprite be flipped.
flipy=false,
solid=true,
squish=false,
layer=1,
--animation definitions.
--use with set_anim()
anims=
{
["idle"]=
{
ticks=1,--how long is each frame shown.
frames={26},--what frames are shown.
},
},
curanim="idle",--currently playing animation
curframe=1,--curent frame of animation.
animtick=0,--ticks until next frame should show.
--request new animation to play.
set_anim=function(self,anim)
if(anim==self.curanim)return--early out.
local a=self.anims[anim]
self.animtick=a.ticks--ticks count down.
self.curanim=anim
self.curframe=1
end,
update_anim=function(self)
--anim tick
self.animtick-=1
if self.animtick<=0 then
self.curframe+=1
local a=self.anims[self.curanim]
self.animtick=a.ticks--reset timer
if self.curframe>#a.frames then
if self.on_anim_done!=nil then
self:on_anim_done()
end
self.curframe=1--loop
end
end
end,
--call once per tick.
update=function(self)
--limit walk speed
self.dx=mid(-self.max_dx,self.dx,self.max_dx)
--move in x
self.x+=self.dx
if self.solid then
local old_dx=self.dx
if collide_side(self) then
self.dx=-1*old_dx
end
end
--move in y
self.dy+=self.grav
self.dy=mid(-self.max_dy,self.dy,self.max_dy)
self.y+=self.dy
if self.solid then
collide_floor(self)
collide_roof(self)
end
self:update_anim()
end,
--draw the obj
draw=function(self)
local a=self.anims[self.curanim]
local frame=a.frames[self.curframe]
if(self.pal)push_pal(self.pal)
if type(frame)=="table" then
local start_x=self.x-(self:w_half())
local start_y=self.y-(self:h_half())
local count=1
local num_vert=flr(self.h/8)
local num_horz=flr(self.w/8)
local inc_x=8
local inc_y=8
if self.flipx then
start_x=start_x+((num_horz-1)*8)
inc_x=-8
end
if self.flipy then
start_y=start_y+((num_vert-1)*8)
inc_y=-8
end
local y=start_y
for v_count=1,num_vert do
local x=start_x
for h_count=1,num_horz do
-- draw in frame order, but from
-- right to left.
local f=frame[count]
local flipx=self.flipx
local flipy=self.flipy
if f!=nil then
if f<0 then
f=abs(f)
flipx=not flipx
end
if f>=256 then
f-=256
flipy=not flipy
end
sspr((f*8)%128,flr((f/16))*8,8,8,
x,y,8,8,
flipx,flipy )
end
count+=1
x += inc_x
end
y += inc_y
end
else
local flipx=self.flipx
local flipy=self.flipy
if frame<0 then
flipx=not flipx
frame=abs(frame)
end
if frame>=256 then
frame-=256
flipy=true
end
sspr((frame*8)%128,flr((frame/16))*8, self.w, self.h,
self.x-(self:w_half()), self.y+(self:h_half())-(self.h/self.scaley), ---(self.h/4/2),
self.w, self.h/self.scaley, flipx, flipy )
end
if(self.pal)pop_pal()
--add(debug_points, {self.x,self.y})
local x,y,w,h=self:col_box()
--rect(x-w,y-h,x+w,y+h,9)
end,
ext=function(self,t)
for k,v in pairs(t) do
self[k]=v
end
return self
end,
}
add(objs_queue,o)
return o
end
--make the player
function m_player(x,y)
local p=m_obj(x,y)
local ext=
{
w=16,
h=16,
max_dx=2,--max x speed
max_dy=4,--max y speed
ticks_since_run=9999,
ticks_since_fire=9999,
jump_speed=-4,--jump veloclity
acc=0.1,--acceleration
dcc=0.8,--decceleration
air_dcc=1,--air decceleration
grav=0.3,
--helper for more complex
--button press tracking.
--todo: generalize button index.
jump_button=m_button(5),
fire_button=m_button(4),
jump_hold_time=0,--how long jump is held
min_jump_press=5,--min time jump can be held
max_jump_press=20,--max time jump can be held
jump_btn_released=true,--can we jump again?
grounded=false,--on ground
airtime=0,--time since grounded
--animation definitions.
--use with set_anim()
anims=
{
["idle"]=
{
ticks=1,--how long is each frame shown.
frames={10},--what frames are shown.
},
["run"]=
{
ticks=2,
frames={6,4,2},
},
["jump"]=
{
ticks=1,
frames={0},
},
["slide"]=
{
ticks=1,
frames={8},
},
["dead"]=
{
ticks=1,
frames={93},
},
["size_up"]=
{
ticks=15,
frames={10,10,10,10,10,10,10,10,10},
},
["fire"]=
{
ticks=15,
frames={{6,7,93,94,109,110,54,55}},
},
},
hit_time=0,
size_time=0,
pipe_time=0,
pipe_dir=0,
pipe=nil,
lives=3,
coins=0,
on_flag=false,
on_flag_time=0,
isbig=false,
has_flower=false,
star_time=0,
offset_anims=function(self,amount)
for k,v in pairs(self.anims) do
for k2,v2 in pairs(v.frames) do
if type(v2)=="table" then
for k3,v3 in pairs(v2) do
self.anims[k].frames[k2][k3]+=amount
end
else
self.anims[k].frames[k2]+=amount
end
end
end
end,
go_big=function(self)
--printh("gobig: " .. (self.isbig and "true" or "false"))
if self.isbig==false then
self:offset_anims(32)
self.h=32
self.y-=8
self.isbig=true
self.size_time=60
elseif self.has_flower==false then
self.has_flower=true
self.size_time=60
end
sfx(58)
end,
go_small=function(self,instant)
if self.isbig==true then
self:offset_anims(-32)
self.h=16
self.y+=8
self.isbig=false
self.has_flower=false
if not instant then
self.size_time=60
end
end
end,
on_instant_death=function(self)
self.hit_time=0
self:go_small(true)
self:on_take_hit(nil)
end,
on_take_hit=function(self,killer)
if self.hit_time<=0 then
if self.isbig then
self:go_small()
self.hit_time=120
else
--self:go_small()
self.is_dead=true
self.dx=0
self.dy=-10
self.flipy=false
self.grounded=false
self.py=self.y
self.dead_time=0
self.w=16
self.star_time=0
self:set_anim("dead")
music(24)
end
end
end,
on_load=function(self,px,py)
self.x=px
self.y=py-self:h_half()
self.dx=0
self.dy=0
self.hit_time=0
self.size_time=0
self.pipe_time=0
self.pipe_dir=0
self.pipe=nil
self.is_dead=false
self.on_flag=false
self.star_time=0
self:set_anim("idle")
end,
on_reach_flag=function(self,flag)
self.dx=0
self.dy=0
self.on_flag=true
self.on_flag_time=0
music(-1)
end,
on_get_star=function(self,star)
self.star_time=900
music(23)
end,
on_get_coin=function(self)
self.coins+=1
if self.coins>=100 then
self.lives+=1
self.coins=self.coins%100
sfx(59)
else
sfx(61)
end
end,
}
p:ext(ext)
p._update_player=p.update
p.update=function(self)
if self.star_time>0 then
self.star_time-=1
if self.star_time==0 then
music(mus[lvls[cur_lvl].mus])
end
end
self.hit_time=max(0, self.hit_time-1)
if self.is_dead then
self.dead_time+=1
if self.dead_time<30 then
return
end
local len = 120
local lerp = (self.dead_time-30) / len
if lerp>0.5 then
self.y+=self.dy
if (self.y>cam.pos_max.y+256) and self.dead_time>200 then
self.lives-=1
if self.lives<=0 then
goto_state(s_gameover)
else
--restart_lvl()
goto_state(s_lvl_intro)
end
end
return
end
--fy=easeoutquint(min(lerp,1),self.py,-16,1)
fy=(sin(lerp)*80)+self.py
if (lerp>=0.5) then
self.dy=fy-self.y
end
self.y=fy
return
end
if self.pipe!=nil then
self.pipe_time-=1
if self.pipe_time==0 then
self.pipe:on_use()
self.pipe=nil
self.pipe_dir=0
else
self.y+=1*self.pipe_dir
end
return
end
if self.on_flag then
if self.on_flag_time==60 then
music(30)
end
self.on_flag_time+=1
if self.on_flag_time>60 then
self.y+=1
if collide_floor(self) then
if (self.on_flag_time>400) then
cur_core_lvl+=1
cur_lvl=core_lvls[cur_core_lvl]
goto_state(s_lvl_intro)
end
elseif ticks%4==0 then
p1:on_get_coin()
m_fx_coin(self.x+rnd(16)-8,self.y-rnd(8))
end
end
return
end
if (self.y>cam.pos_max.y+64) then
self:on_instant_death()
end
if self.size_time>0 then
self.size_time-=1
return
end
--track button presses
local bl=btn(0) and not self.is_dead--left
local br=btn(1) and not self.is_dead --right
--move left/right
if bl==true then
self.dx-=self.acc
br=false--handle double press
elseif br==true then
self.dx+=self.acc
else
if self.grounded then
self.dx*=self.dcc
else
self.dx*=self.air_dcc
end
end
--[[
if btn(4) then
self.cur_max=min(self.cur_max+0.1,self.max_dx)
else
self.cur_max=max(self.cur_max-0.01,self.max_dx*0.5)
end
--]]
local cur_max=self.max_dx*0.5
if btn(4) then
self.ticks_since_run=0
else
self.ticks_since_run=min(999,self.ticks_since_run+1)
end
if self.ticks_since_run<15 then
cur_max=self.max_dx
end
--limit walk speed
self.dx=mid(-cur_max,self.dx,cur_max)
--move in x
self.x+=self.dx
--hit walls
collide_side(self)
local camx,camy = cam:cam_pos()
if self.x-self:w_half() < camx then
self.dx=0
self.x=camx+self:w_half()
elseif self.x+self:w_half() > camx+128 then
self.dx=0
self.x=camx+128-self:w_half()
end
--[[cam pos min]]
--jump buttons
self.jump_button:update()
--jump is complex.
--we allow jump if:
-- on ground
-- recently on ground
-- pressed btn right before landing
--also, jump velocity is
--not instant. it applies over
--multiple frames.
if self.jump_button.is_down and not self.is_dead then
--is player on ground recently.
--allow for jump right after
--walking off ledge.
local on_ground=(self.grounded or self.airtime<5)
--was btn presses recently?
--allow for pressing right before
--hitting ground.
local new_jump_btn=self.jump_button.ticks_down<10
--is player continuing a jump
--or starting a new one?
if self.jump_hold_time>0 or (on_ground and new_jump_btn) then
if(self.jump_hold_time==0)sfx(63)
self.jump_hold_time+=1
--keep applying jump velocity
--until max jump time.
if self.jump_hold_time<self.max_jump_press then
self.dy=self.jump_speed--keep going up while held
end
end
else
self.jump_hold_time=0
end
--move in y
self.dy+=self.grav
self.dy=mid(-self.max_dy,self.dy,self.max_dy)
self.y+=self.dy
--floor
if not self.is_dead and not collide_floor(self) then
self:set_anim("jump")
self.grounded=false
self.airtime+=1
end
if self.grounded==true and btn(3) then
for v in all(objs) do
if v.dest_lvl!=nil then
if intersects_point_obj(self.x,self.y,v) then
self.pipe=v
self.pipe_time=60
self.pipe_dir=1
sfx(56)
music(-1)
return
end
end
end
end
for j=-1,1 do
for i=-1,1 do
local x=(self.x-(i*self:w_half()))/8
local y=(self.y-(j*self:h_half()))/8
if fget(mget(x,y),3) then
--m_fx_explosion(self.x,self.y)
local start_x,start_y=map_pos_to_16x16(flr(x),flr(y))
set2by2(start_x,start_y,{0,0,0,0})
self:on_get_coin()
--[[
if self.on_flag then
for k=0,5 do
p1:on_get_coin()
m_fx_coin(start_x*8+rnd(8),start_y*8+rnd(8))
end
end
--]]
end
end
end
--roof
if(not self.is_dead)collide_roof(self)
--handle playing correct animation when
--on the ground.
if self.ticks_since_fire<5 then
self:set_anim("fire")
elseif self.grounded then
if (br and self.dx<0) or (bl and self.dx>0) then
self:set_anim("slide")
elseif bl or br then
self:set_anim("run")
self.anims["run"].ticks=((self.max_dx-abs(self.dx))+1)*3
else
self:set_anim("idle")
end
end
--flip
if self.grounded then
if(br)self.flipx=false
if(bl)self.flipx=true
end
self.fire_button:update()
if self.fire_button.is_pressed and self.has_flower and #fireballs<2 then
local dir=1
if(self.flipx)dir=-1
m_fireball(self.x,self.y,dir)
self:set_anim("fire")
self.ticks_since_fire=0
else
self.ticks_since_fire=min(9999,self.ticks_since_fire+1)
end
self:update_anim()
end
p._draw_player=p.draw
p.draw=function(self)
if self.hit_time%2==0 then
if self.star_time>0 then
local c={{9,7,5,9},{8,1,5,4,9,15},{8,3,5,9,9,7}}
local d=self.star_time<120 and 8 or 2
local i=(flr(ticks/d)%4)
self.pal=c[i]
elseif self.has_flower then
self.pal={8,15,5,8}
else
self.pal=nil
end
self.scaley=1
if self.size_time%20>10 then
if self.isbig then
self.scaley=2
else
self.scaley=0.5
end
end
self:_draw_player()
end
end
return p
end
function m_fx(x,y)
local o=m_obj(x,y)
o.solid=false
o.on_anim_done=function(self)
del(objs,self)
end
return o
end
function m_fx_explosion(x,y)
local o=m_fx(x,y)
o.w=16
o.h=16
o.anims=
{
["idle"]=
{
ticks=5,--how long is each frame shown.
frames={{135,-135,391,-391},
{136,-136,392,-392},
{137,-137,393,-393}},
},
}
--return o
end
function m_fx_coin(x,y)
local o=m_fx(x,y):ext(
{
w=8,
h=16,
dy=-6,
grav=0.3,
anims=
{
["idle"]=
{
ticks=5,--how long is each frame shown.
frames={
{252,508},
{253,509},
{254,510},
{255,511},
{252,508},
{253,509},
{254,510},
{255,511},
}
},
},
})
--return o
end
function m_fireball(x,y,dirx)
sfx(53)
local o=m_obj(x,y)
local speed=2
o.w=8
o.h=8
o.grav=0.2
o.dx=dirx*speed*2
o.dy=speed
o.anims=
{
["idle"]=
{
ticks=5,--how long is each frame shown.
frames={95,111,-351,-367},--what frames are shown.
},
}
--o.curframe=flr(rnd(#o.anims["idle"].frames)+1)
o.on_collide_floor=function(self,y)
self.dy=-speed
self.y=y
end
o.on_collide_side=function(self)
m_fx_explosion(self.x,self.y)
del(fireballs,self)
end
o.test_hit=function(self,t)
for v in all(t) do
if v.is_enemy and v.dead_time==-1 then
if intersects_obj_obj(self,v) then
self:on_collide_side()
v:on_bounce(self)
break
end
end
end
end
o._update_fireball=o.update
o.update=function(self)
self:_update_fireball()
self:test_hit(objs)
local camx,camy = cam:cam_pos()
if self.x+self.w < camx or self.x-self.w > camx+128 or self.y-self.h > camy+128 then
del(fireballs,self)
end
end
del(objs_queue,o)
add(fireballs,o)
--return o
end
function m_pipe(v,dest_dir)
local o = m_obj(v[1]*8,v[2]*8)
o.w=10
o.h=32
o.dest_lvl=v[3]
o.dest_x=v[4]*8
o.dest_y=v[5]*8
o.dest_dir=dest_dir
o.draw=function()end
--[[
o.draw=function(self)
--debug
--rect(o.x-o:w_half(),o.y-o:h_half(),o.x+o:w_half(),o.y+o:h_half(),15)
--printc("lvl:" .. self.dest_lvl, self.x, self.y, 15, 1, 0)
end
--]]
o.on_use=function(self)
queue_lvl(self.dest_x,self.dest_y,self.dest_lvl,self.dest_dir)
end
--return o
end
--[[
function m_platform(x,y)
local o=m_obj(x,y):ext({
w=48,
h=8,
--cw=48,
--ch=10,
platform=true,
})
o.anims["idle"].frames={{114,114,114,114,114,114}}
o._update_platform=o.update
o.update=function(self)
local start_touch=intersects_obj_obj(self,p1)
--printh("start_touch: "..(start_touch and "true" or "false"))
self.y+=1--sin(ticks*0.01)
self:_update_platform()
if(start_touch)p1.y+=1--sin(ticks*0.001)
if(self.y>128)self.y=0
end
--return o
end
--]]
function m_hidden_item(x,y,t)
local o=m_obj(x,y)
o.t=t
o.coin_ticks=-1
o.is_hidden_item=true
o.on_reveal=function(self)
if self.t==148 or self.t==149 then
local o=m_mushroom(self.x,self.y)
if self.t==149 then
o.pal={4,3}
o.is_1up=true
elseif p1.isbig then
o.flash=true
o.anims["idle"]=
{
ticks=0,
frames={ { 150, -150, 166, -166 } },
}
o.dx=0
end
elseif self.t==151 then
m_star(self.x,self.y)
elseif self.t==152 or self.t==153 then
m_fx_coin(self.x,self.y)
p1:on_get_coin()
if self.coin_ticks==-1 then
--first time
self.coin_ticks=60*4
end
end
local x,y=map_pos_to_16x16(self.x/8,self.y/8)
if self.t!=153 or self.coin_ticks<=0 then
--printh("::bouncing tile in reveal")
bounce_tile(x,y,104)
del(objs,self)
else
bounce_tile(x,y)
end
end
o.update=function(self)
if self.coin_ticks>0 then
self.coin_ticks-=1
end
end
o.draw=function(self) end
return o
end
function m_item(x,y)
local o=m_obj(x,y)
o.ticks=0
o.solid=false
o.flash=false
o.pal={}
o.on_bounce=function(self,block)
self.dx=sgn(self.x-block.x)*abs(self.dx)
self.dy=-2
end
o._update_item=o.update
o.update=function(self)
self.ticks+=1
if intersects_obj_obj(self,p1) then
if self.on_touch then
self:on_touch()
end
del(objs,self)
end
if self.ticks==32 then
self.layer=1
self.solid=true
elseif self.ticks<32 then
self.y-=0.5
return
end
self:_update_item()
end
o._draw_item=o.draw
o.draw=function(self)
if self.flash then
local c={{7,15,9,4,4,2},{7,9,9,3},{4,3}}
local i=(flr(ticks/2)%4)
self.pal=c[i]
end
self:_draw_item()
end
o.layer=0
return o
end
function set_pal(t)
pal()
if t then
for i=1,#t,2 do
pal(t[i],t[i+1])
end
end
end
function push_pal(pal_table)
add(pal_stack,pal_table)
set_pal(pal_table)
end
function pop_pal()
del(pal_stack, pal_stack[#pal_stack])
set_pal(pal_stack[#pal_stack])
end
function set_coin_pal()
local c={{9,4},{},{9,10},{}}
local i=(flr(ticks/10)%4)+1
if c[i]!=nil then
push_pal(c[i])
end
end
function m_mushroom(x,y)
sfx(57)
local o=m_item(x,y)
o.dx=0.75
o.grav=0.1
o.anims["idle"]=
{
ticks=0,--how long is each frame shown.
frames={148},--what frames are shown.
}
--[[
o._update_mushroom=o.update
o.update=function(self)
self:_update_mushroom()
if intersects_obj_obj(self,p1) then
p1:go_big()
del(objs,self)
end
end
--]]
o.on_touch=function(self)
if o.is_1up then
p1.lives+=1
sfx(59)
else
p1:go_big()
end
del(objs,self)
end
return o
end
function m_star(x,y)
sfx(57)
local o=m_item(x,y)
local ext=
{
dx=0.75,
dy=-3,
grav=0.1,
flash=true,
anims=
{
["idle"]=
{
ticks=0,--how long is each frame shown.
frames={{151,-151,167,-167}},--what frames are shown.
}
},
on_collide_floor=function(self,new_y)
self.dy=-3
self.y=new_y
end,
on_touch=function(self)
p1:on_get_star(self)
end,
}
o:ext(ext)
--return o
end
--[[
function m_flower(x,y)
local o=m_item(x,y)
o.anims["idle"]=
{
ticks=0,
frames={ { 150, -150, 166, -166 } },
}
o._update_flower=o.update
o.update=function(self)
self:_update_flower()
if intersects_obj_obj(self,p1) then
p1:go_big()
del(bg_objs,self)
end
end
return o
end
--]]
function m_bounce_obj(x,y,og_tile)
local o = m_obj(x,y)
o.t=0
o.py=y
o.og=og_tile
o.anims["idle"].frames={og_tile}
if lvls[cur_lvl].pal!=nil then
o.pal=pals[lvls[cur_lvl].pal]
end
o.update=function(self)
self.t+=1
local lerp = self.t / 30
fy=(sin(self.t/30)*4)+self.py
self.y=fy
if (self.y>=self.py) then
del(objs,self)
--flip_tile((self.x-8)/8,(self.py-8)/8,self.og)
set2by2((self.x-8)/8,(self.py-8)/8,self.og)
end
end
--return o
end
function m_enemy(x,y)
local o = m_obj(x,y)
o.dx=-0.5
o.grav=0.1
o.dead_time=-1
o.is_enemy=true
o.bounces=true
o.ch=10
o.cw=10
--o.walk_speed=-0.5
o.anims["idle"]=
{
ticks=5,--how long is each frame shown.
frames={12, -12},--what frames are shown.
}
o.on_bounce=function(self,block)
if self.dead_time==-1 then
self.dead_time=240
--printh(self.x)
self.dx=sgn(self.x-block.x)*0.5
--printh(self.dx)
self.dy=-3
self.solid=false
self.flipy=true
sfx(54)
end
end
o.on_stomp=function(self)
end
o.on_attack=function(self,target)
if target.on_take_hit then
target:on_take_hit(self)
end
end
o.on_take_hit=function(self,attacker)
self:on_bounce(self,attacker)
end
o._update_enemy=o.update
o.update=function(self)
self:_update_enemy()
if self.dx<0 then
self.flipx=true
else
self.flipx=false
end
if self.dead_time>=0 then
self.dead_time-=1
if self.dead_time<=0 then
del(objs,self)
end
return
end
--[[flip code]]
--if (self.y>cam.pos_max.y+64+(self:h_half())) then
-- del(objs,self)
--end
if self.dead_time==-1 and not p1.is_dead and p1.pipe==nil then
-- local gx,gy,gw,gh=self.x,self.y+self.h*0.25,self.w,self.h*0.75
if intersects_obj_obj(p1,self) then
if p1.star_time>0 then
self:on_bounce(p1)
else
--feet pos.
local mx,my=p1.x,p1.y+(p1:h_half())
local gx,gy,gw,gh=self:col_box()
slope = abs((gy-my)/(gx-mx))
if ((--[[gy == mx) or ((slope >= 0) and]] (gy > my))) then
if p1.dy>=0 then
self:on_stomp()
end
else
self:on_attack(p1)
end
end
end
end
end
o._draw_enemy=o.draw
o.draw=function(self)
local old_y=self.y
local old_x=self.x
if self.dead_time==-1 then
local camx,camy=cam:cam_pos()
local rad=10
if self.y>=camy+128 then
local new_y=camy+128---rad
circfill(self.x,new_y,rad+1,1)
circfill(self.x,new_y,rad,7)
self.y=new_y
elseif self.y<=camy then
local new_y=camy---rad
circfill(self.x,new_y,rad+1,1)
circfill(self.x,new_y,rad,7)
self.y=new_y
end
end
self:_draw_enemy()
self.x=old_x
self.y=old_y
end
return o
end
function m_goomba(x,y)
local o= m_enemy(x,y):ext(
{
on_stomp=function(self)
self.scaley=4
self.dead_time=60
self.dx=0
self.dy=0
p1.dy=p1.max_dy*-1
sfx(54)
end,
})
if lvls[cur_lvl].pal==1 then
o.pal={4,13,15,12}
end
return o
end
function m_plant(x,y)
y+=12
local o = m_enemy(x+8,y):ext(
{
w=16,
h=24,
iy=y,
dx=0,
--o.walk_speed=0
solid=false,
grav=0,
layer=0,
ticks=0,
--o.wait=0
anims={
["idle"]=
{
ticks=15,
frames={{176,-176,192,-192,208,-208},{177,-177,193,-193,209,-209}},
}
},
on_bounce=function(self,block)
del(objs,self)
sfx(54)
end,
})
o._update_plant=o.update
o.update=function(self)
if abs(self.x-p1.x)>32 or self.y!=self.iy then
self.ticks+=1
self.y=mid(self.iy,self.iy-self:h_half()+cos(self.ticks*0.003)*36,self.iy-self.h)
end
self:_update_plant()
end
return o
end
function m_koopa(x,y)
local o = m_enemy(x,y)
o.w=16
o.h=24
o.ch=12
o.cw=8
o.anims["idle"]=
{
ticks=5,--how long is each frame shown.
frames={44, 46},--what frames are shown.
}
o.on_stomp=function(self)
m_shell(self.x,self.y+4).pal=self.pal
del(objs,self)
p1.dy=p1.max_dy*-1
sfx(54)
end
return o
end
function m_koopa_red(x,y)
--printh("make red")
local o=m_koopa(x,y):ext(
{
pal={3,8},
stay_on=true,
})
return o
end
function m_shell(x,y)
local o=m_enemy(x,y)
o:ext(
{
dx=0,
dy=0,
ch=12,
cw=8,
bounces=true,
hit_time=0,
anims=
{
["idle"]=
{
ticks=1,
frames={{14,-14,30,-30}},
},
},
on_kick=function(self,kicker)
--printh("on kick")
self.dx=sgn(self.x-kicker.x)*2.5
self.hit_time=15
self.bounces=false
sfx(52)
end,
on_stomp=function(self)
--printh("on stomp")
if self.dx==0 then
self:on_kick(p1)
elseif self.hit_time<=0 then
self.dx=0
self.bounces=true
p1.dy=p1.max_dy*-1
end
sfx(54)
end,
on_attack=function(self,target)
--printh("on attack")
if self.dx!=0 and self.hit_time<=0 then
target:on_take_hit(self)
else
self:on_kick(target)
end
end,
_update_shell=o.update,
update=function(self)
self:_update_shell()
self.hit_time=max(0,self.hit_time-1)
for v in all(objs) do
if v!=self and v.solid and v.is_enemy then
if self.dx!=0 and intersects_obj_obj(self,v) then
v:on_bounce(self)
end
end
end
end,
})
return o
end
function m_flag(x,y)
local o = m_obj(x,y)
o.w=16
o.h=16
o.reached=false
o.anims["idle"]=
{
ticks=0,--how long is each frame shown.
frames={{100, 101, nil, 100}},--what frames are shown.
}
o.update=function(self)
if self.reached then
self.y=p1.y
elseif p1.x>self.x then
p1:on_reach_flag(self)
self.reached=true
end
end
return o
end
function m_button(id)
local b =
{
update=function(self)
--start with assumption
--that not a new press.
self.is_pressed=false
if btn(id) then
if not self.is_down then
self.is_pressed=true
end
self.is_down=true
self.ticks_down+=1
else
self.is_down=false
self.is_pressed=false
self.ticks_down=0
end
end,
--state
is_pressed=false,--pressed this frame
is_down=false,--currently down
ticks_down=0,--how long down
}
return b
end
--make the camera.
function m_cam(target)
local c=
{
tar=target,--target to follow.
pos=m_vec(target.x+target:w_half(),target.y+target:h_half()),
--how far from center of screen target must
--be before camera starts following.
--allows for movement in center without camera
--constantly moving.
pull_threshold=16,
--min and max positions of camera.
--the edges of the level.
pos_min=m_vec(64,64),
pos_max=m_vec(446*8-64,196-44),
-- shake_remaining=0,
-- shake_force=0,
update=function(self)
-- self.shake_remaining=max(0,self.shake_remaining-1)
--follow target outside of
--pull range.
if self:pull_max_x()<self.tar.x then
--self.pos.x+=1
self.pos.x+=min(self.tar.x-self:pull_max_x(),4)
end
if self:pull_min_x()>self.tar.x then
self.pos.x+=min((self.tar.x-self:pull_min_x()),4)
end
if self:pull_max_y()<self.tar.y+(self.tar:h_half()) then
self.pos.y+=min(self.tar.y+(self.tar:h_half())-self:pull_max_y(),4)
end
if self:pull_min_y()>self.tar.y+(self.tar:h_half()) then
self.pos.y+=min((self.tar.y+(self.tar:h_half())-self:pull_min_y()),4)
end
--lock to edge
self.pos.x=mid(self.pos_min.x,self.pos.x,self.pos_max.x)
self.pos.y=mid(self.pos_min.y,self.pos.y,self.pos_max.y)
self:cull_objs()
self:activate_objs()
end,
cam_pos=function(self)
--calculate camera shake.
-- local shk=m_vec(0,0)
-- if self.shake_remaining>0 then
-- shk.x=rnd(self.shake_force)-(self.shake_force/2)
-- shk.y=rnd(self.shake_force)-(self.shake_force/2)
-- end
-- return self.pos.x-64+shk.x,self.pos.y-64+shk.y
return self.pos.x-64,self.pos.y-64
end,
pull_max_x=function(self)
return self.pos.x-16--+self.pull_threshold
end,
pull_min_x=function(self)
return self.pos.x-16---64+8
end,
pull_max_y=function(self)
return self.pos.y+self.pull_threshold
end,
pull_min_y=function(self)
return self.pos.y-self.pull_threshold
end,
-- shake=function(self,ticks,force)
-- self.shake_remaining=ticks
-- self.shake_force=force
-- end
cull_objs=function(self)
local cam_min=self.pos_min
local back_offset=128
if p1.x-back_offset>cam_min.x then
self.pos_min.x = p1.x-128
end
for v in all(objs) do
if v.x+v.w<self.pos_min.x-64 or v.y-v.h>self.pos_max.y+64 then
del(objs,v)
end
end
end,
activate_objs=function(self)
for v in all(objs_queue) do
if v.x <= (flr(self:cam_pos()/256)+1)*256+128+v.w then
-- move to active list.
add(objs,v)
del(objs_queue,v)
end
end
end,
}
return c
end
function m_part(_x,_y,_dx,_dy,_s)
local o = m_obj(_x,_y)
local ext=
{
dx=_dx,
dy=_dy,
w=8,
h=8,
sprite=_s,
max_dx=2,--max x speed
max_dy=4,--max y speed
grav=0.3,
--call once per tick.
update=function(self)
--limit walk speed
self.dx=mid(-self.max_dx,self.dx,self.max_dx)
--move in x
self.x+=self.dx
--move in y
self.dy+=self.grav
self.dy=mid(-self.max_dy,self.dy,self.max_dy)
self.y+=self.dy
-- if (self.y>cam.pos_max.y+64+(self:h_half())) then
-- del(objs,self)
-- end
end,
--draw the player
draw=function(self)
spr(self.sprite,
self.x-(self:w_half()),
self.y-(self:h_half()),
(self.w/8),self.h/8,
self.flipx,
false)
end,
}
o:ext(ext)
return o
end
--game flow
--------------------------------
--reset the game to its initial
--state. use this instead of
--_init()
function reset()
--load_lvl(4*8,-64,lvls[2])
state=0
ticks=0
objs={}
objs_queue={}
fireballs={}
pal_stack={}
--[[
menuitem(1,
"[cheat] next level",
function() cur_core_lvl+=1
cur_lvl=core_lvls[cur_core_lvl]
goto_state(s_lvl_intro) end)
--]]
end
function goto_state(new_state)
if state==s_title then
p1=m_player(0,0)
p1:set_anim("idle")
cur_core_lvl=1
end
state=new_state
ticks=0
if state==s_lvl_intro then
cur_lvl=core_lvls[cur_core_lvl]
load_lvl(24,208,cur_lvl)
elseif state==s_gameover then
music(26)
end
end
function queue_lvl(px,py,lvl,pipe_dir)
lvl_next={px,py,lvl,pipe_dir}
end
function load_lvl(px,py,lvl_id,pipe_dir)
--printh("starting load...")
-- cls(0)
-- printc("loading...",64,64,6,5,0)
-- flip()
--[[
for i=0,999 do
--for j=0,1 do
cls(0)
local str="loading"
for k=0,i*0.1%3 do
str=str.."."
end
printc(str,64,64,6,5,0)
flip()
--end
end
--]]
objs={}
objs_queue={}
fireballs={}
--debug_points={}
map_data={}
pal_stack={}
p1:on_load(px,py)
if pipe_dir!=nil and pipe_dir!=0 then
p1.pipe={on_use=function()end,}
p1.pipe_time=60
p1.pipe_dir=-1--pipe_dir
p1.y+=60
end
cam=m_cam(p1)
cur_lvl=lvl_id
local lvl=lvls[cur_lvl]
cam.pos_max=m_vec((lvl.w*8)-64-8,(lvl.h*8)-64-24),
--m_mushroom(48+8,200)
--m_flower(96+8,200)
--m_platform(96,200-64)
--printh("lvl: " .. lvl.bg)
hex_map_load(lvl) -- todo: restore later
--rom_map_load(rom_lvls[1],lvl)
--printh("init complete")
music(mus[lvl.mus])
end
--p8 functions
--------------------------------
function _init()
reset()
end
function _update60()
ticks+=1
--printh("update")
if state==s_title then
if btnp(4) or btnp(5) then
goto_state(s_lvl_intro)
end
elseif state==s_lvl_intro then
if ticks>=120 then
goto_state(s_gameplay)
end
elseif state==s_gameplay then
if not p1.is_dead and p1.size_time==0 then
for o in all(objs) do
o:update()--20%
end
for o in all(fireballs) do
o:update()
end
end
p1:update()--25%
cam:update()--10%
--demo camera shake
--if(btnp(4))cam:shake(15,2)
if lvl_next!=nil then
--printh("queued up level: " ..lvl_next[3].." ["..lvl_next[1]..","..lvl_next[2].."]")
load_lvl(lvl_next[1],lvl_next[2],lvl_next[3],lvl_next[4])
lvl_next=nil
end
elseif state==s_gameover then
if btnp(4) or btnp(5) then
goto_state(s_title)
end
end
end
-- 16x14
local fadetable_w=15
local fadetable=
"000000000000000"..
"111111100000000"..
"222222111000000"..
"333333111000000"..
"444222221100000"..
"555551111100000"..
"66dddd555511100"..
"76666ddd5551100"..
"888822222200000"..
"999444444550000"..
"aa9994445555000"..
"bbb333333300000"..
"ccccc3311111100"..
"ddd555511111000"..
"eeed44222221100"..
"ff6ddd555551100"
function fade(i)
for c=0,15 do
if flr(i+1)>=fadetable_w then
pal(c,0,1)
else
local c2=c*fadetable_w+i+1
pal(c,parse_hex_num(fadetable,c2,0),1)
--pal(c,fadetable[c+1][flr(i+1)])
end
end
end
function _draw()
if state==s_title then
cls(0)
printc("super mario bros.",64,64,7,1,0)
elseif state==s_lvl_intro then
if lvls[cur_lvl].cls then
cls(lvls[cur_lvl].cls)
else
cls(0)
end
camera(512+ticks,(29*8)-128+16)
if(lvls[cur_lvl].pal!=nil)push_pal(pals[lvls[cur_lvl].pal])
map(0,0,0,0,32,446)
if(lvls[cur_lvl].pal!=nil)pop_pal()
camera(0,0)
rectfill(0,0,127,32,0)
rectfill(0,96,127,127,0)
printc("world "..(flr((cur_core_lvl-1)/4)+1).."-"..(flr((cur_core_lvl-1)%4)+1),64,64-48,7,1,0)
spr(10,64-32,64-8+48,2,2)
printc("x",64,64+48,7,1,0)
printc("" .. p1.lives,64+16,64+48,7,1,0)
if ticks<=fadetable_w then
fade(fadetable_w-flr((ticks/fadetable_w)*fadetable_w))
elseif ticks >= 100-fadetable_w then
local lerp=ticks-(100-fadetable_w)
lerp=lerp/fadetable_w
fade(flr((lerp)*fadetable_w))
end
elseif state==s_gameplay then
--50%
--cam:update()
if lvls[cur_lvl].cls then
cls(lvls[cur_lvl].cls)
else
cls(0)
end
camera(cam:cam_pos())
if p1.pipe!=nil then
p1:draw()
end
if(lvls[cur_lvl].pal!=nil)push_pal(pals[lvls[cur_lvl].pal])
for o in all(objs) do
if o.layer==0 then
o:draw() --1%
end
end
map(0,0,0,0,32,446) --22%
for o in all(objs) do
if o.layer==1 then
o:draw() --1%
end
end
if(lvls[cur_lvl].pal!=nil)pop_pal()
for o in all(fireballs) do
o:draw()
end
if p1.pipe==nil then
p1:draw()
end
--for v in all(debug_points) do
-- pset(v[1],v[2],8)
--end
--debug_points = {}
--hud
camera(0,0)
set_coin_pal()
sspr(64, 72, 16, 16, 64-10, 0, 8,8)
pop_pal()--coins
printo("x "..p1.coins,64,2,7,1)
--[[
if lvl_pal!=nil then
for i=1,#lvl_pal,2 do
pal(lvl_pal[i],lvl_pal[i+1],1)
end
end
--]]
--printc("built with",64,4,7,0,0)
--printc("adv. micro platformer",64,12,7,0,0)
elseif state==s_gameover then
cls(0)
printc("game over",64,64,7,1,0)
end
--print("fireballs:"..#fireballs,0,12,7)
--mem_high=(stat(0)>mem_high) and stat(0) or mem_high
--print("mem:"..flr((stat(0)/2048)*100).."% ^" .. flr((mem_high/2048)*100).."%",0,0,7)
--cpu_high=(stat(1)>cpu_high) and stat(1) or cpu_high
--print("cpu:"..flr(stat(1)*200).."% ^"..flr(cpu_high*200).."%",0,6,7)
--print("#objs:"..#objs,0,12,7)
--print("#objs_queue:"..#objs_queue,0,18,7)
end
--mem_high=0
--cpu_high=0
__gfx__
00000000000009990000008888800000000000888880000000000000000000000000008888800000000008888800000000000044440000000000000000000000
00000088888009990000088888888800000008888888880000000008888800000000588888888000000088888888800000000444444000000000000000000000
00000888888888990000055599590000000005559959000000000088888888800005555559590000000055599590000000004444444400000000093333900000
00000555995905550000595999599900000059599959990000000055599590000099599599999900000595999599900000044444444440000000339999330000
00005959995995550000595599959990000059559995999000000595999599900099599559955990000595599959990000411444444114000003393333933000
0000595599959995000055999955550000005599995555000000059559995999000995999999550000055999955550000444f144441f44400003933333393000
0000559999555550000000999999900000000099999990000000055999955550000088855589900000000999999900000444f111111f44400039333333339300
0000009999999500000555588550000000000558555000000000000999999900000889995885550000005585550000004444f1f44f1f44440093933333393900
0055555855585000099555588855599900005555885500000000005555850900000859995555550000055585585550004444fff44fff44440933393333933390
05555555855580050999055898885599000055588988900000000955555599900008889955555500005555888855550044444444444444440333339999333330
99555555888880050990088888880050000055558888800000009985555599000000888885555000009958988985990004444ffffff444407773393333933777
9990885889889855000088888888855000008559998880000000558888888000000085558888000000999888888999000000ffffffff00007777933333397777
0905888888888855000888888888855000000859988800000000588888888000000005555888000000998888888899000011ffffffff00000007733333377000
005558888888885500558880008885500000008885550000000558880888000000505885558000000000888008880000011111fffff110000000773333770000
0555888888800000005550000000000000000055555550000005000055500000005555580000000000055500005550000111111fff1110000000077777700000
05008888000000000005550000000000000000555500000000000000555500000005555000000000005555000055550000111110011100000000007777000000
00000000000099900000008888800000000000000000000000000000000000000000008888888000000000888880000000000000000000000000000000070000
00000000000995990000888888900000000008888800000000000000000000000055888888899000000088888890000000000000000070000000000000777000
00000088888995590008888889900000000888888900000000000008888800000555888888890000000888888990000000000000000777000000000000777900
00008888888999990008888888888800008888889900000000000888888900000995599588888800000888888888880000000000009777000000000009773900
00088888888555550005559959990000008888888888800000008888889900009999599599599880000555995999000000000000099773900000000009773990
00088888888888550059959955999900005559959990000000008888888888809999599599559000005995995599990000000000099773900000000009773990
00055599599955550059955999999990059959955999900000005559959990009959899959999990005995599999999000000000099773900000000009777990
00599599599999550559955999599990059955999999990000059959955999909595889999959999055995599959999000000000099777900000000009979939
00599559999999950559999955555500559955999599990000059955999999999958855995555999055999995555550000000000099979990000000009999999
00599559995999950555999995555500559999955555500000559955999599990008555999955550055599999555550000000000099999390003333309900999
05599999555555500005599999999000055999995555500000559999955555500088555559999900000559999999900000033333009999990039333937900099
05555999955559500000055599000000005599999999000000055999995555500085599955888550000089999950000000393339309909990033939337990000
00055999999995500000888855800090000888899000000000000599999999000085999998885550000058555585000003339393309900990377393333799000
00008888558555500005555885580999005855885500000000005888999000000085999995585550000558555585500003773933337990990373939333799990
05555558858555000055555588585999058555588500000000058555850000000000999995555555005558555585550003739393337990900939333939799900
55555555855855000555555588558999058555588550000000058555585000000088895995555555055558555585555009393339397990000393333393779000
55555555885850000555555588558595058555588850000000558555558899000088889955555555055588555588555003933333937799000939333939379000
55995555885580000555555888558550058555559950000000588555555599990088888885555555555588555588555509393339393790000333939333979000
59999558888590005555558889859500058555599990000000588855555599990008888888555555555588888888555503339393339790000333393333370000
99999588898880005555888888888000088555599998000000088855555559990000555888885550555589888898555503333933333700007773939333770000
99999888888880009999988888888000088855599998800000088885555559990000055555888880999988888888999977739393337700000977733977790000
90998888888880059999988888888005088885599988800000088888855580000055555555888880999988888888999900777339777990000999777779990000
09988888888880559999888888888055088888855888800000088888888880000059999555588800099988888888999009997777799999000999000099900000
00088888888855550999888888855555008888855588000000088888888850000059999995580000099888888888899099990000009999900099900999000000
00058888888855550008588888855555000888555555000055558888888588000000888899500000008888888888880000000000000000000000000000888800
55585588888855550058858888855555000885555550000055558888855888005008888888000000088888800888888000000000000000888880000008899880
555888558888555555588855888555550000885555000000555588885888800055005888800000000888880000888880000000000009988888889900889f9980
55588888008855555555888800055555000058885550000055558880088880005555555880000000088888000088888000000000099959599595999989f99880
55588888000000005555580000000000000055550550000055550000055550000555555500000000005555000055550000000000099559599595599989988800
55588880000000000555000000000000000555550000000055000000055550000055555500000000005555000055550000000000099555999955599988980008
55000000000000000555000000000000000555555500000050000000055555500005555000000000555555000055555500000000000555599555550008880800
50000000000000000055500000000000000005555500000000000000055555500000555000000000555555000055555500000000000059555595500000888080
4ffffffff14ffff4ffffffff44444441777777777777777714444444444444411444444444444441777777770000001111000000000059999995500000888800
f444444441f444414444444144444441077777777333337749999999999999914222222222222221777777770000017777100000000888999988880008899880
f444444441f44441444444414444444100777777337373374919999999999191421222222222212177777777000117777771000000558855558855508899f988
f444444441f444411111111111111111000777773773773749999444449999914222222222222221777777770017777777710100005558855885555088889f98
f444444441f144414441444444414444000077773733373749994411144999914222222222222221777777770017777777771710005558988985555080089998
f444444441411114444144444441444400000777333733374999441994419991422222222222222177777777001777777c777771005558888885555008088988
f444444441fffff144414444444144440000007733333337499944199441999142222222222222217777777701777cc777c77771000558888885550080008880
f444444441f444411111111111111111000000077733377749999119444199914222222222222221777777771777c77777777771000000000000000000800000
f444444441f44441777777770000001111000000b000000049999994411199914222222222222221000001111001000077777100000599559999999900000000
f444444441f4444188888888000001b333100000b000000049999994419999914222222222222221000017771017100077777710005599559995999900000000
114444441f4444419900009900001b3333310000b000000049999999119999914222222222222221000177777177100077777771005599999555555000000000
ff1144441f4444419000008900001b3333310000b000000049999994499999914222222222222221000777777777101077777770000559999955999900000000
f4ff1111f4444441900000890000133333310000b000000049999994419999914222222222222221011777777777717177777110000005995559999000000000
f444fff1f4444441998888990000133333310000b000000049199999119991914212222222222121177777777777777117711000000058855555990000000000
f4444441f4444411999999990000013333100000b000000049999999999999914222222222222221177777777777777101100000000588555555900000000000
41111114f1111114888888880000001111000000b000000011111111111111111111111111111111017777777777771000000000000585555550000000000000
1111111111111111111111111111111133333133000000010000000000000000000000000008008800177c77777777777c777777000585555585000000000000
1bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1333311130000001300000000000000000000800008008888000177c77c777777c7777777000585555885000000000000
133333bbbbbb333333333333333333313333111300000133000000000000000000000808008888890000177cccc777cccc7777c7000088558885500000000000
1bbb33bbbbbb3bb3333333333b3b3bb13333111300001333000000000000000000008888808898980000177777cccccc7ccccc77000088888888500000000000
1bbb33bbbbbb3bb33333333333b3bbb1311311130001333300000000000000800080898900898999000001117777cc7777ccc777000088888988800000000000
1bbb33bbbbbb3bb3333333333b3b3bb131133133001333330000011100008088000889f908889f9f000000001777777177777777000888888888800000000000
1bbb33bbbbbb3bb33333333333b3bbb131133333013333330011133300000889000899ff88989fff000000000117771011777711000888888888800000000000
1bbb33bbbbbb3bb3333333333b3b3bb131133333133333331133333300008899008889ff88899fff000000000001110000111100000888888888800000000000
1bbb33bbbbbb3bb33333333333b3bbb1000000999900000000007777000000090000000000000000000000000000000000000000000000000000000000000000
1bbb33bbbbbb3bb3333333333b3b3bb1000009999440000000777777000000090000000000000000000000000000000000000000000000000000000000000000
1bbb33bbbbbb3bb33333333333b3bbb1000099994444000007779999000000990000099991100000000000000000000000000000000000000000000000000000
1bbb33bbbbbb3bb3333333333b3b3bb1000999994444400077999444000000990000999999110000000000000000000000000000000000000000000000000000
1bbb33bbbbbb3bb33333333333b3bbb1009999999444990077999444000009990000994499110000000000000000000000000000000000000000000000000000
1bbb33bbbbbb3bb3333333333b3b3bb1099444999999999007779999099999990009949919911000000000000000000000000000000000000000000000000000
11111111111111111111111111111111094444499999999000777777099999490009949919911000000000000000000000000000000000000000000000000000
00111111111111111111111111111100994444499999449900007777009999490009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb33333333b3bbb100994444499999444900000003000999490009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb333333333b3bb100999444999999944933300003000099990009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb33333333b3bbb100999999999999999903330003000099990009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb333333333b3bb100094447777774449003333003000999990009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb33333333b3bbb100000077777777000000333303000999990009949919911000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb333333333b3bb100000077777797000000333303000999900000991199110000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb33333333b3bbb100000077777797000000033333009990000000999999110000000000000000000000000000000000000000000000000000
001bbb33bbbbb3bb333333333b3bb100000007777970000000000033009900000000099991100000000000000000000000000000000000000000000000000000
00000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000370003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00003330037770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00007330033700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00033370073377000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00033330333770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00737330733337700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00333330337337000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00333730333330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00373330373333700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00333370333373700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00373330073333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00033730033733300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00033330003333700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00007370000373330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000030000003730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
99000009990000090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
93990009939900090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
09399009093990090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
09939909099399090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00993909009939090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00999399009993990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00099999000999990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000099000000990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094000000990000007400000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000094000009999000007400000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000944400099999900077740000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000944400099749900077740000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000944400997994990077740000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000944400997994990077740000009000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000744400997994990077740000007000
__label__
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc000000000000000c00000ccc00000000000000000cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc077707070777070c07770ccc07070777077707070cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc070707070070070c00700ccc07070070007007070cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc077007070070070cc070cccc07070070c07007770cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc07070707007007000070cccc07770070007007070cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc07770077077707770070cccc07770777007007070cccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccc00000000000000000000cccc00000000000000000cccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccc0000000000000ccccccc000000000000000000000ccc0000000c000000000000000000000000000000000cccccccccccccccccccccc
ccccccccccccccccccccc0777077007070ccccccc077707770077077700770ccc0777070c077707770777007707770777077707770cccccccccccccccccccccc
ccccccccccccccccccccc0707070707070ccccccc077700700700070707070ccc0707070c070700700700070707070777070007070cccccccccccccccccccccc
ccccccccccccccccccccc0777070707070ccccccc07070070070c077007070ccc0777070c077700700770070707700707077007700cccccccccccccccccccccc
ccccccccccccccccccccc0707070707770000cccc070700700700070707070ccc07000700070700700700070707070707070007070cccccccccccccccccccccc
ccccccccccccccccccccc0707077700700070cccc070707770077070707700ccc070c077707070070070c077007070707077707070cccccccccccccccccccccc
ccccccccccccccccccccc000000000000c000cccc00000000000000000000cccc000c000000000000000c000000000000000000000cccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
44444444444441ccccccccccccccccccccccccccccccccccccccccccccccccffffffffffffffff1444444444444441ffffffffffffffff1444444444444441ff
99999999999991cccccccccccccccccccccccccccccccccccccccccccccccc444444414444444149999999999999914444444144444441499999999999999144
19999999999191cccccccccccccccccccccccccccccccccccccccccccccccc444444414444444149199999999991914444444144444441491999999999919144
99944444999991cccccccccccccccccccccccccccccccccccccccccccccccc111111111111111149999444449999911111111111111111499994444499999111
99441114499991cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449994411144999914441444444414444499944111449999144
99441994419991cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449994419944199914441444444414444499944199441999144
99441994419991cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449994419944199914441444444414444499944199441999144
99911944419991cccccccccccccccccccccccccccccccccccccccccccccccc111111111111111149999119444199911111111111111111499991194441999111
99999441119991cccccccccccccccccccccccccccccccccccccccccccccccc444444414444444149999994411199914444444144444441499999944111999144
99999441999991cccccccccccccccccccccccccccccccccccccccccccccccc444444414444444149999994419999914444444144444441499999944199999144
99999911999991cccccccccccccccccccccccccccccccccccccccccccccccc444444414444444149999999119999914444444144444441499999991199999144
99999449999991cccccccccccccccccccccccccccccccccccccccccccccccc111111111111111149999994499999911111111111111111499999944999999111
99999441999991cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449999994419999914441444444414444499999944199999144
19999911999191cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449199999119991914441444444414444491999991199919144
99999999999991cccccccccccccccccccccccccccccccccccccccccccccccc444144444441444449999999999999914441444444414444499999999999999144
11111111111111cccccccccccccccccccccccccccccccccccccccccccccccc111111111111111111111111111111111111111111111111111111111111111111
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc999ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc88888cc999ccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc88888888899ccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc5559959c555ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc595999599555ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc595599959995ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc55999955555cccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc99999995ccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc55555855585cccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc555555585558cc5ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc9955555588888cc5ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc999c885889889855ccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc9c5888888888855ccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc55588888888855ccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc5558888888cccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc5cc8888ccccccccccccccccccccccccccccccccccccccccccccccccc
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
fffffff14ffff44ffffffff14ffff44ffffffff14ffff44ffffffff14ffff44ffffffff14ffff44ffffffff14ffff44ffffffff14ffff44ffffffff14ffff44f
44444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f4
44444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f4
44444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f4
44444441f14441f444444441f14441f444444441f14441f444444441f14441f444444441f14441f444444441f14441f444444441f14441f444444441f14441f4
44444441411114f444444441411114f444444441411114f444444441411114f444444441411114f444444441411114f444444441411114f444444441411114f4
44444441fffff1f444444441fffff1f444444441fffff1f444444441fffff1f444444441fffff1f444444441fffff1f444444441fffff1f444444441fffff1f4
44444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f4
44444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f444444441f44441f4
44444441f44441f444444441f44441f4440000000000010000444440000000f4440000000004410000000000004441f444444441f44441f444444441f44441f4
4444441f444441114444441f4444411144070700770701077004440077777001440777007704410777070707700441114444441f444441114444441f44444111
1144441f444441ff1144441f444441ff1107070707070107070444077070770f110070070704410707070707070441ff1144441f444441ff1144441f444441ff
ff1111f4444441f4ff1111f4444441f4ff077707070701070701110777077704ff1070070704410770070707070441f4ff1111f4444441f4ff1111f4444441f4
44fff1f4444441f444fff1f4444441f44407070707070007070ff1077070770444f070070704410707070707070441f444fff1f4444441f444fff1f4444441f4
444441f4444411f4444441f4444411f444070707700777077704410077777004444070077004110707007707070411f4444441f4444411f4444441f4444411f4
111114f111111441111114f1111114411100000000000000000114f00000004111100000001114000000000000011441111114f111111441111114f111111441
__gff__
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002010101010101010101010000000000000000000000000000000000000000000101050500008383010100000000000001010500000083830101000000000001
0101010100000000000000000000000001010101000000008888000000000000010100010000000088880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__map__
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000969700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000969700000000000000009697000096970000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__sfx__
011200200a135161450713513145081351414507100071000710013100131000a1000a13516145071351314508135141450810008100141001410014100141001f3001f3001f3000030000300003000030000300
01120020031350f145001350c145011350d1450f1000f10000100001000010000100031350f145001350c145011350d14501100011000d1000d1050d1450c1350b1451f3001f3000030000300003000030000300
010e00000e1000e0050e1000e005021050e1050e1000e00500100001000e1000e0050e1000e005001000010013100131051310500100001000010000100001000710007100071050010000100001000010000100
010a00003c6153c0053c6053c005186103c0053c6153c0053c0053c005186103c0053c6153c0053c0053c0053c6153c0053c0053c0053c0053c0053c0053c0053c6153c0053c6153c0053c615000053c61500005
011300002433500000000001f33500000000001c33500000000002133523305233350000022335213350c0231f33528335283052b3352d33500000293352b335000002833500000243352633523335000000c023
011300001c325000000000018325000000000013325000000000018325000001a3250000019325183250c0030c0231f32500000233253c6150000021325233250c0031f325000001c3253c6151a325000000c003
01130000131353f2150c000101353c6153f2150c1350c0000c023111353f215131353c61512135111353f21510135181353f2151c1351d135180001a1351c1350c023181353f215151351713513135071043f215
010c0000243301a015243301a015243301a0151a015243301a015243301a0151a015243301a015243301a01523330180352333018015233301803518015233301801523330180151803523330180352333018035
01130000000002b3052b3352a33529335273353f215283350c0232033521335243353c61521335243352633500000000002b3352a335293352733528305283350000030335070003033530335000000000000000
001300000c0233f205283252732526325233053f205243050c0031c3051d3251f3253c605183251c3251d3250000000000283252732526325233052430524325000002b325003002b3253c615000000000000000
01130000001353f21500000071353c615233250c13524325051351c3253f2150c1350c1353f215051353f215001353f2153f215041353c61523325071350c1350c023293253f21529325293253f215071353f215
01130000000002b3052b3352a335293352733500000283350c0232033521335243353c6152133524335263350000000000273352a30529305263352830528305243353030507000283053c615000000000000000
001300000000000000283052732526325233053f215243050c0031c3051d3251f3253c605183251c3251d32500000000002032527305263051d32524305243051c3352b305003002b3053c6053f2050000000000
01130000001353f21528325071353c615233250c13524325051351c3253f2150c1350c1353f215051353f215001353f215081353f2153c6150a1353f2150c1050c1350c1053f21507135071353f215001353f215
011300002433524335000002433500000243352633500000283352433500000213351f335000003f2150000024335243350000024335000002433526335283350c023000003f2050c023000003f6153f6153f615
011300000c0232030500000203253c6052032522325000001f3251c305000001c32518325000003f205000000c0232030500000203250000020325223251f3250c003000003f2050c003000003f6053f6053f605
0113000008135203253f2150f1353c6153f2151413500000131351c325000000c1353c6153f615071353f6150813520325336150f135306153f215141351f3251313500000000000c13500000000000713500000
0110000013334183341c3341f33424334283342b3342b3302b33014334183341b3342033424334273342c3342c3302c330163301a3341d3342233426334293342e3342e330163002e3352e3352e3353033030330
0113000008135203253f2150f1353c615203251413500000131350c023000000c1353f6153f605071353f6150e1350e1353f6150e135000000e1350e135000001313500000000000c023071353f6153f6153f615
011300002433524335000002433500000243352633500000283352433500000213351f335000003f2150000028335283350000028335000002433528335000002b3350000000000000001f335000000000000000
011300000c0232030500000203253c6052030522325000001f3251c325000001c32518325000003f205000000c0231e325000001e325000001e3251e325000002332500000000000000013325000000000000000
011300002833524335000001f3353f6150000020335000002133529335000002933521335000003f21500000233352d335000002d3352d3352b3350000029335283352433524305213351f335000003f21500000
011300002432521325000001c3253f605000001d325000001d3252432500000243250c135000003f205000001f3252932500000293253f6152832500000263252432521305000001d3053f615000003f20500000
01130000001353f2153f21506135071350c1050c1353f215051353f215051353f2153f6150c1350513505105021353f2150000005135071353f2150b1353f2150713521325071351d3250c1350c1350713500000
01130000001353f2153f21506135071350c1050c1353f215051353f215051353f2150c1350c135051353f215071353f215000000713507135091353f2150b1350c1353f215071353f215001350c1053f21500000
011300002833524335000001f3353f61500000203350000021335293350000029335213350000000000000002333529335000002933529335283350000026335243351c335243051c33518335000000000000000
011300002432521325000001c3253f605000001d325000001d3252432500000243253f6150000000000000001f3252632500000263253f6152432500000233251f32521305000001d3053f615000000000000000
010c00000e0301d3151d330150303c6101d3151d3151a0300c0331d3301d015150303c6101a3301a0300c0330c0301c3151c330130303c6101c3151c315180300c0331c3301c015130303c6101c015180300c033
0114002028335283352830028335280052433528335280052b3352b3052b305003001f3350030000300003002b3052b3052b305003002b3050030000300003001f3001f3001f3050030000300003000030000300
011400201e3251e3251e3001e3251e0051e3251e325003002332523305230050000013325000000000000000233052330523005000001f3050000000000000001330013300130050000000000000000000000000
011400200e1350e1353c6050e1353c6050e1350e13500100131351310513105001000713500100001000010013105131051310500100131050010000100001000710007100071050010000100001000010000100
010a00003c6053c0053c6053c005186003c0053c6053c0053c0053c005186003c0053c6053c0053c0053c0053c6053c0053c0053c0053c0053c6053c6053c6053c6053c0053c6053c0053c605000053c60500005
011200200a325163250732513325083251432507100071000710013100131000a1000a32516325073251332508325143250810008100141001410014100141001f3001f3001f3000030000300003000030000300
01120020033250f325003250c325013250d3250f1050f10500105001050010500105033250f325003250c325013250d32501105011050d1050d3050d3250c3250b3251f3051f3050030500305003050030500305
010d00000a1450a725001050d1400d725001050c1400c725001050614006725001050514005725001050b1400b725001050a135101450f1350e145141351314512135001000d1450010009145001000814507305
010d00000a3200a7050a0050d3200d100003000c32000300003000632000300003000532000300003000b32000300003000a320103200f3200e320143201332012320003000d3200030009320003000832000305
010e00200714500105061450d10500105001050c10500105001050610500105001050510500105001050b10500105001050a305103050f3050e305143051330512305000000d3050000009305000000830507305
010e00200732000305063200d10500105001050c10500105001050610500105001050510500105001050b10500105001050a305103050f3050e305143051330512305000000d3050000009305000000830507305
01120000030300303003030030300303003030030300303002030020300203002030060300603006030060300503005030050300503005030050300503005030040300403004030040300a0300a0300a0300a030
010900000903009030090300903009030090300903009030040300403004030040300403004030040300403003030030300303003030030300303003030030300403004030040300403004030040300403004030
011200001f317223171f317213171f317203171f317213171f317223171f317233171f317223171f317213171e317213171e317203171e317213171e317223171e317213171e317223171e317213171e31720317
010900002231726317223172731722317263172231725317223172631722317253172231724317223172531722317263172231727317223172631722317253172231726317223172531722317243172231725317
0108000023330233202933029310130151301529330293252933029325293002833028325283002633026325263002433024325243000030000300003000030000300183130c3310030000300003000030000300
0108000013030130251f313133312631312331130301302513030130251d00015030150251c00017030170251a0001f3130a3311c3131333113030130201c313103310c0300c0200c00000000000000000000000
01100000000001032013320183201c3201f320243202432024320283000f32014320183201b320203202432024320243202030011320163201a3201d320223202632026320223001a3251a3251a3251c3201c320
010a00002433424330000000000000000000001f3341f330000000000000000000001c3341c3301c3301c33021334213302132023334233302332021334213302132020334203302032020320223342233022320
010f000022320203342033020320203201f3341f3301f3301f3301f3301f3321f3351f3001f300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010a00001c3341c33000000000000000000000183341833000000000000000000000133341333013330133301d3341d3301d3301d3301d3301d3301d3301d3301d3301d3341d3301d3301d3301d3301d3301d330
010b00201033020337230172033520330203301133021330213102133524017213171233022330223102233522330223301f030130101f036130361f036130361f036130361f0361300700000000000000000000
010a00001303013030000000000000000000001003010030000000000000000000000c0300c0300c0300c0301103011030110301103011030110301103011030110300d0300d0300d0300d0300d0300d0300d030
011000000d0300d0300d0300d0320d0320c0300c0300c0300c0220c0220c0120c0150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010b00201c33026330263102633526330263301d33027330273102733527330273301e33028330283102833528330283302933029310293262332629326233262932623326293262330000000000000000000000
01040000103500c3510e3501035010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
01020000133551f3552b3553735537305003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000000
010200002406025051270412f0002b0512c0512d0412e0312f0212f0052f00032000030000000037000370002f0002f0002f0002f000000003300004000000000000000000000000000000000000000000000000
01020000346500513000605396500a130006053365004130006053865009130006053265003130006053765008130006053165002130006053365004130006000060000600006000060000600006000060000600
01030000343502d350343502d35028350213501c35015350103500a35004350343502d350343502d35028350213501c35015350103500a35004350343502d350343502d35028350213501c35015350103500a350
01050000183401f340203401934020340213401a34021340223401b3402234023340003000030000300003000030000300003001a30021300223001b300223002330000300003000030000300003000030000000
01040000244401f44024440284402b440304402b4402044024440274402c440274402c440304403344038440334402244026440294402e440294402e44032440354403a440354400040000400004000040000400
01100000373553c35534c703c3553e35537c700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0104000015320163201732018320193201a3201b3201c3201d3201e3201f320203202132022320233202432025320263202732028320293202a3202c3202d3202f32030320323203332035320363203832039320
010400002f3502f3502f3503435034350343503434034340343403434034340343303433034320343203432034310343103431500300003000030000300003000030000300003000030000300003000030000300
010200001f3601f3602233022330214312133023360233601f450214512130021300233012330023300233001f4001f4001f4001f405214002130523300233051f4002040122401233001f400000000000000000
0103000021360213602135021350213502135022340233302432025320263202732028320293202a3202b3102c3102d3100000000000000000000000000000000000000000000000000000000000000000000000
__music__
00 1c1d1e03
01 04060547
00 04060547
00 080a0947
00 0b0d0c47
00 08090a47
00 0b0c0d47
00 0e100f51
00 13121451
00 04050647
00 04050647
00 1517165b
00 19181a5b
00 1517165b
00 19181a5b
00 0e100f51
00 13121451
00 1516175b
02 191a185b
01 00204302
00 01214302
00 22234344
02 24254342
03 071b6869
00 3e6d6a67
04 2a2b6c67
00 2d316f67
04 2e327067
01 26285167
02 27296c67
00 3c7b7167
04 112c7044
04 33304344