summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/dataeast/kchamp_v.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/dataeast/kchamp_v.cpp')
-rw-r--r--src/mame/dataeast/kchamp_v.cpp68
1 files changed, 16 insertions, 52 deletions
diff --git a/src/mame/dataeast/kchamp_v.cpp b/src/mame/dataeast/kchamp_v.cpp
index 76532b4459f..3096a4c70f4 100644
--- a/src/mame/dataeast/kchamp_v.cpp
+++ b/src/mame/dataeast/kchamp_v.cpp
@@ -37,11 +37,6 @@ void kchamp_state::kchamp_colorram_w(offs_t offset, uint8_t data)
m_bg_tilemap->mark_tile_dirty(offset);
}
-void kchamp_state::flipscreen_w(int state)
-{
- flip_screen_set(state);
-}
-
TILE_GET_INFO_MEMBER(kchamp_state::get_bg_tile_info)
{
int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 7) << 8);
@@ -55,59 +50,28 @@ void kchamp_state::video_start()
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(kchamp_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
-/*
- Sprites
- -------
- Offset Encoding
- 0 YYYYYYYY
- 1 TTTTTTTT
- 2 FGGTCCCC
- 3 XXXXXXXX
-*/
-
-void kchamp_state::kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *spriteram = m_spriteram;
- int offs;
- for (offs = 0; offs < 0x100; offs += 4)
+void kchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int dx, int dy)
+{
+ for (int 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];
+ /* sprite format:
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
+ Offset Encoding
+ 0 YYYYYYYY
+ 1 TTTTTTTT - tile#
+ 2 FGGTCCCC - y flip, gfx bank, high bit of tile#, color
+ 3 XXXXXXXX
+ */
- 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)
- {
- 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())
{
@@ -125,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;
}