#include "lib2d.h" // **** This sets up sprite information, such as x,y, what .TIM data to use etc. etc. void SetSpriteInfo(GsSPRITE *tSprite, u_long tMemAddress, long tX, long tY) { GsIMAGE tTim; u_long tDepth1, tDepth2; // copy tim information into GsIMAGE structure for easy access GsGetTimInfo((u_long *) (tMemAddress+4), &tTim); // calculate the bit depth of texture image and set variables for use // case 0 = 16 colour, 1 = 256 colour, 2 = truecolour switch (tTim.pmode&3) { case 0: {tDepth1=0; tDepth2=4; break;} case 1: {tDepth1=1; tDepth2=2; break;} case 2: {tDepth1=2; tDepth2=1; break;} } // set attribute to specify colour depth of texture image tSprite->attribute = (tDepth1<<24); // specify start position of sprite tSprite->x = tX; tSprite->y = tY; // set width of texture image (modified by bit depth) tSprite->w = tTim.pw * tDepth2; tSprite->h = tTim.ph; // set texture page for texture image tSprite->tpage = GetTPage(tDepth1, 0, tTim.px, tTim.py); // set texuture offset from top left of texture page tSprite->u = tTim.px%64; tSprite->v = tTim.py%256; // set CLUT if texture image is not truecolour if (!(tDepth1==2)) { tSprite->cx = tTim.cx; tSprite->cy = tTim.cy; } // set brightness regulation to normal tSprite->r = tSprite->g = tSprite->b = 128; // set handle to center of texture image tSprite->mx = tTim.pw*tDepth2/2; tSprite->my = tTim.ph/2; // set size and orientation to normal tSprite->scalex = tSprite->scaley = ONE; tSprite->rotate = 0; }