SET TEXT FONT "Zurich extended BT"
SET TEXT SIZE 15
 
print "trees? (y/n)"
do
S$=inkey$()
if S$="y" then mt=1:exit
if S$="n" then mt=2:exit
loop
wait 500
cls
print "rain(long load time for slow cpu's)? (y/n)"
do
S$=inkey$()
if S$="y" then mr=1:exit
if S$="n" then mr=2:exit
loop
wait 500
cls
print "settings confirmed!!!"`for kicks and giggles
wait 300
cls
 
center text screen width()/2,screen height()/2,"loading..."
`main
randomize timer()
for x=1 to 10
  for y=1 to 10
      dot x,y,rgb(0,41,100)
      dot rnd(10),rnd(10),rgb(0,39,55)
  next y
next x
get image 1,1,1,9,9
cls
x=0
y=0
for x=1 to 10
  for y=1 to 10
      dot x,y,rgb(30,110,0)
      dot rnd(10),rnd(10),rgb(29,105,0)
  next y
next x
get image 2,1,1,9,9
cls
x=0
y=0
for x=1 to 400
  for y=1 to 400
      dot x,y,rgb(0,0,200)
      dot rnd(1000),rnd(1000),rgb(205,205,205)
if y>96 AND y<100
dot x,y,rgb(200-(y/2),205,205)
endif
  next y
      dot x,y,rgb(0,0,200)
  next x
get image 3,1,1,199,199
cls
x=0
y=0
for x=1 to 10
  for y=1 to 10
    dot x,y,rgb(139,101,8)
  next y
next x
get image 4,1,1,9,9
cls
x=0
y=0
for x=1 to 10
  for y=1 to 10
      dot x,y,rgb(10,100,0)
      dot rnd(10),rnd(10),rgb(20,70,0)
  next y
next x
get image 5,1,1,9,9
cls
`terrain
make matrix 1,1000,1000,130,130
prepare matrix texture 1,2,3,3
for cliff=1 to 10
   repeat
   xb=rnd(129)+1
   zb=rnd(129)+1
   xe=rnd(129)+1
   ze=rnd(129)+1
   until xb<>xe and zb<>ze
   elevation=rnd(9)+1
   xs=(xe-xb)/abs(xe-xb)
   zs=(ze-zb)/abs(ze-zb)
   for x=xb to xe step xs
      for z=zb to ze step zs
         set matrix height 1,x,z,get matrix height(1,x,z)+elevation
      next z
   next x
next cliff
update matrix 1
position matrix 1,-500,3,-500
prepare matrix texture 1,2,3,3
update matrix 1
`sky
make object sphere 1000,4000
set object cull 1000,0
texture object 1000,3
`water
make matrix 2,4000,4000,100,100
prepare matrix texture 2,1,1,1
position matrix 2,-2000,0,-2000
SET MATRIX TRIM 2,10,10
`trees
if mt=1
   for begin=1 to 20
       make_tree(rnd(7)+10,begin)
   next begin
endif
`rain
if mr=1
   make_rain()
endif
`dock
make_dock()
position object 10000,350,5,580
position object 10001,290,5,690
`camera
make camera 1
position camera 1,0,50,0
color backdrop 1,rgb(0,20,240)
`light
make light 2
position light 2,50,1400,50
point light 2,0,0,0
disable escapekey
do
   if mr=1
      for begin=1 to 10000
         move object down begin+50000,10
         if object position y(begin+50000)<0
            position object begin+50000,rnd(4000)-2000,rnd(2000)+2000,rnd(4000)-2000
         endif
      next begin
      if lightturn=1
         set ambient light 50
      endif
      if cho=0
         lightturn=1
      endif
         cho=rnd(20)
      if cho=0
         set ambient light 400
      endif
   endif
 
 
 
for x=0 to 100
   for z=0 to 100
      h1#=sin((x*100.0+time*3))*2.0
      h2#=sin((z*76.0+time*3))*2.0
      if h1#>h2#
         height#=h1#
      else
         height#=h2#
      endif
      set matrix height 2,x,z,height#
   next z
next x
update matrix 2
inc time
   yrotate object 1000,object angle y(1000)+0.0999
 
   move camera 1,3
   x#=camera angle x(1)
   yrotate camera 1,camera angle y(1)+mousemovex()/2.0
   xrotate camera 1,x#+mousemovey()/2.0
 
   if escapekey()
do
S$=inkey$()
cls
center text screen width()/2,10,"By: Digital Dude RELOADED for Programming Challenge"
center text screen width()/2,22,"Hold any key to Continue!"
wait 100
cls
if S$<>"" then end
loop
wait key
end
endif
 
 
   set cursor 10,10
   print screen fps()
      `fastsync
   loop
 
function make_tree(size,num)
make object box 500+num,size,size*2,size
make object box 500+num+1,size-1,size*2-2,size-1
make mesh from object 1,500+num+1
delete object 500+num+1
add limb 500+num,1,1:SET LIMB SMOOTHING 500+num,1,10:offset limb 500+num,1,0,size*2-3,0:rotate limb 500+num,1,0,10,0
tx=rnd(900)-450
tz=rnd(900)-450
position object 500+num,tx,get ground height (1,tx,tz)+size,tz:rotate object 500+num,rnd(10)-5,rnd(360),0
texture object 500+num,4
texture limb 500+num,1,4
make object plain 2500+num,18,6*size
make mesh from object 10,2500+num
delete object 2500+num
for begin=1 to 40
   add limb 500+num,begin+1,10:offset limb 500+num,begin+1,-0.6,(size*2)+(size*2)-16.7,-0.6:rotate limb 500+num,begin+1,(rnd(80)-40)+90,rnd(360),0
   texture limb 500+num,begin+1,5
next begin
endfunction
 
function make_dock()
make object box 10000,4,20,4
make mesh from object 5,10000
delete object 10000
make object box 10000,50,2,170
add limb 10000,1,5:offset limb 10000,1,25,0,-85:texture limb 10000,1,4
add limb 10000,2,5:offset limb 10000,2,-25,0,85:texture limb 10000,2,4
add limb 10000,3,5:offset limb 10000,3,-25,0,-85:texture limb 10000,3,4
add limb 10000,4,5:offset limb 10000,4,25,0,85:texture limb 10000,4,4
texture object 10000,4
make object box 10001,4,20,4
make mesh from object 5,10001
delete object 10001
make object box 10001,50,2,170
add limb 10001,1,5:offset limb 10001,1,25,0,-85:texture limb 10001,1,4
add limb 10001,2,5:offset limb 10001,2,-25,0,85:texture limb 10001,2,4
add limb 10001,3,5:offset limb 10001,3,-25,0,-85:texture limb 10001,3,4
add limb 10001,4,5:offset limb 10001,4,25,0,85:texture limb 10001,4,4
texture object 10001,4
yrotate object 10001,90
endfunction
 
function make_rain()
for begin=1 to 10000
make object box begin+50000,1,2,1
position object begin+50000,rnd(4000)-2000,rnd(2000)+2000,rnd(4000)-2000
set alpha mapping on begin+50000,30
next begin
endfunction