( System description 9/27/83 )

forget it
: it ;

4 mode 17 0 3 color 10 vtab print " One moment, please ... "

0 variable noise
0 variable xr
0 variable yr
0 variable zr
0 variable yt
0 variable rng
0 variable direct
2000 string aframe
2000 string office
2000 string runway
2000 string plane
2000 string tune
0 variable key.pressed

: clrkey begin getkey 0 = until ;

: check.key getkey dup -> key.pressed drop ;

: draw.it check.key key.pressed 0 = if draw then ;

: locate.end 0 tune begin  dup peek 0 <> while  3 + repeat ;

: set.repeat 0 tune ( address of beginning )  
      locate.end 1 + ( address of end )  pokew ; 

( put address of beginning at end of music )
: load.music 0 tune 1999 memory read " bourree2.mus "  set.repeat ;

: wait  
  0 do 0 begin 1 + dup 1075 > check.key key.pressed or until drop  
  loop ;

: load.it  
   pad concat " .img "  
   object dup objadr 1999 memory pad -> read   
   15 xrot 15 yrot 50 ypos 150 scale   
   off ;

: load.objects  
   objerase  
   pad assign " aframe "  0 aframe 0 load.it  
   pad assign " office "  0 office 1 load.it   
   pad assign " runway "  0 runway 2 load.it   
   pad assign " plane "  0 plane 3 load.it ;
   
: spiny 
   15 begin 15 + dup yrot draw.it  
    dup 390 >= check.key key.pressed 
   or until drop ;

: fly.down.runway  
   key.pressed 0 = if 2 object ( runway )  
    50 -> xr -100 direct * -> yr  100 -> yt  10000 -> rng  
    26 0 do  xr xrot  yr yrot  yt ytran  rng range  draw.it  
    xr 4 * 5 / -> xr  
    yr 2 * 3 / -> yr  
    yt 4 * 5 / 20 + -> yt  
    rng 500 - -> rng  
    loop   
   
    3 object ( plane )  
    -4 scalz 0 -> xr 0 -> yr 0 -> zr 0 -> rng 160 -> yt  
    20 0 do  xr xrot  yr yrot  zr zrot  yt xpos  rng range  draw.it  
     xr 2 - -> xr  
     yr direct 2 * + -> yr  
     zr direct 2 * - -> zr  
     yt direct 8 * + -> yt  
     rng 500 + -> rng  
    loop   
   then ;
   
: screen1  
  key.pressed 0 = if  
   cls 17 1 3 color  
   print " GraFORTH PC has the power you need: " cr cr  17 1 1 color  
   print "   * Three-Dimensional Graphics " cr  
   print "   * Music Composing Features " cr  
   print "   * Fast Compiled Programs " cr  
   print "   * Easy to learn and use " cr cr cr  17 1 2 color  
   print "     GraFORTH makes your computer " cr  
   print "          work for a living ! " cr  2 gcolor 
   32 152 plot 288 184 box  
  then ;  

: screen2  
  key.pressed 0 = if  
   cls cr 17 0 3 color  
   print " Three-Dimensional Graphics " cr cr  17 0 2 color  
   print " * Fast Animation Capability " cr  
   print "   (up to 30 frames per second!) " cr  17 0 1 color  
   print " * Powerful Image Editor " cr  17 0 2 color  
   print " * Full Program Image Control " cr  17 0 1 color  
   print " * View From Inside Structures " cr  
  then ;
  
: screen3  
  key.pressed 0 = if  
   cls cr 17 1 3 color  
   print " GraFORTH PC - more powerful by far " cr cr  17 1 1 color  
   print " * Music plays in background " cr cr  17 1 2 color  
   print " * Full file and system access " cr cr  17 1 3 color  
   print " * Program, graphics, and music " cr  
   print "   development tools included " cr cr   
  then ;
  
: desc  
   
   bell
   
   pad 126 + peek 78 = if 0 else 1 then -> noise 
   clrkey  0 -> key.pressed  
   load.objects  
   load.music  
   key.pressed 0 = if noise if 0 tune -> play then then  
   4 mode 2 38 12 24 window 
   
   bell
   
   screen1 1 object ( office )
     150 ytran  550 ztran  1000 range  300 radius spiny
     2000 1200 do i range draw.it 200 +loop 
     0 ztran  200 ytran  2000 range 1300 radius spiny 
     5000 2500 do i range draw.it 500 +loop
     5000 range 0 radius
     spiny ( 1 wait ) 
     
   bell

   screen2 2 object 50 xrot spiny ( runway ) 
    2 0 do  
     -1 -> direct  
     fly.down.runway  1 -> direct  
     fly.down.runway  
    loop  
 
   screen3  0 object  2000 range  spiny  ( aframe ) 
   4500 2500 do i range draw.it 500 +loop 
   spiny pad 127 + peek 68 = if    
    key.pressed 0 = if      
     17 1 1 color print " (press RETURN for menu) "    
    then  
   then  
   5000 range spiny 
   check.key pad 127 + peek 68 = if  
    key.pressed if read " menu " else read " face " then   
   else 4 mode  
   then 
   0 -> play ;
  close run
