Rem Project: Arbre
Rem Created: 23/08/2005 22:22:57
 
Rem ***** Main Source File *****
 
create bitmap 1,384,64
 
set current bitmap 1
 
image=0
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 30+yorigine step 2
  variable=rnd(7)
  ink rgb(10+(variable*21),25+(variable*12),1+int((variable/3))),0
  dot x,y
 next y
next x
 
yorigine=1
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 30+yorigine step 2
  xg=x-1
  yh=y-1
  xd=x+1
  yb=y+1
  if xg<64*image then xg=63+(64*image)
  if yh<0 then yh=31
  if xd>63+64*image then xd=64*image
  if yb>31 then yb=0
  pixgr=rgbr(point(xg,y))
  pixgg=rgbg(point(xg,y))
  pixgb=rgbb(point(xg,y))
  pixhr=rgbr(point(xg,y))
  pixhg=rgbg(point(xg,y))
  pixhb=rgbb(point(xg,y))
  pixdr=rgbr(point(xd,y))
  pixdg=rgbg(point(xd,y))
  pixdb=rgbb(point(xd,y))
  pixbr=rgbr(point(x,yb))
  pixbg=rgbg(point(x,yb))
  pixbb=rgbb(point(x,yb))
  ink rgb((pixgr+pixhr+pixdr+pixbr)/4,(pixgg+pixhg+pixdg+pixbg)/4,(pixgb+pixhb+pixdb+pixbb)/4),0
  dot x,y
 next y
next x
 
yorigine=0
 
get image image+1,64*image,0,64+(64*image),32
 
image=1
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 62+yorigine step 2
  variable=rnd(7)
  ink rgb(230-(variable*15),230-(variable*15),15-variable),0
  dot x,y
 next y
next x
 
yorigine=1
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 62+yorigine step 2
  xg=x-1
  yh=y-1
  xd=x+1
  yb=y+1
  if xg<64*image then xg=63+(64*image)
  if yh<0 then yh=63
  if xd>63+64*image then xd=64*image
  if yb>63 then yb=0
  pixgr=rgbr(point(xg,y))
  pixgg=rgbg(point(xg,y))
  pixgb=rgbb(point(xg,y))
  pixhr=rgbr(point(xg,y))
  pixhg=rgbg(point(xg,y))
  pixhb=rgbb(point(xg,y))
  pixdr=rgbr(point(xd,y))
  pixdg=rgbg(point(xd,y))
  pixdb=rgbb(point(xd,y))
  pixbr=rgbr(point(x,yb))
  pixbg=rgbg(point(x,yb))
  pixbb=rgbb(point(x,yb))
  ink rgb((pixgr+pixhr+pixdr+pixbr)/4,(pixgg+pixhg+pixdg+pixbg)/4,(pixgb+pixhb+pixdb+pixbb)/4),0
  dot x,y
 next y
next x
 
yorigine=0
 
get image image+1,64*image,0,64+(64*image),64
 
image=2
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 62+yorigine step 2
  variable=rnd(7)
  ink rgb(0,(variable*21),200-variable),0
  dot x,y
 next y
next x
 
yorigine=1
 
for x=64*image to 63+(64*image)
 if yorigine=1
  yorigine=0
 else
  yorigine=1
 endif
 for y=yorigine to 62+yorigine step 2
  xg=x-1
  yh=y-1
  xd=x+1
  yb=y+1
  if xg<64*image then xg=63+(64*image)
  if yh<0 then yh=63
  if xd>63+64*image then xd=64*image
  if yb>63 then yb=0
  pixgr=rgbr(point(xg,y))
  pixgg=rgbg(point(xg,y))
  pixgb=rgbb(point(xg,y))
  pixhr=rgbr(point(xg,y))
  pixhg=rgbg(point(xg,y))
  pixhb=rgbb(point(xg,y))
  pixdr=rgbr(point(xd,y))
  pixdg=rgbg(point(xd,y))
  pixdb=rgbb(point(xd,y))
  pixbr=rgbr(point(x,yb))
  pixbg=rgbg(point(x,yb))
  pixbb=rgbb(point(x,yb))
  ink rgb((pixgr+pixhr+pixdr+pixbr)/4,(pixgg+pixhg+pixdg+pixbg)/4,(pixgb+pixhb+pixdb+pixbb)/4),0
  dot x,y
 next y
next x
 
yorigine=0
 
get image image+1,64*image,0,64+(64*image),64
 
set current bitmap 0
 
autocam off
 
sync on
 
hide mouse
 
angle#=0
 
