home *** CD-ROM | disk | FTP | other *** search
- /*
- ** BustANIM.adpro
- **
- ** $VER: BustANIM.adpro 1.3.0 (17.11.93)
- **
- ** This AREXX program will take an existing ANIM file and bust it
- ** apart into individual frames.
- **
- ** This script requires ADPro v2.5.0 (or higher).
- **
- ** Copyright © 1990-1993 ASDG, Incorporated
- ** All Rights Reserved
- */
-
-
- ADDRESS "ADPro"
- OPTIONS RESULTS
-
- NL = '0A'X
- SQ = '27'X
- DQ = '22'X
- TRUE = 1
- FALSE = 0
- TempDefaults = "T:TempADProDefaults"
-
-
- /*
- ** Save the current environment.
- */
-
- SAVE_DEFAULTS TempDefaults
-
-
- PSTATUS "UNLOCKED"
-
-
- /*
- ** Select the file to bust into frames.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetAFile" '"Enter ANIM to bust up"' '"ADPRO:"' '""""' TRUE
- fname = RESULT
- IF (fname = DQ||DQ) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "No ANIM specified."
- CALL ErrorOut 10
- END
-
-
- /*
- ** Strip the device name.
- */
-
- name = RIGHT( fname, LENGTH( fname ) - INDEX( fname, ':' ))
-
- /*
- ** Strip the path name.
- */
-
- name = RIGHT( name, LENGTH( name ) - LASTPOS( '/', name ))
-
-
- /*
- ** Ask about ANIM settings.
- */
-
- ADPRO_TO_FRONT
-
- OKAYN '"BustANIM"' '"Was this ANIM created with the Wrap-Up Option?"' '"Yes|No|Cancel"'
- WrapCheck = RC
-
- IF (WrapCheck = 0) THEN DO
- CALL ErrorOut 10
- END
- ELSE IF (WrapCheck = 1) THEN
- wrap = 1
- ELSE IF (WrapCheck = 2) THEN
- wrap = 0
-
-
- /*
- ** Ask where the frames should be placed.
- */
-
- CALL GetDestDir
-
- ADPRO_TO_FRONT
-
- OKAYN '"BustANIM"' '"Frame type?"' '"24-Bit|ANIM-type|Cancel"'
- FrameCheck = RC
-
- IF (FrameCheck = 0) THEN DO
- CALL ErrorOut 10
- END
- ELSE IF (FrameCheck = 1) THEN
- stype = 1
- ELSE IF (FrameCheck = 2) THEN
- stype = 0
-
- LOADER "ANIM" fname "COUNT"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Can't find ANIM file."
- CALL ErrorOut 10
- END
-
- NumFrames = ADPRO_RESULT
- IF (wrap ~= 0) THEN
- NumFrames = NumFrames - 2
-
-
- /*
- ** Ask which frames to process.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Starting frame"' 1 1 NumFrames TRUE
- StartFrame = RESULT
- IF (StartFrame = (1-1)) THEN
- CALL ErrorOut 10
-
- CALL "FREDSCRIPTS:FREDFunctions/GetANumber" '"Ending frame"' NumFrames StartFrame NumFrames TRUE
- EndFrame = RESULT
- IF (EndFrame = (StartFrame-1)) THEN
- CALL ErrorOut 10
-
-
- /*
- ** Perform the busting.
- */
-
- continue = FALSE
- num = StartFrame
- DO WHILE (continue = FALSE)
- LOADER "ANIM" fname "FRAME" num
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error during load" || NL ||,
- "of frame " || num || "."
- CALL ErrorOut 10
- END
- IF (stype ~= 0) THEN
- opt = "RAW"
- ELSE
- opt = "IMAGE"
-
- continuesave = FALSE
- DO UNTIL (continuesave = TRUE)
- SAVER "IFF" dir || name || "." || RIGHT( num, 5, "0" ) opt
- IF (RC ~= 0) THEN DO
- text = "Error saving frame " || num || "."
-
- ADPRO_TO_FRONT
-
- OKAYN '"BustANIM"' '"'text'"' '"Retry|Specify New Destination...|Cancel"'
- IF (RC = 0) THEN
- CALL ErrorOut 10
- ELSE IF (RC = 2) THEN
- CALL GetDestDir
- END
- ELSE
- continuesave = TRUE
- END
-
- num = num + 1
- IF (num > EndFrame) THEN
- continue = TRUE
- END
-
- CALL ErrorOut 0
-
-
-
-
- GetDestDir:
- CALL "FREDSCRIPTS:FREDFunctions/GetADir" '"Where should I place the frames?"' '"ADPRO:"' TRUE
- dir = RESULT
- IF (dir = DQ||DQ) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error, no dest path specified."
- CALL ErrorOut 10
- END
-
- IF ((RIGHT( dir, 1 ) ~= '/') & (RIGHT( dir, 1 ) ~= ':')) THEN
- dir = dir || '/'
-
- RETURN
-
-
-
-
- ErrorOut:
- PARSE ARG ExitCode
-
- IF (EXISTS( fname )) & (ErrorCode ~= 0) THEN DO
- LOADER "ANIM" fname "QUIT"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error closing source ANIM:" || NL ||,
- fname || NL || NL ||,
- "You need to close it" || NL ||,
- "manually."
- END
- END
-
- IF (EXISTS( TempDefaults )) THEN DO
- LOAD_DEFAULTS TempDefaults
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error restoring settings."
- END
-
- ADDRESS COMMAND "Delete >NIL:" TempDefaults
- END
-
- EXIT ExitCode
-