diff options
author | kunikuni <42865216+kunikunijp@users.noreply.github.com> | 2018-10-04 22:33:46 +0900 |
---|---|---|
committer | R. Belmont <rb6502@users.noreply.github.com> | 2018-10-04 09:33:46 -0400 |
commit | 844cd2cee9449bec100791f59199d1a810c74456 (patch) | |
tree | 73a34baa423f768768c76aeba5ba0a57a952068b | |
parent | 6392ecb0faca10bf4c4a8e320da4b2b20b0069c7 (diff) |
mpatrol: Improved graphics problems (#4061)
* Update m52.h
* Update m52.cpp
-rw-r--r-- | src/mame/includes/m52.h | 1 | ||||
-rw-r--r-- | src/mame/video/m52.cpp | 80 |
2 files changed, 50 insertions, 31 deletions
diff --git a/src/mame/includes/m52.h b/src/mame/includes/m52.h index fb899754a37..5d77946b3f6 100644 --- a/src/mame/includes/m52.h +++ b/src/mame/includes/m52.h @@ -50,6 +50,7 @@ private: DECLARE_PALETTE_INIT(m52); uint32_t screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int initoffs); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; diff --git a/src/mame/video/m52.cpp b/src/mame/video/m52.cpp index cedc7db65e6..1bb2852d418 100644 --- a/src/mame/video/m52.cpp +++ b/src/mame/video/m52.cpp @@ -182,7 +182,7 @@ WRITE8_MEMBER(m52_state::m52_scroll_w) m_bg_tilemap->set_scrollx(0, 255); m_bg_tilemap->set_scrollx(1, 255); m_bg_tilemap->set_scrollx(2, 255); - m_bg_tilemap->set_scrollx(3, -data); + m_bg_tilemap->set_scrollx(3, -(data + 1)); } @@ -298,17 +298,17 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, if (flip_screen()) { - xpos = 127 - xpos; - ypos = 255 - ypos - BGHEIGHT; + xpos = 264 - xpos; + ypos = 264 - ypos - BGHEIGHT; } - xpos += 128; + xpos += 124; /* this may not be correct */ - ypos = ypos + (22 - 8); + ypos += 16; - m_gfxdecode->gfx(image)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(image)->transpen(bitmap,cliprect, 0, 0, flip_screen(), flip_screen(), @@ -316,7 +316,7 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, ypos, 0); - m_gfxdecode->gfx(image)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(image)->transpen(bitmap,cliprect, 0, 0, flip_screen(), flip_screen(), @@ -344,34 +344,16 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, /************************************* * - * Video render + * Sprites rendering * *************************************/ -uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +void m52_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int initoffs) { int offs; - bitmap.fill(0, cliprect); - - if (!(m_bgcontrol & 0x20)) - { - if (!(m_bgcontrol & 0x10)) - draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */ - - if (!(m_bgcontrol & 0x02)) - draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */ - - if (!(m_bgcontrol & 0x04)) - draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */ - } - - m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - /* draw the sprites */ - for (offs = 0xfc; offs >= 0; offs -= 4) + for (offs = initoffs; offs >= (initoffs & 0xc0); offs -= 4) { int sy = 257 - m_spriteram[offs]; int color = m_spriteram[offs + 1] & 0x3f; @@ -397,11 +379,11 @@ uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitma clip.max_y = 255 - temp; flipx = !flipx; flipy = !flipy; - sx = 112 - sx; - sy = 257 + 11 - sy; + sx = 238 - sx; + sy = 282 - sy; } - sx += 128; + sx += 129; /* in theory anyways; in practice, some of the molecule-looking guys get clipped */ #ifdef SPLIT_SPRITES @@ -414,5 +396,41 @@ uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitma code, color, flipx, flipy, sx, sy, m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 512 + 32)); } +} + + + +/************************************* + * + * Video render + * + *************************************/ + +uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int offs; + + bitmap.fill(0, cliprect); + + if (!(m_bgcontrol & 0x20)) + { + if (!(m_bgcontrol & 0x10)) + draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */ + + if (!(m_bgcontrol & 0x02)) + draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */ + + if (!(m_bgcontrol & 0x04)) + draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */ + } + + m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + /* draw the sprites */ + for (offs = 0x3c; offs <= 0xfc; offs += 0x40) + draw_sprites(bitmap, cliprect, offs); + return 0; } |