Path: chuka.playstation.co.uk!news From: "Rad" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: pmode in GsIMAGE Date: Sun, 28 Feb 1999 14:26:01 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 76 Message-ID: <7bbjm6$abn3@chuka.playstation.co.uk> References: <7ba63i$9po27@chuka.playstation.co.uk> NNTP-Posting-Host: vil-53.village.gre.ac.uk X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Hi Rikki, Try this: switch (tim.pmode) { case 0x08 :sprite->w=tim.pw*4; /* If sprite is 4 bit, make width 4 times bigger */ break; case 0x09 :sprite->w=tim.pw*2; /* If sprite is 8 bit, make width 2 times bigger */ break; default :sprite->w=tim.pw; /* Else set it to width got from tim info */ break; } That should work. Rad. rad@cyberdude.com http://www.netyaroze-europe.com/~radpsx Rikki Prince wrote in message <7ba63i$9po27@chuka.playstation.co.uk>... >I'm currently trying to write a function which will set up a sprite, just by >passing as few as possible parameters i.e. only the absolutely needed ones >are passed: TIM address, pointer to sprite etc. However, one thing that I >cannot currently get to work is getting the function to work out within >itself whether the TIM is 4bit CLUT, 8bit CLUT or otherwise. From the look >of the GsIMAGE structure in the library reference manual, I should be able >to read the pmode member and work out whether it is 4bit, 8 bit or >otherwise. However, when I put this in a switch statement, it doesn't work. >I've also tried it in an if/else if/else setup, and it still doesn't work. >I've just realised I should have put this earlier in the message, but the >problem I'm having is (constructing sentences and messages!! lol) trying to >set the width of the sprite in the GsSPRITE structure, as when the TIM is >4bit, you need to *4, and when it's 8bit you need to *2 (something I picked >up from the Ira Rainey tutorial). As this is going to be a function I'll >need to use for different TIMs, and therefore not specific, I need it to >work out for itself whether the TIM is 4/8/16 bit etc. I've got it partly >working, by putting in if((tim.pmode>>3)&0x01) sprite->w=tim.pw*2; the >'if' part of which I took from the texture load in Peter Passmore's 3d >tutorial, but I believe (well, guess) this bit manipulation tests whether >it's one of 8 or 4 bit, not either individually, which is what I want! > >Basically in conclusion, I need some help on how I can test to see if the >sprite is 4bit/8bit/otherwise, so I can set the width accordingly, something >which seems not to work normally, and only with bits shifts and clever >tricky stuff which the 286 in me 'ead don't seem to be able to cope with. > >Thanks in advance to anyone who can decipher what I've said in the preceding >message, and decides to help this poor little beginner :-) > >Rikki > > >PS here's my switch statement which doesn't work, if anyone is interested. > >switch (tim.pmode) > { > case 0 :sprite->w=tim.pw*4; /* If sprite is 4 bit, make width 4 times >bigger */ > break; > case 1 :sprite->w=tim.pw*2; /* If sprite is 8 bit, make width 2 times >bigger */ > break; > default :sprite->w=tim.pw*2; /* Else set it to width got from tim info */ > break; > } > >