summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/prehisle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/prehisle.c')
-rw-r--r--src/mame/video/prehisle.c69
1 files changed, 33 insertions, 36 deletions
diff --git a/src/mame/video/prehisle.c b/src/mame/video/prehisle.c
index 85fd22caa98..4580f5e856c 100644
--- a/src/mame/video/prehisle.c
+++ b/src/mame/video/prehisle.c
@@ -10,19 +10,19 @@
#include "includes/prehisle.h"
-WRITE16_MEMBER(prehisle_state::prehisle_bg_videoram16_w)
+WRITE16_MEMBER(prehisle_state::fg_vram_w)
{
- COMBINE_DATA(&m_bg_videoram16[offset]);
- m_bg_tilemap->mark_tile_dirty(offset);
+ COMBINE_DATA(&m_fg_vram[offset]);
+ m_fg_tilemap->mark_tile_dirty(offset);
}
-WRITE16_MEMBER(prehisle_state::prehisle_fg_videoram16_w)
+WRITE16_MEMBER(prehisle_state::tx_vram_w)
{
- COMBINE_DATA(&m_videoram[offset]);
- m_fg_tilemap->mark_tile_dirty(offset);
+ COMBINE_DATA(&m_tx_vram[offset]);
+ m_tx_tilemap->mark_tile_dirty(offset);
}
-READ16_MEMBER(prehisle_state::prehisle_control16_r)
+READ16_MEMBER(prehisle_state::control_r)
{
switch (offset)
{
@@ -35,7 +35,7 @@ READ16_MEMBER(prehisle_state::prehisle_control16_r)
}
}
-WRITE16_MEMBER(prehisle_state::prehisle_control16_w)
+WRITE16_MEMBER(prehisle_state::control_w)
{
int scroll = 0;
@@ -43,10 +43,10 @@ WRITE16_MEMBER(prehisle_state::prehisle_control16_w)
switch (offset)
{
- case 0x00: m_bg_tilemap->set_scrolly(0, scroll); break;
- case 0x08: m_bg_tilemap->set_scrollx(0, scroll); break;
- case 0x10: m_bg2_tilemap->set_scrolly(0, scroll); break;
- case 0x18: m_bg2_tilemap->set_scrollx(0, scroll); break;
+ case 0x00: m_fg_tilemap->set_scrolly(0, scroll); break;
+ case 0x08: m_fg_tilemap->set_scrollx(0, scroll); break;
+ case 0x10: m_bg_tilemap->set_scrolly(0, scroll); break;
+ case 0x18: m_bg_tilemap->set_scrollx(0, scroll); break;
case 0x23: m_invert_controls = data ? 0x00ff : 0x0000; break;
case 0x28: coin_counter_w(machine(), 0, data & 1); break;
case 0x29: coin_counter_w(machine(), 1, data & 1); break;
@@ -60,13 +60,11 @@ WRITE16_MEMBER(prehisle_state::prehisle_control16_w)
0 .....xxx gfx code high bits
1 xxxxxxxx gfx code low bits
*/
-TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info)
+TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info)
{
- UINT8 const *const tilerom = memregion("gfx5")->base();
-
int const offs = tile_index * 2;
- int const attr = tilerom[offs + 1] + (tilerom[offs] << 8);
- int const code = (attr & 0x7ff) | 0x800;
+ int const attr = m_tilemap_rom[offs + 1] + (m_tilemap_rom[offs] << 8);
+ int const code = attr & 0x7ff;
int const color = attr >> 12;
int const flags = (attr & 0x800) ? TILE_FLIPX : 0;
@@ -78,9 +76,9 @@ TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info)
0 ....x... ........ flip y
0 .....xxx xxxxxxxx gfx code
*/
-TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info)
+TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info)
{
- int const attr = m_bg_videoram16[tile_index];
+ int const attr = m_fg_vram[tile_index];
int const code = attr & 0x7ff;
int const color = attr >> 12;
int const flags = (attr & 0x800) ? TILE_FLIPY : 0;
@@ -92,9 +90,9 @@ TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info)
0 xxxx.... ........ color
0 ....xxxx xxxxxxxx gfx code
*/
-TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info)
+TILE_GET_INFO_MEMBER(prehisle_state::get_tx_tile_info)
{
- int const attr = m_videoram[tile_index];
+ int const attr = m_tx_vram[tile_index];
int const code = attr & 0xfff;
int const color = attr >> 12;
@@ -104,30 +102,30 @@ TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info)
void prehisle_state::video_start()
{
// ROM-based background layer
- m_bg2_tilemap = &machine().tilemap().create(
+ m_bg_tilemap = &machine().tilemap().create(
m_gfxdecode,
- tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info), this),
+ tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info), this),
TILEMAP_SCAN_COLS, // scan order
16, 16, // tile size
1024, 32); // tilemap size
- // RAM-based background layer (overlays most sprites)
- m_bg_tilemap = &machine().tilemap().create(
+ // RAM-based foreground layer (overlays most sprites)
+ m_fg_tilemap = &machine().tilemap().create(
m_gfxdecode,
- tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info), this),
+ tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info), this),
TILEMAP_SCAN_COLS, // scan order
16, 16, // tile size
256, 32); // tilemap size
- m_bg_tilemap->set_transparent_pen(15);
+ m_fg_tilemap->set_transparent_pen(15);
// text layer
- m_fg_tilemap = &machine().tilemap().create(
+ m_tx_tilemap = &machine().tilemap().create(
m_gfxdecode,
- tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info), this),
+ tilemap_get_info_delegate(FUNC(prehisle_state::get_tx_tile_info), this),
TILEMAP_SCAN_ROWS, // scan order
8, 8, // tile size
32, 32); // tilemap size
- m_fg_tilemap->set_transparent_pen(15);
+ m_tx_tilemap->set_transparent_pen(15);
/* register for saving */
save_item(NAME(m_invert_controls));
@@ -147,12 +145,12 @@ void prehisle_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
{
UINT16 const *const spriteram16 = m_spriteram;
- for (int offs = 0; offs < 1024; offs += 4)
+ for (int offs = 1024 - 4; offs >= 0; offs -= 4)
{
int const attr = spriteram16[offs + 2];
int const code = attr & 0x1fff;
int const color = spriteram16[offs + 3] >> 12;
- int const priority = (color < 0x4) ? 0x04 : 0x06;
+ int const priority = (color < 0x4) ? 0 : GFX_PMASK_1; // correct?
bool flipx = attr & 0x4000;
bool flipy = attr & 0x8000;
int sx = spriteram16[offs + 1] & 0x1ff;
@@ -184,10 +182,9 @@ UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind1
{
screen.priority().fill(0, cliprect);
- m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
draw_sprites(screen, bitmap, cliprect);
-
+ m_tx_tilemap->draw(screen, bitmap, cliprect, 0);
return 0;
}