'
'Coded By Shockwave C) 2002.
'#########################################################
gosub initialise
s=1
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
repeat
    mm=mm+.05
    size=15+2*sin(mm)
    setdrawbuf dw
    dw=1-dw
    setdispbuf dw
rr=0
gg=0
bb=0
for yy=0 to 512 step 80
rr=rr+8
bb=bb+15
gg=0+(yy/10)
for xx=0 to 640 step 80
  gg=gg+10
  setrgb 1,rr,gg,bb
  fill rect xx,yy to xx+80,yy+80
next xx
next yy
setrgb 1,0,0,0
for yy=0 to 512 step 80
 line 0,yy to 640,yy
next yy

for xx=0 to 640 step 80
line xx,0 to xx,512
next xx

for s=5 to 1 step-1
 for a=1 to points
  tx(a,s)=tx(a,s-1)
  ty(a,s)=ty(a,s-1)
 next a
next s
    gosub rotate
q=10
for s=5 to 1 step-1
    gosub construct
next s
gosub logo1
gosub scroll
gosub logo2
 xr=xr+3+3*sin(mm)
 yr=yr+2
 zr=zr+3
if xr>720 xr=xr-720
if yr>720 yr=yr-720
if zr>720 zr=zr-720

until (and(peek("port1"),16384)<>0)
exit

'                        Scroller;
'---------------------------------------------------------
label scroll
yp=100*sin(mm/3)
setrgb 1,255,255,255 : text scx,256+yp,mid$(s$,p,67)
setrgb 1,0,0,0 : text scx+1,257+yp,mid$(s$,p,67)
scx=scx-2
if scx<-10 then:rem               RESET POS ADD NEW LETTER
scx=scx+10 : p=p+1
if p>len(s$) p=0
fi
return
'                     Logo Back Letters;
'---------------------------------------------------------
label logo1
setrgb 1,50,0,100
's
   fill rect 10,210 to 70,220
   fill rect 10,290 to 70,280
   fill rect 10,245 to 70,255
   fill rect 10,210 to 20,255
   fill rect 70,255 to 60,290
   fill rect 70,245 to 50,290
'o
   fill rect 150,210 to 210,220
   fill rect 150,290 to 210,280
   fill rect 150,210 to 160,290
   fill rect 210,210 to 200,290
   fill rect 150,245 to 170,290
'k
   fill rect 290,210 to 300,290
   fill rect 290,245 to 350,255
   fill rect 350,245 to 330,290
   fill rect 320,210 to 330,245
'a
   fill rect 430,210 to 440,290
   fill rect 490,210 to 480,290
   fill rect 430,210 to 490,220
   fill rect 430,245 to 490,255
   fill rect 430,245 to 450,290
'e
   fill rect 570,210 to 580,290
   fill rect 570,210 to 630,220
   fill rect 570,280 to 630,290
   fill rect 570,245 to 610,255
   fill rect 570,245 to 590,290 
return
'                    Logo Front Letters;
'---------------------------------------------------------
label logo2
setrgb 1,0,100,50
'h
   fill rect 80,210 to 90,290
   fill rect 140,210 to 130,290
   fill rect 140,245 to 80,255
   fill rect 80,245 to 100,290
'c
   fill rect 220,210 to 280,220
   fill rect 220,290 to 280,280
   fill rect 220,210 to 230,290
   fill rect 220,245 to 240,290
'w
   fill rect 360,210 to 370,290
   fill rect 360,245 to 380,290
   fill rect 360,290 to 420,280
   fill rect 420,290 to 410,210
   fill rect 390,290 to 400,245
'v
   fill rect 500,210 to 510,290
   fill rect 510,245 to 520,290
   fill rect 560,210 to 550,245
   fill rect 500,280 to 545,290
   fill triangle 545,290 to 540,280 to 550,245
   fill triangle 560,245 to 550,245 to 545,290
   rect 5,204 to 635,296
return


'---------------------------------------------------------
'                     Draw The Object;
'---------------------------------------------------------
label construct
q=q-1.3
for a=1 to faces
gosub draw
next a
return
'---------------------------------------------------------
'              Draw A Face Of The Object;
'---------------------------------------------------------

label draw
  vx1= tx(f1(a),s)-tx(f2(a),s)
  vy1= ty(f1(a),s)-ty(f2(a),s)
  vx2= tx(f3(a),s)-tx(f2(a),s)
  vy2= ty(f3(a),s)-ty(f2(a),s)
  n=  vx1*vy2-vx2*vy1
 if n<0 then
 n=-((n/300)/q)
 setrgb 1,r(a)+n,g(a)+n,b(a)+n
 fill triangle tx(f1(a),s),ty(f1(a),s) to tx(f2(a),s),ty(f2(a),s) to tx(f3(a),s),ty(f3(a),s)
 fill triangle tx(f1(a),s),ty(f1(a),s) to tx(f4(a),s),ty(f4(a),s) to tx(f3(a),s),ty(f3(a),s)
 if cls(a)=1 then
   setrgb 1,0,0,0
   line tx(f1(a),s),ty(f1(a),s) to tx(f2(a),s),ty(f2(a),s)
   line tx(f2(a),s),ty(f2(a),s) to tx(f3(a),s),ty(f3(a),s)
   line tx(f3(a),s),ty(f3(a),s) to tx(f4(a),s),ty(f4(a),s)
   line tx(f4(a),s),ty(f4(a),s) to tx(f1(a),s),ty(f1(a),s)
 fi
