From 2d74a4e86658fac539ca914d86d262fe5dcb4480 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 17 Sep 2024 23:15:58 +0200 Subject: kchamp: remove duplicate function --- src/mame/dataeast/kchamp.cpp | 5 +++-- src/mame/dataeast/kchamp.h | 3 +-- src/mame/dataeast/kchamp_v.cpp | 47 +++++++----------------------------------- 3 files changed, 12 insertions(+), 43 deletions(-) diff --git a/src/mame/dataeast/kchamp.cpp b/src/mame/dataeast/kchamp.cpp index ea7514edd65..f1af8bc53f1 100644 --- a/src/mame/dataeast/kchamp.cpp +++ b/src/mame/dataeast/kchamp.cpp @@ -149,6 +149,7 @@ void kchamp_state::kchampvs_sound_io_map(address_map &map) /******************** * 1 Player Version * ********************/ + uint8_t kchamp_state::sound_reset_r() { if (!machine().side_effects_disabled()) @@ -160,12 +161,12 @@ void kchamp_state::kc_sound_control_w(offs_t offset, uint8_t data) { if (offset == 0) { - m_sound_nmi_enable = ((data >> 7) & 1); + m_sound_nmi_enable = BIT(data, 7); if (!m_sound_nmi_enable) m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } else - m_dac->set_output_gain(0, BIT(data,0) ? 1.0 : 0); + m_dac->set_output_gain(0, BIT(data, 0) ? 1.0 : 0); } void kchamp_state::kchamp_map(address_map &map) diff --git a/src/mame/dataeast/kchamp.h b/src/mame/dataeast/kchamp.h index 70969b3a544..4d0d17b1d72 100644 --- a/src/mame/dataeast/kchamp.h +++ b/src/mame/dataeast/kchamp.h @@ -88,8 +88,7 @@ private: uint32_t screen_update_kchamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void vblank_irq(int state); INTERRUPT_GEN_MEMBER(sound_int); - void kchamp_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void kchampvs_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int dx, int dy); void decrypt_code(); void msmint(int state); void decrypted_opcodes_map(address_map &map); diff --git a/src/mame/dataeast/kchamp_v.cpp b/src/mame/dataeast/kchamp_v.cpp index 38ef03fc38c..030da4d9403 100644 --- a/src/mame/dataeast/kchamp_v.cpp +++ b/src/mame/dataeast/kchamp_v.cpp @@ -60,49 +60,18 @@ void kchamp_state::video_start() 3 XXXXXXXX */ -void kchamp_state::kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int dx, int dy) { - uint8_t *spriteram = m_spriteram; - int offs; - - for (offs = 0; offs < 0x100; offs += 4) - { - int attr = spriteram[offs + 2]; - int bank = 1 + ((attr & 0x60) >> 5); - int code = spriteram[offs + 1] + ((attr & 0x10) << 4); - int color = attr & 0x0f; - int flipx = 0; - int flipy = attr & 0x80; - int sx = spriteram[offs + 3] - 8; - int sy = 247 - spriteram[offs]; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - m_gfxdecode->gfx(bank)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 0); - } -} - -void kchamp_state::kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *spriteram = m_spriteram; - int offs; - - for (offs = 0; offs < 0x100; offs += 4) + for (int offs = 0; offs < 0x100; offs += 4) { - int attr = spriteram[offs + 2]; + int attr = m_spriteram[offs + 2]; int bank = 1 + ((attr & 0x60) >> 5); - int code = spriteram[offs + 1] + ((attr & 0x10) << 4); + int code = m_spriteram[offs + 1] + ((attr & 0x10) << 4); int color = attr & 0x0f; int flipx = 0; int flipy = attr & 0x80; - int sx = spriteram[offs + 3]; - int sy = 240 - spriteram[offs]; + int sx = m_spriteram[offs + 3] + dx; + int sy = 240 - m_spriteram[offs] + dy; if (flip_screen()) { @@ -120,13 +89,13 @@ void kchamp_state::kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle uint32_t kchamp_state::screen_update_kchamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - kchamp_draw_sprites(bitmap, cliprect); + draw_sprites(bitmap, cliprect, -8, 7); return 0; } uint32_t kchamp_state::screen_update_kchampvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - kchampvs_draw_sprites(bitmap, cliprect); + draw_sprites(bitmap, cliprect, 0, 0); return 0; } -- cgit v1.2.3