From 0583a8a95a036d4aafbcd7229ef4a30349b3b480 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 4 Dec 2022 13:28:11 +0100 Subject: zaccaria: small cleanup on prev commit --- src/mame/zaccaria/zaccaria.h | 2 +- src/mame/zaccaria/zaccaria_v.cpp | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/mame/zaccaria/zaccaria.h b/src/mame/zaccaria/zaccaria.h index e7d967534c5..0c479dcce0d 100644 --- a/src/mame/zaccaria/zaccaria.h +++ b/src/mame/zaccaria/zaccaria.h @@ -40,7 +40,7 @@ private: DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); void videoram_w(offs_t offset, uint8_t data); void attributes_w(offs_t offset, uint8_t data); - uint8_t read_attr(offs_t offset); + uint8_t read_attr(offs_t offset, int which); void update_colscroll(); DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w); DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w); diff --git a/src/mame/zaccaria/zaccaria_v.cpp b/src/mame/zaccaria/zaccaria_v.cpp index 8393678d0fc..0790855ef39 100644 --- a/src/mame/zaccaria/zaccaria_v.cpp +++ b/src/mame/zaccaria/zaccaria_v.cpp @@ -113,7 +113,7 @@ TILE_GET_INFO_MEMBER(zaccaria_state::get_tile_info) { uint8_t attr = m_videoram[tile_index | 0x400]; uint16_t code = m_videoram[tile_index] | ((attr & 0x03) << 8); - attr = (attr & 0x0c) >> 2 | (read_attr((tile_index & 0x1f) << 1 | 1) & 0x07) << 2; + attr = (attr & 0x0c) >> 2 | (read_attr(tile_index, 1) & 0x07) << 2; tileinfo.set(0, code, attr, 0); } @@ -156,25 +156,25 @@ void zaccaria_state::attributes_w(offs_t offset, uint8_t data) { if (offset & 1) { - if (flip_screen_x()) offset ^= 0x1f << 1; - for (int i = offset / 2; i < 0x400; i += 32) - m_bg_tilemap->mark_tile_dirty(i); + uint8_t mask = flip_screen_x() ? 0x1f : 0; + for (int i = offset / 2; i < 0x400; i += 0x20) + m_bg_tilemap->mark_tile_dirty(i ^ mask); } else update_colscroll(); } } -uint8_t zaccaria_state::read_attr(offs_t offset) +uint8_t zaccaria_state::read_attr(offs_t offset, int which) { - if (flip_screen_x()) offset ^= 0x1f << 1; - return m_attributesram[offset]; + if (flip_screen_x()) offset ^= 0x1f; + return m_attributesram[(offset << 1 & 0x3f) | (which & 1)]; } void zaccaria_state::update_colscroll() { for (int i = 0; i < 0x20; i++) - m_bg_tilemap->set_scrolly(i, read_attr(i * 2)); + m_bg_tilemap->set_scrolly(i, read_attr(i, 0)); } WRITE_LINE_MEMBER(zaccaria_state::flip_screen_x_w) @@ -213,15 +213,10 @@ offsets 1 and 2 are swapped if accessed from spriteram2 */ void zaccaria_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *spriteram, int color, int section) { - int o1 = 1,o2 = 2; + int o1 = 1 + section; + int o2 = 2 - section; - if (section) - { - o1 = 2; - o2 = 1; - } - - for (int offs = 0;offs < 0x20;offs += 4) + for (int offs = 0; offs < 0x20; offs += 4) { int sx = spriteram[offs + 3] + 1; int sy = 242 - spriteram[offs]; @@ -250,7 +245,7 @@ void zaccaria_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec uint32_t zaccaria_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); + m_bg_tilemap->draw(screen, bitmap, cliprect); // 3 layers of sprites, each with their own palette and priorities // Not perfect yet, does spriteram(1) layer have a priority bit somewhere? -- cgit v1.2.3