Path: chuka.playstation.co.uk!news From: "Chris Wallace" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Basic beginner questions Date: Sat, 11 May 2002 23:40:44 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 126 Message-ID: References: NNTP-Posting-Host: host217-39-8-54.in-addr.btopenworld.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 before you try this make a backup.. because i am NOT the best coder here and i have NOT tested this! here is what i have done with what you gave: Firstly, in the loop which was changing the sprite.r values (etc) the sprite was not written to the screen, vsync doesnt write to the scrren, it waits for vertical syncronisation, or the end of drawing the last frame (i think), also to fade in you need to start at 0 and up the r/g/b values, so i have added a line to set it to 0 and changed to loop to increase values. Also i saw no code to keep it there are fade it out, i added these although i dont know if i missed something! Next i took all you ur writing functions and put them into UpdateScreen(); Personnaly i would put all the sortsprite functions in there, that way calling it will show a frame, and makes it easier, i have done this also.. I actually doubt this will work, as i have never coding something that worked first time, as so i hope some1 else will post what they would do! Anyway, hope this helps! Chris void main (void) { int vsync = 0; // vertical screen sync int BufferIndex; // buffer index int frame; Initialise(); InitSprite((u_long *)YAROZE_SCENE_ADD); BufferIndex = GsGetActiveBuff(); // Returns either 1 or 0, GameState = RUNNING; while(GameState) // Check that we are still playing the game { switch(GameState) { case RUNNING: // The Normal GamePlay break; case TITLESCREEN: // The TitleScreen sprite.r=sprite.g=sprite.b = 0 for(frame=0;frame<=(128/3); frame++) { sprite.r += 3; sprite.g += 3; sprite.b += 3; UpdateScreen(); } for(frame=0;frame<=(50*5); frame++) { UpdateScreen(); } for(frame=0;frame<=(128/3); frame++) } sprite.r -= 3; sprite.g -= 3; sprite.b -= 3; UpdateScreen(); } GameState = RUNNING; break; case PAUSE: // Pause Command break; case GAMEOVER: // GameOver break; } DealWithPad(); } ResetGraph(0); } UpdateScreen() { int count; // get the active buffer BufferIndex = GsGetActiveBuff(); // sets drawing command storage address GsSetWorkBase((PACKET*)packetAre[BufferIndex]); // initialises the ordering table GsClearOt(0, 0, &WorldOT[BufferIndex]); // rendering done here for( count =0; count <8; count++ ) FntFlush(fnt_id[count]); GsSortSprite(&sprite,&WorldOT[BufferIndex],0); // wait for vertical synchronisation //DrawSync(0); VSync(0); // 0: blocking until vertical synch occurs // swap double buffers, (changes the display buffer and drawing buffer) GsSwapDispBuff(); // start execution of the drawing command registered in OT GsDrawOt(&WorldOT[BufferIndex]); }