make object cone 1,15
xrotate object 1,180-angle#/1
scale object 1,100,133.333,100
texture object 1,1
yrotate object 1,90
position object 1,5000-(tan(angle#)*7),0,5000
 
make object cone 2,14
xrotate object 2,object angle x(1)-angle#/2
scale object 2,100,142.857,100
texture object 2,1
yrotate object 2,90
position object 2,object position x(1)-(tan(angle#)*7),7,5000
 
make object cone 3,12.8
xrotate object 3,object angle x(2)-angle#/3
scale object 3,100,156.25,100
texture object 3,1
yrotate object 3,90
position object 3,object position x(2)-(tan(angle#)*7),14,5000
 
make object cone 4,11.2
xrotate object 4,object angle x(3)-angle#/4
scale object 4,100,178.571,100
texture object 4,1
yrotate object 4,90
position object 4,object position x(3)-(tan(angle#)*7),21,5000
 
make object cone 5,11.2
xrotate object 5,object angle x(4)-angle#/5
scale object 5,100,178.571,100
texture object 5,1
yrotate object 5,90
position object 5,object position x(4)-(tan(angle#)*7),27,5000
 
make matrix 1,2000,2000,100,100
 
make matrix 2,10000,10000,100,100
 
prepare matrix texture 1,2,1,1
 
prepare matrix texture 2,3,1,1
 
ghost matrix on 2
 
for x=0 to 100
 for y=0 to 100
  set matrix height 1,x,y,-(sqrt((x-50)^2+(y-50)^2)^2)*0.2-rnd(6)
 next y
next x
 
sens=1
 
position matrix 1,4000,0,4000
position matrix 2,0,-15,0
 
dim membres(30)
 
dim vagues(10)
vagues(1)=0
vagues(2)=6
vagues(3)=13
vagues(4)=20
vagues(5)=4
vagues(6)=0
vagues(7)=6
vagues(8)=20
vagues(9)=4
vagues(10)=0
vaguedeplace=0
 
vent#=5
 
position camera 5000,30,3500
 
for z=3500 to 4850 step 5
 position camera 5000,110-((z-4175)^2)*0.0002,z
 gosub vague
 gosub inclinaison
 sourisx#=mousemovex()
 sourisy#=mousemovey()
 xrotate camera camera angle x()+0.2*sourisy#
 yrotate camera camera angle y()+0.2*sourisx#
 sync
next z
 
do
 
gosub vague
gosub inclinaison
 
sourisx#=mousemovex()
sourisy#=mousemovey()
xrotate camera camera angle x()+0.2*sourisy#
yrotate camera camera angle y()+0.2*sourisx#
 
if upkey()=1
 move camera 0.5*upkey()
 if sqrt(((camera position x()-5000)^2)+((camera position z()-5000)^2))>1000 then move camera -0.5*upkey()
endif
 
if downkey()=1
 move camera -0.5*downkey()
 if sqrt((camera position x()-5000)^2+(camera position z()-5000)^2)>1000 then move camera 0.5*downkey()
endif
 
if leftkey()=1 and timer()>tempsgauche+300 and vent#>0
 vent#=vent#-1
 tempsgauche=timer()
endif
 
if rightkey()=1 and timer()>tempsdroite+300 and vent#<11
 vent#=vent#+1
 tempsdroite=timer()
endif
 
if camera position y()<get ground height(1,camera position x()-4000,camera position z()-4000)+2 then position camera camera position x(),get ground height(1,camera position x()-4000,camera position z()-4000)+2,camera position z()
if camera position y()<get ground height(2,camera position x(),camera position z())-13 then position camera camera position x(),get ground height(2,camera position x(),camera position z())-13,camera position z()
 
sync
 
loop
 
vague:
 
if timer()>tempsvague+250-20*vent#
 vaguedeplace=vaguedeplace+1
 if vaguedeplace=6 then vaguedeplace=1
 for range=1 to 96 step 5
  for colonne=1 to 100
   set matrix height 2,range,colonne,(vagues(vaguedeplace+1)*(vent#/4))-15
   set matrix height 2,range+1,colonne,(vagues(vaguedeplace+2)*(vent#/4))-15
   set matrix height 2,range+2,colonne,(vagues(vaguedeplace+3)*(vent#/4))-15
   set matrix height 2,range+3,colonne,(vagues(vaguedeplace+4)*(vent#/4))-15
   set matrix height 2,range+4,colonne,(vagues(vaguedeplace+5)*(vent#/4))-15
  next colonne
 next range
 update matrix 2
 tempsvague=timer()
endif
 
return
 
inclinaison:
 
if timer()>tempsinclinaison+250-(22*vent#)
 inclinaison#=inclinaison#+sens
 if inclinaison#>10
  sens=-sens
  inclinaison#=9
 endif
 if inclinaison#<1
  sens=-sens
  inclinaison#=2
 endif
 angle#=vent#*1.7
 angleinstant#=(angle#/2)+((angle#/2)*(inclinaison#/10))
 gosub rotation
 tempsinclinaison=timer()
endif
 
return
 
rotation:
 
xrotate object 1,180-angleinstant#/1
position object 1,5000-(tan(angleinstant#)*7),0,5000
 
xrotate object 2,object angle x(1)-angleinstant#/2
position object 2,object position x(1)-(tan(angleinstant#)*7),7,5000
 
xrotate object 3,object angle x(2)-angleinstant#/3
position object 3,object position x(2)-(tan(angleinstant#)*7),14,5000
 
xrotate object 4,object angle x(3)-angleinstant#/4
position object 4,object position x(3)-(tan(angleinstant#)*7),21,5000
 
xrotate object 5,object angle x(4)-angleinstant#/5
position object 5,object position x(4)-(tan(angleinstant#)*7),27,5000
 
return