From e8de74ea0540affa18a37b265ac9bab3dc884ca7 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 5 Nov 2022 15:55:21 +0100 Subject: starshp1: don't draw starfield outside cliprect --- src/mame/atari/starshp1.cpp | 2 -- src/mame/atari/starshp1.h | 2 +- src/mame/atari/starshp1_v.cpp | 23 +++++++---------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/mame/atari/starshp1.cpp b/src/mame/atari/starshp1.cpp index 3b6b1436816..207f2d46f22 100644 --- a/src/mame/atari/starshp1.cpp +++ b/src/mame/atari/starshp1.cpp @@ -311,8 +311,6 @@ void starshp1_state::starshp1(machine_config &config) misclatch.q_out_cb<7>().set(FUNC(starshp1_state::led_w)); /* video hardware */ - - SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(STARSHP1_PIXEL_CLOCK, STARSHP1_HTOTAL, STARSHP1_HBEND, STARSHP1_HBSTART, STARSHP1_VTOTAL, STARSHP1_VBEND, STARSHP1_VBSTART); m_screen->set_screen_update(FUNC(starshp1_state::screen_update_starshp1)); diff --git a/src/mame/atari/starshp1.h b/src/mame/atari/starshp1.h index 203e7aa1a1a..d2731318720 100644 --- a/src/mame/atari/starshp1.h +++ b/src/mame/atari/starshp1.h @@ -94,7 +94,7 @@ private: DECLARE_WRITE_LINE_MEMBER(screen_vblank_starshp1); INTERRUPT_GEN_MEMBER(starshp1_interrupt); void set_pens(); - void draw_starfield(bitmap_ind16 &bitmap); + void draw_starfield(bitmap_ind16 &bitmap, const rectangle &cliprect); int get_sprite_hpos(int i); int get_sprite_vpos(int i); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/atari/starshp1_v.cpp b/src/mame/atari/starshp1_v.cpp index 710607abccd..7f0de2d414e 100644 --- a/src/mame/atari/starshp1_v.cpp +++ b/src/mame/atari/starshp1_v.cpp @@ -52,19 +52,14 @@ TILE_GET_INFO_MEMBER(starshp1_state::get_tile_info) void starshp1_state::video_start() { - uint16_t val = 0; - - int i; - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(starshp1_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 8, 32, 8); - m_bg_tilemap->set_transparent_pen(0); - m_bg_tilemap->set_scrollx(0, -8); m_LSFR = std::make_unique(0x10000); - for (i = 0; i < 0x10000; i++) + uint16_t val = 0; + for (int i = 0; i < 0x10000; i++) { int bit = (val >> 0xf) ^ (val >> 0xc) ^ @@ -123,7 +118,6 @@ void starshp1_state::starshp1_sspic_w(uint8_t data) */ m_ship_picture = data; - } @@ -138,7 +132,7 @@ void starshp1_state::starshp1_playfield_w(offs_t offset, uint8_t data) } -void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) +void starshp1_state::draw_starfield(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* * The LSFR is reset once per frame at the position of @@ -146,13 +140,12 @@ void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) * really needed by the game. Not emulated. */ - for (int y = 0; y < bitmap.height(); y++) + for (int y = 0; y <= cliprect.bottom(); y++) { uint16_t const *const p = m_LSFR.get() + (uint16_t) (512 * y); - uint16_t *const pLine = &bitmap.pix(y); - for (int x = 0; x < bitmap.width(); x++) + for (int x = 0; x <= cliprect.right(); x++) if ((p[x] & 0x5b56) == 0x5b44) pLine[x] = (p[x] & 0x0400) ? 0x0e : 0x0f; } @@ -171,9 +164,7 @@ int starshp1_state::get_sprite_vpos(int i) void starshp1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - - for (i = 0; i < 14; i++) + for (int i = 0; i < 14; i++) { int code = (m_obj_ram[i] & 0xf) ^ 0xf; @@ -341,7 +332,7 @@ uint32_t starshp1_state::screen_update_starshp1(screen_device &screen, bitmap_in bitmap.fill(0, cliprect); if (m_starfield_kill == 0) - draw_starfield(bitmap); + draw_starfield(bitmap, cliprect); draw_sprites(bitmap, cliprect); -- cgit v1.2.3