mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
don't miss the sprite check
DrawAllSprites depends on HighLnSpr, so prepare in DrawAllSprites was a bad idea as lots of things may have changed
This commit is contained in:
parent
0c7d1ba332
commit
6d8782a1f9
2 changed files with 9 additions and 21 deletions
19
pico/draw.c
19
pico/draw.c
|
@ -954,7 +954,7 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
|
||||||
// Index + 0 : hhhhvvvv ----hhvv yyyyyyyy yyyyyyyy // v, h: vert./horiz. size
|
// Index + 0 : hhhhvvvv ----hhvv yyyyyyyy yyyyyyyy // v, h: vert./horiz. size
|
||||||
// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8
|
// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8
|
||||||
|
|
||||||
void PrepareSprites(int full)
|
static NOINLINE void PrepareSprites(int full)
|
||||||
{
|
{
|
||||||
const struct PicoVideo *pvid=&Pico.video;
|
const struct PicoVideo *pvid=&Pico.video;
|
||||||
const struct PicoEState *est=&Pico.est;
|
const struct PicoEState *est=&Pico.est;
|
||||||
|
@ -1117,16 +1117,9 @@ found:;
|
||||||
static void DrawAllSprites(unsigned char *sprited, int prio, int sh,
|
static void DrawAllSprites(unsigned char *sprited, int prio, int sh,
|
||||||
struct PicoEState *est)
|
struct PicoEState *est)
|
||||||
{
|
{
|
||||||
int rs = est->rendstatus;
|
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
if (rs & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {
|
|
||||||
//elprintf(EL_STATUS, "PrepareSprites(%i)", (rs>>4)&1);
|
|
||||||
PrepareSprites(rs & PDRAW_DIRTY_SPRITES);
|
|
||||||
est->rendstatus = rs & ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
|
||||||
}
|
|
||||||
|
|
||||||
cnt = sprited[0] & 0x7f;
|
cnt = sprited[0] & 0x7f;
|
||||||
if (cnt == 0) return;
|
if (cnt == 0) return;
|
||||||
|
|
||||||
|
@ -1288,6 +1281,12 @@ static int DrawDisplay(int sh)
|
||||||
int win=0,edge=0,hvwind=0;
|
int win=0,edge=0,hvwind=0;
|
||||||
int maxw,maxcells;
|
int maxw,maxcells;
|
||||||
|
|
||||||
|
if (est->rendstatus & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {
|
||||||
|
// elprintf(EL_STATUS, "PrepareSprites(%i)", (est->rendstatus>>4)&1);
|
||||||
|
PrepareSprites(est->rendstatus & PDRAW_DIRTY_SPRITES);
|
||||||
|
est->rendstatus &= ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);
|
||||||
|
}
|
||||||
|
|
||||||
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);
|
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);
|
||||||
|
|
||||||
if (pvid->reg[12]&1) {
|
if (pvid->reg[12]&1) {
|
||||||
|
@ -1331,7 +1330,7 @@ static int DrawDisplay(int sh)
|
||||||
DrawLayer(0|(sh<<1), HighCacheA, 0, maxcells, est);
|
DrawLayer(0|(sh<<1), HighCacheA, 0, maxcells, est);
|
||||||
/* - sprites low - */
|
/* - sprites low - */
|
||||||
if (!(PicoDrawMask & PDRAW_SPRITES_LOW_ON));
|
if (!(PicoDrawMask & PDRAW_SPRITES_LOW_ON));
|
||||||
else if (Pico.est.rendstatus & PDRAW_INTERLACE)
|
else if (est->rendstatus & PDRAW_INTERLACE)
|
||||||
DrawAllSpritesInterlace(0, sh);
|
DrawAllSpritesInterlace(0, sh);
|
||||||
else if (sprited[1] & SPRL_HAVE_LO)
|
else if (sprited[1] & SPRL_HAVE_LO)
|
||||||
DrawAllSprites(sprited, 0, sh, est);
|
DrawAllSprites(sprited, 0, sh, est);
|
||||||
|
@ -1352,7 +1351,7 @@ static int DrawDisplay(int sh)
|
||||||
DrawTilesFromCache(HighCacheA, sh, maxw, est);
|
DrawTilesFromCache(HighCacheA, sh, maxw, est);
|
||||||
/* - sprites hi - */
|
/* - sprites hi - */
|
||||||
if (!(PicoDrawMask & PDRAW_SPRITES_HI_ON));
|
if (!(PicoDrawMask & PDRAW_SPRITES_HI_ON));
|
||||||
else if (Pico.est.rendstatus & PDRAW_INTERLACE)
|
else if (est->rendstatus & PDRAW_INTERLACE)
|
||||||
DrawAllSpritesInterlace(1, sh);
|
DrawAllSpritesInterlace(1, sh);
|
||||||
// have sprites without layer pri bit ontop of sprites with that bit
|
// have sprites without layer pri bit ontop of sprites with that bit
|
||||||
else if ((sprited[1] & 0xd0) == 0xd0 && (PicoOpt & POPT_ACC_SPRITES))
|
else if ((sprited[1] & 0xd0) == 0xd0 && (PicoOpt & POPT_ACC_SPRITES))
|
||||||
|
|
|
@ -1101,17 +1101,6 @@ DrawSpriteSHi:
|
||||||
|
|
||||||
DrawAllSprites:
|
DrawAllSprites:
|
||||||
orr r1, r2, r1, lsl #1
|
orr r1, r2, r1, lsl #1
|
||||||
ldr r12,[r3, #OFS_rendstatus]
|
|
||||||
tst r12,#(PDRAW_DIRTY_SPRITES|PDRAW_SPRITES_MOVED)
|
|
||||||
beq das_no_prep
|
|
||||||
stmfd sp!, {r0,r1,r3,lr}
|
|
||||||
and r0, r12,#PDRAW_DIRTY_SPRITES
|
|
||||||
bic r12,r12,#(PDRAW_DIRTY_SPRITES|PDRAW_SPRITES_MOVED)
|
|
||||||
str r12,[r3, #OFS_rendstatus]
|
|
||||||
bl PrepareSprites
|
|
||||||
ldmfd sp!, {r0,r1,r3,lr}
|
|
||||||
|
|
||||||
das_no_prep:
|
|
||||||
ldr r2, [r0]
|
ldr r2, [r0]
|
||||||
ands r2, r2, #0x7f
|
ands r2, r2, #0x7f
|
||||||
bxeq lr
|
bxeq lr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue