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

  1. /*
  2. ** SaveToDP4ANIM.fred.post
  3. **
  4. ** $VER: SaveToDP4ANIM.fred.post 1.1.0 (24.10.93)
  5. **
  6. ** If the SaveToDP4ANIM.fred script appears in the InvokeADPro list,
  7. ** this program will adjust up the current DPaint IV AGA ANIM to its
  8. ** proper length.
  9. **
  10. ** Clips Imported:
  11. **    FREDDP4ANIMOverwrite        -    ~0 if the current ANIM should be overwritten
  12. **                        0 if it should be appended to
  13. **    FREDDP4ANIMOrigNumFrames    -    Original number of ANIM frames in
  14. **                        DPaint before this script is executed
  15. **    FREDLockPalette            -     ~0 if user wanted a locked palette
  16. **                    -    0 if not
  17. **
  18. ** NOTE: Clip names are case sensitive.
  19. **
  20. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  21. ** ADPro v2.5.0 (or higher).
  22. **
  23. ** Copyright © 1993 ASDG, Incorporated
  24. ** All Rights Reserved
  25. */
  26.  
  27.  
  28. ADDRESS "ADPro"
  29. OPTIONS RESULTS
  30.  
  31. NL = '0A'X
  32. SQ = '27'X
  33. DQ = '22'X
  34. TRUE  = 1
  35. FALSE = 0
  36. PaletteFile = "T:TempPalette"
  37.  
  38.  
  39. /*
  40. ** Get the required clips.  Error if any are missing.
  41. */
  42.  
  43. Overwrite = GETCLIP( "FREDDP4ANIMOverwrite" )
  44. IF (Overwrite = "") THEN DO
  45.     ADPRO_TO_FRONT
  46.     OKAY1 "Required clip, FREDDP4ANIMOverwrite," || NL ||,
  47.         "is not specified."
  48.     SCREEN_TO_FRONT "FRED"
  49.     EXIT 10
  50. END
  51.  
  52. OrigNumFrames = GETCLIP( "FREDDP4ANIMOrigNumFrames" )
  53. IF (OrigNumFrames = "") THEN DO
  54.     ADPRO_TO_FRONT
  55.     OKAY1 "Required clip, FREDDP4ANIMOrigNumFrames," || NL ||,
  56.         "is not specified."
  57.     SCREEN_TO_FRONT "FRED"
  58.     EXIT 10
  59. END
  60.  
  61. PaletteFlag = GETCLIP( "FREDLockPalette" )
  62. IF (PaletteFlag = "") THEN DO
  63.     ADPRO_TO_FRONT
  64.     OKAY1 "Required clip, FREDLockPalette," || NL ||,
  65.         "is not specified."
  66.     SCREEN_TO_FRONT "FRED"
  67.     EXIT 10
  68. END
  69.  
  70.  
  71. /*
  72. ** Delete the extra frame (for overwrites only).
  73. */
  74.  
  75. IF (Overwrite ~= 0) THEN DO
  76.     /*
  77.     ** CAUTION...KLUDGE AHEAD
  78.     **
  79.     ** This should actually only be FNum = 1, but there seems to be
  80.     ** a problem with DPaint giving an error when trying to delete page 2 of
  81.     ** a 2 page ANIM, so 2 frames need to stay from the previous ANIM.
  82.     **
  83.     ** This kludge should still work when/if a fixed version of DPaint is used
  84.     ** with this script, since the error condition is always avoided.
  85.     */
  86.  
  87.     IF (OrigNumFrames = 1) THEN
  88.         FNum = 1
  89.     ELSE
  90.         FNum = 2
  91. END
  92. ELSE DO
  93.     IF (OrigNumFrames = 1) THEN
  94.         FNum = 1
  95.     ELSE
  96.         FNum = 0
  97. END
  98.  
  99. DO WHILE (FNum > 0)
  100.     SAVER "DPAINT" "XXX" "IMAGE" "DELETE" FNum
  101.     IF (RC ~= 0) THEN DO
  102.         Why = ADPRO_RESULT
  103.         ADPRO_TO_FRONT
  104.         OKAY1 "Removal of ANIM frame " || FNum || NL ||,
  105.             "failed:" || NL || Why
  106.         SCREEN_TO_FRONT "FRED"
  107.     END
  108.  
  109.     FNum = FNum - 1
  110. END
  111.  
  112.  
  113. /*
  114. ** Delete the palette file, if it was defined and used.
  115. */
  116.  
  117. IF ((PaletteFlag ~= "") & (PaletteFlag ~= 0)) THEN
  118.     ADDRESS COMMAND "Delete >NIL:" PaletteFile
  119.  
  120. EXIT 0
  121.