home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / AllPlaton / Ben3D / Ben.AMOS / Ben.amosSourceCode < prev    next >
Encoding:
AMOS Source Code  |  1995-03-07  |  10.4 KB  |  367 lines

  1. ' Ben AMOS Version 
  2. ' Ein sehr altes Spiel... Das letzte mal d�rfte ich vor 2-3 Jahren dran  
  3. ' gearbeitet haben... die Routinen sind sehr speziell und wahrscheinlich 
  4. ' f�r Dich nutzlos... :-(
  5. ' Und vorallem sind sie saumies. 
  6. Set Buffer 50
  7. Dim F(5+19+5,5+19+5,1),M(5+19+5,5+19+5)
  8. 'GRABICONS 
  9. 'Wait Key  
  10. Unpack 7 To 0
  11. Paper 0 : Pen 1
  12. Double Buffer 
  13. Autoback 0
  14. Bob Update Off 
  15. Make Icon Mask 
  16. For YS=0 To 29
  17.   For XS=0 To 29
  18.     F(XS,YS,0)=1 : M(XS,YS)=0
  19.   Next 
  20. Next 
  21. Reserve As Work 10,928
  22. ST=Start(10)
  23. Bload "BenLevels/1",ST
  24. For YS=0 To 19
  25.   For XS=0 To 19
  26.     F(XS+5,YS+5,0)=Peek(ST+XS*2+YS*40)
  27.     F(XS+5,YS+5,1)=Peek(ST+XS*2+YS*40+1)
  28.   Next 
  29. Next 
  30. XO=0 : YO=0
  31. XB=4 : YB=1 : DB=3
  32. Set Rainbow 0,15,90,"","",""
  33. C0=15 : C1=0 : C2=0
  34. For A=0 To 89
  35.   D0=C0 : D1=C1 : D2=C2
  36.   If C0=15 and C1<15 and C2=0 Then Inc D1
  37.   If C0>0 and C1=15 Then Dec D0
  38.   If C0=0 and C1=15 and C2<15 Then Inc D2
  39.   If C1>0 and C2=15 Then Dec D1
  40.   If C1=0 and C2=15 and C0<15 Then Inc D0
  41.   If C0=15 and C2>0 Then Dec D2
  42.   C0=D0 : C1=D1 : C2=D2
  43.   Rain(0,A)=C0*$100+C1*$10+C2
  44. Next 
  45. RAI=0
  46. A$="L Y=YH(0,56); L A=128; L X=0; A: P; L X=X+2; I X<90 J A; L X=X-90; J A;"
  47. Channel 0 To Rainbow 0
  48. Amal 0,A$
  49. Amal On 
  50. XA=-1 : YA=-1 : UP=0
  51. Do 
  52. '  Home : Print Timer;"    " 
  53.   Wait Vbl : Timer=0
  54.   If XA<>XB or YA<>YB Then UP=2 : XA=XB : YA=YB
  55.   If UP
  56.     Gosub COMDIR
  57.     Gosub MAKEMAP
  58.     Gosub KARTUP
  59.     Gosub MAKEGFX
  60.     Dec UP
  61.   End If 
  62.   Screen Swap 
  63.   For YYY=YB+3 To YB+7
  64.     For XXX=XB+3 To XB+7
  65.       F=F(XXX,YYY,0)
  66.       If F=11 and CC=1 Then F(XXX,YYY,0)=10 : UP=2
  67.       If F=10 and CC=1 Then F(XXX,YYY,0)=8 : UP=2
  68.       If F=10 and CC=0 Then F(XXX,YYY,0)=11 : UP=2
  69.       If F=11 and CC=0 Then F(XXX,YYY,0)=9 : UP=2
  70.     Next 
  71.   Next 
  72.   I$=Inkey$
  73.   If I$=Cup$ Then Gosub SCHUBS
  74.   If I$=Cdown$
  75.     RX=-RX : RY=-RY : Gosub SCHUBS : RX=-RX : RY=-RY
  76.   End If 
  77.   If I$=Cleft$ Then Add DB,-1,0 To 3 : UP=2
  78.   If I$=Cright$ Then Add DB,1,0 To 3 : UP=2
  79.   XB=Min(Max(XB,0),19)
  80.   YB=Min(Max(YB,0),19)
  81.   XO=Min(Max(XB-4,0),12)
  82.   YO=Min(Max(YB-4,0),12)
  83. Loop 
  84. Wait Key 
  85. End 
  86. SCHUBS:
  87.   F=F(XB+5+RX,YB+5+RY,0)
  88.   If F=6 Then Repeat : XB=Rnd(19) : YB=Rnd(19) : Until F(XB+5,YB+5,0)=0
  89.   If F=0 or F=7
  90.     Add XB,RX : Add YB,RY
  91.   Else 
  92.     If F>7 and F<12
  93.       FF=F(XB+5+RX*2,YB+5+RY*2,0)
  94.       RS=0
  95.       If FF=0
  96.         F(XB+5+RX*2,YB+5+RY*2,0)=F
  97.         If F=9
  98.           RS=7 : CC=1
  99.           F(XB+5+RX*2,YB+5+RY*2,0)=11
  100.         End If 
  101.         If F/2=5 and CC=0
  102.           CC=1 : RS=7
  103.         End If 
  104.       End If 
  105.       If FF=7
  106.         If F=8
  107.           F(XB+5+RX*2,YB+5+RY*2,0)=10
  108.           CC=0
  109.         Else 
  110.           F(XB+5+RX*2,YB+5+RY*2,0)=F
  111.           RS=7
  112.         End If 
  113.       End If 
  114.       If FF=0 or FF=6 or FF=7
  115.         F(XB+5+RX,YB+5+RY,0)=RS
  116.         Add XB,RX : Add YB,RY
  117.       End If 
  118.     End If 
  119.   End If 
  120. Return 
  121. MAKEMAP:
  122.   For A=0 To 4
  123.     XX=XB+5+RX*A : YY=YB+5+RY*A
  124.     F=F(XX,YY,0) : M(XX,YY)=1
  125.     If F>0 and F<6 Then Exit 
  126.     If F=7 Then M(XX+RX,YY+RY)=1 : Exit 
  127.   Next 
  128.   MB=0
  129.   For A=0 To 4
  130.     XX=XB+5+RX*A+RY : YY=YB+5+RY*A-RX
  131.     F=F(XX,YY,0)
  132.     If(F=0 or F>5) and MB>0 Then Exit 
  133.     M(XX,YY)=1
  134.     If F>0 and F<6 and MB=0 Then MB=A
  135.   Next 
  136.   TL=MB : MB=0
  137.   For A=0 To 4
  138.     XX=XB+5+RX*A-RY : YY=YB+5+RY*A+RX
  139.     F=F(XX,YY,0)
  140.     If(F=0 or F>5) and MB>0 Then Exit 
  141.     M(XX,YY)=1
  142.     If F>0 and F<6 and MB=0 Then MB=A
  143.   Next 
  144.   TR=MB : MB=0
  145.   If TL>2
  146.     For A=1 To TL
  147.       XX=XB+5+RX*A+RY*2 : YY=YB+5+RY*A-RX*2
  148.       F=F(XX,YY,0)
  149.       If(F=0 or F>5) and MB>0 : Exit : End If 
  150.       M(XX,YY)=1
  151.       If F>0 and F<6 and MB=0 : MB=A : End If 
  152.     Next 
  153.     MB=0
  154.   End If 
  155.   If TR<3 Then Return 
  156.   MB=0
  157.   For A=1 To TR
  158.     XX=XB+5+RX*A-RY*2 : YY=YB+5+RY*A+RX*2
  159.     F=F(XX,YY,0)
  160.     If(F=0 or F>5) and MB>0 Then Exit 
  161.     M(XX,YY)=1
  162.     If F>0 and F<6 and MB=0 Then MB=A
  163.   Next 
  164. Return 
  165. KARTUP:
  166.   Ink 0 : Bar 240,48 To 303,111
  167.   For YS=0 To 7
  168.     For XS=0 To 7
  169.       If M(XS+5+XO,YS+5+YO) Then Paste Icon 240+XS*8,48+YS*8,F(XS+5+XO,YS+5+YO,0)+74
  170.     Next 
  171.   Next 
  172.   Paste Icon 240+(XB-XO)*8,48+(YB-YO)*8,86+DB
  173. Return 
  174. COMDIR:
  175.   If DB=0 Then RX=0 : RY=-1
  176.   If DB=1 Then RX=1 : RY=0
  177.   If DB=2 Then RX=0 : RY=1
  178.   If DB=3 Then RX=-1 : RY=0
  179. Return 
  180. MAKEGFX:
  181.   Clip 32,56 To 208,176
  182.   Paste Icon 32,56,1
  183.   ' Links vorne    X-2,Y-4 
  184.   F=F(XB+5+RX*4+RY*2,YB+5+RY*4-RX*2,0)
  185.   If F>0 and F<6 Then Paste Icon 32,90,13
  186.   If F=6 Then Paste Icon 32,90,25
  187.   ' Links vorne    X-1,Y-4 
  188.   F=F(XB+5+RX*4+RY,YB+5+RY*4-RX,0)
  189.   If F>0 and F<6 Then Paste Icon 68,90,13
  190.   If F=6 Then Paste Icon 58,90,25
  191.   ' Rechts vorne   X+2,Y-4 
  192.   F=F(XB+5+RX*4-RY*2,YB+5+RY*4+RX*2,0)
  193.   If F>0 and F<6 Then Paste Icon 176,90,13
  194.   If F=6 Then Paste Icon 174,90,25
  195.   ' Rechts vorne   X+1,Y-4 
  196.   F=F(XB+5+RX*4-RY,YB+5+RY*4+RX,0)
  197.   If F>0 and F<6 Then Paste Icon 140,90,13
  198.   If F=6 Then Paste Icon 140,90,25
  199.   ' Direkt vorne   X  ,Y-4 
  200.   F=F(XB+5+RX*4,YB+5+RY*4,0)
  201.   If F>0 and F<6 Then Paste Icon 104,90,13
  202.   If F=6 Then Paste Icon 104,90,25
  203.  
  204.   ' Links vorne    X-2,Y-3 
  205.   F=F(XB+5+RX*3+RY*2,YB+5+RY*3-RX*2,0)
  206.   If F>0 and F<6 Then Paste Icon 0,84,12 : Paste Icon 48,86,67
  207.   If F=6 Then Paste Icon 0,84,24 : Paste Icon 48,86,71
  208.   If F=7 Then Paste Icon 10,110,64
  209.   ' Links vorne    X-1,Y-3 
  210.   F=F(XB+5+RX*3+RY,YB+5+RY*3-RX,0)
  211.   If F>0 and F<6 Then Paste Icon 48,84,12 : Paste Icon 96,80,5
  212.   If F=6 Then Paste Icon 48,84,24 : Paste Icon 96,80,17
  213.   If F=7 Then Paste Icon 58,110,64
  214.   If F>7 and F<12 Then Gosub GECA : Paste Icon 58,90,33+BB*9 : Paste Icon 86,90,34+BB*9
  215.   ' Rechts vorne   X+2,Y-3 
  216.   F=F(XB+5+RX*3-RY*2,YB+5+RY*3+RX*2,0)
  217.   If F>0 and F<6 Then Paste Icon 192,84,12 : Paste Icon 176,86,69
  218.   If F=6 Then Paste Icon 192,84,24 : Paste Icon 176,86,73
  219.   If F=7 Then Paste Icon 206,110,64
  220.   ' Rechts vorne   X+1,Y-3 
  221.   F=F(XB+5+RX*3-RY,YB+5+RY*3+RX,0)
  222.   If F>0 and F<6 Then Paste Icon 144,84,12 : Paste Icon 136,80,9
  223.   If F=6 Then Paste Icon 144,84,24 : Paste Icon 136,80,21
  224.   If F=7 Then Paste Icon 158,110,64
  225.   If F>7 and F<12 Then Gosub GECA : Paste Icon 158,90,33+BB*9 : Paste Icon 150,90,32+BB*9
  226.   ' Direkt vorne   X  ,Y-3 
  227.   F=F(XB+5+RX*3,YB+5+RY*3,0)
  228.   If F>0 and F<6 Then Paste Icon 96,84,12
  229.   If F=6 Then Paste Icon 96,84,24
  230.   If F=7 Then Paste Icon 106,110,64
  231.   If F>7 and F<12 Then Gosub GECA : Paste Icon 106,90,33+BB*9
  232.  
  233.   ' Links vorne    X-2,Y-2 
  234.   F=F(XB+5+RX*2+RY*2,YB+5+RY*2-RX*2,0)
  235.   If F>0 and F<6 Then Paste Icon 24,78,66
  236.   If F=6 Then Paste Icon 24,78,70
  237.   ' Links vorne    X-1,Y-2 
  238.   F=F(XB+5+RX*2+RY,YB+5+RY*2-RX,0)
  239.   If F>0 and F<6 Then Paste Icon 0,76,11 : Paste Icon 80,72,4
  240.   If F=6 Then Paste Icon 0,76,23 : Paste Icon 80,72,16
  241.   If F=7 Then Paste Icon 20,120,63
  242.   If F>7 and F<12 Then Gosub GECA : Paste Icon 12,80,30+BB*9 : Paste Icon 68,80,31+BB*9
  243.   ' Rechts vorne   X+2,Y-2 
  244.   F=F(XB+5+RX*2-RY*2,YB+5+RY*2+RX*2,0)
  245.   If F>0 and F<6 Then Paste Icon 192,78,68
  246.   If F=6 Then Paste Icon 192,78,72
  247.   ' Rechts vorne   X+1,Y-2 
  248.   F=F(XB+5+RX*2-RY,YB+5+RY*2+RX,0)
  249.   If F>0 and F<6 Then Paste Icon 160,76,11 : Paste Icon 144,72,8
  250.   If F=6 Then Paste Icon 160,76,23 : Paste Icon 144,72,20
  251.   If F=7 Then Paste Icon 180,120,63
  252.   If F>7 and F<12 Then Gosub GECA : Paste Icon 172,80,30+BB*9 : Paste Icon 164,80,29+BB*9
  253.   ' Direkt vorne   X  ,Y-2 
  254.   F=F(XB+5+RX*2,YB+5+RY*2,0)
  255.   If F>0 and F<6 Then Paste Icon 80,76,11
  256.   If F=6 Then Paste Icon 80,76,23
  257.   If F=7 Then Paste Icon 100,120,63
  258.   If F>7 and F<12 Then Gosub GECA : Paste Icon 92,80,30+BB*9
  259.  
  260.   ' Links vorne    X-1,Y-1 
  261.   F=F(XB+5+RX+RY,YB+5+RY-RX,0)
  262.   If F>0 and F<6 Then Paste Icon -72,64,10 : Paste Icon 56,64,3
  263.   If F=6 Then Paste Icon -72,64,22 : Paste Icon 56,64,15
  264.   If F=7 Then Paste Icon -40,136,62
  265.   If F>7 and F<12 Then Gosub GECA : Paste Icon -32,68,27+BB*9 : Paste Icon 48,68,28+BB*9
  266.   ' Rechts vorne   X+1,Y-1 
  267.   F=F(XB+5+RX-RY,YB+5+RY+RX,0)
  268.   If F>0 and F<6 Then Paste Icon 184,64,10 : Paste Icon 160,64,7
  269.   If F=6 Then Paste Icon 184,64,22 : Paste Icon 160,64,19
  270.   If F=7 Then Paste Icon 200,136,62
  271.   If F>7 and F<12 Then Gosub GECA : Paste Icon 192,68,27+BB*9 : Paste Icon 184,68,26+BB*9
  272.   ' Direkt vorne   X  ,Y-1   
  273.   F=F(XB+5+RX,YB+5+RY,0)
  274.   If F>0 and F<6 Then Paste Icon 56,64,10
  275.   If F=6 Then Paste Icon 56,64,22
  276.   If F=7 Then Paste Icon 80,136,62
  277.   If F>7 and F<12 Then Gosub GECA : Paste Icon 80,68,27+BB*9
  278.   If F>1 and F<6 and(F-2)=((DB+2) mod 4) Then Paste Icon 104,88,65
  279.   ' Links von Ben  X-1,Y   
  280.   F=F(XB+5+RY,YB+5-RX,0)
  281.   If F>0 and F<6 Then Paste Icon 32,56,2
  282.   If F=6 Then Paste Icon 32,56,14
  283.   ' Rechts von Ben X+1,Y 
  284.   F=F(XB+5-RY,YB+5+RX,0)
  285.   If F>0 and F<6 Then Paste Icon 184,56,6
  286.   If F=6 Then Paste Icon 184,56,18
  287.   Clip 0,0 To 320,200
  288. Return 
  289. GECA:
  290.   If F=8 Then BB=0
  291.   If F=9 Then BB=3
  292.   If F=10 Then BB=1
  293.   If F=11 Then BB=2
  294. Return 
  295. Procedure GRABICONS
  296.   Load Iff "Ben4.iff",0
  297.   Screen Offset 0,320,0
  298.   Screen Display 0,128,40,320,264
  299.   Colour 0,0
  300.   ' Floor and Ceiling
  301.   Get Icon 1,0,0 To 176,120
  302.   ' Left Sidewall pieces 
  303.   Get Icon 2,0,120 To 24,240
  304.   Get Icon 3,24,120 To 48,216
  305.   Get Icon 4,48,120 To 64,182
  306.   Get Icon 5,64,120 To 72,160
  307.   Get Icon 66,624,0 To 648,56
  308.   Get Icon 67,648,8 To 664,48
  309.   ' Right Sidewall pieces
  310.   Get Icon 9,72,120 To 80,160
  311.   Get Icon 8,80,120 To 96,182
  312.   Get Icon 7,96,120 To 120,216
  313.   Get Icon 6,120,120 To 144,240
  314.   Get Icon 69,624,64 To 640,104
  315.   Get Icon 68,640,56 To 664,112
  316.   ' Front Walls
  317.   Get Icon 10,176,0 To 304,96
  318.   Get Icon 11,304,0 To 384,60
  319.   Get Icon 12,304,64 To 352,100
  320.   Get Icon 13,352,64 To 384,88
  321.   ' Left Sideteleport pieces 
  322.   Get Icon 14,144,120 To 168,240
  323.   Get Icon 15,168,120 To 192,216
  324.   Get Icon 16,192,120 To 208,182
  325.   Get Icon 17,208,120 To 216,160
  326.   Get Icon 70,624,112 To 648,168
  327.   Get Icon 71,648,120 To 664,160
  328.   ' Right Sideteleport pieces
  329.   Get Icon 21,216,120 To 224,160
  330.   Get Icon 20,224,120 To 240,182
  331.   Get Icon 19,240,120 To 264,216
  332.   Get Icon 18,264,120 To 288,240
  333.   Get Icon 73,624,176 To 640,216
  334.   Get Icon 72,640,168 To 664,224
  335.   ' Front Teleports
  336.   Get Icon 22,384,0 To 512,96
  337.   Get Icon 23,512,0 To 592,60
  338.   Get Icon 24,512,64 To 560,100
  339.   Get Icon 25,560,64 To 592,88
  340.   ' Cases
  341.   X=288 : Y=104 : B=0
  342.   For A=0 To 3
  343.     ' Big Case 
  344.     Get Icon 26+B,X,Y To X+8,Y+80
  345.     Get Icon 27+B,X+8,Y To X+88,Y+80
  346.     Get Icon 28+B,X+88,Y To X+96,Y+80
  347.     ' Medium Case
  348.     Get Icon 29+B,X+96,Y To X+104,Y+52
  349.     Get Icon 30+B,X+104,Y To X+160,Y+52
  350.     Get Icon 31+B,X+160,Y To X+168,Y+52
  351.     ' Small Case 
  352.     Get Icon 32+B,X+96,Y+52 To X+104,Y+80
  353.     Get Icon 33+B,X+104,Y+52 To X+132,Y+80
  354.     Get Icon 34+B,X+132,Y+52 To X+140,Y+80
  355.     Add B,9
  356.     Add X,168 : If X>472 Then X=288 : Add Y,80
  357.   Next 
  358.   ' Case Target  
  359.   Get Icon 62,144,240 To 224,256
  360.   Get Icon 63,224,240 To 264,256
  361.   Get Icon 64,264,240 To 288,256
  362.   ' Wall Button  
  363.   Get Icon 65,176,96 To 216,120
  364.   For A=0 To 15
  365.     Get Icon 74+A,A*8,240 To A*8+8,248
  366.   Next 
  367. End Proc