0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3= 6 then cls(0) else cls(6) end end function rotatingsheepSCN() end angle = 0.1 displaymesh = mesh xoff = 65 yoff = -20 ydelta = 2 ydeltadelta = 0.2 stars = {} names = {"ToBach", "aldroid", "Church of the Spinning Cube", "superogue", "reality404", "dave84", "TUHB", "Mrs Beanbag", "mantratronic", "tea lovers committee", "slipstream", "NOVA orgas", "and you!"} allnames = "" for _,n in pairs(names) do allnames = allnames .. n allnames = allnames .. "\t\t\t\t\t\t\t\t\t" end for i=1,100 do px = math.random(240) py = math.random(136) stars[#stars+1] = {px,py} end function drawsheep(xoff,yoff,scale) table.sort(displaymesh,z_order) for i, tr in pairs(displaymesh) do x1,y1,z1 = project(tr.p1,xoff,yoff,scale) x2,y2,z2 = project(tr.p2,xoff,yoff,scale) x3,y3,z3 = project(tr.p3,xoff,yoff,scale) tri( x1, y1, x2, y2, x3, y3, tr.c) end end function rotatesheep() newmesh = {} for i, t in pairs(displaymesh) do newmesh[i] = {} for j, v in pairs(t) do if type(v) == "table" then tx = v.x * m.cos(angle) - v.z * m.sin(angle) ty = v.y tz = v.x * m.sin(angle) + v.z * m.cos(angle) newmesh[i][j] = {} newmesh[i][j].x = tx newmesh[i][j].y = ty newmesh[i][j].z = tz end newmesh[i].c = t.c end end displaymesh = newmesh end goingup = true goingdown = false initial = true sp=2 function rotatingsheepOVR() songframe = peek(0x13ffd) if songframe >= 5 then -- song frame number if songframe == 5 then yoff = yoff + ydelta ydelta = ydelta + ydeltadelta if yoff > 50 then ydelta = -ydelta-0.2 ydeltadelta = 0.5 end end if songframe == 6 and initial then yoff = 100 initial = false end if songframe == 7 then scenestarttime = t scene = scene + 1 end if songframe >= 6 and songframe <=8 then if goingup then yoff = yoff - 6 end if yoff < 10 then goingdown = true end if goingdown and yoff < 40 then -- going down! goingup = false yoff = yoff + 4 end for i, s in pairs(stars) do pix(s[1],s[2],12) if s[1] <= 10 then stars[i] = { 240, s[2] } else stars[i] = {s[1]-1,s[2]} end end end drawsheep(xoff,yoff,100) end rotatesheep() end -- only allows portions of the background to be visible local occluder = {x=25,y=25,r=25,dx=1,dy=1} function intro_occluder() cls(15) circ(occluder.x,occluder.y,occluder.r,0) occluder.x = occluder.x + occluder.dx occluder.y = occluder.y + occluder.dy if occluder.x+occluder.r > 240 or occluder.x-occluder.r < 0 then occluder.dx = -occluder.dx end if occluder.y+occluder.r > 136 or occluder.y-occluder.r < 0 then occluder.dy = -occluder.dy end end function ufobg() cls(0) songframe = peek(0x13ffd) -- starfield for i, s in pairs(stars) do pix(s[1],s[2],12) if s[1] <= 10 then -- stop making new stars when greets roll stars[i] = { 240, s[2] } else stars[i] = {s[1]-1,s[2]} end end if songframe >= 10 then for i=8,240,8 do for y=4,136,8 do circ(i+y/2, y, sin(i/16+(t/10))*4, (i%3)+9) end end end end ufo_yoff = -40 sheepsize = 100 ufox = 120 function ufoOVR() if ufo_yoff < 0 then ufo_yoff = ufo_yoff + 1 end songframe = peek(0x13ffd) movement = sin(t/10)*10 -- tractor beam if songframe == 7 then sectionstarttime = t end if songframe >= 9 then if ufo_yoff < 50 then ufo_yoff = ufo_yoff + 1 end print(allnames,240-(t-sectionstarttime-400),100,12) end if songframe == 8 and t-sectionstarttime<100 then tri(70,25,0,136,240,136,4) end -- sheep if songframe >= 8 and sheepsize > 0 then sheepsize = 100-(t-sectionstarttime) elseif sheepsize <= 0 then sheepsize = 0 else sheepsize = 100 end drawsheep(xoff,yoff,sheepsize) -- draw UFO elli(ufox,ufo_yoff+10+movement,30,10,13) -- pod for i=1,3 do spr(0,ufox-35+i*15,ufo_yoff+movement,0,2) -- aliens end elli(ufox,ufo_yoff+20+movement,100,10,12) -- saucer rotatesheep() if songframe > 11 and peek(0x13ffe) > 32 then scenestarttime = t scene = scene + 1 end end function ufoSCN() end function sheep2d(x,y,scale) -- legs rect(x+10,y,7,20,1) rect(x-15,y,7,20,1) elli(x,y,20,10,12) -- body elli(x+20,y-5,10,6,1) -- head rect(x+24,y-7,2,2,12) -- eye end function flyawayOVR() movement = sin(t/10)*10 if ufo_yoff > -60 then -- draw UFO elli(ufox,ufo_yoff+10+movement,30,10,13) -- pod for i=1,3 do spr(0,ufox-35+i*15,ufo_yoff+movement,0,2) -- aliens end elli(ufox,ufo_yoff+20+movement,100,10,12) -- saucer ufox = 120+((t-scenestarttime)) end print([[ no sheep, rotating or otherwise, were harmed in the making of this intro. nihilazo 2022]],0,100,12) end local textstarttime = 0 local textscale = 2 function intro_scroller() rect(0,scrolly-(2*textscale), 240, textscale*5*2, 6) -- scroll rectangle background print(scrolltexts[text],240-scrollx,scrolly,15,false,textscale) -- scrolltext print(scrolltexts[text],240-scrollx-1,scrolly,13,false,textscale) print(scrolltexts[text],240-scrollx-2,scrolly,12,false,textscale) if scrollx > (scrolltextslen[text]*textscale*5)+240 then if text >= #scrolltexts then scene = scene + 1 scenestarttime = t else textstarttime = t text = text + 1 scrollx = 0 end else scrollx = (t-textstarttime)*1.5 end end local clearsize = textscale*5*2 -- scroller background bar moves to top of screen and wipes -- runs in overlay layer function scroller_clear_transition() pos = scrolly-2-(t-scenestarttime) if pos > 0 then rect(0,pos, 240, textscale*5*2, 6) elseif clearsize > 136 then cls(6) scene = scene + 1 else rect(0,0,240,clearsize,6) clearsize = t-scenestarttime-(scrolly-(textscale*5*2)) end end -- project a 3d vertex to the screen at offset xoff,yoff function project(v,xoff,yoff,scale) local x = v.x --/ v.z local y = -v.y --/ v.z local z = v.z -- do projection local x = (x + 1)/2 * scale + xoff local y = (y + 1)/2 * scale + yoff local z = (z + 1)/2 * scale -- scaling for screen return x, y, z end function z_order(a,b) return (a.p1.z+a.p2.z+a.p3.z)<(b.p1.z+b.p2.z+b.p3.z) end -- every scanline function SCN(l) if scene == 0 or scene == 1 then poke(0x3ff9,math.sin(l/8)*4) end end -- overlay layer function OVR() if scene == 0 then intro() elseif scene == 1 then scroller_clear_transition() elseif scene == 2 then rotatingsheepOVR() elseif scene == 3 then ufoOVR() elseif scene == 4 then flyawayOVR() end end music(0,-1,-1,false) local trackcurrent = 0 -- background layer function TIC() _,_,click = mouse() if click then exit() end -- automatically advance music tracks if peek(0x13ffc) == 255 then exit() end if scene == 0 or scene == 1 then intro_bg() elseif scene == 2 then rotatingsheepbg() elseif scene == 3 or scene==4 then ufobg() end t = time()/20 end