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

  1. /*
  2. ** RenderAsHAM.fred
  3. **
  4. ** $VER: RenderAsHAM.fred 1.2.0 (24.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to convert images
  7. ** into HAM.  Including this program automatically causes a pre program
  8. ** to be executed as well (to select the screen modes).
  9. **
  10. ** Clips Imported:
  11. **    FREDScreenType        -    Screen type to be used
  12. **    FREDLockPalette        -     ~0 if locked palette wanted
  13. **                    0  if floating palette wanted
  14. **                    defined in a SaveAs pre script
  15. **    FREDDither        -    Which dither to use
  16. **    FREDDitherAmt        -    Dither amount to be used
  17. **    FREDHAMType        -    Render as HAM(6) or HAM8
  18. **
  19. ** NOTE: Clip names are case sensitive.
  20. **
  21. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  22. ** ADPro v2.5.0 (or higher).
  23. **
  24. ** Copyright © 1992-1993 ASDG, Incorporated
  25. ** All Rights Reserved
  26. */
  27.  
  28.  
  29. ADDRESS "ADPro"
  30. OPTIONS RESULTS
  31.  
  32. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  33.  
  34. NL = '0A'X
  35. SQ = '27'X
  36. DQ = '22'X
  37. TRUE  = 1
  38. FALSE = 0
  39.  
  40.  
  41. /*
  42. ** If the definition of PaletteFile should change for any reason, change it
  43. ** also in the SaveAs post script which cleans up the file if it is present.
  44. */
  45.  
  46. PaletteFile = "T:TempPalette"
  47.  
  48.  
  49. /*
  50. ** Get the required clips.
  51. **
  52. ** See if FREDLockPalette was previously defined.  It will be if we are
  53. ** making an ANIM, for example.  Set it to false if FREDLockPalette was not
  54. ** found.
  55. */
  56.  
  57. PaletteFlag = GETCLIP( "FREDLockPalette" )
  58. IF (PaletteFlag = "") THEN
  59.     PaletteFlag = 0
  60.  
  61. ScreenType = GETCLIP( "FREDScreenType" )
  62. IF (ScreenType = "") THEN DO
  63.     ADPRO_TO_FRONT
  64.     OKAY1 "Required clip, FREDScreenType," || NL ||,
  65.         "is not specified."
  66.         SCREEN_TO_FRONT "FRED"
  67.     EXIT 10
  68. END
  69.  
  70. DitherMode = GETCLIP( "FREDDither" )
  71. IF (DitherMode = "") THEN DO
  72.     ADPRO_TO_FRONT
  73.     OKAY1 "Required clip, FREDDither," || NL ||,
  74.         "is not specified."
  75.     SCREEN_TO_FRONT "FRED"
  76.     EXIT 10
  77. END
  78. ELSE IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
  79.     DitherAmt = GETCLIP( "FREDDitherAmt" )
  80.     IF (DitherAmt = "") THEN DO
  81.         ADPRO_TO_FRONT
  82.         OKAY1 "Required clip, FREDDitherAmt," || NL ||,
  83.             "is not specified."
  84.         SCREEN_TO_FRONT "FRED"
  85.         EXIT 10
  86.     END
  87. END
  88.  
  89. HamType = GETCLIP( "FREDHAMType" )
  90. IF (HamType = "") THEN DO
  91.     ADPRO_TO_FRONT
  92.     OKAY1 "Required clip, FREDHAMType," || NL ||,
  93.         "is not specified."
  94.     SCREEN_TO_FRONT "FRED"
  95.     EXIT 10
  96. END
  97.  
  98.  
  99. /*
  100. ** See what type of data is loaded in ADPro/MorphPlus.
  101. */
  102.  
  103. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  104. IF (RESULT ~= 0) THEN
  105.     EXIT 10
  106.  
  107.  
  108. /*
  109. ** If this isn't the first call then we may have to load a predefined palette.
  110. */
  111.  
  112. IF ((FirstCallSeq = 0) & (PaletteFlag ~= 0)) THEN DO
  113.     PSTATUS "UNLOCKED"
  114.     PLOAD PaletteFile
  115.     IF (RC ~= 0) THEN DO
  116.         ADPRO_TO_FRONT
  117.         OKAY1 "Loading of temp palette failed." || NL ||,
  118.             "Argument Information:" || NL ||,
  119.             "Filename = " || PaletteFile
  120.         SCREEN_TO_FRONT "FRED"
  121.         EXIT 10
  122.     END
  123.     PSTATUS "LOCKED"
  124. END
  125.  
  126.  
  127. /*
  128. ** Do the conversion.
  129. */
  130.  
  131. SCREEN_TYPE ScreenType
  132. IF (RC ~= 0) THEN DO
  133.     ADPRO_TO_FRONT
  134.     OKAY1 "Screen mode not supported." || NL || ADPRO_RESULT
  135.     SCREEN_TO_FRONT "FRED"
  136.     EXIT 10
  137. END
  138.  
  139. RENDER_TYPE HamType
  140. IF (RC ~= 0) THEN DO
  141.     ADPRO_TO_FRONT
  142.     OKAY1 "Render mode not supported." || NL || ADPRO_RESULT
  143.     SCREEN_TO_FRONT "FRED"
  144.     EXIT 10
  145. END
  146.  
  147. DITHER DitherMode
  148. IF (RC ~= 0) THEN DO
  149.     ADPRO_TO_FRONT
  150.     OKAY1 "Dither mode not supported." || NL || ADPRO_RESULT
  151.         SCREEN_TO_FRONT "FRED"
  152.     EXIT 10
  153. END
  154.  
  155. IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
  156.     DITHER_AMOUNT DitherAmt
  157.     IF (RC ~= 0) THEN DO
  158.         ADPRO_TO_FRONT
  159.         OKAY1 "Dither amount not supported." || NL || ADPRO_RESULT
  160.         SCREEN_TO_FRONT "FRED"
  161.         EXIT 10
  162.     END
  163. END
  164.  
  165. EXECUTE
  166. IF (RC ~= 0) THEN DO
  167.     ADPRO_TO_FRONT
  168.     OKAY1 "Rendering into" || NL ||,
  169.         "HAM" || " color mode failed."
  170.     SCREEN_TO_FRONT "FRED"
  171.     EXIT 10
  172. END
  173.  
  174. PSTATUS "UNLOCKED"
  175.  
  176.  
  177. /*
  178. ** If this IS first call and we want a locked palette, we need to save one.
  179. */
  180.  
  181. IF ((FirstCallSeq ~= 0) & (PaletteFlag ~= 0)) THEN DO
  182.     PSAVE PaletteFile
  183.     IF (RC ~= 0) THEN DO
  184.         ADPRO_TO_FRONT
  185.         OKAY1 "Saving of temp palette failed." || NL ||,
  186.             "Argument Information:" || NL ||,
  187.             "Filename = " || PaletteFile
  188.         SCREEN_TO_FRONT "FRED"
  189.         EXIT 10
  190.     END
  191. END
  192.  
  193. EXIT 0
  194.