eliminate texrels, part 3
[picodrive.git] / pico / draw.c
index e4bff25..cf638e9 100644 (file)
@@ -1161,8 +1161,6 @@ void BackFill(int reg7, int sh, struct PicoEState *est)
 \r
 // --------------------------------------------\r
 \r
-unsigned short HighPal[0x100];\r
-\r
 #ifndef _ASM_DRAW_C\r
 void PicoDoHighPal555(int sh, int line, struct PicoEState *est)\r
 {\r
@@ -1172,7 +1170,7 @@ void PicoDoHighPal555(int sh, int line, struct PicoEState *est)
   Pico.m.dirtyPal = 0;\r
 \r
   spal = (void *)Pico.cram;\r
-  dpal = (void *)HighPal;\r
+  dpal = (void *)est->HighPal;\r
 \r
   for (i = 0; i < 0x40 / 2; i++) {\r
     t = spal[i];\r
@@ -1206,7 +1204,7 @@ void FinalizeLine555(int sh, int line, struct PicoEState *est)
 {\r
   unsigned short *pd=est->DrawLineDest;\r
   unsigned char  *ps=est->HighCol+8;\r
-  unsigned short *pal=HighPal;\r
+  unsigned short *pal=est->HighPal;\r
   int len;\r
 \r
   if (Pico.m.dirtyPal)\r
@@ -1253,9 +1251,9 @@ static void FinalizeLine8bit(int sh, int line, struct PicoEState *est)
     rs |= PDRAW_SONIC_MODE;\r
     est->rendstatus = rs;\r
     if (dirty_count == 3) {\r
-      blockcpy(HighPal, Pico.cram, 0x40*2);\r
+      blockcpy(est->HighPal, Pico.cram, 0x40*2);\r
     } else if (dirty_count == 11) {\r
-      blockcpy(HighPal+0x40, Pico.cram, 0x40*2);\r
+      blockcpy(est->HighPal+0x40, Pico.cram, 0x40*2);\r
     }\r
   }\r
 \r
@@ -1496,15 +1494,16 @@ void PicoDrawSync(int to, int blank_last_line)
 // also works for fast renderer\r
 void PicoDrawUpdateHighPal(void)\r
 {\r
+  struct PicoEState *est = &Pico.est;\r
   int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?\r
   if (PicoOpt & POPT_ALT_RENDERER)\r
     sh = 0; // no s/h support\r
 \r
   PicoDoHighPal555(sh, 0, &Pico.est);\r
-  if (Pico.est.rendstatus & PDRAW_SONIC_MODE) {\r
+  if (est->rendstatus & PDRAW_SONIC_MODE) {\r
     // FIXME?\r
-    memcpy(HighPal + 0x40, HighPal, 0x40*2);\r
-    memcpy(HighPal + 0x80, HighPal, 0x40*2);\r
+    memcpy(est->HighPal + 0x40, est->HighPal, 0x40*2);\r
+    memcpy(est->HighPal + 0x80, est->HighPal, 0x40*2);\r
   }\r
 }\r
 \r