home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / misc / amoner02.dms / amoner02.adf / Autoexec.AMOS / Autoexec.amosSourceCode next >
Encoding:
AMOS Source Code  |  1988-01-20  |  5.5 KB  |  256 lines

  1. Set Buffer 35
  2. Rem  
  3. Rem Start up Program for Amoner02 - Gal-on Broner. 
  4. Rem
  5.   Screen Open 0,640,200,8,Hires
  6.   Bank Swap 2,3
  7.   Load "Amoner002:Icons.abk",2
  8.   Get Icon Palette 
  9.   Curs Off : Flash Off : Cls 0
  10.   Dim ARTICLE$(2,150)
  11.   Dim LASTLINE(2)
  12.   TEXREAD[1,"Amoner002:Editorial.txt"]
  13.   TEXREAD[2,"Amoner002:Policy.txt"]
  14. Rem
  15. Rem Reserve some zones.
  16. Rem
  17. HANDLE_ZONE:
  18.   BUILD_SCREEN_FACE
  19.   Reserve Zone 
  20.   Reserve Zone 8
  21.   Set Zone 1,10,10 To 300,27
  22.   Set Zone 2,10,10 To 100,100
  23.   Set Zone 3,300,10 To 590,27
  24.   Set Zone 4,500,10 To 590,100
  25.   Set Zone 5,10,100 To 100,190
  26.   Set Zone 6,10,173 To 300,190
  27.   Set Zone 7,500,100 To 590,190
  28.   Set Zone 8,300,173 To 590,190
  29.   Paste Icon 101,28,2
  30. Rem
  31. Rem Check mouse, here we use three vers. 
  32. Rem Past_zone - privous zone 
  33. Rem now_zone - The zone which the mouse is currntly in.
  34. Rem curr_zone - the zone we currently act on...
  35. Rem
  36. CHECKMOUSE:
  37.   NOW_ZONE=0
  38.   PAST_ZONE=0
  39.   Repeat 
  40.     If Mouse Zone<>NOW_ZONE
  41.       PAST_ZONE=NOW_ZONE
  42.       NOW_ZONE=Mouse Zone
  43.       Gosub REDRAW_ZONE
  44.     End If 
  45.   Until Mouse Click
  46. Rem  
  47. Rem moused clicked, Act according to zone. 
  48. Rem
  49. Rem Editorial/policy, new icon 
  50. Rem create new zones 
  51. Rem
  52. If((NOW_ZONE<>1) and(NOW_ZONE<>2)) Then Goto 6
  53.   Ink 0
  54.   Bar 101,28 To 499,172
  55. 4
  56.   Reserve Zone 
  57.   Reserve Zone 3
  58.   Set Zone 1,142,88 To 233,112 : Rem Policy 
  59.   Set Zone 2,355,48 To 482,76 : Rem Editorial
  60.   Set Zone 3,290,137 To 399,168 : Rem Forget it
  61.   Paste Icon 101,28,3
  62. 5
  63.   Repeat : Until Mouse Click
  64.   If Mouse Zone=0 Then Goto 5
  65.   If Mouse Zone=1
  66.     DISPLAY[2]
  67.     Goto 4
  68.   End If 
  69.   If Mouse Zone=2
  70.     DISPLAY[1]
  71.     Goto 4
  72.   End If 
  73.   If Mouse Zone=3 Then Goto HANDLE_ZONE
  74. Rem  
  75. Rem Agraph. Create Agraph temp file and exit.
  76. Rem
  77. 6
  78.   If NOW_ZONE=3 or NOW_ZONE=4
  79.     Open Out 1,"Amoner002:s/Agraph.tmp"
  80.       Print #1,"This is a tmp file."
  81.     Close 1
  82.     End 
  83.   End If 
  84. If((NOW_ZONE<>5) and(NOW_ZONE<>6)) Then Goto 9
  85.   Ink 0
  86.   Bar 101,28 To 499,172
  87. 7
  88.   Reserve Zone 
  89.   Reserve Zone 3
  90.   Set Zone 1,142,88 To 233,112 : Rem Explode  
  91.   Set Zone 2,355,48 To 482,76 : Rem Loan_Calc
  92.   Set Zone 3,290,137 To 399,168 : Rem Forget it
  93.   Paste Icon 101,28,4
  94. 8
  95.   Repeat : Until Mouse Click
  96.   If Mouse Zone=0 Then Goto 8
  97.   If Mouse Zone=1
  98.     Run "Amoner002:Explode.Amos"
  99.   End If 
  100.   If Mouse Zone=2
  101.     Run "Amoner002:LoanCalc.Amos"
  102.   End If 
  103.   If Mouse Zone=3 Then Goto HANDLE_ZONE
  104. 9
  105.   If NOW_ZONE=7 or NOW_ZONE=8
  106.     Run "Amoner002:Gunner.Amos"
  107.   End If 
  108. End 
  109. REDRAW_ZONE:
  110.   If(((NOW_ZONE/2=NOW_ZONE/2.0) and(NOW_ZONE-1=PAST_ZONE)) or((NOW_ZONE/2<>NOW_ZONE/2.0) and(NOW_ZONE+1=PAST_ZONE))) Then Return 
  111. Rem
  112. Rem Erase middle icon if entring or leaving Agraph area. 
  113. Rem
  114.   If NOW_ZONE=3 or NOW_ZONE=4 or PAST_ZONE=3 or PAST_ZONE=4
  115.     Ink 0
  116.     Bar 101,28 To 499,172 : Wait Vbl 
  117.   End If 
  118.   If NOW_ZONE=0
  119.     Paste Icon 101,28,2
  120.     Locate 27,19 : Print "       Quit       "
  121.   End If 
  122.   CURR_ZONE=PAST_ZONE
  123.   Ink 7
  124.   Gosub PA_ZONE
  125.   CURR_ZONE=NOW_ZONE
  126.   Ink 6
  127.   Gosub PA_ZONE
  128. Return 
  129. PA_ZONE:
  130.   If(CURR_ZONE=1 or CURR_ZONE=2)
  131.     Paint 20,20
  132.     If CURR_ZONE=NOW_ZONE
  133.       Paste Icon 101,28,2
  134.       Locate 27,19 : Print "Editorial / Policy"
  135.     End If 
  136.   End If 
  137.   If(CURR_ZONE=3 or CURR_ZONE=4)
  138.     Paint 580,15
  139.     If CURR_ZONE=NOW_ZONE
  140.       Paste Icon 101,28,1
  141.     End If 
  142.   End If 
  143.   If(CURR_ZONE=5 or CURR_ZONE=6)
  144.     Paint 20,180
  145.     If CURR_ZONE=NOW_ZONE
  146.       Paste Icon 101,28,2
  147.       Locate 27,19 : Print "    Tiny Hacks    "
  148.     End If 
  149.   End If 
  150.   If(CURR_ZONE=7 or CURR_ZONE=8)
  151.     Paint 580,170
  152.     If CURR_ZONE=NOW_ZONE
  153.       Paste Icon 101,28,2
  154.       Locate 27,19 : Print "      Gunner      "
  155.     End If 
  156.   End If 
  157. Return 
  158. Procedure BUILD_SCREEN_FACE
  159.   Ink 7
  160.   Bar 10,10 To 590,190
  161.   Ink 1
  162.   Box 10,10 To 590,190
  163.   Draw 300,10 To 300,190
  164.   Draw 10,100 To 590,100
  165.   Ink 0
  166.   Bar 100,27 To 500,173
  167.   Ink 1
  168.   Box 100,27 To 500,173
  169.   Paper 7
  170.   Locate 2,2 : Print "Click"
  171.   Locate 68,2 : Print "Click"
  172.   Locate 2,22 : Print "Click"
  173.   Locate 68,22 : Print "Click"
  174.   Paper 1
  175. End Proc
  176. Procedure TEXREAD[ARTICLE,FILENAME$]
  177. Shared ARTICLE$(),LASTLINE()
  178. LINE=1
  179. Set Input 10,-1
  180. Open In 1,FILENAME$
  181. SEREAD:
  182.   Line Input #1,ARTICLE$(ARTICLE,LINE)
  183.   If Left$(ARTICLE$(ARTICLE,LINE),6)="end..." Then Goto CLFILE
  184.   LINE=LINE+1
  185.   Goto SEREAD
  186. CLFILE:
  187.   Close 1
  188.   ARTICLE$(ARTICLE,LINE)=""
  189.   LASTLINE(ARTICLE)=LINE-1
  190. End Proc
  191. Procedure DISPLAY[ARTICLE]
  192.   Shared ARTICLE$(),LASTLINE()
  193.   Bank Swap 2,3
  194.   Screen Open 1,620,140,16,Hires
  195.   Get Icon Palette 
  196.   Screen Display 1,130,100,,
  197.   Cls 2 : Paper 2 : Pen 0 : Ink 0,2 : Cls 2
  198.   LINE=1
  199. Rem
  200. Rem design display screen
  201. Rem
  202.   Reserve Zone : Wait Vbl 
  203.   Reserve Zone 3
  204.   Set Zone 1,0,102 To 74,139
  205.   Set Zone 2,75,102 To 148,139
  206.   Set Zone 3,160,115 To 218,122
  207.   Draw 0,100 To 640,100
  208.   Draw 230,100 To 230,140
  209.   Text 240,116,"                Text-Reader               "
  210.   Text 240,130,"   By Gal-on Broner, Barbarian Minds 1991."
  211. Rem  
  212. Rem display text on screen 
  213. Rem
  214. TXTDISPLAY:
  215.   Locate 1,1
  216.   For LINECLEAN=1 To 9
  217.     Print Space$(74)
  218.   Next LINECLEAN
  219.   Locate 1,1
  220.   For LINETEXT=LINE To LINE+8
  221.     Print ARTICLE$(ARTICLE,LINETEXT)
  222.   Next LINETEXT
  223. Rem
  224. Rem Display icons
  225. Rem
  226.   Paste Icon 0,102,1
  227.   Paste Icon 160,115,4
  228. Rem
  229. Rem Detect mouse on icons. 
  230. Rem
  231. CLICKER:
  232.   Repeat : Until Mouse Click
  233.   If Mouse Zone=1
  234.     Paste Icon 0,102,2
  235.     LINE=LINE+9
  236.     If LINE>LASTLINE(ARTICLE)
  237.       LINE=LINE-9
  238.     End If 
  239.     Goto TXTDISPLAY
  240.   End If 
  241.   If Mouse Zone=2
  242.     Paste Icon 90,102,3
  243.     LINE=LINE-9
  244.     If LINE<1
  245.       LINE=LINE+9
  246.     End If 
  247.     Goto TXTDISPLAY
  248.   End If 
  249.   If Mouse Zone=3
  250.     Screen Close 1
  251.     Get Palette 0
  252.     Bank Swap 2,3
  253.     Pop Proc
  254.   End If 
  255. Goto CLICKER
  256. End Proc