0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3?0000000000000000000000@/NwOgO0O0OOO@@@@@@@@@@@@@@@@@@@@@@ÀFxGlH0J0KOO@@@@@@@@@@@@@@@@@@@@@@ ð0P0N@@@@@@@@@@@@@@@@@@@@@@@@@@@@@C, €€€ ` d c b a d b d c b a d c b adcbaaa d c b a d c b adcbn0a d c b adb„ƒ‚„‚„ƒ‚„‚„ƒ‚„‚dcba b a a a b a b a a a b a a abaaaaa b a a a b a a abaaa d c b adb„ƒ‚„‚„ƒ‚„‚„ƒ‚„‚dcba d c b a d b d c b a d c b adcbaaa d c b a d c b adcba d c b adb„ƒ‚„‚„ƒ‚„‚„ƒ‚„‚dcba„‚„ƒ‚ „ ƒ ‚ „ƒ‚'0Ic b a a c b c b a a c b a a÷cbaaaa c b a aKc b a acbaa c b a acbƒ‚ƒ‚ƒ‚ƒ‚ƒ‚ƒ‚ƒ‚cbaaƒ‚ƒ‚ ƒ ‚ ƒ‚ùc b a b c b a a c b a a c bGcbaaaa c b a aûc b a acbaa c b a acbƒ‚ƒ‚ƒ‚ƒ‚ƒ‚ƒ‚ƒ‚cbaaƒ‚ƒ‚ ƒ ‚ ƒ‚ð€ €A €b€ €B€ €B €bùŸá€ €á€ €á€ €áù( ( ( ( € % % € % % € % % % € % % € G & E € & & G € G & ' € & & À C' E ' À C&%@fDG%G Dh@o g@'`E„‚„ƒ‚ „ ƒ ‚ „ƒ‚ a a a a a a a a a a a a a aaaaaaa a a a a a a a aaaaa a a a aaa„‚„ƒ‚ „ ƒ ‚ „ƒ‚ d b c a d b d b c c c c d ccdaaaa a a a a a a a aaaaa a a a aaa d c b adb„ƒ‚„‚„ƒ‚„‚„ƒ‚„‚dcba Á¿ €¿ €°tâ>0T•Ê0Î0ÊÀ8KÐ<ÊÀ8_Ð<% L 0L L ãL ãL ãL!3Q 3QŠQŠQŠQŠQ 3Q 3Q 3U3Y þ:ü §'W=240 H=136 STEP=7 songs={ {0,"beach",1}, {1,"slow",2}, {2,"fast",2}, {3,"end",3} } song=0 s={} s.fl=0 s.orw=0 s.row=0 s.total=0 offx={} offy={} prg_parts={} def_pal={ {0x1a,0x1c,0x2c}, {0x5d,0x27,0x5d}, {0xb1,0x3e,0x53}, {0xef,0x7d,0x57}, {0xff,0xcd,0x75}, {0xa7,0xf0,0x70}, {0x38,0xb7,0x64}, {0x25,0x71,0x79}, {0x29,0x36,0x6f}, {0x3b,0x5d,0xc9}, {0x41,0xa6,0xf6}, {0x73,0xef,0xf7}, {0xf4,0xf4,0xf4}, {0x94,0xb0,0xc2}, {0x56,0x6c,0x86}, {0x33,0x3c,0x57} } gra_pal={ {0x1a,0x1a,0x1a}, {0x5d,0x5d,0x5d}, {0xb1,0xb1,0xb1}, {0xef,0xef,0xef}, {0xff,0xff,0xff}, {0xa7,0xa7,0xa7}, {0x38,0x38,0x38}, {0x25,0x25,0x25}, {0x29,0x29,0x29}, {0x3b,0x3b,0x3b}, {0x41,0x41,0x41}, {0x73,0x73,0x73}, {0xf4,0xf4,0xf4}, {0x94,0x94,0x94}, {0x56,0x56,0x56}, {0x33,0x33,0x33} } bla_pal={ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} } whi_pal={ {0,0,0}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff} } flr=math.floor rnd=math.random cos=math.cos sin=math.sin PI=3.1415 playing=false ended=false function pal(i,r,g,b) --sanity checks if i<0 then i=0 end if i>15 then i=15 end --returning color r,g,b of the color if r==nil and g==nil and b==nil then return peek(0x3fc0+(i*3)),peek(0x3fc0+(i*3)+1),peek(0x3fc0+(i*3)+2) else if r==nil or r<0 then r=0 end if g==nil or g<0 then g=0 end if b==nil or b<0 then b=0 end if r>255 then r=255 end if g>255 then g=255 end if b>255 then b=255 end poke(0x3fc0+(i*3)+2,b) poke(0x3fc0+(i*3)+1,g) poke(0x3fc0+(i*3),r) end end function subpix(i,a,f) local p=peek4(i+f) poke4(math.min(i-f,0x3fbf*2+1),math.max(p-a,0)) end function addpix(i,a,of) local p=peek4(i-of) poke4(math.min(i+of,0x3fbf*2+1),math.min(p+a,15)) end function lerp(a, b, t) return a + (b - a) * t end function lerp_pal(pl,t) local p={} local r,g,b,rr,gg,bb=0,0,0,0,0,0 for i=0,15 do p=pl[i+1] rr,gg,bb=pal(i) r=lerp(rr,p[1],t) g=lerp(gg,p[2],t*1.5) b=lerp(bb,p[3],t*2) pal(i,r,g,b) end end function set_pal(pl) local p={} for i=0,15 do p=pl[i+1] pal(i,p[1],p[2],p[3]) end end text={ "oh no another faerjan is almost lost at sea be quick and send a search and resque demoparty to save the faerjan lost at sea and claim your rightful place as the farjan compo master who saved the farjan from a certain destruction", "thankfully not all is lost now since you're reading this message and as such are doing your part in aiding the search and rescue team sent over to the dire situation our little farjan is currently in in the waves of the vast sea", "if for some reason this text is flying past too quick it means the little farjan has boosted their distress signal and as such have increased the speed at which the communication is handled at as to get the information out quick", "it seems we can't reach any seaworthy vessel near the farjan and are sad to conclude this intermission by accepting the fact that the farjan will be sinkng shortly and can't be helped at this moment in time as we have no vessels", } for i=0,15 do pal(i,0,0,0) end cls() vbank(1) for i=0,15 do r=0x3b+i*i g=0x5d+i*i*1.5 b=0xc9+i*i*2 pal(i,r,g,b) end pal(15,0,0,0) cls() vbank(0) rowf=0 function BOOT() prg_parts={ prt_beach, prt_slow, prt_fast, prt_credits } for i=0,H+20 do offx[i+1]=0 offy[i+1]=0 end end function TIC() if s.total<1300 then update_music(false) s=update_sync(s) poke(0x3ffb,s.row%8+1) t=time()//6 prg_parts[song+1](s) else s=update_sync(s) prt_credits(s) end if song==3 then s.total=1300 end end function BDR(i) if s.total<1300 then poke(0x3ffa,0) poke(0x3ff9,rnd(1+math.max(0,s.total-800)//10)-1) else offx[i+1]=lerp(offx[i+1],offx[i+1]*.9+rnd(-4,4),.3) offy[i+1]=lerp(offy[i+1],offy[i+1]*.9+rnd(-2,2),.3) poke(0x3ff9,offx[i+1]) poke(0x3ffa,offy[i+1]) end end function prt_credits(s) t=time()/30 poke(0x3ffb,0) if not ended then music(3) ended=true end if s.fram>0 then set_pal(def_pal) cls() five(W/2,H/2,60,t/100,1,3,1) credit_text(4,2,1) vbank(1) cls() set_pal(def_pal) credit_text(12,3,1) vbank(0) else if t%4>=2 then set_pal(whi_pal) else set_pal(gra_pal) end end end function credit_text(c1,c2,sc) local p={W/4-30,H/3} p=cprint(" Faerjanverse keeps on growing",p,c1,c2,sc,1,1) p=cprint(" Even though ",p,c1,c2,sc,1,1) p=cprint(" a lot of the ships ",p,c1,c2,sc,1,1) p=cprint(" keep sinking ",p,c1,c2,sc,1,1) end function prt_beach(s) vbank(1) cls() vbank(0) lerp_pal(gra_pal,math.min(s.fl*0.005,0.03)) local row,fram=s.row,s.fram local t=time()//12 rowf=lerp(rowf,row,0.02) rectb(0,0,W,H,15) circ(W-10-sin(t*.005)*8-cos(t*.002)*3,10+cos(t*.0051)*9+sin(t*.002)*4,30,0) circ(W-10-sin(t*.005)*8,10+cos(t*.0051)*9,30,4) for i=0,W*H,STEP do subpix(i-t%STEP,rnd(2),(10-rnd(20))) if rnd(50)>49 then poke4(i-t%STEP,rnd(4)) end end for i=0,6 do ii=i*1.2 arect(W/2,H-sin(t*.02+.9+ii*.31)*H/8+(16-rowf)*4,W,H/3,sin(t*0.02+ii*.31)*.2,11-ii/3) end viking(W/2-cos(t*.023)*2,H/2-sin(t*.021)*6-(20-s.fl)*5,PI/4+sin(t*.013)*.1) --viking(W/2,H/2,PI/4) end function viking(x,y,a) arect(x,y,20,20,a,12) arect(x,y+2,14,14,a,1) arect(x,y,14,14,a,4) arect(x-10,y,6,2,a,1) arect(x,y-10,6,2,a,1) arect(x-5,y-5,6,2,a,1) arect(x+9,y+9,2,8,a,1) arect(x+12,y+2,2,6,a+PI/4,1) end function prt_slow(s) if s.total<186 then lerp_pal(def_pal,.02) else lerp_pal(bla_pal,.008) end local row,fram=s.row,s.fram local t=time()//8 rowf=lerp(rowf,s.tr,0.02) rectb(0,0,W,H,15) circ(W-10-sin(t*.005)*8-cos(t*.002)*3,10+cos(t*.0051)*9+sin(t*.002)*4,30,0) circ(W-10-sin(t*.005)*8,10+cos(t*.0051)*9,30,4) for i=0,W*H,STEP do subpix(i-t%STEP,rnd(2),(10-rnd(20))) if rnd(50)>49 then poke4(i-t%STEP,rnd(4)) end end for i=0,2 do ii=i*1.2 arect(W/2,H-sin(t*.02+.9+ii*.31)*H/8,W,H/3,sin(t*0.02+ii*.31)*.2,11-ii/3) end arect(W/2+cos(t*0.009)*H/11,H/3*2-sin(t*0.02+.9)*H/9-3-(256-rowf)/2,20,8,sin(t*0.02)*.1,12) arect(W/2+cos(t*0.009)*H/11,H/3*2-sin(t*0.02+.9)*H/9-(256-rowf)/2,20,3,sin(t*0.02)*.1,2) viking(W/2-cos(t*.023)*2,H/2-sin(t*.021)*6-(20-s.fl)*5+s.tr*.3,PI/4+sin(t*.013)*.1) for i=3,6 do ii=i*1.2 arect(W/2,H-sin(t*.02+.9+ii*.31)*H/8,W,H/3,sin(t*0.02+ii*.31)*.2,11-ii/3) end end function prt_fast(s) set_pal(def_pal) --rect(0,H/4*3-sin(t*.01)*H/6,W,H/2,10) local row,fram,total=s.row,s.fram//4,s.total-600 local t=time()/6 rectb(0,0,W,H,15) five(W/2,math.max(H/4,H/5*6-total*.4),80+(7-s.fl%8),s.fl*.005,0,2,8) five(W/2,math.max(H/4,H/5*6-total*.4),80+(7-s.fl%8),s.fl*.005,0,2,8) five(W/2,math.max(H/4,H/5*6-total*.4),80+(7-s.fl%8),s.fl*.005,0,2,8) for i=0,W*H,STEP do subpix(i-t%STEP,rnd(5),(rnd(20))) if rnd(50)>49-(7-s.row%8)*10 then poke4(i-t%STEP,rnd(4)) end end circ(W-10-sin(t*.005)*8-cos(t*.002)*3,10+cos(t*.0051)*9+sin(t*.002)*4,30+(7-s.fl%8),0) circ(W-10-sin(t*.005)*8,10+cos(t*.0051)*9,30+(7-s.fl%8),4) for i=0,2 do ii=i+row%8//3 arect(W/2,H-sin(t*.02+.9+ii*.31)*H/8,W,H/3,sin(t*0.02+ii*.31)*.2,11-ii/3) end arect(W/2+cos(t*0.009)*H/11,H/3*2-sin(t*0.02+.9)*H/9-3,20,8,sin(t*0.02)*.1,12) arect(W/2+cos(t*0.009)*H/11,H/3*2-sin(t*0.02+.9)*H/9,20,3,sin(t*0.02)*.1,2) for i=3,6 do ii=i+row%8//3 arect(W/2,H-sin(t*.02+.9+ii*.31)*H/8,W,H/3,sin(t*0.02+ii*.31)*.2,11-ii/3) end vbank(1) for i=W/4*3*H,W*(H) do subpix(i,2,rnd(2)) end w=print(text[fram+1],0,-1000,9,1,5) print(text[fram+1],(-t*5)%(W+w)-w-5,H/5*4-sin(t*.02)*6,(12-row%8)/8,1,5) print(text[fram+1],(-t*5)%(W+w)-w,H/5*4-sin(t*.02)*6,12-row%8,1,5) vbank(0) end function five(x,y,r,a,c,ii,rn) local i,k,t=0,0,a local x1,y1,x2,y2=0,0,0,0 local px,py={},{} for k=0,5 do px[k+1]=cos(t+k*2*PI/5)*r py[k+1]=sin(t+k*2*PI/5)*r end for i=0,ii do circb(x+r/30+rn,y+r/30+rn,r/5*4-i,c) end for k=0,10,2 do for i=0,ii do x1=px[k%5+1]+rnd(ii)*rn y1=py[k%5+1]+rnd(ii)*rn x2=px[(k+2)%5+1]+rnd(ii)*rn y2=py[(k+2)%5+1]+rnd(ii)*rn line(x+x1,y+y1,x+x2,y+y2,c-(i-1)/c) end end end function cprint(text,p,c1,c2,sc,mono,scale) local x,y,i=p[1],p[2],0 for i=1,sc do print(text,x,y+i,c2,mono,scale) print(text,x+i,y,c2,mono,scale) print(text,x,y-i,c2,mono,scale) print(text,x-i,y,c2,mono,scale) print(text,x+i,y+i,c2,mono,scale) print(text,x-i,y-i,c2,mono,scale) print(text,x+i,y-i,c2,mono,scale) print(text,x-i,y+i,c2,mono,scale) end print(text,x,y,c1,mono,scale) p[2]=p[2]+16*scale return p end function rot(p,a) local out={} out.x=p[1] out.y=p[2] out.x=cos(a)*p[1]-sin(a)*p[2] out.y=cos(a)*p[2]+sin(a)*p[1] return {out.x,out.y} end function arect(x,y,w,h,a,c) local p1,p2,p3,p4={x,y},{x,y},{x,y},{x,y} p1[1],p1[2]=w,h p2[1],p2[2]=-w,h p3[1],p3[2]=-w,-h p4[1],p4[2]=w,-h p1=rot(p1,a) p2=rot(p2,a) p3=rot(p3,a) p4=rot(p4,a) quad(x+p1[1],y+p1[2],x+p2[1],y+p2[2],x+p3[1],y+p3[2],x+p4[1],y+p4[2],c) end function quad(x1,y1,x2,y2,x3,y3,x4,y4,col) tri(x1-1,y1-1,x2-1,y2-1,x3-1,y3-1,0) tri(x3-1,y3-1,x4-1,y4-1,x1-1,y1-1,0) tri(x1,y1,x2,y2,x3,y3,col) tri(x3,y3,x4,y4,x1,y1,col) end function update_music(debug) if peek(0x13FFC)==255 and playing then song=songs[1+song][3] playing=false end if not playing then music(songs[1+song][1],-1,-1,false) --sfx(62,40,-1,0,15,6) playing=true end if debug or key(64) then if keyp(58) then playing=false song=song-1 end if keyp(59) then playing=false song=song+1 end end song=song%#songs end function update_sync(a) local track_data=0x13E64 local sound_state=0x13FFC local rows=peek(track_data+51*(songs[1+song][1]+1)-2) a.plen=64-rows -- pattern length a.orw=a.row a.row=peek(sound_state+2) if a.orw