diff options
author | David Haywood <mamehaze@users.noreply.github.com> | 2014-10-14 18:34:00 +0000 |
---|---|---|
committer | David Haywood <mamehaze@users.noreply.github.com> | 2014-10-14 18:34:00 +0000 |
commit | b230c86a203315f992660d09ae4e35f1cf300824 (patch) | |
tree | 01a75775a3246467e1fdfe0b669c657ce5adef9f | |
parent | 421118ba62c5b8bccd91016b71dec7853f36975e (diff) |
further improvements
(of all the Mario versions we support at the moment this one probably has the least offensive sound ;-)
-rw-r--r-- | src/mame/drivers/mario.c | 12 | ||||
-rw-r--r-- | src/mame/includes/mario.h | 2 | ||||
-rw-r--r-- | src/mame/video/mario.c | 104 |
3 files changed, 85 insertions, 33 deletions
diff --git a/src/mame/drivers/mario.c b/src/mame/drivers/mario.c index 6aa38955364..b77e0e88f90 100644 --- a/src/mame/drivers/mario.c +++ b/src/mame/drivers/mario.c @@ -303,9 +303,9 @@ INPUT_PORTS_END static INPUT_PORTS_START( mariobl ) PORT_START("SYSTEM") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) @@ -313,12 +313,12 @@ static INPUT_PORTS_START( mariobl ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_START("INPUTS") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h index 2ecb48bc081..a8db22f4d4b 100644 --- a/src/mame/includes/mario.h +++ b/src/mame/includes/mario.h @@ -102,7 +102,7 @@ public: DECLARE_WRITE8_MEMBER(mario_sh2_w); DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int yaddr, int xaddr, int dx, int dy); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int is_bootleg); required_device<cpu_device> m_maincpu; optional_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; diff --git a/src/mame/video/mario.c b/src/mame/video/mario.c index 494e6e0f933..2c3c16e72c2 100644 --- a/src/mame/video/mario.c +++ b/src/mame/video/mario.c @@ -147,49 +147,101 @@ void mario_state::video_start() * confirmed on mametests.org as being present on real PCB as well. */ -void mario_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int yaddr, int xaddr, int dx, int dy) +void mario_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int is_bootleg) { /* TODO: draw_sprites should adopt the scanline logic from dkong.c * The schematics have the same logic for sprite buffering. */ int offs; - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + int start, end, inc; + + if (!is_bootleg) + { + start = 0; + end = m_spriteram.bytes(); + inc = 4; + } + else + { + start = m_spriteram.bytes()-4; + end = -4; + inc = -4; + } + + offs = start; + + while (offs != end) { - if (m_spriteram[offs]) + if (is_bootleg || m_spriteram[offs]) { int x, y; + int code, color, flipx, flipy; + + if (!is_bootleg) + { + // from schematics .... + y = (m_spriteram[offs + 0] + (m_flip ? 0xF7 : 0xF9) + 1) & 0xFF; + x = m_spriteram[offs + 3]; + // sprite will be drawn if (y + scanline) & 0xF0 = 0xF0 + y = 240 - y; /* logical screen position */ + + y = y ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ + x = x ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ + + code = m_spriteram[offs + 2]; + color = (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor; + flipx = (m_spriteram[offs + 1] & 0x80); + flipy = (m_spriteram[offs + 1] & 0x40); + + if (m_flip) + { + y -= 14; + x -= 7; + } + else + { + y += 1; + x -= 8; + } + } + else + { + y = (m_spriteram[offs + 3] + (m_flip ? 0xF7 : 0xF9) + 1) & 0xFF; + x = m_spriteram[offs + 0]; + y = 240 - y; /* logical screen position */ - // from schematics .... - y = (m_spriteram[offs+yaddr] + (m_flip ? 0xF7 : 0xF9) + 1) & 0xFF; - x = m_spriteram[offs+xaddr]; - // sprite will be drawn if (y + scanline) & 0xF0 = 0xF0 - y = 240 - y; /* logical screen position */ + // y = y ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ + // x = x ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ - y = y ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ - x = x ^ (m_flip ? 0xFF : 0x00); /* physical screen location */ + code = (m_spriteram[offs + 2] & 0x7f) | ((m_spriteram[offs + 1] & 0x40) << 1); // upper tile bit is where the flipy bit goes on mario + color = (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor; + flipx = (m_spriteram[offs + 1] & 0x80); + flipy = (m_spriteram[offs + 2] & 0x80); // and the flipy bit is where the upper tile bit is on mario + + y += -7; + } if (m_flip) { - y -= 14; - x -= 7; - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - m_spriteram[offs + 2], - (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor, - !(m_spriteram[offs + 1] & 0x80),!(m_spriteram[offs + 1] & 0x40), - x+dx, y+dy,0); + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + !flipx, !flipy, + x, y, 0); } else { - y += 1; - x -= 8; - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - m_spriteram[offs + 2], - (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor, - (m_spriteram[offs + 1] & 0x80),(m_spriteram[offs + 1] & 0x40), - x+dx, y+dy,0); + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + x, y, 0); } } + + offs += inc; } } @@ -214,7 +266,7 @@ UINT32 mario_state::screen_update_common(screen_device &screen, bitmap_ind16 &bi UINT32 mario_state::screen_update_mario(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { screen_update_common(screen, bitmap, cliprect); - draw_sprites(bitmap, cliprect, 0, 3, 0, 0); + draw_sprites(bitmap, cliprect, 0); return 0; } @@ -226,6 +278,6 @@ UINT32 mario_state::screen_update_mariobl(screen_device &screen, bitmap_ind16 &b screen_update_common(screen, bitmap, cliprect); - draw_sprites(bitmap, cliprect, 3, 0, 8, -8); + draw_sprites(bitmap, cliprect, 1); return 0; } |