Use correct sprite ram for Shaolin's Road & Kicker [smf, jotego]

This commit is contained in:
smf- 2021-12-10 19:32:24 +00:00
parent 5a88dc6a70
commit ec401fec51
3 changed files with 23 additions and 31 deletions

View File

@ -140,8 +140,8 @@ void shaolins_state::shaolins_map(address_map &map)
map(0x1000, 0x1000).nopw(); /* latch for 76496 #1 */
map(0x1800, 0x1800).w(FUNC(shaolins_state::palettebank_w));
map(0x2000, 0x2000).w(FUNC(shaolins_state::scroll_w));
map(0x2800, 0x2bff).ram(); /* RAM BANK 2 */
map(0x3000, 0x33ff).ram().share("spriteram"); /* RAM BANK 1 */
map(0x2800, 0x2bff).ram().share("spriteram"); /* RAM BANK 2 */
map(0x3000, 0x33ff).ram().share("spriteram2"); /* RAM BANK 1 */
map(0x3800, 0x3bff).ram().w(FUNC(shaolins_state::colorram_w)).share("colorram");
map(0x3c00, 0x3fff).ram().w(FUNC(shaolins_state::videoram_w)).share("videoram");
map(0x4000, 0x5fff).rom(); /* Machine checks for extra rom */

View File

@ -18,6 +18,7 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"),
m_colorram(*this, "colorram"),
m_videoram(*this, "videoram")
{ }
@ -30,6 +31,7 @@ private:
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_spriteram2;
required_shared_ptr<uint8_t> m_colorram;
required_shared_ptr<uint8_t> m_videoram;

View File

@ -147,38 +147,28 @@ void shaolins_state::video_start()
void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// area $3000-1f is written and never read to.
// Its values are filled to 0x00 when it's expected to have no sprites (cross hatch, service mode, between level transitions ...)
// May be a rudimentary per-sprite disable
// TODO: understand actual disabling conditions (either by schematics or by probing the real HW)
if (m_spriteram[0] == 0)
return;
for (int offs = m_spriteram.bytes() - 32; offs >= 0x100; offs -= 32 ) /* max 24 sprites */
for (int offs = 23 * 2; offs >= 0; offs -= 2) /* max 24 sprites */
{
if (m_spriteram[offs] && m_spriteram[offs + 6]) /* stop rogue sprites on high score screen */
int code = m_spriteram2[offs + 1];
int color = (m_spriteram[offs + 0] & 0x0f) | (m_palettebank << 4);
int flipx = !(m_spriteram[offs + 0] & 0x40);
int flipy = m_spriteram[offs + 0] & 0x80;
int sx = m_spriteram2[offs + 0];
int sy = 255 - m_spriteram[offs + 1];
if (flip_screen())
{
int code = m_spriteram[offs + 8];
int color = (m_spriteram[offs + 9] & 0x0f) | (m_palettebank << 4);
int flipx = !(m_spriteram[offs + 9] & 0x40);
int flipy = m_spriteram[offs + 9] & 0x80;
int sx = 240 - m_spriteram[offs + 6];
int sy = 248 - m_spriteram[offs + 4];
if (flip_screen())
{
sx = 240 - sx;
sy = 248 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transmask(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palettebank << 5));
sx = 240 - sx;
sy = 248 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transmask(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, m_palettebank << 5));
}
}