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

  1. /*
  2. ** SaveToDP4ANIM.fred.pre
  3. **
  4. ** $VER: SaveDP4ANIM.fred.pre 1.1.0 (24.10.93)
  5. **
  6. ** If the SaveToDP4ANIM.fred script appears in the InvokeADPro list,
  7. ** this program will ask the user whether the current DPaint IV AGA ANIM
  8. ** frames (whether any exist or not) should be deleted before appending
  9. ** the currently selected frames.
  10. **
  11. ** If they fail to answer, the InvokeADPro list will be aborted.
  12. **
  13. ** Clips Exported:
  14. **    FREDDP4ANIMOverwrite        -    ~0 if the current ANIM should be overwritten
  15. **                        0 if it should be appended to
  16. **    FREDDP4ANIMFrameNum        -    Current DPaint frame number
  17. **    FREDDP4ANIMOrigNumFrames    -    Original number of ANIM frames in
  18. **                        DPaint before this script is executed
  19. **    FREDLockPalette            -    ~0 if we are to pick a new palette
  20. **                    -    0 if we are to lock the palette
  21. **
  22. ** NOTE: Clip names are case sensitive.
  23. **
  24. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  25. ** ADPro v2.5.0 (or higher).
  26. **
  27. ** Copyright © 1993 ASDG, Incorporated
  28. ** All Rights Reserved
  29. */
  30.  
  31.  
  32. ADDRESS "ADPro"
  33. OPTIONS RESULTS
  34.  
  35. PARSE ARG NumberOfCells NumberOfFrames
  36.  
  37. NL = '0A'X
  38. SQ = '27'X
  39. DQ = '22'X
  40. TRUE  = 1
  41. FALSE = 0
  42.  
  43.  
  44. /*
  45. ** Ask the user whether the new frames should be appended to the existing
  46. ** DPaint IV AGA ANIM or replace it.
  47. */
  48.  
  49. LOADER "DPAINT" "XXX" "PAGE" "STATUS"
  50. IF (RC ~= 0) THEN DO
  51.     ADPRO_TO_FRONT
  52.     OKAY1 "Error retrieving DPaint status"
  53.     SCREEN_TO_FRONT "FRED"
  54.     EXIT 10
  55. END
  56. DPaintStatus = ADPRO_RESULT
  57.  
  58. CurrPage = WORD( DPaintStatus, 22 )
  59. SETCLIP( "FREDDP4ANIMOrigNumFrames", CurrPage )
  60.  
  61. ADPRO_TO_FRONT
  62.  
  63. OKAYN '"SaveToDP4ANIM.fred"' '"Overwrite existing ANIM?"' '"Replace ANIM|Append New Frames|Cancel"'
  64. IF (RC = 0) THEN DO
  65.     SCREEN_TO_FRONT "FRED"
  66.     EXIT 10
  67. END
  68. ELSE
  69.     Overwrite = 2 - RC
  70.  
  71. IF (Overwrite ~= 0) THEN DO
  72.     CurrFrameNum = 1
  73.  
  74.  
  75.     /*
  76.     ** CAUTION...KLUDGE AHEAD
  77.     **
  78.     ** This should actually be checking for CurrPage > 1, but there seems to be
  79.     ** a problem with DPaint giving an error when trying to delete page 2 of
  80.     ** a 2 page ANIM.
  81.     **
  82.     ** This kludge should still work when/if a fixed version of DPaint is used
  83.     ** with this script, since the error condition is always avoided.
  84.     */
  85.     DO WHILE (CurrPage > 2)
  86.         SAVER "DPAINT" "XXX" "IMAGE" "DELETE" CurrPage
  87.  
  88.         Why = ADPRO_RESULT
  89.         IF (RC ~= 0) THEN DO
  90.             ADPRO_TO_FRONT
  91.             OKAY1 "DPaint ANIM save failed:" || NL || Why || NL ||,
  92.                 "Argument Information:" || NL ||,
  93.                 "Filename = " || FrameFName || NL ||,
  94.                 "ImageType = " || "IMAGE" || NL ||,
  95.                 "Action = " || "DELETE" CurrPage
  96.             SCREEN_TO_FRONT "FRED"
  97.             EXIT 10
  98.         END
  99.  
  100.         CurrPage = CurrPage - 1
  101.     END
  102. END
  103. ELSE DO
  104.     CurrFrameNum = WORD( DPaintStatus, 20 )
  105. END
  106.  
  107. ADPRO_TO_FRONT
  108.  
  109. OKAYN '"SaveToDP4ANIM.fred"' '"Lock Palette to First Frame?"' '"Locked|Unlocked|Cancel"'
  110. IF (RC = 0) THEN DO
  111.     SCREEN_TO_FRONT "FRED"
  112.     EXIT 10
  113. END
  114. ELSE
  115.     LockPalette = 2 - RC
  116.  
  117.  
  118. /*
  119. ** Update the clips.
  120. */
  121.  
  122. SETCLIP( "FREDDP4ANIMOverwrite", Overwrite )
  123. SETCLIP( "FREDDP4ANIMFrameNum", CurrFrameNum )
  124. SETCLIP( "FREDLockPalette", LockPalette )
  125.  
  126. EXIT 0
  127.