Path: chuka.playstation.co.uk!news From: sosman@terratron.com (Steven Osman) Newsgroups: scee.yaroze.freetalk.english Subject: Re: Buggery Title Screen!! Date: Fri, 31 Aug 2001 02:42:28 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 177 Message-ID: <3b8ef71d.30794950@www.netyaroze-europe.com> References: <9mgsl9$8t81@www.netyaroze-europe.com> <9mjfqr$dra4@www.netyaroze-europe.com> <9mlmco$h6i1@www.netyaroze-europe.com> NNTP-Posting-Host: dsl092-099-074.nyc2.dsl.speakeasy.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 1.5/32.452 Max, Try this and let me know if it works: replace: void InitSprite(u_long *addr, GsSPRITE *sprite, short xPos, short yPos) with void InitSprite(u_char *addr, GsSPRITE *sprite, short xPos, short yPos) I'll bet you it will work, and that's probably what you had before when you used +4. That's because of something kinda wierd in C that took me a while to get used to. when you say addr+4 you actually mean the fourth *long* after addr. Since each long is 4 bytes, addr+4 is actually sixteen bytes into addr. It makes more sense when you think of it as an array (addr[4] would be 16 bytes after addr[0]) Sauce On Thu, 30 Aug 2001 16:30:11 +0100, "Max" wrote: >Thanks guys, it turns out it was my call to GsGetTimInfo... strange... it >was (address+4) and should have been (address+1) to work (as it is now) but >before it worked with +4... Yaroze memory really is very strange... can >anyone offer an explanation? >Now i have the images on screen but they are flickering like mad - must be >my OT setup... any suggestions? > >Max > >Ben James wrote in message >news:9mjfqr$dra4@www.netyaroze-europe.com... >> Could the CLUT be positioned somewhere in the frame buffer? That could >make >> all the sprites appear black. >> >> Something I always do during development is clear the screen to mid-grey >at >> the start of a frame. Quite often when something's not quite working it >get >> drawn as black and therefore invisible on a black background. >> >> Ben >> >> "Max" wrote in message >> news:9mgsl9$8t81@www.netyaroze-europe.com... >> Hey all, >> >> Now I'm trying to get the title screen in MonkyRegs, and I thought I had >it >> sussed until the Yaroze told me otherwise. I can't honestly see where its >> going wrong. >> >> I have 640 x 512 res and I'm trying to get 4 230 x 222 x 8-bit images on >the >> screen arranged into a (imperfect) square. The code I use for loading and >> setting up the sprite is below, can someone have a look and tell me whats >> wrong if anything, I'm in the process of narrowing down the causes. Does >> anyone else use the gnu debugger? - if so do they have as much damn >trouble >> getting the thing to run as I do? - I have given up on it completely. >> >> This code is executed before I go into the game loop, the mode is first 2D >> to allow the menu to be put up, then when the game starts I switch to 3D. >(I >> will probably will have the title screen overlayed on the 3D arena >> eventually but just now I want to get this working so that if I come to >> adding anything before the title screen I will know how to. Thanks all. >> >> >/*-------------------------------------CODE-------------------------------*/ >> >> void InitSprite(u_long *addr, GsSPRITE *sprite, short xPos, short yPos) >> { >> RECT rect; // this is a rectangle in which the sprite will be stored >> >> GsIMAGE imageInfo; // this holds the actual sprite data >> >> GsGetTimInfo((u_long *)(addr+4),&imageInfo); // read the TIM and store >its >> data in imageInfo >> >> // set up the rect before we load in the data >> setRect(&rect,imageInfo.px,imageInfo.py,imageInfo.pw,imageInfo.ph); // >set >> up the rect for texture loading to VRAM >> >> LoadImage(&rect, imageInfo.pixel); // load in the data to the rect >> >> DrawSync(0); >> >> // check to see if the image has a clut i.e. < 16 bit >> if((imageInfo.pmode>>3)&0x01) >> { >> // CLUT exists so load it into the rect >> setRect(&rect,imageInfo.cx,imageInfo.cy,imageInfo.cw,imageInfo.ch); // >set >> up the rect for texture loading to VRAM >> LoadImage(&rect, imageInfo.clut); // Loads all of the above into the >Frame >> Buffer >> >> DrawSync(0); >> } >> >> sprite->x = xPos; // set up the position within the frame >> sprite->y = yPos; >> >> // check for bit mode >> if(0) >> switch(imageInfo.pmode) >> { >> case 0x08 /*4 bit*/ : sprite->attribute = 0 << 24; // this tells the >> yaroze what attributes the image has >> sprite->w = imageInfo.pw*4; // this is the image data offset in >the >> VRAM >> sprite->tpage = GetTPage(0,0,imageInfo.px,imageInfo.py); // gets >> texture page address >> break; >> >> case 0x09 /*8 bit*/ : sprite->attribute = 1 << 24; >> sprite->w = imageInfo.pw*2; >> sprite->tpage = GetTPage(1,0,imageInfo.px,imageInfo.py); >> break; >> >> default /*16 bit*/ : sprite->attribute = 1 << 25; >> sprite->w = imageInfo.pw; >> sprite->tpage = GetTPage(2,0,imageInfo.px,imageInfo.py); >> break; >> } >> >> sprite->h = imageInfo.ph; // sets the height of the sprite >> >> sprite->u = 0; // sets the texture page offset of the sprite along >the >> x axis >> sprite->v = 0; // sets the texture page offset of the sprite along >the >> y axis >> >> sprite->cx = imageInfo.cx; // sets the x position of the CLUT, if any >> sprite->cy = imageInfo.cy; >> >> sprite->r = 128; // used to apply brightness to the sprite, 128 is >> normal >> sprite->g = 128; >> sprite->b = 128; >> >> sprite->mx = sprite->w/2; // sets the center point of the sprite for >use >> with rotation etc >> sprite->my = sprite->h/2; >> >> sprite->scalex = 4096; // sets sprite scaling to default, x axis >> sprite->scaley = 4096; // sets sprite scaling to default, y axis >> >> sprite->rotate = 0; // sets rotation to off >> } >> >> >/*-------------------------------------------CODE--------------------------- >> -----*/ >> >> Max >> >> >> >> >