fi
return


label rotate
'###############################################
'## Rotate And Scale Each Point! Store Result ##
'###############################################
xo=5*sin(mm/2)
 for a=1 to points
  x1=x(a)+xo
  y1=y(a)
  z1=z(a)
'######################
'## X,Y,Z rotations! ##
'######################
  xx=x1
  yy=y1*cs(xr)+z1*sn(xr)
  zz=z1*cs(xr)-y1*sn(xr)
  y1=yy
  x1=xx*cs(yr)-zz*sn(yr)
  z1=xx*sn(yr)+zz*cs(yr)
  zz=z1
  xx=x1*cs(zr)-y1*sn(zr)
  yy=x1*sn(zr)+y1*cs(zr)
'########################
'## Apply Perspective! ##
'########################
dv=(zz/40)+1
  xx=size*(xx/dv)+320
  yy=size*(yy/dv)+256
  tx(a,1)=xx
  ty(a,1)=yy
  tz(a,1)=zz
 next a
return
label initialise
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
' This Sub-Routine Initialises The Program.
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'######################
'## Open Gfx Screen! ##
'######################
open window 640,512
'---------------------------------------------------------
'            Define the necessary variables;
'---------------------------------------------------------
'                   Scroller Definition;
'---------------------------------------------------------
s$="                                                      "
s$=s$+"Welcome to the Blurred demo....   I got the idea "
s$=s$+"for this from parabellum's cube demo and this is "
s$=s$+"purely a less optimised version of his cube idea "
s$=s$+"with a few cheap and tacky effects thrown in for "
s$=s$+"the hell of it....  Not particularly original but "
s$=s$+"it was quick to code and good fun :o) which is "
s$=s$+"what it's all about at the end of the day...    "
s$=s$+"I'd also like to say that this demo blatently rips"
s$=s$+" the guts out of my retro style demo for this "
s$=s$+"scroll routine (how lazy can u get) and reuses the"
s$=s$+" shockwave logo because I couldn't be bothered to "
s$=s$+"draw another one.  Never mind...    It gives me "
s$=s$+"something to do while f*****g lame Ezboard sort "
s$=s$+"out thier downed server...   The following is a "
s$=s$+"shortened list of greets (sorry if you've been "
s$=s$+"left out) "
s$=s$+"    JIM, PARABELLUM, XALTHORN, DEMONEYE, DOCTOR, "
s$=s$+"JO, SNAKEDOGG, TRICKY, FRYER, KYATA, CK0, TAPPI, "
s$=s$+"JINX, ZINGY, PYRO, LOOPY, JACOB, AZ..."


scx=0:p=0

s=10
size=16: rem                       how big do you want it?
dw=1 : Rem                       Double buffering Variable
points=8 : Rem          The amount of points in the object
faces=6 : Rem            The Amount of faces in the object
dim x(points): Rem            Original X co-ordinate store
dim y(points): Rem            Original Y co-ordinate store
dim z(points): Rem            Original Z co-ordinate store
dim tx(points,s): Rem     Transformed  X co-ordinate store
dim ty(points,s): Rem     Transformed Y co-ordinate store
dim tz(points,s): Rem     Transformed Z co-ordinate store
dim f1(faces):rem                   Connections definition
dim f2(faces):rem                   Connections definition
dim f3(faces):rem                   Connections definition
dim f4(faces):rem                   Connections definition
dim r(faces):rem                             Red Component
dim g(faces):rem                           Green Component
dim b(faces):rem                            Blue Component
dim cls(faces):rem                        Cell Shade Face?
'---------------------------------------------------------
'   Define Sine Tables for faster matrix calculations;
'---------------------------------------------------------
 dim cs(1440)
 dim sn(1440)
 for ang=0 to 1440
  cs(ang)=cos(ang*(pi/360))
  sn(ang)=sin(ang*(pi/360))
 next ang
'---------------------------------------------------------
'               Read in the object's points;
'---------------------------------------------------------
for a=1 to points
 read x(a),y(a),z(a)
next a
'---------------------------------------------------------
'         Read In Connections and face parameters;
'---------------------------------------------------------
for a=1 to faces
read f1(a)
read f2(a)
read f3(a)
read f4(a)
read r(a),g(a),b(a),cls(a)
next a
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'   The Object Description As Data!
'   The Data Below Describes A Cube.
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data -10,10,10,10,10,10,10,-10,10,-10,-10,10
data -10,10,-10,10,10,-10,10,-10,-10,-10,-10,-10
data 1,2,3,4,30,30,0,1
data 5,8,7,6,30,0,30,1
data 6,2,1,5,0,30,30,1
data 8,4,3,7,0,30,0,1
data 2,6,7,3,0,0,30,1
data 8,5,1,4,30,0,0,1
return



