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

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