Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: mperdue@hrtc.net (Mario Perdue) Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Sprite/OT trouble Date: Sun, 03 Aug 1997 04:41:25 GMT Organization: SCEA Net Yaroze News Lines: 74 Message-ID: <33e4094a.25115732@205.149.189.29> References: <01bc9f6f$da300e60$37f135ce@jjustice.iquest.net> NNTP-Posting-Host: firewall.hrtc.net X-Newsreader: Forte Free Agent 1.1/32.230 John, I don't see anything wrong with what you've posted here. Any chance we could see the rest of the program? Mario On 2 Aug 1997 19:10:52 GMT, "John Emmer" wrote: >Here's my main display loop: > >while(!(padValue&PAD1_SELECT)) >{ > padValue = PadRead(); > > activeBuff = GsGetActiveBuff(); > > GsSetWorkBase((PACKET*)GpuPacketArea[activeBuff]); > > GsClearOt(0,0,&WorldOT[activeBuff]); > > // register sprites in OT (just players for now) > for (i = 0; i < 2; i++) > { > GsSortSprite(&(player[i].tank.turret.turretSprite), > &WorldOT[activeBuff],0); > GsSortSprite(&(player[i].tank.tankSprite), > &WorldOT[activeBuff],1); > } > > // add a dummy tank because last sprite is not displaying > GsSortSprite(&(computer[0].tank.tankSprite),&WorldOT[activeBuff],0); > > DrawSync(0); > > VSync(0); > > GsSwapDispBuff(); > > GsSortClear(255,255,255,&WorldOT[activeBuff]); > > GsDrawOt(&WorldOT[activeBuff]); >} > >And here are my questions: > > A couple of weird things are happening. I want the turrets to display >over the tanks, so I set the priority of the tanks to 1 and the turrets to >0. (My OT length is currently 4). For some reason, if I swap the order of >the two lines inside the for loop, the screen gets garbage. In their >current order it works. I know "Doctor, it hurts when I put them in this >order" "If it hurts, don't do it!" - but I want to understand _why_ this >makes a difference. > Secondly, as you see from the comment after the for loop, the fourth >sprite doesn't display (actually, it flickers on for a fraction of a second >every now and then). I figured it had something to do with the timing, so >I added a fifth sprite that I don't currently care about, so that the fifth >one wouldn't display instead of the fourth one that I do want. But why >isn't the fourth sprite displaying? > Finally, both of these problems go away if I run the program stepwise >through the CodeWarrior Debugger. This suggests to me even more strongly >that the problem has to do with timing. But I have my DrawSync(0) and >VSync(0) in there, and the rest of my code looks like the examples I've >seen (thanks Shadow and Mario!) as far as I can tell. What's up? > Thanks! > >-- > John Emmer Video Game Enthusiast, Philosopher, Fledgling Programmer > jjustice@cs.bsu.edu jjustice@iquest.net jpemmer@bsuvc.bsu.edu > > Vectrex; 7800, Supercharger, Lynx, Jaguar; NES, SNES, Virtual Boy; > Turbo Duo & Express; SG, SGCD, 32X, Saturn; 3DO; PlayStation, Yaroze; >C64, A600, A1200, P100; Arcade Centipede, Spy Hunter, Neo-Geo; BA, MA, ABD