diff options
Diffstat (limited to 'src/mame/video/k007121.cpp')
-rw-r--r-- | src/mame/video/k007121.cpp | 164 |
1 files changed, 67 insertions, 97 deletions
diff --git a/src/mame/video/k007121.cpp b/src/mame/video/k007121.cpp index e5bae691d41..5b6df6d3348 100644 --- a/src/mame/video/k007121.cpp +++ b/src/mame/video/k007121.cpp @@ -46,6 +46,7 @@ control registers 000: scroll x (low 8 bits) 001: -------x scroll x (high bit) ------x- enable rowscroll? (combatsc) + -----x-- unknown (flak attack) ----x--- this probably selects an alternate screen layout used in combat school where tilemap #2 is overlayed on front and doesn't scroll. The 32 lines of the front layer can be individually turned on or @@ -206,17 +207,6 @@ WRITE8_MEMBER( k007121_device::ctrl_w ) * 4 | ----xxx- | sprite size 000=16x16 001=16x8 010=8x16 011=8x8 100=32x32 * 4 | -------x | x position (high bit) * - * Flack Attack uses a different, "wider" layout with 32 bytes per sprite, - * mapped as follows, and the priority order is reversed. Maybe it is a - * compatibility mode with an older custom IC. It is not known how this - * alternate layout is selected. - * - * 0 -> e - * 1 -> f - * 2 -> 6 - * 3 -> 4 - * 4 -> 8 - * */ void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, device_palette_interface &palette, @@ -224,55 +214,37 @@ void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &clipre { // gfx_element *gfx = gfxs[chip]; int flipscreen = m_flipscreen; - int i, num, inc, offs[5]; + int i, num, inc; - if (is_flakatck) - { - num = 0x40; - inc = -0x20; - source += 0x3f * 0x20; - offs[0] = 0x0e; - offs[1] = 0x0f; - offs[2] = 0x06; - offs[3] = 0x04; - offs[4] = 0x08; - } - else /* all others */ + + /* TODO: sprite limit is supposed to be per-line! (check MT #00185) */ + num = 0x40; + //num = (k007121->ctrlram[0x03] & 0x40) ? 0x80 : 0x40; /* WRONG!!! (needed by combatsc) */ + + inc = 5; + /* when using priority buffer, draw front to back */ + if (pri_mask != -1) { - /* TODO: sprite limit is supposed to be per-line! (check MT #00185) */ - num = 0x40; - //num = (k007121->ctrlram[0x03] & 0x40) ? 0x80 : 0x40; /* WRONG!!! (needed by combatsc) */ - - inc = 5; - offs[0] = 0x00; - offs[1] = 0x01; - offs[2] = 0x02; - offs[3] = 0x03; - offs[4] = 0x04; - /* when using priority buffer, draw front to back */ - if (pri_mask != -1) - { - source += (num - 1)*inc; - inc = -inc; - } + source += (num - 1)*inc; + inc = -inc; } for (i = 0; i < num; i++) { - int number = source[offs[0]]; /* sprite number */ - int sprite_bank = source[offs[1]] & 0x0f; /* sprite bank */ - int sx = source[offs[3]]; /* vertical position */ - int sy = source[offs[2]]; /* horizontal position */ - int attr = source[offs[4]]; /* attributes */ - int xflip = source[offs[4]] & 0x10; /* flip x */ - int yflip = source[offs[4]] & 0x20; /* flip y */ - int color = base_color + ((source[offs[1]] & 0xf0) >> 4); + int number = source[0]; /* sprite number */ + int sprite_bank = source[1] & 0x0f; /* sprite bank */ + int sx = source[3]; /* vertical position */ + int sy = source[2]; /* horizontal position */ + int attr = source[4]; /* attributes */ + int xflip = source[4] & 0x10; /* flip x */ + int yflip = source[4] & 0x20; /* flip y */ + int color = base_color + ((source[1] & 0xf0) >> 4); int width, height; int transparent_mask; static const int x_offset[4] = {0x0,0x1,0x4,0x5}; static const int y_offset[4] = {0x0,0x2,0x8,0xa}; int x,y, ex, ey, flipx, flipy, destx, desty; - + if (attr & 0x01) sx -= 256; if (sy >= 240) sy -= 256; @@ -282,68 +254,66 @@ void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &clipre /* Flak Attack doesn't use a lookup PROM, it maps the color code directly */ /* to a palette entry */ + // TODO: is if (is_flakatck) transparent_mask = 1 << 0; else transparent_mask = palette.transpen_mask(*gfx, color, 0); - if (!is_flakatck || source[0x00]) /* Flak Attack needs this */ - { - number += bank_base; + number += bank_base; - switch (attr & 0xe) - { - case 0x06: width = height = 1; break; - case 0x04: width = 1; height = 2; number &= (~2); break; - case 0x02: width = 2; height = 1; number &= (~1); break; - case 0x00: width = height = 2; number &= (~3); break; - case 0x08: width = height = 4; number &= (~3); break; - default: width = 1; height = 1; + switch (attr & 0xe) + { + case 0x06: width = height = 1; break; + case 0x04: width = 1; height = 2; number &= (~2); break; + case 0x02: width = 2; height = 1; number &= (~1); break; + case 0x00: width = height = 2; number &= (~3); break; + case 0x08: width = height = 4; number &= (~3); break; + default: width = 1; height = 1; // logerror("Unknown sprite size %02x\n", attr & 0xe); // popmessage("Unknown sprite size %02x\n", attr & 0xe); - } + } - for (y = 0; y < height; y++) + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x++) { - for (x = 0; x < width; x++) + ex = xflip ? (width - 1 - x) : x; + ey = yflip ? (height - 1 - y) : y; + + if (flipscreen) + { + flipx = !xflip; + flipy = !yflip; + destx = 248 - (sx + x * 8); + desty = 248 - (sy + y * 8); + } + else { - ex = xflip ? (width - 1 - x) : x; - ey = yflip ? (height - 1 - y) : y; - - if (flipscreen) - { - flipx = !xflip; - flipy = !yflip; - destx = 248 - (sx + x * 8); - desty = 248 - (sy + y * 8); - } - else - { - flipx = xflip; - flipy = yflip; - destx = global_x_offset + sx + x * 8; - desty = sy + y * 8; - } - - if (pri_mask != -1) - gfx->prio_transmask(bitmap,cliprect, - number + x_offset[ex] + y_offset[ey], - color, - flipx,flipy, - destx,desty, - priority_bitmap,pri_mask, - transparent_mask); - else - gfx->transmask(bitmap,cliprect, - number + x_offset[ex] + y_offset[ey], - color, - flipx,flipy, - destx,desty, - transparent_mask); + flipx = xflip; + flipy = yflip; + destx = global_x_offset + sx + x * 8; + desty = sy + y * 8; } + + if (pri_mask != -1) + gfx->prio_transmask(bitmap,cliprect, + number + x_offset[ex] + y_offset[ey], + color, + flipx,flipy, + destx,desty, + priority_bitmap,pri_mask, + transparent_mask); + else + gfx->transmask(bitmap,cliprect, + number + x_offset[ex] + y_offset[ey], + color, + flipx,flipy, + destx,desty, + transparent_mask); } } - + source += inc; } } |