UIQ3 bugfixes, SVP drc indirect jumps, stuff
[picodrive.git] / Pico / Draw.c
index 7dadb4b..215e9ec 100644 (file)
@@ -839,7 +839,7 @@ static void DrawSpritesSHi(unsigned char *sprited)
     }\r
   }\r
 }\r
-#endif\r
+#endif // !_ASM_DRAW_C\r
 \r
 static void DrawSpritesHiAS(unsigned char *sprited, int sh)\r
 {\r
@@ -850,6 +850,8 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
   cnt = sprited[0] & 0x7f;\r
   if (cnt == 0) return;\r
 \r
+  rendstatus |= PDRAW_SPR_LO_ON_HI;\r
+\r
   p = &sprited[3];\r
 \r
   // Go through sprites:\r
@@ -1200,7 +1202,7 @@ static void FinalizeLineBGR444(int sh)
     }\r
   }\r
 \r
-  if (!sh && (rendstatus & PDRAW_ACC_SPRITES))\r
+  if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI))\r
     mask=0x3f; // accurate sprites\r
 \r
   for(i = 0; i < len; i++)\r
@@ -1228,7 +1230,7 @@ static void FinalizeLineRGB555(int sh)
   {\r
 #ifndef PSP\r
     int i, mask=0xff;\r
-    if (!sh && (rendstatus & PDRAW_ACC_SPRITES))\r
+    if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI))\r
       mask=0x3f; // accurate sprites, upper bits are priority stuff\r
 \r
     for (i = 0; i < len; i++)\r
@@ -1236,7 +1238,7 @@ static void FinalizeLineRGB555(int sh)
 #else\r
     extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);\r
     extern void amips_clut_6bit(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);\r
-    if (!sh && (rendstatus & PDRAW_ACC_SPRITES))\r
+    if (!sh && (rendstatus & PDRAW_SPR_LO_ON_HI))\r
          amips_clut_6bit(pd, ps, pal, len);\r
     else amips_clut(pd, ps, pal, len);\r
 #endif\r
@@ -1250,7 +1252,7 @@ static void FinalizeLine8bit(int sh)
   int len, rs = rendstatus;\r
   static int dirty_count;\r
 \r
-  if (!sh && !(rs & PDRAW_ACC_SPRITES) && Pico.m.dirtyPal == 1 && DrawScanline < 222)\r
+  if (!sh && Pico.m.dirtyPal == 1 && DrawScanline < 222)\r
   {\r
     // a hack for mid-frame palette changes\r
     if (!(rs & PDRAW_SONIC_MODE))\r
@@ -1374,8 +1376,8 @@ static int DrawDisplay(int sh)
   if (!(PicoDrawMask & PDRAW_SPRITES_HI_ON));\r
   else if (rendstatus & PDRAW_INTERLACE)\r
     DrawAllSpritesInterlace(1, sh);\r
-  // AS on and have both lo/hi sprites and lo before hi sprites?\r
-  else if ((sprited[1] & 0xd0) == 0xd0 && (rendstatus & PDRAW_ACC_SPRITES))\r
+  // have sprites without layer pri bit ontop of sprites with that bit\r
+  else if ((sprited[1] & 0xd0) == 0xd0 && (PicoOpt & POPT_ACC_SPRITES))\r
     DrawSpritesHiAS(sprited, sh);\r
   else if (sh && (sprited[1] & SPRL_MAY_HAVE_OP))\r
     DrawSpritesSHi(sprited);\r
@@ -1394,13 +1396,11 @@ static int DrawDisplay(int sh)
   return 0;\r
 }\r
 \r
-\r
+// MUST be called every frame\r
 PICO_INTERNAL void PicoFrameStart(void)\r
 {\r
   // prepare to do this frame\r
   rendstatus = 0;\r
-  if (PicoOpt & POPT_ACC_SPRITES)\r
-    rendstatus |= PDRAW_ACC_SPRITES;\r
   if ((Pico.video.reg[12]&6) == 6)\r
     rendstatus |= PDRAW_INTERLACE; // interlace mode\r
 \r