\r
//unsigned short ppt[] = { 0x0f11, 0x0ff1, 0x01f1, 0x011f, 0x01ff, 0x0f1f, 0x0f0e, 0x0e7c };\r
\r
-static void (*DrawAllSpritesLoPri)(int *hcache, int maxwidth, int prio, int sh) = NULL;\r
-static void (*DrawAllSpritesHiPri)(int *hcache, int maxwidth, int prio, int sh) = NULL;\r
+static void (*DrawAllSpritesLoPri)(int *hcache, int prio, int sh) = NULL;\r
+static void (*DrawAllSpritesHiPri)(int *hcache, int prio, int sh) = NULL;\r
\r
struct TileStrip\r
{\r
void BackFill(int reg7, int sh);\r
void DrawSprite(int *sprite, int sh, int as);\r
void DrawTilesFromCache(int *hc, int sh, int rlim);\r
-void DrawSpritesFromCache(int *hc, int maxwidth, int prio, int sh);\r
+void DrawSpritesFromCache(int *hc, int prio, int sh);\r
void DrawLayer(int plane_sh, int *hcache, int cellskip, int maxcells);\r
void FinalizeLineBGR444(int sh);\r
void FinalizeLineRGB555(int sh);\r
switch (rlim-dx+8)\r
{\r
case 7: t=pack&0x00f00000; if (t) pd[6]=(unsigned char)(pal|(t>>20));\r
- case 6: t=pack&0x0f000000; if (t) pd[5]=(unsigned char)(pal|(t>>24));\r
- case 5: t=pack&0xf0000000; if (t) pd[4]=(unsigned char)(pal|(t>>28));\r
- case 4: t=pack&0x0000000f; if (t) pd[3]=(unsigned char)(pal|(t ));\r
- case 3: t=pack&0x000000f0; if (t) pd[2]=(unsigned char)(pal|(t>> 4));\r
- case 2: t=pack&0x00000f00; if (t) pd[1]=(unsigned char)(pal|(t>> 8));\r
- case 1: t=pack&0x0000f000; if (t) pd[0]=(unsigned char)(pal|(t>>12));\r
- default: break;\r
+ case 6: t=pack&0x0f000000; if (t) pd[5]=(unsigned char)(pal|(t>>24));\r
+ case 5: t=pack&0xf0000000; if (t) pd[4]=(unsigned char)(pal|(t>>28));\r
+ case 4: t=pack&0x0000000f; if (t) pd[3]=(unsigned char)(pal|(t ));\r
+ case 3: t=pack&0x000000f0; if (t) pd[2]=(unsigned char)(pal|(t>> 4));\r
+ case 2: t=pack&0x00000f00; if (t) pd[1]=(unsigned char)(pal|(t>> 8));\r
+ case 1: t=pack&0x0000f000; if (t) pd[0]=(unsigned char)(pal|(t>>12));\r
+ default: break;\r
}\r
}\r
}\r
}\r
\r
\r
-static void DrawAllSpritesInterlace(int *hcache, int maxwidth, int pri, int sh)\r
+static void DrawAllSpritesInterlace(int *hcache, int pri, int sh)\r
{\r
struct PicoVideo *pvid=&Pico.video;\r
int i,u,table,link=0,sline=DrawScanline<<1;\r
// check if sprite is not hidden offscreen\r
sx = (sx>>16)&0x1ff;\r
sx -= 0x78; // Get X coordinate + 8\r
- if(sx <= -8*3 || sx >= maxwidth) goto nextsprite;\r
+ if(sx <= -8*3 || sx >= 328) goto nextsprite;\r
\r
// sprite is good, save it's pointer\r
sprites[i++]=sprite;\r
\r
\r
#ifndef _ASM_DRAW_C\r
-static void DrawSpritesFromCache(int *hc, int maxwidth, int prio, int sh)\r
+static void DrawSpritesFromCache(int *hc, int prio, int sh)\r
{\r
int code, tile, sx, delta, width;\r
int pal;\r
}\r
#endif\r
\r
-static void DrawSpritesFromCacheAS(int *hc, int maxwidth, int prio, int sh)\r
+static void DrawSpritesFromCacheAS(int *hc, int prio, int sh)\r
{\r
int code, tile, sx, delta, width;\r
int pal, *hce, *hco;\r
int u,link=0;\r
int table=0;\r
int *pd = HighPreSpr;\r
- int max_lines = 224, max_sprites = 80;\r
+ int max_lines = 224, max_sprites = 80, max_width = 328;\r
int max_line_sprites = 20; // 20 sprites, 40 tiles\r
\r
if (!(Pico.video.reg[12]&1))\r
- max_sprites = 64, max_line_sprites = 16;\r
+ max_sprites = 64, max_line_sprites = 16, max_width = 264;\r
if (PicoOpt & POPT_DIS_SPRITE_LIM)\r
max_line_sprites = MAX_LINE_SPRITES;\r
\r
sx = (code2>>16)&0x1ff;\r
sx -= 0x78; // Get X coordinate + 8\r
sy = (pack << 16) >> 16;\r
- height = pack >> 28;\r
+ height = (pack >> 24) & 0xf;\r
\r
if (sy < max_lines && sy + (height<<3) > DrawScanline && // sprite onscreen (y)?\r
- (sx > -24 || sx < 328)) // onscreen x\r
+ (sx > -24 || sx < max_width)) // onscreen x\r
{\r
int y = (sy >= DrawScanline) ? sy : DrawScanline;\r
+ int offs = (pd - HighPreSpr) / 2;\r
for (; y < sy + (height<<3) && y < max_lines; y++)\r
{\r
- int i, cnt, offs;\r
+ int i, cnt;\r
cnt = HighLnSpr[y][0] & 0x7f;\r
if (cnt >= max_line_sprites) continue; // sprite limit?\r
- offs = (pd - HighPreSpr) / 2;\r
\r
for (i = 0; i < cnt; i++)\r
if (HighLnSpr[y][2+i] == offs) goto found;\r
{\r
unsigned int *sprite;\r
int code, code2, sx, sy, hv, height, width;\r
- int sx_min, offscr_x;\r
+ int sx_min;\r
\r
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite\r
\r
sx -= 0x78; // Get X coordinate + 8\r
sx_min = 8-(width<<3);\r
\r
- offscr_x = (sx <= sx_min) || sx >= 328;\r
-\r
if (sy < max_lines && sy + (height<<3) > DrawScanline) // sprite onscreen (y)?\r
{\r
int y = (sy >= DrawScanline) ? sy : DrawScanline;\r
int cnt = HighLnSpr[y][0];\r
if (cnt >= max_line_sprites) continue; // sprite limit?\r
\r
- if (HighLnSpr[y][1] >= max_line_sprites*2) { // tile limit?\r
+ if (HighLnSpr[y][1] >= max_line_sprites*2) { // tile limit?\r
HighLnSpr[y][0] |= 0x80;\r
- continue;\r
+ continue;\r
}\r
HighLnSpr[y][1] += width;\r
\r
if (sx == -0x78) {\r
if (cnt > 0)\r
HighLnSpr[y][0] |= 0x80; // masked, no more sprites for this line\r
- continue;\r
+ continue;\r
}\r
// must keep the first sprite even if it's offscreen, for masking\r
- if (cnt > 0 && (sx <= sx_min || sx >= 328)) continue; // offscreen x\r
+ if (cnt > 0 && (sx <= sx_min || sx >= max_width)) continue; // offscreen x\r
\r
HighLnSpr[y][2+cnt] = ((pd - HighPreSpr) / 2); // | prio;\r
HighLnSpr[y][0] = cnt + 1;\r
}\r
}\r
\r
-static void DrawAllSprites(int *hcache, int maxwidth, int prio, int sh)\r
+static void DrawAllSprites(int *hcache, int prio, int sh)\r
{\r
int rs = rendstatus, scan = DrawScanline;\r
unsigned char *p;\r
DrawWindow( (win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 0, sh|as);\r
} else\r
DrawLayer(0|((sh|as)<<1), HighCacheA, 0, maxcells);\r
- DrawAllSpritesLoPri(HighCacheS, maxw, 0, sh);\r
+ DrawAllSpritesLoPri(HighCacheS, 0, sh);\r
\r
- if (HighCacheB[0]) DrawTilesFromCache(HighCacheB, sh, 328);\r
+ if (HighCacheB[0]) DrawTilesFromCache(HighCacheB, sh, maxw);\r
if (hvwind == 1)\r
DrawWindow(0, maxcells>>1, 1, sh);\r
else if (hvwind == 2) {\r
- if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh, (win&0x80) ? edge<<4 : 328);\r
+ if(HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh, (win&0x80) ? edge<<4 : maxw);\r
DrawWindow((win&0x80) ? edge : 0, (win&0x80) ? maxcells>>1 : edge, 1, sh);\r
} else\r
- if (HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh, 328);\r
- if (HighCacheS[0]) DrawAllSpritesHiPri(HighCacheS, maxw, 1, sh);\r
+ if (HighCacheA[0]) DrawTilesFromCache(HighCacheA, sh, maxw);\r
+ if (HighCacheS[0]) DrawAllSpritesHiPri(HighCacheS, 1, sh);\r
\r
#if 0\r
{\r