Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: "Nelson Santos" Newsgroups: scea.yaroze.programming.2d_graphics Subject: Sprite widths, why does this work???? Date: 10 Jan 1998 04:41:24 GMT Organization: SCEA News Server Lines: 98 Message-ID: <01bd1d9c$4c2d9000$4454eccd@nsantos> NNTP-Posting-Host: ppp-annex-0258.tor.total.net X-Newsreader: Microsoft Internet News 4.70.1160 Hi people, Take a look at this code for me please... GsIMAGE WarningImage; GsSPRITE WarningSprite1; GsSPRITE WarningSprite2; RECT Dest; GsGetTimInfo((u_long *)(TIM_WARNING+4),&WarningImage); Dest.x=WarningImage.px; Dest.y=WarningImage.py; Dest.w=WarningImage.pw; Dest.h=WarningImage.ph; LoadImage(&Dest,WarningImage.pixel); Dest.x=WarningImage.cx; Dest.y=WarningImage.cy; Dest.w=WarningImage.cw; Dest.h=WarningImage.ch; LoadImage(&Dest,WarningImage.clut); DrawSync(0); // Initialize Sprites WarningSprite1.attribute = 1 << 26; WarningSprite1.x = 0; WarningSprite1.y = 80; WarningSprite1.w = 256; WarningSprite1.h = 80; WarningSprite1.tpage = GetTPage(0,0,320,0); WarningSprite1.u = 0; WarningSprite1.v = 0; WarningSprite1.cx = WarningImage.cx; WarningSprite1.cy = WarningImage.cy; WarningSprite1.r = 127; WarningSprite1.g = 127; WarningSprite1.b = 127; WarningSprite1.mx = 0; WarningSprite1.my = 0; WarningSprite1.scalex = ONE; WarningSprite1.scaley = ONE; WarningSprite1.rotate = 0; WarningSprite2.attribute = 1 << 26; WarningSprite2.x = 256; WarningSprite2.y = 80; WarningSprite2.w = 64; WarningSprite2.h = 80; WarningSprite2.tpage = GetTPage(0,0,384,0); WarningSprite2.u = 0; WarningSprite2.v = 0; WarningSprite2.cx = WarningImage.cx; WarningSprite2.cy = WarningImage.cy; WarningSprite2.r = 127; WarningSprite2.g = 127; WarningSprite2.b = 127; WarningSprite2.mx = 0; WarningSprite2.my = 0; WarningSprite2.scalex = ONE; WarningSprite2.scaley = ONE; WarningSprite2.rotate = 0; for(; Time != 0 ; Time -= 1) { Buffer = GsGetActiveBuff(); GsSetWorkBase((PACKET *)Packet[Buffer]); GsClearOt(0,0,&OrdTab[Buffer]); GsSortClear(0, 0, 0, &OrdTab[Buffer]); GsSortFastSprite(&WarningSprite1,&OrdTab[Buffer], 0); GsSortFastSprite(&WarningSprite2,&OrdTab[Buffer], 0); GsDrawOt(&OrdTab[Buffer]); GsSwapDispBuff(); DrawSync(0); VSync(0); } First I load a 320x80 image into the Frame Buffer. It's a 4-bit image. After the GsGetTimInfo, WarningImage.pw is actually equal to 80, not 320! This probably has something to do with the fact that the image is a 4-bit image, but the picture itself is still 320 pixels wide. Why does it return 80?? Next, I create two sprites, one for the first 256 pixels, and the second sprite handles the rest of the sprite, 64 pixels. However, the GetTPage command for the second sprite must be GetTPage(0,0,384,0) for it to work properly, rather than GetTPage(0,0,576,0), to skip the 256 pixels in the first TPage. I have no idea why this is so. Can anyone answer these 2 questions for me, please??? Nelson Santos