home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / atari / 8bit / 5962 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  5.8 KB

  1. Path: sparky!uunet!well!moon!cyberden!anyone
  2. From: anyone@cyberden.sf.ca.us
  3. Newsgroups: comp.sys.atari.8bit
  4. Subject: POLYB.ACT
  5. Message-ID: <kyyyXB3w165w@cyberden.sf.ca.us>
  6. Date: Mon, 25 Jan 93 21:40:43 PST
  7. Reply-To: anyone@cyberden.sf.ca.us
  8. Organization: Indescribable Creations
  9. Lines: 183
  10.  
  11. Ran outta time last time.  Using alternate account:  POLYB.ACTion! 
  12. follows:
  13.  
  14. ; PolyB.ACT  - Action! version of PolyB.C
  15. ; programmed by Scott0LaValley in C "IHOL" BBS 1993
  16. ; translated to Action! by Bill Kendrick, NBS 1993
  17.  
  18. ; fully commented!!!  :)
  19.  
  20. ; global declarations: (can be used anywhere)
  21. Byte InternalKeyAddress=764, ; Address of internal key value
  22.   ColrReg1=708,ColrReg2=709,ColrReg3=710,
  23.   LMar=82,RMar=83,Chg
  24. Char Array SpeedCh(5),Buffer(25),ClearCh(5)
  25. Int Dimensiona=[160],Dimensionb=[192],j,
  26.   Colr,Speed,i,Compare,Echo,Clear,e,f,a,
  27.   b,x,y,h,k,IncrementA,IncrementB,
  28.   IncrementC,IncrementD,ea,fa,ab,bb,xc,
  29.   yc,hd,kd,jv
  30. Card ScreenMem=88 ; screen memory pointer
  31.  
  32.  
  33.  
  34. ; following is Function "Key", which returns Byte values...
  35. Byte Func Key() ; Replaces "KbHit" function in C
  36.   If InternalKeyAddress=255 Then Return(0) Fi ; No keys hit
  37.   InternalKeyAddress=255 ; Clear it...
  38. Return(1) ; Otherwise, someone hit something
  39.  
  40.  
  41. Proc ScreenOn()
  42.   Graphics(31) ; 160 x 192 x 4 - no text window
  43.   SetColor(0,1,14) ; bright yellow   /
  44.   SetColor(1,12,8) ; medium green   < default colors
  45.   SetColor(2,4,2) ; dark red         \
  46.   ; (the SetColor commands effect the ColrReg_ values, at addresses 708, 
  47. 709, 710)
  48. Return
  49.  
  50.  
  51. Proc Rotate() ; Rotates colors
  52. Byte C1,C2,C3 ; I added this myself
  53.   C1=ColrReg1 ; color 1
  54.   C2=ColrReg2 ; color 2
  55.   C3=ColrReg3 ; color 3
  56.   If Chg=0 Then C1=Rand(256) Fi ; Insert random color
  57.   ColrReg1=C2
  58.   ColrReg2=C3
  59.   ColrReg3=C1
  60. Return
  61.  
  62.  
  63. ; following is Function "Inp" (input), which returns Int(eger) values...
  64. Int Func Inp(Int Default) ; Inputs from user, null input results in 
  65. returning of default value
  66. Int UserVal
  67.   Print(" (") PrintI(Default) Print("):") ; show default value in ()'s
  68.   InternalKeyAddress=255
  69.   Do ; Repeat
  70.     ; NADA
  71.   Until InternalKeyAddress<255 Od ; wait for key... (don't clear tho!!)
  72.   If InternalKeyAddress<>12 Then ; didn't hit [RETURN]
  73.     UserVal=InputI()
  74.     Return(UserVal)
  75.   Fi
  76.   ; did hit [RETURN]
  77.   PrintIE(Default)
  78. Return(Default)
  79.  
  80.  
  81. Proc GetData() ; get data from user (or use default data)
  82.   PutE() PrintE("Return alone selects defaults (in '()'s)")
  83.   Print("Point 1 Increment?") ; speed values
  84.   IncrementA=Inp(2)
  85.   Print("Point 2 Increment?")
  86.   IncrementB=Inp(4)
  87.   Print("Point 3 Increment?")
  88.   IncrementC=Inp(6)
  89.   Print("Point 4 Increment?")
  90.   IncrementD=Inp(8)
  91.   Print("Echo? (0=yes, 1=no)") ; leave trail?
  92.   Echo=Inp(0)
  93.   Print("Clear speed?") ; clear screen ever ?th count
  94.   Clear=Inp(500)
  95.   Print("Insert colors? (0=yes, 1=no)") ; insert random colors every 
  96. color rotate?
  97.   Chg=Inp(0)
  98.   Print("Color change speed? (1=fast)") ; change speed every ?th count
  99.   JV=Inp(10)
  100.   InternalKeyAddress=255
  101. Return
  102.  
  103.  
  104. ; - main -
  105.  
  106. Proc Main() ; the main loop!
  107.   ; title:
  108.   Graphics(0) LMar=0 RMar=39 ColrReg2=15 ColrReg3=0 ; text mode, white 
  109. text, black bkgd
  110.   PrintE("PolyBounce Version 1.0 by Scott LaValley") PutE()
  111.   PrintE("The International House of LeeChes") PrIntE("415-897-8190") 
  112. PutE() PutE()
  113.   PrintE("Converted to Action! by Bill Kendrick") PutE()
  114.   PrintE("NBS 1993")
  115.   GetData()
  116.   j=0 Colr=1
  117.  
  118.   ; startup:
  119.   ScreenOn()
  120.   Color=1 ; (not same as "Colr".. "Colr" is variable, "Color" is system 
  121. command!!!)
  122.   e=Rand(50)  f=Rand(20)
  123.   a=Rand(175) b=Rand(200)
  124.   x=Rand(22)  y=Rand(97)
  125.   h=Rand(3)   k=Rand(125)
  126.   ea=2  fa=2
  127.   ab=-3 bb=-3
  128.   xc=5 ; where's yc Scott?
  129.   hd=-7 kd=-7
  130.  
  131.   ; main loop:
  132.   While Key()=0 Do ; while nobody hits a key, do ALL of this stuff!:
  133.     j=j+1 ; increase 'J' counter
  134.     If J Mod JV=0 Then Colr=Colr+1 Fi ; every 'JV'th count, change color
  135.     If Colr=4 Then ; every 4th color, roll over to 0 & rotate colors
  136.       Colr=0 Rotate()
  137.       If Echo=1 And Colr=0 Then Colr=1 Fi
  138.     Fi
  139.  
  140.     ; erase line if need be (move above update so it won't be DIRECTLY 
  141. after last draw... thus replacing the Pause()
  142.     If Echo<>0 Then ; routine from the C version)
  143.       SetBlock(ScreenMem,7680,0) ; note: this replaces a bunch of plot's 
  144. and DrawTo's by simply clearing screen memory     
  145.     Fi ; FAST! (7680=bytes of RAM used by screen)
  146.  
  147.     ; update (move) the points' positions:
  148.     e=e+ea ; point position updaters moved ABOVE IF-tests so any moves 
  149. off of screen will be caught
  150.     f=f+fa ; BEFORE draw, rather than before MOVE and THEN draw.... (get 
  151. it?!)
  152.     If e<=1 Then E=1 ea=IncrementA Fi
  153.     If f<=1 Then F=1 fa=IncrementA Fi
  154.     If e>=DimensionA-1 Then E=DimensionA-1 ea=-IncrementA Fi
  155.     If f>=Dimensionb-1 Then F=DimensionB-1 fa=-IncrementA Fi
  156.  
  157.     a=a+ab b=b+bb
  158.     If a<=1 Then A=1 ab=IncrementB Fi
  159.     If b<=1 Then B=1 bb=IncrementB Fi
  160.     If a>=Dimensiona-1 Then A=DimensionA-1 ab=-IncrementB Fi
  161.     If b>=Dimensionb-1 Then B=DimensionB-1 bb=-IncrementB Fi
  162.  
  163.     x=x+xc y=y+yc
  164.     If x<=1 Then X=1 xc=IncrementC Fi
  165.     If y<=1 Then Y=1 yc=IncrementC Fi
  166.     If x>=Dimensiona-1 Then X=DimensionA-1 xc=-IncrementC Fi
  167.     If y>=Dimensionb-1 Then Y=DimensionB-1 yc=-IncrementC Fi
  168.  
  169.     h=h+hd k=k+kd
  170.     If h<=1 Then H=1 hd=IncrementD Fi
  171.     If k<=1 Then K=1 kd=IncrementD Fi
  172.     If h>=Dimensiona-1 Then H=DimensionA-1 hd=-IncrementD Fi
  173.     If k>=Dimensionb-1 Then K=DimensionB-1 kd=-IncrementD Fi
  174.  
  175.     ; draw the lines:
  176.     Color=Colr
  177.     Plot(e,f) ; start line ...
  178.     DrawTo(a,b) ; draw ...
  179.     DrawTo(x,y) ; draw ...
  180.     DrawTo(h,k) ; draw ...
  181.     DrawTo(e,f) ; draw (connect to start)
  182.  
  183.     If j Mod Clear=0 And Echo=0 Then ScreenOn() Color=Colr Fi ; clear 
  184. screen (every 'Clear'th count)
  185.   Od ; end of loop
  186.  
  187.   Graphics(0) ; back to mode 0 and ...
  188. Return ; ...the end!
  189.  
  190.  
  191. __________________________________________________________________________
  192.    |       /         |\
  193.    | H E   \ Y B E R |/ E N            [ anyone@cyberden.sf.ca.us ]
  194.