summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Alex W. Jackson <alex.w.jackson@gmail.com>2014-11-16 04:19:09 -0500
committer Alex W. Jackson <alex.w.jackson@gmail.com>2014-11-16 04:19:09 -0500
commitd803e96ac813024bdc0c390473adec48f1c02a0c (patch)
tree99a625438949469c53b61700b4c59862d4628e1a
parent03e9f7234e6fe91c6402d6354b173c506c7213e7 (diff)
drawgfx.h: Long-overdue documentation about how to use priority-masked
drawing (aka pdrawgfx); add some useful constants. [Alex Jackson] (nw) prehisle.c: Fix issues introduced by pdrawgfx conversion; use required_region_ptr instead of runtime tag lookup; give gfx regions more meaningful names; remove superfluous "prehisle"'s and "16"'s from member names (it's been many years since you could accidentally plug a handler of the wrong width into an address map and not have the core catch you at compile time)
-rw-r--r--src/emu/drawgfx.h110
-rw-r--r--src/mame/drivers/prehisle.c60
-rw-r--r--src/mame/includes/prehisle.h24
-rw-r--r--src/mame/video/prehisle.c69
4 files changed, 186 insertions, 77 deletions
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index 2edfd3c0eca..e63e095f0ef 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -7,6 +7,109 @@
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
+**********************************************************************
+
+ How to use priority-masked drawing (formerly pdrawgfx):
+
+ There are two different standard ways to use the priority bitmap
+ and the priority-masked draw methods, depending on how many layers
+ of interest (tilemap or other layers that individual sprites can
+ be either "behind" or "in front of") your driver has.
+
+ In the more common scheme, which you can use when the number of
+ layers of interest is four or fewer, the priority bitmap contains
+ a bitmask indicating which layers are opaque at each location.
+ To use this scheme, draw your tilemap layers this way, in order
+ from back to front:
+
+ screen.priority().fill(0, cliprect);
+ m_tilemap1->draw(screen, bitmap, cliprect, tmap1flags, 1);
+ m_tilemap2->draw(screen, bitmap, cliprect, tmap2flags, 2);
+ m_tilemap3->draw(screen, bitmap, cliprect, tmap3flags, 4);
+ m_tilemap4->draw(screen, bitmap, cliprect, tmap4flags, 8);
+
+ Now, when drawing your sprites, the pmask parameter for each
+ sprite should be the bitwise OR of all the GFX_PMASK_n constants
+ corresponding to layers that the sprite should be masked by.
+ For example, to draw a sprite that appears over tilemap1, but
+ under opaque pixels of tilemap2, tilemap3, and tilemap4:
+
+ UINT32 pmask = GFX_PMASK_2 | GFX_PMASK_4 | GFX_PMASK_8;
+ gfx->prio_transpen(bitmap, cliprect,
+ code, color,
+ flipx, flipy,
+ sx, sy,
+ screen.priority(),
+ pmask,
+ trans_pen);
+
+ This scheme does not require priority to be transitive: it is
+ perfectly possible for a sprite to be "under" tilemap1 but "over"
+ tilemap4, even though tilemap1 itself is "under" tilemap4.
+
+ If you have more than four layers, you need to use a different
+ scheme, in which the priority bitmap contains the index of the
+ topmost opaque layer rather than a bitmask of all the opaque
+ layers. To use this scheme, draw your tilemaps this way, again
+ in order from back to front:
+
+ screen.priority().fill(0, cliprect);
+ m_tilemap1->draw(screen, bitmap, cliprect, tmap1flags, 1, 0);
+ m_tilemap2->draw(screen, bitmap, cliprect, tmap2flags, 2, 0);
+ m_tilemap3->draw(screen, bitmap, cliprect, tmap3flags, 3, 0);
+ m_tilemap4->draw(screen, bitmap, cliprect, tmap4flags, 4, 0);
+ m_tilemap5->draw(screen, bitmap, cliprect, tmap5flags, 5, 0);
+ m_tilemap6->draw(screen, bitmap, cliprect, tmap6flags, 6, 0);
+ m_tilemap7->draw(screen, bitmap, cliprect, tmap7flags, 7, 0);
+ m_tilemap8->draw(screen, bitmap, cliprect, tmap8flags, 8, 0);
+
+ Notice the additional 0 parameter to tilemap_t::draw(). This
+ parameter causes the new layer's priority code to replace that of
+ the underlying layer instead of being ORed with it (the parameter
+ is a mask to be ANDed with the previous contents of the priority
+ bitmap before the new code is ORed with it)
+
+ You need to use a different pmask for your sprites with this
+ scheme than with the previous scheme. The pmask should be set to
+ ((~1) << n), where n is the index of the highest priority layer
+ that the sprite should *not* be masked by. For example, to draw
+ a sprite over the first four tilemaps but under the higher
+ numbered ones:
+
+ UINT32 pmask = (~1) << 4;
+ gfx->prio_transpen(bitmap, cliprect,
+ code, color,
+ flipx, flipy,
+ sx, sy,
+ screen.priority(),
+ pmask,
+ trans_pen);
+
+ Unlike the other scheme, this one does require priority to be
+ transitive, because the priority bitmap only contains information
+ about the topmost opaque pixel.
+
+ These examples have used a different tilemap for each layer, but
+ the layers could just as easily be different tile categories or
+ pen layers from the same tilemap.
+
+ If you have a layer that is behind all sprites, draw it with
+ priority 0, and if you have a layer that is in front of all
+ sprites, just draw it after the sprites. The bitmask scheme
+ can handle up to 6 layers if you count "behind all sprites" and
+ "in front of all sprites".
+
+ An important thing to remember when using priority-masked drawing
+ is that the sprites are drawn from front to back. Sprite pixels
+ will not be drawn over already-drawn sprite pixels, even if the
+ previously-drawn pixel was masked by a background layer.
+ This reflects the fact that in most hardware, sprite-to-sprite
+ priority is unrelated to sprite-to-background priority. Your
+ sprites need to be pre-sorted by their sprite-to-sprite priority
+ (whether that be a field in the sprite attributes or simply their
+ order in sprite RAM) before drawing.
+
+
*********************************************************************/
#pragma once
@@ -30,6 +133,13 @@ enum
DRAWMODE_SHADOW
};
+enum
+{
+ GFX_PMASK_1 = 0xaaaa,
+ GFX_PMASK_2 = 0xcccc,
+ GFX_PMASK_4 = 0xf0f0,
+ GFX_PMASK_8 = 0xff00
+};
/***************************************************************************
diff --git a/src/mame/drivers/prehisle.c b/src/mame/drivers/prehisle.c
index dc8c08b6252..7bdf9fd74bc 100644
--- a/src/mame/drivers/prehisle.c
+++ b/src/mame/drivers/prehisle.c
@@ -16,7 +16,7 @@
/******************************************************************************/
-WRITE16_MEMBER(prehisle_state::prehisle_sound16_w)
+WRITE16_MEMBER(prehisle_state::soundcmd_w)
{
soundlatch_byte_w(space, 0, data & 0xff);
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
@@ -27,13 +27,13 @@ WRITE16_MEMBER(prehisle_state::prehisle_sound16_w)
static ADDRESS_MAP_START( prehisle_map, AS_PROGRAM, 16, prehisle_state )
AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x070000, 0x073fff) AM_RAM
- AM_RANGE(0x090000, 0x0907ff) AM_RAM_WRITE(prehisle_fg_videoram16_w) AM_SHARE("videoram")
+ AM_RANGE(0x090000, 0x0907ff) AM_RAM_WRITE(tx_vram_w) AM_SHARE("tx_vram")
AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM AM_SHARE("spriteram")
- AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(prehisle_bg_videoram16_w) AM_SHARE("bg_videoram16")
+ AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(fg_vram_w) AM_SHARE("fg_vram")
AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
- AM_RANGE(0x0e0000, 0x0e00ff) AM_READ(prehisle_control16_r)
- AM_RANGE(0x0f0070, 0x0ff071) AM_WRITE(prehisle_sound16_w)
- AM_RANGE(0x0f0000, 0x0ff0ff) AM_WRITE(prehisle_control16_w)
+ AM_RANGE(0x0e0000, 0x0e00ff) AM_READ(control_r)
+ AM_RANGE(0x0f0070, 0x0ff071) AM_WRITE(soundcmd_w)
+ AM_RANGE(0x0f0000, 0x0ff0ff) AM_WRITE(control_w)
ADDRESS_MAP_END
/******************************************************************************/
@@ -182,10 +182,10 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( prehisle )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 768, 16 )
- GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 512, 16 )
- GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 256, 16 )
+ GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 16 )
+ GFXDECODE_ENTRY( "bgtiles", 0, tilelayout, 768, 16 )
+ GFXDECODE_ENTRY( "fgtiles", 0, tilelayout, 512, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 256, 16 )
GFXDECODE_END
/******************************************************************************/
@@ -243,20 +243,20 @@ ROM_START( prehisle )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
ROM_LOAD( "gt1.1", 0x000000, 0x10000, CRC(80a4c093) SHA1(abe59e43259eb80b504bd5541f58cd0e5eb998ab) )
- ROM_REGION( 0x008000, "gfx1", 0 )
+ ROM_REGION( 0x008000, "chars", 0 )
ROM_LOAD( "gt15.b15", 0x000000, 0x08000, CRC(ac652412) SHA1(916c04c3a8a7bfb961313ab73c0a27d7f5e48de1) )
- ROM_REGION( 0x040000, "gfx2", 0 )
+ ROM_REGION( 0x040000, "bgtiles", 0 )
ROM_LOAD( "pi8914.b14", 0x000000, 0x40000, CRC(207d6187) SHA1(505dfd1424b894e7b898f91b89f021ddde433c48) )
- ROM_REGION( 0x040000, "gfx3", 0 )
+ ROM_REGION( 0x040000, "fgtiles", 0 )
ROM_LOAD( "pi8916.h16", 0x000000, 0x40000, CRC(7cffe0f6) SHA1(aba08617964fc425418b098be5167021768bd47c) )
- ROM_REGION( 0x0a0000, "gfx4", 0 )
+ ROM_REGION( 0x0a0000, "sprites", 0 )
ROM_LOAD( "pi8910.k14", 0x000000, 0x80000, CRC(5a101b0b) SHA1(9645ab1f8d058cf2c6c42ccb4ce92a9b5db10c51) )
ROM_LOAD( "gt5.5", 0x080000, 0x20000, CRC(3d3ab273) SHA1(b5706ada9eb2c22fcc0ac8ede2d2ee02ee853191) )
- ROM_REGION( 0x10000, "gfx5", 0 ) /* background tilemaps */
+ ROM_REGION( 0x10000, "bgtilemap", 0 ) /* background tilemaps */
ROM_LOAD( "gt11.11", 0x000000, 0x10000, CRC(b4f0fcf0) SHA1(b81cc0b6e3e6f5616789bb3e77807dc0ef718a38) )
ROM_REGION( 0x20000, "upd", 0 ) /* ADPCM samples */
@@ -271,20 +271,20 @@ ROM_START( prehisleu )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
ROM_LOAD( "gt1.1", 0x000000, 0x10000, CRC(80a4c093) SHA1(abe59e43259eb80b504bd5541f58cd0e5eb998ab) )
- ROM_REGION( 0x008000, "gfx1", 0 )
+ ROM_REGION( 0x008000, "chars", 0 )
ROM_LOAD( "gt15.b15", 0x000000, 0x08000, CRC(ac652412) SHA1(916c04c3a8a7bfb961313ab73c0a27d7f5e48de1) )
- ROM_REGION( 0x040000, "gfx2", 0 )
+ ROM_REGION( 0x040000, "bgtiles", 0 )
ROM_LOAD( "pi8914.b14", 0x000000, 0x40000, CRC(207d6187) SHA1(505dfd1424b894e7b898f91b89f021ddde433c48) )
- ROM_REGION( 0x040000, "gfx3", 0 )
+ ROM_REGION( 0x040000, "fgtiles", 0 )
ROM_LOAD( "pi8916.h16", 0x000000, 0x40000, CRC(7cffe0f6) SHA1(aba08617964fc425418b098be5167021768bd47c) )
- ROM_REGION( 0x0a0000, "gfx4", 0 )
+ ROM_REGION( 0x0a0000, "sprites", 0 )
ROM_LOAD( "pi8910.k14", 0x000000, 0x80000, CRC(5a101b0b) SHA1(9645ab1f8d058cf2c6c42ccb4ce92a9b5db10c51) )
ROM_LOAD( "gt5.5", 0x080000, 0x20000, CRC(3d3ab273) SHA1(b5706ada9eb2c22fcc0ac8ede2d2ee02ee853191) )
- ROM_REGION( 0x10000, "gfx5", 0 ) /* background tilemaps */
+ ROM_REGION( 0x10000, "bgtilemap", 0 ) /* background tilemaps */
ROM_LOAD( "gt11.11", 0x000000, 0x10000, CRC(b4f0fcf0) SHA1(b81cc0b6e3e6f5616789bb3e77807dc0ef718a38) )
ROM_REGION( 0x20000, "upd", 0 ) /* ADPCM samples */
@@ -299,20 +299,20 @@ ROM_START( prehislek )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
ROM_LOAD( "gt1.1", 0x000000, 0x10000, CRC(80a4c093) SHA1(abe59e43259eb80b504bd5541f58cd0e5eb998ab) )
- ROM_REGION( 0x008000, "gfx1", 0 )
+ ROM_REGION( 0x008000, "chars", 0 )
ROM_LOAD( "gt15.b15", 0x000000, 0x08000, BAD_DUMP CRC(ac652412) SHA1(916c04c3a8a7bfb961313ab73c0a27d7f5e48de1) ) // not dumped, missing korean text
- ROM_REGION( 0x040000, "gfx2", 0 )
+ ROM_REGION( 0x040000, "bgtiles", 0 )
ROM_LOAD( "pi8914.b14", 0x000000, 0x40000, CRC(207d6187) SHA1(505dfd1424b894e7b898f91b89f021ddde433c48) )
- ROM_REGION( 0x040000, "gfx3", 0 )
+ ROM_REGION( 0x040000, "fgtiles", 0 )
ROM_LOAD( "pi8916.h16", 0x000000, 0x40000, CRC(7cffe0f6) SHA1(aba08617964fc425418b098be5167021768bd47c) )
- ROM_REGION( 0x0a0000, "gfx4", 0 )
+ ROM_REGION( 0x0a0000, "sprites", 0 )
ROM_LOAD( "pi8910.k14", 0x000000, 0x80000, CRC(5a101b0b) SHA1(9645ab1f8d058cf2c6c42ccb4ce92a9b5db10c51) )
ROM_LOAD( "gt5.5", 0x080000, 0x20000, CRC(3d3ab273) SHA1(b5706ada9eb2c22fcc0ac8ede2d2ee02ee853191) )
- ROM_REGION( 0x10000, "gfx5", 0 ) /* background tilemaps */
+ ROM_REGION( 0x10000, "bgtilemap", 0 ) /* background tilemaps */
ROM_LOAD( "gt11.11", 0x000000, 0x10000, CRC(b4f0fcf0) SHA1(b81cc0b6e3e6f5616789bb3e77807dc0ef718a38) )
ROM_REGION( 0x20000, "upd", 0 ) /* ADPCM samples */
@@ -327,20 +327,20 @@ ROM_START( gensitou )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
ROM_LOAD( "gt1.1", 0x000000, 0x10000, CRC(80a4c093) SHA1(abe59e43259eb80b504bd5541f58cd0e5eb998ab) )
- ROM_REGION( 0x008000, "gfx1", 0 )
+ ROM_REGION( 0x008000, "chars", 0 )
ROM_LOAD( "gt15.b15", 0x000000, 0x08000, CRC(ac652412) SHA1(916c04c3a8a7bfb961313ab73c0a27d7f5e48de1) )
- ROM_REGION( 0x040000, "gfx2", 0 )
+ ROM_REGION( 0x040000, "bgtiles", 0 )
ROM_LOAD( "pi8914.b14", 0x000000, 0x40000, CRC(207d6187) SHA1(505dfd1424b894e7b898f91b89f021ddde433c48) )
- ROM_REGION( 0x040000, "gfx3", 0 )
+ ROM_REGION( 0x040000, "fgtiles", 0 )
ROM_LOAD( "pi8916.h16", 0x000000, 0x40000, CRC(7cffe0f6) SHA1(aba08617964fc425418b098be5167021768bd47c) )
- ROM_REGION( 0x0a0000, "gfx4", 0 )
+ ROM_REGION( 0x0a0000, "sprites", 0 )
ROM_LOAD( "pi8910.k14", 0x000000, 0x80000, CRC(5a101b0b) SHA1(9645ab1f8d058cf2c6c42ccb4ce92a9b5db10c51) )
ROM_LOAD( "gt5.5", 0x080000, 0x20000, CRC(3d3ab273) SHA1(b5706ada9eb2c22fcc0ac8ede2d2ee02ee853191) )
- ROM_REGION( 0x10000, "gfx5", 0 ) /* background tilemaps */
+ ROM_REGION( 0x10000, "bgtilemap", 0 ) /* background tilemaps */
ROM_LOAD( "gt11.11", 0x000000, 0x10000, CRC(b4f0fcf0) SHA1(b81cc0b6e3e6f5616789bb3e77807dc0ef718a38) )
ROM_REGION( 0x20000, "upd", 0 ) /* ADPCM samples */
diff --git a/src/mame/includes/prehisle.h b/src/mame/includes/prehisle.h
index 987b6b13e2a..a8ef345e4ed 100644
--- a/src/mame/includes/prehisle.h
+++ b/src/mame/includes/prehisle.h
@@ -5,9 +5,10 @@ class prehisle_state : public driver_device
public:
prehisle_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_videoram(*this, "videoram"),
+ m_tx_vram(*this, "tx_vram"),
m_spriteram(*this, "spriteram"),
- m_bg_videoram16(*this, "bg_videoram16"),
+ m_fg_vram(*this, "fg_vram"),
+ m_tilemap_rom(*this, "bgtilemap"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_upd7759(*this, "upd"),
@@ -15,25 +16,26 @@ public:
m_palette(*this, "palette") { }
- required_shared_ptr<UINT16> m_videoram;
+ required_shared_ptr<UINT16> m_tx_vram;
required_shared_ptr<UINT16> m_spriteram;
- required_shared_ptr<UINT16> m_bg_videoram16;
+ required_shared_ptr<UINT16> m_fg_vram;
+ required_region_ptr<UINT8> m_tilemap_rom;
UINT16 m_invert_controls;
- tilemap_t *m_bg2_tilemap;
tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap;
+ tilemap_t *m_tx_tilemap;
- DECLARE_WRITE16_MEMBER(prehisle_sound16_w);
- DECLARE_WRITE16_MEMBER(prehisle_bg_videoram16_w);
- DECLARE_WRITE16_MEMBER(prehisle_fg_videoram16_w);
- DECLARE_READ16_MEMBER(prehisle_control16_r);
- DECLARE_WRITE16_MEMBER(prehisle_control16_w);
+ DECLARE_WRITE16_MEMBER(soundcmd_w);
+ DECLARE_WRITE16_MEMBER(fg_vram_w);
+ DECLARE_WRITE16_MEMBER(tx_vram_w);
+ DECLARE_READ16_MEMBER(control_r);
+ DECLARE_WRITE16_MEMBER(control_w);
DECLARE_WRITE8_MEMBER(D7759_write_port_0_w);
DECLARE_WRITE8_MEMBER(D7759_upd_reset_w);
- TILE_GET_INFO_MEMBER(get_bg2_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ TILE_GET_INFO_MEMBER(get_tx_tile_info);
virtual void video_start();
UINT32 screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
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;
}