[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

The bits in the vsprite.flags field that apply to a bob are the vsprite
flag, the saveback flag and the overlay flag.  when a vsprite structure is
used to define a Bob, the VSPRITE flag in the VSprite.Flags field must be
set to zero.  This tells the system that this GEL is a Bob type.

To have the GEL routines save the background before the Bob is drawn and
restore the background after the Bob is removed, specify the saveback flag
(stands for "save the background") in the vsprite structure flags field.
If this flag is set, the savebuffer must have been allocated, which is
where the system puts this saved background area.  The buffer must be
large enough to save all the background bitplanes, regardless of how many
planes the Bob has.  The size in words can be calculated as follows:

    /* Note that Bob.Width is in units of words. */
    size = Bob.Width * Bob.Height * RastPort.BitMap.Depth;

To allocate this space, the graphics function allocraster() can be used.
AllocRaster() takes the width in bits, so it is a convenient way to
allocate the space needed.  The makebob() routine below shows another way
to correctly allocate this buffer. For example:

    /* space for 16 bits times 5 lines times 5 bitplanes */
    myBob.SaveBuffer = AllocRaster( (UWORD) 16, (UWORD) (5 * 5) );


    Warning:
    --------
    The savebuffer must be allocated from chip memory and contain an
    even number of word-aligned bytes.  The allocraster() function
    does this for you.  The AllocRaster() function rounds the width
    value up to the next integer multiple of 16 bits which is greater
    than or equal to the current value an it obtains memory from the Chip
    memory pool.

overlay is the other vsprite.flags item that applies to bobs. if this flag
is set, it means that the background's original pixels show through in any
area where there are 0 bits in the Bob's shadow mask (imageshadow,
explained later).  The space for the ImageShadow shadow mask must have
been allocated and initialized.  The ImageShadow mask must be allocated
from Chip memory.

If the overlay bit is cleared, the system uses the entire rectangle of
words that define the Bob image to replace the playfield area at the
specified x,y coordinates.  See the paragraphs below called "imageshadow".