Tips, Tricks, and Troubleshooting


This section provides some information that 3DO title developers have found useful when preparing 3DO titles:

CCB Formulas

Here are some formulas that make working with CCBs easier. The order of points is clockwise from the upper left corner.

HDX = (X1 - X0) / W

HDY = (Y1 - Y0) / W

VDX = (X3 - X0) / H

VDY = (Y3 - Y0) / H

HDDX = [ (X2- X3) - (X1 - X0)] / (WH) = (HDX1 - HDX0) / H

HDDY = [ (Y2- Y3) - (Y1 - Y0)] / (WH) = (HDY1 - HDY0) / H

Working with Cels Efficiently

To work with cels efficiently, keep in mind the following:

Additional Code Examples

Here are some additional examples from the sample programs that help with cel manipulation. CenterCCB() centers a cel. This example comes from jsanimation.c.

Example 1: Centering a cel

void CenterCCB(CCB *aCCB, Coord aXCenter, Coord aYCenter)
{
    int32 aWidth;
    int32 aHeight;
    int32 aXPos;
    int32 aYPos;

    aWidth = aCCB->ccb_Width;
    aHeight = aCCB->ccb_Height;
    aXPos = aXCenter - aWidth / 2;
    aYPos = aYCenter - aHeight / 2;

    MoveCCB(aCCB, aXPos, aYPos);
}