From aefdb21281c7cf99e26f5db645e8ab9c2cedd674 Mon Sep 17 00:00:00 2001 From: cam900 Date: Fri, 28 Feb 2020 13:24:54 +0900 Subject: Improve mixing behavior related to DECO ACE chip (#6370) * Improve mixing behavior related to DECO ACE chip boogwing.cpp : Fix priority with alternative palette fading, Fix palette effects deco32.cpp : Add notes, nslasher : Fix palette effects, Background color deco16ic.cpp : Fix drawing behavior with 16bit indexed bitmap * deco_ace.cpp : Add notes of splitted palette area --- src/mame/drivers/boogwing.cpp | 3 +-- src/mame/drivers/deco32.cpp | 25 +++++++++++---------- src/mame/includes/boogwing.h | 1 + src/mame/video/boogwing.cpp | 49 +++++++++++++++++++++++++---------------- src/mame/video/deco16ic.cpp | 9 +++++++- src/mame/video/deco32.cpp | 41 +++++++++++++++++++++------------- src/mame/video/deco_ace.cpp | 51 +++++++++++++------------------------------ src/mame/video/deco_ace.h | 5 +---- 8 files changed, 95 insertions(+), 89 deletions(-) diff --git a/src/mame/drivers/boogwing.cpp b/src/mame/drivers/boogwing.cpp index d5b819b3318..24821e9b749 100644 --- a/src/mame/drivers/boogwing.cpp +++ b/src/mame/drivers/boogwing.cpp @@ -117,7 +117,6 @@ WRITE16_MEMBER( boogwing_state::boogwing_protection_region_0_104_w ) WRITE16_MEMBER( boogwing_state::priority_w ) { COMBINE_DATA(&m_priority); - m_deco_ace->set_palette_effect_max((m_priority & 0x8) ? 0x4ff : 0xfff); } @@ -289,7 +288,7 @@ static const gfx_layout tile_16x16_layout = static GFXDECODE_START( gfx_boogwing ) - GFXDECODE_ENTRY( "tiles1", 0, tile_8x8_layout, 0, 16 ) /* Tiles (8x8) */ + GFXDECODE_ENTRY( "tiles1", 0, tile_8x8_layout, 0x800, 16 ) /* Tiles (8x8) */ GFXDECODE_ENTRY( "tiles2", 0, tile_16x16_layout_5bpp, 0x100, 16 ) /* Tiles (16x16) */ GFXDECODE_ENTRY( "tiles3", 0, tile_16x16_layout, 0x300, 32 ) /* Tiles (16x16) */ GFXDECODE_ENTRY( "sprites1", 0, tile_16x16_layout, 0x500, 32 ) /* Sprites (16x16) */ diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index 149a1ba0c31..ca68923befb 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -975,7 +975,8 @@ void deco32_state::eeprom_w(u8 data) // -6------ eeprom cs // --5----- eeprom clk // ---4---- eeprom di - // ----32-- unknown + // ----3--- unknown + // -----2-- color fading effect (0 = without obj1, 1 = with obj1) (used in nslasher, TODO : not implemented) // ------1- bg2/3 joint mode (8bpp) (not used by fghthist?) // -------0 layer priority @@ -983,7 +984,7 @@ void deco32_state::eeprom_w(u8 data) m_eeprom->di_write(BIT(data, 4)); m_eeprom->cs_write(BIT(data, 6) ? ASSERT_LINE : CLEAR_LINE); - pri_w(data & 0x03); + pri_w(data & 0x07); } void dragngun_state::eeprom_w(u8 data) @@ -1816,19 +1817,19 @@ static GFXDECODE_START( gfx_dragngun ) GFXDECODE_END static GFXDECODE_START( gfx_tattass ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 128 ) /* Characters 8x8 */ - GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tilelayout_5bpp, 1536, 16 ) /* Sprites 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, tilelayout, 1024+256, 32 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x800, 128 ) /* Characters 8x8 */ + GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ + GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ + GFXDECODE_ENTRY( "gfx3", 0, tilelayout_5bpp, 0x600, 16 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "gfx4", 0, tilelayout, 0x500, 16 ) /* Sprites 16x16 */ GFXDECODE_END static GFXDECODE_START( gfx_nslasher ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 128 ) /* Characters 8x8 */ - GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tilelayout_5bpp, 1024, 16 ) /* Sprites 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, tilelayout, 1536, 32 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x800, 128 ) /* Characters 8x8 */ + GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ + GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 128 ) /* Tiles 16x16 */ + GFXDECODE_ENTRY( "gfx3", 0, tilelayout_5bpp, 0x400, 16 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "gfx4", 0, tilelayout, 0x600, 16 ) /* Sprites 16x16 */ GFXDECODE_END diff --git a/src/mame/includes/boogwing.h b/src/mame/includes/boogwing.h index 1b048994ce9..9f1113b2181 100644 --- a/src/mame/includes/boogwing.h +++ b/src/mame/includes/boogwing.h @@ -48,6 +48,7 @@ public: required_shared_ptr m_decrypted_opcodes; uint16_t m_priority; + bitmap_ind16 m_temp_bitmap; bitmap_ind16 m_alpha_tmap_bitmap; DECLARE_WRITE8_MEMBER(sound_bankswitch_w); diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp index 3683bf165d3..16b31b3b1da 100644 --- a/src/mame/video/boogwing.cpp +++ b/src/mame/video/boogwing.cpp @@ -9,6 +9,7 @@ void boogwing_state::video_start() m_priority = 0; m_sprgen[0]->alloc_sprite_bitmap(); m_sprgen[1]->alloc_sprite_bitmap(); + m_screen->register_screen_bitmap(m_temp_bitmap); m_screen->register_screen_bitmap(m_alpha_tmap_bitmap); save_item(NAME(m_priority)); } @@ -32,7 +33,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2, *alpha_tmap_bitmap; bitmap_ind8* priority_bitmap; - uint16_t priority = m_priority; + uint16_t priority = m_priority & 0x7; sprite_bitmap1 = &m_sprgen[0]->get_sprite_temp_bitmap(); sprite_bitmap2 = &m_sprgen[1]->get_sprite_temp_bitmap(); @@ -40,7 +41,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c priority_bitmap = &screen.priority(); uint32_t* dstline; - uint16_t *srcline1, *srcline2, *srcline3; + uint16_t *srcline1, *srcline2, *srcline3, *tmapline; uint8_t *srcpriline; for (y=cliprect.top();y<=cliprect.bottom();y++) @@ -48,6 +49,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c srcline1=&sprite_bitmap1->pix16(y,0); srcline2=&sprite_bitmap2->pix16(y,0); srcline3=&alpha_tmap_bitmap->pix16(y,0); + tmapline=&m_temp_bitmap.pix16(y,0); srcpriline=&priority_bitmap->pix8(y,0); dstline=&bitmap.pix32(y,0); @@ -57,6 +59,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; uint16_t pix3 = srcline3[x]; + uint16_t tmappix = tmapline[x]; /* Here we have pix1 - raw pixel / colour / priority data from first 1st chip @@ -187,41 +190,48 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c pix2 - same as before ^^ */ + const u16 calculated_coloffs = (m_priority & 8) ? 0x800 : 0; int drawnpixe1 = 0; if (pix1 & 0xf) { if (pri1 > bgpri) { - dstline[x] = paldata[(pix1&0x1ff)+0x500]; + dstline[x] = paldata[calculated_coloffs | ((pix1&0x1ff)+0x500)]; drawnpixe1 |= 1; } } if (pix2 & 0xf) { + if ((drawnpixe1 == 0) && (tmappix != 0xffff)) + dstline[x] = paldata[calculated_coloffs | tmappix]; + if (pri2 > bgpri) { if ((!drawnpixe1) || (spri2 > spri1)) { if (alpha2>=0xff) { - dstline[x] = paldata[(pix2&0xff)+0x700]; + dstline[x] = paldata[calculated_coloffs | ((pix2&0xff)+0x700)]; } else { uint32_t base = dstline[x]; - dstline[x] = alpha_blend_r32(base, paldata[(pix2&0xff)+0x700], alpha2); + dstline[x] = alpha_blend_r32(base, paldata[calculated_coloffs | ((pix2&0xff)+0x700)], alpha2); } drawnpixe1 |= 2; } } } + if ((drawnpixe1 == 0) && (tmappix != 0xffff)) + dstline[x] = paldata[tmappix]; + // alpha blended tilemap handling if (pix3 & 0xf) { // TODO : sprite vs playfield priority, actual behavior of shadowing - if ((m_priority & 0x7) == 0x3) + if (priority == 0x3) { bool bg2_drawed = (bgpri == 8) && (!drawnpixe1); bool sprite1_drawed = (drawnpixe1 & 1) && (pri1 <= pri3); @@ -229,7 +239,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c if ((bg2_drawed) || ((sprite1_drawed && (~drawnpixe1 & 2)) || (sprite2_drawed && (~drawnpixe1 & 1)) || (sprite1_drawed && sprite2_drawed))) { if (((pix2 & 0x900) != 0x900) || ((spri2 <= spri1) && sprite1_drawed)) - dstline[x] = alpha_blend_r32(dstline[x], paldata[pix3], alpha3); + dstline[x] = alpha_blend_r32(dstline[x], paldata[((drawnpixe1 & 3) ? calculated_coloffs : 0) | pix3], alpha3); } } } @@ -256,30 +266,31 @@ uint32_t boogwing_state::screen_update_boogwing(screen_device &screen, bitmap_rg /* Draw playfields */ bitmap.fill(m_deco_ace->pen(0x400), cliprect); /* pen not confirmed */ + m_temp_bitmap.fill(0xffff, cliprect); screen.priority().fill(0); // bit&0x8 is definitely some kind of palette effect // bit&0x4 combines playfields if ((priority & 0x7) == 0x5) { - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - m_deco_tilegen[1]->tilemap_12_combine_draw(screen, bitmap, cliprect, 0, 32); + m_deco_tilegen[0]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_deco_tilegen[1]->tilemap_12_combine_draw(screen, m_temp_bitmap, cliprect, 0, 32); } else if ((priority & 0x7) == 0x4) { - m_deco_tilegen[1]->tilemap_12_combine_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 32); + m_deco_tilegen[1]->tilemap_12_combine_draw(screen, m_temp_bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_deco_tilegen[0]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, 0, 32); } else if ((priority & 0x7) == 0x1 || (priority & 0x7) == 0x2) { - m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 8); - m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 32); + m_deco_tilegen[1]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_deco_tilegen[0]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, 0, 8); + m_deco_tilegen[1]->tilemap_1_draw(screen, m_temp_bitmap, cliprect, 0, 32); } else if ((priority & 0x7) == 0x3) { - m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 8); + m_deco_tilegen[1]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_deco_tilegen[0]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, 0, 8); // This mode uses playfield 3 to shadow sprites & playfield 2 (instead of // regular alpha-blending, the destination is inverted). Not yet implemented. @@ -288,9 +299,9 @@ uint32_t boogwing_state::screen_update_boogwing(screen_device &screen, bitmap_rg } else { - m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 8); - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 32); + m_deco_tilegen[1]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_deco_tilegen[1]->tilemap_1_draw(screen, m_temp_bitmap, cliprect, 0, 8); + m_deco_tilegen[0]->tilemap_2_draw(screen, m_temp_bitmap, cliprect, 0, 32); } mix_boogwing(screen,bitmap,cliprect); diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index cf702310970..bd27143550b 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -443,6 +443,11 @@ void deco16ic_device::custom_tilemap_draw( u8 pmask ) { + typename _BitmapClass::pixel_t *dest; + int rgb; + if (sizeof(*dest) == 2) rgb = 0; + else rgb = 1; + tilemap_t *tilemap0 = BIT(control1, 7) ? tilemap0_8x8 : tilemap0_16x16; tilemap_t *tilemap1 = BIT(control1, 7) ? tilemap1_8x8 : tilemap1_16x16; const bitmap_ind16 *src_bitmap0 = tilemap0 ? &tilemap0->pixmap() : nullptr; @@ -502,7 +507,9 @@ void deco16ic_device::custom_tilemap_draw( if ((flags & TILEMAP_DRAW_OPAQUE) || (p & trans_mask)) { - bitmap.pix(y, x) = m_gfxdecode->palette().pen(p); + dest = &bitmap.pix(y); + if (!rgb) dest[x] = p; + else dest[x] = m_gfxdecode->palette().pen(p); if (screen.priority().valid()) { u8 *pri = &screen.priority().pix8(y); diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index 903186827b8..2ae5678448b 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -266,6 +266,8 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi const bool alpha2 = (!(priColAlphaPal1 & 0x1000)); // Apply sprite bitmap 0 according to priority rules + u16 coloffs = ((m_pri & 4) == 0) ? 0x800 : 0; + bool sprite1_drawn = false; if ((priColAlphaPal0 & 0xff) != 0) { /* @@ -278,20 +280,28 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi */ if ((pri0 & 0x3) == 0 || (pri0 & 0x3) == 1 || ((pri0 & 0x3) == 2 && mixAlphaTilemap)) // Spri0 on top of everything, or under alpha playfield { - destLine[x] = pal0[(priColAlphaPal0 & 0xff) + col0]; + destLine[x] = pal0[coloffs | ((priColAlphaPal0 & 0xff) + col0)]; + sprite1_drawn = true; } else if ((pri0 & 0x3) == 2) // Spri0 under top playfield { if (tilemapPri[x] < 4) - destLine[x] = pal0[(priColAlphaPal0 & 0xff) + col0]; + { + destLine[x] = pal0[coloffs | ((priColAlphaPal0 & 0xff) + col0)]; + sprite1_drawn = true; + } } else // Spri0 under top & middle playfields { if (tilemapPri[x] < 2) - destLine[x] = pal0[(priColAlphaPal0 & 0xff) + col0]; + { + destLine[x] = pal0[coloffs | ((priColAlphaPal0 & 0xff) + col0)]; + sprite1_drawn = true; + } } } + coloffs = (((m_pri & 4) == 0) && sprite1_drawn) ? 0x800 : 0; /* Alpha values are tied to ACE ram... */ int alpha = ((!alpha1) || alpha2) ? m_deco_ace->get_alpha((col1 & 0x8) ? (0x4 + ((col1 & 0x3) / 2)) : ((col1 & 0x7) / 2)) : 0xff; @@ -316,16 +326,17 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi if (pri1 == 0 && (((priColAlphaPal0 & 0xff) == 0 || ((pri0 & 0x3) != 0 && (pri0 & 0x3) != 1 && (pri0 & 0x3) != 2)))) { - if ((m_pri & 1) == 0 || ((m_pri & 1) == 1 && tilemapPri[x] < 4) || ((m_pri & 1) == 1 && mixAlphaTilemap)) - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + if ((m_pri & 1) == 0 || ((m_pri & 1) == 1 && tilemapPri[x] < 4) || ((m_pri & 1) == 1 && + (mixAlphaTilemap && ((alphaTilemap[x] & 0xf) == 0)))) + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); } else if (pri1 == 1 && ((m_pri & 1) == 0 || tilemapPri[x] < 4) && ((priColAlphaPal0 & 0xff) == 0 || ((pri0 & 0x3) != 0 && (pri0 & 0x3) != 1))) - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); else if (pri1 == 2) // TODO - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); else if (pri1 == 3) // TODO - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); } else { @@ -335,13 +346,13 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi Pri 0 - Under sprite 0 pri 0, over all tilemaps */ if (pri1 == 0 && ((priColAlphaPal0 & 0xff) == 0 || ((pri0 & 0x3) != 0))) - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); else if (pri1 == 1) // TODO - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); else if (pri1 == 2) // TODO - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); else if (pri1 == 3) // TODO - destLine[x] = alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1 & 0xff) + col1], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal1[coloffs | ((priColAlphaPal1 & 0xff) + col1)], alpha); } } @@ -358,7 +369,7 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi /* Alpha values are tied to ACE ram */ int alpha = m_deco_ace->get_alpha(0x17 + (((p & 0xf0) >> 4) / 2)); - destLine[x] = alpha_blend_r32(destLine[x], pal2[p], alpha); + destLine[x] = alpha_blend_r32(destLine[x], pal2[coloffs | p], alpha); } } } @@ -373,12 +384,12 @@ u32 nslasher_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c m_deco_tilegen[1]->pf_update(m_pf_rowscroll[2].get(), m_pf_rowscroll[3].get()); /* This is not a conclusive test for deciding if tilemap needs alpha blending */ - if (m_deco_ace->get_aceram(0x17) != 0x0 && m_pri) + if (m_deco_ace->get_aceram(0x17) != 0x0 && (m_pri & 3)) alphaTilemap = true; screen.priority().fill(0, cliprect); - bitmap.fill(m_deco_ace->pen(0x200), cliprect); + bitmap.fill(m_deco_ace->pen(0x300), cliprect); // TODO : verify this from real hardware /* Draw sprites to temporary bitmaps, saving alpha & priority info for later mixing */ m_sprgen[0]->set_pix_raw_shift(8); diff --git a/src/mame/video/deco_ace.cpp b/src/mame/video/deco_ace.cpp index e4a84d7deed..05330443da7 100644 --- a/src/mame/video/deco_ace.cpp +++ b/src/mame/video/deco_ace.cpp @@ -67,8 +67,6 @@ deco_ace_device::deco_ace_device(const machine_config &mconfig, const char *tag, : device_t(mconfig, DECO_ACE, tag, owner, clock), device_video_interface(mconfig, *this), device_palette_interface(mconfig, *this), - m_palette_effect_min(0x100), - m_palette_effect_max(0xfff), m_paletteram(nullptr), m_paletteram_buffered(nullptr), m_ace_ram(nullptr) @@ -96,8 +94,6 @@ void deco_ace_device::device_start() void deco_ace_device::device_reset() { - m_palette_effect_min = 0x100; /* Screenshots seem to suggest ACE fades do not affect playfield 1 palette (0-255) */ - m_palette_effect_max = 0xfff; memset(m_ace_ram.get(),0,0x28); } @@ -173,41 +169,24 @@ void deco_ace_device::palette_update() int b = (m_paletteram_buffered[i] >>16) & 0xff; int g = (m_paletteram_buffered[i] >> 8) & 0xff; int r = (m_paletteram_buffered[i] >> 0) & 0xff; + set_pen_color(i + 2048, rgb_t(r, g, b)); // raw palettes - if ((i>=m_palette_effect_min) && (i<=m_palette_effect_max)) + switch (mode) { - switch (mode) - { - default: - case 0x1100: // multiplicative fade - /* Yeah, this should really be fixed point, I know */ - b = std::max(0, std::min(255, u8((b + (((fadeptb - b) * fadepsb) / 255))))); - g = std::max(0, std::min(255, u8((g + (((fadeptg - g) * fadepsg) / 255))))); - r = std::max(0, std::min(255, u8((r + (((fadeptr - r) * fadepsr) / 255))))); - break; - case 0x1000: // additive fade, correct? - b = std::min(b + fadepsb, 0xff); - g = std::min(g + fadepsg, 0xff); - r = std::min(r + fadepsr, 0xff); - break; - } + default: + case 0x1100: // multiplicative fade + /* Yeah, this should really be fixed point, I know */ + b = std::max(0, std::min(255, u8((b + (((fadeptb - b) * fadepsb) / 255))))); + g = std::max(0, std::min(255, u8((g + (((fadeptg - g) * fadepsg) / 255))))); + r = std::max(0, std::min(255, u8((r + (((fadeptr - r) * fadepsr) / 255))))); + break; + case 0x1000: // additive fade, correct? + b = std::min(b + fadepsb, 0xff); + g = std::min(g + fadepsg, 0xff); + r = std::min(r + fadepsr, 0xff); + break; } - set_pen_color(i, rgb_t(r, g, b)); - } -} - -/************************************************************************* - - set_palette_effect_max : Change Palette effect max bound (uses boogwing) - -*************************************************************************/ - -void deco_ace_device::set_palette_effect_max(uint32_t val) -{ - if (m_palette_effect_max != val) - { - m_palette_effect_max = val; - palette_update(); + set_pen_color(i, rgb_t(r, g, b)); // faded palettes } } diff --git a/src/mame/video/deco_ace.h b/src/mame/video/deco_ace.h index de73d1f064f..68f1ceaa99a 100644 --- a/src/mame/video/deco_ace.h +++ b/src/mame/video/deco_ace.h @@ -32,7 +32,6 @@ public: DECLARE_WRITE16_MEMBER( buffered_palette16_w ); DECLARE_WRITE16_MEMBER( ace_w ); void palette_update(); - void set_palette_effect_max(uint32_t val); uint16_t get_aceram(uint8_t val); uint8_t get_alpha(uint8_t val); DECLARE_WRITE16_MEMBER( palette_dma_w ); @@ -44,12 +43,10 @@ protected: virtual void device_post_load() override; // device_palette_interface overrides - virtual uint32_t palette_entries() const override { return 2048; } + virtual uint32_t palette_entries() const override { return 2048 * 2; } private: // internal state - uint32_t m_palette_effect_min; - uint32_t m_palette_effect_max; std::unique_ptr m_paletteram; std::unique_ptr m_paletteram_buffered; std::unique_ptr m_ace_ram; -- cgit v1.2.3