home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDRenderers / RenderAsHAM.fred.pre < prev    next >
Encoding:
Text File  |  1994-01-31  |  5.7 KB  |  283 lines

  1. /*
  2. ** RenderAsHAM.fred.pre
  3. **
  4. ** $VER: RenderAsHAM.fred.pre 1.3.0 (24.10.93)
  5. **
  6. ** If the RenderAsHAM.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user to select a screen mode and
  8. ** dither type into which the images will be rendered.
  9. **
  10. ** Clips Exported:
  11. **    FREDScreenType        -    Screen type to be used
  12. **    FREDDither        -    Dither to be used
  13. **    FREDDitherAmt        -    Dither amount to be used
  14. **    FREDHAMType        -    Use HAM or HAM8
  15. **
  16. ** NOTE: Clip names are case sensitive.
  17. **
  18. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  19. ** ADPro v2.5.0 (or higher).
  20. **
  21. ** Copyright © 1992-1993 ASDG, Incorporated
  22. ** All Rights Reserved
  23. */
  24.  
  25.  
  26. ADDRESS "ADPro"
  27. OPTIONS RESULTS
  28.  
  29. PARSE ARG NumberOfCells NumberOfFrames
  30.  
  31. NL = '0A'X
  32. SQ = '27'X
  33. DQ = '22'X
  34. TRUE  = 1
  35. FALSE = 0
  36.  
  37.  
  38. /*
  39. ** Ask the user to select the screen mode.
  40. */
  41.  
  42.  
  43.     /*
  44.     ** Select the horizontal resolution.
  45.     */
  46.  
  47. HorizSize.1  = "Low Res"
  48. HorizSize.2  = "High Res"
  49. HorizSize.3  = "Super High Res"
  50. MinHorizSize = 1
  51. MaxHorizSize = 3
  52. DefHorizSize = 1
  53.  
  54. String = '"' || HorizSize.DefHorizSize || '"'
  55. DO LoopCounter = MinHorizSize TO MaxHorizSize
  56.     String = String '"' || HorizSize.LoopCounter || '"'
  57. END
  58.  
  59. continue = 0
  60. DO UNTIL (continue = 1)
  61.     ADPRO_TO_FRONT
  62.  
  63.     LISTVIEW '"Horiz. Resolutions:"' (MaxHorizSize-MinHorizSize+1) ITEMS String
  64.     LISTVIEW_RC = RC
  65.     PARSE VAR ADPRO_RESULT '"'HorizSizeStr'"' scratch
  66.  
  67.     HorizRes = MinHorizSize
  68.     DO WHILE (HorizRes <= MaxHorizSize) & (COMPARE( HorizSizeStr, HorizSize.HorizRes ) ~= 0)
  69.         HorizRes = HorizRes + 1
  70.     END
  71.  
  72.     IF (LISTVIEW_RC ~= 0) & (LISTVIEW_RC ~= 1) THEN DO
  73.         ADPRO_TO_FRONT
  74.  
  75.         OKAYN '"RenderAsHAM.fred"' '"This value is required."' '"Retry|Cancel"'
  76.         IF (RC = 0) THEN
  77.             EXIT 10
  78.     END
  79.     ELSE
  80.         continue = 1
  81. END
  82.  
  83. ADPRO_TO_FRONT
  84.  
  85. OKAYN '"RenderAsHAM.fred"' '"Enable Horizontal Overscan?"' '"Overscan|Non-Overscan|Cancel"'
  86. IF (RC = 0) THEN DO
  87.     ADPRO_TO_FRONT
  88.     OKAY1 "Process aborted."
  89.     SCREEN_TO_FRONT "FRED"
  90.     EXIT 10
  91. END
  92. ELSE
  93.     HorizOscan = 2 - RC
  94.  
  95.  
  96.     /*
  97.     ** Select the monitor.
  98.     */
  99.  
  100. GETLIST MONITORS
  101. String = ADPRO_RESULT
  102. IF (RC ~= 0) THEN DO
  103.     ADPRO_TO_FRONT
  104.     OKAY1 "Could not retrieve" || NL ||,
  105.         "monitor list."
  106.     SCREEN_TO_FRONT "FRED"
  107.     EXIT 10
  108. END
  109.  
  110. continue = 0
  111. DO UNTIL (continue = 1)
  112.     ADPRO_TO_FRONT
  113.  
  114.     LISTVIEW '"Monitors Available:"' 10 ITEMS String
  115.     LISTVIEW_RC = RC
  116.     PARSE VAR ADPRO_RESULT '"'Monitor'"' scratch
  117.  
  118.     IF (LISTVIEW_RC ~= 0) & (LISTVIEW_RC ~= 1) THEN DO
  119.         ADPRO_TO_FRONT
  120.  
  121.         OKAYN '"RenderAsHAM.fred"' '"This value is required."' '"Retry|Cancel"'
  122.         IF (RC = 0) THEN
  123.             EXIT 10
  124.     END
  125.     ELSE
  126.         continue = 1
  127. END
  128.  
  129. ADPRO_TO_FRONT
  130.  
  131. OKAYN '"RenderAsHAM.fred"' '"Enable Interlace?"' '"Interlace|Non-Interlace|Cancel"'
  132. IF (RC = 0) THEN DO
  133.     ADPRO_TO_FRONT
  134.     OKAY1 "Process aborted."
  135.     SCREEN_TO_FRONT "FRED"
  136.     EXIT 10
  137. END    
  138. ELSE
  139.     VertLace = 2 - RC
  140.  
  141. ADPRO_TO_FRONT
  142.  
  143. OKAYN '"RenderAsHAM.fred"' '"Enable Vertical Overscan?"' '"Overscan|Non-Overscan|Cancel"'
  144. IF (RC = 0) THEN DO
  145.     ADPRO_TO_FRONT
  146.     OKAY1 "Process aborted."
  147.     SCREEN_TO_FRONT "FRED"
  148.     EXIT 10
  149. END
  150. ELSE
  151.     VertOscan = 2 - RC
  152.  
  153.  
  154.     /*
  155.     ** Now build the SCREEN_TYPE value.
  156.     */
  157.  
  158. ScreenType = 0
  159.  
  160. IF (HorizRes = 2) THEN                /* High Res */
  161.     ScreenType = ScreenType + 1
  162. ELSE IF (HorizRes = 3) THEN            /* Super High Res */
  163.     ScreenType = ScreenType + 64
  164.  
  165. IF (HorizOscan = 1) THEN            /* Horizontal Overscan */
  166.     ScreenType = ScreenType + 8
  167.  
  168. IF (Monitor = "DFLT") THEN            /* DFLT */
  169.     ScreenType = ScreenType + 256
  170. ELSE IF (Monitor = "PAL") THEN            /* PAL */
  171.     ScreenType = ScreenType + 4
  172. ELSE IF (Monitor = "VGA") THEN            /* VGA */
  173.     ScreenType = ScreenType + 32
  174. ELSE IF (Monitor = "SUP72") THEN        /* SUP72 */
  175.     ScreenType = ScreenType + 128
  176.  
  177. IF (VertLace = 1) THEN                /* Interlace */
  178.     ScreenType = ScreenType + 2
  179.  
  180. IF (VertOscan = 1) THEN                /* Vertical Overscan */
  181.     ScreenType = ScreenType + 16
  182.  
  183.  
  184. /*
  185. ** Ask the user to render as HAM(6) or HAM8.
  186. */
  187.  
  188. ADPRO_TO_FRONT
  189.  
  190. OKAYN '"RenderAsHAM.fred"' '"Choose HAM Type"' '"HAM|HAM8|Cancel"'
  191. IF (RC = 0) THEN DO
  192.     ADPRO_TO_FRONT
  193.     OKAY1 "Process aborted."
  194.     SCREEN_TO_FRONT "FRED"
  195.     EXIT 10
  196. END
  197. ELSE IF (RC = 1) THEN
  198.     HamType = "HAM"
  199. ELSE IF (RC = 2) THEN
  200.     HamType = "HAM8"
  201.  
  202.  
  203. /*
  204. ** Ask the user to select the dither mode to use.
  205. */
  206.  
  207. GETLIST DITHERS
  208. String = ADPRO_RESULT
  209. IF (RC ~= 0) THEN DO
  210.     ADPRO_TO_FRONT
  211.     OKAY1 "Could not retrieve" || NL ||,
  212.         "dither list."
  213.     SCREEN_TO_FRONT "FRED"
  214.     EXIT 10
  215. END
  216.  
  217. continue = 0
  218. DO UNTIL (continue = 1)
  219.     ADPRO_TO_FRONT
  220.  
  221.     LISTVIEW '"Dithers Available:"' 10 ITEMS String
  222.     LISTVIEW_RC = RC
  223.     PARSE VAR ADPRO_RESULT '"'DitherModeStr'"' scratch
  224.  
  225.     IF (LISTVIEW_RC ~= 0) & (LISTVIEW_RC ~= 1) THEN DO
  226.         ADPRO_TO_FRONT
  227.  
  228.         OKAYN '"RenderAsHAM.fred"' '"This value is required."' '"Retry|Cancel"'
  229.         IF (RC = 0) THEN
  230.             EXIT 10
  231.     END
  232.     ELSE
  233.         continue = 1
  234. END
  235.  
  236. IF (DitherModeStr = "Off") THEN            /* Off */
  237.     DitherMode = 0
  238. ELSE IF (DitherModeStr = "Floyd (1)") THEN    /* Floyd (1) */
  239.     DitherMode = 1
  240. ELSE IF (DitherModeStr = "Burkes (2)") THEN    /* Burkes (2) */
  241.     DitherMode = 2
  242. ELSE IF (DitherModeStr = "Sierra (3)") THEN    /* Sierra (3) */
  243.     DitherMode = 3
  244. ELSE IF (DitherModeStr = "Jarvis (4)") THEN    /* Jarvis (4) */
  245.     DitherMode = 4
  246. ELSE IF (DitherModeStr = "Stucki (5)") THEN    /* Stucki (5) */
  247.     DitherMode = 5
  248. ELSE IF (DitherModeStr = "Random (6)") THEN    /* Random (6) */
  249.     DitherMode = 6
  250. ELSE IF (DitherModeStr = "Lg Ord (7)") THEN    /* Lg Ord (7) */
  251.     DitherMode = 7
  252. ELSE IF (DitherModeStr = "Sm Ord (8)") THEN    /* Sm Ord (8) */
  253.     DitherMode = 8
  254. ELSE
  255.     DitherMode = 0
  256.  
  257.  
  258. /*
  259. ** If dither is Random or Ordered, get the Dither Amount.
  260. */
  261.  
  262. IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
  263.     CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Enter Dither Amount"' 16 1 256 TRUE
  264.     IF (RESULT = (1-1)) THEN
  265.         EXIT 10
  266.     DitherAmt = RESULT
  267.  
  268.     SETCLIP( "FREDDitherAmt", DitherAmt )
  269. END
  270.  
  271. SCREEN_TO_FRONT "FRED"
  272.  
  273.  
  274. /*
  275. ** Update the clips.
  276. */
  277.  
  278. SETCLIP( "FREDScreenType", ScreenType )
  279. SETCLIP( "FREDDither", DitherMode )
  280. SETCLIP( "FREDHAMType", HamType )
  281.  
  282. EXIT 0
  283.