home *** CD-ROM | disk | FTP | other *** search
- /*
- ** PingPongANIM.adpro
- **
- ** $VER: PingPongANIM.adpro 1.2.1 (17.1.94)
- **
- ** This AREXX program will take an existing ANIM file create a new
- ** PingPong anim from it.
- **
- ** This script requires ADPro v2.5.0 (or higher).
- **
- ** Copyright © 1990-1994 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
-
-
- /*
- ** Select the file to ping-pong.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetAFile" '"Enter ANIM to Ping Pong"' '"ADPRO:"' '""""' TRUE
- SrcANIMFName = RESULT
- IF (SrcANIMFName = DQ||DQ) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "No source ANIM specified."
- CALL ErrorOut 10
- END
-
- ADPRO_TO_FRONT
-
- OKAYN '"PingPongANIM"' '"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
-
-
- /*
- ** Specify ANIM file to create.
- */
-
- CALL "FREDSCRIPTS:FREDFunctions/GetAFile" '"Enter new ANIM to create"' '"ADPRO:"' '""""' TRUE
- DestANIMFName = RESULT
- IF (DestANIMFName = DQ||DQ) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "No destination ANIM specified."
- CALL ErrorOut 10
- END
-
- IF (EXISTS( DestANIMFName )) THEN DO
- ADPRO_TO_FRONT
-
- OKAYN '"PingPongANIM"' '"Truncate destination ANIM?"' '"Start New File|Append To File|Cancel"'
- IF (RC = 0) THEN DO
- CALL ErrorOut 10
- END
- ELSE IF (RC = 1) THEN DO
- IMAGE_TYPE
- ImageType = ADPRO_RESULT
- IF (WORD( ImageType, 1 ) = "NONE") THEN DO
- LOADER "BACKDROP" "XXX" "WIDTH" 10 "HEIGHT" 10 "COLOR"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Unable to create temp image." || NL ||,
- "Argument Information:" || NL||,
- "Width = " || 10 || NL ||,
- "Height = " || 10 || NL ||,
- "Type = " || "COLOR"
- CALL ErrorOut 10
- END
- END
-
- IF (WORD( ImageType, 1 ) ~= "BITPLANE") THEN DO
- EXECUTE
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Unable to create temp rendered data."
- CALL ErrorOut 10
- END
- END
-
- SAVER "ANIM" DestANIMFName "IMAGE" "QUIT" ANIMCompressType ANIMCompressQual
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Could not close current ANIM file." || NL ||,
- "Argument Information:" || NL ||,
- "Filename = " || DestANIMFName || NL ||,
- "Type = " || "IMAGE" || NL ||,
- "Flags = " || "QUIT"
- CALL ErrorOut 10
- END
-
- ADDRESS COMMAND "Delete >NIL:" DestANIMFName
- END
- END
-
-
- /*
- ** Get the compression mode.
- */
-
- ADPRO_TO_FRONT
-
- OKAYN '"PingPongANIM"' '"Select ANIM Compression"' '"BYTE|WORD|LONG|Cancel"'
- IF (RC = 0) THEN DO
- CALL ErrorOut 10
- END
- ELSE IF (RC = 1) THEN
- ANIMCompressType = "BYTE"
- ELSE IF (RC = 2) THEN
- ANIMCompressType = "WORD"
- ELSE IF (RC = 3) THEN
- ANIMCompressType = "LONG"
-
-
- /*
- ** Get the compression quality.
- */
-
- ADPRO_TO_FRONT
-
- OKAYN '"PingPongANIM"' '"Select Compression Quality"' '"Faster Compression|Smaller File Size|Cancel"'
- IF (RC = 0) THEN DO
- CALL ErrorOut 10
- END
- ELSE IF (RC = 1) THEN
- ANIMCompressQual = "FASTER"
- ELSE IF (RC = 2) THEN
- ANIMCompressQual = "SMALLER"
-
-
- /*
- ** Perform operation.
- */
-
- LOADER "ANIM" SrcANIMFName "COUNT"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Can't find ANIM file."
- CALL ErrorOut 10
- END
-
- numframes = ADPRO_RESULT
-
- ADDRESS COMMAND "Copy" SrcANIMFName DestANIMFName
-
- IF (wrap ~= 0) THEN DO
- numframes = numframes - 2
- LOADER "ANIM" SrcANIMFName "FRAME" 1
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Cannot load src anim frame 1."
- CALL ErrorOut 10
- END
-
- SAVER "ANIM" DestANIMFName "IMAGE" "TRUNCATE" numframes ANIMCompressType ANIMCompressQual
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Cannot create dest anim."
- CALL ErrorOut 10
- END
- END
-
- num = numframes
- continue = 0
- DO WHILE (continue = 0)
- LOADER "ANIM" SrcANIMFName "FRAME" num
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error during load."
- CALL ErrorOut 10
- END
-
- SAVER "ANIM" DestANIMFName "IMAGE" "APPEND"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error during save."
- CALL ErrorOut 10
- END
-
- num = num - 1
- IF (num < 1) THEN
- continue = 1
- END
-
- IF (wrap ~= 0) THEN
- SAVER "ANIM" DestANIMFName "IMAGE" "WRAPUP" ANIMCompressType ANIMCompressQual
- ELSE
- SAVER "ANIM" DestANIMFName "IMAGE" "QUIT" ANIMCompressType ANIMCompressQual
-
- CALL ErrorOut 0
-
-
- ErrorOut:
- PARSE ARG ExitCode
-
- IF (EXISTS( SrcANIMFName )) & (ErrorCode ~= 0) THEN DO
- LOADER "ANIM" SrcANIMFName "QUIT"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error closing source ANIM:" || NL ||,
- SrcANIMFName || NL || NL ||,
- "You need to close it" || NL ||,
- "manually."
- END
- END
-
- IF (EXISTS( DestANIMFName )) & (ErrorCode ~= 0) THEN DO
- SAVER "ANIM" DestANIMFName "IMAGE" "QUIT"
- IF (RC ~= 0) THEN DO
- ADPRO_TO_FRONT
- OKAY1 "Error closing dest ANIM:" || NL ||,
- DestANIMFName || 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
-