From aea6bbe2b4c49776c86acf22a1eacbabfda0e784 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 23 Nov 2019 01:29:23 +0100 Subject: popeye: Applied recommended code changes. (nw) --- src/mame/includes/popeye.h | 6 +++++- src/mame/video/popeye.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mame/includes/popeye.h b/src/mame/includes/popeye.h index 7b09497d135..594dcd93d2d 100644 --- a/src/mame/includes/popeye.h +++ b/src/mame/includes/popeye.h @@ -12,6 +12,8 @@ #include "emupal.h" #include "tilemap.h" +#include + class tnx1_state : public driver_device { public: @@ -26,6 +28,7 @@ public: m_colorram(*this, "colorram"), m_color_prom(*this, "proms"), m_color_prom_spr(*this, "sprpal"), + m_io_mconf(*this, "MCONF"), m_background_scroll{0,0,0}, m_fg_tilemap(nullptr), m_palette_bank(0), @@ -53,6 +56,7 @@ protected: required_shared_ptr m_colorram; required_region_ptr m_color_prom; required_region_ptr m_color_prom_spr; + required_ioport m_io_mconf; static const res_net_decode_info mb7051_decode_info; static const res_net_decode_info mb7052_decode_info; @@ -74,7 +78,7 @@ protected: uint8_t m_dswbit; bool m_nmi_enabled; int m_field; - std::unique_ptr m_bitmap[2]; // bitmaps for fields + std::array m_bitmap; // bitmaps for fields virtual DECLARE_WRITE8_MEMBER(refresh_w); DECLARE_READ8_MEMBER(protection_r); diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp index 2b91492acb0..d62fd59c725 100644 --- a/src/mame/video/popeye.cpp +++ b/src/mame/video/popeye.cpp @@ -249,8 +249,8 @@ void tnx1_state::video_start() m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tnx1_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_fg_tilemap->set_transparent_pen(0); - m_bitmap[0] = std::make_unique(512, 512); - m_bitmap[1] = std::make_unique(512, 512); + m_bitmap[0].resize(512, 512); + m_bitmap[1].resize(512, 512); m_field = 0; @@ -450,8 +450,8 @@ void tpp2_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect uint32_t tnx1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const auto ilmode(ioport("MCONF")->read()); - bitmap_ind16 &bm((ilmode == 0) ? bitmap : *m_bitmap[m_field]); + const auto ilmode(m_io_mconf->read()); + bitmap_ind16 &bm((ilmode == 0) ? bitmap : m_bitmap[m_field]); update_palette(); draw_background(bm, cliprect); @@ -473,7 +473,7 @@ uint32_t tnx1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { for (int y=(cliprect.min_y); y<=cliprect.max_y; y ++) { - auto &bm_last(*m_bitmap[m_field ^ 1]); + auto &bm_last(m_bitmap[m_field ^ 1]); if ((y & 1) == m_field) for (int x=cliprect.min_x; x<=cliprect.max_x; x++) bitmap.pix(y, x) = bm_last.pix(y, x); -- cgit v1.2.3