home *** CD-ROM | disk | FTP | other *** search
- /*
- ** SaveToDP4ANIM.fred.pre
- **
- ** $VER: SaveDP4ANIM.fred.pre 1.1.0 (24.10.93)
- **
- ** If the SaveToDP4ANIM.fred script appears in the InvokeADPro list,
- ** this program will ask the user whether the current DPaint IV AGA ANIM
- ** frames (whether any exist or not) should be deleted before appending
- ** the currently selected frames.
- **
- ** If they fail to answer, the InvokeADPro list will be aborted.
- **
- ** Clips Exported:
- ** FREDDP4ANIMOverwrite - ~0 if the current ANIM should be overwritten
- ** 0 if it should be appended to
- ** FREDDP4ANIMFrameNum - Current DPaint frame number
- ** FREDDP4ANIMOrigNumFrames - Original number of ANIM frames in
- ** DPaint before this script is executed
- ** FREDLockPalette - ~0 if we are to pick a new palette
- ** - 0 if we are to lock the palette
- **
- ** NOTE: Clip names are case sensitive.
- **
- ** This script requires FRED v1.4.0 (or higher) to run. Also required is
- ** ADPro v2.5.0 (or higher).
- **
- ** Copyright © 1993 ASDG, Incorporated
- ** All Rights Reserved
- */
-
-
- ADDRESS "ADPro"
- OPTIONS RESULTS
-
- PARSE ARG NumberOfCells NumberOfFrames
-
- NL = '0A'X
- SQ = '27'X
- DQ = '22'X
- TRUE = 1
- FALSE = 0
-
-
- /*
- ** Ask the user whether the new frames should be appended to the existing
- ** DPaint IV AGA ANIM or replace it.
- */
-
- LOADER "DPAINT" "XXX" "PAGE" "STATUS"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error retrieving DPaint status"
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- DPaintStatus = ADPRO_RESULT
-
- CurrPage = WORD( DPaintStatus, 22 )
- SETCLIP( "FREDDP4ANIMOrigNumFrames", CurrPage )
-
- ADPRO_TO_FRONT
-
- OKAYN '"SaveToDP4ANIM.fred"' '"Overwrite existing ANIM?"' '"Replace ANIM|Append New Frames|Cancel"'
- IF (RC = 0) THEN DO
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- ELSE
- Overwrite = 2 - RC
-
- IF (Overwrite ~= 0) THEN DO
- CurrFrameNum = 1
-
-
- /*
- ** CAUTION...KLUDGE AHEAD
- **
- ** This should actually be checking for CurrPage > 1, but there seems to be
- ** a problem with DPaint giving an error when trying to delete page 2 of
- ** a 2 page ANIM.
- **
- ** This kludge should still work when/if a fixed version of DPaint is used
- ** with this script, since the error condition is always avoided.
- */
- DO WHILE (CurrPage > 2)
- SAVER "DPAINT" "XXX" "IMAGE" "DELETE" CurrPage
-
- Why = ADPRO_RESULT
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "DPaint ANIM save failed:" || NL || Why || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || FrameFName || NL ||,
- "ImageType = " || "IMAGE" || NL ||,
- "Action = " || "DELETE" CurrPage
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
-
- CurrPage = CurrPage - 1
- END
- END
- ELSE DO
- CurrFrameNum = WORD( DPaintStatus, 20 )
- END
-
- ADPRO_TO_FRONT
-
- OKAYN '"SaveToDP4ANIM.fred"' '"Lock Palette to First Frame?"' '"Locked|Unlocked|Cancel"'
- IF (RC = 0) THEN DO
- SCREEN_TO_FRONT "FRED"
- EXIT 10
- END
- ELSE
- LockPalette = 2 - RC
-
-
- /*
- ** Update the clips.
- */
-
- SETCLIP( "FREDDP4ANIMOverwrite", Overwrite )
- SETCLIP( "FREDDP4ANIMFrameNum", CurrFrameNum )
- SETCLIP( "FREDLockPalette", LockPalette )
-
- EXIT 0
-