Ver código fonte

overdraw eliminated in AS mode

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@519 be3aeb3a-fb24-0410-a615-afba39da0efa
notaz 16 anos atrás
pai
commit
97a7f774d3
3 arquivos alterados com 19 adições e 25 exclusões
  1. 12 13
      Pico/Draw.c
  2. 5 11
      Pico/Draw.s
  3. 2 1
      Pico/Pico.c

+ 12 - 13
Pico/Draw.c

@@ -628,7 +628,7 @@ last_cut_tile:
 // Index + 0  :    hhhhvvvv ab--hhvv yyyyyyyy yyyyyyyy // a: offscreen h, b: offs. v, h: horiz. size
 // Index + 4  :    xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8
 
-static void DrawSprite(int *sprite, int sh, int as)
+static void DrawSprite(int *sprite, int sh)
 {
   int width=0,height=0;
   int row=0,code=0;
@@ -657,7 +657,7 @@ static void DrawSprite(int *sprite, int sh, int as)
   delta<<=4; // Delta of address
 
   pal=(code>>9)&0x30;
-  pal|=((sh|as)<<6);
+  pal|=sh<<6;
 
   if (sh && (code&0x6000) == 0x6000) {
     if(code&0x0800) fTileFunc=TileFlipSH_noop;
@@ -1085,7 +1085,7 @@ static void DrawAllSprites(int prio, int sh)
 {
   int rs = rendstatus, scan = DrawScanline;
   unsigned char *p;
-  int cnt, as;
+  int cnt;
 
   if (rs & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {
     //elprintf(EL_STATUS, "PrepareSprites(%i)", (rs>>4)&1);
@@ -1097,15 +1097,14 @@ static void DrawAllSprites(int prio, int sh)
   if (cnt == 0) return;
 
   p = &HighLnSpr[scan][2];
-  as = (rs & PDRAW_ACC_SPRITES) ? 1 : 0;
 
   // Go through sprites backwards:
   for (cnt--; cnt >= 0; cnt--)
   {
     int offs;
-    if ((p[cnt] >> 7) != prio && !as) continue;
+    if ((p[cnt] >> 7) != prio) continue;
     offs = (p[cnt]&0x7f) * 2;
-    DrawSprite(HighPreSpr + offs, sh, as);
+    DrawSprite(HighPreSpr + offs, sh);
   }
 }
 
@@ -1331,7 +1330,7 @@ static int DrawDisplay(int sh, int as)
     DrawWindow(                           (win&0x80) ? edge :       0, (win&0x80) ? maxcells>>1 : edge, 0, sh|as);
   } else
     DrawLayer(0|((sh|as)<<1), HighCacheA, 0, maxcells);
-  if ((rendstatus & PDRAW_HAVE_LO_SPR) || as)
+  if (rendstatus & PDRAW_HAVE_LO_SPR)
     DrawAllSpritesLoPri(0, sh);
 
   if (HighCacheB[0]) DrawTilesFromCache(HighCacheB, sh, maxw);
@@ -1366,12 +1365,7 @@ PICO_INTERNAL void PicoFrameStart(void)
   if (PicoOpt & POPT_ACC_SPRITES)
     rendstatus |= PDRAW_ACC_SPRITES;
 
-  if ((Pico.video.reg[12]&6) == 6) {
-    rendstatus |= PDRAW_INTERLACE; // interlace mode
-    DrawAllSpritesLoPri =
-    DrawAllSpritesHiPri = DrawAllSpritesInterlace;
-  }
-  else if (sh)
+  if (sh)
   {
     DrawAllSpritesLoPri = DrawAllSprites;
     DrawAllSpritesHiPri = DrawSpritesSHi;
@@ -1383,6 +1377,11 @@ PICO_INTERNAL void PicoFrameStart(void)
   }
   if (rendstatus & PDRAW_ACC_SPRITES)
     DrawAllSpritesHiPri = DrawSpritesHiAS;
+  if ((Pico.video.reg[12]&6) == 6) {
+    rendstatus |= PDRAW_INTERLACE; // interlace mode
+    DrawAllSpritesLoPri =
+    DrawAllSpritesHiPri = DrawAllSpritesInterlace;
+  }
 
   if (Pico.m.dirtyPal) Pico.m.dirtyPal = 2; // reset dirty if needed
 

+ 5 - 11
Pico/Draw.s

@@ -1163,17 +1163,12 @@ das_no_prep:
 
     @ time to do some real work
     stmfd   sp!, {r4-r11,lr}
-    ldr     r4, =rendstatus
     mov     r12,#0xff
-    ldr     r4, [r4]
     strb    r12,[r2,#1]     @ set end marker
     add     r10,r2, #2
     add     r10,r10,r3      @ r10=HighLnSpr end
 
-    mov     r8, r1, lsl #4
-    tst     r4, #PDRAW_ACC_SPRITES
-    orrne   r8, r8, #1
-    str     r8, [sp, #-4]   @ no calls after this point
+    str     r1, [sp, #-4]   @ no calls after this point
 
 .if OVERRIDE_HIGHCOL
     ldr     r11,=HighCol
@@ -1196,7 +1191,7 @@ DrawSprite: @ was: unsigned int *sprite, int sh, int acc_sprites
     mov     r2, r0, lsr #7
     cmp     r0, #0xff
     ldmeqfd sp!, {r4-r11,pc} @ end of list
-    cmp     r2, r8, lsr #5
+    cmp     r2, r8, lsr #1
     bne     DrawSprite      @ wrong priority
     and     r0, r0, #0x7f
     add     r0, r1, r0, lsl #3
@@ -1220,7 +1215,7 @@ DrawSprite: @ was: unsigned int *sprite, int sh, int acc_sprites
     mov     r2, r9, asr #16 @ r2=sx
     mov     r9, r9, lsl #16
     mov     r9, r9, lsr #16
-    orr     r9, r9, r8, lsl #27 @ r9=code|sh[31]|as[27]
+    orr     r9, r9, r8, lsl #31 @ r9=code|sh[31]
 
     tst     r9, #0x1000
     movne   r4, r5, lsl #3
@@ -1242,11 +1237,10 @@ DrawSprite: @ was: unsigned int *sprite, int sh, int acc_sprites
     mov     r5, r5, lsl #4     @ delta<<=4; // Delta of address
     and     r4, r9, #0x6000
     orr     r9, r9, r4, lsl #16
-    orr     r9, r9, #0x10000000 @ r9=scc1 a??? ... <code> (s=shadow/hilight, cc=pal, a=acc_spr)
+    orrs    r9, r9, #0x10000000 @ r9=scc1 ???? ... <code> (s=shadow/hilight, cc=pal)
 
-    orrs    r3, r9, r9, lsl #4
     mov     r3, r4, lsr #9     @ r3=pal=((code>>9)&0x30);
-    orrmi   r3, r3, #0x40      @ for shadow|as
+    orrmi   r3, r3, #0x40      @ for sh/hi
 
     add     r6, r6, #1         @ inc now
     adds    r0, r2, #0         @ mov sx to r0 and set ZV flags

+ 2 - 1
Pico/Pico.c

@@ -375,7 +375,8 @@ char *debugString(void)
     else sprites_lo++;
 
   dstrp = dstr;
-  sprintf(dstrp, "mode set 1: %02x       spr lo: %2i, spr hi: %2i\n", (r=reg[0]), sprites_lo, sprites_hi);
+  sprintf(dstrp, "mode set 1: %02x       spr lo[%c]: %2i, spr hi[%c]: %2i\n", (r=reg[0]),
+    rendstatus&PDRAW_HAVE_LO_SPR?'y':'n', sprites_lo, rendstatus&PDRAW_HAVE_HI_SPR?'y':'n', sprites_hi);
   dstrp+=strlen(dstrp);
   sprintf(dstrp, "display_disable: %i, M3: %i, palette: %i, ?, hints: %i\n", bit(r,0), bit(r,1), bit(r,2), bit(r,4));
   dstrp+=strlen(dstrp);