To animate a cel, you change its CCB between frames. The Graphics folio's wait call, WaitVBL()
, helps time the CCB changing calls to occur during the vertical blank interval between frames. If you are double-buffering the animation, during or after the vertical blank you can project cels into the bitmap that is not displayed-just be sure you finish projection before the next vertical blank.
XPOS
and YPOS
values in the CCB from frame to frame. You can use fractional pixels for fine motion, and you can specify locations beyond the boundaries of the bitmap or screen on which you are projecting the cel. Cels are clipped when they go past bitmap or screen boundaries, or when they go past clipping boundaries set by SetClipHeight()
and SetClipWidth()
.
HDX
, HDY
, VDX
, VDY
, HDDX
, and HDDY
words of the CCB to set the cel's projection quadrilateral. This requires calculation to figure the appropriate slopes for the external and row boundaries of the cel. You can also use MapCel()
to determine the projection quadrilateral.
MapCel()
accepts two arguments: a pointer to a cel's CCB and a pointer to an array of four point structures. These four point structures set the four corners of the cel's projection quadrilateral. MapCel()
works out the projection quadrilateral from the four points, and automatically sets the quadrilateral offsets in the CCB.
The four-point projection quadrilateral structure contains four pairs of point coordinates, the x coordinate followed by the y coordinate. Each point coordinate is a 32-bit value that is in 16.16 format. The four points within the structure are tied to the corners of the original cel source data, starting with the upper-left corner and proceeding clockwise:
To skip a cel within a group, simply set the SKIP
flag within the FLAGS word of its CCB. The connections between cels within the group remain intact, but the cel engine does not project any cels whose SKIP
flags are set, saving cel engine processing time.
Once multiple source data files are set up, a cel can be sequentially animated by changing the contents of the CCB's SOURCEPTR
word from frame to frame. SOURCEPTR
points to a different source data file for each frame, and so presents a sequence of images within the cel. You can go through images in any order you wish, cycling through source data files, working forward and then backward through them, jumping from place to place, or whatever works best. You can also load new source data files to replace old ones that are no longer used.
While a cel is sequentially animated from frame to frame, you can add to its animation by changing its position and its projection quadrilateral.