Site Tools


documentation:development:opera:pf25:ppgfldr:smmfldr:gspfldr:05pgs003

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:

  • Try to call DrawCels() only once by working with cel lists if possible, as discussed in Chapter 2, “Displaying Cels.”
  • MapCel() can became a CPU bottleneck in certain titles. If you are manipulating data with width and height that are powers of 2, you should use the FastMapCel() function from graphics.lib. It operates quite a bit faster than MapCel() since it can use shifts instead of divides and multiplies.

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);
}
documentation/development/opera/pf25/ppgfldr/smmfldr/gspfldr/05pgs003.txt · Last modified: 2022/10/10 16:53 by 127.0.0.1