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

The collision handler table is a structure, CollTable, defined in
<graphics/gels.h>.  it is accessed as the collhandler member of the
gelsinfo structure.  the table only needs to be as large as the number of
bits for which you wish to provide collision processing.  It is safest,
though, to allocate space for all 16 entries, considering the small amount
of space required.

Call the routine setcollision() to initialize the table entries that
correspond to the hitmask and memask bits that you plan to use.  do not
set any of the table entries directly, instead give the address to
SetCollision() routine and let it handle the set up of the
gelsinfo.colltable field.

For example, setcollision() could be called as follows:

    ULONG            num;
    VOID           (*routine)();
    struct GelsInfo *GInfo;

    VOID myCollisionRoutine(GELA, GELB)   /* sample collision routine */
    struct VSprite *GELA;
    struct VSprite *GELB;
    {
        /* process gels here - GELA and GELB point to the base VSprites */
        /* of the gels, you can use the user extensions to identify what */
        /* hit (if you need the info). */
    }

    /* GelsInfo must be allocated and initialized */

    routine = myCollisionRoutine;

    SetCollision(num, routine, GInfo)

The num argument is the collision table vector number (0-15).  The
(*routine)() argument is a pointer to your collision routine.  And the
GInfo argument is a pointer to the gelsinfo structure.