Tips, Tricks, and Troubleshooting


This section provides some additional advice on working with animations:

Using an Animation Unified for Efficiency

UnifyAnimation() goes through the ANIM structure and sets it so that each frame uses the same CCB but has its own cel data and PLUT (Pixel Lookup Table).

Example 1: The UnifyAnimation function.

void UnifyAnimation(ANIM* pAnim)
    {
    int i;
    CCB* theCCB;
    
    theCCB = pAnim->pentries[0].af_CCB;
    for (i = 0; i < pAnim->num_Frames; i++)
        {
        pAnim->pentries[i].af_CCB = theCCB;
        }
    }

GetAnimCel() sets the cel data pointer and the PLUT pointer in a single CCB to point to the next frame. As a result, the animation can change its cel data and its PLUT, but not its size or other data. Although this is not as flexible as it was before, it is useful for many situations. When you change the location or the scale factor of one frame of the unified animation, that change is maintained in all the frames. Furthermore, you can insert the animation's one CCB into a cel list; this isn't done in UFO, but it's a useful technique.

Creating an Anti-Aliased Animation

Title developers often find that animations show bad aliasing when displayed against a background. This can be remedied by going through the following steps: