0,]']╠>SБ∙█Ф╤╤╖Пp8╥d%qy)6o;]иA╕ЖsОВТТТ■╟бVl├30.5) then pix(x,y,c1) else pix(x,y,c0) end end x = x + 1 end x = 0 y = y + 1 end end -- let's grow! function growth(n,x0,y0,x1,y1,c0,c1,c2) while (n ~= 0) do local x = RAND(x0, x1) local y = RAND(y0, y1) local p = pix(x,y) if (p == c0 or p == c1) then -- wood or old leaf local gx = x+RAND(-1,1) local gy = y+RAND(-1,1) p = pix(gx,gy) -- new growth pixel if (p ~= c1) then pix(gx,gy,c2) end end n = n - 1 end end -- backdrop function cloud(x, y) rect(x+1,y+7,59,8,1) elli(x+11,y+5,16,10,1) elli(x+30,y-2,16,10,1) elli(x+45,y+7,16,10,1) end function sky(cx) for i=0,19199 do -- 80 pixels high local x=i%240 local y=i//240 poke4(i,y/25+(x*2-y%2)%4/4+6) end cloud(18+cx,30) cloud(100+2*cx,14) cloud(210+cx,55) end function grnd() rect(0,80,240,55,COLR_GRND) end -- letter functions function letter_m(x,y,sx,sy,c) line(x,y,x,y+4*sy,c) line(x,y,x+2*sx,y+2*sy,c) line(x+2*sx,y+2*sy,x+4*sx,y,c) line(x+4*sx,y,x+4*sx,y+4*sy,c) end function letter_a(x,y,sx,sy,c) line(x,y+4*sy,x+2*sx,y,c) line(x+2*sx,y,x+4*sx,y+4*sy,c) line(x+sx,y+2*sy,x+3*sx,y+2*sy,c) end function letter_n(x,y,sx,sy,c) line(x,y,x,y+4*sy,c) line(x,y,x+4*sx,y+4*sy,c) line(x+4*sx,y,x+4*sx,y+4*sy,c) end function letter_t(x,y,sx,sy,c) line(x,y,x+4*sx,y,c) line(x+2*sx,y,x+2*sx,y+4*sy,c) end function letter_r(x,y,sx,sy,c) line(x,y,x,y+4*sy,c) line(x,y,x+2*sx,y,c) line(x+2*sx,y,x+3*sx,y+sy,c) line(x+3*sx,y+sy,x+2*sx,y+2*sy,c) line(x+2*sx,y+2*sy,x,y+2*sy,c) line(x+2*sx,y+2*sy,x+3*sx,y+4*sy,c) end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setExamplePalette() -- replace those greys with sky blues for vb=0,1 do vbank(vb) setRGB(6,0x91,0xbf,0xde) -- #91bfde setRGB(7,0x76,0xaa,0xd1) -- #76aad1 setRGB(8,0xd5,0x91,0xbf) -- #d591bf setRGB(9,0x46,0x76,0xaa) -- #4676aa setRGB(1,0xCC,0xBB,0xBB) -- #ccbbcc end math.randomseed(5) -- for interesting trees (but doesn't seem to work consistently) end -- Your amazing effect function myTIC(unitTics) vbank(0) if (unitTics < 0.15) then local grow_up = LETTER_V-(unitTics*350)//1 local cloud_scud = (unitTics*100)//1 if (unitTics < 0.144) then cls() sky(cloud_scud) end if (unitTics > 0.02) then local grow_up_m = LETTER_V-((unitTics-0.02)*400)//1 letter_m(20,grow_up_m,LETTER_SX,LETTER_SY,COLR_WOOD) letter_m(21,grow_up_m,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_m(22,grow_up_m,LETTER_SX,LETTER_SY,COLR_WOOD) end letter_a(55,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) letter_a(56,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_a(57,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) if (unitTics > 0.06) then local grow_up_n = LETTER_V-((unitTics-0.06)*580)//1 letter_n(90,grow_up_n,LETTER_SX,LETTER_SY,COLR_WOOD) letter_n(91,grow_up_n,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_n(92,grow_up_n,LETTER_SX,LETTER_SY,COLR_WOOD) end if (unitTics > 0.02) then local grow_up_t = LETTER_V-((unitTics-0.02)*400)//1 letter_t(125,grow_up_t,LETTER_SX,LETTER_SY,COLR_WOOD) letter_t(126,grow_up_t,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_t(127,grow_up_t,LETTER_SX,LETTER_SY,COLR_WOOD) end letter_r(160,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) letter_r(161,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_r(162,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) letter_a(188,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) letter_a(189,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD+1) letter_a(190,grow_up,LETTER_SX,LETTER_SY,COLR_WOOD) if (unitTics < 0.144) then grnd() end -- after letters to cover trunks elseif (unitTics > 0.15) then -- scroller and leaves and after a short delay -- scroller local i local text_x = (unitTics*950//1) local text_y = unitTics*24 rect(0,98,240,24,COLR_GRND) -- clear existing text for i=1,#MSG_MANTRA do print(string.sub(MSG_MANTRA,i,i),i*12+341-text_x,104+SIN(i+text_y)*6+1,0,true,2) print(string.sub(MSG_MANTRA,i,i),i*12+340-text_x,104+SIN(i+text_y)*6,COLR_MANTRA+i%3,true,2) end -- grow trees, grow! growth(700-(unitTics*500)//1,1,30,239,74,COLR_WOOD,COLR_LEAF1,COLR_NEWLEAF) colr_update(0,29,239,76,COLR_LEAF1,COLR_LEAF2,COLR_NEWLEAF) -- recolour new leaves end end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsjtruk=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local SIN,COS,PI = math.sin,math.cos,math.pi local MAX,MIN = math.max,math.min local ABS=math.abs local RI_STOP_TIME = .9 local CAM_X,CAM_Y,CAM_Z=0,0,5 local MANTRA_X,MANTRA_Y = nil, nil local RAINBOW_PAL={9,8,10,5,11,12,13} -- Ensure sT and eT are in order! local ANIM = { {sT=.05, eT=.17, a='m'}, {a='r'}, {sT=.225, eT=.325, a='rm'}, {a='r'}, {sT=.375, eT=.475, a='rm'}, {sT=.5, eT=.57, a='j'}, {a='rb'}, {a='l'}, {sT=.57, eT=1, a='f'}, } local ANIM_STEP = 0 local ANIM_INTERP = {} local RAINBOWS = {} local LETTERS = {} local BG_SQUARES = { {25,30},{30,30}, {-25,15},{-20,15},{-15,15}, {15,0}, {20,0}, {25,0}, {30,0}, {35,0}, {-35,-10}, {-30,-10}, {-25,-10}, {-20,-10}, {-20,-25}, {-15,-25}, {-10,-25}, {30,-35}, {35,-35}, } function moveMantra(x, y) MANTRA_X, MANTRA_Y = x, y if CAM_Y < MANTRA_Y - 120 then CAM_Y = MANTRA_Y - 120 elseif CAM_Y > MANTRA_Y + 80 then CAM_Y = MANTRA_Y + 80 end end function clamp(v,min,max) return MAX(min,MIN(v,max)) end function addRainbow(x,y,z, rY) RAINBOWS[#RAINBOWS+1]={ x=x,y=y,z=z,rY=rY,life=0,fall=nil } end function animRainbows() for _,r in ipairs(RAINBOWS) do r.life = r.life+1 end end function drawRainbows() for _,r in ipairs(RAINBOWS) do drawRainbow(r) end end -- x,y,z: pos -- grow: 0-1 -- fall: drops on y axis function drawRainbowArc(x, y, z, rY, grow, fall) local bands={ {r=150, c=0}, {r=135, c=5}, {r=120, c=10}, {r=105, c=15}, } local pointsLast = nil local iSegs = 8 for i=0, iSegs do local ang=grow*(i/iSegs)*math.pi local cosa,sina=-COS(ang),SIN(ang) local pointsThis={} for iRing,band in ipairs(bands) do local p={ x=x + band.r * cosa, y=y + band.r * sina - (fall == nil and 0 or fall * 7), z=z, } p=proj(rotY(p,rY)) pointsThis[#pointsThis+1]=p if pointsLast ~= nil and iRing>1 then local i0 = pointsLast[iRing-1] local i1 = pointsThis[iRing-1] local o0 = pointsLast[iRing] local o1 = pointsThis[iRing] tri(i0.x,i0.y,i1.x,i1.y,o1.x,o1.y,band.c) tri(o1.x,o1.y,o0.x,o0.y,i0.x,i0.y,band.c) end end pointsLast = pointsThis end end -- rainbow life: -- grow -- hold -- drop function drawRainbow(r) local growD1, growD2, holdD = 20,20,120 local life = r.life local grow1=clamp(life/growD1,0,1) life = life - growD1 local grow2=clamp(life/growD2,0,1) life = life - growD2 local hold=clamp(life/holdD,0,1) if r.fall ~= nil then r.fall = r.fall + 1 end drawRainbowArc(r.x, r.y, r.z, r.rY, grow1, r.fall) drawRainbowArc(r.x + 260, r.y, r.z, r.rY, grow2, r.fall) end function addLetter(ch,c,x,y,mx,my) LETTERS[#LETTERS+1]={ x=x,y=y,z=0,mx=mx,my=my,ch=ch,c=c,life=0 } end function drawLetters(unitTics) for i,l in ipairs(LETTERS) do drawLetter(i, l, unitTics) end poke4(0x3FF0*2+1,1) -- Reset the colour map end local RI_LETTERS_START = .57 local RI_LETTERS_LEN = .3 local RI_COLOURS = .7 local RI_MANTRA_BIG = .75 -- Beware! Messes with the colour map function drawLetter(i,l,unitTics) local dim=16 poke4(0x3FF0*2+1,l.c) local tx0,ty0,tx1,ty1=l.ch*16,24,l.ch*16+16,24+16 local tIn = MIN(1,(unitTics-RI_LETTERS_START)/RI_LETTERS_LEN) local xc=120 - (6.5-i) * 16 * tIn local lAcross = 6.5-ABS(6.5-i)/6.5 local yHigh = 10 + lAcross * 10 local yc=100-ABS(SIN(tIn * lAcross * 1.2)*yHigh) local ldim=8 drawTQuad( xc-ldim, yc-ldim, xc+ldim, yc-ldim, xc-ldim, yc+ldim, xc+ldim, yc+ldim, tx0,ty0,tx1,ty1 ) end function drawTQuad(x0,y0,x1,y1,x2,y2,x3,y3,tx0,ty0,tx1,ty1) ttri(x0,y0,x1,y1,x3,y3,tx0,ty0,tx1,ty0,tx1,ty1,0,0) ttri(x3,y3,x2,y2,x0,y0,tx1,ty1,tx0,ty1,tx0,ty0,0,0) end function drawDiamonds(unitTics) local t = MAX(0, unitTics - RI_COLOURS) for i=0,6 do x=120+(i-3)*20 c=getRainbowColour(i + (t * 80)//1) drawDiamond(x,126,c) end poke4(0x3FF0*2+1,1) end function drawDiamond(x,y,c) poke4(0x3FF0*2+1,c) spr(6,x-8,y-8,0,1,0,0,2,2) end function getRainbowColour(c) return RAINBOW_PAL[c%#RAINBOW_PAL+1] end function drawBG() for _,sq in ipairs(BG_SQUARES) do local p=proj({x=sq[1]*16, y=sq[2]*16, z=0}) rect(p.x - 8, p.y - 8,16,16,1) rectb(p.x - 7, p.y - 7,14,14,3) end end function drawMantra(unitTics) local iSpr=(MANTRA_X//60%2 == 0) and 0 or 3 local p = proj({x=MANTRA_X,y=MANTRA_Y,z=0}) local scale = unitTics < RI_MANTRA_BIG and 1 or 3 local x, y = p.x - 12*scale, p.y - 12*scale spr(iSpr,x,y,0,scale,0,0,3,3) end local RI_TEXT_COLOURS={5,2,8} function drawText() local text="RAINBOW IRELANDS" for i=1,8 do local x,y=188+i*6,120 local c=RI_TEXT_COLOURS[1+(i//3)] local l1=text:sub(i,i) local l2=text:sub(i+8,i+8) print(l1, x+1, y+1, 4) print(l2, x-2, y+8, 4) print(l1, x, y, c) print(l2, x-3, y+7, c) end end function nextAnimStep(t) ANIM_STEP = ANIM_STEP + 1 ANIM_INTERP = { startX = MANTRA_X, startY = MANTRA_Y, } end -- VERY ROPEY! -- a=- (wait) -- a=m (move) -- a=r (rainbow) -- a=f (fall) -- a=rm (rainbow-move) -- a=rb (rainbow-break) -- a=l (letters) -- a=b (bounce) -- returns false for [something still in this step] and true for [keep stepping] function doAnimStep(unitT, anim) if anim == nil then return false end -- Do steps that don't require time if anim.a == 'r' then addRainbow(MANTRA_X + 210, MANTRA_Y - 55, 0, 0) nextAnimStep(unitT) return true elseif anim.a == 'rb' then for _,r in ipairs(RAINBOWS) do r.fall = 0 end nextAnimStep(unitT) return true elseif anim.a == 'l' then local word={0,1,2,3,4,1,3,4,5,2,6,7} for i=1,#word do local c=getRainbowColour(i-1) addLetter(word[i], c, 0,-50,200*(i-6), 3500 + 150*i) end nextAnimStep(unitT) return true end local ticsD = anim.eT - anim.sT local ticsThrough = MIN((unitT - anim.sT) / ticsD, 1) if ticsThrough < 0 then return false end if anim.a == 'm' then moveMantra(ANIM_INTERP.startX + (ticsThrough * (ticsD * 3000)), MANTRA_Y) elseif anim.a == 'rm' then moveMantra(ANIM_INTERP.startX + (ticsThrough * 200), ANIM_INTERP.startY + SIN(ticsThrough * PI/2) * 150) elseif anim.a == 'j' then moveMantra(MANTRA_X, ANIM_INTERP.startY + ABS(SIN(ticsThrough * PI) * 60)) elseif anim.a == 'f' then moveMantra(MANTRA_X, ANIM_INTERP.startY - ticsThrough * 800) end if ticsThrough >= 1 then nextAnimStep(unitT) return true end return false end function doAnim(unitT) if ANIM_STEP > #ANIM then return end local loopAgain = false repeat local anim = ANIM[ANIM_STEP] loopAgain = doAnimStep(unitT, anim) until not loopAgain end function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use this specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {0,154,68}, -- WHITE {255,255,255}, -- ORANGE {255,130,0}, vbank(0) setExamplePalette() setRGB(1,140,210,255) local sprData = rift_contributorsjtruksprdata() loadMegaSprite(sprData.pixels.mantra1, 0, 0) loadMegaSprite(sprData.pixels.mantra2, 3, 0) loadMegaSprite(sprData.pixels.ticman, 6, 0) loadMegaSprite(sprData.pixels.m, 0, 3) loadMegaSprite(sprData.pixels.a, 2, 3) loadMegaSprite(sprData.pixels.n, 4, 3) loadMegaSprite(sprData.pixels.t, 6, 3) loadMegaSprite(sprData.pixels.r, 8, 3) loadMegaSprite(sprData.pixels.o, 10, 3) loadMegaSprite(sprData.pixels.i, 12, 3) loadMegaSprite(sprData.pixels.c, 14, 3) local pixelData = sprData.pixels for iSp=0,1 do end for i,rgb in ipairs(sprData.palette) do local r = (rgb >> 16) & 0xff local g = (rgb >> 8) & 0xff local b = rgb & 0xff setRGB(i-1, r, g, b) end moveMantra(-700, -60) nextAnimStep() end function loadMegaSprite(sprdata, destX0, destY0) local pixelData = sprdata.data local destX,destY=destX0,destY0 local destX1=destX0+sprdata.width-1 for i=1,#pixelData,4 do toGfxSlot(0, 16*destY+destX, {pixelData[i], pixelData[i+1], pixelData[i+2], pixelData[i+3]}) destX=destX+1 if destX>destX1 then destX = destX0 destY = destY+1 end end end local lastUnitTics = 0 -- Your amazing effect function myTIC(unitTics, metrics) doAnim(unitTics) if unitTics >= .7 and lastUnitTics < .7 then addRainbow(300, -300, 100, .6) end if unitTics >= .8 and lastUnitTics < .8 then addRainbow(-300, -400, 200, -.6) end if unitTics >= .85 and lastUnitTics < .85 then addRainbow(300, -550, 0, .6) end vbank(1) cls() drawBG() drawMantra(unitTics) drawLetters(unitTics) vbank(0) cls(1) animRainbows() drawRainbows() vbank(1) drawDiamonds(unitTics) drawText() lastUnitTics = unitTics end function myBDR(y, unitTics, tics, time, metrics) vbank(0) local fade = y - CAM_Y * .2 setRGB(1,100-fade/4,110+fade/2,200) end function myPOSTSCENE() vbank(1) cls() end -- b=0: tiles, b=1: sprites function toGfxSlot(b, iSpr, vals) local a=(0x4000+b*0x2000)*2+iSpr*64 for i=1,#vals do local acc = vals[i] for i=0,15 do poke4(a, (acc >> ((15-i)*4)) & 0xf) a = a + 1 end end end function proj(v) local sc=100 local z=CAM_Z-v.z/sc return {x=120+(v.x-CAM_X)/z,y=68-(v.y-CAM_Y)/z} end function rotX(v,a) local sa,ca=SIN(a),COS(a) return { x=v.x, y=v.y*ca-v.z*sa, z=v.y*sa+v.z*ca, } end function rotY(v,a) local sa,ca=SIN(a),COS(a) return { x=v.x*ca-v.z*sa, y=v.y, z=v.x*sa+v.z*ca } end function rotZ(v,a) local sa,ca=SIN(a),COS(a) return { x=v.x*ca-v.y*sa, y=v.x*sa+v.y*ca, z=v.z, } end function trans(v,x,y,z) return { x=v.x+x, y=v.y+y, z=v.z+z, } end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsgasman=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local SIN,COS,PI = math.sin,math.cos,math.pi local teapot={ {0.00,2.40,-1.40}, {0.45,2.40,-1.33}, {0.83,2.40,-1.13}, {1.13,2.40,-0.83}, {1.33,2.40,-0.45}, {1.40,2.40,-0.00}, {1.33,2.40,0.45}, {1.13,2.40,0.83}, {0.83,2.40,1.13}, {0.45,2.40,1.33}, {0.00,2.40,1.40}, {-0.45,2.40,1.33}, {-0.83,2.40,1.13}, {-1.13,2.40,0.83}, {-1.33,2.40,0.45}, {-1.40,2.40,0.00}, {-1.33,2.40,-0.45}, {-1.13,2.40,-0.83}, {-0.83,2.40,-1.13}, {-0.45,2.40,-1.33}, {0.00,2.46,-1.38}, {0.64,2.46,-1.23}, {1.23,2.46,-0.64}, {1.36,2.46,0.23}, {0.98,2.46,0.98}, {0.23,2.46,1.36}, {-0.64,2.46,1.23}, {-1.23,2.46,0.64}, {-1.36,2.46,-0.23}, {-0.98,2.46,-0.98}, {-0.23,2.48,-1.36}, {0.44,2.48,-1.31}, {1.12,2.48,-0.82}, {1.38,2.48,-0.00}, {1.12,2.48,0.82}, {0.44,2.48,1.31}, {-0.44,2.48,1.31}, {-1.12,2.48,0.82}, {-1.38,2.48,0.00}, {-1.12,2.48,-0.82}, {-0.44,2.49,-1.32}, {0.23,2.49,-1.37}, {0.99,2.49,-0.99}, {1.37,2.49,-0.23}, {1.24,2.49,0.64}, {0.64,2.49,1.24}, {-0.23,2.49,1.37}, {-0.99,2.49,0.99}, {-1.37,2.49,0.23}, {-1.24,2.49,-0.64}, {-0.65,2.50,-1.25}, {0.00,2.50,-1.40}, {0.83,2.50,-1.14}, {1.33,2.50,-0.45}, {1.33,2.50,0.45}, {0.83,2.50,1.14}, {0.00,2.50,1.40}, {-0.83,2.50,1.14}, {-1.33,2.50,0.45}, {-1.33,2.50,-0.45}, {-0.84,2.49,-1.15}, {-0.23,2.49,-1.40}, {0.66,2.49,-1.26}, {1.26,2.49,-0.66}, {1.40,2.49,0.23}, {1.01,2.49,1.01}, {0.23,2.49,1.40}, {-0.66,2.49,1.26}, {-1.26,2.49,0.66}, {-1.40,2.49,-0.23}, {-1.02,2.48,-1.02}, {-0.46,2.48,-1.37}, {0.46,2.48,-1.37}, {1.16,2.48,-0.85}, {1.44,2.48,-0.00}, {1.16,2.48,0.85}, {0.46,2.48,1.37}, {-0.46,2.48,1.37}, {-1.16,2.48,0.85}, {-1.44,2.48,0.00}, {-1.18,2.46,-0.87}, {-0.68,2.46,-1.30}, {0.24,2.46,-1.44}, {1.04,2.46,-1.04}, {1.44,2.46,-0.24}, {1.30,2.46,0.68}, {0.68,2.46,1.30}, {-0.24,2.46,1.44}, {-1.04,2.46,1.04}, {-1.44,2.46,0.24}, {-1.32,2.44,-0.69}, {-0.88,2.44,-1.20}, {0.00,2.44,-1.48}, {0.88,2.44,-1.20}, {1.41,2.44,-0.47}, {1.41,2.44,0.47}, {0.88,2.44,1.20}, {0.00,2.44,1.48}, {-0.88,2.44,1.20}, {-1.41,2.44,0.47}, {-1.42,2.40,-0.48}, {-1.06,2.40,-1.06}, {-0.25,2.40,-1.48}, {0.69,2.40,-1.33}, {1.33,2.40,-0.69}, {1.48,2.40,0.25}, {1.06,2.40,1.06}, {0.25,2.40,1.48}, {-0.69,2.40,1.33}, {-1.33,2.40,0.69}, {-1.55,2.24,-0.26}, {-1.27,2.24,-0.94}, {-0.50,2.24,-1.50}, {0.50,2.24,-1.50}, {1.27,2.24,-0.94}, {1.57,2.24,-0.00}, {1.27,2.24,0.94}, {0.50,2.24,1.50}, {-0.50,2.24,1.50}, {-1.27,2.24,0.94}, {-1.65,2.09,0.00}, {-1.47,2.09,-0.76}, {-0.76,2.09,-1.47}, {0.27,2.09,-1.63}, {1.17,2.09,-1.17}, {1.63,2.09,-0.27}, {1.47,2.09,0.76}, {0.76,2.09,1.47}, {-0.27,2.09,1.63}, {-1.17,2.09,1.17}, {-1.70,1.93,0.28}, {-1.63,1.93,-0.55}, {-1.02,1.93,-1.39}, {0.00,1.93,-1.72}, {1.02,1.93,-1.39}, {1.63,1.93,-0.55}, {1.63,1.93,0.55}, {1.02,1.93,1.39}, {0.00,1.93,1.72}, {-1.02,1.93,1.39}, {-1.69,1.77,0.57}, {-1.76,1.77,-0.29}, {-1.27,1.77,-1.27}, {-0.29,1.77,-1.76}, {0.83,1.77,-1.59}, {1.59,1.77,-0.83}, {1.76,1.77,0.29}, {1.27,1.77,1.27}, {0.29,1.77,1.76}, {-0.83,1.77,1.59}, {-1.64,1.62,0.85}, {-1.84,1.62,0.00}, {-1.49,1.62,-1.10}, {-0.59,1.62,-1.75}, {0.59,1.62,-1.75}, {1.49,1.62,-1.10}, {1.84,1.62,-0.00}, {1.49,1.62,1.10}, {0.59,1.62,1.75}, {-0.59,1.62,1.75}, {-1.53,1.47,1.13}, {-1.87,1.47,0.31}, {-1.69,1.47,-0.88}, {-0.88,1.47,-1.69}, {0.31,1.47,-1.87}, {1.35,1.47,-1.35}, {1.87,1.47,-0.31}, {1.69,1.47,0.88}, {0.88,1.47,1.69}, {-0.31,1.47,1.87}, {-1.38,1.32,1.38}, {-1.84,1.32,0.62}, {-1.84,1.32,-0.62}, {-1.15,1.32,-1.57}, {0.00,1.32,-1.94}, {1.15,1.32,-1.57}, {1.84,1.32,-0.62}, {1.84,1.32,0.62}, {1.15,1.32,1.57}, {0.00,1.32,1.94}, {-1.17,1.18,1.60}, {-1.75,1.18,0.91}, {-1.95,1.18,-0.32}, {-1.40,1.18,-1.40}, {-0.32,1.18,-1.95}, {0.91,1.18,-1.75}, {1.75,1.18,-0.91}, {1.95,1.18,0.32}, {1.40,1.18,1.40}, {0.32,1.18,1.95}, {-0.92,1.04,1.77}, {-1.61,1.04,1.18}, {-1.99,1.04,0.00}, {-1.61,1.04,-1.18}, {-0.64,1.04,-1.89}, {0.64,1.04,-1.89}, {1.61,1.04,-1.18}, {1.99,1.04,-0.00}, {1.61,1.04,1.18}, {0.64,1.04,1.89}, {-0.64,0.90,1.90}, {-1.42,0.90,1.42}, {-1.97,0.90,0.33}, {-1.78,0.90,-0.93}, {-0.93,0.90,-1.78}, {0.33,0.90,-1.97}, {1.42,0.90,-1.42}, {1.97,0.90,-0.33}, {1.78,0.90,0.93}, {0.93,0.90,1.78}, {-0.33,0.77,1.96}, {-1.18,0.77,1.61}, {-1.89,0.77,0.63}, {-1.89,0.77,-0.63}, {-1.18,0.77,-1.61}, {0.00,0.77,-1.99}, {1.18,0.77,-1.61}, {1.89,0.77,-0.63}, {1.89,0.77,0.63}, {1.18,0.77,1.61}, {0.00,0.66,1.95}, {-0.90,0.66,1.73}, {-1.73,0.66,0.90}, {-1.92,0.66,-0.32}, {-1.38,0.66,-1.38}, {-0.32,0.66,-1.92}, {0.90,0.66,-1.73}, {1.73,0.66,-0.90}, {1.92,0.66,0.32}, {1.38,0.66,1.38}, {0.31,0.55,1.87}, {-0.60,0.55,1.80}, {-1.53,0.55,1.12}, {-1.89,0.55,0.00}, {-1.53,0.55,-1.12}, {-0.60,0.55,-1.80}, {0.60,0.55,-1.80}, {1.53,0.55,-1.12}, {1.89,0.55,-0.00}, {1.53,0.55,1.12}, {0.58,0.46,1.73}, {-0.30,0.46,1.80}, {-1.30,0.46,1.30}, {-1.80,0.46,0.30}, {-1.62,0.46,-0.84}, {-0.84,0.46,-1.62}, {0.30,0.46,-1.80}, {1.30,0.46,-1.30}, {1.80,0.46,-0.30}, {1.62,0.46,0.84}, {0.81,0.38,1.56}, {0.00,0.38,1.75}, {-1.04,0.38,1.42}, {-1.66,0.38,0.56}, {-1.66,0.38,-0.56}, {-1.04,0.38,-1.42}, {0.00,0.38,-1.75}, {1.04,0.38,-1.42}, {1.66,0.38,-0.56}, {1.66,0.38,0.56}, {1.00,0.32,1.36}, {0.27,0.32,1.65}, {-0.78,0.32,1.49}, {-1.49,0.32,0.78}, {-1.65,0.32,-0.27}, {-1.19,0.32,-1.19}, {-0.27,0.32,-1.65}, {0.78,0.32,-1.49}, {1.49,0.32,-0.78}, {1.65,0.32,0.27}, {1.14,0.26,1.14}, {0.51,0.26,1.53}, {-0.51,0.26,1.53}, {-1.30,0.26,0.96}, {-1.61,0.26,0.00}, {-1.30,0.26,-0.96}, {-0.51,0.26,-1.53}, {0.51,0.26,-1.53}, {1.30,0.26,-0.96}, {1.61,0.26,-0.00}, {1.26,0.21,0.92}, {0.72,0.21,1.38}, {-0.25,0.21,1.53}, {-1.10,0.21,1.10}, {-1.53,0.21,0.25}, {-1.38,0.21,-0.72}, {-0.72,0.21,-1.38}, {0.25,0.21,-1.53}, {1.10,0.21,-1.10}, {1.53,0.21,-0.25}, {1.35,0.18,0.70}, {0.90,0.18,1.23}, {0.00,0.18,1.51}, {-0.90,0.18,1.23}, {-1.44,0.18,0.48}, {-1.44,0.18,-0.48}, {-0.90,0.18,-1.23}, {0.00,0.18,-1.51}, {0.90,0.18,-1.23}, {1.44,0.18,-0.48}, {1.42,0.15,0.48}, {1.06,0.15,1.06}, {0.25,0.15,1.48}, {-0.69,0.15,1.33}, {-1.33,0.15,0.69}, {-1.48,0.15,-0.25}, {-1.06,0.15,-1.06}, {-0.25,0.15,-1.48}, {0.69,0.15,-1.33}, {1.33,0.15,-0.69}, {1.48,0.13,0.25}, {1.43,0.08,0.24}, {1.27,0.05,0.21}, {0.94,0.02,0.16}, {0.38,0.00,0.06}, {0.37,0.00,-0.12}, {0.23,0.00,-0.31}, {0.00,0.00,-0.39}, {-0.23,0.00,-0.31}, {-0.37,0.00,-0.12}, {-0.37,0.00,0.12}, {-0.23,0.00,0.31}, {0.00,0.00,0.39}, {0.23,0.00,0.31}, {0.37,0.00,0.12}, {1.22,0.05,0.41}, {1.42,0.13,0.48}, {1.23,0.06,0.64}, {0.63,0.01,0.33}, {1.04,0.05,0.76}, {1.21,0.13,0.89}, {0.98,0.06,0.98}, {0.50,0.01,0.50}, {0.76,0.05,1.04}, {0.89,0.13,1.21}, {0.64,0.06,1.23}, {0.33,0.01,0.63}, {0.41,0.05,1.22}, {0.48,0.13,1.42}, {0.23,0.06,1.36}, {0.12,0.01,0.69}, {0.00,0.05,1.28}, {0.00,0.13,1.50}, {-0.23,0.06,1.36}, {-0.12,0.01,0.69}, {-0.41,0.05,1.22}, {-0.48,0.13,1.42}, {-0.64,0.06,1.23}, {-0.33,0.01,0.63}, {-0.76,0.05,1.04}, {-0.89,0.13,1.21}, {-0.98,0.06,0.98}, {-0.50,0.01,0.50}, {-1.04,0.05,0.76}, {-1.21,0.13,0.89}, {-1.23,0.06,0.64}, {-0.63,0.01,0.33}, {-1.22,0.05,0.41}, {-1.42,0.13,0.48}, {-1.36,0.06,0.23}, {-0.69,0.01,0.12}, {-1.28,0.05,0.00}, {-1.50,0.13,0.00}, {-1.36,0.06,-0.23}, {-0.69,0.01,-0.12}, {-1.22,0.05,-0.41}, {-1.42,0.13,-0.48}, {-1.23,0.06,-0.64}, {-0.63,0.01,-0.33}, {-1.04,0.05,-0.76}, {-1.21,0.13,-0.89}, {-0.98,0.06,-0.98}, {-0.50,0.01,-0.50}, {-0.76,0.05,-1.04}, {-0.89,0.13,-1.21}, {-0.64,0.06,-1.23}, {-0.33,0.01,-0.63}, {-0.41,0.05,-1.22}, {-0.48,0.13,-1.42}, {-0.23,0.06,-1.36}, {-0.12,0.01,-0.69}, {0.00,0.05,-1.28}, {0.00,0.13,-1.50}, {0.23,0.06,-1.36}, {0.12,0.01,-0.69}, {0.41,0.05,-1.22}, {0.48,0.13,-1.42}, {0.64,0.06,-1.23}, {0.33,0.01,-0.63}, {0.76,0.05,-1.04}, {0.89,0.13,-1.21}, {0.98,0.06,-0.98}, {0.50,0.01,-0.50}, {1.04,0.05,-0.76}, {1.21,0.13,-0.89}, {1.23,0.06,-0.64}, {0.63,0.01,-0.33}, {1.22,0.05,-0.41}, {1.42,0.13,-0.48}, {1.36,0.06,-0.23}, {0.69,0.01,-0.12}, {0.06,3.14,-0.18}, {0.16,3.14,-0.12}, {0.19,3.14,-0.00}, {0.16,3.14,0.12}, {0.06,3.14,0.18}, {-0.06,3.14,0.18}, {-0.16,3.14,0.12}, {-0.19,3.14,0.00}, {-0.16,3.14,-0.12}, {-0.06,3.14,-0.18}, {0.05,3.12,-0.30}, {0.22,3.12,-0.22}, {0.30,3.12,-0.05}, {0.27,3.12,0.14}, {0.14,3.12,0.27}, {-0.05,3.12,0.30}, {-0.22,3.12,0.22}, {-0.30,3.12,0.05}, {-0.27,3.12,-0.14}, {-0.14,3.12,-0.27}, {0.00,3.08,-0.36}, {0.21,3.08,-0.29}, {0.34,3.08,-0.11}, {0.34,3.08,0.11}, {0.21,3.08,0.29}, {0.00,3.08,0.36}, {-0.21,3.08,0.29}, {-0.34,3.08,0.11}, {-0.34,3.08,-0.11}, {-0.21,3.08,-0.29}, {-0.06,3.03,-0.35}, {0.17,3.03,-0.32}, {0.32,3.03,-0.17}, {0.35,3.03,0.06}, {0.25,3.03,0.25}, {0.06,3.03,0.35}, {-0.17,3.03,0.32}, {-0.32,3.03,0.17}, {-0.35,3.03,-0.06}, {-0.25,3.03,-0.25}, {-0.10,2.98,-0.31}, {0.10,2.98,-0.31}, {0.26,2.98,-0.19}, {0.33,2.98,-0.00}, {0.26,2.98,0.19}, {0.10,2.98,0.31}, {-0.10,2.98,0.31}, {-0.26,2.98,0.19}, {-0.33,2.98,0.00}, {-0.26,2.98,-0.19}, {-0.13,2.92,-0.24}, {0.05,2.92,-0.27}, {0.19,2.92,-0.19}, {0.27,2.92,-0.05}, {0.24,2.92,0.13}, {0.13,2.92,0.24}, {-0.05,2.92,0.27}, {-0.19,2.92,0.19}, {-0.27,2.92,0.05}, {-0.24,2.92,-0.13}, {-0.13,2.86,-0.18}, {0.00,2.86,-0.22}, {0.13,2.86,-0.18}, {0.21,2.86,-0.07}, {0.21,2.86,0.07}, {0.13,2.86,0.18}, {0.00,2.86,0.22}, {-0.13,2.86,0.18}, {-0.21,2.86,0.07}, {-0.21,2.86,-0.07}, {-0.13,2.80,-0.13}, {-0.03,2.80,-0.18}, {0.08,2.80,-0.16}, {0.16,2.80,-0.08}, {0.18,2.80,0.03}, {0.13,2.80,0.13}, {0.03,2.80,0.18}, {-0.08,2.80,0.16}, {-0.16,2.80,0.08}, {-0.18,2.80,-0.03}, {-0.14,2.75,-0.10}, {-0.05,2.75,-0.16}, {0.05,2.75,-0.16}, {0.14,2.75,-0.10}, {0.17,2.75,-0.00}, {0.14,2.75,0.10}, {0.05,2.75,0.16}, {-0.05,2.75,0.16}, {-0.14,2.75,0.10}, {-0.17,2.75,0.00}, {-0.18,2.70,-0.09}, {-0.09,2.70,-0.18}, {0.03,2.70,-0.20}, {0.14,2.70,-0.14}, {0.20,2.70,-0.03}, {0.18,2.70,0.09}, {0.09,2.70,0.18}, {-0.03,2.70,0.20}, {-0.14,2.70,0.14}, {-0.20,2.70,0.03}, {-0.27,2.66,-0.09}, {-0.17,2.66,-0.23}, {0.00,2.66,-0.28}, {0.17,2.66,-0.23}, {0.27,2.66,-0.09}, {0.27,2.66,0.09}, {0.17,2.66,0.23}, {0.00,2.66,0.28}, {-0.17,2.66,0.23}, {-0.27,2.66,0.09}, {-0.39,2.63,-0.06}, {-0.28,2.63,-0.28}, {-0.06,2.63,-0.39}, {0.18,2.63,-0.35}, {0.35,2.63,-0.18}, {0.39,2.63,0.06}, {0.28,2.63,0.28}, {0.06,2.63,0.39}, {-0.18,2.63,0.35}, {-0.35,2.63,0.18}, {-0.53,2.60,0.00}, {-0.43,2.60,-0.31}, {-0.17,2.60,-0.50}, {0.17,2.60,-0.50}, {0.43,2.60,-0.31}, {0.53,2.60,-0.00}, {0.43,2.60,0.31}, {0.17,2.60,0.50}, {-0.17,2.60,0.50}, {-0.43,2.60,0.31}, {-0.66,2.57,0.11}, {-0.60,2.57,-0.31}, {-0.31,2.57,-0.60}, {0.11,2.57,-0.66}, {0.48,2.57,-0.48}, {0.66,2.57,-0.11}, {0.60,2.57,0.31}, {0.31,2.57,0.60}, {-0.11,2.57,0.66}, {-0.48,2.57,0.48}, {-0.78,2.55,0.26}, {-0.78,2.55,-0.26}, {-0.49,2.55,-0.67}, {0.00,2.55,-0.82}, {0.49,2.55,-0.67}, {0.78,2.55,-0.26}, {0.78,2.55,0.26}, {0.49,2.55,0.67}, {0.00,2.55,0.82}, {-0.49,2.55,0.67}, {-0.86,2.53,0.45}, {-0.96,2.53,-0.16}, {-0.69,2.53,-0.69}, {-0.16,2.53,-0.96}, {0.45,2.53,-0.86}, {0.86,2.53,-0.45}, {0.96,2.53,0.16}, {0.69,2.53,0.69}, {0.16,2.53,0.96}, {-0.45,2.53,0.86}, {-0.89,2.50,0.65}, {-1.10,2.50,0.00}, {-0.89,2.50,-0.65}, {-0.35,2.50,-1.04}, {0.35,2.50,-1.04}, {0.89,2.50,-0.65}, {1.10,2.50,-0.00}, {0.89,2.50,0.65}, {0.35,2.50,1.04}, {-0.35,2.50,1.04}, {-0.86,2.47,0.86}, {-1.19,2.47,0.20}, {-1.07,2.47,-0.56}, {-0.56,2.47,-1.07}, {0.20,2.47,-1.19}, {0.86,2.47,-0.86}, {1.19,2.47,-0.20}, {1.07,2.47,0.56}, {0.56,2.47,1.07}, {-0.20,2.47,1.19}, {-0.76,2.44,1.03}, {-1.21,2.44,0.41}, {-1.21,2.44,-0.41}, {-0.76,2.44,-1.03}, {0.00,2.44,-1.27}, {0.76,2.44,-1.03}, {1.21,2.44,-0.41}, {1.21,2.44,0.41}, {0.76,2.44,1.03}, {0.00,2.44,1.27}, {-0.60,2.40,1.16}, {-1.16,2.40,0.60}, {-1.28,2.40,-0.21}, {-0.92,2.40,-0.92}, {-0.21,2.40,-1.28}, {0.60,2.40,-1.16}, {1.16,2.40,-0.60}, {1.28,2.40,0.21}, {0.92,2.40,0.92}, {0.21,2.40,1.28}, {0.08,2.03,1.80}, {0.19,2.07,1.58}, {0.23,2.14,1.55}, {0.19,2.20,1.52}, {0.08,2.24,1.50}, {-0.08,2.24,1.79}, {-0.08,2.23,2.26}, {-0.08,2.19,2.62}, {-0.08,2.09,2.86}, {-0.08,1.92,2.98}, {-0.08,1.67,2.98}, {-0.08,1.41,2.90}, {-0.08,1.16,2.73}, {-0.08,0.93,2.47}, {-0.08,0.71,2.11}, {0.08,0.71,2.11}, {0.08,1.04,2.61}, {0.08,1.54,2.95}, {0.08,2.02,2.93}, {0.08,2.22,2.46}, {0.14,2.22,2.25}, {0.14,2.08,2.84}, {0.14,1.67,2.96}, {0.14,1.18,2.71}, {0.14,0.73,2.12}, {0.19,0.86,2.29}, {0.19,1.32,2.78}, {0.19,1.80,2.94}, {0.19,2.11,2.71}, {0.19,2.20,2.03}, {0.22,2.12,2.55}, {0.22,1.90,2.88}, {0.22,1.46,2.81}, {0.22,1.00,2.43}, {0.23,0.84,2.13}, {0.23,1.14,2.54}, {0.23,1.59,2.82}, {0.23,1.96,2.80}, {0.23,2.12,2.37}, {0.22,2.10,2.19}, {0.22,2.00,2.69}, {0.22,1.71,2.80}, {0.22,1.28,2.61}, {0.22,0.88,2.13}, {0.19,1.00,2.27}, {0.19,1.41,2.65}, {0.19,1.80,2.76}, {0.19,2.01,2.57}, {0.19,2.07,2.00}, {0.14,2.02,2.43}, {0.14,1.87,2.72}, {0.14,1.53,2.67}, {0.14,1.13,2.38}, {0.08,0.97,2.14}, {0.08,1.24,2.47}, {0.08,1.64,2.68}, {0.08,1.91,2.66}, {0.08,2.02,2.29}, {0.00,2.02,2.15}, {0.00,1.95,2.59}, {0.00,1.73,2.69}, {0.00,1.35,2.54}, {0.00,0.97,2.14}, {-0.14,0.95,2.14}, {-0.22,0.88,2.13}, {-0.22,0.80,2.12}, {-0.14,0.73,2.12}, {-0.14,1.18,2.71}, {-0.14,1.67,2.96}, {-0.14,2.08,2.84}, {-0.14,2.22,2.25}, {-0.19,2.20,1.79}, {-0.19,2.18,2.42}, {-0.19,2.00,2.88}, {-0.19,1.56,2.90}, {-0.19,1.08,2.58}, {-0.22,1.00,2.43}, {-0.22,1.46,2.81}, {-0.22,1.90,2.88}, {-0.22,2.12,2.55}, {-0.22,2.17,1.79}, {-0.23,2.13,2.01}, {-0.23,2.06,2.64}, {-0.23,1.80,2.85}, {-0.23,1.37,2.71}, {-0.23,0.93,2.28}, {-0.22,1.28,2.61}, {-0.22,1.71,2.80}, {-0.22,2.00,2.69}, {-0.22,2.10,2.19}, {-0.19,2.07,1.80}, {-0.19,2.06,2.33}, {-0.19,1.93,2.71}, {-0.19,1.62,2.74}, {-0.19,1.20,2.49}, {-0.14,1.13,2.38}, {-0.14,1.53,2.67}, {-0.14,1.87,2.72}, {-0.14,2.02,2.43}, {-0.14,2.05,1.80}, {-0.08,2.03,1.98}, {-0.08,1.98,2.52}, {-0.08,1.80,2.71}, {-0.08,1.45,2.60}, {-0.08,1.05,2.27}, {0.31,1.37,-1.95}, {0.47,1.18,-1.98}, {0.48,0.89,-1.70}, {0.31,0.77,-2.05}, {0.00,0.60,-1.70}, {-0.17,0.86,-2.31}, {-0.14,1.24,-2.60}, {-0.11,1.68,-2.74}, {-0.08,2.09,-2.91}, {-0.07,2.40,-3.28}, {-0.06,2.45,-3.38}, {-0.06,2.47,-3.42}, {-0.05,2.48,-3.39}, {-0.04,2.45,-3.31}, {-0.04,2.40,-3.19}, {0.04,2.45,-3.31}, {0.06,2.47,-3.42}, {0.07,2.40,-3.28}, {0.11,1.68,-2.74}, {0.17,0.86,-2.31}, {0.22,1.48,-2.66}, {0.13,2.27,-3.02}, {0.11,2.46,-3.36}, {0.08,2.47,-3.32}, {0.10,2.43,-3.17}, {0.12,2.47,-3.28}, {0.15,2.44,-3.26}, {0.18,2.11,-2.84}, {0.32,1.32,-2.55}, {0.41,1.21,-2.40}, {0.24,1.95,-2.70}, {0.18,2.42,-3.14}, {0.14,2.47,-3.22}, {0.11,2.43,-3.11}, {0.12,2.44,-3.08}, {0.16,2.46,-3.12}, {0.19,2.40,-3.00}, {0.30,1.80,-2.59}, {0.46,1.17,-2.21}, {0.33,1.67,-2.49}, {0.19,2.29,-2.77}, {0.16,2.45,-3.01}, {0.12,2.45,-3.03}, {0.10,2.42,-2.92}, {0.12,2.46,-2.96}, {0.15,2.44,-2.90}, {0.18,2.16,-2.61}, {0.32,1.58,-2.39}, {0.27,1.52,-2.26}, {0.16,2.04,-2.51}, {0.12,2.42,-2.80}, {0.10,2.46,-2.89}, {0.07,2.42,-2.87}, {0.04,2.44,-2.85}, {0.06,2.45,-2.82}, {0.07,2.40,-2.72}, {0.11,1.92,-2.44}, {0.17,1.48,-2.12}, {-0.18,1.42,-1.94}, {0.00,1.68,-2.33}, {0.00,1.93,-2.43}, {0.00,2.18,-2.53}, {0.00,2.40,-2.70}, {0.00,2.44,-2.76}, {0.00,2.45,-2.81}, {0.00,2.45,-2.84}, {0.00,2.44,-2.84}, {0.00,2.40,-2.80}, {-0.10,2.42,-2.92}, {-0.11,2.40,-3.00}, {-0.09,2.40,-3.11}, {-0.08,2.45,-3.28}, {-0.10,2.47,-3.37}, {-0.12,2.40,-3.24}, {-0.19,1.70,-2.72}, {-0.30,0.91,-2.30}, {-0.39,0.98,-2.27}, {-0.25,1.72,-2.68}, {-0.16,2.40,-3.17}, {-0.14,2.47,-3.30}, {-0.10,2.45,-3.22}, {-0.14,2.47,-3.22}, {-0.18,2.42,-3.14}, {-0.24,1.95,-2.70}, {-0.41,1.21,-2.40}, {-0.48,0.89,-1.70}, {-0.43,1.30,-2.37}, {-0.25,1.97,-2.65}, {-0.19,2.42,-3.04}, {-0.15,2.47,-3.13}, {-0.12,2.44,-3.01}, {-0.15,2.46,-3.03}, {-0.18,2.40,-2.91}, {-0.28,1.84,-2.55}, {-0.44,1.27,-2.18}, {-0.39,1.36,-2.16}, {-0.25,1.87,-2.50}, {-0.16,2.40,-2.83}, {-0.14,2.46,-2.94}, {-0.10,2.44,-2.94}, {-0.10,2.46,-2.89}, {-0.12,2.42,-2.80}, {-0.16,2.04,-2.51}, {-0.27,1.52,-2.26}, {-0.32,1.34,-1.70}, } function myPRECALC() end function myPRESCENE() -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) poke(16320,0) poke(16321,0) poke(16322,0) poke(16326,177) poke(16327,62) poke(16328,83) poke(16332,255) poke(16333,136) poke(16334,62) poke(16338,22) poke(16339,155) poke(16340,98) poke(16356,255) poke(16357,255) poke(16358,255) end function drawpot(ya, t) xa=0.7 zd=4.2 for i=1,#teapot do v0=teapot[i] v1={ v0[1], v0[2]*math.cos(xa)+v0[3]*math.sin(xa), v0[3]*math.cos(xa)-v0[2]*math.sin(xa)+zd, } v={ v1[1]*math.cos(ya)+v1[3]*math.sin(ya), v1[2], v1[3]*math.cos(ya)-v1[1]*math.sin(ya), } if v0[2]<0.9 then c=6 elseif v0[2]<1.7 then c=12 else c=4 end circ(120+v[1]*18,80-v[2]*18,1,c) end end function drawstream(ya, t) di=t/100 for i=0.6+(di%.2),-2,-.2 do cv={0,0.5-i*i,i*1.1-0.5} ir=.1+.08*math.sin(i*8+time()/50)+(i-1)/6 for j=0,0.9,.1 do ja=j*math.pi*2 v0={ cv[1]+ir*math.cos(ja), cv[2]+.1*math.sin(ja), cv[3]+ir*math.sin(ja) } v={ v0[1]*math.cos(ya)+v0[3]*math.sin(ya), v0[2], v0[3]*math.cos(ya)-v0[1]*math.sin(ya), } sv={ v[1]*18*1/(v[3]/4+2), v[2]*18*1/(v[3]/4+2) } circ(120+sv[1],80-sv[2],1,2) end end end function drawpool(ya, t) for i=1+(t/200)%1,20 do for j=0,1,0.03 do ja=j*math.pi*2 v0={ i*math.cos(ja), -3.3+0.2*math.sin(i+t/100), i*math.sin(ja)-2.5 } v={ v0[1]*math.cos(ya)+v0[3]*math.sin(ya), v0[2], v0[3]*math.cos(ya)-v0[1]*math.sin(ya), } if v[3]>-3 and v[3]<10 then sv={ v[1]*18*1/(v[3]/4+2), v[2]*18*1/(v[3]/4+2) } pix(120+sv[1],80-sv[2],2) end end end end -- Your amazing effect function myTIC(unitTics) vbank(0) cls() t=time() beat=(unitTics * 16) % 1 poke(16341,255-(beat*218)) poke(16342,255-(beat*142)) poke(16343,255-(beat*134)) ya=t/900 if (ya-math.pi/2)%(math.pi*2)>math.pi then drawpool(ya, t) drawpot(ya, t) drawstream(ya, t) else drawpool(ya, t) drawstream(ya, t) drawpot(ya, t) end print("it's not Barry's",16,0,7,false,2) print("it's mine",140,110,7,false,2) end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorscatnip=function() -- You can have 'global' vars like this -- Though you can delete these if you like! -- local YOUR_NAME = "Catnip" -- local SIN,COS,PI = math.sin,math.cos,math.pi local particles={} function drawShape(type,origin,size,border,colour) if type==0 then if border then rectb(origin.x,origin.y,size.x,size.y,colour) else rect(origin.x,origin.y,size.x,size.y,colour) end elseif type==1 then if border then circb(origin.x,origin.y,size.x,colour) else circ(origin.x,origin.y,size.x,colour) end elseif type==2 then if border then ellib(origin.x,origin.y,size.x,size.y,colour) else elli(origin.x,origin.y,size.x,size.y,colour) end elseif type==3 then if border then trib( origin.x-size.x,origin.y+size.y, origin.x+size.x,origin.y+size.y, origin.x,origin.y-size.y, colour) else tri( origin.x-size.x,origin.y+size.y, origin.x+size.x,origin.y+size.y, origin.x,origin.y-size.y, colour) end elseif type==4 then line(origin.x,origin.y,origin.x+size.x,origin.y-size.y,colour) elseif type==5 then pix(origin.x,origin.y,colour) end end function catnipDraw(drawList,x,y) for i=1,#drawList do for j=1,#drawList[i] do local s=drawList[i][j] drawShape( s.t, {x=s.x+x,y=s.y+y}, {x=s.w,y=s.h}, s.b==1 and true or false,s.c) end end end function catnipBkg() local drawList={ {{t=0,b=0,x=-3,y=94,w=250,h=157,c=6},{t=0,b=0,x=-3,y=-1,w=246,h=39,c=6},{t=2,b=0,x=8,y=11,w=31,h=15,c=7},{t=2,b=0,x=56,y=25,w=30,h=16,c=7},{t=2,b=0,x=101,y=6,w=35,h=15,c=7},{t=2,b=0,x=105,y=30,w=33,h=10,c=7},{t=2,b=0,x=156,y=16,w=23,h=12,c=7},{t=2,b=0,x=144,y=31,w=25,h=10,c=7},{t=2,b=0,x=193,y=6,w=28,h=12,c=7},{t=2,b=0,x=191,y=28,w=21,h=12,c=7},{t=2,b=0,x=223,y=10,w=19,h=9,c=7},{t=2,b=0,x=235,y=30,w=24,h=12,c=7},{t=2,b=0,x=10,y=6,w=26,h=10,c=8},{t=2,b=0,x=56,y=23,w=29,h=12,c=8},{t=2,b=0,x=99,y=2,w=31,h=11,c=8},{t=2,b=0,x=101,y=27,w=27,h=6,c=8},{t=2,b=0,x=143,y=31,w=22,h=5,c=8},{t=2,b=0,x=153,y=13,w=20,h=9,c=8},{t=2,b=0,x=188,y=24,w=24,h=6,c=8},{t=2,b=0,x=191,y=4,w=25,h=10,c=8},{t=2,b=0,x=223,y=9,w=19,h=7,c=8},{t=2,b=0,x=232,y=28,w=20,h=9,c=8},{t=2,b=0,x=10,y=3,w=24,h=8,c=9},{t=2,b=0,x=51,y=20,w=26,h=10,c=9},{t=2,b=0,x=102,y=26,w=23,h=3,c=9},{t=2,b=0,x=98,y=0,w=30,h=6,c=9},{t=2,b=0,x=142,y=29,w=18,h=4,c=9},{t=2,b=0,x=150,y=11,w=20,h=6,c=9},{t=2,b=0,x=189,y=4,w=25,h=6,c=9},{t=2,b=0,x=224,y=7,w=17,h=5,c=9},{t=2,b=0,x=233,y=24,w=20,h=6,c=9},{t=2,b=0,x=187,y=21,w=23,h=5,c=9},{t=2,b=0,x=124,y=16,w=15,h=5,c=8},{t=2,b=0,x=147,y=0,w=23,h=5,c=8},{t=2,b=0,x=80,y=14,w=19,h=8,c=8},{t=2,b=0,x=47,y=2,w=20,h=7,c=8},{t=2,b=0,x=8,y=25,w=24,h=9,c=8},{t=2,b=0,x=123,y=13,w=14,h=3,c=9},{t=2,b=0,x=149,y=0,w=16,h=2,c=9},{t=2,b=0,x=46,y=0,w=20,h=5,c=9},{t=2,b=0,x=78,y=12,w=15,h=6,c=9},{t=2,b=0,x=12,y=21,w=18,h=7,c=9},},{{t=0,b=0,x=85,y=35,w=94,h=69,c=9},{t=0,b=0,x=182,y=35,w=61,h=69,c=9},{t=0,b=0,x=-2,y=35,w=84,h=69,c=9},{t=0,b=0,x=82,y=35,w=3,h=69,c=6},{t=0,b=0,x=179,y=35,w=3,h=70,c=6},{t=0,b=0,x=-2,y=40,w=246,h=3,c=6},{t=0,b=0,x=-4,y=36,w=86,h=4,c=7},{t=0,b=0,x=86,y=36,w=92,h=4,c=7},{t=0,b=0,x=177,y=36,w=2,h=4,c=7},{t=0,b=0,x=183,y=36,w=58,h=4,c=7},{t=0,b=0,x=65,y=80,w=12,h=24,c=5},{t=0,b=0,x=161,y=81,w=12,h=23,c=5},{t=0,b=0,x=68,y=87,w=8,h=12,c=5},{t=0,b=0,x=67,y=82,w=8,h=10,c=3},{t=0,b=0,x=67,y=93,w=8,h=9,c=3},{t=0,b=0,x=163,y=83,w=8,h=9,c=3},{t=0,b=0,x=163,y=93,w=8,h=9,c=3},{t=0,b=0,x=68,y=83,w=6,h=8,c=4},{t=0,b=0,x=68,y=94,w=6,h=7,c=4},{t=0,b=0,x=164,y=84,w=6,h=7,c=4},{t=0,b=0,x=164,y=94,w=6,h=7,c=4},{t=1,b=0,x=171,y=92,w=1,h=0,c=15},{t=1,b=0,x=75,y=92,w=1,h=0,c=15},{t=0,b=0,x=3,y=81,w=22,h=15,c=12},{t=0,b=0,x=31,y=81,w=28,h=15,c=12},{t=0,b=0,x=3,y=48,w=22,h=16,c=12},{t=0,b=0,x=29,y=48,w=26,h=16,c=12},{t=0,b=0,x=59,y=48,w=19,h=16,c=12},{t=0,b=0,x=89,y=49,w=24,h=14,c=12},{t=0,b=0,x=118,y=49,w=27,h=14,c=12},{t=0,b=0,x=149,y=49,w=26,h=14,c=12},{t=0,b=0,x=91,y=82,w=27,h=14,c=12},{t=0,b=0,x=123,y=82,w=28,h=14,c=12},{t=0,b=0,x=187,y=48,w=20,h=16,c=12},{t=0,b=0,x=213,y=48,w=21,h=16,c=12},{t=0,b=0,x=187,y=82,w=20,h=15,c=12},{t=0,b=0,x=214,y=82,w=20,h=15,c=12},{t=0,b=0,x=63,y=77,w=16,h=3,c=7},{t=0,b=0,x=159,y=78,w=16,h=3,c=7},}, {{t=0,b=0,x=5,y=50,w=18,h=12,c=8},{t=0,b=0,x=31,y=50,w=22,h=12,c=8},{t=0,b=0,x=61,y=50,w=15,h=12,c=8},{t=0,b=0,x=5,y=83,w=18,h=11,c=8},{t=0,b=0,x=33,y=83,w=24,h=11,c=8},{t=0,b=0,x=93,y=84,w=23,h=10,c=8},{t=0,b=0,x=125,y=84,w=24,h=10,c=8},{t=0,b=0,x=91,y=51,w=20,h=10,c=8},{t=0,b=0,x=120,y=51,w=23,h=10,c=8},{t=0,b=0,x=151,y=51,w=22,h=10,c=8},{t=0,b=0,x=189,y=50,w=16,h=12,c=8},{t=0,b=0,x=215,y=50,w=17,h=12,c=8},{t=0,b=0,x=189,y=84,w=16,h=11,c=8},{t=0,b=0,x=216,y=84,w=16,h=11,c=8},{t=0,b=0,x=13,y=50,w=2,h=12,c=12},{t=0,b=0,x=38,y=49,w=2,h=13,c=12},{t=0,b=0,x=31,y=52,w=7,h=2,c=12},{t=0,b=0,x=71,y=49,w=2,h=13,c=12},{t=0,b=0,x=100,y=50,w=2,h=12,c=12},{t=0,b=0,x=127,y=51,w=2,h=10,c=12},{t=0,b=0,x=135,y=50,w=2,h=11,c=12},{t=0,b=0,x=165,y=51,w=2,h=10,c=12},{t=0,b=0,x=189,y=52,w=17,h=2,c=12},{t=0,b=0,x=226,y=50,w=2,h=12,c=12},{t=0,b=0,x=223,y=83,w=2,h=12,c=12},{t=0,b=0,x=215,y=88,w=18,h=2,c=12},{t=0,b=0,x=199,y=84,w=2,h=11,c=12},{t=0,b=0,x=132,y=83,w=2,h=11,c=12},{t=0,b=0,x=141,y=84,w=2,h=11,c=12},{t=0,b=0,x=99,y=83,w=2,h=11,c=12},{t=0,b=0,x=108,y=83,w=2,h=11,c=12},{t=0,b=0,x=40,y=82,w=2,h=12,c=12},{t=0,b=0,x=48,y=82,w=2,h=12,c=12},{t=0,b=0,x=11,y=83,w=2,h=12,c=12},}, } catnipDraw(drawList,0,0) rect(5,67,55,9,4) rect(95,67,55,9,4) rect(190,67,55,9,4) print("IRISH PUB",8,69,15) print("IRISH PUB",98,69,15) print("IRISH PUB",193,69,15) end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end function catnipSetParticle() local x=math.random(240) local y=math.random(35) for i=1,20*4 do particles[i] = { x=x, y=y, dx=math.random()*2-1, dy=math.random()*2-1 } if i%20==0 then x=math.random(240) y=math.random(35) end end end -- Prescene function myPRESCENE() setExamplePalette() vbank(0) cls() catnipBkg() vbank(1) cls() catnipSetParticle() end function leg(p,t) local x=p.x local y=p.y+12 local tl=math.sin(t)^3 local xs=math.sin(tl)*1.5 local ys=math.cos(tl)*1.5 for i=0,8 do local s=7-i/4 circ(x,y,s,5-i/4) x=x+xs y=y+ys end for i=0,8 do local s=5-i/4 circ(x,y,s,4-i/4) x=x-math.abs(xs) y=y+ys end end function arm(p,t) local x=p.x local y=p.y-12 local tl=t/4+math.sin(t/2)^3 local xs=-math.cos(tl*2+1)*1.5 local ys=math.sin(tl*2)*1.5 for i=0,8 do local s=7-i/4 circ(x,y,s,5-i/4) x=x-xs y=y+ys end for i=0,8 do local s=5-i/4 circ(x,y,s,4-i/4) x=x+math.abs(xs) y=y+ys end end function lepcat(t,p) local drawlist={ {{t=2,b=0,x=48,y=82,w=11,h=19,c=4},{t=2,b=0,x=49,y=80,w=8,h=13,c=5},{t=2,b=0,x=49,y=56,w=7,h=6,c=14},{t=0,b=0,x=42,y=60,w=13,h=5,c=4},{t=3,b=0,x=54,y=62,w=3,h=3,c=4},{t=3,b=0,x=42,y=63,w=3,h=2,c=4},{t=2,b=0,x=49,y=50,w=9,h=2,c=5},{t=0,b=0,x=45,y=39,w=10,h=10,c=3},{t=0,b=0,x=49,y=39,w=4,h=10,c=4},{t=4,b=0,x=51,y=39,w=0,h=-9,c=5},}, } arm({x=p.x+48,y=p.y+82},-t*math.pi*16-4) leg({x=p.x+48,y=p.y+82},t*math.pi*16+1.5) catnipDraw(drawlist,p.x,p.y) leg({x=p.x+48,y=p.y+82},t*math.pi*16) arm({x=p.x+48,y=p.y+82},t*math.pi*16+1) end function lepcat2(t,p) local drawList={{{t=2,b=0,x=121,y=137,w=75,h=21,c=3},{t=2,b=0,x=121,y=136,w=58,h=15,c=4},},{{t=2,b=0,x=157,y=41,w=12,h=18,c=14},{t=2,b=0,x=95,y=42,w=12,h=18,c=14},{t=2,b=0,x=156,y=42,w=9,h=15,c=15},{t=2,b=0,x=96,y=42,w=9,h=15,c=15},{t=2,b=0,x=124,y=80,w=66,h=43,c=14},{t=2,b=0,x=125,y=76,w=58,h=35,c=15},{t=2,b=0,x=125,y=99,w=8,h=10,c=11},{t=2,b=0,x=120,y=100,w=1,h=5,c=10},{t=4,b=0,x=129,y=90,w=0,h=-4,c=10},{t=4,b=0,x=130,y=91,w=0,h=-1,c=10},{t=4,b=0,x=128,y=90,w=0,h=-2,c=10},{t=0,b=0,x=115,y=99,w=20,h=11,c=15},{t=2,b=0,x=144,y=68,w=9,h=13,c=10},{t=2,b=0,x=106,y=70,w=8,h=12,c=10},{t=2,b=0,x=139,y=91,w=7,h=6,c=14},{t=2,b=0,x=110,y=91,w=7,h=6,c=14},{t=2,b=0,x=139,y=89,w=7,h=5,c=15},{t=2,b=0,x=110,y=90,w=7,h=5,c=15},{t=2,b=0,x=110,y=90,w=7,h=5,c=15},{t=2,b=0,x=125,y=105,w=9,h=5,c=14},{t=2,b=0,x=125,y=104,w=13,h=4,c=15},{t=2,b=0,x=155,y=102,w=12,h=7,c=14},{t=2,b=0,x=156,y=100,w=12,h=6,c=15},{t=2,b=0,x=98,y=103,w=11,h=5,c=14},{t=2,b=0,x=97,y=102,w=12,h=4,c=15},{t=2,b=0,x=125,y=81,w=3,h=2,c=11},{t=2,b=0,x=127,y=83,w=2,h=1,c=11},{t=2,b=0,x=123,y=83,w=2,h=1,c=11},},{{t=2,b=0,x=124,y=47,w=85,h=3,c=5},{t=2,b=0,x=124,y=44,w=70,h=2,c=5},{t=2,b=0,x=118,y=43,w=57,h=5,c=5},{t=0,b=0,x=106,y=0,w=40,h=39,c=1},{t=0,b=0,x=109,y=1,w=35,h=38,c=2},{t=0,b=0,x=116,y=1,w=25,h=38,c=3},{t=0,b=0,x=126,y=1,w=12,h=38,c=4},{t=0,b=0,x=132,y=1,w=3,h=38,c=5},{t=2,b=0,x=124,y=48,w=63,h=3,c=4},{t=2,b=0,x=124,y=51,w=38,h=2,c=15},{t=0,b=0,x=80,y=115,w=26,h=10,c=4},{t=0,b=0,x=144,y=115,w=24,h=14,c=4},{t=3,b=0,x=105,y=120,w=5,h=6,c=5},{t=3,b=0,x=144,y=120,w=5,h=6,c=5},},} catnipDraw(drawList,p.x,p.y) local x=133+p.x local y=99+p.y local ox=-math.cos(t*math.pi*16+1)^1 local oy=1 circ(p.x+104,p.y+67,5,11) circ( p.x+144+(math.sin(t*math.pi*16)^3)*5, p.y+69+math.abs(math.cos(t*math.pi*16)^3)*7,5,11) for i=0,8 do local j=i+1 local s=i==8 and 2 or 1 local ox2=i*i*i*0.005*math.sin(t*math.pi*16) circ(x+ox2,y,s,9) if i==8 then circ(x+ox2,y,s-1,10) end local w=5 line(1+x+(i+1)*w,p.y+87+(i*i)/8,1+x+(i+2)*w,p.y+87+(j*j)/8,10) line(3+x+(i+1)*w,p.y+90+(i*i)/6,3+x+(i+2)*w,p.y+90+(j*j)/6,10) line(1+x+(i+1)*w,p.y+93+(i*i)/4,1+x+(i+2)*w,p.y+93+(j*j)/4,10) line(-(18-x+(i+1)*w),p.y+87+(i*i)/8,-(18-x+(i+2)*w),p.y+87+(j*j)/8,10) line(-(20-x+(i+1)*w),p.y+90+(i*i)/6,-(20-x+(i+2)*w),p.y+90+(j*j)/6,10) line(-(18-x+(i+1)*w),p.y+93+(i*i)/4,-(18-x+(i+2)*w),p.y+93+(j*j)/4,10) x=x+ox y=y+oy end end -- Your amazing effect local fc=0 function myTIC(t) vbank(0) rect(0,0,240,35,0) clip(0,0,240,35) if fc%32==0 then catnipSetParticle() end local col=5-(fc%60)/20+((fc//60)%3)*5 for i=1,#particles do local p=particles[i] pix(p.x,p.y,col) p.x=p.x+p.dx p.y=p.y+p.dy p.dy=p.dy+0.03 end clip() vbank(1) cls() if t<0.5 then vbank(1) cls() lepcat(t,{x=-80+t*570,y=math.sin(t*math.pi*16)*20-10}) else lepcat2(t,{ x=math.sin(t*math.pi*16)^3*20, y=(t<.625 and 120-(t-.5)*960 or 0)-math.abs(math.cos(t*math.pi*16))*20+20 }) end fc=fc+1 end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() vbank(0) cls() vbank(1) cls() vbank(0) end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorssuule=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "suule" local SIN,COS,PI,FLOOR,MIN,MAX = math.sin,math.cos,math.pi,math.floor,math.min,math.max -- Palette: -- 0 (border) 0, 0, 0 -- PLease use the flag colours -- in the rest of your palette: -- Green: 0, 154, 68 -- White: 255, 255, 255 -- Orange: 255, 130, 0 local scroll_text = '' -- LOAD SPRITES function myPRESCENE() drawdit() setExamplePalette() rspr(eye0,0) rspr(eye1,1) rspr(eye2,2) rspr(lhand1,16) rspr(lhand2,17) rspr(lhand3,32) rspr(lhand4,33) rspr(lhand5,48) rspr(lhand6,49) rspr(rhand1,18) rspr(rhand2,19) rspr(rhand3,34) rspr(rhand4,35) rspr(rhand5,50) rspr(rhand6,51) end -- SPRITE DATA eye0={ 4,9,4,8, 2,10,1,4,1,10, 1,0,1,4,1,10,1,7, 1,9,1,10,1,5,2,0,1,5,1,10,1,9, 1,15,1,9,1,10,2,5,1,10,1,9, 3,15,4,9,26,15} eye1={ 1,7,3,15,2,7,2,9, 1,10,4,15,1,9,1,10,1,0, 1,9,4,15,1,9,2,0, 6,15,1,9,1,4,32,15} eye2={ 2,9,6,15, 1,4,1,10,6,15, 1,4,1,10,6,15, 1,10,7,15, 2,9,6,15, 1,10,1,9,22,15} lhand1={ 8,15, 3,15,1,9,4,15, 2,15,1,10,1,9,2,10,2,15, 1,15,2,10,2,9,1,10,2,15, 1,15,3,10,1,9,1,10,2,15, 1,15,3,10,1,9,1,10,2,15, 2,15,2,10,1,9,1,10,2,15, 2,15,2,10,1,9,2,10,1,15} lhand2={64,15} lhand3={ 2,15,2,10,1,9,2,10,1,15, 2,15,2,10,1,8,2,9,1,15, 2,15,2,10,2,8,2,10, 2,15,1,10,5,9, 2,15,2,9,4,10, 1,15,1,9,6,10, 1,15,5,10,2,9, 1,9,3,10,2,9,2,8} lhand4={ 8,15, 8,15, 1,9,1,10,6,15, 2,9,1,10,1,9,4,15, 1,10,2,9,1,10,1,9,3,15, 2,10,1,9,1,10,1,9,3,15, 2,9,1,10,1,8,1,10,1,9,2,15, 3,10,1,9,1,10,1,9,2,15} lhand5={ 1,9,5,10,1,9,1,8, 1,15,1,9,4,10,2,9, 1,15,1,8,1,9,4,10,1,9, 2,15,1,8,1,9,3,10,1,9, 2,15,2,8,3,10,1,9, 3,15,1,8,2,9,2,10, 3,15,2,8,3,9, 4,15,3,8,1,9} lhand6={ 1,9,2,10,1,9,1,10,1,9,2,15, 1,9,1,8,1,9,3,8,2,15, 2,10,1,8,1,9,1,8,3,15, 3,10,1,9,1,8,3,15, 3,10,1,8,4,15, 2,10,2,9,4,15, 1,10,2,9,5,15, 2,9,6,15} rhand1={ 2,10,1,8,4,9,1,15, 2,10,2,7,1,9,3,10, 1,10,2,7,5,10, 1,10,1,7,6,10, 1,7,1,8,6,10, 1,7,1,9,6,10, 2,7,1,8,1,9,4,10, 2,7,2,8,4,10} rhand2={ 8,15, 2,9,6,15, 1,10,2,9,5,15, 2,10,2,9,4,15, 4,10,1,9,3,15, 2,10,1,9,1,10,1,9,3,15, 5,10,1,9,2,15, 1,9,2,10,1,9,1,10,1,9,2,15} rhand3={ 1,8,1,7,2,8,1,9,3,10, 1,6,1,0,1,7,2,8,2,9,1,10, 1,6,2,0,1,7,2,8,2,10, 1,6,3,0,2,15,1,9,1,10, 6,15,1,8,1,9, 6,15,1,8,1,9, 7,15,1,8, 8,15} rhand4={ 1,10,1,9,1,10,1,9,2,10,2,15, 1,10,1,9,2,10,1,9,1,10,2,15, 1,10,1,9,2,10,1,9,1,10,2,15, 1,10,1,9,2,10,1,9,1,10,2,15, 2,10,1,9,1,10,1,9,1,10,2,15, 2,10,1,9,2,10,1,9,2,15, 2,10,1,9,2,10,1,9,2,15, 2,10,1,9,2,10,1,9,2,15} rhand5={64,15} rhand6={ 1,8,1,10,1,8,2,10,1,9,2,15, 1,15,2,8,2,10,3,15, 3,15,1,9,1,10,3,15, 8,15, 8,15, 8,15, 8,15, 8,15} -- SHAPE DATA local shrckrot = {} local shrck={ 0,0,20, 30,20,20, 40,10,20, 40,-10,20, 30,-20,20, 0,0,20, -30,20,20, -40,10,20, -40,-10,20, -30,-20,20, 0,0,20, 20,30,20, 10,40,20, -10,40,20, -20,30,20, 0,0,20, 20,-30,20, 10,-40,20, -10,-40,20, -20,-30,20, 0,0,20, 30,-30,15, 40,-50,10} ticlin={1,0,56,0,10, 0,1,0,40,10, 0,41,56,41,8, 0,42,57,42,7, 57,1,57,41,8, 3,3,54,3,8, 3,3,3,35,8, 54,4,54,35,10, 4,35,54,35,10, 0,43,56,43,10, 0,43,0,51,10, 0,52,57,52,8, 57,43,57,52,8, 2,46,4,46,10, 3,46,3,50,10, 6,46,6,50,10, 9,46,10,46,10, 9,50,10,50,10, 8,47,8,49,10, 12,48,12,48,10, 14,47,15,46,10, 15,46,16,47,10, 14,47,16,49,10, 16,47,14,49,10, 14,49,15,50,10, 15,50,16,49,10, 18,47,18,49,10, 20,47,20,49,10, 18,47,19,46,10, 19,46,20,47,10, 18,49,19,50,10, 19,50,20,49,10, 2,45,4,45,7, 3,45,3,49,7, 6,45,6,49,7, 9,45,10,45,7, 9,49,10,49,7, 8,46,8,48,7, 12,47,12,47,7, 14,46,15,45,7, 15,45,16,46,7, 14,46,16,48,7, 16,46,14,48,7, 14,48,15,49,7, 15,49,16,48,7, 18,46,18,48,7, 20,46,20,48,7, 18,46,19,45,7, 19,45,20,46,7, 18,48,19,49,7, 19,49,20,48,7, 27,45,25,50,7, 28,45,26,50,8, 29,45,27,50,7, 30,45,28,50,8, 31,45,29,50,7, 32,45,30,50,8, 33,45,31,50,7, 34,45,32,50,8, 35,45,33,49,10, 25,50,32,50,10, 40,45,53,45,8, 39,46,54,46,8, 40,47,53,47,10, 40,46,53,46,0, 42,45,43,45,7, 42,47,43,47,8, 40,49,42,49,15, 51,49,53,49,10, 51,50,53,50,8, 51,38,53,38,5} ticrec={1,1,56,40,9, 3,3,52,33,6, 5,6,48,27,0, 6,5,46,29,0, 1,44,56,8,9} tickey={ 1,1,51,1,10,-2,3,54,3,10,-5,5,57,5,10, -7,7,60,7,10,-10,9,63,9,10,-12,11,67,11,10, 56,1,59,1,10,57,2,60,2,7, 59,3,62,3,10,60,4,64,4,7, 62,5,65,5,10,63,6,66,6,7, 65,7,68,7,10,66,8,69,8,7, 4,1,-8,11,8,6,1,-4,11,8, 9,1,3,8,8, 11,1,8,8,8, 14,1,11,8,8, 17,1,14,8,8, 20,1,18,8,8, 23,1,22,8,8, 26,1,25,8,8, 28,1,28,8,8, 31,1,32,8,8, 34,1,36,8,8, 37,1,39,8,8, 40,1,42,8,8, 43,1,47,11,8, 43,1,47,11,8,46,1,51,11,8, 49,1,58,11,8, 0,2,53,2,7,-3,4,56,4,7,-6,6,57,6,7, -8,8,60,8,7,-10,10,63,10,7} local gear={ -7,0,-4,0,-11,2,-4,2,10, -4,0,0,0,-4,2,0,2,10, -11,2,-4,2,-9,4.5,-5,5.5,10, -4,2,0,2,-5,5.5,-2,6,9, -11,2,-3,2,-9,4.5,-9,4.5,9} local ghr={ -19,-12,-15,-9,-15,-7,-13,-7,13, -15,-7,-13,-7,-12,-2,-10,-4,13, -12,-2,-10,-4,-10,4,-7,2,13, 0,-12,1,-9,0,-7,2,-6,13, 0,-7,2,-6,1,0,3,-1,13, -19,-12,-15,-9,-16,-11,-13,-9,14, -16,-11,-13,-9,-13,-7,-11,-7,14, -13,-7,-11,-7,-10,-4,-7,-4,14, -10,-4,-7,-4,-7,2,-5,-1,14, 0,-16,2,-9,0,-12,1,-9,14, 1,-9,2,-9,2,-6,4,-6,14, 2,-6,4,-6,3,-1,5,-2,14, -5,-2,0,-2,-5,0,0,0,11, 0,-2,3,-1,0,0,3,1,11, 6,-2,11,-2,8,-1,11,0,11, 11,-2,15,1,11,0,15,2,11, 3,-1,7,1,3,1,6,5,11, 7,1,12,4,6,5,11,5,11, 6,5,11,5,9,7,11,6,11, 12,4,15,6,11,5,13,7,11, 13,7,15,6,14,9,15,10,11, 1,3,5,6,1,5,5,8,11, -3,2,1,3,-3,6,1,5,11, -6,1,-3,2,-6,8,-3,6,11, -5,-2,-5,0,-9,1,-6,1,11, -9,1,-6,1,-12,4,-8,5,11, -8,5,-6,1,-8,8,-6,8,11, -12,4,-8,5,-13,8,-8,8,11, -13,8,-8,8,-13,17,-8,17,11, -13,17,-8,17,-13,23,-10,24,11, -13,23,-10,24,-9,28,-8,27,11, -8,17,-7,21,-10,24,-8,23,11, -7,21,-6,24,-8,23,-7,25,11, -8,8,-6,8,-8,17,-6,14,12, -8,17,-6,14,-6,19,-5,18,12, -5,0,0,0,-6,1,-3,2,12, 0,0,3,1,-6,1,1,3,12, 3,1,6,5,1,3,5,6,12, 5,6,6,5,5,8,7,7,12, 0,-2,4,-3,3,-1,6,-2,12, 3,-1,6,-2,7,1,8,-1,12, 4,-3,10,-4,6,-2,11,-2,12, 10,-4,13,-3,11,-2,15,-2,12, 8,-1,7,1,11,0,12,4,12, 11,0,15,4,12,4,15,6,12} local ghd={-16,-13,-13,-17,-16,-9,-13,-12,9, -13,-17,-10,-18,-13,-12,-10,-12,10, -10,-18,0,-11,-10,-12,0,-9,10, -4,-19,0,-18,-10,-18,0,-11,10, 0,-18,5.5,-15,0,-11,5.5,-11,10, 0,-11,5.5,-11,0,-9,5.5,-9,9, 0,-9,4,-9,4,-6,5,-6,9, -16,-9,-13,-12,-16,-4,-13,-2,9, -13,-12,-10,-12,-13,-2,-10,0,10, -10,-12,0,-9,-10,0,0,0,10, 0,-9,4,-6,0,0,4,2,10, 3.5,-6,6,-5,3.5,2,6,1,10, 6,-5,6.5,-4,6,1,6.5,2,9, -16,-4,-13,-2,-14,2,-12,2,8, -13,-2,-10,0,-12,2,-9,2,9, -10,0,0,0,-9,2,4,2,10, -14,2,-12,2,-11,5,-8,5,8, -12,2,-9,2,-8,5,-6,5,9, -9,2,4.5,2,-6,5,3.5,6,10, 6,1,6.5,-2,4.5,2,5.5,4,9, 4.5,2,5.5,4,3.5,6,4.5,6,9, -11,5,-8,5,-8,8,-6,8,8, -8,5,-6,5,-6,8,-4,8,9, -6,5,3.5,6,-4,8,2,9,10, 3.5,6,4.5,6,2,9,4.5,8,9, -8,8,-6,8,-6,10,-5,9,8, -6,8,-4,8,-5,9,-3,10,9, -4,8,2,9,-3,10,0,10,10, 2,9,4.5,8,2,14,3.5,12,9, -5,9,-3,10,-6,10,-4,11,8, -4,11,-3,10,-3,12,-2,12,9, -3,10,0,10,-2,12,-1,12,10, -1,12,0,10,0,13,1,13,10} local gnsmo={-2,-2,0,0,8, 2,-2,0,0,8, -1,-1,1,-1,8, -7,3,-4,6,8, -6,4,3,4,8, -4,6,2,6,8} local gglss={-2,-4,2,-4,7, -2,4,2,4,7, -4,2,-4,-2,7, 4,2,4,-2,7, -2,-4,-4,-2,7, -2,4,-4,2,7, 2,-4,4,-2,7, 2,4,4,2,7, 16,-2,16,2,7, 10,-4,14,-4,7, 14,-4,16,-2,7, 10,-4,8,-2,7, 14,4,16,2,7, 8,-1,4,1,7} local gpnts={-19,-13,-4,-18,-19,-10,-6,-14,11, -4,-18,-1,-19,-6,-14,-1,-15,11, -1,-19,2,-19,-1,-15,2,-15,8, 2,-19,7,-19,2,-15,7,-15,8, 7,-19,12,-18,7,-15,12,-14,11, 12,-18,16,-16,12,-14,17,-8,11, -19,-10,-6,-14,-20,-7,-7,-9,11, -6,-14,-1,-15,-7,-9,-1,-9,12, -1,-15,2,-15,-1,-9,3,-11,12, 2,-15,7,-15,3,-11,8,-11,12, 7,-15,12,-14,8,-11,14,-8,12, 12,-14,16,-13,14,-8,17,-8,12, -20,-7,-7,-9,-20,-4,-10,-5,11, -7,-9,-1,-9,-10,-5,-7,-4,12, -1,-9,3,-11,-7,-4,4,-3,13, 3,-11,8,-11,4,-3,8,-4,13, 8,-11,14,-8,8,-4,9,-3,13, -20,-4,-10,-5,-20,0,-14,-1,11, -10,-5,-7,-4,-14,-1,-7,-1,12, -7,-4,4,-3,-7,-1,0,0,13, 4,-3,5,-1,0,0,4,0,12, 4,-3,8,-4,5,-1,8,-1,12, 8,-4,9,-3,8,-1,10,-2,12, 9,-3,14,-8,10,-2,15,-3,13, 14,-8,17,-8,15,-3,18,-3,12, -20,0,-14,-1,-19,8,-13,9,11, -14,-1,-7,-1,-13,9,-8,9,12, -7,-1,0,0,-8,9,0,10,13, 0,0,4,0,0,10,4,10,13, 4,0,5,-1,4,10,7,10,11, 5,-1,8,-1,7,10,10,9,12, 8,-1,10,-2,10,9,13,8,13, 10,-2,15,-3,13,8,17,6,13, 15,-3,18,-3,17,6,19,2,12, -20,0,-14,-1,-19,8,-13,9,11, -14,-1,-7,-1,-13,9,-8,9,12, -7,-1,0,0,-8,9,0,10,13, 0,0,4,0,0,10,4,10,13, 4,0,5,-1,4,10,7,10,11, 5,-1,8,-1,7,10,10,9,12, 8,-1,10,-2,10,9,13,8,13, 10,-2,15,-3,13,8,17,6,13, 15,-3,18,-3,17,6,19,2,12, -20,0,-14,-1,-19,8,-13,9,11, -14,-1,-7,-1,-13,9,-8,9,12, -7,-1,0,0,-8,9,0,10,13, 0,0,4,0,0,10,4,10,13, 4,0,5,-1,4,10,7,10,11, 5,-1,8,-1,7,10,10,9,12, 8,-1,10,-2,10,9,13,8,13, 10,-2,15,-3,13,8,17,6,13, 15,-3,18,-3,17,6,19,2,12, -19,8,-13,9,-17,21,-12,22,11, -13,9,-8,9,-12,22,-6,22,12, -8,9,0,10,-6,22,0,23,13, 0,10,4,10,0,23,6,22,13, 4,10,7,10,6,22,9,23,11, 7,10,10,9,9,23,12,22,12, 10,9,13,8,12,22,15,21,13, 13,8,17,6,15,21,18,20,13, 17,6,19,2,18,20,20,20,12} local gnecc={ -6,-3,2, 4,-2,2, -6,3,2, -3,6,2, 7, 4,-2,2, 0,0,2, -3,6,2, 1,10,2, 9, 0,0,2, 6,1,2, 1,10,2, 5,9,2, 9, 6,1,2, 8,1,2, 5,9,2, 8,9,2, 8, -6,3,2, -3,6,2, -7,8,1, -3,10,1, 7, -3,6,2, 1,10,2, -3,10,1, 0,12,1, 7, 1,10,2, 5,9,2, 0,12,1, 5,12,1, 8, 5,9,2, 8,9,2, 5,12,1, 8,12,1, 8} local gsuit={ -18,-1,-14,-1,-20,0,-13,0,11, -14,-1,-8,-3,-13,0,-7,-2,12, -8,-3,-5,-6,-3,-3,-7,-2,9, -20,0,-13,0,-23,3,-12,3,11, -13,0,-7,-2,-12,3,-4,4,13, -3,-3,-7,-2,-4,4,0,0,10, -23,3,-11,3,-24,7,-11,6,11, -11,3,-4,4,-11,6,-4,5,13, -4,4,0,0,-4,5,-2,5,11, 0,0,1,1,-2,5,1,3,13, -24,7,-11,6,-24,14,-11,14,11, -11,6,-4,5,-11,14,-4,14,13, -4,5,-2,5,-6,14,1,15,13, -2,5,1,3,1,15,2,8,13, 2,8,3,12,1,15,3,15,13, -24,14,-11,14,-24,19,-15,19,11, -15,19,-11,14,-17,22,-11,19,12, -11,14,-6,14,-11,19,-8,18,12, -6,14,3,15,-8,18,4,19,13, -24,19,-15,19,-23,22,-17,22,11, -23,22,-17,22,-20,25,-20,25,11, -17,22,-11,19,-20,25,-10,25,12, -11,19,-8,18,-10,25,-7,25,13, -8,18,4,19,-7,25,4,25,13, -20,25,-10,25,-17,36,-9,35,12, -10,25,-7,25,-9,35,-7,30,13, -7,25,4,25,-7,30,5,30,13, -7,30,5,30,-9,35,5,33,13, -17,36,-9,35,-11,48,-7,42,12, -9,35,5,33,-7,42,5,43,13, -17,36,-11,48,-15,48,-14,53,11, -11,48,-7,42,-14,53,-3,48,12, -7,42,5,43,-3,48,5,48,13, -14,53,-3,48,-14,57,-7,55,12, -3,48,5,48,-7,55,4,53,13, -14,57,-7,55,-15,65,-8,60,12, -7,55,4,53,-8,60,4,57,13, -15,65,-8,60,-16,69,-8,64,0, -8,60,4,57,-8,64,1,60,0, 1,3,4,6,2,8,5,8,9, 2,8,5,8,3,12,5,12,10, 3,12,5,12,3,15,5,15,10, 3,15,5,15,4,19,4,19,10, 8,6,9,4,8,8,10,8,10, 8,8,10,8,9,12,11,12,10, 9,12,11,12,10,15,12,15,10, 10,15,12,15,10,18,13,18,10, 10,18,13,18, 11,25, 13,25,10, 11,25, 13,25,8,35, 14,34,10, 8,35, 14,34,8,40,14,39,9, 5,33,8,40,5,43,8,43,9, 8,40,14,39,8,43,14,48,9, 5,43,8,43,5,48,14,48,9, 5,48,14,48,4,53,14,52,9, 8,1,9,1,9,4,10,4,13, 9,1,11,-1,10,4,12,0,8, 9,1,11,-2,10,3,12,0,9, 8,1,9,1,9,4,10,3,14, 10,3,12,0,9,4,17,3,13, 9,4,17,3,10,8,19,8,13, 10,8,19,8,11,12,20,12,13, 11,12,20,12,12,15,21,15,13, 12,15,21,15,13,18,21,18,13, 13,18,21,18,13,25,20,25,13, 13,25,20,25,14,34,20,33,13, 14,34,20,33,14,39,20,37,13, 14,39,20,37,14,48,20,48,13, 20,37,21,42,20,48,22,48,12, 14,48,20,48,14,52,20,52,13, 20,48,22,48,20,52,23,52,12, 14,52,20,52,14,55,19,56,13, 20,52,23,52,19,56,24,57,12, 14,55,19,56,15,57,19,58,0, 19,56,24,57,19,58,25,59,0, 1,1,4,2,1,3,4,6,14, 4,2,7,2,4,6,8,6,15, 7,2,8,1,8,6,9,4,15, 4,6,8,6,5,8,8,8,14, 5,8,8,8,5,12,9,12,15, 5,12,9,12,5,15,10,15,15, 5,15,10,15,4,19,10,18,15, 4,19,10,18,4,25,11,25,15, 4,25,11,25,5,30,8,35,15, 5,30,8,35,5,33,8,40,14, 8,35,11,25,8,40,11,27,14} local gsuitdet={ 0,0,-4,3,12,-4,3,-7,12,12, -7,12,-1,13,12,-1,13,-1,16,12, -1,16,-5,18,12,-5,18,0,23,12, 0,23,5,30,12,5,30,5,33,12, 1,3,2,8,12,2,8,3,12,12, 3,12,3,15,12,3,15,4,19,12, 4,19,4,25,12,4,25,5,30,12, 5,33,5,43,12,5,43,5,48,12, 5,48,4,53,12,4,53,4,57,12, 9,4,10,8,12, 10,8,11,12,12, 11,12,12,15,12, 12,15,13,18,12, 13,18,13,25,12, 13,25,14,34,12, 14,34,14,39,12, 14,39,14,48,12, 14,48,14,52,12, 14,52,14,54,12, 14,34,18,15,12, 18,15,14,14,12, 14,14,14,11,12, 14,11,16,7,12, 16,7,11,2,12} local grrm={ -2,-20,2,2,-21,2,1,-19,2,5,-19,2,12, 1,-19,2,5,-19,2,0,-5,2,6,-12,2,13, 0,-5,2,6,-12,2,2,-3,2,6,-8,2,12, 2,-3,2,6,-8,2,3,-2,2,6,-6,2,11, -2,-20,2,1,-19,2,-10,-11,2,-6,-11,2,12, -6,-11,2,1,-19,2,-2,0,1,0,-5,2,13, 0,-5,2,2,-3,2,-2,0,1, 0,0,1,12, 2,-3,2,3,-2,2,0,0,1,1,1,1,11, -10,-11,2,-6,-11,2,-15,-3,2,-13,-3,2,12, -6,-11,2,-2,0,1,-13,-3,2,-3,1,1,13, -14,-1,1,-13,-3,2,-7,1,1,-3,1,1,13, -17,3,1,-12,5,1,-19,9,1,-12,12,1,12, -15,-3,2,-13,-3,2,-17,1,1,-14,-1,1,12, -17,1,1,-14,-1,1, -21,4,1,-17,3,1,12, -21,4,1,-17,3,1, -22,8,1,-19,9,1,12, -14,-1,1,-7,1,1,-17,3,1,-12,5,1,13, -3,1,1, 1,1,1, -8,5,1, -1,6,1, 13, -8,5,1, 1,6,1, -8,12,1,-1,12,1, 12, 0,0,1, 6,3,1, -1,6,1, 6,8,1, 13, 6,3,1,12,6,1, 6,8,1, 11,10,1, 13, 12,6,1, 18,10,1,11,10,1, 15,13,1,13, 18,10,1,20,12,1,15,13,1,18,14,1,9, -1,6,1, 6,8,1, -1,12,1, 6,13,1,12, 6,8,1, 11,10,1, 6,13,1,10,17,1,12, 11,10,1, 15,13,1,10,17,1,14,19,1,12, 15,13,1,18,14,1,14,19,1,17,19,1,10, -1,12,1,6,13,1,-1,16,1,4,17,1,11, 6,13,1,10,17,1,4,17,1,10,21,1,11, 10,17,1,14,19,1,10,21,1,14,22,1,11, 14,19,1,17,19,1,14,22,1,17,22,1,8, 4,17,1,10,21,1, 4,18,1,11,23,1,11, 10,21,1,14,22,1,11,23,1,16,24,1,11, 14,22,1,17,22,1,16,24,1,18,23,1,6, -7,1,1,-3,1,1,-12,5,1, -8,5,1,12, -12,5,1, -8,5,1,-12,12,1,-8,12,1,12, -1,6,1, 6,8,1, -1,12,1,6,13,1,12, -2,0,1, 0,0,1, -3,1,1, 1,1,1, 12, -6,2,1,-5,1,1, -13,6,1,-9,5,1, 11} local glrma={ -4,1,2, -2,1,2, -4,3,2, -1,3,2, 9, -2,1,2, 5,0,2, -1,3,2, 6,2,2, 10, 5,0,2, 6.5,0,2, 6,2,2, 7.5,2,2, 9, -4,3,2, -1,3,2, -5,1,1, -2,0,1, 12, -1,3,2, 6,2,2, -2,0,1, 4,-4,1, 13, 6,2,2, 7.5,2,2, 4,-4,1, 6.5,-5,1, 12 } local glrmb={ -2,5,6,-5,0,5,5,0,12, -22,-8,-21,-26,-2,5,6,-5,12} local glrmc={ -4,-2,-2,-2,-2,7,1,7,8, -2,-2,2,-4,1,7,5,6,10} -- BASIC FUNCTIONS function drawdit() for i=0,30960 do local x=i%240 local y=i//240 poke4(i+0x18000,y/30+(x*2-y%2)%4/4+6) end end function rspr(sprarr,id) local con=0 for i=0,#sprarr//2-1 do local rep=sprarr[i*2+1] local col=sprarr[i*2+2] for j=1,rep do poke4(0x8000+con+id*64,col) con=con+1 end end end function qd(x1,y1,x2,y2,x3,y3,x4,y4,c) tri(x1,y1,x2,y2,x3,y3,c) tri(x2,y2,x3,y3,x4,y4,c) end function pl(ax,ay,la) for i=1,#la//5 do as=(i-1)*5 line(ax+la[as+1],ay+la[as+2],ax+la[as+3],ay+la[as+4],la[as+5]) end end function pr(ax,ay,la) for i=1,#la//5 do as=(i-1)*5 rect(ax+la[as+1],ay+la[as+2],la[as+3],la[as+4],la[as+5]) end end function pqs(ax,ay,la) for i=1,#la//9 do as=(i-1)*9 qd(ax+la[as+1],ay+la[as+2], ax+la[as+3],ay+la[as+4], ax+la[as+5],ay+la[as+6], ax+la[as+7],ay+la[as+8], la[as+9]) end end function pqsm(ax,ay,bx,by,cx,cy,dx,dy,la) local ofx={} local ofy={} ofx[1]=ax ofy[1]=ay ofx[2]=bx ofy[2]=by ofx[3]=cx ofy[3]=cy ofx[4]=dx ofy[4]=xy for i=1,#la//13 do as=(i-1)*13 qd(ofx[la[as+3]]+la[as+1],ofy[la[as+3]]+la[as+2], ofx[la[as+6]]+la[as+4],ofy[la[as+6]]+la[as+5], ofx[la[as+9]]+la[as+7],ofy[la[as+9]]+la[as+8], ofx[la[as+12]]+la[as+10],ofy[la[as+12]]+la[as+11], la[as+13]) end end function suuleRotY(X,Xo,Y,Yo,Z,Zo,deg) Xr=Xo+(X-Xo)*COS(deg)-(Z-Zo)*SIN(deg) Yr=Yo+Y Zr=Zo+(Z-Zo)*COS(deg)+(X-Xo)*SIN(deg) return {Xr,Yr,Zr} end function suuleRotX(X,Xo,Y,Yo,Z,Zo,deg) Xr=Xo+X Yr=Xo+(Y-Yo)*COS(deg)+(Z-Zo)*SIN(deg) Zr=Zo+(Z-Zo)*COS(deg)-(Y-Yo)*SIN(deg) return {Xr,Yr,Zr} end function rnd(num) return FLOOR(num+0.5) end function clmp(num,nmin,nmax) return MIN(MAX(num,nmin),nmax) end function drawhead(ax,ay) pqs(156+ax,33+ay,ghd) spr(0,144+ax,22+ay,15,1,0,0,3,1) pl(158+ax,32+ay,gnsmo) pl(148+ax,24+ay,gglss) pqs(149+ax,14+ay,ghr) pqs(141+ax,23+ay,gear) end function drawlhand(ax,ay,deg) pqs(ax,ay,glrmc) local rad=deg/180*PI local x1=-8*COS(rad)-(-24)*SIN(rad) local y1=-8*SIN(rad)+(-24)*COS(rad) local x2=7*COS(rad)-(-24)*SIN(rad) local y2=7*SIN(rad)+(-24)*COS(rad) local x3=-8*COS(rad) local y3=-8*SIN(rad) local x4=7*COS(rad) local y4=7*SIN(rad) ttri(ax+x1,ay+y1,ax+x2,ay+y2,ax+x3,ay+y3,0,8,15,8,0,31,0,15,0,0,0) ttri(ax+x2,ay+y2,ax+x3,ay+y3,ax+x4,ay+y4,15,8,0,31,15,31,0,15,0,0,0) end function drawrarm(ax,ay,bx,by) pqs(ax,ay,glrmb) pqsm(ax,ay,bx,by,0,0,0,0,glrma) end function drawsuit(ax,ay,bx,by) pqs(155+ax,117+ay,gpnts) pqsm(150+ax,38+ay,150+bx,38+by,0,0,0,0,gnecc) pqs(148+ax,46+ay,gsuit) pl(148+ax,46+ay,gsuitdet) pqsm(130,66,130+ax,66+ay,0,0,0,0,grrm) spr(18,147,79,15,1,0,0,2,3) end function drawTIC(ax,ay) pr(ax,ay,ticrec) pl(ax,ay,ticlin) qd(ax-1,ay+53,ax-19,ay+65, ax+59.5,ay+53,ax+77.5,ay+65,9) pl(ax-1,ay+53,tickey) end function rotshrck(tim) for i=1,#shrck//3 do local temp=suuleRotX(shrck[1+(i-1)*3],0, shrck[2+(i-1)*3],0, shrck[3+(i-1)*3],0,tim) local temp=suuleRotY(temp[1],0,temp[2],0,temp[3],0,tim/3) shrckrot[1+(i-1)*3]=temp[1] shrckrot[2+(i-1)*3]=temp[2] shrckrot[3+(i-1)*3]=temp[3] end end function drw_wire(camx,camy,camz,model) for i=1,(#model-1)//3 do local prs1=camz/(model[3+(i-1)*3]-camz) local prs2=camz/(model[3+(i)*3]-camz) line(120+camx+(camx-model[1+(i-1)*3])*prs1, 68+camy+(camy-model[2+(i-1)*3])*prs1, 120+camx+(camx-model[1+(i)*3])*prs2, 68+camy+(camy-model[2+(i)*3])*prs2,4) end end function draw_seceffect(tim) cls(0) rotshrck(tim*30) drw_wire(0,0,-34780,shrckrot) print(scroll_text, 240-tim*520,120,5) print(scroll_text, 1440-tim*520,120,5) memcpy(0x8000,0x0000,16384) end function drawscn(ax,ay,wdt) local scl=240/wdt local hgt=rnd(136/scl) local ox=rnd(ax) local oy=rnd(ay) for j=0,hgt-1 do for i=0,wdt-1 do if (ox+i < 240) and (ox+i > -1) and (oy+j < 136) and (oy+j > -1) then poke4(0x0000+(ox+i)+(oy+j)*240,peek4(0x10000+rnd(i*scl)+240*rnd(j*scl))) end -- pix(ax+i,ay+j, -- peek4(0x10000+rnd(i*scl)+240*rnd(j*scl))) end end end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end function myTIC(t) vbank(0) poke(0x3ffb,0) -- pointer begone! draw_seceffect(t) if t*50 < 15 then cls(10) memcpy(0x0000,0xC000,15420) drawlhand(174+clmp(t*70-8,0,4),40,clmp((t*1200-200),-15,15)) drawrarm(182+clmp(5-t*30,-1,0),72,174+clmp(t*70-8,0,4),40) drawsuit( clmp(5-t*30,-1,0),0, clmp(10-t*60,-1,1),0) drawhead(clmp(10-t*60,-1,1),0) drawTIC(78,73) drawscn(85,80,44) elseif t*50 < 31.328125 then cls(10) memcpy(0x0000,0xC000,15420) drawdit() drawlhand(178,40,15) drawrarm(181,72,178,40) drawsuit(-1,0,-1,0) drawhead(-1,0) drawTIC(78,73) drawscn(85-5.3*(t*50-15),80-5*(t*50-15),44+12*(t*50-15)) end end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, name="suule" } end rift_contributorsblossom=function() local SQRT,ATAN,SIN,MAX,PI=math.sqrt,math.atan,math.sin,math.max,math.pi -- Palette: -- 0 (border) 0, 0, 0 -- PLease use the flag colours -- in the rest of your palette: -- Green: 0, 154, 68 -- White: 255, 255, 255 -- Orange: 255, 130, 0 function myBoot() -- You don't need to use this specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {0,154,68}, -- WHITE {255,255,255}, -- ORANGE {255,130,0}, setSuggestedPalette() end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setExamplePalette() cls() end -- Your amazing effect function myTIC(t) vbank(0) local t=t*29 local t4=t*4 local t8=t/8 local t12=t/12 local pi75=PI*0.75 local w=SIN(t)*.2-t12+.7 local w2=w+.3 local w3=w+1.9 local o=0 for y=0,135 do local y24=y/24 local y4=y*t//4 local sdivz=64/(y-64+t4) local v=sdivz-1 for x=0,239 do local u=(x/120-1)*sdivz local r=1-SQRT(u*u+v*v) local a=3*ATAN(u,v)+t local f1=(SIN(a)+1)*r local f2=(SIN(a+pi75)+1)*r local d=MAX(f1,f2)*t8 poke4(o,d>w3 and 5 or d>w2 and 3 or d>w and 1 or y24-(y4+x~y)%.74) o=o+1 end end end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=%myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsevilpaul=function() --[[ M A N T R A T R O N I C ]] local blobs={} function blobLine(x0,y0,x1,y1,height,size,blobs) x0=math.floor(x0) y0=math.floor(y0) x1=math.floor(x1) y1=math.floor(y1) local dx=math.abs(x1-x0) local sx if x0=dy then if x0==x1 then break end e=e+dy x0=x0+sx end if e2<=dx then if y0==y1 then break end e=e+dx y0=y0+sy end end end local lineDefs={ -- Intro {{-.5,-.5,-.5,-.5},{.5,.5,.5,.5,},{-.5,.5,-.5,.5},{.5,-.5,.5,-.5}}, {{-1,0,1,0},{0,-1,0,1}}, {{-1,0,1,0}}, {{0,-1,0,1}}, -- M {{-1,-1,-1,1},{-1,1,1,1},{1,1,1,-1},{0,1,0,-1}}, -- A {{-1,-1,0,1},{0,1,1,-1},{-.5,0,.5,0}}, -- N {{-1,-1,-1,1},{-1,1,1,-1},{1,-1,1,1}}, -- T {{-1,1,1,1},{0,1,0,-1}}, -- R {{-1,-1,-1,1},{-1,1,1,1},{1,1,1,0},{1,0,-1,0},{0,0,1,-1}}, -- A {{-1,-1,0,1},{0,1,1,-1},{-.5,0,.5,0}}, -- T {{-1,1,1,1},{0,1,0,-1}}, -- R {{-1,-1,-1,1},{-1,1,1,1},{1,1,1,0},{1,0,-1,0},{0,0,1,-1}}, -- O {{-1,1,1,1},{1,1,1,-1},{1,-1,-1,-1},{-1,-1,-1,1}}, -- N {{-1,-1,-1,1},{-1,1,1,-1},{1,-1,1,1}}, -- I {{-.5,1,.5,1},{0,1,0,-1},{-.5,-1,.5,-1}}, -- C {{-1,1,1,1},{-1,-1,1,-1},{-1,1,-1,-1}}, } function myPRESCENE() vbank(0) setExamplePalette() end function myTIC(unitTics) vbank(0) local t=unitTics local letter=(math.floor(t*16)//1) local alpha=(t*16)%1 math.randomseed(letter) math.random() local mx=240/2 if letter>=4 then mx=mx+(((letter-3)/12)-.5)*125 end local my=136/2 local sl=40 local sd=(alpha-.5)*50 blobs={} local height=math.random()*20+5 local size=math.random()*5+2 for i=1,#lineDefs[letter+1] do local lineDef=lineDefs[letter+1][i] local dx0=math.random()-.5 local dy0=math.random()-.5 local dx1=math.random()-.5 local dy1=math.random()-.5 local dx2=math.random()-.5 local dy2=math.random()-.5 local dx3=math.random()-.5 local dy3=math.random()-.5 local x0=mx+sl*lineDef[1] local y0=my-sl*lineDef[2] local x2=mx+sl*lineDef[3] local y2=my-sl*lineDef[4] local x1=x0+(x2-x0)/2 local y1=y0+(y2-y0)/2 blobLine( x0+dx0*sd, y0+dy0*sd, x1+dx1*sd, y1+dy1*sd, height,size,blobs) blobLine( x1+dx2*sd, y1+dy2*sd, x2+dx3*sd, y2+dy3*sd, height,size,blobs) end cls(12) for y=16,136-16,8 do line(0,y,240,y,13) end for i,blob in ipairs(blobs) do local x=blob.x local y=blob.y local s=blob.size local h=blob.height circ(x,y+h,s/2,1) --rect(x-s/2,y+15-s/2,s,s,1) end for i,blob in ipairs(blobs) do local x=blob.x local y=blob.y local s=blob.size local h=blob.height for i=1,h*2/3 do circ(x-i/2,y+i,s/2,5) end end for i,blob in ipairs(blobs) do local x=blob.x local y=blob.y local s=blob.size circ(x,y,s/2,9) end end function myPOSTSCENE() cls() end function myNULL() end return { precalc=myNULL, preScene=myPRESCENE, tic=myTIC, bdr=myNULL, postScene=myPOSTSCENE, } end rift_contributorsdeved=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "DevEd" local SIN,COS,PI,RAND = math.sin,math.cos,math.pi,math.random local xo = 0 local yo = 0 local timefactor = 384 local misspellings = { "mantatronic", "mantra tropic", "mandarin orange", "mantis shrimp", "manta rays", "diego mantroya", "manchego tubarao", "mango topping", "amanda tapping", "the mantralorian", "mana tonic", "manda nudes" } local spellscrollers = {} colortable = {0,0,1,1,2,2,6,6,7,7,8,11,11,12,12,13} -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setExamplePalette() -- populate spellscrollers for i=1, #misspellings do spellscrollers[i] = {misspellings[i],240,8 + (i*20)%120,1,i*26,RAND(200)/200,((RAND(3)*5))} end end -- Your amazing effect function myTIC(t) xo = SIN((t*60)/10)*30 yo = COS((t*60)/18)*12 vbank(0) -- calc bouncing text str = "AYCE has infiltrated this production to\n bring you these fine misspellings" strw = print(str,0,0) cls() -- cool background for y=-(34-yo),(34+yo) do for x=-(60-xo),(60+xo) do q=t*10 k=SIN(q) i=k+2 p=colortable[((((COS(q)*x-k*y)/i)//1)~(((k*x+COS(q)*y)/i)//1))%16] if ((t*timefactor)%2)//1 == 1 then pix(120+(x-xo)*2,68+(y-yo)*2,p) else pix(121-(x-xo)*2,69-(y-yo)*2,p) end end end -- do spellscrollers for i=1,#spellscrollers do if spellscrollers[i][5] == 0 then spellscrollers[i][2] = spellscrollers[i][2] - (spellscrollers[i][4]+1 + spellscrollers[i][6]) for j=1,#spellscrollers[i][1] do print(string.sub(spellscrollers[i][1],j,j),2 + (spellscrollers[i][2]+(j*13) + COS(((t+(j/4))*timefactor)/16)*4), 2 + (spellscrollers[i][3] + SIN(((t+(j/4))*timefactor)/8)*4),0,0,2) print(string.sub(spellscrollers[i][1],j,j),spellscrollers[i][2]+(j*13) + COS(((t+(j/4))*timefactor)/16)*4,spellscrollers[i][3] + SIN(((t+(j/4))*timefactor)/8)*4,spellscrollers[i][7],0,2) end else spellscrollers[i][5] = spellscrollers[i][5] - 1 end end -- bouncing text print(str, 120-(strw/2),16-math.abs(SIN(t*50)*16), 10, false, 1) end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsrealityfinal=function() --rain pre start linkPlay = true neoTime = 0 -- for testing we should replace this with 't' local sceners = { 'aldroid', 'Blossom', 'Catnip', 'Decca', 'dave84', 'DevEd', 'evilpaul', 'Flux', 'gasman', 'gigabates', 'jtruk', 'MrsBeanbag', 'ps', 'reality404', 'suule', 'superogue', 'ToBach', 'xxx', '', '', '', '', '', '', '' } local chars = {} local offsetRain = {} for i = 1, #sceners do local randomString = "" for j = 1, math.random(20, 30) do randomString = randomString .. string.char ( math.random( 33, ( 126 ) ) ) end table.insert(offsetRain, 7*math.random(0, 20)) table.insert(chars, randomString) --sceners[i] = sceners[i] .. randomString end for i = #sceners, 2, -1 do local j = math.random(i) sceners[i], sceners[j] = sceners[j], sceners[i] end local long = ((#chars+#sceners)*7)+140 --rain pre end --momin pre start local snufkinPlay = true local moominTime = 0 local moominDelay = 60 local dingOnce = false local moomins = { {letter = 'T', xCoord = 12, xCoord_TPOLM = 106, offset = 0, c = 13, left = true, hide = false}, {letter = 'h', xCoord = 17, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 23, xCoord_TPOLM = 116, offset = 0, c = 13, left = true, hide = true}, {letter = 's', xCoord = 29, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 35, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = true}, {letter = 'P', xCoord = 45, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = false}, {letter = 'e', xCoord = 51, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 'o', xCoord = 57, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 'p', xCoord = 63, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 'l', xCoord = 69, xCoord_TPOLM = 112, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 74, xCoord_TPOLM = 112, offset = 0, c = 13, left = true, hide = true}, {letter = 'O', xCoord = 84, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = false}, {letter = 'v', xCoord = 90, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 96, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'r', xCoord = 102, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 't', xCoord = 108, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'l', xCoord = 115, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'y', xCoord = 120, xCoord_TPOLM = 120, offset = 0, c = 13, left = true, hide = true}, {letter = 'L', xCoord = 129, xCoord_TPOLM = 120, offset = 0, c = 13, left = false, hide = false}, {letter = 'o', xCoord = 135, xCoord_TPOLM = 110, offset = 0, c = 13, left = false, hide = true}, {letter = 'v', xCoord = 141, xCoord_TPOLM = 110, offset = 0, c = 13, left = false, hide = true}, {letter = 'e', xCoord = 147, xCoord_TPOLM = 110, offset = 0, c = 13, left = false, hide = true}, {letter = 'M', xCoord = 157, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = false}, {letter = 'a', xCoord = 163, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'n', xCoord = 169, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 't', xCoord = 175, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'r', xCoord = 181, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'a', xCoord = 187, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 't', xCoord = 193, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'r', xCoord = 199, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'o', xCoord = 205, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'n', xCoord = 211, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'i', xCoord = 217, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'c', xCoord = 220, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true} } --moomin pre end --MEGA start local megaPlay = true local megaTime = 0 local megaDelay = 60 local megaDingOnce = false --MEGA end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, setExamplePalette() end -- Your amazing effect start function myTIC(unitTics) vbank(0) cls() --clear screen if snufkinPlay == true then moominTime = moominTime + 1 if moominTime < moominDelay then print("TPOL", 106, 65, 12) print("M", 130, 65, 3) end if moominTime > moominDelay then for i, moominData in ipairs(moomins) do local letter = moominData.letter local xCoord = moominData.xCoord local xCoord_TPOLM = moominData.xCoord_TPOLM local offset = moominData.offset local colour = moominData.c local direction = 1 if moominData.left == true then direction = -1 end if math.abs(xCoord_TPOLM - xCoord) > math.abs(offset) then moominData.offset = moominData.offset + direction end moomins[i].offset = moominData.offset local targetPosition = xCoord_TPOLM + offset if targetPosition == moomins[6].xCoord then moomins[2].hide = false moomins[3].hide = false moomins[4].hide = false moomins[5].hide = false end if targetPosition == moomins[12].xCoord then moomins[7].hide = false moomins[8].hide = false moomins[9].hide = false moomins[10].hide = false moomins[11].hide = false end if targetPosition == moomins[19].xCoord then moomins[13].hide = false moomins[14].hide = false moomins[15].hide = false moomins[16].hide = false moomins[17].hide = false moomins[18].hide = false end if targetPosition == moomins[23].xCoord then moomins[20].hide = false moomins[21].hide = false moomins[22].hide = false end if targetPosition == moomins[23].xCoord then moomins[24].hide = false moomins[25].hide = false moomins[26].hide = false moomins[27].hide = false moomins[28].hide = false moomins[29].hide = false moomins[30].hide = false moomins[31].hide = false moomins[32].hide = false moomins[33].hide = false moomins[34].hide = false end if not moominData.hide then print(letter,xCoord_TPOLM + moominData.offset,65,colour) end end end end --]] --moomin end end -- Your amazing effect end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() vbank(0) cls() end return { tics=400, precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorssuperogue=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "Superogue" local SIN,COS,PI = math.sin,math.cos,math.pi -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setExamplePalette() end -- Your amazing effect function myTic(tt) vbank(0) S=math.sin;O=math.cos;t=tt*48 cls(7) for i=0,136 do line(0,i,240,i,8.1-i/63+i%1.3) end for i=250,0,-.1 do p=i/4 r=((i//100)&2)+1--(O(p/48)) x=O(p+t)*r*(56-i/6) z=32+S(p+t+2)*(S(t)*4+16) y=z/2+i/3+200 -((t*16)%720) h=(S(p*2)*2+2) circ(128+x/3,96+y/3,2,h-1) circ(196+x/2,36+y/2,3,h+1) circ(x+32,y,6,h+2) circ(48+x/2,190+y/2,3,h+1) circ(x+180,330+y,4,h+2) end --print(t,0,0,12) print("Our hats go off to",50,56-8,0,1,2,1) print("Our hats go off to",49,55-8,6+t%6,1,2,1) print("all the beardos out there",24,72-8,0,1,2,1) print("all the beardos out there",23,71-8,t%6+12,1,2,1) end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTic, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsmrsbeanbag=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "Mrs Beanbag" local SIN,COS,PI = math.sin,math.cos,math.pi -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() vbank(0) setRGB(2,255,245,225) setRGB(3,255,136,62) setRGB(4,240,180,120) setRGB(6,22,155,98) setRGB(12,255,255,255) setRGB(13,200,200,200) setRGB(14,145,145,145) end -- Your amazing effect function myTIC(T) cls(8) -- stream s=math.sin(T*50)*4+math.sin(T*20)*8 if T<0.5 then rect(110+s,0,3,math.min(T*108*40,118),2) else q=(T*108-92)*40 rect(110+s,q,3,100-q,2) end -- orange q=math.min((T*108-105)*20,15) circ(157,q+13,22,3) circb(157,q+13,19,12) for i=0,11 do a=(i*math.pi)/6 line(157,q+13,157+17*math.sin(a),q+13+17*math.cos(a),12) end -- umbrella q=math.min((T*108-102)*20,15) rect(89,q+12,2,30,4) tri(90,q,120,q+12,60,q+12,6) line(90,q+18,80,q+12,12) line(90,q+18,85,q+12,12) line(90,q+18,95,q+12,12) line(90,q+18,100,q+12,12) rect(88,q+18,4,4,12) rect(88,q-3,4,4,4) -- fill h=90-math.max(0,math.min(T*108-4,90)) for i=h,90 do w=35-i/10 c=(90-i)<((90-h)*0.8)and 1 or 2 line(120.5-w,28+i,120.5+w,28+i,c) end -- bar rect(0,128,240,18,4) -- sides line(120.5-37,28,120.5-27,128,13) line(120.5-35,28,120.5-26,118,13) line(120.5+35,28,120.5+26,118,13) line(120.5+37,28,120.5+27,128,13) -- shine line(120.5+37*.5,28,120.5+27*.5,128,14) line(120.5+37*.6,28,120.5+27*.6,128,13) line(120.5+37*.65,28,120.5+27*.65,128,14) line(120.5+37*.625,28,120.5+27*.625,128,12) -- top line(120.5-37,28,120.5+37,28,12) -- bottom line(120.5-27,128,120.5+27,128,12) line(120.5-26,118,120.5+26,118,12) -- umbrella sticks line(90,q,57,q+13,4) line(90,q,75,q+14,4) line(90,q,105,q+14,4) line(90,q,123,q+13,4) end function myBDR(y,T,n1,n2) h=math.min(math.max((y-82+T*120)/100,0.0),1.0) i=1-h setRGB(1,55*h+255*i,35*h+245*i,25*h+225*i) b=y-4 setRGB(8,b/2,b,b*2) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorseverybodyclapyourhands=function() local tSpread = 1 / 16 local texts = { {t = 0, s = "EVERYONE", x = 33, y = 21, sz = 2}, {t = tSpread * 4, s = "PLEASE", x = 135, y = 21, sz = 2}, {t = tSpread * 5, s = "CLAP", x = 48, y = 40, sz = 6}, {t = tSpread * 6, s = "ALONG!", x = 54, y = 80, sz = 4} } sin = math.sin cos = math.cos function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use this specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {0,154,68}, -- WHITE {255,255,255}, -- ORANGE {255,130,0}, vbank(0) -- setExamplePalette() -- setRGB(1,140,210,255) sweetie16_pal = "1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57" local o = 0 for c = 1, #sweetie16_pal, 2 do -- walk colors local v = tonumber(sweetie16_pal:sub(c, c + 1), 16) -- get color (v)alue poke(0x3fc0 + o, v) o = o + 1 -- set color end end -- Your amazing effect function myTIC(unitTics, metrics) vbank(0) cls() t = time() // 32 fv = sin(t) if fv > 1 then fv = 1 end if fv < 0.5 then fv = 0 end rect(15, 15, 210, 110, 13) for i, t in ipairs(texts) do print(t.s, t.x + 1, t.y + 1, 12, false, t.sz) print(t.s, t.x, t.y, 13, false, t.sz) tx = t.t if unitTics > 0.5 then tx = t.t + 0.5 end if (unitTics >= tx) then print(t.s, t.x + 1, t.y + 1, 14, false, t.sz) print(t.s, t.x, t.y, 12, false, t.sz) end end -- print("BUALADH BOS GACH DUINE!", 20, 3, 13, true, 2, true) print("BUALADH BOS GACH DUINE!", 28, 2, 14, true, 2, true) for i = 0, 10 do line(i, 0, i, 135, i % 2 + 1) line(230 + i, 0, 230 + i, 135, i % 2 + 1) end for k = 0, 8 do clap(-108 + k * 48, 40, unitTics) end for i = 0, 8 do rect(0 + i * 28, 120, 24, 24, 15) end if unitTics > .5 then local size = 4 local count = 4-(((unitTics-.5)/.5)*4)//1 local number = string.format("%d", count) local yBounce = -math.abs(math.sin(unitTics*math.pi*8)*3) local w = print(number, 0, 140, 1, true, size) circ(121,119 + yBounce,16,0) circ(120,118 + yBounce,16,12) print(number, 120-w/2+2, 109 + yBounce, 0, true, size) end end function clap(x, y, unitTics) t = unitTics * 98 circ(x + 112 + math.cos(t) * 2, y + 78 + math.cos(t) * 2, 10, 14) for i = 0, 3 do line(x + 120 + i + math.sin(t) * 6.5, y + 55, x + 115 + i, y + 88, 14) end for i = 0, 3 do line(x + 104 + i - math.sin(t) * 6.5, y + 55, x + 105 + i, y + 88, 14) end end function myBDR(y, unitTics, tics, time, metrics) end function myPOSTSCENE() end return { precalc = myPRECALC, preScene = myPRESCENE, tic = myTIC, bdr = myBDR, postScene = myPOSTSCENE, name = "clap" } end rift_contributorsdave84=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "dave84" local SIN, COS, PI = math.sin, math.cos, math.pi local d84_grma_length = 0 local d84_grma = { { -78, -18, -63, -18, -63, -18, -68, -16, -73, -13, -77, -8, -78, -1, -77, 2, -75, 6, -71, 8, -67, 8, -61, 7, -56, 5, -53, 3, -52, 2, -53, 12, -56, 19, -59, 23, -64, 24, -66, 24, -68, 22, -70, 21, -71, 18, -71, 15, -70, 13, -69, 12, -70, 11, -71, 12, -73, 15, -75, 17, -77, 19, -77, 20, -74, 22, -70, 24, -66, 25, -58, 24, -53, 19, -49, 13, -48, 6, -47, 0, -47, -5, -47, -10, -47, -14, -48, -16, -48, -17, -48, -16, -49, -13, -49, -9, -50, -5, -53, 0, -57, 4, -61, 6, -64, 6, -68, 5, -71, 3, -72, 0, -73, -3, -71, -8, -68, -13, -63, -17, -48, -18, -47, -20, -65, -20, -65, -20, -69, -21, -71, -22, -72, -23, -72, -23, -75, -21, -77, -19, -79, -18, -78, -18 }, { -38, 4, -38, 4, -38, 6, -32, 8, -32, 8, -33, 6, -33, -3, -33, -3, -33, -4, -31, -3, -30, -2, -28, -1, -25, 0, -22, 3, -19, 6, -17, 8, -14, 8, -11, 7, -10, 7, -14, 5, -18, 1, -22, -2, -29, -4, -27, -5, -22, -7, -17, -10, -15, -15, -15, -18, -18, -20, -21, -21, -24, -21, -29, -21, -34, -18, -34, -19, -37, -20, -41, -20, -41, -20, -40, -19, -38, -17, -38, 4 }, { -20, -15, -20, -15, -22, -9, -27, -7, -31, -5, -33, -16, -33, -16, -31, -18, -26, -19, -22, -18, -20, -15 }, { 19, 8, 19, 8, 20, 1, 21, -4, 20, -10, 19, -14, 18, -16, 21, -18, 26, -19, 33, -15, 36, -4, 35, 1, 39, 8, 39, 8, 40, 2, 40, -4, 40, -10, 38, -16, 35, -19, 29, -21, 25, -20, 22, -20, 20, -19, 17, -18, 16, -18, 14, -20, 10, -21, 5, -20, 2, -19, 0, -18, 0, -20, 0, -20, -1, -21, -4, -21, -7, -20, -10, -20, -10, -20, -8, -18, -6, -16, -5, 5, -5, 5, -5, 7, 0, 8, 0, 8, 0, -13, 0, -13, 0, -15, 1, -17, 4, -18, 7, -19, 10, -18, 13, -15, 15, -11, 16, -4, 19, 8 }, { 56, 8, 56, 8, 61, 7, 65, 4, 68, 1, 74, 8, 79, 8, 65, -17, 65, -17, 64, -20, 62, -23, 60, -25, 60, -25, 59, -23, 57, -22, 55, -21, 54, -19, 54, -19, 56, -20, 58, -19, 63, -13, 63, -13, 59, -12, 53, -9, 48, -5, 46, 0, 48, 6, 56, 8 }, { 69, 0, 69, 0, 68, 0, 66, 2, 62, 4, 58, 5, 54, 4, 52, 3, 51, 1, 51, -1, 52, -5, 55, -9, 69, 0 } } local d84_pal = {7, 12, 3} -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() d84_grma_length = d84_precalculateTotalLength(d84_grma) end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) sweetie16_pal = "1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57" local o = 0 for c = 1, #sweetie16_pal, 2 do -- walk colors local v = tonumber(sweetie16_pal:sub(c, c + 1), 16) -- get color (v)alue poke(0x3fc0 + o, v) o = o + 1 -- set color end setRGB(7,0,154,68) setRGB(12,255,255,255) setRGB(3,255,130,0) end function d84_calculateDistance(x1, y1, x2, y2) return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2) end function d84_precalculateTotalLength(polylines) local totalLength = 0 for _, polyline in ipairs(polylines) do for i = 1, #polyline - 2, 2 do totalLength = totalLength + d84_calculateDistance(polyline[i], polyline[i + 1], polyline[i + 2], polyline[i + 3]) end end return totalLength end function d84_drawFractionOfPolylines(polylines, length, fraction, xOffset, yOffset, color) local totalLength = length local lengthToDraw = totalLength * fraction local drawnLength = 0 for _, polyline in ipairs(polylines) do local i = 1 while i < #polyline and drawnLength < lengthToDraw do local x1 = polyline[i] + xOffset local y1 = polyline[i + 1] + yOffset local x2, y2 if i + 2 <= #polyline then x2 = polyline[i + 2] + xOffset y2 = polyline[i + 3] + yOffset else break end local segmentLength = d84_calculateDistance(x1, y1, x2, y2) if drawnLength + segmentLength > lengthToDraw then local ratio = (lengthToDraw - drawnLength) / segmentLength local xEnd = x1 + (x2 - x1) * ratio local yEnd = y1 + (y2 - y1) * ratio line(x1, y1, xEnd, yEnd, color) return else line(x1, y1, x2, y2, color) drawnLength = drawnLength + segmentLength end i = i + 2 end if drawnLength >= lengthToDraw then break end end end -- Your amazing effect function myTIC(unitTics) vbank(0) cls() local start = time() local t = time() / 8000 for i = 0, 32639 do local x = i % 240 - 120 local y = i / 240 - 68 local u = math.atan2(y, x) * 7.17 local v = 200 / (x * x + y * y) ^ .5 + unitTics poke4(i, d84_pal[((u + v) % 3) // 1 + 1]) end rect(0, 40, 240, 60, 12) d84_drawFractionOfPolylines(d84_grma, d84_grma_length, unitTics*1.2, 120, 70, 15) rect(0,100,240,9,14) print("Go Raibh Maith Agat means 'Thank You'",10,102,12, true) print("G R M A ",10,102,5, true) end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc = myPRECALC, preScene = myPRESCENE, tic = myTIC, bdr = myBDR, postScene = myPOSTSCENE } end rift_contributorsgigabates=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local text=" THANKS MANTRATRONIC! " local fontBits={} local t=0 local circs={ { x=120, y=68, vx=3, vy=2.5, r=12, col=10 }, { x=16, y=68, vx=-3, vy=-2, r=15, col=5 }, { x=100, y=16, vx=-2, vy=3, r=17, col=15 }, } -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() -- extract font bits for text for c=1,#text do local char=string.sub(text,c,c) local code=string.byte(char) for y=0,5 do byte=peek(0x14604+code*8+y) for x=0,5 do fontBits[1+((c-1)*36+x*6+y)]=byte&(1<240-c.r then c.x=240-c.r c.vx=-c.vx elseif c.x136-c.r then c.y=136-c.r c.vy=-c.vy elseif c.y0 then for xo=0,10,5 do for yo=0,10,5 do local px=x*15+xo-t%1*15 local py=y*15+yo+40 local col=0 -- repel circles for i=1,#circs do c=circs[i] local dx=px-c.x local dy=py-c.y local d=(dx^2+dy^2)^.5 local nx=dx/d local ny=dy/d local fm=c.r+100 local f=1-math.min(d,fm)/fm px=px+nx*c.r*f py=py+ny*c.r*f col=math.max(col,d) end circ(px,py,2,6+col/80+((px/5)*2-(py/5)%2)%4/4) end end end i=i+1 end end -- draw the circles for i=1,#circs do c=circs[i] circ(c.x,c.y,c.r,c.col-2) circ(c.x-c.r*.05,c.y-c.r*.05,c.r*.9,c.col-1) circ(c.x-c.r*.1,c.y-c.r*.1,c.r*.8,c.col) end end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsaldroid=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local S,C = math.sin,math.cos local fofs = 0x14604 -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setRGB(12,255,255,255); end butv = { {36,0,34}, {29,38,28}, {36,0,-33}, {29,38,-27}, {-38,0,34}, {-32,38,28}, {-32,38,-27} } butf = { {{2,3,1},1}, {{6,1,5},2}, {{4,6,7},3}, {{2,4,3},1}, {{6,2,1},2}, {{4,2,6},3} } cubv = { {200,50,-300}, {200,50,300}, {200,-50,300}, {-200,50,-300}, {-200,-50,-300}, {-200,50,300}, {-200,-50,300} } cubf = { {{2, 7, 3},2}, {{2, 6, 7},2}, {{4, 2, 1},3}, {{4, 6, 2},3}, } bezv = { {-166,-11,131}, {-166,13,131}, {-166,-11,-133}, {-166,13,-133}, {166,-11,131}, {166,13,131}, {166,13,-133}, {137,-11,108}, {137,-11,-111}, {-137,-11,-111}, {-137,13,108}, {-137,13,-111}, {137,13,108}, {137,13,-111}, {-137,-11,108}, } bezf= { {{6,1,5},2}, {{10,9,14},2}, {{10,14,12},2}, {{8,13,14},1}, {{8,14,9},1}, {{2,4,3},1}, {{6,2,1},2}, {{4,2,12},3}, {{6,7,14},3}, {{12,14,7},3}, {{2,6,13},3}, {{2,13,11},3}, {{12,7,4},3}, {{2,11,12},3}, {{6,14,13},3}, {{10,11,15},1}, {{10,11,12},1}, --{{2,3,1},4}, } function roty(pt,a) ca=C(a) sa=S(a) return {pt[1]*ca-pt[3]*sa,pt[2],pt[3]*ca+pt[1]*sa} end function rotx(pt,a) ca=C(a) sa=S(a) return {pt[1],pt[2]*ca-pt[3]*sa,pt[3]*ca+pt[2]*sa} end -- perspective project a point function ppt(pt) z=(-150+pt[3]) X=(pt[1]+100)/z Y=(pt[2]-400)/z return 40+X*260,38+Y*260 end function drawtri(points,col) x1,y1 = ppt(points[1]) x2,y2 = ppt(points[2]) x3,y3 = ppt(points[3]) tri( x1,y1,x2,y2,x3,y3, col) end -- do model-space transform here -- do world-space transform in -- ppt function aldroid_trans(point, tr) return {point[1]+tr[1],point[2]+tr[2],point[3]+tr[3]} end local timeWobble = 0 local timescale = 0 function dorots(pt) return roty( rotx( roty(pt, -0.5), 0.7), timeWobble) end function drawobj(faces,pts,tr) for f=1,#faces do fc = faces[f] points = {} for fp=1,3 do points[fp]= dorots( aldroid_trans(pts[fc[1][fp]],tr)) end drawtri(points,fc[2]) end end function boxchar(ch,ofs,screenpos, pixsize,col) local cofs = fofs+string.byte(ch)*8 local y=screenpos[1] local lofs = 7 local pofs = ofs if ofs < 0 then lofs = 7+ofs ofs=0 end for y=0,7 do row = peek(cofs+y) for x=ofs,lofs do p = (row >> x)&1 if p==1 then x0,y0=screenpos[1]+pixsize[1]*(x-pofs),screenpos[3]+pixsize[2]*y x1,y1=pixsize[1]+x0+5,y0 x2,y2=x0,pixsize[2]-10+y0 x3,y3=x1,y2 p0=dorots({x0,y,y0}) p1=dorots({x1,y,y1}) p2=dorots({x2,y,y2}) p3=dorots({x3,y,y3}) drawtri({p0,p1,p2},col) drawtri({p1,p2,p3},col) end end end end function boxtext(screenpos, screensize) bgpoints1 = { dorots(screenpos), dorots({screenpos[1], screenpos[2],screenpos[3]+screensize[2]}), dorots({screenpos[1]+screensize[1], screenpos[2],screenpos[3]}), } bgpoints2= { dorots({screenpos[1], screenpos[2],screenpos[3]+screensize[2]}), dorots({screenpos[1]+screensize[1], screenpos[2],screenpos[3]+screensize[2]}), dorots({screenpos[1]+screensize[1], screenpos[2],screenpos[3]}), } --drawtri(bgpoints1,4) --drawtri(bgpoints2,4) local msg = " ALRIGHT M8 " local t=timescale //100 local ch1=(((t+7)//16)*2)%(#msg-1)+1 local ch2=(((t)//16)*2+1)%(#msg-1)+1 boxchar( string.sub(msg,ch1,ch1), ((t+7) %16)-8, {screenpos[1]+screensize[1],screenpos[2],screenpos[3]}, {-screensize[1]/8,screensize[2]/8}, 12) boxchar( string.sub(msg,ch2,ch2), ((t ) %16)-8, {screenpos[1]+screensize[1],screenpos[2],screenpos[3]}, {-screensize[1]/8,screensize[2]/8}, 12) end function plotm8() drawobj(cubf,cubv,{-10,-90,-570}) boxtext({-140,-30,-670},{240,200}) drawobj(bezf,bezv,{-20,-30,-670}) drawobj(butf,butv,{-10,-160,-570}) drawobj(butf,butv,{-90,-120,-570}) drawobj(butf,butv,{-170,-120,-570}) drawobj(butf,butv,{90,-120,-470}) drawobj(butf,butv,{-10,-120,-470}) s=C(timeWobble) for i=1,3 do for j=0,2 do poke(0x3fc0+i*3+j,s*8*(i-1)*i) end end end -- Your amazing effect function myTIC(unitTics) timeWobble= (S(unitTics*2)^2)*0.15 timescale=unitTics*9000 cls(15) plotm8(120,68) end function myBDR(y, unitTics, tics, time) local oa=1-y/135 local ga=y/135 oa = oa * oa * oa * 0.5 ga = ga * ga * 0.5 setRGB(15,22*ga + 255*oa,155*ga + 136*oa,98*ga + 62*oa) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsxxx=function() -- You can have 'global' vars like this -- Though you can delete these if you like! local YOUR_NAME = "xxx" local x=96 local y=24 local texts={"THERE'S", "A POT OF", "BARRY'S", "GOLD", "BLEND","AT THE", "END", "OF THE","RAINBOW"} local SIN,COS,PI,RND,FLR,ABS,SQRT = math.sin,math.cos,math.pi,math.random,math.floor,math.abs,math.sqrt move=-70 -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, vbank(0) setExamplePalette() setRGB(15,255*.53,255*.81,255*.92) local f=0 local z= 180 end function particle() local p = {} local x=RND(0,1) p.x=165-RND(10) p.y=105 p.a=RND()/RND(15,20) p.v=RND()*2+1 p.c=RND(60)+30 p.s=RND(9)+2 p.xx=(RND()+0.1)*3-x*3 return p end function reset_particles(num) num = num or 200 local particles={} for i=1,num do local p = particle() table.insert(particles,p) end return particles end particles=reset_particles(30) function drawCoin(xc, yc, width, height,rotx) local rot = rotx-FLR(rotx) local sin = SIN(PI*2*rot) local side = FLR((rot*8)//2) local thickness = width/4 local width = width*ABS(sin) local frontcol=7 local sidecol=8 local borderwidth = (thickness-thickness*ABS(sin)) for y = -height, height do local ny = y / height local widthForY = width * SQRT(1 - ny^2) local x1 = math.floor(xc - widthForY) local x2 = math.floor(xc + widthForY) if side==0 then x1 = x1 + thickness - thickness * sin x2 = x2 + thickness - thickness * sin elseif side==1 then x1 = x1 - thickness + thickness * sin x2 = x2 - thickness + thickness * sin elseif side==2 then x1 = x1 - 2*thickness - 2*thickness * sin x2 = x2 - 2*thickness - 2*thickness * sin elseif side==3 then x1 = x1 + 2*thickness + 2*thickness * sin x2 = x2 + 2*thickness + 2*thickness * sin end -- infill line(x1,yc + y, x2, yc + y, frontcol) -- Fill between borders -- border if side==0 then line(x2,yc + y, x2+borderwidth, yc + y, sidecol) elseif side==1 then x1=x1-borderwidth line(x1,yc + y, x1+borderwidth, yc + y, sidecol) elseif side==2 then line(x2,yc + y, x2+borderwidth, yc + y, sidecol) elseif side==3 then x1=x1-borderwidth line(x1,yc + y, x1+borderwidth, yc + y, sidecol) end end end f=0 z= 180 function coins() minimum=180 for k,p in pairs(particles) do -- update p.a=p.a-0.002 p.v=p.v+p.a p.y=p.y-p.v p.x=p.x+p.xx if p.y>175 and f<500 then particles[k]=particle() end minimum = math.min(minimum,p.y) -- draw drawCoin(p.x,p.y,p.s,p.s,f/p.c) end if minimum>=z then particles=reset_particles(RND(20,60)) z=RND(5000)+150 f=-RND(500) end end -- Your amazing effect function myTIC(unitTics, metrics) vbank(0) --setRGB() setRGB(6,255*.53,255*.81,255*.92) setRGB(7,255,255*.84,0) setRGB(8,255*.85,255*.65,255*.13) cls(6) f=f+1 -- for i=0,15 do -- rect(i*10,0,10,10,i) -- end row = 130 textcols={5,15} hop=SIN(f/10) if hop>-0.3 then move=move+hop*5 end for i=1,#texts do text=texts[i] textsize=FLR(240/(#text*6)) textx=FLR(120-#text*textsize*3)+4 print(text, textx+2, row-move+2, textcols[i%#textcols+1], true,textsize) print(text, textx, row-move, 10, true,textsize) row = row + 6*textsize end local xoff = SIN(f/8)*2 local yoff = COS(f/13)*3 elli(30+xoff,250+yoff,190,170,3) -- back hill elli(190-yoff,240+xoff,180,140,4) -- middle hill coins() -- pot local yoff = SIN(f/10)*4 circ(160,120+yoff,30,0) rect(135,90+yoff,50,10,0) circ(137,96+yoff,6,0) circ(182,96+yoff,6,0) local xoff = SIN(f/10)*3 local yoff = COS(f/13)*5 elli(120+xoff,260+yoff,180,140,5)-- front hill end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorspsenough=function() local ps=function() local R={} local SIN=math.sin local COS=math.cos local RANDOM=math.random local T=0 local First=true -- lemon shark local pal = "0500042b2b2156553b33803378801c86807aaaaa23d1e129acaa9bffe167bffb63cc8000dbd5d1f3ff79fefffeff9d37" local gfx = "8040fffffffffffffffffffffffffffffffffffffffffffffff0ffffff05ffffff08ffffff00fff00058ff05ced9f08e999908d999998d999999d99999999999999900000000eedddddd999999999999e9999999999999999999999999999999777000ffffffc000ffff9dd800ff9999900f9999920099602eec902ec9992ec99999fffffffffffffff0fff0000e0000eecceecc9999999999999999999799999999ffff00000000ccccecc99ddd99999999999920007777750c7e999100999999420fffffffc0000000ddee90dd9999999c2699999909999990199991029999025ef00000ff00e9920f9996990f9999990f11111000b282bc8020cc2c50e18c2880ffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000007fffff000fffffff1fffffff0fffffff0ffffff02ffffff00ffffff0c7777721e77770ecc7770ec99770e999970d999990d9999e7c999997999999799c9999979999779999979999297990990799029109990990099909909999099079909999990c999990c999e99c9999999c9999777999777999777999977999999999999999999929999999991799999189999962c9999905899991851999618e09100288505cc5885b85ed1c81885e01cd188e021e80221208501200f010010f1e22e5081e1082110c011010f8021220f1158010f01000ffff0ffffff10f10f00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1c9fffff199ffff0c99fff0c999fff0c999ff0c9999ff199999f0c9999e99997999999979999997990999799990999999969999999999999990999999970990d7070996077960970799990779990777999990799999079999e9799999997999999999999999999999999999999999999999e999999999999999999999999a9120029961200099500101999999999999dddd9ddddddddddddddddddddddd1021c000e105880c22212112ddddddddddddddddddddddddddddddddddddddddc1120120828c08c021c82cc562111210ddddddd1ddddddd0ddddddd0ddddddd0fffffffffffffffffffffffffffffff0fffffff0fffffff0fffff004fff00919f0999999089999990997999949779999997799999777799997777999777777999999997799999799999979999997999999999999999999999999e999999999979999999999999999999099699999009999904999990d99999049999990d999999999999d9999d6ad9999d0ad999d0aad999e0aad99d0aada9d40aaaadc1aaaaaddddddddddddddddddddddddddddddaddddddadddddaaaddaaaaaaddaaaaaaeddddddddddddddddadddddddaddddddaddddddaddddddaddddddaddddddadddddaddddd00dddddd0fdddddd0fddddd00fddddd0ffdddd00ffdddd0fffddd00fffff099709fff17709ffff0707fffff007ffffff07ffffff07ffffff07ffffff077777777977777777777777777777777777777777777777777777777777777777999999777999977777797777777777777e777776777777707777777077777770099999990999999d099999d009999d030999e03a999d03aa99d03aaadd03aaaac13aaaaa13aaaaaa3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaeaaaaaaaaaddaaaaaaadaaaaaaaaaaaaaaaaaaaaa2aaaaaa2aaaaa22aaaaa27aaaaaddddddddddddddddaddddddaaaaaaaaaaaaaaaaaaaaaaaa4aaaaaa40aaaaaa01dda0ffffda00ffffaa0fffffa000ffff0120ffff0110ffff1220ffff122b0fffffffff06fffffff0fffffff1fffffff0fffffff0fffffff0fffffffffff000007777777777777777777777777777777777777777677777770777777707777707777777607777770c7777770077777aaa7777aaaa6777aaaa077aaaaa07aaaaaae03aaaaa03aaaaaa3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2aaaa222aaa22aaaaaaaaaaa2aaaaaa27aaaa22aaaaa27aaaa22aaaaa2aaaaaaaaaaaaaaaaaaaaaaa2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaaaaa00aaaa400faaaaa000aaaa00ffaaa00fffaa00ffff400fffff00ffffffffffffffffffffff22b90fff08950ffff0920fffff00fffffff0ffffffffffffffffffffffffffffff07d777f077d7770a77777700000007fffffff1fffffff0fffffff0ffffffff077777060677776070777777766777776777777a27777700077777aa0006777a07aaaaaa7aaaaaaa7aaaaaaa7aaaaaaaaaaaaaaaaaaaaaaa200000000fffffffaaaaaaaaaaaaaaaeaaaaaaaaaaaaaaaaaaaaaaaaaaaa4000000000ffffffffffaaaaaaaaaaaaaaaaaaaaaa40aaaaa000a40000ff000fffffffffffffffffffffaa4000ffa000ffff01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00a77affff077affff077affff00aafffff0a0fffff0a0ffff0d00ffff000f0fffffff0fffffff0fffffff0fffffff0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" local Scene=nil local cloth=nil local actor=nil rift_3dactor=function() return function(R) R=R or {} rift_3dgeom()(R) rift_3dcam()(R) rift_3dproj()(R) rift_3dmodel()(R) rift_3dviewport()(R) R.Actor={} -- Attaches to a reference of the model -- So, copy that model if you want multiple, with deformations or whatever function R.Actor:new(model) local o={ model=model, mat=R.M44:new(R.M44.ID), drawFn=nil, drawFlags=0, geomPrePassFn=nil, geomPostPassFn=nil, geomDrawFn=nil, drawPassFns={}, -- {"pass1":fn,...} animCycle=nil, animTime=nil, alive=true, } setmetatable(o,self) self.__index=self return o end function R.Actor:getMat() return self.mat end function R.Actor:setMat(mat) self.mat=mat:clone() end -- fn can be nil, but you won't get anything out! function R.Actor:setDrawFn(fn,flags) self.drawFn=fn self.drawFlags=flags end function R.Actor:setDrawPassFn(name,fn) if self.alive then self.drawPassFns[name]=fn end end -- fn can be nil function R.Actor:setGeomPrePassFn(fn) if self.alive then self.geomPrePassFn=fn end end -- fn can be nil function R.Actor:setGeomPostPassFn(fn) if self.alive then self.geomPostPassFn=fn end end -- fn can be nil function R.Actor:setGeomDrawFn(fn) if self.alive then self.geomDrawFn=fn end end function R.Actor:setAnim(cycle,time) self.animCycle=cycle self.animTime=time end function R.Actor:clearAnim() self.animCycle=nil end function R.Actor:draw(viewMat,projMat,viewport) if self.alive then local draw={fn=self.drawFn,passFns=self.drawPassFns,flags=self.drawFlags} local anim=(self.animCycle) and {cycle=self.animCycle,time=self.animTime} or {} local cbFns={geomPrePassFn=self.geomPrePassFn,geomPostPassFn=self.geomPostPassFn,geomDrawFn=self.geomDrawFn} self.model:draw(self.mat,viewMat,projMat,viewport,draw,anim,cbFns) end end end end rift_3dmodel=function() return function(R) R=R or {} rift_3dgeom()(R) rift_3danim()(R) R.poly={} R.Tri={} R.Model={ Z_SORT=1, -- Sort faces by average Z CALC_NORMAL=2, -- Calculate face normals BACKFACE_CULLING=4, -- Do not draw triangles facing the wrong way } R.TriBuffer = {} -- point index: p1,p2,p3 -- ex: extra data function R.Tri:new(p1,p2,p3,ex,normal) local o={ vx={p1,p2,p3}, ex=ex, normal=normal, } setmetatable(o,self) self.__index=self return o end -- vtxs: V4 -- tris: tri -- p[1]-p[3] function R.Model:new() local o={ vtxs={}, anim={}, tris={}, passes={}, } setmetatable(o,self) self.__index=self return o end -- v=V4 -- Returns the index function R.Model:addVtx(v) local i=#self.vtxs+1 self.vtxs[i]=v return i end -- tri is a Tri -- normal can be unset/nil function R.Model:addTri(tri) local i=#self.tris+1 self.tris[i]=tri return i end function R.Model:AddDrawPass(name,tris,priority) self.passes[#self.passes+1]={name=name,tris=tris,priority=priority} table.sort(self.passes,function(a,b) return a.priorityentityMat> (world) >viewMat> (view) >projMat> (screen) -- (#TODO: collapse that to viewMat -> projMat coming in to this function?) -- Transform the normals by entityMat -- anim: nil or {cycle=,time=} function R.Model:draw(entityMat,viewMat,projMat,viewport,draw,anim,cbFns) local cbFns={ geomPrePassFn=cbFns and cbFns.geomPrePassFn or nil, geomPostPassFn=cbFns and cbFns.geomPostPassFn or nil, geomDrawFn=cbFns and cbFns.geomDrawFn or nil, } local geomMat=projMat:mulM44C(viewMat) geomMat:mulM44(entityMat) local vtxs={} -- put the model vtxs in a fresh table so that deformations don't alter source data local vtxFrame=nil if anim==nil or anim.cycle==nil then vtxFrame=self.vtxs else local animDef=self.anim[anim.cycle] local unitTime=math.fmod(anim.time,1) -- Get the fractional part, 0-1 local iFrame1,interp=math.modf(unitTime*#animDef.frames) local iFrame2=1+(iFrame1+1)%#animDef.frames iFrame1=iFrame1+1 -- Blend frames: local frame1vtxs=animDef.frames[iFrame1].vtxs local frame2vtxs=animDef.frames[iFrame2].vtxs for i=1,#animDef.frames[iFrame1].vtxs do vtxs[i]=frame1vtxs[i]:lerp(frame2vtxs[i],interp) end vtxFrame=vtxs end if cbFns.geomPrePassFn then for i=1,#self.vtxs do vtxs[i]=cbFns.geomPrePassFn(i,vtxFrame[i]:clone(),self) end else for i=1,#self.vtxs do vtxs[i]=vtxFrame[i]:clone() end end local geom={} for i=1,#vtxs do local p=vtxs[i]:mulM44C(geomMat,true) if cbFns.geomPostPassFn then p=cbFns.geomPostPassFn(i,p,self) end local x,y=viewport:transform(p.e[1],p.e[2]) geom[i]={x=x,y=y,z=p.e[3]} end if draw then if cbFns.geomDrawFn then cbFns.geomDrawFn(geom) end if #self.passes>0 then for i=1,#self.passes do local pass=self.passes[i] local drawFn=draw.passFns[pass.name] drawFn=drawFn or R.poly.Draw1Colour(math.random(1,15)) local draw={ fn=drawFn, flags=0, } self:drawTris(draw,geom,pass.tris,nil) end elseif draw.fn then self:drawTris(draw,geom,self.tris,entityMat) end end end function R.Model:drawTris(draw,geom,tris,entityMat) local rTris={} for i=1,#tris do local t=tris[i] -- If this triangle doesn't have a normal then create one... -- Should only happen on the first run if not t.normal then t.normal=R.V4Normal( self.vtxs[t.vx[1]], self.vtxs[t.vx[2]], self.vtxs[t.vx[3]] ) end local vScr1=geom[t.vx[1]] local vScr2=geom[t.vx[2]] local vScr3=geom[t.vx[3]] local normal=t.normal if draw.flags and draw.flags&R.Model.CALC_NORMAL>0 then normal=normal:mulM44RotC(entityMat) else -- Return a dummy normal pointing towards the viewer normal=R.V4:new({0,0,1,0}) end rTris[#rTris+1]={ i=i, v={vScr1,vScr2,vScr3}, normal=normal, ex=t.ex, } end if draw.flags and draw.flags&R.Model.Z_SORT>0 then -- Should this instead sort by closest Z, rather than average? table.sort(rTris, function(a,b) local az=a.v[1].z+a.v[2].z+a.v[3].z local bz=b.v[1].z+b.v[2].z+b.v[3].z return az0 then for i=1,#rTris do local t=rTris[i] if t.normal.e[3] < 0 then draw.fn(t) end end else for i=1,#rTris do draw.fn(rTris[i]) end end end -- Load -- vertices: table (one dimension: x,y,z fixed point values) -- triangles: table (one dimension: index of p[1]-p[3]) function R.Model:load(data) local scale=data.scale or 1 local origin=data.origin or {0,0,0} local divide_by=data.divide_by or nil if divide_by==nil then divide_by=0 -- Get the largest extent of the model. This will be our bound for i=1,#data.vertices do local extent=math.max(math.abs(data.vertices[i])) divide_by=math.max(divide_by,extent) end end self.vtxs={} for i=1,#data.vertices//3 do local startindex = (i-1)*3+1 local x=(data.vertices[startindex])/divide_by-origin[1] local y=(data.vertices[startindex+1])/divide_by-origin[2] local z=(data.vertices[startindex+2])/divide_by-origin[3] local v=R.V4:new({x*scale,y*scale,z*scale,1}) self:addVtx(v) end self.anim={} if data.vanim then for name,frames in pairs(data.vanim) do local anim=R.Anim:new(name) for i,vertices in ipairs(frames) do local frame=R.AnimFrame:new() for i=1,#vertices//3 do local startindex = (i-1)*3+1 local x=(vertices[startindex])/divide_by-origin[1] local y=(vertices[startindex+1])/divide_by-origin[2] local z=(vertices[startindex+2])/divide_by-origin[3] local v=R.V4:new({x*scale,y*scale,z*scale,1}) frame:addVtx(v) end anim:addFrame(frame) end self.anim[name]=anim end end self.tris={} if data.triangles then for i=1,#data.triangles//3 do local startindex = (i-1)*3+1 local p1 = data.triangles[startindex] local p2 = data.triangles[startindex+1] local p3 = data.triangles[startindex+2] local ex={} if data.triangles_ex then ex=data.triangles_ex[i] end self:addTri(R.Tri:new(p1,p2,p3,ex,nil)) end end if data.drawpasses then for name,dp in pairs(data.drawpasses) do local tris={} for i=1,#dp.triangles//3 do local startindex = (i-1)*3+1 local p1 = dp.triangles[startindex] local p2 = dp.triangles[startindex+1] local p3 = dp.triangles[startindex+2] tris[#tris+1]=R.Tri:new(p1,p2,p3,{},nil) end self:AddDrawPass(name,tris,dp.priority) end end end function R.poly.Draw1Colour(colour) return function(tr) tri( tr.v[1].x,tr.v[1].y, tr.v[2].x,tr.v[2].y, tr.v[3].x,tr.v[3].y, colour ) end end function R.poly.Draw3ColourLit(il) return function(tr) local light=il or R.V4:new({.2,-.2,-1}) local l=tr.normal:dot(light)*14 l=math.min(4,math.max(0,l)) l=l+1+(tr.ex.c-1)*5 tri( tr.v[1].x+8,tr.v[1].y, tr.v[2].x+8,tr.v[2].y, tr.v[3].x+8,tr.v[3].y, l ) end end function R.poly.DrawDebug(tr) tri( tr.v[1].x,tr.v[1].y, tr.v[2].x,tr.v[2].y, tr.v[3].x,tr.v[3].y, 1+(tr.i)%15 ) end function R.poly.DrawFlat(tr) tri( tr.v[1].x,tr.v[1].y, tr.v[2].x,tr.v[2].y, tr.v[3].x,tr.v[3].y, tr.ex.c ) end function R.poly.DrawWire(colour) return function(tr) trib( tr.v[1].x,tr.v[1].y, tr.v[2].x,tr.v[2].y, tr.v[3].x,tr.v[3].y, colour ) end end function R.poly.DrawBuffer(tr) table.insert(R.TriBuffer,tr) end function R.poly.ResetBuffer() R.TriBuffer = {} end function R.poly.GetBuffer() return R.TriBuffer end function R.poly.DrawLit(il) return function(tr) if il then else local il = R.V4:new({1,1,0}) end --local light=R.V4:new({1,1,0}) -- assume the camera is looking along the -- #TODO: pass the scene's camera vector in here so we can cull properly local screen=R.V4:new({0,0,1,0}) screen:normal() -- backface culling(ish), really need to project the normals for that -- but it eliminates some of the faces which is handy. Seems ok for the -- cube but on our chicken other faces are going missing, making me think -- they're possibly not all wound in the same direction? -- local dp=tr.normal:dot(screen) -- if(dp <= 0) then -- return -- end local l=tr.normal:dot(il)*14 l=math.min(14,math.max(0,l)) l=l+1 tri( tr.v[1].x+8,tr.v[1].y, tr.v[2].x+8,tr.v[2].y, tr.v[3].x+8,tr.v[3].y, l ) end end function R.poly.DrawTex(u0,v0,u1,v1,inSrc,inMask) return function(tr) local src=inSrc or 2 local mask=inMask or 0 ttri( tr.v[1].x,tr.v[1].y, tr.v[2].x,tr.v[2].y, tr.v[3].x,tr.v[3].y, u0+tr.ex.u1*u1,v0+tr.ex.v1*v1, u0+tr.ex.u2*u1,v0+tr.ex.v2*v1, u0+tr.ex.u3*u1,v0+tr.ex.v3*v1, src, mask, -tr.v[1].z,-tr.v[2].z,-tr.v[3].z ) end end end end rift_datamodelrectangletexsubdiv=function() -- Make a subdivided,textured rect -- model goes from w/2 to h/2 -- wSegs -> number of segments across -- hSegs -> number of segments down return function(w,h,xSegs,ySegs) local m={vertices={},triangles={},triangles_ex={},origin={0,0,0}} for pYi=0,ySegs do for pXi=0,xSegs do local vxu=pXi/xSegs local vyu=pYi/ySegs local x=-w/2+vxu*w local y=-h/2+vyu*h m.vertices[#m.vertices+1]=x m.vertices[#m.vertices+1]=y m.vertices[#m.vertices+1]=0 -- Add triangles if pXi>0 and pYi>0 then local triX0Y0=(pYi-1)*(xSegs+1)+(pXi-1)+1 local triX1Y0=(pYi-1)*(xSegs+1)+(pXi)+1 local triX1Y1=(pYi)*(xSegs+1)+(pXi)+1 local triX0Y1=(pYi)*(xSegs+1)+(pXi-1)+1 m.triangles[#m.triangles+1]=triX0Y0 m.triangles[#m.triangles+1]=triX1Y0 m.triangles[#m.triangles+1]=triX1Y1 m.triangles[#m.triangles+1]=triX1Y1 m.triangles[#m.triangles+1]=triX0Y1 m.triangles[#m.triangles+1]=triX0Y0 local unitX0=(pXi-1)/xSegs local unitY0=(pYi-1)/ySegs local unitX1=(pXi)/xSegs local unitY1=(pYi)/ySegs m.triangles_ex[#m.triangles_ex+1]={ u1=unitX0,v1=unitY0, u2=unitX1,v2=unitY0, u3=unitX1,v3=unitY1, } m.triangles_ex[#m.triangles_ex+1]={ u1=unitX1,v1=unitY1, u2=unitX0,v2=unitY1, u3=unitX0,v3=unitY0, } end end end return m end end rift_3dviewport=function() return function(R) R=R or {} R.Viewport={} function R.Viewport:new(w,h) local o={ xofs=w/2, yofs=h/2, } setmetatable(o,self) self.__index=self return o end function R.Viewport:transform(x,y) return self.xofs+x,self.yofs+y end end end rift_sysmath=function() --- Helpers for Maths - clamps and easing -- @module sys.math return function(R) R=R or {} --- Clamp a value -- @param v A value -- @param min The lower bound -- @param max The upper bound R.clamp=function(v,min,max) return math.min(math.max(v,min),max) end --- Linear Interpolation bewteen two values -- @param t Time (0-1) -- @param v0 The value at T=0 -- @param v1 The value at T=1 R.lerp=function(t,v0,v1) return (1-t)*v0+t*v1 end --- Quadratic Bц╘zier -- @param t Time (0-1) -- @param v0 The value at T=0 -- @param v1 The mid-value modifier -- @param v2 The value at T=1 R.qBezier=function(t,v0,v1,v2) local tInv=1-t return (tInv*tInv*v0)+(tInv*t*v1)+(t*t*v2) end --- Cubic Bц╘zier -- @param t Time (0-1) -- @param v0 The value at T=0 -- @param v1 The first mid-value modifier -- @param v2 The second mid-value modifier -- @param v3 The value at T=1 R.cBezier=function(t,v0,v1,v2,v3) local tInv=1-t return (tInv*tInv*tInv*v0)+(3*tInv*tInv*t*v1)+(3*tInv*t*t*v2)+(t*t*t*v3) end --- Smoothstep Easing function -- @param t Time (0-1) -- @param e0 The value at T=0 -- @param e1 The value at T=1 R.smoothStep=function(t,e0,e1) local s = (t-e0)/(e1-e0) local x = R.clamp(s,0,1) return e0 + (x * x * (3.0 - 2.0 * x))*(e1-e0) end --- Smootherstep Easing function -- @param t Time (0-1) -- @param e0 The value at T=0 -- @param e1 The value at T=1 R.smootherStep=function(t,e0,e1) local s = (t-e0)/(e1-e0) local x = R.clamp(s,0,1) return e0 + (x * x * x * (3.0 * x * (2.0 * x - 5.0) + 10.0))*(e1-e0) end end end rift_3dcam=function() return function(R) R=R or {} rift_3dgeom()(R) R.Cam={} function R.Cam:new(pos,aim,up) local o={ pos=pos, aim=aim, up=up, } setmetatable(o,self) self.__index=self return o end -- pos is a V4 function R.Cam:setPos(pos) self.pos=pos end -- aim is a V4 function R.Cam:setAim(aim) self.aim=aim end -- up is a V4 function R.Cam:setUp(up) self.up=up end function R.Cam:getM44() return R.NewM44LookAt(self.pos,self.aim,self.up) end end end rift_3dproj=function() return function(R) R=R or {} rift_3dgeom()(R) R.Proj={ ORTHOGRAPHIC='o', PERSPECTIVE='p', } function R.Proj:new(type) local o={ type=type, } setmetatable(o,self) self.__index=self return o end -- type is ORTHOGRAPHIC or PERSPECTIVE function R.Proj:setType(type) self.type=type end function R.Proj:getM44() local viewAngle=75 local near=0.01 local far=100 if self.type==R.Proj.ORTHOGRAPHIC then -- width,height,near,far return R.NewM44OrthProj(1,1,near,far) else -- viewAngle,near,far return R.NewM44PersProj(viewAngle,near,far) end end end end rift_3dscene=function() return function(R) R=R or {} rift_3dcam()(R) rift_3dproj()(R) rift_3dviewport()(R) R.Scene={} function R.Scene:new() local o={ cam=R.Cam:new(R.V4:new({0,0,0,0}),R.V4:new({0,0,1,0}),R.V4:new({0,-1,0,1})), proj=R.Proj:new(R.Proj.PERSPECTIVE), viewport=R.Viewport:new(240,136), actors={}, -- Table of actors, entries may be nil if an actor was removed } setmetatable(o,self) self.__index=self return o end function R.Scene:getCam() return self.cam end function R.Scene:setCam(cam) self.cam=cam:clone() end function R.Scene:proj() return self.proj end function R.Scene:setProj(proj) self.proj=proj:clone() end function R.Scene:clearActors() self.actors={} end -- mat is the World Transform - i.e. where the object is placed in the world function R.Scene:registerActor(actor) -- Slot this one into a gap if possible for i=1,#self.actors do local tryActor=self.actors if tryActor==nil then self.actors[i]={alive=true,actor=actor} return end end self.actors[#self.actors+1]={alive=true,actor=actor} end -- Removes the reference -- Not even sure this works #TODO: Thorough test function R.Scene:unregisterActor(actor) for i=1,#self.actors do local tryActor=self.actors[i] if tryActor==actor then self.actors[i].alive=false return end end end function R.Scene:draw() local viewMat=self.cam:getM44() local projMat=self.proj:getM44() for i=1,#self.actors do local actor=self.actors[i] if actor.alive then actor.actor:draw(viewMat,projMat,self.viewport) end end end end end rift_3danim=function() return function(R) R=R or {} R.Anim={} R.AnimFrame={} function R.Anim:new(name) local o={ name=name, frames={}, } setmetatable(o,self) self.__index=self return o end function R.Anim:addFrame(f) self.frames[#self.frames+1]=f end function R.AnimFrame:new() local o={ vtxs={} } setmetatable(o,self) self.__index=self return o end function R.AnimFrame:addVtx(v) self.vtxs[#self.vtxs+1]=v end end end rift_3dgeom=function() return function(R) R=R or {} rift_sysmath()(R) local S=math.sin local C=math.cos R.V4={ EMPTY={0,0,0,0}, ID={0,0,0,1}, } R.M44={ EMPTY={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}, ID={{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}}, } -- V4 -- -- e: -- {1,2,3,4} -- V4.EMPTY -- V4.IDENTITY function R.V4:new(e) local o={e={}} for i=1,4 do o.e[i]=e[i] end setmetatable(o,self) self.__index=self return o end function R.V4:clone() return R.V4:new(self.e) end function R.V4:add(v4) for x=1,4 do self.e[x]=self.e[x]+v4.e[x] end end function R.V4:addC(v4) local o=self:clone() o:add(v4) return o end function R.V4:sub(v4) for x=1,4 do self.e[x]=self.e[x]-v4.e[x] end end function R.V4:subC(v4) local o=self:clone() o:sub(v4) return o end function R.V4:mul(s) for x=1,4 do self.e[x]=self.e[x]*s end end function R.V4:mulC(s) local o=self:clone() o:mul(s) return o end function R.V4:div(s) -- catch s==0 s=(math.abs(s)<.001) and .001 or s for x=1,4 do self.e[x]=self.e[x]/s end end function R.V4:divC(s) local o=self:clone() o:div(s) return o end function R.V4:normal() local l=self:length() -- Catch l==0 l=(l<.001) and .001 or l self.e[1]=self.e[1]/l self.e[2]=self.e[2]/l self.e[3]=self.e[3]/Й²l end function R.V4:normalC() local o=self:clone() o:normal() return o end function R.V4:length() return math.sqrt( self.e[1]*self.e[1] +self.e[2]*self.e[2] +self.e[3]*self.e[3] ) end function R.V4:dot(v4) return self.e[1]*v4.e[1] +self.e[2]*v4.e[2] +self.e[3]*v4.e[3] end function R.V4:cross(v4) return R.V4:new({ self.e[2]*v4.e[3]-self.e[3]*v4.e[2], self.e[3]*v4.e[1]-self.e[1]*v4.e[3], self.e[1]*v4.e[2]-self.e[2]*v4.e[1], 1 }) end function R.V4:lerp(v4,t) return R.V4:new({ R.lerp(t,self.e[1],v4.e[1]), R.lerp(t,self.e[2],v4.e[2]), R.lerp(t,self.e[3],v4.e[3]), 1 }) end -- when working with V3 vectors for normals etc. and -- we just want to rotate them function R.V4:mulM44RotE(m44) local out={} for y=1,3 do local acc=0 for x=1,3 do acc=acc+self.e[x]*m44.e[y][x] end out[y]=acc end return out end function R.V4:mulM44Rot(m44,normalise) self.e=self:mulM44RotE(m44,normalise) end function R.V4:mulM44RotC(m44,normalise) return R.V4:new(self:mulM44RotE(m44,normalise)) end function R.V4:mulM44E(m44,normalise) local out={} for y=1,4 do local acc=0 for x=1,4 do acc=acc+self.e[x]*m44.e[y][x] end out[y]=acc end if normalise then if out[4]==0 then -- not sure if this is the right thing to do out[4]=0.00001 end out[1]=out[1]/out[4] out[2]=out[2]/out[4] out[3]=out[3]/out[4] end return out end function R.V4:mulM44(m44,normalise) self.e=self:mulM44E(m44,normalise) end function R.V4:mulM44C(m44,normalise) return R.V4:new(self:mulM44E(m44,normalise)) end function R.V4Normal(v1,v2,v3) local u=v2:subC(v1) local v=v3:subC(v1) local cross=u:cross(v) local l=cross:length() l=(l<.001) and .001 or l -- Catch l==0 return R.V4:new({cross.e[1]/l,cross.e[2]/l,cross.e[3]/l,1}) end -- M44 -- function R.M44:new(e) local o={e={{},{},{},{}}} for y=1,4 do for x=1,4 do o.e[y][x]=e[y][x] end end setmetatable(o,self) self.__index=self return o end function R.M44:clone() return R.M44:new(self.e) end function R.M44:newRotX(a) local s,c=S(a),C(a) return R.M44:new({{1,0,0,0},{0,c,-s,0},{0,s,c,0},{0,0,0,1}}) end function R.M44:newRotY(a) local s,c=S(a),C(a) return R.M44:new({ {c,0,-s,0}, {0,1,0,0}, {s,0,c,0}, {0,0,0,1}}) end function R.M44:newRotZ(a) local s,c=S(a),C(a) return R.M44:new({{c,-s,0,0},{s,c,0,0},{0,0,1,0},{0,0,0,1}}) end function R.M44:newScale(x,y,z) return R.M44:new({{x,0,0,0},{0,y,0,0},{0,0,z,0},{0,0,0,1}}) end function R.M44:newTrans(x,y,z) return R.M44:new({{1,0,0,x},{0,1,0,y},{0,0,1,z},{0,0,0,1}}) end -- Returns e[][] function R.M44:mulM44E(m44) local out={{},{},{},{}} for y=1,4 do for x=1,4 do local acc=0 for i=1,4 do acc=acc+self.e[y][i]*m44.e[i][x] end out[y][x]=acc end end return out end function R.M44:mulM44(m44) self.e=self:mulM44E(m44) end function R.M44:mulM44C(m44) return R.M44:new(self:mulM44E(m44)) end function R.NewM44LookAt(from,to,up) local z=(to:subC(from)):normalC() local x=up:cross(z):normalC() local y=z:cross(x):normalC() return R.M44:new({ {x.e[1],x.e[2],x.e[3],-x:dot(from)}, {y.e[1],y.e[2],y.e[3],-y:dot(from)}, {z.e[1],z.e[2],z.e[3],-z:dot(from)}, {0,0,0,1}, }) end function R.NewM44OrthProj(width,height,near,far) return R.M44:new({ {1/width,0,0,0}, {0,1/height,0,0}, {0,0,-(2/(far-near)),-((far+near)/(far-near))}, {0,0,0,1}, }) end -- viewAngle: 90 -- near: .1 -- far: 100 -- https://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/building-basic-perspective-projection-matrix.html function R.NewM44PersProj(viewAngle,near,far) local scale=1/math.tan(viewAngle * 0.5 * math.pi / 180); local p1=-(far/(near-far)) local p2=-((far*near)/(far-near)) return R.M44:new({ {scale,0,0,0}, {0,scale,0,0}, {0,0,p1,-1}, {0,0,p2,0}, }) end function R.M44:trace(name) if name==null then name="" end trace(string.format(name.."\n|%.2f, %.2f, %.2f, %.2f|\n|%.2f, %.2f, %.2f, %.2f|\n|%.2f, %.2f, %.2f, %.2f|\n|%.2f, %.2f, %.2f, %.2f|\n", self.e[1][1], self.e[1][2], self.e[1][3], self.e[1][4], self.e[2][1], self.e[2][2], self.e[2][3], self.e[2][4], self.e[3][1], self.e[3][2], self.e[3][3], self.e[3][4], self.e[4][1], self.e[4][2], self.e[4][3], self.e[4][4])) end end end function FLAG(R) R=R or {} local DAMPING = 0.01 local TIMESTEP = .025 R.cPoint = {} function R.cPoint:new(p1) local o={} o.p = p1 or R.V4:new({0,0,0,1}) o.op = p1 or R.V4:new({0,0,0,1}) o.acceleration = R.V4:new({0,0,0,1}) o.mass = 1 o.movable = true setmetatable(o,self) self.__index=self return o end function R.cPoint:addForce(V4) self.acceleration:add(V4:divC(self.mass)) end function R.cPoint:timeStep() if self.movable == true then local temp = self.p:clone() -- p = p+ (p-op)*(1-DAMPING) + acceleration*TIMESTEP local p1 = self.p:subC(self.op) p1:mul(1-DAMPING) local p2 = self.acceleration:mulC(TIMESTEP) p1:add(p2) self.p:add(p1) self.op = temp:clone() self.acceleration = R.V4:new({0,0,0,1}) end end function R.cPoint:offset(v4) if self.movable == true then self.p:add(v4) end end R.cConstraint = {} function R.cConstraint:new(cp1,cp2) local o={} o.cp1 = cp1 o.cp2 = cp2 local d1 = cp1.p:subC(cp2.p) o.restDistance=d1:length() setmetatable(o,self) self.__index=self return o end function R.cConstraint:satisfy() local d1 = self.cp2.p:subC(self.cp1.p) local currentDistance = d1:length() local correction = d1:mulC(1 - self.restDistance / currentDistance) correction:mul(0.5) self.cp1:offset(correction) self.cp2:offset(correction:mulC(-1)) end function R.normalTri(P1,P2,P3) local v1 = P2.p:subC(P1.p) local v2 = P3.p:subC(P1.p) return v1:cross(v2) end function R.windTriangle(P1,P2,P3,dir) local nm = R.normalTri(P1,P2,P3) local d = nm:normalC() nm:mul(d:dot(dir)) P1:addForce(nm) P2:addForce(nm) P3:addForce(nm) end R.Cloth = {} function R.Cloth:new(width, height, xsegs, ysegs) local o={} o.numX = xsegs o.numY = ysegs o.points = {} o.constraints = {} o.wind=1 local wi2 = width/2 local he2 = height/2 -- make points for i=1,xsegs do local x = width * (i/xsegs) - wi2 for j=1,ysegs do local y = height * (j/ysegs) - he2 --local z = 0 o.points[(j-1)*xsegs + i] = R.cPoint:new(R.V4:new({x,y,0,1})) -- left most points are on the flagpole if i == 1 then o.points[(j-1)*xsegs + i].movable = false end end end -- make constraints for i=1,xsegs do for j=1,ysegs do if (i+1) <= xsegs then table.insert(o.constraints, R.cConstraint:new(o.points[(j-1)*xsegs + i], o.points[(j-1)*xsegs + i+1])) -- x,y - x+1,y end if (j+1) <= ysegs then table.insert(o.constraints, R.cConstraint:new(o.points[(j-1)*xsegs + i], o.points[(j)*xsegs + i])) -- x,y - x,y+1 end if (i+1) <= xsegs and (j+1) <= ysegs then table.insert(o.constraints, R.cConstraint:new(o.points[(j-1)*xsegs + i], o.points[(j)*xsegs + i+1])) -- x,y - x+1,y+1 end if (i+1) <= xsegs and (j+1) <= ysegs then table.insert(o.constraints, R.cConstraint:new(o.points[(j-1)*xsegs + i+1], o.points[(j)*xsegs + i])) -- x+1,y - x,y+1 end end end -- 2nd level constraints (if needed) setmetatable(o,self) self.__index=self return o end function R.Cloth:timeStep() local gravity = R.V4:new({0,0.2 * TIMESTEP,0,0}) for i=1,#self.points do self.points[i]:addForce(gravity) end -- add wind for i=1,self.numX-1 do for j=1,self.numY-1 do local p1 = self.points[(j-1)*self.numX + i] local p2 = self.points[(j-1)*self.numX + i + 1] local p3 = self.points[(j)*self.numX + i] local p4 = self.points[(j)*self.numX + i + 1] local wind = R.V4:new({self.wind + RANDOM(), 0, 0.9, 1}) R.windTriangle(p1,p2,p3, wind) wind = R.V4:new({1.5 + RANDOM(), 0, 0.9, 1}) R.windTriangle(p4,p2,p3, wind) end end for i=1,#self.constraints do self.constraints[i]:satisfy() end for i=1,#self.points do self.points[i]:timeStep() end end end rift_3dgeom()(R) rift_3dmodel()(R) rift_3dscene()(R) rift_3dactor()(R) function setFlag() local flagw = 120 local flagh = 80 local flagr = flagw/flagh local detail = 7 Scene=R.Scene:new() -- counts differently to flag.lua, so X - 1 subdivs local modelData=rift_datamodelrectangletexsubdiv()(flagr,1,detail,detail) modelData.divide_by=1 local model=R.Model:new() model:load(modelData) actor=R.Actor:new(model) actor:setDrawFn(R.poly.DrawTex(0,0,flagw,flagh,2,-1),0) cloth = R.Cloth:new(flagr,1,detail+1,detail+1) actor:setGeomPrePassFn(function(i,v,m) v.e[1] = cloth.points[i].p.e[1] v.e[2] = cloth.points[i].p.e[2] v.e[3] = cloth.points[i].p.e[3] return v end) Scene:registerActor(actor) end function tomem(str) local tnb=tonumber local o=128*128+tnb(str:sub(1,2),16)*256 local w=tnb(str:sub(3,4),16)*8-1 local d=str:sub(5,str:len()) local y=0 for x = 1,#d,1 do local c=tnb(d:sub(x,x),16) poke4(o+y,c) y=y+1 if y>w then y=0 o=o+1024 end end end function tovram(str) local o=0 for c=1,#str,2 do local v=tonumber(str:sub(c,c+1),16) poke(0x3fc0+o,v) o=o+1 end end function myBoot() end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- dont need to copy the whole screen, just the area where i'm drawing the flag local memchunk = 141*136/2 -- Prescene function myPRESCENE() vbank(0) -- load shark palette tovram(pal) -- load shark gfx to sprites area tomem(gfx) vbank(1) -- load shark palette on second bank too tovram(pal) -- init scene/flag rendering stuff FLAG(R) setFlag() -- draw the flag with the shark --cls() rect(0,0,40,80,3) rect(40,0,40,80,14) rect(80,0,40,80,15) spr(256,30,10,15,1,0,0,8,8) for x=30,120 do for y=10,120 do if pix(x,y)==0 then pix(x,y,1) end end end -- save it to map memory memcpy(0x8000,0,memchunk) --cls() end -- Your amazing effect function myTIC(unitTics) local T = unitTics * 300 -- put flag on vbank0 because ttri needs special memory chunks for printing vbank(0) memcpy(0,0x8000,memchunk) vbank(1) cls() cloth:timeStep() --cloth.wind = 5+3*SIN(T*.013) local mat=R.M44:newTrans(0,-.1,1.2) mat:mulM44(R.M44:newRotX(SIN(T*.03)*.1)) mat:mulM44(R.M44:newRotY(SIN(T*.022)*.1)) mat:mulM44(R.M44:newRotZ(SIN(T*.027)*.2)) actor:setMat(mat) Scene:draw() vbank(0) cls() local at=T/100 for x=0,40 do for y=0,22 do local l=COS(math.abs(x-20)-math.abs(y-10)*at)%2+12 rect(x*6,y*6,6,6,l*12) --poke4(2*65438+x,c(l)) end end rect(0,106,256,20,15) line(0,126,256,126,11) local ax = COS(T*0.05)*74-20 print("approved by the leprechaum committe",ax,111,3,0,2,0) print("approved by the leprechaum committe",ax-1,110,14,0,2,0) --[[vbank(1) cls() ttri(0,0,20,20,20,0, 0,8,120,128,120,8, 0)--]] end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() vbank(1) cls() end return { precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end return ps() end rift_contributorsthanksfinal=function() local MIN, SIN, PI = math.min, math.sin, math.pi local tInc=.065 local GRMA_FOR = { {t=0,s={"For Mantratronic", "- who couldn't make Revision this time -"},x=0,y=60}, {t=tInc*2,s={"Thanks for", "The First TIC-80 Demo"},x=0,y=20}, {t=tInc*3,s={"Thanks for", "VJ-80"},x=0,y=60}, {t=tInc*4,s={"Thanks for", "Music for my first demo"},x=0,y=100}, {t=tInc*5,s={"Thanks for", "Archiving Monday Night Bytes"},x=0,y=20}, {t=tInc*6,s={"Thanks for", "Demos and ByteJams"},x=0,y=45}, {t=tInc*7,s={"Thanks for", "Being a good sport"},x=0,y=72}, {t=tInc*8,s={"Thanks for", "Being Mantratronic :)"},x=0,y=100}, {t=.7,s={"To keep you going", "till we can hug again IRL!"},x=0,y=50}, {t=.7,s={" - TPOLuaM"},x=0,y=120}, } -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, setExamplePalette() end -- Your amazing effect start function myTIC(unitTics) vbank(0) cls(13) --clear screen local barW = 2 rect(0,0,barW,136,14) rect(240-barW,0,barW,136,15) local iColour = 2 for _, gfor in ipairs(GRMA_FOR) do if unitTics > gfor.t then local inT = MIN(1, (unitTics - gfor.t) * 10/2) local y = gfor.y local fontsize=1 if inT < 1 then for i,str in ipairs(gfor.s) do local w = print(str, 0, 140, 0, false, fontsize) local x = 120 - w/2 local y = gfor.y + (i-1)*12 print(str, x-1, y-1, iColour, false, fontsize) print(str, x+1, y+1, iColour + 1, false, fontsize) print(str, x, y, iColour + 2, false, fontsize) end local v = SIN(inT * PI) setRGB(iColour, v*64, v*64, v*64) setRGB(iColour + 1, v*120, v*120, v*120) setRGB(iColour + 2, v*255, v*255, v*255) iColour = iColour + 3 end end end local v=1 if unitTics < .1 then v=unitTics/.1 elseif unitTics >= .9 then v=1-((unitTics-.9)/.1) end setRGB(13, v*0, v*0, v*0) setRGB(14, v*22, v*155, v*98) setRGB(15, v*255, v*136, v*62) end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() vbank(0) cls() trace("\n\n\nThanks for watching.\n\nGreetings to all who clapped along!\n\n") end return { tics=1000, precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end rift_contributorsjtruksprdata=function() -- b=0: tiles, b=1: sprites function fromGfxSlot(b,spr) local a = (0x4000+b*0x2000)*2+spr*64 local vals = {} for b=0,63,16 do local acc = 0 for i=0,15 do acc = acc + (peek4(a) << (i*4)) a = a + 1 end vals[#vals+1] = acc end return vals end return { palette={ 0x0,0xfff2bf,0xffffff,0xf7a594,0x0,0xf7a5,0xe9c62,0x5231, 0xff893c,0xff003c,0xffff00,0xffff,0x1a2aff,0xd313ee, }, pixels={ mantra1={ width=3, data={ 0x11,0x111100001113,0x1113300011133,0x1111300011331,0x1111111011133311,0x1333333333333333,0x3333333333333443,0x3333422444442243, 0x11000000,0x3311000033311000,0x3333110044331100,0x2243100042440000,0x1133100001333,0x11100000031,0x5300000555,0x555500055555, 0x3334224333342223,0x1133444111113314,0x1111113451111111,0x5551111155555111,0x4243000022431000,0x4431100013111000,0x3111100011110000,0x1113300011553300, 0x53335500333336,0x33333600033386,0x88600000888,0x8800000000,0x6666661166677777,0x6667717766667777,0x6666666666660000,0x8800000000000008, 0x6665330077763000,0x1776000077666000,0x6666660077777700,0x8888880088888880, } }, mantra2={ width=3, data={ 0x1,0x11100000111,0x111100001113,0x111100011133,0x111111111111331,0x1133333313333333,0x3333333333333344,0x3333342214444224, 0x11110000,0x3331100033331100,0x3333310034433100,0x4224300034244000,0x113300000133,0x1100003003,0x3335500333335,0x33333500033355, 0x1333422433334222,0x1113344411111331,0x3111111355111111,0x5555111155555511,0x3424310032243100,0x1443110011311100,0x4311130011111330,0x1111533011555300, 0x500000000,0x600000887,0x888700008888,0x888800000888,0x5666666166667777,0x6666771766666777,0x6666666676666666,0x8777000000000000, 0x1666000077770000,0x7178880077888880,0x6888888088888800,0x888800000000000, } }, ticman={ width=2, data={ 0x22222202244444,0x211111102144444,0x212222202124422,0x212442202124222,0x2222200044442200,0x1111420044414220,0x2221424244214242,0x4421424242214422, 0x212222202111111,0x211222202111222,0x211111102444444,0x224442200222220,0x2221422011114200,0x2211420021114200,0x1111420044444200,0x2444220022222000, } }, m={ width=2, data={ 0x444400044111,0x41111100411111,0x41114100411141,0x411141104111411,0x4444400011114400,0x1111114011111144,0x1141114411411144,0x1141144414111440, 0x411141104111444,0x4111440441114400,0x4111440041114400,0x444440000444000,0x1411144044111440,0x4411144041114440,0x4111440041114400,0x4444440004444000, } }, a={ width=2, data={ 0x400000041,0x41100004111,0x4111400041114,0x41111100411111,0x4440000011440000,0x1114400041114400,0x4411440044111440,0x1111144011111444, 0x411111104111144,0x4111144441111440,0x4111440041114400,0x4444400004440000,0x1111114444111144,0x4441114400411144,0x41114400411144,0x4444400004440, } }, n={ width=2, data={ 0x440000041440,0x41111400411114,0x41111100411111,0x411111104111141,0x4440000411440,0x41114444111144,0x4411114414111444,0x1111144011111440, 0x411144104111444,0x4111144441111404,0x4111440441114400,0x4444440000444400,0x1111144011111440,0x1111440011114400,0x4111440041144400,0x4444400004444000, } }, t={ width=2, data={ 0x4444400441111,0x41111100411111,0x44444100000041,0x4100000041,0x4444444011111144,0x1111114411111144,0x1144444411440000,0x1144000011400000, 0x41100000411,0x41100004111,0x411100004111,0x444400000444,0x1440000014400000,0x1440000044000000,0x4400000044000000,0x4400000040000000, } }, r={ width=2, data={ 0x444400041111,0x4111100441114,0x41114400411114,0x41111104111111,0x4444000011114400,0x1111144044411140,0x4444114444441144,0x1111114411111440, 0x411144404111444,0x411144441114440,0x4111440041114400,0x4444400004444000,0x1111440041114000,0x4411140004111140,0x411114400411144,0x41144400044440, } }, o={ width=2, data={ 0x4400004411,0x4111100411114,0x441114404111440,0x4411144041114440,0x4444000011114400,0x1111144044111140,0x4441114400411144,0x41114400411144, 0x4111440041114400,0x4411144404111111,0x441111100441111,0x4444400000444,0x41114404111144,0x4111144411111444,0x1111444014444400,0x4444400044400000, } }, i={ width=2, data={ 0x400000041,0x4100000041,0x41100000411,0x41100000411,0x4400000011400000,0x1144000011440000,0x1144000014440000,0x1444000014400000, 0x41100004111,0x411100004111,0x411100004111,0x44400000444,0x1440000014400000,0x4440000044000000,0x4400000044000000,0x4400000044000000, } }, c={ width=2, data={ 0x4400004411,0x4111100411111,0x41114404111444,0x411444041114440,0x4444400011111400,0x1111114044411144,0x4044114400044444,0x444000000000, 0x4111440041114400,0x4111444004111444,0x41111100041111,0x444400000444,0x4440,0x4114444411144,0x1111114411114440,0x4444440044440000, } }, }, } end rift_contributorsrealityfirst=function() --rain pre start linkPlay = true neoTime = 0 -- for testing we should replace this with 't' local sceners = { 'aldroid', 'Blossom', 'Catnip', 'Decca', 'dave84', 'DevEd', 'evilpaul', 'Flux', 'gasman', 'gigabates', 'jtruk', 'MrsBeanbag', 'ps', 'reality404', 'suule', 'superogue', 'ToBach', 'xxx', '', '', '', '', '', '', '' } local chars = {} local offsetRain = {} for i = 1, #sceners do local randomString = "" for j = 1, math.random(20, 30) do randomString = randomString .. string.char ( math.random( 33, ( 126 ) ) ) end table.insert(offsetRain, 7*math.random(0, 20)) table.insert(chars, randomString) --sceners[i] = sceners[i] .. randomString end for i = #sceners, 2, -1 do local j = math.random(i) sceners[i], sceners[j] = sceners[j], sceners[i] end local long = ((#chars+#sceners)*7)+140 --rain pre end --momin pre start local snufkinPlay = true local moominTime = 0 local moominDelay = 60 local dingOnce = false local moomins = { {letter = 'T', xCoord = 12, xCoord_TPOLM = 106, offset = 0, c = 12, left = true, hide = false}, {letter = 'h', xCoord = 17, xCoord_TPOLM = 111, offset = 0, c = 12, left = true, hide = true}, {letter = 'e', xCoord = 23, xCoord_TPOLM = 116, offset = 0, c = 12, left = true, hide = true}, {letter = 's', xCoord = 29, xCoord_TPOLM = 111, offset = 0, c = 12, left = true, hide = true}, {letter = 'e', xCoord = 35, xCoord_TPOLM = 111, offset = 0, c = 12, left = true, hide = true}, {letter = 'P', xCoord = 45, xCoord_TPOLM = 112, offset = 0, c = 12, left = true,hide = false}, {letter = 'e', xCoord = 51, xCoord_TPOLM = 112, offset = 0, c = 12, left = true,hide = true}, {letter = 'o', xCoord = 57, xCoord_TPOLM = 112, offset = 0, c = 12, left = true,hide = true}, {letter = 'p', xCoord = 63, xCoord_TPOLM = 112, offset = 0, c = 12, left = true,hide = true}, {letter = 'l', xCoord = 69, xCoord_TPOLM = 112, offset = 0, c = 12, left = true, hide = true}, {letter = 'e', xCoord = 74, xCoord_TPOLM = 112, offset = 0, c = 12, left = true, hide = true}, {letter = 'O', xCoord = 84, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = false}, {letter = 'v', xCoord = 90, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = true}, {letter = 'e', xCoord = 96, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = true}, {letter = 'r', xCoord = 102, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = true}, {letter = 't', xCoord = 108, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = true}, {letter = 'l', xCoord = 115, xCoord_TPOLM = 118, offset = 0, c = 12, left = true, hide = true}, {letter = 'y', xCoord = 120, xCoord_TPOLM = 120, offset = 0, c = 12, left = true, hide = true}, {letter = 'L', xCoord = 129, xCoord_TPOLM = 120, offset = 0, c = 12, left = false, hide = false}, {letter = 'o', xCoord = 135, xCoord_TPOLM = 110, offset = 0, c = 12, left = false, hide = true}, {letter = 'v', xCoord = 141, xCoord_TPOLM = 110, offset = 0, c = 12, left = false, hide = true}, {letter = 'e', xCoord = 147, xCoord_TPOLM = 110, offset = 0, c = 12, left = false, hide = true}, {letter = 'M', xCoord = 157, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = false}, {letter = 'a', xCoord = 163, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'n', xCoord = 169, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 't', xCoord = 175, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'r', xCoord = 181, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'a', xCoord = 187, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 't', xCoord = 193, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'r', xCoord = 199, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'o', xCoord = 205, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'n', xCoord = 211, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'i', xCoord = 217, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true}, {letter = 'c', xCoord = 220, xCoord_TPOLM = 130, offset = 0, c = 3, left = false, hide = true} } --moomin pre end --MEGA start local megaPlay = true local megaTime = 0 local megaDelay = 60 local megaDingOnce = false local megas = { {letter = 'T', xCoord = 22, xCoord_TPOLM = 106, offset = 0, c = 13, left = true, hide = false}, {letter = 'h', xCoord = 27, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 33, xCoord_TPOLM = 116, offset = 0, c = 13, left = true, hide = true}, {letter = 'P', xCoord = 43, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = false}, {letter = 'r', xCoord = 49, xCoord_TPOLM = 111, offset = 0, c = 13, left = true, hide = true}, {letter = 'a', xCoord = 55, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 'c', xCoord = 61, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 't', xCoord = 67, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 'i', xCoord = 73, xCoord_TPOLM = 112, offset = 0, c = 13, left = true,hide = true}, {letter = 't', xCoord = 76, xCoord_TPOLM = 112, offset = 0, c = 13, left = true, hide = true}, {letter = 'i', xCoord = 82, xCoord_TPOLM = 112, offset = 0, c = 13, left = true, hide = true}, {letter = 'o', xCoord = 85, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'n', xCoord = 91, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'e', xCoord = 97, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'r', xCoord = 103, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 's', xCoord = 109, xCoord_TPOLM = 118, offset = 0, c = 13, left = true, hide = true}, {letter = 'o', xCoord = 120, xCoord_TPOLM = 120, offset = 0, c = 13, left = false, hide = false}, {letter = 'f', xCoord = 126, xCoord_TPOLM = 125, offset = 0, c = 13, left = false, hide = true}, {letter = 'L', xCoord = 135, xCoord_TPOLM = 119, offset = 0, c = 13, left = false, hide = false}, {letter = 'u', xCoord = 141, xCoord_TPOLM = 110, offset = 0, c = 13, left = false, hide = true}, {letter = 'a', xCoord = 147, xCoord_TPOLM = 110, offset = 0, c = 13, left = false, hide = true}, {letter = 'M', xCoord = 157, xCoord_TPOLM = 110, offset = 0, c = 4, left = false, hide = false}, {letter = 'e', xCoord = 163, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'g', xCoord = 169, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'a', xCoord = 175, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'd', xCoord = 181, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'e', xCoord = 187, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'm', xCoord = 193, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 'o', xCoord = 199, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true}, {letter = 's', xCoord = 205, xCoord_TPOLM = 130, offset = 0, c = 4, left = false, hide = true} } --MEGA end -- Precalc for every scene is run in BOOT -- If you have anything expensive enough to slow the music then please do it here -- Not for setting sprite data, etc. since that may be overwritten by others. -- Use PRESCENE for that. function myPRECALC() end -- Prescene function myPRESCENE() -- You don't need to use the example palette specifically -- but please use these mandatory colours -- BLACK {0,0,0} (palette index 0) -- GREEN {22,155,98}, -- WHITE {255,255,255}, -- ORANGE {255,136,62}, setExamplePalette() end -- Your amazing effect start function myTIC(unitTics) vbank(0) cls() --clear screen -- rain start if linkPlay == true then --rect(0,0,240,136,6); -- remove this just so we can see the canvas size when testing neoTime = neoTime + 1 -- remember we can use 't' just for testing for i= 1, #sceners do local handle = sceners[i] local char = chars[i] local start = -(((#char+#handle)*7)+offsetRain[i]) for j = 1, #handle do print(string.sub(handle, j, j), 2 +((i - 1) * 10), ((j - 1) * 7)+start+neoTime,3) end for j = 1, #char do print(string.sub(char, j, j), 2 +((i - 1) * 10), ((j - 1) * 7)+(#handle*7)+start+neoTime,2) end if long == neoTime then megaPlay = true end end end -- rain end --mega start if megaPlay == true then megaTime = megaTime + 1 --print("These People Overtly Love Mantratronic", 10, 0, 12) --print("The Practitioners of Lua Megademos", 22, 10, 12) if megaTime < megaDelay then print("TPOL", 106, 65, 13) print("M", 130, 65, 4) end if megaTime > megaDelay then for i, megaData in ipairs(megas) do local letter = megaData.letter local xCoord = megaData.xCoord local xCoord_TPOLM = megaData.xCoord_TPOLM local offset = megaData.offset local colour = megaData.c local direction = 1 if megaData.left == true then direction = -1 end if math.abs(xCoord_TPOLM - xCoord) > math.abs(offset) then megaData.offset = megaData.offset + direction end megas[i].offset = megaData.offset local targetPosition = xCoord_TPOLM + offset if targetPosition == megas[4].xCoord then megas[2].hide = false megas[3].hide = false end if targetPosition == megas[17].xCoord then megas[5].hide = false megas[6].hide = false megas[7].hide = false megas[8].hide = false megas[9].hide = false megas[10].hide = false megas[11].hide = false megas[12].hide = false megas[13].hide = false megas[14].hide = false megas[15].hide = false megas[16].hide = false end if targetPosition == megas[17].xCoord then megas[18].hide = false end if targetPosition == megas[19].xCoord then megas[20].hide = false megas[21].hide = false end if targetPosition == megas[22].xCoord then megas[23].hide = false megas[24].hide = false megas[25].hide = false megas[26].hide = false megas[27].hide = false megas[28].hide = false megas[29].hide = false megas[30].hide = false end if targetPosition == megas[28].xCoord then if megaDingOnce == false then sfx(16) megaDingOnce = true end end if not megaData.hide then print(letter,xCoord_TPOLM + megaData.offset,65,colour) end end end end --mega end --moomin start --[[ if snufkinPlay == true then moominTime = moominTime + 1 if moominTime < moominDelay then print("TPOL", 106, 65, 12) print("M", 130, 65, 3) end if moominTime > moominDelay then for i, moominData in ipairs(moomins) do local letter = moominData.letter local xCoord = moominData.xCoord local xCoord_TPOLM = moominData.xCoord_TPOLM local offset = moominData.offset local colour = moominData.c local direction = 1 if moominData.left == true then direction = -1 end if math.abs(xCoord_TPOLM - xCoord) > math.abs(offset) then moominData.offset = moominData.offset + direction end moomins[i].offset = moominData.offset local targetPosition = xCoord_TPOLM + offset if targetPosition == moomins[6].xCoord then moomins[2].hide = false moomins[3].hide = false moomins[4].hide = false moomins[5].hide = false end if targetPosition == moomins[12].xCoord then moomins[7].hide = false moomins[8].hide = false moomins[9].hide = false moomins[10].hide = false moomins[11].hide = false end if targetPosition == moomins[19].xCoord then moomins[13].hide = false moomins[14].hide = false moomins[15].hide = false moomins[16].hide = false moomins[17].hide = false moomins[18].hide = false end if targetPosition == moomins[23].xCoord then moomins[20].hide = false moomins[21].hide = false moomins[22].hide = false end if targetPosition == moomins[23].xCoord then moomins[24].hide = false moomins[25].hide = false moomins[26].hide = false moomins[27].hide = false moomins[28].hide = false moomins[29].hide = false moomins[30].hide = false moomins[31].hide = false moomins[32].hide = false moomins[33].hide = false moomins[34].hide = false end if targetPosition == moomins[34].xCoord then if dingOnce == false then sfx(16) dingOnce = true end end if not moominData.hide then print(letter,xCoord_TPOLM + moominData.offset,65,colour) end end end end --]] --moomin end end -- Your amazing effect end function myBDR(y, unitTics, tics, time) end function myPOSTSCENE() vbank(0) cls() end return { tics=400, precalc=myPRECALC, preScene=myPRESCENE, tic=myTIC, bdr=myBDR, postScene=myPOSTSCENE, } end package.path = package.path .. ";C:\\Users\\micro\\AppData\\Roaming\\com.nesbox.tic\\TIC-80\\2024-revision-tic-grma\\?.lua" -- jtruk package.path = package.path .. ";/Users/flux/src/2024-revision-tic-grma/?.lua" -- flux package.path = package.path .. ";/Users/matthew/Development/tic80/grma/2024-revision-tic-grma/?.lua" -- gasman package.path = package.path .. ";/Users/alia/Documents/Demo/2024-revision-tic-grma/?.lua" -- catnip package.path = package.path .. ";/Users/tobi/tic80/2024-revision-tic-grma/?.lua" -- xxx package.path = package.path .. ";/Users/dave/Documents/GitHub/2024-revision-tic-grma/?.lua" -- dave84 package.path = package.path .. ";/home/deved/2024-revision-tic-grma/?.lua" -- deved local SCENES={ rift_contributorsrealityfirst(), rift_contributorsblossom(), rift_contributorsdave84(), rift_contributorssuperogue(), rift_contributorsmrsbeanbag(), rift_contributorsevilpaul(), rift_contributorsgigabates(), rift_contributorsaldroid(), rift_contributorsflux(), rift_contributorsjtruk(), rift_contributorsgasman(), rift_contributorseverybodyclapyourhands(), rift_contributorsxxx(), rift_contributorsdeved(), rift_contributorspsenough(), rift_contributorscatnip(), rift_contributorssuule(), rift_contributorsrealityfinal(), rift_contributorsthanksfinal(), } local ISCENE = 0 local CURRENT_SCENE = nil -- false: not started. true: started. local MUSIC = false local UNIT_TICS = 0 local TICS_THROUGH_SCENE = 0 local TIME = 0 local METRICS = { frame = 0, row = 0, isNewMusicRow = false, } function BOOT() -- Run precalc for all scenes... for i=1, #SCENES do SCENES[i].precalc() end -- Set up the first scene (0 -> 1) incScene() -- Reset music frame/row poke(0x13FFD,0) poke(0x13FFE,0) end function getMusicRowsInFrame(iFrame) return (iFrame == 10) and 32 or 64 end function TIC() TIME = time() poke(0x3ffb,0) -- pointer begone! if keyp(66) then exit("Aborted by Esc") end LAST_METRICS = METRICS local toNextScene = false local trackMeta = getTrackMeta(0) -- Check if we need to move to the next scene if CURRENT_SCENE.tics then -- non-music driven scene if TICS_THROUGH_SCENE > CURRENT_SCENE.tics then toNextScene = true end else -- music driven scene -- We have moved to a new frame if trackMeta.frame ~= LAST_METRICS.frame then toNextScene = true end end if toNextScene then local keepGoing = incScene() if not keepGoing then exit() end end if CURRENT_SCENE.tics then UNIT_TICS = TICS_THROUGH_SCENE / CURRENT_SCENE.tics else local rowsInFrame = getMusicRowsInFrame(trackMeta.frame) local timeForScene = rowsInFrame / trackMeta.rowsPerSec local ticsForScene = timeForScene * 60 UNIT_TICS = TICS_THROUGH_SCENE / ticsForScene local fMusicRow = (UNIT_TICS * rowsInFrame) METRICS = { frame = trackMeta.frame, row = trackMeta.row, nMusicRows = rowsInFrame, fMusicRow = fMusicRow, isNewMusicRow = fMusicRow//1 ~= LAST_METRICS.row, } end CURRENT_SCENE.tic(UNIT_TICS, METRICS) TICS_THROUGH_SCENE = TICS_THROUGH_SCENE + 1 --[[ local debugTime = string.format("%.01f", time() - TIME) print(debugTime, 0,0, 8) print(debugTime, 2,2, 15) print(debugTime, 1,1, 2) --]] end function BDR(y) CURRENT_SCENE.bdr(y, UNIT_TICS, TICS_THROUGH_SCENE, TIME, METRICS) end -- returns false if we've exhausted all scenes function incScene() if CURRENT_SCENE then CURRENT_SCENE.postScene() end ISCENE = ISCENE + 1 if ISCENE > #SCENES then return false end CURRENT_SCENE = SCENES[ISCENE] TICS_THROUGH_SCENE = 0 CURRENT_SCENE.preScene() -- Kick music off if it hasn't yet been requested and this is a music scene... if not MUSIC and CURRENT_SCENE.tics == nil then music(0,0,0,false) MUSIC=true end return true end function setExamplePalette() for vb=0,1 do vbank(vb) local rgbs={ {22,155,98}, {255,255,255}, {255,136,62}, } setRGB(0,0,0,0) for c,rgb in ipairs(rgbs) do for sh=0,4 do local sc=(1+sh)/5 local r=rgb[1]*sc local g=rgb[2]*sc local b=rgb[3]*sc local i=(c-1)*5+sh+1 setRGB(i,r,g,b) end end end end function setRGB(i,r,g,b) poke(16320+i*3,r) poke(16320+i*3+1,g) poke(16320+i*3+2,b) end function getTrackMeta(track) local a=0x13E64+51*track+48 local tempo=peek(a) if (peek(a)&128)//128 == 1 then tempo = 150 + peek(a)&127 else tempo = 150 + tempo end local rows=64-peek(a+1) local speed = 0 local t2=(peek(a+2)&128)//128 if t2 == 1 then speed = 6 + peek(a+2)&127 else speed = 6 + peek(a+2) end local bpm=(6*tempo)/speed return { frame=peek(0x13FFD), row=peek(0x13FFE), rows=rows, rowsPerSec=bpm/(60/4) } end