Created
April 19, 2019 21:59
-
-
Save Powersaurus/196aa4a9bc3bdffc24453c51830ce8a7 to your computer and use it in GitHub Desktop.
Pico-8 raycaster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pico-8 cartridge // http://www.pico-8.com | |
| version 16 | |
| __lua__ | |
| -- raycaster demo | |
| -- by @powersaurus | |
| -- based heavily on http://lodev.org/cgtutor/raycasting.html | |
| -- and http://lodev.org/cgtutor/raycasting2.html | |
| -- and inspired by the work of @matthughson | |
| -- thanks for advice from @kometbomb and @doyousketch2 | |
| debug=true | |
| frames=0 | |
| function calculate_fps(now) | |
| frames+=1 | |
| local newnow=flr(now) | |
| if (newnow!=lastclock) then | |
| fps=frames | |
| frames=0 | |
| lastclock=newnow | |
| end | |
| end | |
| function clamp(val,mi,ma) | |
| return max(mi,min(ma,val)) | |
| end | |
| function make_door(x,y,a) | |
| local d=make_sprite(x,y,a,true) | |
| d.update=function(s) | |
| local diff = abs(s.target_r-s.a) | |
| if diff>1 then | |
| local rot = (s.target_r-s.a)/diff*2 | |
| turn_player(s,rot) | |
| end | |
| if abs(player.pos.x-s.pos.x)<=1.5 and | |
| abs(player.pos.y-s.pos.y)<=1.5 then | |
| rotate_to(s,90) | |
| else | |
| rotate_to(s,0) | |
| end | |
| end | |
| return d | |
| end | |
| function make_cat(x,y,a) | |
| local c=make_sprite(x,y,a,false) | |
| c.think_timer=1 | |
| c.do_plan=function() | |
| local diff = abs(c.target_r-c.a) | |
| if diff>1 then | |
| local rot = 10 | |
| if c.target_r<c.a then | |
| rot=-10 | |
| end | |
| turn_player(c,rot) | |
| end | |
| move_in_current_dir(c,0.10) | |
| end | |
| c.update=function(c) | |
| c.do_plan() | |
| c.think_timer-=1 | |
| if c.think_timer==0 then | |
| c.think_timer=30 | |
| --plan | |
| rotate_to(c,rnd(360)) | |
| --end plan | |
| end | |
| end | |
| end | |
| function make_sprite(x,y,a,flat) | |
| local s={ | |
| a=0, | |
| target_r=0, | |
| dr={x=1,y=0}, | |
| pos={x=x,y=y}, | |
| flat=flat | |
| } | |
| return s | |
| end | |
| function rotate_to(s,targetrotation) | |
| s.target_r = targetrotation | |
| end | |
| function make_world() | |
| --[[ return { | |
| {5,6,5,6,5,5,5,5,5,5,5,0,0,0,0,0,0,0}, | |
| {5,-1,-1,-1,-1,-1,5,-4,-4,-4,2,0,0,0,0,0,0,0}, | |
| {5,-1,-1,-1,-1,-1,0,-4,-4,-4,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, | |
| {6,-1,-1,-1,-1,-1,0,-4,-4, -4,-4,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,6}, | |
| {6,-1,-1,-1,-2,5,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,6}, | |
| {6,-1,-1,-1,-1,5,-4,-4,-4,-4,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, | |
| {6,-1,-1,-1,-1,3,-4,-4,-4,-4,5,0,0,0,0,0,0,0}, | |
| {5,-1,-1,-1,-1,5,-4,-4,-4,-4,5,0,0,0,0,0,0,0}, | |
| {5,-1,-1,-1,-1,5,-4,-4,-4,-4,5,0,0,0,0,0,0,0}, | |
| {5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0} | |
| }]] | |
| local new_world={} | |
| for y=0,7 do | |
| new_world[y+1]={} | |
| for x=0,7 do | |
| local tex=map_to_tex(mget(x,48+y)) | |
| new_world[y+1][x+1]=tex | |
| if tex==3 then | |
| add(doors,{x=x+1,y=y+1,open_pcnt=0,open_vel=0}) | |
| end | |
| end | |
| end | |
| return new_world | |
| end | |
| doors={} | |
| function update_doors(doors) | |
| for _,d in pairs(doors) do | |
| local dx=player.pos.x-(d.x+0.5) | |
| local dy=player.pos.y-(d.y+0.5) | |
| local dtd=abs(dx*dx+dy*dy) | |
| msg=player.pos.x.." "..player.pos.y.." "..d.x.." "..d.y.." "..dtd | |
| -- msg="" | |
| if dtd<2 then | |
| msg="door "..dtd.." "..d.x.." "..d.y.." "..player.pos.x.." "..player.pos.y | |
| if d.open_pcnt<100 then | |
| d.open_vel=5 | |
| end | |
| else | |
| if d.open_pcnt>0 then | |
| d.open_vel=-5 | |
| end | |
| end | |
| d.open_pcnt=clamp(d.open_pcnt+d.open_vel,0,100) | |
| end | |
| end | |
| map_to_tex_mapping={} | |
| map_to_tex_mapping[96]=0 | |
| map_to_tex_mapping[97]=-1 | |
| map_to_tex_mapping[98]=-2 | |
| map_to_tex_mapping[99]=3 | |
| map_to_tex_mapping[100]=4 | |
| map_to_tex_mapping[101]=5 | |
| map_to_tex_mapping[102]=6 | |
| map_to_tex_mapping[103]=7 | |
| function map_to_tex(mapval) | |
| return map_to_tex_mapping[mapval] | |
| end | |
| function _init() | |
| timer=0 | |
| dist_table={} | |
| detail_limit_table={} | |
| create_palettes() | |
| msg="" | |
| player={ | |
| a=0, | |
| vr=0, | |
| v=0, | |
| sv=0, | |
| -- pos={x=2.5,y=2.5}, | |
| -- pos={x=4.6,y=8.3}, | |
| -- pos={x=7.6,y=8.3}, | |
| pos={x=3.6,y=3.8}, | |
| -- dr={x=1,y=-0.0010}, | |
| -- pos={x=5.704,y=4.116}, | |
| dr={x=1,y=0}, -- looking west | |
| cam={x=0,y=0.66} | |
| } | |
| turn_player(player,45) | |
| world=make_world() | |
| sprites={} | |
| for y=0,128 do | |
| dist_table[y]=128/(2*y-128) | |
| detail_limit_table[y]=flr(98+7*sin(y/256)) | |
| end | |
| -- build tex lookup table | |
| for y=1,#world do | |
| for x=1,#world[y] do | |
| poke(0x4300+y*32+x,abs(world[y][x])) | |
| end | |
| end | |
| stars={} | |
| for s=0,50 do | |
| local x=rnd(20)-10 | |
| local y=rnd(20)-10 | |
| local z=32+rnd(64) | |
| local star={ | |
| x=x, | |
| y=y, | |
| z=z | |
| } | |
| add(stars,star) | |
| end | |
| particles={} | |
| -- add(particles,{x=2,y=2,z=1}) | |
| -- add(particles,{x=3,y=3,z=1}) | |
| -- add(particles,{x=3,y=2,z=1}) | |
| -- add(particles,{x=2,y=3,z=1}) | |
| --[[ for i=1,128 do | |
| local d=rnd(2) | |
| local r=rnd(1) | |
| add(particles,{ | |
| x=4+d*-sin(r), | |
| y=4+d*cos(r), | |
| z=rnd(50)-30, | |
| life=100}) | |
| end]] | |
| _draw=draw | |
| _update=update | |
| end | |
| function turn_player(player,ar) | |
| player.a+=ar | |
| if player.a>359 then | |
| player.a-=359 | |
| end | |
| player.a=flr(player.a) | |
| local r=player.a/360 | |
| local olddrx=player.dr.x | |
| player.dr.x=cos(r) | |
| player.dr.y=-sin(r) | |
| if player.cam then | |
| local r2=ar/360 | |
| local oldplanex=player.cam.x | |
| player.cam.x=oldplanex*cos(r2)+ | |
| player.cam.y*sin(r2) | |
| player.cam.y=-oldplanex*sin(r2)+ | |
| player.cam.y*cos(r2) | |
| end | |
| end | |
| function turn_player2(player,ar) | |
| player.vr=clamp(player.vr+ar,-6,6) | |
| end | |
| strafe=false | |
| draw_map=false | |
| draw_walls=true | |
| door_open_pcnt=1 | |
| door_open_vel=5 | |
| function door_for(x,y) | |
| for _,d in pairs(doors) do | |
| if d.x==x and d.y==y then | |
| return d | |
| end | |
| end | |
| return nil | |
| end | |
| function update() | |
| timer+=1 | |
| update_doors(doors) | |
| if btnp(5) then | |
| --draw_map=not draw_map | |
| draw_walls=not draw_walls | |
| end | |
| local sp=0.08 | |
| if btn(4) then | |
| strafe=true | |
| else | |
| strafe=false | |
| end | |
| if btn(0) then | |
| if strafe then | |
| strafe_in_current_dir(player,-sp) | |
| else | |
| turn_player2(player,-1.0) | |
| end | |
| end | |
| if btn(1) then | |
| if strafe then | |
| strafe_in_current_dir(player,sp) | |
| else | |
| turn_player2(player,1.0) | |
| end | |
| end | |
| if btn(2) then | |
| move_in_current_dir(player,sp) | |
| end | |
| if btn(3) then | |
| move_in_current_dir(player,-sp) | |
| end | |
| update_p(player) | |
| player.vr*=0.9 | |
| player.a+=player.vr | |
| if player.a>359 then | |
| player.a-=359 | |
| end | |
| local r=player.a/360 | |
| local olddrx=player.dr.x | |
| player.dr.x=cos(r) | |
| player.dr.y=-sin(r) | |
| if player.cam then | |
| local r2=player.vr/360 | |
| local oldplanex=player.cam.x | |
| player.cam.x=oldplanex*cos(r2)+ | |
| player.cam.y*sin(r2) | |
| player.cam.y=-oldplanex*sin(r2)+ | |
| player.cam.y*cos(r2) | |
| end | |
| for _,s in pairs(sprites) do | |
| if (s.update) s:update() | |
| end | |
| end | |
| function move_in_current_dir(s,amount) | |
| s.v=clamp(s.v+amount,-0.3,0.3) | |
| end | |
| function strafe_in_current_dir(s,amount) | |
| s.sv=clamp(s.sv+amount,-0.3,0.3) | |
| end | |
| function update_p(s) | |
| s.v*=0.6 | |
| s.sv*=0.6 | |
| local mvx=player.cam.x*s.sv+s.dr.x*s.v | |
| local mvy=player.cam.y*s.sv+s.dr.y*s.v | |
| -- local movex=s.pos.x+s.dr.x*s.v | |
| local movex=s.pos.x+mvx | |
| -- local movey=s.pos.y+s.dr.y*s.v | |
| local movey=s.pos.y+mvy | |
| local move_sq=world | |
| [flr(s.pos.y)] | |
| [flr(movex)] | |
| if move_sq<=0 | |
| or (move_sq==3 and door_for( | |
| flr(movex), flr(s.pos.y)).open_pcnt>70) | |
| -- and abs(flr(movex)-movex)>0.1 | |
| then | |
| s.pos.x=movex | |
| end | |
| move_sq=world | |
| [flr(movey)] | |
| [flr(s.pos.x)] | |
| if world[flr(movey)][flr(s.pos.x)]<=0 | |
| or (move_sq==3 and door_for( | |
| flr(s.pos.x), flr(movey)).open_pcnt>70) | |
| -- and abs(flr(movey)-movey)>0.1 | |
| then | |
| s.pos.y=movey | |
| end | |
| end | |
| function draw() | |
| reset_palette() | |
| calculate_fps(time()) | |
| timer+=1 | |
| --[[msg=player.pos.x.." "..player.pos.y | |
| .."\n"..player.dr.x.." "..player.dr.y | |
| .."\n"..player.cam.x.." "..player.cam.y]] | |
| if draw_map then | |
| draw_map_view(world,player) | |
| else | |
| draw_perspective(world,player,dist_table,detail_limit_table) | |
| if debug then | |
| reset_palette() | |
| print(fps,2,2,7) | |
| print("cpu: "..stat(1),2,10,7) | |
| -- print("pos: "..player.pos.x.." "..player.pos.y.." "..player.a,2,19,7) | |
| -- print("msg: "..msg,2,19,10) | |
| end | |
| end | |
| end | |
| function draw_map_view(world,player) | |
| cls(5) | |
| pal(7,7) | |
| reset_palette() | |
| for y=1,#world do | |
| for x=1,#world[y] do | |
| local sp=abs((world[y][x])*2) | |
| -- if (sp==-1) sp=16 | |
| -- spr(sp,(x-1)*8,#world*8-y*8) | |
| spr(sp,(x-1)*8,(y-1)*8) | |
| end | |
| end | |
| local px=8*(player.pos.x-1) | |
| local py=8*(player.pos.y-1) | |
| local pxe=px+player.dr.x*10 | |
| local pye=py+player.dr.y*10 | |
| line( | |
| px,py, | |
| pxe,pye, | |
| 8) | |
| circfill( | |
| px, | |
| py, | |
| 2, | |
| 7) | |
| pset(px,py,9) | |
| end | |
| function draw_perspective(world,player,dist_table,detail_limit_table) | |
| -- sky | |
| rectfill(0,0,128,64,0) | |
| --[[ for i=48,60,2 do | |
| rectfill(0,i,128,i,1) | |
| rectfill(0,i+7,128,i+7,1) | |
| end]] | |
| local cam=player.cam | |
| local dr=player.dr | |
| -- stars | |
| for _,s in pairs(stars) do | |
| local invdet=1/(cam.x*dr.y-cam.y*dr.x) | |
| local tfx=invdet*(dr.y*s.x-dr.x*s.y) | |
| local tfy=invdet*(-cam.y*s.x+cam.x*s.y) | |
| local sx=64*(1+tfx/tfy) | |
| local sy=abs(64-s.z) | |
| pset(sx,sy,7) | |
| end | |
| -- put another rect fill to hide the stars behind the walls | |
| rectfill(0,64,128,128,1) | |
| if not draw_walls then | |
| return | |
| end | |
| local floors={} | |
| local zbuf={} | |
| local check=0 | |
| local prevside=-1 | |
| -- local lworld=world | |
| -- local ldist_table=dist_table | |
| local camx1=player.cam.x | |
| local camy=player.cam.y | |
| local rayx=player.pos.x | |
| local rayy=player.pos.y | |
| for x=0,127 do | |
| rayx=player.pos.x | |
| rayy=player.pos.y | |
| local camx=2*x/128 -1 | |
| local raydirx= | |
| player.dr.x+camx1*camx | |
| local raydiry= | |
| player.dr.y+camy*camx | |
| local mapx=flr(rayx) | |
| local mapy=flr(rayy) | |
| local rdy2=raydiry*raydiry | |
| local rdx2=raydirx*raydirx | |
| local ddx=sqrt(1+rdy2/rdx2) | |
| local ddy=sqrt(1+rdx2/rdy2) | |
| --.5143->.4703 wow! thanks lodev tut | |
| -- it doesn't work!!!! | |
| -- local ddx=abs(1/raydirx) | |
| -- local ddy=abs(1/raydiry) | |
| if abs(raydirx)<0.01 then | |
| if raydirx<0 then | |
| raydirx=-0.01 | |
| else | |
| raydirx=0.01 | |
| end | |
| ddx=100 | |
| end | |
| if abs(raydiry)<0.01 then | |
| if raydiry<0 then | |
| raydiry=-0.01 | |
| else | |
| raydiry=0.01 | |
| end | |
| ddy=100 | |
| end | |
| -- printh("r:"..raydiry,"debug") | |
| local hit=0 | |
| local side=0 | |
| local stepx=0 | |
| local stepy=0 | |
| local sidedistx=0 | |
| local sidedisty=0 | |
| local texidx=0 | |
| local door=false | |
| local d=nil--door | |
| -- fooooo | |
| if raydirx<0 then | |
| stepx=-1 | |
| sidedistx=(rayx-mapx)*ddx | |
| elseif raydirx>0 then | |
| stepx=1 | |
| sidedistx=(mapx+1-rayx)*ddx | |
| else | |
| sidedistx=20000 | |
| end | |
| if raydiry<0 then | |
| stepy=-1 | |
| sidedisty=(rayy-mapy)*ddy | |
| elseif raydiry>0 then | |
| stepy=1 | |
| sidedisty=(mapy+1-rayy)*ddy | |
| else | |
| sidedisty=20000 | |
| end | |
| while hit==0 do | |
| if sidedistx<sidedisty then | |
| sidedistx+=ddx | |
| mapx+=stepx | |
| side=0 | |
| else | |
| sidedisty+=ddy | |
| mapy+=stepy | |
| side=1 | |
| end | |
| texidx=world[mapy][mapx] | |
| if texidx>2 then | |
| -- msg=player.pos.x..","..player.pos.y | |
| -- insane door draw hacks | |
| if texidx==3 then | |
| if false and ((side==0 and sidedistx<sidedisty) | |
| or (side==1 and sidedistx>sidedisty)) | |
| then | |
| door=true | |
| hit=1 | |
| else | |
| local map_x2=mapx | |
| local map_y2=mapy | |
| if (rayx<map_x2) map_x2-=1 | |
| if (rayy>map_y2) map_y2+=1 | |
| local adj=1 | |
| local ray_mult=1 | |
| if side==1 then | |
| adj=map_y2-rayy | |
| ray_mult=adj/raydiry | |
| else | |
| adj=(map_x2-rayx)+1 | |
| ray_mult=adj/raydirx | |
| end | |
| local rxe=rayx+raydirx*ray_mult | |
| local rye=rayy+raydiry*ray_mult | |
| d=door_for(mapx,mapy) | |
| if side==0 then | |
| local y_step=sqrt(ddx*ddx-1) | |
| if flr(rye+(stepy*y_step)/2)==mapy | |
| and (rye+(stepy*y_step)/2)-mapy>d.open_pcnt/100 then | |
| hit=1 | |
| door=true | |
| end | |
| --[[ if hit==0 then | |
| mapx+=5 | |
| rayx+=5 | |
| end]] | |
| else | |
| local x_step=sqrt(ddy*ddy-1) | |
| if flr(rxe+(stepx*x_step)/2)==mapx | |
| and (rxe+(stepx*x_step)/2)-mapx>d.open_pcnt/100 then | |
| hit=1 | |
| door=true | |
| end | |
| end | |
| end | |
| -- end door hack | |
| else | |
| hit=1 | |
| end | |
| end | |
| end | |
| local perpwalldist=0 | |
| if side==0 then | |
| if(door) mapx+=stepx/2 | |
| perpwalldist=(mapx-rayx+ | |
| (1-stepx)/2)/raydirx | |
| else | |
| if(door) mapy+=stepy/2 | |
| perpwalldist=(mapy-rayy+ | |
| (1-stepy)/2)/raydiry | |
| end | |
| zbuf[x]=perpwalldist | |
| local lheight=flr(128/perpwalldist) | |
| local half_height=lheight/2 | |
| local stacks=0--mapy%2 | |
| --[[ if mapx==6 then | |
| stacks=1 | |
| end]] | |
| local dstart=-(half_height)+64 | |
| local dend=flr(half_height+64) | |
| -- if (dend==nil) dend=128 | |
| -- hack for being very close | |
| -- to the wall. doesn't quite | |
| -- work | |
| if dstart>dend then | |
| dstart=0 | |
| dend=128 | |
| end | |
| if (dend<64) dend=128 | |
| if lheight==0 then | |
| dstart=0 | |
| dend=128 | |
| end | |
| local wallx=0 | |
| if side==0 then | |
| wallx=rayy+perpwalldist*raydiry | |
| else | |
| wallx=rayx+perpwalldist*raydirx | |
| end | |
| wallx-=flr(wallx) | |
| local texx=flr(wallx*16) | |
| if texidx==3 then | |
| if d.open_pcnt>0 then--whuuuuuut | |
| texx+=1 | |
| end | |
| texx-=(d.open_pcnt/100)*16 | |
| end | |
| dend=dend or 128 | |
| local dcol= | |
| min(15,flr((dend-dstart)/2)) | |
| if (side==1) dcol=max(dcol-3,0) | |
| local p=clamp(15-dcol,0,7) | |
| palette(p) | |
| local vstep=(64-dstart)*2 | |
| local t=0 | |
| for i=0,stacks do | |
| local foo=half_height*(max(1,i*3)) | |
| local dstart2=-foo+64 | |
| sspr(texidx*16+texx,0,1,16,x,dstart2,1,dend-dstart+1) | |
| end | |
| -- draw every other vertical line | |
| if x%2==0 and dend<128 then | |
| add(floors, | |
| { | |
| x, | |
| check%2, | |
| dend, | |
| raydirx, | |
| raydiry, | |
| flr(max( | |
| detail_limit_table[x], | |
| dend)), | |
| stacks }) | |
| check+=1 | |
| end | |
| end | |
| reset_palette() | |
| floor_cast(floors,world,player,dist_table,detail_limit_table) | |
| --[[ ce_heap_sort(sprites,player) | |
| for _,s in pairs(sprites) do | |
| if s.flat then | |
| draw_flat_sprite(s,player,zbuf) | |
| else | |
| draw_billboard_sprite(s,player,zbuf) | |
| end | |
| end]] | |
| reset_palette() | |
| local par_col={} | |
| par_col[0]=4 | |
| par_col[1]=9 | |
| par_col[2]=10 | |
| par_col[3]=10 | |
| par_col[4]=7 | |
| par_col[5]=7 | |
| for _,s in pairs(particles) do | |
| s.z+=0.3 | |
| s.life-=1 | |
| if s.z>30 or s.life==0 then | |
| s.z=-30+rnd(4) | |
| s.life=150+flr(rnd(50)) | |
| end | |
| local s_x=s.x-player.pos.x | |
| local s_y=s.y-player.pos.y | |
| local invdet=1/(cam.x*dr.y-cam.y*dr.x) | |
| local tfx=invdet*(dr.y*s_x-dr.x*s_y) | |
| local tfy=invdet*(-cam.y*s_x+cam.x*s_y) | |
| local scr_x=64*(1+tfx/tfy) | |
| local scr_y=64-(s.z/tfy) | |
| -- int drawstarty = -spriteheight / 2 + h / 2 + vmovescreen; | |
| if tfy>0 and tfy<128 then | |
| -- msg=">> "..(tfy/tfx) | |
| local sz= | |
| flr(clamp(4-sqrt(s_x*s_x+s_y*s_y),0,3)) | |
| rectfill( | |
| scr_x, | |
| scr_y, | |
| scr_x+sz, | |
| scr_y+sz, | |
| par_col[clamp(flr(s.life/20),0,5)]) | |
| end | |
| end | |
| reset_palette() | |
| end | |
| function floor_cast(floors,world,player,dist_table,detail_limit_table) | |
| local h=128 | |
| local px=player.pos.x | |
| local py=player.pos.y | |
| for _,f in pairs(floors) do | |
| local x=f[1] | |
| local check=f[2] | |
| local dend=f[3] | |
| local raydirx=f[4] | |
| local raydiry=f[5] | |
| local start_dither=f[6] | |
| local stacks=f[7] | |
| -- local start_dither=detail_limit_table[x] | |
| -- for y=h-check%2,dend+10,-2 do | |
| --653 to beat | |
| local curdist=0 | |
| local cfloorx=0 | |
| local cfloory=0 | |
| local floortex=0 | |
| local floortexx=0 | |
| local floortexy=0 | |
| if stacks==0 then | |
| rectfill(x,128-start_dither,x+2,128-(dend+3),1) | |
| end | |
| for y=start_dither-check,dend+5,-2 do | |
| curdist=dist_table[y] | |
| cfloorx=curdist*raydirx+px | |
| cfloory=curdist*raydiry+py | |
| -- floortex=abs(world[flr(cfloory)][flr(cfloorx)]) | |
| floortex=peek(0x4300+32*flr(cfloory)+flr(cfloorx)) | |
| floortexx=(cfloorx*16)%16 | |
| floortexy=(cfloory*16)%16 | |
| local tcol=sget(floortex*16+floortexx,floortexy) | |
| pset(x,y,tcol) | |
| if floortex==0 | |
| or floortex==3 then | |
| local trcol=sget(floortexx,floortexy+16) | |
| pset(x,128-y,trcol) | |
| end | |
| end | |
| for y=h-check,start_dither,-2 do | |
| curdist=dist_table[y] | |
| cfloorx=curdist*raydirx+px | |
| cfloory=curdist*raydiry+py | |
| -- floortex=abs(world[flr(cfloory)][flr(cfloorx)]) | |
| --6503->6374 | |
| floortex=peek(0x4300+32*flr(cfloory)+flr(cfloorx)) | |
| if floortex==3 then | |
| floortex=0 | |
| end | |
| floortexx=(cfloorx*16)%16 | |
| floortexy=(cfloory*16)%16 | |
| local tcol=sget(floortex*16+floortexx,floortexy) | |
| rectfill(x,y,x+3,y,tcol) | |
| if floortex==0 | |
| or floortex==3 then | |
| local trcol=sget(floortexx,floortexy+16) | |
| rectfill(x,128-y,x+3,128-y,trcol) | |
| end | |
| end | |
| end | |
| end | |
| function dot_product(a,b) | |
| return a.x*b.x+a.y*b.y | |
| end | |
| function len(a) | |
| return sqrt(a.x*a.x+a.y*a.y) | |
| end | |
| function acos(x) | |
| return atan2(x,-sqrt(1-x*x)) | |
| end | |
| function lerp(a,b,percent) | |
| return (b-a)*percent+a | |
| end | |
| function draw_billboard_sprite(s,player,zbuf) | |
| local pos=player.pos | |
| local dr=player.dr | |
| local cam=player.cam | |
| local tex_width=32 | |
| local s_x=s.pos.x-pos.x | |
| local s_y=s.pos.y-pos.y | |
| local s_dist= | |
| sqrt(s_x*s_x+s_y*s_y) | |
| local invdet=1.0/ | |
| (cam.x*dr.y- | |
| cam.y*dr.x | |
| ) | |
| local t_x=invdet*( | |
| dr.y*s_x- | |
| dr.x*s_y | |
| ) | |
| local t_y=invdet*( | |
| -cam.y*s_x+ | |
| cam.x*s_y | |
| ) | |
| -- if t_y>0 and t_y<128 then | |
| local sscr_x=flr(64*(1+t_x/t_y)) | |
| local s_height=flr(abs(128/t_y)) | |
| local ds_y=-s_height/2+64 | |
| local s_width=s_height | |
| local ds_x=-s_width/2+sscr_x | |
| if ds_x<0 then | |
| ds_x=0 | |
| end | |
| local de_x=s_width/2+sscr_x | |
| if (de_x>=128) de_x=127 | |
| if t_y>0 and t_y<128 then | |
| -- new slighlty faster way | |
| --[[ local visstart=-1 | |
| local visend=-1 | |
| local texstart=0 | |
| local texend=(de_x-(-s_width/2+sscr_x))*32/s_width | |
| local setstart=false | |
| local visible=false | |
| for i=ds_x,de_x do | |
| if zbuf[flr(i)]>s_dist then | |
| visible=true | |
| if visstart==-1 then | |
| visstart=i | |
| texstart=(i-(-s_width/2+sscr_x))*32/s_width | |
| setstart=true | |
| end | |
| else | |
| if setstart and visend==-1 then | |
| visend=i | |
| texend=(i-(-s_width/2+sscr_x))*32/s_width | |
| end | |
| end | |
| end | |
| if (visstart==-1) visstart=ds_x | |
| if (visend==-1) visend=de_x | |
| if visible then | |
| sspr(texstart,64,texend-texstart,32,visstart,ds_y,visend-visstart,s_height) | |
| end]] | |
| -- old, slower way | |
| --[[ local foo=dot_product(dr,s.dr)/ | |
| (len(dr)*len(s.dr))]] | |
| local foo=(s.a-player.a) | |
| if foo>360 then | |
| foo-=360 | |
| elseif foo<0 then | |
| foo+=360 | |
| end | |
| msg="a="..foo | |
| local rot_tex_idx=0 | |
| if foo<25 or foo>335 then | |
| rot_tex_idx=32 | |
| elseif foo>=25 and foo<155 then | |
| rot_tex_idx=64 | |
| elseif foo>=155 and foo<205 then | |
| rot_tex_idx=96 | |
| end | |
| palette(clamp(flr(s_dist-2),0,15)) | |
| for i=ds_x,de_x do | |
| if zbuf[flr(i)]>s_dist then | |
| local texx=( | |
| i-(-s_width/2+sscr_x))*31 /s_width | |
| sspr(rot_tex_idx+texx,64,1,32,i,ds_y,1,s_height) | |
| end | |
| end | |
| end | |
| end | |
| function reset_palette() | |
| palette(0) | |
| end | |
| function palette(z) | |
| memcpy(0x5f00,0x5000+16*z,16) | |
| end | |
| function create_palettes() | |
| for z=0,7 do | |
| for i=0,15 do | |
| local col=sget(i,z+32) | |
| if i==12 then | |
| col=bor(0x80,i) | |
| end | |
| poke(0x5000+16*z+i,col) | |
| end | |
| end | |
| end | |
| -- originally by @casualeffects | |
| function ce_heap_sort(data,player) | |
| if (#data==0) return | |
| local n = #data | |
| local p_pos=player.pos | |
| for d in all(data) do | |
| local dx=(d.pos.x-p_pos.x)/10 | |
| local dy=(d.pos.y-p_pos.y)/10 | |
| d.key=dx*dx+dy*dy | |
| end | |
| -- form a max heap | |
| for i = flr(n / 2) + 1, 1, -1 do | |
| -- m is the index of the max child | |
| local parent, value, m = i, data[i], i + i | |
| local key = value.key | |
| while m <= n do | |
| -- find the max child | |
| if ((m < n) and (data[m + 1].key < data[m].key)) m += 1 | |
| local mval = data[m] | |
| if (key < mval.key) break | |
| data[parent] = mval | |
| parent = m | |
| m += m | |
| end | |
| data[parent] = value | |
| end | |
| -- read out the values, | |
| -- restoring the heap property | |
| -- after each step | |
| for i = n, 2, -1 do | |
| -- swap root with last | |
| local value = data[i] | |
| data[i], data[1] = data[1], value | |
| -- restore the heap | |
| local parent, terminate, m = 1, i - 1, 2 | |
| local key = value.key | |
| while m <= terminate do | |
| local mval = data[m] | |
| local mkey = mval.key | |
| if (m < terminate) and (data[m + 1].key < mkey) then | |
| m += 1 | |
| mval = data[m] | |
| mkey = mval.key | |
| end | |
| if (key < mkey) break | |
| data[parent] = mval | |
| parent = m | |
| m += m | |
| end | |
| data[parent] = value | |
| end | |
| end | |
| __gfx__ | |
| ddddddd5dddddddd5111511311b1153b442444342244422411111111111111111122211111122211112d3111111222115d5d515d5d5d5d5d111111111111111d | |
| dd5d6dddddd5ddd51311131b11311131544524444434445419a29a59a29a29a1411111442211511441d3b34422115114111111111111111115d15d15d15d15dd | |
| dddddddddddddddd1331111b11311111445224424442244414954944954954a12211142222211142221b3422222111425d6761111d67671515d15d15d15d15dd | |
| dddddddd6dddd6dd1b31511b511513114422134454421444144244244544249122211222222211222223b222222211225dddd155ddddd61515d15d15d15d15dd | |
| d5ddd5dddddddddd13b3111b1113135144444434524454431494494494494441252112225552112225213222525211225d5d51555d5d551515d15d15d15d15dd | |
| dddddddddd5ddd5d1b33131313311b114224544421244224144244244254244155111555555111125211152525211112111551111115115115d15d15d1dd15dd | |
| 5d6ddddddddddddd1b3b111331311b112122444422242124122222222222222111111111111111111111111111111111115111111111111115d15d15515d15dd | |
| dddd5ddd5ddddddd1b3315111111131122144124444252141424524254244241114422111442221111442211143d3311551155d66767155615515d15d15d15dd | |
| d5dddddddddd6d5d13b3111311531351444442244444444414444444444dd1411422221442222211142222144223b211551155555556155515d15d15d15d15dd | |
| ddddddd6dddddddd1b3135131511111124444444454224341222222222221121122225122222211112222512222b3111d51ddddddd5515d515d15d15d1dd155d | |
| ddddd5dddddddddd131b31b11111515112442444244114421111111111111111112551122222114411252112222231445d11ddddddd5115d15d15d15d15d15dd | |
| dd5dddddd5ddddd5151331b5311111312243442124422442122122122122122121111122525114222111112252511422d51111111d5511d515d15d15d15d15dd | |
| d6dddd6dddd5dddd1115133131511131244434124444442412424525524414415111112555111222511331252511122211111111511111111551551d5155155d | |
| dddddddddddddddd51111111111131b34424424444344444121144144145114111442112511411521143b11251141152555d6d6711555d55155155155155155d | |
| 5d5ddddd5ddddddd115311151131313b52124434224442241111211121121111142222111142211114223211114221115555d5d61155d6d5155155155155156d | |
| dddd5dddddd6d5d61113311111b1113b41225442212452221111111111111111122222111122221112222211112222111111111511111d6d11d11d11d11d11d6 | |
| 111111111111111d112d311111122211222222224524422211c111111ccd111155555551d55555551111111111111111dddddddddddddddd111111111111111d | |
| 15d15d15d15d15dd41d3b3442211511422224522442242521cc11111dcccd111dddddd51dddddddd19a29a59a29a29a1dddddddddddddddd155555555555555d | |
| 15d15d15d15d15dd221b3422222111422452442224222242ccdc1111ccdccccc76676651d676766614954222222454a1dddddddddddddddd155555d55555555d | |
| 15d15d15d15d15dd2223b222222211225452422222225222111ccccccdddcc1167667651d667676614422c1cc1c22491dddddddddddddddd15555d555555555d | |
| 15d15d15d15d15dd25213222525211224442424452255225111c1111c1111c11667676515676677614942c5cc5c2444166666666666666661555d555555d555d | |
| 15d15d15d1dd15dd5211152525211112445222244424442411ccd11dc1111c1167667651576676661442251551522441dddddddddddddddd155d555555d5555d | |
| 15d15d15515d15dd11111111111111114422222224244422ccddc11cc111cccc677676515676676712222c5cc5c222216666666666666666155555555d55555d | |
| 15515d15d15d15dd11442211143d33112425524224224222c11dcccccc11cc1c766776515666767614242c5cc5c242416666666666666666155555555555555d | |
| 15d15d15d15d15dd142222144223b2112224524424122221c1111c11dccccd1c776767515676666714441c5cc5c1d1417777777777777777155555555555555d | |
| 15d15d15d1dd155d12222512222b31112224424422224412c1111c111111c11c667667515667667612221c1cc1c1112166666666666666661555555555d5555d | |
| 15d15d15d15d15dd11252112222231441214422221214422cc11cc111111ccc1676677515676676611111111111111117777777777777777155555555d55555d | |
| 15d15d15d15d15dd211111225251142222244214411242241ccccccccd111ccc67767651576677671221221221221221777777777777777715555555d555555d | |
| 1551551d5155155d51133125251112224212211244122144cc1dcd1dccd1ccd16767765156767676124242142144144177777777777777771555555d5555555d | |
| 155155155155155d1143b1125114115242244221442242441c1c11111ccccd116666665156666666121142142145114177777777777777771555d5555555555d | |
| 155155155155156d1422321111422111121441122224412411cc11111dccd111d7dd75155dd6dd6d11112111211211117777777777777777155d55555555556d | |
| 11d11d11d11d11d61222221111222211211121111414111211c111111cc11111111111111111111111111111111111117777777777777777ddddddddddddddd6 | |
| 0123456789abcdefcccccccc00000000666d6ddd666d66d61242424214242421010010150010010066fff66f666fff6611294441111911110123456789abcdef | |
| 012325562493dde9cccccccc00000000dddddddddddddddd149494a219494942005000001005000555dd5555555dd5551124494141149111012325562493dde9 | |
| 2123255d2493d524cccccccc00000000111111111111111114a494a219494a421010010100000100005500000005500011244941411449112123255d2493d524 | |
| 0111215d2243d524cccccccc0000000000000000000000001494a4a21a494a420000100001100001101101111101101111224941491244910111215d2243d524 | |
| 0111111512211522cccccccc0000000001010100100010101494a492194a49420500050100001000101101111101101111224441441149410111111512211522 | |
| 0001111112211122cccccccc00000000111111111111111114949492194949420001000010510050101101111101101111122441249124990001111112211122 | |
| 000011111221112211cccccc00000000212212122121222114949142191949425100010100000001101101111101101111122441244112440000111112211122 | |
| 0000101111111111e1cccccc0000000052252155d212d2d214911142191119420001500050111000101101010101101191112241224912240000101111111111 | |
| 0000001100000000e11111cccccccccc55d5d515512155551491d142191d19421500001000000050101101010101101044111241124411240000001100000000 | |
| 0000000100000000ee1ee11ccccccccc5555155d5515555512915142191519420001000000100001001100000001100049111244124441220000000100000000 | |
| 0000000000000000e11111111ccccccc5d555d555dddd5d512911142192119421000150010010100d5115d555d5115d544411124112241220000000000000000 | |
| 0000000000000000eee11e1111cccccc555dd55ddddd5ddd12949442194449420150001005000005666666666666666624441111111221220000000000000000 | |
| 00000000000000001eee1ee1e1cccccc5d5ddddddddddddd12949442124449420000000001050001111111111111111122441111111111110000000000000000 | |
| 00000000000000001eee1ee1e11ccccc555dddd5555dd55512949492124949420101001000000100555555555555555522244144499111110000000000000000 | |
| 00000000000000001eeee1e1ee1ccccc5155d555d55551d512929292122929225050000050010010ff65d6656f6d55d612224124444911110000000000000000 | |
| 0123456789abcdef11eee1e1ee1ccccc111115151115111111424242112424210000501000100500f6d56f65d66d5d6f11224412444491110123456789abcdef | |
| 2555555251115115442444341111111111111111111111111111111111111111dd666dd6ddd666dd00000000000000001111111111111111ddddd555d5dddddd | |
| 5d5ddd5515b335515445244419a29a5111521141115211411d1d1dd115d115d155dd5555555dd55504409909904409901224941249912499dd5d6d5d5dd5ddd5 | |
| 5dddddd51333b33144522442149549411211142112113b211d6761d11565156100110000000110000990aa0490990aa01111111111111111ddddd5d5d5dddddd | |
| 5d6666d513baab31242213441442442112411221124132211dddd15115651561105501111105501100000000000000002444124444124441dd5ddddddd6dd6dd | |
| 556665d5133abab1444444421494494115211221152112211d5d515115d51561105501111105501100000000000000001111111111111111d5d5d5dddddddddd | |
| 5dd66dd513b33331422454421442442115215451152154511115511115d515d110550111110550110330a902209901101111112244412444dd5ddddddd5d5d5d | |
| 5dddddd51b3b3b512142444412222221151155111511551111511d6115d115d110550111110550110bb0a90440a90d1011111111111111115d65ddddd555d5dd | |
| 5555555511151511421441241111111111111111111111111111111111121112105501010105501100000000000000004441244441111112dd555ddd5d5d5ddd | |
| 0000000000000000000000000000000000000000000000000000000000000000105501010105501000000000000000001111111111111111d555d5ddd5d5dd5d | |
| 0000000000000000000000000000000000000000000000000000000000000000005500000005500004401109909909a012244412444124445d5d5ddddd555ddd | |
| 000000000000000000000000000000000000000000000000000000000000000055dd5555555dd5550990dd0a909a09a01111111111111111d5ddd56dddd555dd | |
| 00000000000000000000000000000000000000000000000000000000000000006d66d6d6d6d66d6d00000000000000004411111112444122dd5dddd6d5dd5dd5 | |
| 0000000000000000000000000000000000000000000000000000000000000000111111111111111100000000000000001111111111111111d6ddd56dddd5d5dd | |
| 0000000000000000000000000000000000000000000000000000000000000000555555555555555509904409902209902444412444412441dddd5d5ddddd5d5d | |
| 000000000000000000000000000000000000000000000000000000000000000066ddddddd6dddddd0aa0aa09a0440a9022222222222222225d5dd5dd5dddd5dd | |
| 00000000000000000000000000000000000000000000000000000000000000006dddd6ddddddddd600000000000000004444444444444444dddd5d5dddd6d5d6 | |
| cccc1111ccccccccccccc11111ccccccccccccc111ccccc155cccccccccccccccccc1111ccccccccccccc11111cccccccccccccccccccc511ccccc111ccccccc | |
| cccc155511cc111111c115f551ccccccccccccc15f55cc155fcccccccccccccccccc155511cc111111c1155551ccccccccccccccccccccf551cc55f51ccccccc | |
| cccc155ff5115555551555f51cccccccccccccc15ff5551559cccccccccccccccccc155555115555551555551ccccccccccccccccccccc9551555ff51ccccccc | |
| ccccc15ff9155555555519f51cccccccccccccc159ff5555555cccccccccccccccccc15555555555555551151cccccccccccccccccccc5555555ff951ccccccc | |
| ccccc15f99155555555551951cccccccccccccc1599555551155ccccccccccccccccc15111555555555551151ccccccccccccccccccc5511555559951ccccccc | |
| ccccc15011511115555511151cccccccccccccc155555551aa155cccccccccccccccc15111555555555555111cccccccccccccccccc551aa155555551ccccccc | |
| cccccc11151aaaa15551aaa1ccccccccccccccc115555551a0155ccccccccccccccccc111555555555555555ccccccccccccccccccc5510a155555511ccccccc | |
| cccccc11151aa0a15551a0a1ccccccccccccccc115555551a015555ccccccccccccccc111555555555555555ccccccccccccccccc555510a155555511ccccccc | |
| ccccccc1151aa0a15551a0a1ccccccccccccccc115555551aa155500ccccccccccccccc11555555555555555cccccccccccccccc005551aa155555511ccccccc | |
| ccccccc1151aaaa15551aaa15cccccccccccccc115555551aa155000ccccccccccccccc115555555555555555ccccccccccccccc000551aa155555511ccccccc | |
| ccccccc115511115115511155cccccccccccccc11555555511555050ccccccccccccc11115555555555555551ccccccccccccccc05055511555555511ccccccc | |
| ccccccc111555555005555555cccccccccccccc11155555555555055ccccccccccccccc1115555555555555111cccccccccccccc11055555555555111ccccccc | |
| ccccccc11100555000055505ccccccccccccccc11155555555550555ccccccccccccccc11155551111555511cccccccccccccccc11505555555555111ccccccc | |
| ccccccc11110000055000015ccccccccccccccc11115555555005515cccccccccccccc1111111111111111111ccccccccccccccc11150055555551111ccccccc | |
| cccccccc111111555555115ccccccccccccccccc111115555555511cccccccccccccc1cc111111111111111cccccccccccccccccc111155555551111cccccccc | |
| ccccccc111111111155555ccccccccccccccccc1111111111115ccccccccccccccccccc111111111111111cccccccccccccccccccccc11155511111ccccccccc | |
| ccccccc111111115555555ccccccccccccccccc1111111111155ccccccccccccccccccc111111115555551cccccccccccccccccccc111115555555cccccccccc | |
| cccccc11111555555555555ccccccccccccccc111115555555555ccccccccccccccccc11111555555555555cccccccccccccccccc11555555555555ccccccccc | |
| ccccc1111155555555555555ccccccccccccc11111555555555555ccccccccccccccc1111155555555555555cccccccccccccccc1155555555555555cccccccc | |
| ccccc11111555555555555555cccccccccccc111115555555555555cccccccccccccc11111555555555555555cccccccccccccc111555555555555555ccccccc | |
| ccccc111115555555555555555ccccccccccc111115555555555555cccccccccccccc111115555555555555555ccccccccccccc1115555555555555555cccccc | |
| cccc1111115555555555555555cccccccccc11111155555555555555cccccccccccc1111115555555555555555ccccccccccccc1115555555555555555cccccc | |
| cccc1111115555555555555555cccccccccc11111155555555555555cccccccccccc1111115555555555555555cccccccccccc11115555555555555555cccccc | |
| cccc1111115555555555555555cccccccccc111111555555555555555ccccccccccc1111115555555555555555cccccccccccc11115555555555555555cccccc | |
| cccc11111155555555555555555ccccccccc111111555555555555555ccccccccccc11111155555555555555555ccccccccc11111155555555555555555ccccc | |
| ccc111111115555555555555555cccccccc1111111555555555555555cccccccccc111111115555555555555555cccccccc111111155555555555555555ccccc | |
| ccc111111115555555555555555cccccccc1111111155555555555555cccccccccc111111115555555555555555cccccccc111111115555555555555555ccccc | |
| ccc111111115555555555555555cccccccc11111111555555555555555ccccccccc111111115511111155555555cccccccc111111115555555555555555ccccc | |
| ccc111111115555555555555555cccccccc11111111555555555555555ccccccccc111111111111111111115555cccccccc111111115555555555555555ccccc | |
| ccc111111111111115555555555cccccccc11111111111111555555555ccccccccc111111111111111111111555cccccccc111111111111115555555555ccccc | |
| ccc111111111111111111115555cccccccc111111111111111111115555cccccccc111111111111111111111155cccccccc111111111111111111115555ccccc | |
| ccc111111111111111111111155cccccccc111111111111111111111155cccccccc111111111111111111111115cccccccc111111111111111111111155ccccc | |
| 46464646464646463434343434343434000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46261616161616460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46261616661616460000003400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46261666066616460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46262636066616460034340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46161666661616460000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46161616161616460000000000000034340034340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 46464646464646463400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| __label__ | |
| 55552211212500000000000000000000000000000000000000000000011444442244444222222222222222222222222200000000000000000000000000000000 | |
| 55552211112500000000000000000070000000000000000000000000011444442244422222222222222222222222222200000000000000000070000000000000 | |
| 55777177712500000000000000000000000000070000000000000000011444442222222222222222222222222222222400000000000000000000000000000000 | |
| 55557171712500000000000000000000000000000000000000000000011444442222222222222222222222222222222400000000000000000000000000000000 | |
| 55577171712500000000000000000000000000000000000000000000011442222222222222222222222222222444222400000000000000000000000000000000 | |
| 55557171712500000000000000000000000000000000000007000000011222222222222222222222222224444444222400000000000000000000000000000000 | |
| 55777177712500000000000000000000000000000000000000000000011222222222222222222222242224444444222400000000000000000000000000000000 | |
| 55551111112100000000000000000000000000000000000000000000011222222222222222222254442224444444222400000000000000000000000000000011 | |
| 55551111111100070000000000000000000000000000000000000000011222222222222222222554442224444444222400000000000000000000000000111111 | |
| 55551111111100000000000000000000000000000000000000000000011222222222222244222554442224444444222400000000000000000000001111111111 | |
| 55577177717170000000007770000077707770777077700000000000011222222222222444222554442224444444222400000000000000000011111111111111 | |
| 55711171717170070000007070000070007070707700700000000000011222222255522444222554442224444444222400000000000000111111111111111111 | |
| 11711177717170000000007070000077707770707007700000000000011222224455522444222554442224444444222400000000111111111111111111111111 | |
| 11711171117170070000007070000000700070707000700000000000011224224455522444222554442224444444222400001111111111111111111222111111 | |
| 11177171111770000000007770070077700070777077700000000000011444224455522444222554442224444ddd111411111111111111111112222222111111 | |
| 111111111111000000000000000000000000000000000000000000000114442244555224442225544422244ddddd111411111111111111122222222222111111 | |
| 1111111111110000000000000000000000000000000000000000000001144422445552244422255444224ddddddd111411111111122222222222222222111111 | |
| 1111111211110000000000000000000000000000000700000000000001144422445552244422254444444ddddddd111411111111122222222222222222111111 | |
| 1111122211110000000000000000000000000070000000000000000001144422445552244424444444444ddddddd111111111111122222222221122111111111 | |
| 11aaa22aa11aa000000000000000000000000007000000000000000001144422445552244444444444444ddddd11111111111111122222211111111111111111 | |
| 11aaa2a211a1000a0000000000000000000000000000000000000000011444224444444444444444444411111111444411111111122111111111111111111111 | |
| 11a4a2aaa1a100000000000000000007000000000000000000000000011444224444444444444444445555111144442222111111111111111111111111111111 | |
| 11a4a222a1a1a00a0000000000000000000000000000000000000000011444444444444444442222555511111111222211441111111111111111111111111111 | |
| 11a4a2aa11aaa0000000000000000000000000000000000000000000011444444444441111111111111111444422222222441111111111111111111111114411 | |
| 11442222111100000000000000000000000000000000000000000000011444444444111111111111111111114444222244441111111111111111111111444444 | |
| 11442222111100000000000000000000000000000000000000000000011444111111112222111122221111111144442222441111111111111111111111444444 | |
| 11442222111100000000000000000000000000000000000000000000011411111111444422222222111111112222222244441111111111111111111111444444 | |
| 11422222111100000000000000000000000000000011100000000022225555111111112222222255551111111111112222441122211111111111111111444444 | |
| 44222222111100000000000000000000000000111111111000002222555555551111444422222222555511111111111114222222211111111111111111444444 | |
| 44222222111100000000000000000000111111111111114444222222222222111111114444222255551111221122111111222222211111111111111111444444 | |
| 11122222111100000000000000001111111111111111111111112222222211111111111122222211111122115511551112222222211111111111111111442222 | |
| 11111112111100000000000011111111111111111111111111111111111111111111111111111111112211221155551222222222211111111111111111222222 | |
| 11111111111110000000111111111111111111111111111122111111111111112211551111114411221122111111111222222222211111111111111111222222 | |
| 11111111111111111111111111111111122222111111111111221111114411221122111111111144111222221111111222222222211222211111111111222222 | |
| 11111111111111111000111111111112222222114422111111111111111122112211221111111222222222221111111122222222222222211111111111222222 | |
| 11111111111110000222111111111112225111114422211111111111114411221122111222222222222222221111111122222222222222211111111111222222 | |
| 11111111111101122222111111111111155111114422211111111111111122111222222222222222222211111111111122222222222222211111111111222222 | |
| 11111221111111122222111111222111155111114422211111111111111222222222222222222211111111111111111122222222222222211111111111222222 | |
| 22222221111111122222114442222111155111142421211111111111111222222222211111111111111111111111111122222222222222211111111111222222 | |
| 22222221111111122111144442222111151111442211111111111122111221111111111111111111111111111111111122222255222222211111111111222222 | |
| 22222221111141111111144442222121111111442211111111111122211111111111111111111111111111111111111122225555522222211111111111222222 | |
| 22222221144141111111142242222221111111442211111111112122211111111111111111111111111111111111111122225555522222211111111111222222 | |
| 22222211444141111111422222222221111111442211111111112211211111111111111111111111111111111111111122225555522222211111111111222222 | |
| 22222211444142211111422222222221111111422211111111112211111111111111111111111111111111111111111122225555522222211111111111225522 | |
| 22222211444122211111422222222222211111222211111111112211111111111111111111111111111111111111111122225555522222211111111111555555 | |
| 22222211444122211111422222222222211111222211111111111211111111111111111111111111111111111111111222225555522112211111111111555555 | |
| 22222211444122211111222222222222211111222211111111111111111111111111111111111111111122221111222222555555511111111111111111555555 | |
| 22222211444122221111222222222222211111222211111111111111111111111111111111222221112222221111222255555555511111111111111111555555 | |
| 22222211444122221111222222552252211111222211111111111111111112221122222111222221112222221111222255555555511111111111111111555555 | |
| 22222211422122221111222225555552211111222211111111111111111222221122222111222221112222221111222255555555511111111111111111555555 | |
| 22222114222225521111222225555552211111222211111111111111111222221122222111222221112222221111222255555555511111111111111111551155 | |
| 55251114222225521111222225555552211111212211111111111111111222221122222111222221112222221111222255555511511111111111111111111111 | |
| 55251114222225521111225525555551111111112211111111111111111222221122222111222221112222221111222255111111111111111111111111111111 | |
| 55251114222225521111555555555551111111112211111111111111111222221122222111222221112222221111222211111111111111111111111111111111 | |
| 55251114222255511111555555555551111111112211111111111111111222221122222111222221112222221111222211111111111111111111111111111111 | |
| 55251114222255511111555555555551111111111211111111111111111222221122222111222221112222221111222211111111111111111111111111111111 | |
| 55251114222255511111551155115511111111111111111111111111111222221122222111222221112244421111444411111111111111111111111111111111 | |
| 55251114222251111111111111111111111111111111111111111111111222441144455222555552224444441111444411111111111441144114211221112211 | |
| 55551112222511111111111111111111111111111111111111111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222511111111111111111111112221111111111111111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222511111422111111141142222222111111111221111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222511144422211111144442222222111111111222111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222511144422211111144442222222111111111222111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222511144422211111144442222222111111111222111111111222442244455222555552224444441111444411111111144444444444222222222222 | |
| 55511112222514444222211411424422222222111111122212111111111222442244455222555552224444441111444411111144144224422442222222222222 | |
| 55511112222514422222211444422222222222111111122111111111211222442244455222555552224444441111444411114444422222222222222222222222 | |
| 55114411552514422222211444422222222222111111122111111111211222112244455211455541124445541111444411114444422222222222222222222222 | |
| 55114411552112222222211244222222222222111111122111111111211222111144444111444441114445551111111411114444422222222222222222222222 | |
| 55114411552112222222511222222222222112111111111111111111111222111144444111444441114445551111111411114444422222222222222222222222 | |
| 55114411552112222222511222222222222111111111111111111111111222111144444111444441114445551111111411114444422222222222222222222222 | |
| 55114411552111122222511222222222222111111111111111111111111222111144444111444441114445551111111411114422422222222222222222225522 | |
| 55114411552111122555511222222222222111111111111111111111111222111144444111444441114445551111111411112222222222222222222222555555 | |
| 55114411552111125555111222222222221111144111111111111111111222111144444111444441114445551111111411112222222222222222222222555555 | |
| 55114411552111125555111222222222211111444411111111111111111222111144444111444441114445551111111411112222222222222222222222555555 | |
| 11142221511111125111111222222222211111444411111111111111111222111144444111444441114445551111111411112222222222222222222222555555 | |
| 11142221111121111111112222522251211111444411111111111111111111111144444111444441114445551111111411112222222222222222222222555555 | |
| 11142221111121111111122225522551211441422411111111111111111111111122211111144421114445551111111411112211222222255225522222555555 | |
| 11142221111121111111122225522551111444222211111111111111111111111122211111111221111112221111111111111111122222255555522552551155 | |
| 11142221111151111111122525522551111444222211111111111111111111111122211111111221111112221111111111111111122222255555555555111111 | |
| 11142221111151111111122525552511111444222211111111111111111111111122211111111221111112221111111111111111122222255555555555111111 | |
| 11142221111151111111122555555111111224222211111111111111111111111122211111111221111112221111111111111111122222255555555555111111 | |
| 11142221111151111422122555555111111222222211111111111111111111111122211111111221111112221111111111221111122222255555555555111111 | |
| 11122221111111144422121255555111111222222211111111111111111111111122211111111221111112221111111122221111122112211555555555111111 | |
| 11122222111111144422111255515114111222222211111121111111111111111122211111111221111112221111111122221111111111111551155115111111 | |
| 11122222111114444422111225511114111112252211111122111111111111111122211111111221111112221111111122221111111111111111111115111111 | |
| 11122222111114444222111225511114411111552211111222111111111111111111111111111221111112221111111122221111111111111111111111111111 | |
| 11122222111114422222111125111114411111552211111222111111111111111111111111111111111112221111111122221111111111111111111111111111 | |
| 11122222111114422222211111111142411111552211111212111111111111111111111111111111111111121111111122551111111111111111111111111111 | |
| 11122222111112222222211111111442412111552211122211111111111111111111111111111111111111111111111155551111111111111111111111111111 | |
| 11122222111112222222211111111442222111511211122111111111111111111111111111111111111111111111111155551111111111111111111111111111 | |
| 11111112111112222222211111111442222111111111122111111111111111111111111111111111111111111111111155551111111111111111111111111111 | |
| 11111111111111122222211111111422222111111111122111111111111111111111111111111111111111111111111155551111111111111111111111111111 | |
| 111111111111111221112111111112222222211111111111111111111111aaaa1111111111111111111111111111111155551111111111111111111111111111 | |
| 11111111111111111111211111111222222221111111111111111111119999444444441111111111111111111111111155111111111111111111111111111111 | |
| 11111111111111111111111111111222222222111111111111111111aaaa44444444444422221111111111111111111111111111111441111111111111111111 | |
| 11111111113111bbbb11111111111111112222111111111111111199999999444444442222222244441111111111111111111111144441144111111111111111 | |
| 31511111111111113333555511111111222255551111111111112222555544449999444444444444222211111111111111111111144444444114211221111111 | |
| 11111111111111111133331111555511111111111111111111aaaa99992222444444442222444422221111222255551111111111144444444444222221111111 | |
| 11113333333311111111111111113333bbbbbbbbbbbb111199994444444444442222222255554444111111115555444411111111144444444444222222111111 | |
| 11333311115555111155551111111111113333bbbbbbbb1111111144449999444422224444444422221111111122221111111111144444444444222222111111 | |
| 33331111555511111111111111113333111133333333111111111111444444442222222244442222111122225555111111111144144444444444222222111111 | |
| 11111111115555111111111111333333331111555533331111111111111111222244444444222211112222444444441111114444144224422444222222111111 | |
| 11111111555511111111555511111111111155551111111111111111111111111111444422221111111122224444222211114444422222222442222222111111 | |
| 11333311111111111155551111111111111111111111113333555511111111111111112222111111112222222211112222114444422222222222222222111111 | |
| 33331111333333331111111133331111111111111111333333331111111111111111111111111111222244441111111111114444422222222222222222112211 | |
| 11111155553333111111111111bbbbbbbb1111111111111111bbbbbbbb1111111111111111111122222222111111111111114444422222222222222222222222 | |
| bbbb555511111111111111111111bbbb33331111555511111111bbbbbbbb11115555111111111111111122222222111111114422422222222222222222222222 | |
| 11bbbb11111111111111111111111133333333555533331111111111113333333311115555111111111111111111111111112222422222222222222222222222 | |
| bbbb3333111155551111111111111111111111111111111111111111111133331111111155551111111111111111111111112222222222222222222222222222 | |
| 11333311111111111133331111111111111111111111111111111111111111111111115555333333333333333311111111112222222222222222222222222222 | |
| 3333111111111111333333331111111111111111111133331111111133331111111111111111333333333333bbbb111111112222222222222222222222222222 | |
| 1111111111111111113333bbbb11115555111111113333333311111111333311115555111111113333bbbb3333bbbbbbbb111122222222222222222222222222 | |
| 11111111111111111111bbbbbbbb55551111111133331111111111113333111155555555111111111111bbbb3333bbbbbbbb1111222222222222222222222222 | |
| 1111111111111111111111bbbbbbbb11111111111111111111111155551111111111111111111111111111333333333333bbbb11112222222222222222222222 | |
| 111111111111333311111111bbbbbbbbbbbb11113333111111115555111111111111111111111111111111111111333333331111111111112222222222222222 | |
| 11333355553333333311111111bbbbbbbb3333333333331111111111111111111111111111111133333333111111113333333333331111111122222222222222 | |
| 3333555511113333111111111111bbbb333333333333111111111111555511111111111111111111333333331111111155553333333311111111111122222222 | |
| 11555511111111111111111111111111113333333311111111111155551111111111115555111111113333333311115555111133331111111111111111555522 | |
| 11111111111111111111111111111111111133331111111111111111555511111111111155551111111111111111111155551111111111111111111111111111 | |
| 11111111111111555511111111111111111111111111113333111111111111111111115555111111111111111111111111111111111111111111115555111111 | |
| 11111111111155555555111133331111111111111111333333331111111111111111111155551111333311111111111111111111111111113333555555551111 | |
| 11111111115555555511113333333311111111111133333333333311111111333311111111111133333333111111111111111111111111333333335555111111 | |
| 111111111111555511111111333311111111111111113333333311111111333333331111111111113333bbbb1111111111111111111111113333333333331111 | |
| 11111111111111111111111111111111115555111111113333333311113333333333331111111111113333bbbbbbbb1111111111111111111133333333bbbb11 | |
| 333311111111333311111111111111115555111111111111111111115555333333333333111111111111bbbbbbbbbbbb1111111111111111111111113333bbbb | |
| 11333311113333333311111111111155555555111111111111bbbb11115555111133331111111111111111bbbbbbbbbbbb111111111111111111111111bbbbbb | |
| 333333333333333333331111111111115555111155551111bbbbbbbb555555551111111111111111111111111111bbbb3333333311115555555511111111bbbb | |
| 113333bbbb333333333333111111111111111111115555bbbbbbbbbbbb5555111111111111111111111111111111113333333333331111555555551111111111 | |
| __map__ | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c2 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment