From c469068273b98aba2a82020a805010c929be81a1 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 4 Apr 2014 00:51:15 +0000 Subject: [PATCH] some misc Kaneko refactor, preparation for further work (nw) --- src/mame/drivers/kaneko16.c | 39 +++++++++++++++-- src/mame/includes/kaneko16.h | 29 ++++++++++--- src/mame/video/kaneko16.c | 76 ++++++++++++++++++++++++--------- src/mame/video/kaneko_spr.c | 82 ++++++++++++++++++++++++++++-------- src/mame/video/kaneko_spr.h | 15 ++++++- src/mame/video/kaneko_tmap.c | 17 ++++++-- src/mame/video/kaneko_tmap.h | 11 +++++ 7 files changed, 217 insertions(+), 52 deletions(-) diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index 8e938427cea..88b693994ef 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -232,6 +232,32 @@ WRITE16_MEMBER(kaneko16_state::kaneko16_eeprom_w) The Berlin Wall ***************************************************************************/ +READ16_MEMBER(kaneko16_berlwall_state::berlwall_oki_r) +{ + UINT16 ret; + + if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte. + { + mem_mask >>= 8; + } + + ret = m_oki->read(space, offset, mem_mask); + ret = ret | ret << 8; + + return ret; +} + +WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_oki_w) +{ + if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte. + { + data >>= 8; + mem_mask >>= 8; + } + + m_oki->write(space, offset, data, mem_mask); +} + static ADDRESS_MAP_START( berlwall, AS_PROGRAM, 16, kaneko16_berlwall_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM // ROM AM_RANGE(0x200000, 0x20ffff) AM_RAM // Work RAM @@ -251,7 +277,7 @@ static ADDRESS_MAP_START( berlwall, AS_PROGRAM, 16, kaneko16_berlwall_state ) AM_RANGE(0x800000, 0x80001f) AM_READWRITE(kaneko16_ay1_YM2149_r, kaneko16_ay1_YM2149_w) // Sound AM_RANGE(0x800200, 0x80021f) AM_READWRITE(kaneko16_ay2_YM2149_r, kaneko16_ay2_YM2149_w) AM_RANGE(0x8003fe, 0x8003ff) AM_NOP // for OKI when accessed as .l - AM_RANGE(0x800400, 0x800401) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) + AM_RANGE(0x800400, 0x800401) AM_READWRITE( berlwall_oki_r, berlwall_oki_w ) AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w ) AM_RANGE(0xd00000, 0xd0001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w) ADDRESS_MAP_END @@ -1630,10 +1656,13 @@ static MACHINE_CONFIG_START( berlwall, kaneko16_berlwall_state ) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1) MCFG_SCREEN_UPDATE_DRIVER(kaneko16_berlwall_state, screen_update_berlwall) - MCFG_SCREEN_PALETTE("palette") +// MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit) - MCFG_PALETTE_ADD("palette", 2048 + 32768) /* 32768 static colors for the bg */ + MCFG_PALETTE_ADD("palette", 2048 ) + MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) + + MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */ MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) MCFG_PALETTE_INIT_OWNER(kaneko16_berlwall_state,berlwall) @@ -1764,7 +1793,7 @@ static MACHINE_CONFIG_START( blazeon, kaneko16_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB) - + MCFG_DEVICE_ADD("view2_0", KANEKO_TMAP, 0) kaneko_view2_tilemap_device::set_gfx_region(*device, 1); kaneko_view2_tilemap_device::set_offset(*device, 0x33, 0x8, 320, 240); @@ -2486,6 +2515,7 @@ ROM_START( berlwallt ) ROM_END + /*************************************************************************** Blaze On (Japan version) @@ -3854,6 +3884,7 @@ DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, brapboys ) GAME( 1991, berlwall, 0, berlwall, berlwall, kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall", 0 ) GAME( 1991, berlwallt,berlwall, berlwall, berlwalt, kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall (bootleg ?)", 0 ) + GAME( 1991, mgcrystl, 0, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 92/01/10)", 0 ) GAME( 1991, mgcrystlo,mgcrystl, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 91/12/10)", 0 ) GAME( 1991, mgcrystlj,mgcrystl, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko (Atlus license)", "Magical Crystals (Japan, 92/01/13)", 0 ) diff --git a/src/mame/includes/kaneko16.h b/src/mame/includes/kaneko16.h index 4c3f7f6119d..4e377494aba 100644 --- a/src/mame/includes/kaneko16.h +++ b/src/mame/includes/kaneko16.h @@ -31,7 +31,8 @@ public: m_view2_0(*this, "view2_0"), m_view2_1(*this, "view2_1"), m_kaneko_spr(*this, "kan_spr"), - m_pandora(*this, "pandora") + m_pandora(*this, "pandora"), + m_palette(*this, "palette") { } required_device m_maincpu; @@ -45,6 +46,7 @@ public: optional_device m_view2_1; optional_device m_kaneko_spr; optional_device m_pandora; + required_device m_palette; UINT16 m_disp_enable; @@ -72,10 +74,19 @@ public: DECLARE_VIDEO_START(kaneko16); DECLARE_MACHINE_RESET(mgcrystl); UINT32 screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + template + UINT32 screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect); + + + TIMER_DEVICE_CALLBACK_MEMBER(kaneko16_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(shogwarr_interrupt); - void kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + + template + void kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect); + + void kaneko16_common_oki_bank_w( const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize ); void kaneko16_unscramble_tiles(const char *region); void kaneko16_expand_sample_banks(const char *region); @@ -111,12 +122,15 @@ public: kaneko16_berlwall_state(const machine_config &mconfig, device_type type, const char *tag) : kaneko16_state(mconfig, type, tag), m_bg15_reg(*this, "bg15_reg"), - m_bg15_select(*this, "bg15_select") + m_bg15_select(*this, "bg15_select"), + m_bgpalette(*this, "bgpalette") + { } optional_shared_ptr m_bg15_reg; optional_shared_ptr m_bg15_select; + required_device m_bgpalette; bitmap_ind16 m_bg15_bitmap; @@ -125,11 +139,14 @@ public: DECLARE_READ16_MEMBER(kaneko16_bg15_reg_r); DECLARE_WRITE16_MEMBER(kaneko16_bg15_reg_w); + DECLARE_READ16_MEMBER(berlwall_oki_r); + DECLARE_WRITE16_MEMBER(berlwall_oki_w); + DECLARE_DRIVER_INIT(berlwall); DECLARE_PALETTE_INIT(berlwall); DECLARE_VIDEO_START(berlwall); - UINT32 screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); }; class kaneko16_shogwarr_state : public kaneko16_state diff --git a/src/mame/video/kaneko16.c b/src/mame/video/kaneko16.c index 1472fca8184..0a29b5ebc73 100644 --- a/src/mame/video/kaneko16.c +++ b/src/mame/video/kaneko16.c @@ -24,25 +24,40 @@ VIDEO_START_MEMBER(kaneko16_state,kaneko16) -void kaneko16_state::kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) +/* Fill the bitmap with a single colour. This is wrong, but will work most of + the times. To do it right, each pixel should be drawn with pen 0 + of the bottomost tile that covers it (which is pretty tricky to do) */ +template +void kaneko16_state::kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect) { + int pen = 0; + if (m_kaneko_spr) - if(m_kaneko_spr->get_sprite_type()== 1) + { + if (m_kaneko_spr->get_sprite_type() == 1) { - bitmap.fill(0x7f00, cliprect); - return; + pen = 0x7f00; } + } - - /* Fill the bitmap with pen 0. This is wrong, but will work most of - the times. To do it right, each pixel should be drawn with pen 0 - of the bottomost tile that covers it (which is pretty tricky to do) */ - bitmap.fill(0, cliprect); - + typename _BitmapClass::pixel_t *dest; + if (sizeof(*dest) == 2) + { + bitmap.fill(pen, cliprect); + } + else + { + const pen_t *pal = palette->pens(); + bitmap.fill(pal[pen], cliprect); + } } -UINT32 kaneko16_state::screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) + + + +template +UINT32 kaneko16_state::screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect) { int i; @@ -66,7 +81,7 @@ UINT32 kaneko16_state::screen_update_common(screen_device &screen, bitmap_ind16 UINT32 kaneko16_state::screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - kaneko16_fill_bitmap(bitmap,cliprect); + kaneko16_fill_bitmap(m_palette, bitmap,cliprect); // if the display is disabled, do nothing? if (!m_disp_enable) return 0; @@ -91,7 +106,7 @@ PALETTE_INIT_MEMBER(kaneko16_berlwall_state,berlwall) /* initialize 555 RGB lookup */ for (i = 0; i < 32768; i++) - palette.set_pen_color(2048 + i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); + palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); } VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall) @@ -134,7 +149,7 @@ VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall) if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; /* decrease with wraparound */ - m_bg15_bitmap.pix16(y, sx * 256 + x) = 2048 + ((g << 10) | (r << 5) | b); + m_bg15_bitmap.pix16(y, sx * 256 + x) = ((g << 10) | (r << 5) | b); } VIDEO_START_CALL_MEMBER(kaneko16); @@ -164,29 +179,50 @@ READ16_MEMBER(kaneko16_berlwall_state::kaneko16_bg15_reg_r) WRITE16_MEMBER(kaneko16_berlwall_state::kaneko16_bg15_reg_w) { COMBINE_DATA(&m_bg15_reg[0]); +// printf("kaneko16_bg15_reg_w %04x\n", m_bg15_reg[0]); + double brt1 = data & 0xff; + brt1 = brt1 / 255.0; + + for (int i = 0; i < 0x8000;i++) + m_bgpalette->set_pen_contrast(i, brt1); } -void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) +void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { if (m_bg15_bitmap.valid()) { int select = m_bg15_select[ 0 ]; // int reg = m_bg15_reg[ 0 ]; int flip = select & 0x20; - int sx, sy; + int sx;//, sy; - if (flip) select ^= 0x1f; + // if (flip) select ^= 0x1f; sx = (select & 0x1f) * 256; - sy = 0; + // sy = 0; - copybitmap(bitmap, m_bg15_bitmap, flip, flip, -sx, -sy, cliprect); + const pen_t *pal = m_bgpalette->pens(); + UINT16* srcbitmap; + UINT32* dstbitmap; + + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + if (!flip) srcbitmap = &m_bg15_bitmap.pix16(y); + else srcbitmap = &m_bg15_bitmap.pix16(255-y); + dstbitmap = &bitmap.pix32(y); + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + { + UINT16 pix = srcbitmap[x + sx]; + dstbitmap[x] = pal[pix&0x7fff]; + } + } // flag = 0; } } -UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // berlwall uses a 15bpp bitmap as a bg, not a solid fill kaneko16_render_15bpp_bitmap(bitmap,cliprect); diff --git a/src/mame/video/kaneko_spr.c b/src/mame/video/kaneko_spr.c index 34387beb3d4..a471f61fac0 100644 --- a/src/mame/video/kaneko_spr.c +++ b/src/mame/video/kaneko_spr.c @@ -229,7 +229,12 @@ int kaneko16_sprite_device::kaneko16_parse_sprite_type012(running_machine &machi } // custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities -void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, + + + + +template +void kaneko16_sprite_device::kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, bitmap_ind8 &priority_bitmap, int priority) { @@ -294,25 +299,36 @@ void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp ey -= pixels; } - if( ex>sx ) + if (ex > sx) { /* skip if inner loop doesn't draw anything */ - int y; - for( y=sy; ypalette()->pens(); + + for (int y = sy; y < ey; y++) { - const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - UINT16 *dest = &dest_bmp.pix16(y); + const UINT8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); + dest = &dest_bmp.pix(y); UINT8 *pri = &priority_bitmap.pix8(y); - int x, x_index = x_index_base; - for( x=sx; x>16]; - if( c != 0 ) + int c = source[x_index >> 16]; + if (c != 0) { if (pri[x] < priority) - dest[x] = pen_base + c; - pri[x] = 0xff; // mark it "already drawn" + { + + if (!rgb) dest[x] = pen_base + c; + else dest[x] = pal[pen_base + c]; + + pri[x] = 0xff; // mark it "already drawn" + } } x_index += dx; } @@ -323,9 +339,12 @@ void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp } } -/* Build a list of sprites to display & draw them */ -void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) + + +/* Build a list of sprites to display & draw them */ +template +void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { /* Sprites *must* be parsed from the first in RAM to the last, because of the multisprite feature. But they *must* be drawn @@ -550,17 +569,46 @@ WRITE16_MEMBER(kaneko16_sprite_device::kaneko16_sprites_regs_w) } +void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0); +} -void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) +void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pal = m_gfxdecode->gfx(0)->palette()->pens(); + UINT16* srcbitmap; + UINT32* dstbitmap; + + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + srcbitmap = &m_sprites_bitmap.pix16(y); + dstbitmap = &bitmap.pix32(y); + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + { + UINT16 pix = srcbitmap[x]; + if (pix) dstbitmap[x] = pal[pix]; + } + } +} + + + +void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); } +void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); } + +template +void kaneko16_sprite_device::kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { /* Sprites last (rendered with pdrawgfx, so they can slip in between the layers) */ if(m_keep_sprites) { - /* keep sprites on screen */ + /* keep sprites on screen - used by mgcrystl when you get the first gem and it shows instructions */ kaneko16_draw_sprites(machine,m_sprites_bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); - copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0); + kaneko16_copybitmap(bitmap,cliprect); } else { diff --git a/src/mame/video/kaneko_spr.h b/src/mame/video/kaneko_spr.h index a9d5a25cc1d..727dd3063c7 100644 --- a/src/mame/video/kaneko_spr.h +++ b/src/mame/video/kaneko_spr.h @@ -42,6 +42,11 @@ public: virtual int get_sprite_type(void) =0; void kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); + void kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); + + + template + void kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); DECLARE_READ16_MEMBER(kaneko16_sprites_regs_r); @@ -81,14 +86,20 @@ private: int m_keep_sprites; bitmap_ind16 m_sprites_bitmap; - void kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); - void kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx, + template + void kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes); + + + template + void kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, bitmap_ind8 &priority_bitmap, int priority); int kaneko16_parse_sprite_type012(running_machine &machine, int i, struct tempsprite *s, UINT16* spriteram16, int spriteram16_bytes); + void kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + void kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_gfxdecode; diff --git a/src/mame/video/kaneko_tmap.c b/src/mame/video/kaneko_tmap.c index 01dd812ccd5..efffd0cf0dd 100644 --- a/src/mame/video/kaneko_tmap.c +++ b/src/mame/video/kaneko_tmap.c @@ -195,8 +195,11 @@ void kaneko_view2_tilemap_device::kaneko16_vram_w(offs_t offset, UINT16 data, UI m_tmap[_N_]->mark_tile_dirty(offset/2); } +void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); }; +void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); }; -void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect) +template +void kaneko_view2_tilemap_device::kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect) { int layers_flip_0; UINT16 layer0_scrollx, layer0_scrolly; @@ -244,13 +247,21 @@ void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const r } } -void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) +void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); } +void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); } + +template +void kaneko_view2_tilemap_device::render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri) { m_tmap[0]->draw(screen, bitmap, cliprect, pri, pri, 0); m_tmap[1]->draw(screen, bitmap, cliprect, pri, pri, 0); } -void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri) +void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); } +void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); } + +template +void kaneko_view2_tilemap_device::render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri) { m_tmap[0]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0); m_tmap[1]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0); diff --git a/src/mame/video/kaneko_tmap.h b/src/mame/video/kaneko_tmap.h index 2dd5ee047ab..e11e2e829e6 100644 --- a/src/mame/video/kaneko_tmap.h +++ b/src/mame/video/kaneko_tmap.h @@ -26,9 +26,20 @@ public: void kaneko16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_); // call to do the rendering etc. + template + void kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect); + template + void render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri); + template + void render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri); + void kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect); + void kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect); void render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri); + void render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri); void render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri); + void render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri); + // access DECLARE_READ16_MEMBER( kaneko_tmap_vram_r );