tc0150rod: updated to use inline configs. nw.

This commit is contained in:
Fabio Priuli 2014-04-08 16:10:59 +00:00
parent 6513c5b67e
commit 9c8533cfcf
3 changed files with 40 additions and 51 deletions

View File

@ -2994,8 +2994,6 @@ static const tc0480scp_interface taitoz_tc0480scp_intf =
};
static const tc0150rod_interface taitoz_tc0150rod_intf = { "gfx3" };
/***********************************************************
SAVE STATES
***********************************************************/
@ -3081,7 +3079,9 @@ static MACHINE_CONFIG_START( contcirc, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
MCFG_TC0110PCR_ADD("tc0110pcr")
MCFG_TC0110PCR_PALETTE("palette")
@ -3156,7 +3156,9 @@ static MACHINE_CONFIG_START( chasehq, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
MCFG_TC0110PCR_ADD("tc0110pcr")
MCFG_TC0110PCR_PALETTE("palette")
@ -3233,7 +3235,9 @@ static MACHINE_CONFIG_START( enforce, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
MCFG_TC0110PCR_ADD("tc0110pcr")
MCFG_TC0110PCR_PALETTE("palette")
@ -3306,7 +3310,8 @@ static MACHINE_CONFIG_START( bshark, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -3385,7 +3390,8 @@ static MACHINE_CONFIG_START( sci, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -3459,7 +3465,9 @@ static MACHINE_CONFIG_START( nightstr, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
MCFG_TC0110PCR_ADD("tc0110pcr")
MCFG_TC0110PCR_PALETTE("palette")
@ -3536,7 +3544,9 @@ static MACHINE_CONFIG_START( aquajack, taitoz_state )
MCFG_TC0100SCN_GFXDECODE("gfxdecode")
MCFG_TC0100SCN_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
MCFG_TC0110PCR_ADD("tc0110pcr")
MCFG_TC0110PCR_PALETTE("palette")
@ -3679,7 +3689,8 @@ static MACHINE_CONFIG_START( dblaxle, taitoz_state )
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -3752,7 +3763,8 @@ static MACHINE_CONFIG_START( racingb, taitoz_state )
MCFG_TC0480SCP_GFXDECODE("gfxdecode")
MCFG_TC0480SCP_PALETTE("palette")
MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
MCFG_TC0150ROD_GFXTAG("gfx3")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -11,8 +11,6 @@ Road generator. Two roads allow for forking. Gfx data fetched from ROM. Refer to
#define TC0150ROD_RAM_SIZE 0x2000
const device_type TC0150ROD = &device_creator<tc0150rod_device>;
tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
@ -21,25 +19,6 @@ tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *ta
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void tc0150rod_device::device_config_complete()
{
// inherit a copy of the static data
const tc0150rod_interface *intf = reinterpret_cast<const tc0150rod_interface *>(static_config());
if (intf != NULL)
*static_cast<tc0150rod_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -47,8 +26,10 @@ void tc0150rod_device::device_config_complete()
void tc0150rod_device::device_start()
{
m_ram = auto_alloc_array_clear(machine(), UINT16, TC0150ROD_RAM_SIZE / 2);
save_pointer(NAME(m_ram), TC0150ROD_RAM_SIZE / 2);
m_roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base();
assert(m_roadgfx);
}
@ -240,7 +221,6 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
UINT16 roada_line[512], roadb_line[512];
UINT16 *dst16;
UINT16 *roada, *roadb;
UINT16 *roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base();
UINT16 pixel, color, gfx_word;
UINT16 roada_clipl, roada_clipr, roada_bodyctrl;
@ -434,7 +414,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
if (road_gfx_tilenum) /* fixes Nightstr round C */
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
if ((pixel) || !(road_trans))
@ -485,7 +465,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
for (i = left_edge; i >= 0; i--)
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */
@ -528,7 +508,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
for (i = right_edge; i < screen_width; i++)
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */
@ -642,7 +622,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
for (i = begin; i < end; i++)
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
if ((pixel) || !(road_trans))
@ -692,7 +672,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
for (i = left_edge; i >= 0; i--)
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */
@ -735,7 +715,7 @@ void tc0150rod_device::draw( bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
for (i = right_edge; i < screen_width; i++)
{
gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */

View File

@ -1,36 +1,33 @@
#ifndef __TC0150ROD_H__
#define __TC0150ROD_H__
struct tc0150rod_interface
{
const char *m_gfx_region; /* gfx region for the road */
};
class tc0150rod_device : public device_t,
public tc0150rod_interface
class tc0150rod_device : public device_t
{
public:
tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~tc0150rod_device() {}
static void set_gfx_tag(device_t &device, const char *tag) { downcast<tc0150rod_device &>(device).m_gfx_region = tag; }
DECLARE_READ16_MEMBER( word_r );
DECLARE_WRITE16_MEMBER( word_w );
void draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs, int palette_offs, int type, int road_trans, bitmap_ind8 &priority_bitmap, UINT32 low_priority, UINT32 high_priority);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
private:
// internal state
UINT16 * m_ram;
const char *m_gfx_region; /* gfx region for the road */
UINT16 * m_roadgfx;
};
extern const device_type TC0150ROD;
#define MCFG_TC0150ROD_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, TC0150ROD, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_TC0150ROD_GFXTAG(_tag) \
tc0150rod_device::set_gfx_tag(*device, _tag);
#endif