fixed namco_c45_road_device (tceptor and finallap) (nw)

This commit is contained in:
Miodrag Milanovic 2014-02-17 20:33:32 +00:00
parent d99a774dee
commit 266e88c179
4 changed files with 24 additions and 30 deletions

View File

@ -1317,22 +1317,11 @@ const gfx_layout namco_c45_road_device::s_tile_layout =
namco_c45_road_device::namco_c45_road_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NAMCO_C45_ROAD, "Namco C45 Road", tag, owner, clock, "namco_c45_road", __FILE__),
m_transparent_color(~0),
m_gfx(NULL),
m_tilemap(NULL),
m_gfxdecode(*this)
m_gfxdecode(*this, "gfxdecode")
{
}
//-------------------------------------------------
// static_set_gfxdecode_tag: Set the tag of the
// gfx decoder
//-------------------------------------------------
void namco_c45_road_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
{
downcast<namco_c45_road_device &>(device).m_gfxdecode.set_tag(tag);
}
//-------------------------------------------------
// read -- read from RAM
//-------------------------------------------------
@ -1359,7 +1348,7 @@ WRITE16_MEMBER( namco_c45_road_device::write )
else
{
offset -= 0x10000/2;
m_gfx->mark_dirty(offset / WORDS_PER_ROAD_TILE);
m_gfxdecode->gfx(0)->mark_dirty(offset / WORDS_PER_ROAD_TILE);
}
}
@ -1460,13 +1449,25 @@ void namco_c45_road_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect
void namco_c45_road_device::device_start()
{
// create a gfx_element describing the road graphics
m_gfx = auto_alloc(machine(), gfx_element(machine(), s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00));
m_gfxdecode->set_gfx(0, auto_alloc(machine(), gfx_element(machine(), s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00)));
// create a tilemap for the road
m_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(namco_c45_road_device::get_road_info), this),
TILEMAP_SCAN_ROWS, ROAD_TILE_SIZE, ROAD_TILE_SIZE, ROAD_COLS, ROAD_ROWS);
}
MACHINE_CONFIG_FRAGMENT( namco_c45_road )
MCFG_GFXDECODE_ADD("gfxdecode", empty)
MACHINE_CONFIG_END
//-------------------------------------------------
// device_mconfig_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor namco_c45_road_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( namco_c45_road );
}
//-------------------------------------------------
// device_stop -- device shutdown
@ -1474,7 +1475,7 @@ void namco_c45_road_device::device_start()
void namco_c45_road_device::device_stop()
{
auto_free(machine(), m_gfx);
}
@ -1486,8 +1487,8 @@ TILE_GET_INFO_MEMBER( namco_c45_road_device::get_road_info )
{
// ------xx xxxxxxxx tile number
// xxxxxx-- -------- palette select
//UINT16 data = m_ram[tile_index];
//int tile = data & 0x3ff;
//int color = data >> 10;
//SET_TILE_INFO_MEMBER(*m_gfxdecode, *m_gfx, tile, color, 0);
UINT16 data = m_ram[tile_index];
int tile = data & 0x3ff;
int color = data >> 10;
SET_TILE_INFO_MEMBER(m_gfxdecode, 0, tile, color, 0);
}

View File

@ -1859,7 +1859,6 @@ static MACHINE_CONFIG_START( finallap, namcos2_state )
MCFG_VIDEO_START_OVERRIDE(namcos2_state, finallap)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_NAMCO_C45_ROAD_GFXDECODE("gfxdecode")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -2014,7 +2013,6 @@ static MACHINE_CONFIG_START( luckywld, namcos2_state )
MCFG_VIDEO_START_OVERRIDE(namcos2_state, luckywld)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_NAMCO_C45_ROAD_GFXDECODE("gfxdecode")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -387,7 +387,6 @@ static MACHINE_CONFIG_START( tceptor, tceptor_state )
MCFG_DEFAULT_LAYOUT(layout_horizont)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_NAMCO_C45_ROAD_GFXDECODE("gfxdecode")
MCFG_SCREEN_ADD("2dscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60.606060)

View File

@ -124,11 +124,12 @@ public:
// construction/destruction
namco_c45_road_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
// read/write handlers
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
// optional information overrides
virtual machine_config_constructor device_mconfig_additions() const;
// C45 Land (Road) Emulation
void set_transparent_color(pen_t pen) { m_transparent_color = pen; }
@ -142,9 +143,8 @@ protected:
// internal helpers
TILE_GET_INFO_MEMBER( get_road_info );
// internal state
// internal state
pen_t m_transparent_color;
gfx_element * m_gfx;
tilemap_t * m_tilemap;
UINT16 m_ram[0x20000/2]; // at 0x880000 in Final Lap; at 0xa00000 in Lucky&Wild
@ -156,10 +156,6 @@ protected:
// device type definition
extern const device_type NAMCO_C45_ROAD;
#define MCFG_NAMCO_C45_ROAD_GFXDECODE(_gfxtag) \
namco_c45_road_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
/*----------- defined in drivers/namcoic.c -----------*/
void namco_tilemap_draw( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );