home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1998-04-19 | 12.4 KB | 359 lines |
- '
- '
- '
- 'Goto HERE
- '
- D$=Dir$
- Load D$+"banks/jetnoises.abk",5
- '
- Screen Open 1,640,264,2,Hires : Colour 1,$BCD : Colour 0,$445
- Screen Open 2,936,256,8,LORES
- Screen Open 3,936,256,8,LORES
- Screen Open 4,320,240,16,LORES : Curs Off : Rem 3d screen
- 'Screen Open 5,36,56,2,LORES : Screen Hide 5 : Rem hope to stop gurus
- Screen To Front 1
- '
- Screen 1 : Hide : Gosub PRYNT
- Load Iff D$+"pictures/monta",2 : Screen Hide 2
- Load Iff D$+"pictures/montb",3 : Screen Hide 3
- '
- Dim SYN#(361)
- Dim COZN#(361)
- Dim TRAILX(60)
- Dim TRAILY(60)
- Dim TRAILZ(60)
- Degree
- For X=0 To 360 : SYN#(X)=Sin(X) : COZN#(X)=Cos(X) : Next
- Extension_4_04D6 D$+"objects"
- Hide
- Screen 4
- Extension_4_0054 240
- RT1=16384 : RT2=32768 : RT3=49152 : RT4=65536
- Double Buffer
- Autoback 0
- TPSPEED=750 : Rem this is max, to limit sound max loop rate for jet
- STALL=160
- THRUST=0
- INDRAG=0 : Rem 65 is max for input.. (30 is pretty slow)
- DRAG=65-INDRAG
- WEIGHT=9 : Rem jet standard 9 (a max wing loading effect), 3 a minimum
- SENK=WEIGHT*4 : Rem 40 for sink rate , increases on turn
- RESPONSE=900 : Rem standard 900
- UPDOWN=RESPONSE/2
- HOLDIT=0
- TAANK=50000 : FUEL=TAANK
- TRAILOFF=1
- 'Td Keep On
- Extension_4_0016 "jetplane3"
- Extension_4_0016 "runway"
- Extension_4_01A6 0,RT3,0,RT1
- Extension_4_00EC 0,900,2200,1500
- Extension_4_0036 1,"jetplane3",5400,-200,50,RT1-200,RT2,-500
- Extension_4_0036 2,"runway",12000,100,-200,RT1,RT2,1000
- Extension_4_058A 2,-1
- Get Palette 2
- Palette $69F,,,,,,,,$F96,$FEF,$573,$0,$333,$444,$FFF
- '
- Extension_4_05E2 1,1,15
- For Y=1 To 8
- Colour Y,Colour(Y)-$222
- Next
- '
- Volume 10 : Sam Loop On : Sam Play %1001,1,9000
- HERE:
- Clear Key : Wait Key
- Screen Hide 1
- 'End
- '
- ' ---------------- START OF LOOP------------------
- '
- Repeat
- X=Joy(1)
- MORE=0
- If Jleft(1)=-1 Then Add A,RESPONSE
- If Jright(1)=-1 Then Add A,-RESPONSE
- A=A-A/3
- If Jdown(1)=-1 Then Add B,-UPDOWN
- If Jup(1)=-1
- If WZ>GRZ or BAT<30500
- Add B,UPDOWN
- End If
- End If
- B=B-B/3
- F$=Inkey$
- Clear Key
- If F$<>"" Then Gosub KEYBOARD
- AAT= Extension_4_01BC(1)
- BAT= Extension_4_01D0(1)
- CAT= Extension_4_01E4(1)
- ' --------------------the tricky bit!!!!----------
- '
- ' angles first
- '
- INVERT=1 : If BAT<RT1 or BAT>RT3 Then INVERT=-1
- USEFUL#=COZN#(AAT/182)
- MOREUSE#=SYN#(BAT/182)
- ELEVT=USEFUL#*B*INVERT
- VERT=0 : AMORE=0
- If BAT<21000 and BAT>11000 or BAT>43000 and BAT<55000
- ' these lines allow direct c rotation from vert when vertical
- ' <21000 >11000 >43000 <55000 to 20k- 12k 44k- 54k
- '
- If AAT<RT1-700 : AMORE=500 : End If : Rem 4 lines to stop bad alignment of c and a
- If AAT>RT3+700 : AMORE=-500 : End If
- If AAT>RT1 and AAT<RT2 : AMORE=-500 : End If
- If AAT>RT2 and AAT<RT3 : AMORE=500 : End If
- If BAT<21000 and BAT>11000
- VERT=A*MOREUSE#-AMORE
- End If
- If BAT>43000 and BAT<55000
- VERT=A*MOREUSE#+AMORE
- End If
- End If
- ' finally set angle.....
- Extension_4_018C 1,A*Abs(COZN#(BAT/182))+AMORE,B*SYN#(AAT/182),USEFUL#*300*INVERT-ELEVT+VERT
- If HOLDIT=0 and WZ>GRZ+400 and SPEED<STALL Then Extension_4_018C 1,0,1800*INVERT,0
- ' above line is for stall
- '
- ' then movement
- '
- Add FUEL,-THRUST : If FUEL<0 Then THRUST=0
- GRAVITY=Int(MOREUSE#*WEIGHT) : Rem ..........speed alter with climb/ fall
- Add SPEED,THRUST-(SPEED/DRAG)-GRAVITY
- If SPEED<0 Then SPEED=0
- If SPEED<65 and WZ<(GRZ-180) Then SPEED=0 : THRUST=0 : Rem To give Stop On landing
- If SPEED>TPSPEED Then SPEED=TPSPEED : Rem else the sound goes too high
- '
- ' main movement..
- MZ#=MOREUSE#*SPEED : Rem vertical move
- TEMP#=-(COZN#(BAT/182)*SPEED) : Rem split rest between x/y
- MX#=COZN#(CAT/182)*TEMP#
- MY#=SYN#(CAT/182)*TEMP#
- If WZ<GRZ Then MZ#=0 : Rem to prevent underground on runway
- Extension_4_00D4 1,MX#,MY#,MZ#-LOSS : Rem actual plane move
- LOSS=0 : If WZ>GRZ Then LOSS=SENK+(Abs(USEFUL#)*SENK*2) : Rem loss is sink rate
- '
- Dec HOLDIT : If HOLDIT<0 Then HOLDIT=0
- ' above prevents nose down on runway after stall
- '
- '
- ' then viewpoint
- '
- WX= Extension_4_0114(1) : WY= Extension_4_0128(1) : WZ= Extension_4_013C(1)
- SCX= Extension_4_0474(WX,WY,WZ)
- SCY= Extension_4_0480
- GRZ=200-RNG/26
- If WZ<GRZ
- CRASH=1 : If WY>1000 or WY<-1700 : CRASH=0 : End If : Rem sideways limit runway
- If CRASH=1 and WX>24000 or WX<0 : CRASH=0 : End If : Rem Ends Runway
- If CRASH=0 : Gosub CRASH : End If
- End If
- '
- ' ------- horizontal change of view--------
- '
- SP=SP/1.2 : Rem damping for viewpoint turn
- FOOL=0
- If SCX>1 and SCX<230 Then CORRECT=0
- If CORRECT=1 Then FOOL=-350 : Goto AVOID
- If SCX<100 Then FOOL=105-SCX
- If SCX<65 Then FOOL=(90-SCX)*4 : Rem was 350
- AVOID:
- If SCX>230 Then FOOL=205-SCX
- If SCX>255 Then FOOL=(190-SCX)*4 : CORRECT=1
- Add SP,FOOL
- '
- ' ------ vertical change------
- '
- If SCY=-1 Then Gosub MISS : Rem MISS =attempt to swing to pick up dive/vanish
- TAD= Extension_4_01BC(0)
- If SCY<55 and SCY>-1 Then Add UP,(55-SCY)*100 : Rem to follow overhead pass
- If WZ<5000 and TAD>RT3 Then Add UP,-(5100-WZ)/14 : THING=1 : Rem moves bcgrnd up as plane nears ground
- If TAD>51800 and SCY>100 : Rem when PLANE HIGH and comes low on screen
- HOPE=-SCY*3
- Add UP,HOPE
- End If
- If WZ>5200 and TAD<51000 Then Add UP,128 : Rem move bkgd DOWN for mid flight
- UP=UP/3
- '
- Extension_4_018C 0,UP,0,-SP
- ' If TAD>55000 and SCY<80 and SCY>0 Then Gosub DESPERATE
- If Extension_4_01BC(0)<RT1 Then Extension_4_01A6 0,RT4-(UP*20),0, Extension_4_01E4(0)+RT2
- ' above line flicks view over the vertical
- '
- Extension_4_053C
- Extension_4_0318
- QUICK=(SPEED/5)+1
- Paper 0 : Ink 1
- Bar 0,0 To QUICK,2 : Draw 130,4 To 130,7 : Draw 50,4 To 50,7
- Locate 15,0 : Print " <airspeed"
- Locate 28,0 : Print THRUST;" <power"
- Bar 0,9 To FUEL/1000,11 : Locate 7,1 : Print "<fuel"
- ' ----------------- now the background.. confounded size limits!!! ----------
- UPPER=(TAD-49152)/35
- If UPPER<0 Then UPPER=0
- '
- BACPOS= Extension_4_01E4(0)/35
- EXTRA2=1 : OVER2=0 : EXTRA3=1 : OVER3=0
- WID1=320 : If BACPOS>616 and BACPOS<936 Then WID1=936-BACPOS : EXTRA3=0 : OVER3=1
- WID2=320 : If BACPOS>1552 Then WID2=1872-BACPOS : EXTRA2=0 : OVER2=1
- If BACPOS>930 and BACPOS<1553 Then Goto SKIP1
- Extension_4_049E 2,BACPOS*EXTRA2,80,WID1,256 To WID2*OVER2,62+UPPER
- SKIP1:
- If BACPOS<617 Then Goto SKIP2
- Extension_4_049E 3,(BACPOS-936)*EXTRA3,80,WID2,256 To WID1*OVER3,62+UPPER
- SKIP2:
- '
- '
- Dec CHOOK
- If CHOOK<1 Then CHOOK=6 : Gosub SOUND
- OVERDONE:
- If Timer<3 Then Goto OVERDONE : Rem To LIMIT SPEED On FASTER MACHINE
- Timer=0
- Gosub TRAIL
- Screen Swap
- Wait Vbl
- Until False
- '--------------------------=END LOOP ----------------------
- '
- '
- '========================================================================
- PRYNT:
- Locate 22,1 : Print "A SIMPLE MODEL JET FLIGHT SIMULATOR ..."
- '
- Locate 20,2 : Print "( miniature gas turbines are in use now ) "
- Locate 20,3 : Print " Programmed using AMOS 3D "
- Locate 2,4
- Print " "
- Print " Turning is done by first banking the plane ( using joystick) "
- Print " A slight natural turn occurs, which increases as the bank increases."
- Print " "
- Print " Elevator action (..joystick) is normal with wings level, but when the"
- Print " wings are tilted, elevator will cause the turn to increase or decrease."
- Print "(limitations in amos3d allowed only partial rudder control so it is ommitted)"
- Print ""
- Print " NOTE.. most aerobatics are possible, but it takes time to get used to the "
- Print " controls being relative to the plane's attitude, and not the viewpoint."
- Print " Very slow speed will help- reducing WEIGHT variable will allow slowest speed "
- Print " Runway landing is difficult as there's none of the 3d depth perception and"
- Print " sense of orientation in a landscape that you get with the real thing. "
- Print ""
- Print " Power level is from 0-11,using keys..'tab,0,1,2.. etc. up to -'"
- Print " Key P will pause "
- Print " Key R will reset the plane to the runway"
- Print " Key Z will flick zoom the plane closer if it gets too distant"
- Print " Key T will toggle the 'smoke trail' On /Off.. off speeds frame rate"
- Print " Key H will bring back this screen "
- Print " Key C will end program "
- Print " "
- Print " Background and viewpoint movement proved to be tricky but normally the view"
- Print " angle will swing after, or over and catch up to the plane going past. "
- Print " Once disc activity stops.... PRESS ANY KEY TO CONTINUE"
- Print ""
- Print " Programmer... David Lawrence. First done about 1994, improved 1997 "
- Return
- '=======================================================
- SOUND:
- ' about 50,000 seems to be max visible comfortably
- RNG= Extension_4_007E(0,1)
- FACTOR=(RNG/700)-10
- If FACTOR>50 Then FACTOR=50 : Rem limit low sound at dist
- If FACTOR<0 Then FACTOR=0
- VOL=63-((500-SPEED)/10)-FACTOR
- If VOL<8 Then VOL=8
- If VOL>63 Then VOL=63
- Volume VOL
- Doke $DFF0D6,800-(THRUST*60)
- Doke $DFF0A6,800-SPEED
- 'above sets frequency --amos sound has to break the loop to change@#!
- Return
- '========================================================
- CRASH:
- TEMP1=4+(SPEED/20)
- VOL=1
- For H=0 To 20
- Extension_4_018C 1,Rnd(200)*TEMP1,Rnd(200)*TEMP1,Rnd(600)*TEMP1
- Extension_4_00D4 1,MX#,MY#,0
- Extension_4_053C
- Extension_4_0318
- If BACPOS>930 and BACPOS<1553 Then Goto SKIP3
- Extension_4_049E 2,BACPOS*EXTRA2,80,WID1,256 To WID2*OVER2,62+UPPER
- SKIP3:
- If BACPOS<617 Then Goto SKIP4
- Extension_4_049E 3,(BACPOS-936)*EXTRA3,80,WID2,256 To WID1*OVER3,62+UPPER
- SKIP4:
- Screen Swap : Wait Vbl
- TEMP1=TEMP1-2 : If TEMP1<1 Then TEMP1=1
- MX#=MX#/1.4 : MY#=MY#/1.4
- Add VOL,12 : If VOL>63 Then VOL=63
- If VOL=63 Then Volume 1 Else Volume VOL
- Next
- Volume 0 : Locate 4,20 : Print "... below ground zero! " : Locate 7,23
- Print " resetting..... " : Screen Swap : Wait 100
- Extension_4_01A6 1,RT1-200,RT2,-500 : SPEED=0 : THRUST=0
- Extension_4_00EC 1,5400,-200,250 : C1=0 : C2=0 : BAT=16384 : B=0 : A=0 : FOOL=0 : WZ=0
- Extension_4_01A6 0,RT3,0,RT1 : SP=0 : UP=0 : UPPER=0 : CORRECT=0 : HOLDIT=20 : FUEL=TAANK
- Return
- '===================================================================
- KEYBOARD:
- ' plane speed
- '
- HOLD=Scancode
- If HOLD>-1 and HOLD<12 Then THRUST=HOLD
- If F$="c" Then Volume 0 : End
- If F$="t" and TRAILOFF=0
- TRAILOFF=1
- For X=0 To 45 : TRAILZ(X)=50000 : Next : Return
- End If
- If F$="t" and TRAILOFF=1 Then TRAILOFF=0
- If F$="h"
- Screen Show 1
- Wait Key : Screen Hide 1 : Screen 4
- End If
- If F$="r" : Rem ...... reset if plane lost
- Extension_4_01A6 1,RT1-200,RT2,-500 : SPEED=0 : THRUST=0
- Extension_4_00EC 1,5400,-200,250 : C1=0 : C2=0 : BAT=16384 : B=0 : A=0 : FOOL=0
- Extension_4_01A6 0,RT3,0,RT1 : SP=0 : UP=0 : UPPER=0 : CORRECT=0 : WZ=0 : HOLDIT=20 : FUEL=TAANK
- End If
- If F$="p" Then Volume 0 : Wait Key
- If F$="z" Then Extension_4_00EC 1,WX/2,WY/2,WZ/1.8
- Return
- '==========================================================================
- MISS:
- HELPA= Extension_4_0236(0,WY,WZ,WX)
- HELPB= Extension_4_0244
- If HELPA<RT1 and HELPA>0 Then TEMPA=49152+HELPA
- If HELPA<0 Then TEMPA=49152
- If HELPA>RT1 Then TEMPA=49152+(RT2-HELPA)
- Extension_4_01A6 0,TEMPA,0, Extension_4_01E4(0)
- TAD= Extension_4_01BC(0)
- ' FOOL=0
- ' SP=0
- ' UP=0
- Return
- '==================================================================
- DESPERATE:
- LAST= Extension_4_01BC(0)
- LEVER=(LAST-TAD)/4
- If LEVER>600 or LEVER<1 : LEVER=600 : End If
- If SCX<160 : Add SP,100+LEVER : End If : Rem try and swivel overhead
- If SCX>159 : Add SP,-100-LEVER : End If
- 'Print LEVER; : Screen Swap : Wait Key
- Return
- '========================================================
- TRAIL:
- '
- If TRAILOFF=1 Then Return
- If THRUST<1 Then For X=0 To 45 : TRAILZ(X)=50000 : Next : Return
- Colour 15,$AAA
- Add MARK,1,0 To 45
- TRAILX(MARK)=WX+Rnd(250)
- TRAILY(MARK)=WY+Rnd(250)
- TRAILZ(MARK)=WZ-70+Rnd(200)
- '
- For TR=0 To 35+Rnd(4) : Rem Step 2
- TX= Extension_4_0474(TRAILX(TR),TRAILY(TR),TRAILZ(TR))
- TY= Extension_4_0480
- Ink 15
- Plot TX,TY+Rnd(2)
- Next
- Return