diff options
Diffstat (limited to 'src/mame/video/deco32.cpp')
-rw-r--r-- | src/mame/video/deco32.cpp | 92 |
1 files changed, 45 insertions, 47 deletions
diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index 44352932ebc..8e2f435ca62 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -10,12 +10,12 @@ void deco32_state::pri_w(u32 data) m_pri = data; } -WRITE32_MEMBER( dragngun_state::sprite_control_w ) +void dragngun_state::sprite_control_w(u32 data) { m_sprite_ctrl = data; } -WRITE32_MEMBER( dragngun_state::spriteram_dma_w ) +void dragngun_state::spriteram_dma_w(u32 data) { /* DMA spriteram to private sprite chip area, and clear cpu ram */ m_spriteram->copy(); @@ -27,13 +27,13 @@ WRITE32_MEMBER( dragngun_state::spriteram_dma_w ) /* Later games have double buffered paletteram - the real palette ram is only updated on a DMA call */ -WRITE32_MEMBER( deco32_state::buffered_palette_w ) +void deco32_state::buffered_palette_w(offs_t offset, u32 data, u32 mem_mask) { COMBINE_DATA(&m_paletteram[offset]); - m_dirty_palette[offset]=1; + m_dirty_palette[offset] = 1; } -WRITE32_MEMBER( deco32_state::palette_dma_w ) +void deco32_state::palette_dma_w(u32 data) { for (int i = 0; i < m_palette->entries(); i++) { @@ -41,11 +41,11 @@ WRITE32_MEMBER( deco32_state::palette_dma_w ) { m_dirty_palette[i] = 0; - uint8_t b = (m_paletteram[i] >> 16) & 0xff; - uint8_t g = (m_paletteram[i] >> 8) & 0xff; - uint8_t r = (m_paletteram[i] >> 0) & 0xff; + const u8 b = (m_paletteram[i] >> 16) & 0xff; + const u8 g = (m_paletteram[i] >> 8) & 0xff; + const u8 r = (m_paletteram[i] >> 0) & 0xff; - m_palette->set_pen_color(i,rgb_t(r,g,b)); + m_palette->set_pen_color(i, rgb_t(r, g, b)); } } } @@ -59,24 +59,24 @@ void deco32_state::video_start() void deco32_state::allocate_spriteram(int chip) { - m_spriteram16[chip] = std::make_unique<uint16_t[]>(0x2000/4); - m_spriteram16_buffered[chip] = std::make_unique<uint16_t[]>(0x2000/4); + m_spriteram16[chip] = std::make_unique<u16[]>(0x2000/4); + m_spriteram16_buffered[chip] = std::make_unique<u16[]>(0x2000/4); save_pointer(NAME(m_spriteram16[chip]), 0x2000/4, chip); save_pointer(NAME(m_spriteram16_buffered[chip]), 0x2000/4, chip); } void deco32_state::allocate_buffered_palette() { - m_dirty_palette = make_unique_clear<uint8_t[]>(2048); + m_dirty_palette = make_unique_clear<u8[]>(2048); save_pointer(NAME(m_dirty_palette), 2048); } void deco32_state::allocate_rowscroll(int size1, int size2, int size3, int size4) { - m_pf_rowscroll[0] = make_unique_clear<uint16_t[]>(size1); - m_pf_rowscroll[1] = make_unique_clear<uint16_t[]>(size2); - m_pf_rowscroll[2] = make_unique_clear<uint16_t[]>(size3); - m_pf_rowscroll[3] = make_unique_clear<uint16_t[]>(size4); + m_pf_rowscroll[0] = make_unique_clear<u16[]>(size1); + m_pf_rowscroll[1] = make_unique_clear<u16[]>(size2); + m_pf_rowscroll[2] = make_unique_clear<u16[]>(size3); + m_pf_rowscroll[3] = make_unique_clear<u16[]>(size4); save_pointer(NAME(m_pf_rowscroll[0]), size1); save_pointer(NAME(m_pf_rowscroll[1]), size2); save_pointer(NAME(m_pf_rowscroll[2]), size3); @@ -102,10 +102,9 @@ void fghthist_state::video_start() void nslasher_state::video_start() { - int width, height; - width = m_screen->width(); - height = m_screen->height(); - m_tilemap_alpha_bitmap=std::make_unique<bitmap_ind16>(width, height); + const int width = m_screen->width(); + const int height = m_screen->height(); + m_tilemap_alpha_bitmap = std::make_unique<bitmap_ind16>(width, height); for (int chip = 0; chip < 2; chip++) { m_sprgen[chip]->alloc_sprite_bitmap(); @@ -128,9 +127,9 @@ void dragngun_state::video_start() /******************************************************************************/ -uint32_t captaven_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 captaven_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t flip = m_deco_tilegen[0]->pf_control_r(0); + const u16 flip = m_deco_tilegen[0]->pf_control_r(0); flip_screen_set(BIT(flip, 7)); m_sprgen[0]->set_flip_screen(BIT(flip, 7)); @@ -142,7 +141,7 @@ uint32_t captaven_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // pf4 not used (because pf3 is in 8bpp mode) - if ((m_pri&1)==0) + if ((m_pri & 1) == 0) { m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 1); m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 2); @@ -161,7 +160,7 @@ uint32_t captaven_state::screen_update(screen_device &screen, bitmap_ind16 &bitm return 0; } -uint32_t dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { screen.priority().fill(0, cliprect); bitmap.fill(m_palette->pen(0x400), cliprect); // Palette index not confirmed @@ -185,7 +184,7 @@ uint32_t dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm { rectangle clip(cliprect.left(), cliprect.right(), 8, 247); - m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_sprite_layout_ram[0], m_sprite_layout_ram[1], m_sprite_lookup_ram[0], m_sprite_lookup_ram[1], m_sprite_ctrl, screen.priority(), m_temp_render_bitmap ); + m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_sprite_layout_ram[0], m_sprite_layout_ram[1], m_sprite_lookup_ram[0], m_sprite_lookup_ram[1], m_sprite_ctrl, screen.priority(), m_temp_render_bitmap); } @@ -193,7 +192,7 @@ uint32_t dragngun_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm } -uint32_t fghthist_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 fghthist_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { screen.priority().fill(0, cliprect); bitmap.fill(m_palette->pen(0x300), cliprect); // Palette index not confirmed @@ -208,7 +207,7 @@ uint32_t fghthist_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm /* Draw screen */ m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, 0, 1); - if(m_pri&1) + if (m_pri & 1) { m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 2); m_sprgen[0]->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0800, 0x0800, 1024, 0x1ff); @@ -247,21 +246,21 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint8_t* tilemapPri = &screen.priority().pix8(y); - uint16_t* sprite0 = &sprite0_mix_bitmap.pix16(y); - uint16_t* sprite1 = &sprite1_mix_bitmap.pix16(y); - uint32_t* destLine = &bitmap.pix32(y); - uint16_t* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); + const u8* tilemapPri = &screen.priority().pix8(y); + u32* destLine = &bitmap.pix32(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint16_t const priColAlphaPal0 = sprite0[x]; - uint16_t const priColAlphaPal1 = sprite1[x]; - uint16_t const pri0 = (priColAlphaPal0 & 0x6000) >> 13; - uint16_t const pri1 = (priColAlphaPal1 & 0x6000) >> 13; - uint16_t const col0 = (((priColAlphaPal0 & 0x1f00) >> 8) % gfx0->colors()) * gfx0->granularity(); - uint16_t const col1 = (((priColAlphaPal1 & 0x0f00) >> 8) % gfx1->colors()) * gfx1->granularity(); - uint16_t const alpha1 = priColAlphaPal1 & 0x8000; + const u16 priColAlphaPal0 = sprite0[x]; + const u16 priColAlphaPal1 = sprite1[x]; + const u16 pri0 = (priColAlphaPal0 & 0x6000) >> 13; + const u16 pri1 = (priColAlphaPal1 & 0x6000) >> 13; + const u16 col0 = (((priColAlphaPal0 & 0x1f00) >> 8) % gfx0->colors()) * gfx0->granularity(); + const u16 col1 = (((priColAlphaPal1 & 0x0f00) >> 8) % gfx1->colors()) * gfx1->granularity(); + const u16 alpha1 = priColAlphaPal1 & 0x8000; // Apply sprite bitmap 0 according to priority rules if ((priColAlphaPal0 & 0xff) != 0) @@ -346,7 +345,7 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi /* Optionally mix in alpha tilemap */ if (mixAlphaTilemap) { - uint16_t p = alphaTilemap[x]; + const u16 p = alphaTilemap[x]; if (p & 0xf) { /* Alpha tilemap under top two sprite 0 priorities */ @@ -366,15 +365,15 @@ void nslasher_state::mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bi } } -uint32_t nslasher_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 nslasher_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int alphaTilemap=0; + bool alphaTilemap = false; m_deco_tilegen[0]->pf_update(m_pf_rowscroll[0].get(), m_pf_rowscroll[1].get()); 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) - alphaTilemap=1; + if (m_deco_ace->get_aceram(0x17) != 0x0 && m_pri) + alphaTilemap = true; screen.priority().fill(0, cliprect); @@ -390,12 +389,11 @@ uint32_t nslasher_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm m_sprgen[0]->draw_sprites(bitmap, cliprect, m_spriteram16_buffered[0].get(), 0x800); m_sprgen[1]->draw_sprites(bitmap, cliprect, m_spriteram16_buffered[1].get(), 0x800); - /* Render alpha-blended tilemap to separate buffer for proper mixing */ m_tilemap_alpha_bitmap->fill(0, cliprect); /* Draw playfields & sprites */ - if (m_pri&2) + if (m_pri & 2) { m_deco_tilegen[1]->tilemap_12_combine_draw(screen, bitmap, cliprect, 0, 1, 1); m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 4); @@ -403,7 +401,7 @@ uint32_t nslasher_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else { m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, 0, 1); - if (m_pri&1) + if (m_pri & 1) { m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 2); if (alphaTilemap) |