home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ozsi 10
/
Ozsi_10_1998_Tide_Side_B.d64
/
stoned.tri.._rtn
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
81 lines
0 rem"[141][147][146]tomz/tide/the dark realm
1 [143]"sys
2 print"[147]":poke53280,0:poke53281,0
10 dimx(48),y(48),s(3),t(3),u(12),v(12),xt(48),yt(48)
20 for k=1 to 3
30 readx(k),y(k)
40 nextk
50 data150,50,250,150,50,150
60 gosub500:rem hi-res screen
70 for n=0 to 1
80 for k=1 to4^n
90 gosub4000:rem sub divide triangles
100 next k
110 for k=1 to 4^(n+1)*3
120 x(k)=xt(k): y(k)=yt(k)
130 next k
140 next n
150 for k=1 to 16
160 for j=1 to 3
170 s(j)=x(j+3*(k-1)):t(j)=y(j+3*(k-1))
180 next j
190 gosub3000:rem plot each triangle
200 next k
210 end
500 poke53272,peek(53272) or 8
510 poke53265,peek(53265) or 32
520 for i=8192 to 16192:poke i,o:next i
530 for i=1024 to 2023:poke i,22:next i
540 return
1000 ro=int(r/8):co=int(c/8)
1010 l=r and 7
1020 bit=7-(c and 7)
1030 byte=8192+ro*320+co*8+l
1040 poke byte,peek(byte) or 2^bit
1050 return
2000 dx=x2-x1:dy=y2-y1
2010 if dx=0 then 2070
2020 for c=x1 to x2 step sgn(dx)
2030 r=int(y1+(c-x1)*dy/dx)
2040 gosub1000:rem plot point
2050 next c
2060 return
2070 c=x1
2080 for r=y1 to y2 step sgn(dy)
2090 gosub1000:rem plot point
2100 next r
2110 return
3000 x1=s(3):y1=t(3)
3010 for p=1 to 3
3020 x2=s(p):y2=t(p)
3030 gosub2000:rem draw line
3040 x1=x2:y1=y2
3050 next p
3060 return
4000 for m=1 to 3
4010 s(m)=x(m+3*(k-1)):t(m)=y(m+3*(k-1))
4020 next m
4030 gosub5000:rem sub-divide this triangle
4040 for m=1 to 12
4050 xt(m+12*(k-1))=u(m):yt(m+12*(k-1))=v(m)
4060 next m
4070 return
5000 a1=(s(1)-s(2))*0.2*(rnd(0)-0.5)
5010 b1=(s(1)-s(3))*0.2*(rnd(0)-0.5)
5020 c1=(s(2)-s(3))*0.2*(rnd(0)-0.5)
5030 a=0.5*(s(1)+s(2))+a1
5040 d=0.5*(t(1)+t(2))+a1
5050 b=0.5*(s(1)+s(3))+b1
5060 e=0.5*(t(1)+t(3))+b1
5070 c=0.5*(s(2)+s(3))+c1
5080 f=0.5*(t(2)+t(3))+c1
5090 u(1)=s(1):u(4)=s(2):u(7)=s(3)
5100 v(1)=t(1):v(4)=t(2):v(7)=t(3)
5110 u(2)=a:u(6)=a:u(12)=a
5120 v(2)=d:v(6)=d:v(12)=d
5130 u(3)=b:u(8)=b:u(11)=b
5140 v(3)=e:v(8)=e:v(11)=e
5150 u(5)=c:u(9)=c:u(10)=c
5160 v(5)=f:v(9)=f:v(10)=f
5170 return