`=============================
`======Alex's Deathmatch======
`=============================
 
 
 
autocam off
sync on
sync rate 40
hide mouse
set camera range 1,200000
cls
gosub matrixsetup
gosub spheresetup
gosub cutscene
do
gosub movement
sync
loop
 
 
 
movement:
ocpx#=camera position x()
ocpz#=camera position z()
position mouse 320,240
cx#=wrapvalue(cx#+mousemovey())
cy#=wrapvalue(cy#+mousemovex())
cz#=wrapvalue(cz#+mousemovez())
set cursor 0,0
print cx#
rotate camera cx#,cy#,cz#
if cx#<270 and cx#>240 then cx#=270
if cx#>90 and cx#<120 then cx#=90
if upkey()=1 then move camera 5
if downkey()=1 then move camera -5
position camera camera position x(),get ground height(1,camera position x(),camera position z())+10,camera position z()
if camera position x()<70 then position camera ocpx#,10,camera position z()
if camera position z()<70 then position camera camera position x(),10,ocpz#
if camera position x()>1440 then position camera ocpx#,10,camera position z()
if camera position z()>1440 then position camera camera position x(),10,ocpz#
return
 
 
 
cutscene:
for t=1500 to 0 step -10
position camera 0,580,t
point camera 750,0,750
wait 1
next t
ch#=250
 
for t=1500 to 0 step -10
position camera t,ch#,0
inc ch#,1
point camera 750,0,750
wait 1
next t
 
for t=100 to 1300 step 10
position camera t,170,t+125
point camera 750,250,750
wait 1
next t
position camera 75,get ground height(1,55,55)+10,75
return
 
 
 
 
 
 
spheresetup:
make object sphere 1,100000
set object 1,1,1,0
ink rgb(0,0,0),0
box 0,0,500,400
ink rgb(255,255,255),0
for t=0 to 500
a=rnd(500) : b=rnd(400)
box a,b,a,b
next t
get image 2,0,0,500,400
texture object 1,2
return
 
 
 
matrixsetup:
make matrix 1,1500,1500,30,30
   for x = 0 to 30
      for z = 0 to 30
         read height
         set matrix height 1,x,z,height * 30
      next z
   next x
   update matrix 1
 
   data  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 7
   data  7, 0, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
   data  7, 0, 0,-3,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
 
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
   data  7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7
 
   data  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
 
fill_box(0,0,128,128,0)
get image 1,0,0,128,128
prepare matrix texture 1,1,1,1
set mipmap mode 2
make matrix 2,1500,1500,30,30
position matrix 2,0,-20,0
ink rgb(255,0,0),0
box 0,0,100,100
get image 3,0,0,100,100
prepare matrix texture 2,3,1,1
ghost matrix on 2
return
 
 
 
 
function fill_box(sx,sy,ex,ey,shade)
   ink rgb(shade,shade,shade+20),0
   box sx,sy,ex,ey
   if sx < 128 then fill_box(sx+4,sy+3,ex-4,ey-3,shade+5)
endfunction