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

  1. /*
  2. ** RenderAsDefined.fred
  3. **
  4. ** $VER: RenderAsDefined.fred 1.3.0 (30.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to convert images
  7. ** into the user-defined screen settings.  Including this program
  8. ** automatically causes a pre program to be executed as well (to select
  9. ** the screen modes).
  10. **
  11. ** Clips Imported:
  12. **    FREDRenderScreen    -    Render screen to use
  13. **    FREDDither        -    Dither to be used
  14. **    FREDDitherAmt        -    Dither amount to be used
  15. **    FREDLockPalette        -     ~0 if locked palette wanted
  16. **                    0  if floating palette wanted
  17. **                    defined in a SaveAs pre script
  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. RenderScreen = GETCLIP( "FREDRenderScreen" )
  62. IF (RenderScreen = "") THEN DO
  63.     ADPRO_TO_FRONT
  64.     OKAY1 "Required clip, FREDRenderScreen," || 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.  
  90. /*
  91. ** See what type of data is loaded in ADPro/MorphPlus.
  92. */
  93.  
  94. CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  95. IF (RESULT ~= 0) THEN
  96.     EXIT 10
  97.  
  98.  
  99. /*
  100. ** If this isn't the first call then we may have to load a predefined palette.
  101. */
  102.  
  103. IF ((FirstCallSeq = 0) & (PaletteFlag ~= 0)) THEN DO
  104.     PSTATUS "UNLOCKED"
  105.     PLOAD PaletteFile
  106.     IF (RC ~= 0) THEN DO
  107.         ADPRO_TO_FRONT
  108.         OKAY1 "Loading of temp palette failed." || NL ||,
  109.             "Argument Information:" || NL ||,
  110.             "Filename = " || PaletteFile
  111.         SCREEN_TO_FRONT "FRED"
  112.         EXIT 10
  113.     END
  114.     PSTATUS "LOCKED"
  115. END
  116.  
  117.  
  118. /*
  119. ** Do the conversion.
  120. */
  121.  
  122. SET_RENDER_MODE RenderScreen
  123. IF (RC ~= 0) THEN DO
  124.     ADPRO_TO_FRONT
  125.     OKAY1 "Could not set render screen:" || NL || RenderScreen
  126.     SCREEN_TO_FRONT "FRED"
  127.     EXIT 10
  128. END
  129.  
  130. DITHER DitherMode
  131. IF (RC ~= 0) THEN DO
  132.     ADPRO_TO_FRONT
  133.     OKAY1 "Dither mode not supported." || NL || ADPRO_RESULT
  134.         SCREEN_TO_FRONT "FRED"
  135.     EXIT 10
  136. END
  137.  
  138. IF (DitherMode = 6) | (DitherMode = 7) | (DitherMode = 8) THEN DO
  139.     DITHER_AMOUNT DitherAmt
  140.     IF (RC ~= 0) THEN DO
  141.         ADPRO_TO_FRONT
  142.         OKAY1 "Dither amount not supported." || NL || ADPRO_RESULT
  143.         SCREEN_TO_FRONT "FRED"
  144.         EXIT 10
  145.     END
  146. END
  147.  
  148. EXECUTE
  149. IF (RC ~= 0) THEN DO
  150.     ADPRO_TO_FRONT
  151.     OKAY1 "Rendering into" || NL ||,
  152.         RenderType || " color mode failed."
  153.     SCREEN_TO_FRONT "FRED"
  154.     EXIT 10
  155. END
  156.  
  157. PSTATUS "UNLOCKED"
  158.  
  159.  
  160. /*
  161. ** If this IS first call and we want a locked palette, we need to save one.
  162. */
  163.  
  164. IF ((FirstCallSeq ~= 0) & (PaletteFlag ~= 0)) THEN DO
  165.     PSAVE PaletteFile
  166.     IF (RC ~= 0) THEN DO
  167.         ADPRO_TO_FRONT
  168.         OKAY1 "Saving of temp palette failed." || NL ||,
  169.             "Argument Information:" || NL ||,
  170.             "Filename = " || PaletteFile
  171.         SCREEN_TO_FRONT "FRED"
  172.         EXIT 10
  173.     END
  174. END
  175.  
  176. EXIT 0
  177.