/* ROLL RIGHT */

/* Ask for verbose results. */

options results

/* Grab the arguments. */

arg frame " " total " " loopf

/* Start talking to ADPro, and bring it into view. */

address "ADPro"

ADPRO_TO_FRONT

/* Set image info for current frame. */

IMAGE_TYPE

if index(ADPRO_RESULT,"BITPLANE") = 0 then
do
   image = 0

   /* Deal with the palette. */

   if frame = 1 & loopf = 0 then PSTATUS UNLOCKED

   /* Set image parameters with default conversion options. */

   ABS_SCALE 320 400

   DITHER 6
   DITHER_AMOUNT 16

   SCREEN_TYPE 258
   RENDER_TYPE HAM8
end
else
do
   image = 1

   /* Deal with the palette. */

   PSTATUS LOCKED

   /* Use image parameters as defined by loaded image. */
   /* Except for the following... */

   DITHER 0
   DITHER_AMOUNT 16
end

/* Get the image's dimensions. */

XSIZE

ix = ADPRO_RESULT

YSIZE

iy = ADPRO_RESULT

/* Set the arguments and call the operator! */

dir = RIGHT

pix = (frame-1)*(ix%total)

mod = WRAP

OPERATOR "ROLL" dir pix mod

/* Render the image. */

EXECUTE

/* Take care of palette locking/unlocking. */

if image = 0 then PSTATUS LOCKED

if image = 1 then PSTATUS UNLOCKED

/* Show the new image for a sec. */

ADPRO_DISPLAY

PAUSE 50

/* Throw ADPro into the background. */

ADPRO_UNDISPLAY

ADPRO_TO_BACK

/* Start talking to AWorks, bring it into view. */

address "AWorks.1"

SCREEN_TO_FRONT

exit
