Path: chuka.playstation.co.uk!news From: george_bain@playstation.sony.com (George Bain) Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: ugly sprite-ling is not changing! Date: 2 Jul 1999 11:24:20 GMT Organization: Sony Computer Entertainment Europe Lines: 168 Message-ID: <7li7h4$ko28@chuka.playstation.co.uk> References: <3773B07B.27E19B85@aol.com> NNTP-Posting-Host: mailgate.scee.sony.co.uk Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII X-Newsreader: WinVN 0.99.8 (x86 32bit) Hi there, STEP 1 1- open your favourite graphics program 2- draw some sprite (try to use even width sprites (e.g.32x32,64x64)) 3- select the sprite palette as 4,-8,-or 16bit (I recommend using 8bit (256 colors)) 4- save a .bmp (Microsoft Bitmap) STEP 2 1- open up TIMTOOL and set your video mode. 2- The free area is the light green area 3- go to "file" and choose "import image file" (will convert the .bmp -> .tim ) 4- align your images on the boundries. (every 64 width and 256 height (the white lines in TIMTOOL!!) 5- if your images are 4,8-bit align you CLUTS (same as above!) 6- save and exit STEP 3 1- find some sample code to draw a sprite ( my tutorial!!) 2- init the sprite image see below 3- sort the sprite in the OT 4- pray that I didn't mess up writting all this! //------- I N I T S P R I T E // global! GsSPRITE sprite; void InitPlayer( void ) { GsIMAGE *tim=NULL; tim = ReadTexture((u_long*)MY_ADDR); switch( tim.pmode ) { case 0x08: //4 bit with CLUT sprite.attribute = 0; sprite.w = (tim.pw*4); sprite.tpage = GetTPage(0,0,tim.px,tim.py); break; case 0x09: //8 bit with CLUT sprite.attribute |= (1<<24); sprite.w = (tim.pw*2); sprite.tpage = GetTPage(1,0,tim.px,tim.py); break; case 0x02: //16 bit sprite.attribute |= (1<<25); sprite.w = tim.pw; sprite.tpage = GetTPage(2,0,tim.px,tim.py); break; } sprite.x = 150; sprite.y = 150; sprite.h = tim.ph; sprite.u = 0; sprite.v = 0; sprite.cx = tim.cx; sprite.cy = tim.cy; sprite.r = 0x80; sprite.g = 0x80; sprite.b = 0x80; sprite.mx = sprite.w/2; sprite.my = sprite.h/2; sprite.scalex = ONE; sprite.scaley = ONE; sprite.rotate = 0; // sprite range (0~255) if( (sprite.w > 256) || (sprite.h > 256) ) { printf(" ERROR: Over max sprite.w:(%d) or sprite.h:(%d)\n",sprite.w,sprite.h); } }// end InitPlayer //------ S O R T S P R I T E void UpdateScreen( void ) { int count; // get the active buffer output_buffer_index = GsGetActiveBuff(); // sets drawing command storage address GsSetWorkBase((PACKET*)gpu_work_area[output_buffer_index]); // initialises the ordering table GsClearOt(0, 0, &world_ordering_table[output_buffer_index]); // rendering done here GsSortSprite(&sprite, &world_ordering_table[output_buffer_index], 0); // next sprite // next sprite , etc.... DrawSync(0); // wait for vertical synchronisation VSync(0); // 0: blocking until vertical synch occurs // swap double buffers, (changes the display buffer and drawing buffer) GsSwapDispBuff(); // registers drawing clear command in OT (e.g. clear to black) GsSortClear(0x0, 0x0, 0x80, &world_ordering_table[output_buffer_index]); // start execution of the drawing command registered in OT GsDrawOt(&world_ordering_table[output_buffer_index]); FntFlush(-1); }// end UpdateScreen In article <3773B07B.27E19B85@aol.com>, Metwally7@aol.com says... > >in regards to the reply to my previous message about the "ugly sprite" > >i was using George Bain's Ch. 4 (sprite collision) tutorial, example >4-bounding boxes (restore). I tried replacing George's sprites with my >sprites, and that's when the sprites were messed up. actually, i moved >them around a bit and player 2 is fine, but player 1 is cut off at the >top. and before anyone says its the code's fault, i should say that i >modified it to use 2 hex addresses. the cluts are in free vram space, >BUT the problem is that some spots that i move the sprite to in timtool >kind of mutilate it while others semi-mutilate it. WHERE IN TIM TOOL AM >I SUPPOSE TO MOVE THE TIMS?! ( i know not to put them in the green or >brown areas. for some reason it changes the sprite when i move it to >different areas in the light blue FREE areas in tim tool. i guess the >latter questions is giving me the most trouble. > >thank you, > > >Omar > > > >