// ********** // Load a TIM // ********** void LoadTIMData(u_long tMemAddress) { RECT tRect; // rectangular area to be used GsIMAGE tTim; // TIM image information tMemAddress += 4; // advance memory pointer to data GsGetTimInfo((u_long *) tMemAddress, &tTim); // fill tTim with info from TIM tRect.x = tTim.px; // tell GPU where graphics data is tRect.y = tTim.py; tRect.w = tTim.pw; tRect.h = tTim.ph; LoadImage(&tRect, tTim.pixel); // load video memory with TIM data tRect.x = tTim.cx; // tell GPU where colour table is tRect.y = tTim.cy; tRect.w = tTim.cw; tRect.h = tTim.ch; LoadImage(&tRect, tTim.clut); // load video memory with CLUT data DrawSync(0); // force LoadImages to complete } // ****************************************************** // This sets up sprite information from basic information // ****************************************************** void SetBlocksInfo(GsSPRITE *tSprite, long tX, long tY, long tU, long tV, long tW, long tH, long tPX, long tPY, u_char tCol) { u_short tTexturePage; // some variables to clear up u_long tTexturePageXOffset, tTexturePageYOffset; // assignment of texture pages // Set up new sprite with some default attributes if (tCol == 8) { tSprite->attribute = (1<<24); tSprite->w = tW; tTexturePage = GetTPage(1, 0, ((tX + tU / 2) / 64) * 64, ((tY + tV) / 256) * 256); tTexturePageXOffset = (tX % 64) * 2 + (tU % 128); } else { tSprite->attribute = 0; tSprite->w = tW; tTexturePage = GetTPage(0, 0, ((tX + tU / 4) / 64) * 64, ((tY + tV) / 256) * 256); tTexturePageXOffset = (tX % 64) * 4 + (tU % 256); } tTexturePageYOffset = (tY + tV) % 256; tSprite->tpage = tTexturePage; tSprite->u = tTexturePageXOffset; tSprite->v = tTexturePageYOffset; tSprite->h = tH; tSprite->cx = tPX; tSprite->cy = tPY; tSprite->r = tSprite->g = tSprite->b = 128; tSprite->mx = tW / 2; tSprite->my = tH / 2; tSprite->scalex = tSprite->scaley = ONE; tSprite->rotate = 0; }