/*-------------------------------------------------------------------
**
** This AREXX script uses ArtDepartment Professional to convert a
** series of IFF24 animation frames produced by RayDance to HAM
** (after which they can be passed to a program such as ASTATION or
** BuildAnim to create an anim file).
**
** The source pictures are expected to have names of the format:
** [
]_nnnnn.IFF24
**
** The converted pictures are store with names of the format:
** []_nnnnn.HAM
**
** For more information consult the ADPro manual which has a large
** section devoted to AREXX scripts.
**
**-----------------------------------------------------------------*/
OPTIONS RESULTS
CALL Locate_ADPro
IF RESULT = 0 THEN
DO
SAY 'Could not locate or start ADPro'
EXIT
END
/*
** ADPro has been found.
*/
ADDRESS "ADPro"
/*
** Screen types for ADPro
*/
HIRES = 1
LACE = 2
PAL = 4
HOVERSCAN = 8
VOVERSCAN = 16
/*
** Setup the conversion parameters.....
*/
/*
** Output will be HAM...
*/
RENDER_TYPE HAM
/*
** Output will be interlaced with horizontal and vertical overscan.
** The exact size of the output pictures will be the same as the
** size of the input pictures (unless the SCALE command is used).
*/
SCREEN_TYPE HOVERSCAN + VOVERSCAN + LACE
/*
** Floyd-steinberg dithering
*/
DITHER 1
/*
** Load pictures in IFF format
*/
LFORMAT "Iff"
/*
** The directory and base (with out suffixes) file name of the
** input, IFF24, pictures. Make sure that DIRNAME ends with a / or :
*/
DIRNAME = "work:anims/txcube/"
FILENAME = "txcube"
/*
** Convert input files from frame # 1 to frame # 59. Output will
** be setup in ASTATION format,
**
** name.0
** name.1
** name.2
** . . .
** name.58
*/
DO F = 1 to 59
/*
** Unlock the palette so we can create one using the first frame's
** coloration.
*/
IF F = 1 THEN
PSTATUS UNLOCKED
/*
** After the first frame we will want to use the same color palette
** so lock it before generating anymore frames.
*/
IF F = 2 THEN
PSTATUS LOCKED
/*
** Do the magic arithmetic to change from a file name format of
**
** name_00001.iff24
**
** to
** name.0
**
** We will need to open the input file using the first format and
** write the output file using the second.
IF F < 10 THEN
FILENUM = "0000" || VALUE(F)
ELSE
IF F < 100 THEN
FILENUM = "000" || VALUE(F)
ELSE
IF F < 1000 THEN
FILENUM = "00" || VALUE(F)
ELSE
IF F < 10000 THEN
FILENUM = "0" || VALUE(F)
ELSE
FILENUM = VALUE(F)
/*
** Construct the name of the input file by catenating the input
** directory, base filename, and frame number.
*/
FULLNAME = DIRNAME || FILENAME || "_" || FILENUM
/*
** Construct the output file name by adding a .framenumber to
** the hard coded name.
*/
OUTNAME = "work:outdir/txcube" || "." || F-1
/*
** Echo the picture names we will be converting to the user.
*/
SAY "Converting " FULLNAME " to " OUTNAME
/*
** Open and load the input file.
*/
LOAD FULLNAME || ".IFF24"
/*
** If the input file is not the desired size of the output then
** use the ABS_SCALE statement to change it.
*/
ABS_SCALE 384 240
/*
** Start the actual conversion process
*/
EXECUTE
/*
** The picture was converted. Write the output file for this
** frame.
*/
SAVE OUTNAME "SCREEN"
/*
** Continue with the other frames.
*/
END
/*
** We're done!
*/
EXIT
/*
** The following script lines are a subroutine that is called to
** see if we need to start a new copy of ADPro or if one is already
** in operation. This brings up the point that this script leaves
** ADPro running when the script finishes.
*/
/*
** Locate an existing copy of ADPro that is running. If not found
** then try to start one.
*/
Locate_ADPro:
LibName = 'rexxsupport.library'
IF POS(LibName, SHOW('Libraries')) = 0 THEN
ADDLIB(LibName, 0, -30,0)
IF POS(LibName, SHOW('Libraries')) = 0 THEN
RETURN 0
IF POS('ADPro', SHOW('Ports')) = 0 THEN
DO
ADDRESS COMMAND 'run ADPro:ADPro'
ADDRESS COMMAND 'WAIT 3'
END
say SHOW('Ports')
IF POS('ADPro', SHOW('Ports')) = 0 THEN
RETURN 0
RETURN 1