' ========================================================================== ' RAY CASTER 3D sorta ENGINE thingymajig by Peter Cooper ' ========================================================================== '---------------------------------------- 'Translated and messed up by Erlend Rovik ' 'If Anyone Gets it to work I would appreciate 'if you mailed it to me, just so I could figure out 'where I went wrong :-) ' 'erlend@rovik.com 'e-rovik@online.no '---------------------------------------- $TYPECHECK ON declare sub key(key as byte) DIM st%(0 TO 360) as integer DIM ct%(0 TO 360) as integer DIM a$(1 TO 10) as string dim sa% as integer,tmp1% as integer,px% as integer,py% as integer,t% as integer dim xb as integer,yb as integer,bx as integer,by as integer,l% as integer,k% as integer dim x% as integer,dd% as integer px% = 15: py% = 15: sa% = 0 a$(1) = "1919191919" a$(2) = "9000000001" a$(3) = "1000000409" a$(4) = "9010005001" a$(5) = "1020040009" a$(6) = "9030000001" a$(7) = "1000078009" a$(8) = "9050087001" a$(9) = "1060000009" a$(10) = "9191919191" ' Peters boring _yawn_ table creation FOR tmp1% = 0 TO 360 st%(tmp1%) = SIN(tmp1% * .0174) * 100 ' IF tmp1% MOD 100 = 0 THEN:PRINT ; "."; NEXT tmp1% FOR tmp1% = 0 TO 360 ct%(tmp1%) = COS(tmp1% * .0174) * 100 'IF tmp1% MOD 100 = 0 THEN PRINT ; "."; NEXT tmp1% Create form as qform create can as qcanvas width=form.clientwidth:height=form.clientheight end create onkeypress=key showmodal end create sub key(key as byte) IF chr$(key)="x" THEN:sa% = sa% + 3:end if IF chr$(key)="z" THEN:sa% = (sa% + 357) MOD 360:end if IF chr$(key)=" " THEN px% = px% + (st%(t% MOD 360) / 50) py% = py% + (ct%(t% MOD 360) / 50) END IF FOR t% = sa% TO sa% + 59 STEP 1 xb=st%(t% MOD 360) / 100 'get inc yb=ct%(t% MOD 360) / 100 'get inc bx=px% 'decimal copy by=py% 'decimal copy l%=0 'reset length DO bx=bx+xb:by=by+yb:l%=l%+1 k%=asc(MID$(a$(int(by/10)),int(bx/10),1))-48 LOOP UNTIL k% <> 0 x%=(t%-sa%)*5 dd%=(1000/l%) can.fillrect x%,1,x%+5,99-dd%,15000 can.fillrect x%,101+dd%,x%+5,200,2*10000 can.fillrect x%,100-dd%,x%+5,100+dd%,k%*10000 can.LINE x%,100-dd%,x%+5,100-dd%,0 can.LINE x%,100+dd%,x%+5,100+dd%,0 'problem lies here NEXT t% end sub