\r
ts.xmask=(1<<shift[width])-1; // X Mask in tiles (0x1f-0x7f)\r
ymask=(height<<8)|0xff; // Y Mask in pixels\r
- if(width == 1) ymask&=0x1ff;\r
- else if(width>1) ymask =0x0ff;\r
+ switch (width) {\r
+ case 1: ymask &= 0x1ff; break;\r
+ case 2: ymask = 0x007; break;\r
+ case 3: ymask = 0x0ff; break;\r
+ }\r
\r
// Find name table:\r
if (plane_sh&1) ts.nametab=(pvid->reg[4]&0x07)<<12; // B\r
// Index + 0 : hhhhvvvv ----hhvv yyyyyyyy yyyyyyyy // v, h: vert./horiz. size\r
// Index + 4 : xxxxxxxx xxxxxxxx pccvhnnn nnnnnnnn // x: x coord + 8\r
\r
-void PrepareSprites(int full)\r
+static NOINLINE void PrepareSprites(int full)\r
{\r
const struct PicoVideo *pvid=&Pico.video;\r
const struct PicoEState *est=&Pico.est;\r
static void DrawAllSprites(unsigned char *sprited, int prio, int sh,\r
struct PicoEState *est)\r
{\r
- int rs = est->rendstatus;\r
unsigned char *p;\r
int cnt;\r
\r
- if (rs & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {\r
- //elprintf(EL_STATUS, "PrepareSprites(%i)", (rs>>4)&1);\r
- PrepareSprites(rs & PDRAW_DIRTY_SPRITES);\r
- est->rendstatus = rs & ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);\r
- }\r
-\r
cnt = sprited[0] & 0x7f;\r
if (cnt == 0) return;\r
\r
\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
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
{\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
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
int win=0,edge=0,hvwind=0;\r
int maxw,maxcells;\r
\r
+ if (est->rendstatus & (PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES)) {\r
+ // elprintf(EL_STATUS, "PrepareSprites(%i)", (est->rendstatus>>4)&1);\r
+ PrepareSprites(est->rendstatus & PDRAW_DIRTY_SPRITES);\r
+ est->rendstatus &= ~(PDRAW_SPRITES_MOVED|PDRAW_DIRTY_SPRITES);\r
+ }\r
+\r
est->rendstatus &= ~(PDRAW_SHHI_DONE|PDRAW_PLANE_HI_PRIO);\r
\r
if (pvid->reg[12]&1) {\r
DrawLayer(0|(sh<<1), HighCacheA, 0, maxcells, est);\r
/* - sprites low - */\r
if (!(PicoDrawMask & PDRAW_SPRITES_LOW_ON));\r
- else if (Pico.est.rendstatus & PDRAW_INTERLACE)\r
+ else if (est->rendstatus & PDRAW_INTERLACE)\r
DrawAllSpritesInterlace(0, sh);\r
else if (sprited[1] & SPRL_HAVE_LO)\r
DrawAllSprites(sprited, 0, sh, est);\r
DrawTilesFromCache(HighCacheA, sh, maxw, est);\r
/* - sprites hi - */\r
if (!(PicoDrawMask & PDRAW_SPRITES_HI_ON));\r
- else if (Pico.est.rendstatus & PDRAW_INTERLACE)\r
+ else if (est->rendstatus & PDRAW_INTERLACE)\r
DrawAllSpritesInterlace(1, sh);\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
// 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