From 1e7e9ade9cca2c1e1d347a43ea601e3ffa5927ec Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 13 Feb 2013 11:19:27 +0000 Subject: [PATCH] Modernization of drivers part 21 (no whatsnew) --- src/mame/drivers/wecleman.c | 32 ++++----- src/mame/drivers/wgp.c | 18 +++-- src/mame/drivers/williams.c | 6 +- src/mame/drivers/xain.c | 2 +- src/mame/drivers/xexex.c | 40 +++++------ src/mame/drivers/xyonix.c | 39 ++++++----- src/mame/drivers/zaxxon.c | 12 ++-- src/mame/includes/warpwarp.h | 2 + src/mame/includes/warriorb.h | 2 + src/mame/includes/wc90.h | 13 ++++ src/mame/includes/wc90b.h | 1 + src/mame/includes/wecleman.h | 3 + src/mame/includes/welltris.h | 1 + src/mame/includes/wgp.h | 6 ++ src/mame/includes/williams.h | 12 ++-- src/mame/includes/wiz.h | 3 + src/mame/includes/wolfpack.h | 4 ++ src/mame/includes/wrally.h | 1 + src/mame/includes/wwfsstar.h | 1 + src/mame/includes/wwfwfest.h | 1 + src/mame/includes/xain.h | 2 + src/mame/includes/xexex.h | 3 + src/mame/includes/xorworld.h | 1 + src/mame/includes/xxmissio.h | 1 + src/mame/includes/xyonix.h | 1 + src/mame/includes/yiear.h | 1 + src/mame/includes/yunsun16.h | 1 + src/mame/includes/zac2650.h | 2 + src/mame/includes/zaccaria.h | 1 + src/mame/includes/zaxxon.h | 6 ++ src/mame/machine/williams.c | 11 ++- src/mame/video/warpwarp.c | 23 +++---- src/mame/video/warriorb.c | 17 +++-- src/mame/video/wc90.c | 95 +++++++++++++------------- src/mame/video/wc90b.c | 13 ++-- src/mame/video/welltris.c | 11 ++- src/mame/video/wgp.c | 127 +++++++++++++++++------------------ src/mame/video/williams.c | 90 ++++++++++--------------- src/mame/video/wiz.c | 83 +++++++++++------------ src/mame/video/wolfpack.c | 67 +++++++++--------- src/mame/video/wrally.c | 21 +++--- src/mame/video/wwfsstar.c | 13 ++-- src/mame/video/wwfwfest.c | 21 +++--- src/mame/video/xain.c | 31 +++++---- src/mame/video/xorworld.c | 9 ++- src/mame/video/xxmissio.c | 17 +++-- src/mame/video/yiear.c | 15 ++--- src/mame/video/yunsun16.c | 29 ++++---- src/mame/video/zac2650.c | 76 ++++++++++----------- src/mame/video/zaccaria.c | 15 ++--- src/mame/video/zaxxon.c | 93 ++++++++++++------------- 51 files changed, 545 insertions(+), 550 deletions(-) diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c index 897ad42a12a..d442cd9090a 100644 --- a/src/mame/drivers/wecleman.c +++ b/src/mame/drivers/wecleman.c @@ -1287,13 +1287,13 @@ ROM_START( wecleman2 ) ROM_LOAD( "602a12.1a", 0x000000, 0x04000, CRC(77b9383d) SHA1(7cb970889677704d6324bb64aafc05326c4503ad) ) ROM_END -static void wecleman_unpack_sprites(running_machine &machine) +void wecleman_state::wecleman_unpack_sprites() { const char *region = "gfx1"; // sprites - const UINT32 len = machine.root_device().memregion(region)->bytes(); - UINT8 *src = machine.root_device().memregion(region)->base() + len / 2 - 1; - UINT8 *dst = machine.root_device().memregion(region)->base() + len - 1; + const UINT32 len = machine().root_device().memregion(region)->bytes(); + UINT8 *src = machine().root_device().memregion(region)->base() + len / 2 - 1; + UINT8 *dst = machine().root_device().memregion(region)->base() + len - 1; while(dst > src) { @@ -1304,9 +1304,9 @@ static void wecleman_unpack_sprites(running_machine &machine) } } -static void bitswap(running_machine &machine,UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0) +void wecleman_state::bitswap(UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0) { - UINT8 *buffer = auto_alloc_array(machine, UINT8, len); + UINT8 *buffer = auto_alloc_array(machine(), UINT8, len); int i; memcpy(buffer,src,len); @@ -1315,7 +1315,7 @@ static void bitswap(running_machine &machine,UINT8 *src,size_t len,int _14,int _ src[i] = buffer[BITSWAP24(i,23,22,21,_14,_13,_12,_11,_10,_f,_e,_d,_c,_b,_a,_9,_8,_7,_6,_5,_4,_3,_2,_1,_0)]; } - auto_free(machine, buffer); + auto_free(machine(), buffer); } /* Unpack sprites data and do some patching */ @@ -1343,18 +1343,18 @@ DRIVER_INIT_MEMBER(wecleman_state,wecleman) RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6); } - bitswap(machine(), machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes(), + bitswap(machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes(), 0,1,20,19,18,17,14,9,16,6,4,7,8,15,10,11,13,5,12,3,2); /* Now we can unpack each nibble of the sprites into a pixel (one byte) */ - wecleman_unpack_sprites(machine()); + wecleman_unpack_sprites(); /* Bg & Fg & Txt */ - bitswap(machine(), machine().root_device().memregion("gfx2")->base(), machine().root_device().memregion("gfx2")->bytes(), + bitswap(machine().root_device().memregion("gfx2")->base(), machine().root_device().memregion("gfx2")->bytes(), 20,19,18,17,16,15,12,7,14,4,2,5,6,13,8,9,11,3,10,1,0); /* Road */ - bitswap(machine(), machine().root_device().memregion("gfx3")->base(), machine().root_device().memregion("gfx3")->bytes(), + bitswap(machine().root_device().memregion("gfx3")->base(), machine().root_device().memregion("gfx3")->bytes(), 20,19,18,17,16,15,14,7,12,4,2,5,6,13,8,9,11,3,10,1,0); m_spr_color_offs = 0x40; @@ -1414,13 +1414,13 @@ ROM_END in a ROM module definition. This routine unpacks each sprite nibble into a byte, doubling the memory consumption. */ -static void hotchase_sprite_decode( running_machine &machine, int num16_banks, int bank_size ) +void wecleman_state::hotchase_sprite_decode( int num16_banks, int bank_size ) { UINT8 *base, *temp; int i; - base = machine.root_device().memregion("gfx1")->base(); // sprites - temp = auto_alloc_array(machine, UINT8, bank_size ); + base = machine().root_device().memregion("gfx1")->base(); // sprites + temp = auto_alloc_array(machine(), UINT8, bank_size ); for( i = num16_banks; i >0; i-- ){ UINT8 *finish = base + 2*bank_size*i; @@ -1458,7 +1458,7 @@ static void hotchase_sprite_decode( running_machine &machine, int num16_banks, i *dest++ = data & 0xF; } while( destbase(); /* Now we can unpack each nibble of the sprites into a pixel (one byte) */ - hotchase_sprite_decode(machine(),3,0x80000*2); // num banks, bank len + hotchase_sprite_decode(3,0x80000*2); // num banks, bank len /* Let's copy the second half of the fg layer gfx (charset) over the first */ RAM = memregion("gfx3")->base(); diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c index 1ada1159114..daa2e0f5fd4 100644 --- a/src/mame/drivers/wgp.c +++ b/src/mame/drivers/wgp.c @@ -413,13 +413,12 @@ WRITE16_MEMBER(wgp_state::sharedram_w) COMBINE_DATA(&m_sharedram[offset]); } -static void parse_control(running_machine &machine) +void wgp_state::parse_control() { /* bit 0 enables cpu B */ /* however this fails when recovering from a save state if cpu B is disabled !! */ - wgp_state *state = machine.driver_data(); - state->m_subcpu->set_input_line(INPUT_LINE_RESET, (state->m_cpua_ctrl & 0x1) ? CLEAR_LINE : ASSERT_LINE); + m_subcpu->set_input_line(INPUT_LINE_RESET, (m_cpua_ctrl & 0x1) ? CLEAR_LINE : ASSERT_LINE); /* bit 1 is "vibration" acc. to test mode */ } @@ -430,7 +429,7 @@ WRITE16_MEMBER(wgp_state::cpua_ctrl_w)/* assumes Z80 sandwiched between 68Ks */ data = data >> 8; /* for Wgp */ m_cpua_ctrl = data; - parse_control(machine()); + parse_control(); logerror("CPU #0 PC %06x: write %04x to cpu control\n",space.device().safe_pc(),data); } @@ -601,16 +600,15 @@ WRITE16_MEMBER(wgp_state::wgp_adinput_w) SOUND **********************************************************/ -static void reset_sound_region( running_machine &machine ) /* assumes Z80 sandwiched between the 68Ks */ +void wgp_state::reset_sound_region( ) /* assumes Z80 sandwiched between the 68Ks */ { - wgp_state *state = machine.driver_data(); - state->membank("bank10")->set_entry(state->m_banknum); + membank("bank10")->set_entry(m_banknum); } WRITE8_MEMBER(wgp_state::sound_bankswitch_w) { m_banknum = data & 7; - reset_sound_region(machine()); + reset_sound_region(); } WRITE16_MEMBER(wgp_state::wgp_sound_w) @@ -912,8 +910,8 @@ graphics glitches. void wgp_state::wgp_postload() { - parse_control(machine()); - reset_sound_region(machine()); + parse_control(); + reset_sound_region(); } void wgp_state::machine_reset() diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c index f852fa8b943..94f373a16d6 100644 --- a/src/mame/drivers/williams.c +++ b/src/mame/drivers/williams.c @@ -519,7 +519,7 @@ static ADDRESS_MAP_START( defender_map, AS_PROGRAM, 8, williams_state ) ADDRESS_MAP_END -void defender_install_io_space(address_space &space) +void williams_state::defender_install_io_space(address_space &space) { williams_state *state = space.machine().driver_data(); pia6821_device *pia_0 = space.machine().device("pia_0"); @@ -534,8 +534,8 @@ void defender_install_io_space(address_space &space) space.install_read_handler (0xc800, 0xcbff, 0, 0x03e0, read8_delegate(FUNC(williams_state::williams_video_counter_r),state)); space.install_readwrite_handler(0xcc00, 0xcc03, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_1), write8_delegate(FUNC(pia6821_device::write), pia_1)); space.install_readwrite_handler(0xcc04, 0xcc07, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_0), write8_delegate(FUNC(pia6821_device::write), pia_0)); - state->membank("bank3")->set_base(space.machine().driver_data()->m_nvram); - state->membank("bank4")->set_base(space.machine().driver_data()->m_generic_paletteram_8); + membank("bank3")->set_base(space.machine().driver_data()->m_nvram); + membank("bank4")->set_base(space.machine().driver_data()->m_generic_paletteram_8); } diff --git a/src/mame/drivers/xain.c b/src/mame/drivers/xain.c index 3ab297ea5c2..e67bec8a4b5 100644 --- a/src/mame/drivers/xain.c +++ b/src/mame/drivers/xain.c @@ -164,7 +164,7 @@ Updates by Bryan McPhail, 12/12/2004: Since MAME's video timing is 0-based, we need to convert this. */ -INLINE int scanline_to_vcount(int scanline) +inline int xain_state::scanline_to_vcount(int scanline) { int vcount = scanline + 8; if (vcount < 0x100) diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index 192149b9699..9ca8f4849e9 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -114,20 +114,19 @@ WRITE16_MEMBER(xexex_state::K053247_scattered_word_w) #endif -static void xexex_objdma( running_machine &machine, int limiter ) +void xexex_state::xexex_objdma( int limiter ) { - xexex_state *state = machine.driver_data(); int counter, num_inactive; UINT16 *src, *dst; - counter = state->m_frame; - state->m_frame = machine.primary_screen->frame_number(); - if (limiter && counter == state->m_frame) + counter = m_frame; + m_frame = machine().primary_screen->frame_number(); + if (limiter && counter == m_frame) return; // make sure we only do DMA transfer once per frame - k053247_get_ram(state->m_k053246, &dst); - counter = k053247_get_dy(state->m_k053246); - src = state->m_spriteram; + k053247_get_ram(m_k053246, &dst); + counter = k053247_get_dy(m_k053246); + src = m_spriteram; num_inactive = counter = 256; do @@ -170,23 +169,21 @@ READ16_MEMBER(xexex_state::xexex_waitskip_r) } -static void parse_control2( running_machine &machine ) +void xexex_state::parse_control2( ) { - xexex_state *state = machine.driver_data(); - /* bit 0 is data */ /* bit 1 is cs (active low) */ /* bit 2 is clock (active high) */ /* bit 5 is enable irq 6 */ /* bit 6 is enable irq 5 */ /* bit 11 is watchdog */ - state->ioport("EEPROMOUT")->write(state->m_cur_control2, 0xff); + ioport("EEPROMOUT")->write(m_cur_control2, 0xff); /* bit 8 = enable sprite ROM reading */ - k053246_set_objcha_line(state->m_k053246, (state->m_cur_control2 & 0x0100) ? ASSERT_LINE : CLEAR_LINE); + k053246_set_objcha_line(m_k053246, (m_cur_control2 & 0x0100) ? ASSERT_LINE : CLEAR_LINE); /* bit 9 = disable alpha channel on K054157 plane 0 (under investigation) */ - state->m_cur_alpha = !(state->m_cur_control2 & 0x200); + m_cur_alpha = !(m_cur_control2 & 0x200); } READ16_MEMBER(xexex_state::control2_r) @@ -197,7 +194,7 @@ READ16_MEMBER(xexex_state::control2_r) WRITE16_MEMBER(xexex_state::control2_w) { COMBINE_DATA(&m_cur_control2); - parse_control2(machine()); + parse_control2(); } @@ -230,16 +227,15 @@ READ16_MEMBER(xexex_state::sound_status_r) return soundlatch3_byte_r(space, 0); } -static void reset_sound_region(running_machine &machine) +void xexex_state::reset_sound_region() { - xexex_state *state = machine.driver_data(); - state->membank("bank2")->set_entry(state->m_cur_sound_region & 0x07); + membank("bank2")->set_entry(m_cur_sound_region & 0x07); } WRITE8_MEMBER(xexex_state::sound_bankswitch_w) { m_cur_sound_region = data & 7; - reset_sound_region(machine()); + reset_sound_region(); } static void ym_set_mixing(device_t *device, double left, double right) @@ -291,7 +287,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(xexex_state::xexex_interrupt) if (k053246_is_irq_enabled(m_k053246)) { // OBJDMA starts at the beginning of V-blank - xexex_objdma(machine(), 0); + xexex_objdma(0); // schedule DMA end interrupt m_dmadelay_timer->adjust(XE_DMADELAY); @@ -442,8 +438,8 @@ static const k053252_interface xexex_k053252_intf = void xexex_state::xexex_postload() { - parse_control2(machine()); - reset_sound_region(machine()); + parse_control2(); + reset_sound_region(); } void xexex_state::machine_start() diff --git a/src/mame/drivers/xyonix.c b/src/mame/drivers/xyonix.c index 38edb6a0f44..4f9cfe999bd 100644 --- a/src/mame/drivers/xyonix.c +++ b/src/mame/drivers/xyonix.c @@ -33,42 +33,41 @@ WRITE8_MEMBER(xyonix_state::xyonix_irqack_w) /* Inputs ********************************************************************/ -static void handle_coins(running_machine &machine, int coin) +void xyonix_state::handle_coins(int coin) { static const int coinage_table[4][2] = {{2,3},{2,1},{1,2},{1,1}}; - xyonix_state *state = machine.driver_data(); int tmp = 0; - //popmessage("Coin %d", state->m_coin); + //popmessage("Coin %d", m_coin); if (coin & 1) // Coin 2 ! { - tmp = (state->ioport("DSW")->read() & 0xc0) >> 6; - state->m_coins++; - if (state->m_coins >= coinage_table[tmp][0]) + tmp = (ioport("DSW")->read() & 0xc0) >> 6; + m_coins++; + if (m_coins >= coinage_table[tmp][0]) { - state->m_credits += coinage_table[tmp][1]; - state->m_coins -= coinage_table[tmp][0]; + m_credits += coinage_table[tmp][1]; + m_coins -= coinage_table[tmp][0]; } - coin_lockout_global_w(machine, 0); /* Unlock all coin slots */ - coin_counter_w(machine,1,1); coin_counter_w(machine,1,0); /* Count slot B */ + coin_lockout_global_w(machine(), 0); /* Unlock all coin slots */ + coin_counter_w(machine(),1,1); coin_counter_w(machine(),1,0); /* Count slot B */ } if (coin & 2) // Coin 1 ! { - tmp = (machine.root_device().ioport("DSW")->read() & 0x30) >> 4; - state->m_coins++; - if (state->m_coins >= coinage_table[tmp][0]) + tmp = (machine().root_device().ioport("DSW")->read() & 0x30) >> 4; + m_coins++; + if (m_coins >= coinage_table[tmp][0]) { - state->m_credits += coinage_table[tmp][1]; - state->m_coins -= coinage_table[tmp][0]; + m_credits += coinage_table[tmp][1]; + m_coins -= coinage_table[tmp][0]; } - coin_lockout_global_w(machine, 0); /* Unlock all coin slots */ - coin_counter_w(machine,0,1); coin_counter_w(machine,0,0); /* Count slot A */ + coin_lockout_global_w(machine(), 0); /* Unlock all coin slots */ + coin_counter_w(machine(),0,1); coin_counter_w(machine(),0,0); /* Count slot A */ } - if (state->m_credits >= 9) - state->m_credits = 9; + if (m_credits >= 9) + m_credits = 9; } @@ -97,7 +96,7 @@ READ8_MEMBER(xyonix_state::xyonix_io_r) coin = ((ioport("P1")->read() & 0x80) >> 7) | ((ioport("P2")->read() & 0x80) >> 6); if (coin ^ m_prev_coin && coin != 3) { - if (m_credits < 9) handle_coins(machine(), coin); + if (m_credits < 9) handle_coins(coin); } m_prev_coin = coin; return m_credits; diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c index e5e41b5dd27..a11086fbc8b 100644 --- a/src/mame/drivers/zaxxon.c +++ b/src/mame/drivers/zaxxon.c @@ -1472,7 +1472,7 @@ ROM_END * *************************************/ -static void zaxxonj_decode(running_machine &machine, const char *cputag) +void zaxxon_state::zaxxonj_decode(const char *cputag) { /* the values vary, but the translation mask is always laid out like this: @@ -1517,10 +1517,10 @@ static void zaxxonj_decode(running_machine &machine, const char *cputag) }; int A; - address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); - UINT8 *rom = machine.root_device().memregion(cputag)->base(); - int size = machine.root_device().memregion(cputag)->bytes(); - UINT8 *decrypt = auto_alloc_array(machine, UINT8, size); + address_space &space = machine().device(cputag)->memory().space(AS_PROGRAM); + UINT8 *rom = machine().root_device().memregion(cputag)->base(); + int size = machine().root_device().memregion(cputag)->bytes(); + UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size); space.set_decrypted_region(0x0000, size - 1, decrypt); @@ -1559,7 +1559,7 @@ static void zaxxonj_decode(running_machine &machine, const char *cputag) DRIVER_INIT_MEMBER(zaxxon_state,zaxxonj) { - zaxxonj_decode(machine(), "maincpu"); + zaxxonj_decode("maincpu"); } diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h index 29fcf953151..39505c06f1f 100644 --- a/src/mame/includes/warpwarp.h +++ b/src/mame/includes/warpwarp.h @@ -48,6 +48,8 @@ public: DECLARE_PALETTE_INIT(navarone); UINT32 screen_update_geebee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); + inline void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen); + void draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen); }; diff --git a/src/mame/includes/warriorb.h b/src/mame/includes/warriorb.h index 91f71b46d8a..9e6c5c45cdb 100644 --- a/src/mame/includes/warriorb.h +++ b/src/mame/includes/warriorb.h @@ -43,4 +43,6 @@ public: UINT32 screen_update_warriorb_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_warriorb_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void reset_sound_region(); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs ); + UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn); }; diff --git a/src/mame/includes/wc90.h b/src/mame/includes/wc90.h index 2d748b17a65..95ec2ef5b60 100644 --- a/src/mame/includes/wc90.h +++ b/src/mame/includes/wc90.h @@ -20,6 +20,8 @@ public: m_scroll2yhi(*this, "scroll2yhi"), m_spriteram(*this, "spriteram"){ } + typedef void (wc90_state::*draw_sprites_func)(bitmap_ind16 &, const rectangle &, int, int, int, int, int ); + required_shared_ptr m_fgvideoram; required_shared_ptr m_bgvideoram; required_shared_ptr m_txvideoram; @@ -53,4 +55,15 @@ public: virtual void video_start(); DECLARE_VIDEO_START(wc90t); UINT32 screen_update_wc90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); + void draw_sprite_16x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_16x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_16x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_32x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_32x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_32x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags ); + void draw_sprite_64x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_64x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_64x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ); + void draw_sprite_invalid(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags ); }; diff --git a/src/mame/includes/wc90b.h b/src/mame/includes/wc90b.h index d32f54eb058..d240381e093 100644 --- a/src/mame/includes/wc90b.h +++ b/src/mame/includes/wc90b.h @@ -40,4 +40,5 @@ public: TILE_GET_INFO_MEMBER(get_tx_tile_info); virtual void video_start(); UINT32 screen_update_wc90b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); }; diff --git a/src/mame/includes/wecleman.h b/src/mame/includes/wecleman.h index fc98752c2d6..ba273d6580b 100644 --- a/src/mame/includes/wecleman.h +++ b/src/mame/includes/wecleman.h @@ -81,6 +81,9 @@ public: INTERRUPT_GEN_MEMBER(hotchase_sound_timer); TIMER_DEVICE_CALLBACK_MEMBER(wecleman_scanline); TIMER_DEVICE_CALLBACK_MEMBER(hotchase_scanline); + void wecleman_unpack_sprites(); + void bitswap(UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0); + void hotchase_sprite_decode( int num16_banks, int bank_size ); }; /*----------- defined in video/wecleman.c -----------*/ diff --git a/src/mame/includes/welltris.h b/src/mame/includes/welltris.h index 2313a85b86b..2afb67af49a 100644 --- a/src/mame/includes/welltris.h +++ b/src/mame/includes/welltris.h @@ -41,4 +41,5 @@ public: TILE_GET_INFO_MEMBER(get_welltris_tile_info); virtual void video_start(); UINT32 screen_update_welltris(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/wgp.h b/src/mame/includes/wgp.h index b87d2c8a9bc..ffc016f264b 100644 --- a/src/mame/includes/wgp.h +++ b/src/mame/includes/wgp.h @@ -74,4 +74,10 @@ public: TIMER_CALLBACK_MEMBER(wgp_interrupt6); TIMER_CALLBACK_MEMBER(wgp_cpub_interrupt6); void wgp_postload(); + inline void common_get_piv_tile_info( tile_data &tileinfo, int tile_index, int num ); + void wgp_core_vh_start( int piv_xoffs, int piv_yoffs ); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ); + void wgp_piv_layer_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ); + void parse_control(); + void reset_sound_region( ) /* assumes Z80 sandwiched between the 68Ks */; }; diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h index 2d591f8b34f..2fe745407f6 100644 --- a/src/mame/includes/williams.h +++ b/src/mame/includes/williams.h @@ -129,6 +129,13 @@ public: DECLARE_WRITE8_MEMBER(tshoot_lamp_w); void williams2_postload(); void defender_postload(); + void state_save_register(); + void create_palette_lookup(); + void blitter_init(int blitter_config, const UINT8 *remap_prom); + inline void blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid); + int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data); + inline void update_blaster_banking(); + void defender_install_io_space(address_space &space); }; @@ -148,11 +155,6 @@ public: DECLARE_WRITE8_MEMBER(joust2_snd_cmd_w); }; -/*----------- defined in drivers/williams.c -----------*/ - -void defender_install_io_space(address_space &space); - - /*----------- defined in machine/williams.c -----------*/ /* Generic old-Williams PIA interfaces */ diff --git a/src/mame/includes/wiz.h b/src/mame/includes/wiz.h index 211d85244c3..525d33641f8 100644 --- a/src/mame/includes/wiz.h +++ b/src/mame/includes/wiz.h @@ -53,4 +53,7 @@ public: UINT32 screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(wiz_vblank_interrupt); INTERRUPT_GEN_MEMBER(wiz_sound_interrupt); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype); + void draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8* sprite_ram,int bank); }; diff --git a/src/mame/includes/wolfpack.h b/src/mame/includes/wolfpack.h index ffc52376c7f..d449d6e3765 100644 --- a/src/mame/includes/wolfpack.h +++ b/src/mame/includes/wolfpack.h @@ -57,4 +57,8 @@ public: UINT32 screen_update_wolfpack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_wolfpack(screen_device &screen, bool state); TIMER_CALLBACK_MEMBER(periodic_callback); + void draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/wrally.h b/src/mame/includes/wrally.h index 7c7e5ca14ac..4c130f300ee 100644 --- a/src/mame/includes/wrally.h +++ b/src/mame/includes/wrally.h @@ -25,4 +25,5 @@ public: TILE_GET_INFO_MEMBER(get_tile_info_wrally_screen1); virtual void video_start(); UINT32 screen_update_wrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); }; diff --git a/src/mame/includes/wwfsstar.h b/src/mame/includes/wwfsstar.h index 19c31000159..9ef61541b40 100644 --- a/src/mame/includes/wwfsstar.h +++ b/src/mame/includes/wwfsstar.h @@ -28,4 +28,5 @@ public: virtual void video_start(); UINT32 screen_update_wwfsstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_scanline); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/wwfwfest.h b/src/mame/includes/wwfwfest.h index e6e46c41179..2c5692978d9 100644 --- a/src/mame/includes/wwfwfest.h +++ b/src/mame/includes/wwfwfest.h @@ -45,4 +45,5 @@ public: DECLARE_VIDEO_START(wwfwfstb); UINT32 screen_update_wwfwfest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(wwfwfest_scanline); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/xain.h b/src/mame/includes/xain.h index bf7f2c60db9..34f2ad4c7f3 100644 --- a/src/mame/includes/xain.h +++ b/src/mame/includes/xain.h @@ -70,4 +70,6 @@ public: virtual void video_start(); UINT32 screen_update_xain(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(xain_scanline); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + inline int scanline_to_vcount(int scanline); }; diff --git a/src/mame/includes/xexex.h b/src/mame/includes/xexex.h index 66a1da07162..367bd4b3280 100644 --- a/src/mame/includes/xexex.h +++ b/src/mame/includes/xexex.h @@ -69,6 +69,9 @@ public: TIMER_CALLBACK_MEMBER(dmaend_callback); TIMER_DEVICE_CALLBACK_MEMBER(xexex_interrupt); void xexex_postload(); + void xexex_objdma( int limiter ); + void parse_control2( ); + void reset_sound_region(); }; /*----------- defined in video/xexex.c -----------*/ diff --git a/src/mame/includes/xorworld.h b/src/mame/includes/xorworld.h index 5e777b98d58..1d18ffa40a3 100644 --- a/src/mame/includes/xorworld.h +++ b/src/mame/includes/xorworld.h @@ -20,4 +20,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_xorworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/xxmissio.h b/src/mame/includes/xxmissio.h index d18c8717a32..4a96ff003fe 100644 --- a/src/mame/includes/xxmissio.h +++ b/src/mame/includes/xxmissio.h @@ -33,4 +33,5 @@ public: INTERRUPT_GEN_MEMBER(xxmissio_interrupt_s); DECLARE_WRITE8_MEMBER(xxmissio_scroll_x_w); DECLARE_WRITE8_MEMBER(xxmissio_scroll_y_w); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); }; diff --git a/src/mame/includes/xyonix.h b/src/mame/includes/xyonix.h index 0422621c052..64d8b5b3d33 100644 --- a/src/mame/includes/xyonix.h +++ b/src/mame/includes/xyonix.h @@ -20,4 +20,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_xyonix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void handle_coins(int coin); }; diff --git a/src/mame/includes/yiear.h b/src/mame/includes/yiear.h index edd7a764a44..80f53b618bd 100644 --- a/src/mame/includes/yiear.h +++ b/src/mame/includes/yiear.h @@ -38,4 +38,5 @@ public: UINT32 screen_update_yiear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(yiear_vblank_interrupt); INTERRUPT_GEN_MEMBER(yiear_nmi_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/yunsun16.h b/src/mame/includes/yunsun16.h index f142b21e053..5254e7dd088 100644 --- a/src/mame/includes/yunsun16.h +++ b/src/mame/includes/yunsun16.h @@ -45,4 +45,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_yunsun16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/zac2650.h b/src/mame/includes/zac2650.h index 8f49b54dbbe..598442f76bd 100644 --- a/src/mame/includes/zac2650.h +++ b/src/mame/includes/zac2650.h @@ -22,4 +22,6 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + int SpriteCollision(int first,int second); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/zaccaria.h b/src/mame/includes/zaccaria.h index 7e5a453b483..4957c142204 100644 --- a/src/mame/includes/zaccaria.h +++ b/src/mame/includes/zaccaria.h @@ -47,4 +47,5 @@ public: UINT32 screen_update_zaccaria(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(zaccaria_cb1_toggle); INTERRUPT_GEN_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section); }; diff --git a/src/mame/includes/zaxxon.h b/src/mame/includes/zaxxon.h index ef64c7fbca2..d828b2841e5 100644 --- a/src/mame/includes/zaxxon.h +++ b/src/mame/includes/zaxxon.h @@ -78,6 +78,12 @@ public: DECLARE_WRITE8_MEMBER(zaxxon_sound_c_w); DECLARE_WRITE8_MEMBER(congo_sound_b_w); DECLARE_WRITE8_MEMBER(congo_sound_c_w); + void video_start_common(tilemap_get_info_delegate fg_tile_info); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int skew); + inline int find_minimum_y(UINT8 value, int flip); + inline int find_minimum_x(UINT8 value, int flip); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask); + void zaxxonj_decode(const char *cputag); }; diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index 281a2466a0a..3562c29f8fe 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -865,11 +865,10 @@ MACHINE_RESET_MEMBER(williams_state,blaster) } -INLINE void update_blaster_banking(running_machine &machine) +inline void williams_state::update_blaster_banking() { - williams_state *state = machine.driver_data(); - state->membank("bank1")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1)); - state->membank("bank2")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1)); + membank("bank1")->set_entry(m_vram_bank * (m_blaster_bank + 1)); + membank("bank2")->set_entry(m_vram_bank * (m_blaster_bank + 1)); } @@ -877,7 +876,7 @@ WRITE8_MEMBER(williams_state::blaster_vram_select_w) { /* VRAM/ROM banking from bit 0 */ m_vram_bank = data & 0x01; - update_blaster_banking(machine()); + update_blaster_banking(); /* cocktail flip from bit 1 */ m_cocktail = data & 0x02; @@ -890,7 +889,7 @@ WRITE8_MEMBER(williams_state::blaster_vram_select_w) WRITE8_MEMBER(williams_state::blaster_bank_select_w) { m_blaster_bank = data & 15; - update_blaster_banking(machine()); + update_blaster_banking(); } diff --git a/src/mame/video/warpwarp.c b/src/mame/video/warpwarp.c index b3de4c52970..2d6984ed132 100644 --- a/src/mame/video/warpwarp.c +++ b/src/mame/video/warpwarp.c @@ -207,30 +207,29 @@ WRITE8_MEMBER(warpwarp_state::warpwarp_videoram_w) ***************************************************************************/ -INLINE void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) +inline void warpwarp_state::geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { if (cliprect.contains(x, y)) bitmap.pix16(y, x) = pen; } -static void draw_ball(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen) +void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen) { - warpwarp_state *state = machine.driver_data(); - if (state->m_ball_on) + if (m_ball_on) { int x,y,i,j; - if (state->flip_screen() & 1) { - x = 376 - state->m_ball_h; - y = 280 - state->m_ball_v; + if (flip_screen() & 1) { + x = 376 - m_ball_h; + y = 280 - m_ball_v; } else { - x = 264 - state->m_ball_h; - y = 240 - state->m_ball_v; + x = 264 - m_ball_h; + y = 240 - m_ball_v; } - for (i = state->m_ball_sizey;i > 0;i--) - for (j = state->m_ball_sizex;j > 0;j--) + for (i = m_ball_sizey;i > 0;i--) + for (j = m_ball_sizex;j > 0;j--) geebee_plot(bitmap, cliprect, x-j, y-i, pen); } } @@ -239,6 +238,6 @@ UINT32 warpwarp_state::screen_update_geebee(screen_device &screen, bitmap_ind16 { m_bg_tilemap->draw(bitmap, cliprect, 0,0); - draw_ball(machine(), bitmap, cliprect, m_ball_pen); + draw_ball(bitmap, cliprect, m_ball_pen); return 0; } diff --git a/src/mame/video/warriorb.c b/src/mame/video/warriorb.c index 1cdd744bc7d..ea643e51923 100644 --- a/src/mame/video/warriorb.c +++ b/src/mame/video/warriorb.c @@ -15,10 +15,9 @@ void warriorb_state::video_start() SPRITE DRAW ROUTINE ************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs ) +void warriorb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs ) { - warriorb_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, data, data2, tilenum, color, flipx, flipy; int x, y, priority, pri_mask; @@ -27,7 +26,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const #endif /* pdrawgfx() needs us to draw sprites front to back */ - for (offs = 0; offs < state->m_spriteram.bytes() / 2; offs += 4) + for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 4) { data = spriteram[offs + 1]; tilenum = data & 0x7fff; @@ -63,12 +62,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (x > 0x3c0) x -= 0x400; if (y > 0x180) y -= 0x200; - pdrawgfx_transpen(bitmap,cliprect,machine.gfx[0], + pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0], tilenum, color, flipx,flipy, x,y, - machine.priority_bitmap,pri_mask,0); + machine().priority_bitmap,pri_mask,0); } #ifdef MAME_DEBUG @@ -82,7 +81,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const SCREEN REFRESH **************************************************************/ -static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn) +UINT32 warriorb_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn) { UINT8 layer[3], nodraw; @@ -101,13 +100,13 @@ static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const r /* Ensure screen blanked even when bottom layers not drawn due to disable bit */ if (nodraw) - bitmap.fill(get_black_pen(screen.machine()), cliprect); + bitmap.fill(get_black_pen(machine()), cliprect); // draw middle layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[1], 0, 1); /* Sprites can be under/over the layer below text layer */ - draw_sprites(screen.machine(), bitmap, cliprect, xoffs, 8); // draw sprites + draw_sprites(bitmap, cliprect, xoffs, 8); // draw sprites // draw top(text) layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[2], 0, 0); diff --git a/src/mame/video/wc90.c b/src/mame/video/wc90.c index 7abaf5ee132..9483cff451d 100644 --- a/src/mame/video/wc90.c +++ b/src/mame/video/wc90.c @@ -126,7 +126,7 @@ WRITE8_MEMBER(wc90_state::wc90_txvideoram_w) ***************************************************************************/ #define WC90_DRAW_SPRITE( code, sx, sy ) \ - drawgfx_transpen( bitmap, cliprect, machine.gfx[3], code, flags >> 4, \ + drawgfx_transpen( bitmap, cliprect, machine().gfx[3], code, flags >> 4, \ bank&1, bank&2, sx, sy, 0 ) static const char p32x32[4][4] = { @@ -157,13 +157,13 @@ static const char p64x64[4][16] = { { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } }; -static void draw_sprite_16x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_16x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ WC90_DRAW_SPRITE( code, sx, sy ); } -static void draw_sprite_16x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_16x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ if ( bank & 2 ) { WC90_DRAW_SPRITE( code+1, sx, sy+16 ); WC90_DRAW_SPRITE( code, sx, sy ); @@ -173,8 +173,8 @@ static void draw_sprite_16x32(running_machine &machine, bitmap_ind16 &bitmap, co } } -static void draw_sprite_16x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_16x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ if ( bank & 2 ) { WC90_DRAW_SPRITE( code+3, sx, sy+48 ); WC90_DRAW_SPRITE( code+2, sx, sy+32 ); @@ -188,8 +188,8 @@ static void draw_sprite_16x64(running_machine &machine, bitmap_ind16 &bitmap, co } } -static void draw_sprite_32x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_32x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ if ( bank & 1 ) { WC90_DRAW_SPRITE( code+1, sx+16, sy ); WC90_DRAW_SPRITE( code, sx, sy ); @@ -199,8 +199,8 @@ static void draw_sprite_32x16(running_machine &machine, bitmap_ind16 &bitmap, co } } -static void draw_sprite_32x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_32x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ const char *p = p32x32[ bank&3 ]; WC90_DRAW_SPRITE( code+p[0], sx, sy ); @@ -209,8 +209,8 @@ static void draw_sprite_32x32(running_machine &machine, bitmap_ind16 &bitmap, co WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 ); } -static void draw_sprite_32x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_32x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags ) +{ const char *p = p32x64[ bank&3 ]; WC90_DRAW_SPRITE( code+p[0], sx, sy ); @@ -223,8 +223,8 @@ static void draw_sprite_32x64(running_machine &machine, bitmap_ind16 &bitmap, co WC90_DRAW_SPRITE( code+p[7], sx+16, sy+48 ); } -static void draw_sprite_64x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_64x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ if ( bank & 1 ) { WC90_DRAW_SPRITE( code+3, sx+48, sy ); WC90_DRAW_SPRITE( code+2, sx+32, sy ); @@ -238,8 +238,8 @@ static void draw_sprite_64x16(running_machine &machine, bitmap_ind16 &bitmap, co } } -static void draw_sprite_64x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_64x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ const char *p = p64x32[ bank&3 ]; WC90_DRAW_SPRITE( code+p[0], sx, sy ); @@ -252,8 +252,8 @@ static void draw_sprite_64x32(running_machine &machine, bitmap_ind16 &bitmap, co WC90_DRAW_SPRITE( code+p[7], sx+48, sy+16 ); } -static void draw_sprite_64x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_64x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags ) +{ const char *p = p64x64[ bank&3 ]; WC90_DRAW_SPRITE( code+p[0], sx, sy ); @@ -275,40 +275,37 @@ static void draw_sprite_64x64(running_machine &machine, bitmap_ind16 &bitmap, co WC90_DRAW_SPRITE( code+p[15], sx+48, sy+48 ); } -static void draw_sprite_invalid(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code, - int sx, int sy, int bank, int flags ) { +void wc90_state::draw_sprite_invalid(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags ) +{ logerror("8 pixel sprite size not supported\n" ); } -typedef void (*draw_sprites_func)(running_machine &, bitmap_ind16 &, const rectangle &, int, int, int, int, int ); - -static const draw_sprites_func draw_sprites_proc[16] = { - draw_sprite_invalid, /* 0000 = 08x08 */ - draw_sprite_invalid, /* 0001 = 16x08 */ - draw_sprite_invalid, /* 0010 = 32x08 */ - draw_sprite_invalid, /* 0011 = 64x08 */ - draw_sprite_invalid, /* 0100 = 08x16 */ - draw_sprite_16x16, /* 0101 = 16x16 */ - draw_sprite_32x16, /* 0110 = 32x16 */ - draw_sprite_64x16, /* 0111 = 64x16 */ - draw_sprite_invalid, /* 1000 = 08x32 */ - draw_sprite_16x32, /* 1001 = 16x32 */ - draw_sprite_32x32, /* 1010 = 32x32 */ - draw_sprite_64x32, /* 1011 = 64x32 */ - draw_sprite_invalid, /* 1100 = 08x64 */ - draw_sprite_16x64, /* 1101 = 16x64 */ - draw_sprite_32x64, /* 1110 = 32x64 */ - draw_sprite_64x64 /* 1111 = 64x64 */ +static const wc90_state::draw_sprites_func draw_sprites_proc[16] = { + &wc90_state::draw_sprite_invalid, /* 0000 = 08x08 */ + &wc90_state::draw_sprite_invalid, /* 0001 = 16x08 */ + &wc90_state::draw_sprite_invalid, /* 0010 = 32x08 */ + &wc90_state::draw_sprite_invalid, /* 0011 = 64x08 */ + &wc90_state::draw_sprite_invalid, /* 0100 = 08x16 */ + &wc90_state::draw_sprite_16x16, /* 0101 = 16x16 */ + &wc90_state::draw_sprite_32x16, /* 0110 = 32x16 */ + &wc90_state::draw_sprite_64x16, /* 0111 = 64x16 */ + &wc90_state::draw_sprite_invalid, /* 1000 = 08x32 */ + &wc90_state::draw_sprite_16x32, /* 1001 = 16x32 */ + &wc90_state::draw_sprite_32x32, /* 1010 = 32x32 */ + &wc90_state::draw_sprite_64x32, /* 1011 = 64x32 */ + &wc90_state::draw_sprite_invalid, /* 1100 = 08x64 */ + &wc90_state::draw_sprite_16x64, /* 1101 = 16x64 */ + &wc90_state::draw_sprite_32x64, /* 1110 = 32x64 */ + &wc90_state::draw_sprite_64x64 /* 1111 = 64x64 */ }; -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void wc90_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - wc90_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs, sx,sy, flags, which; /* draw all visible sprites of specified priority */ - for (offs = 0;offs < state->m_spriteram.bytes();offs += 16){ + for (offs = 0;offs < m_spriteram.bytes();offs += 16){ int bank = spriteram[offs+0]; if ( ( bank >> 4 ) == priority ) { @@ -321,7 +318,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (sx >= 0x0300) sx -= 0x0400; flags = spriteram[offs+4]; - ( *( draw_sprites_proc[ flags & 0x0f ] ) )(machine, bitmap,cliprect, which, sx, sy, bank, flags ); + (this->*( draw_sprites_proc[ flags & 0x0f ] ) )(bitmap,cliprect, which, sx, sy, bank, flags ); } } } @@ -339,12 +336,12 @@ UINT32 wc90_state::screen_update_wc90(screen_device &screen, bitmap_ind16 &bitma m_tx_tilemap->set_scrollx(0,m_scroll0xlo[0] + 256 * m_scroll0xhi[0]); m_tx_tilemap->set_scrolly(0,m_scroll0ylo[0] + 256 * m_scroll0yhi[0]); -// draw_sprites(machine(), bitmap,cliprect, 3 ); +// draw_sprites(bitmap,cliprect, 3 ); m_bg_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect, 2 ); + draw_sprites(bitmap,cliprect, 2 ); m_fg_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect, 1 ); + draw_sprites(bitmap,cliprect, 1 ); m_tx_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect, 0 ); + draw_sprites(bitmap,cliprect, 0 ); return 0; } diff --git a/src/mame/video/wc90b.c b/src/mame/video/wc90b.c index 0ee7a2ec964..06917b1e062 100644 --- a/src/mame/video/wc90b.c +++ b/src/mame/video/wc90b.c @@ -91,14 +91,13 @@ WRITE8_MEMBER(wc90b_state::wc90b_txvideoram_w) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void wc90b_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - wc90b_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs, sx, sy; /* draw all visible sprites of specified priority */ - for ( offs = state->m_spriteram.bytes() - 8 ; offs >= 0 ; offs -= 8 ) + for ( offs = m_spriteram.bytes() - 8 ; offs >= 0 ; offs -= 8 ) { if ( ( ~( spriteram[offs+3] >> 7 ) & 1 ) == priority ) { @@ -115,7 +114,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r sy = 240 - spriteram[offs + 1]; - drawgfx_transpen( bitmap, cliprect,machine.gfx[17], code, + drawgfx_transpen( bitmap, cliprect,machine().gfx[17], code, flags >> 4, /* color */ bank & 1, /* flipx */ bank & 2, /* flipy */ @@ -134,8 +133,8 @@ UINT32 wc90b_state::screen_update_wc90b(screen_device &screen, bitmap_ind16 &bit m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect, 1 ); + draw_sprites(bitmap,cliprect, 1 ); m_tx_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect, 0 ); + draw_sprites(bitmap,cliprect, 0 ); return 0; } diff --git a/src/mame/video/welltris.c b/src/mame/video/welltris.c index d273a67ef1d..22d5923ab77 100644 --- a/src/mame/video/welltris.c +++ b/src/mame/video/welltris.c @@ -77,18 +77,17 @@ void welltris_state::video_start() m_char_tilemap->set_transparent_pen(15); } -static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void welltris_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - welltris_state *state = machine.driver_data(); int x, y; int pixdata; for (y = 0; y < 256; y++) { for (x = 0; x < 512 / 2; x++) { - pixdata = state->m_pixelram[(x & 0xff) + (y & 0xff) * 256]; + pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * state->m_pixelpalettebank) + 0x400; - bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * state->m_pixelpalettebank) + 0x400; + bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; } } } @@ -98,7 +97,7 @@ UINT32 welltris_state::screen_update_welltris(screen_device &screen, bitmap_ind1 m_char_tilemap->set_scrollx(0, m_scrollx); m_char_tilemap->set_scrolly(0, m_scrolly); - draw_background(machine(), bitmap, cliprect); + draw_background(bitmap, cliprect); m_char_tilemap->draw(bitmap, cliprect, 0, 0); m_spr_old->turbofrc_draw_sprites(m_spriteram, m_spriteram.bytes(), m_spritepalettebank, machine(), bitmap, cliprect, 0); return 0; diff --git a/src/mame/video/wgp.c b/src/mame/video/wgp.c index 40b57d60f8f..0e953135a2c 100644 --- a/src/mame/video/wgp.c +++ b/src/mame/video/wgp.c @@ -5,13 +5,12 @@ /*******************************************************************/ -INLINE void common_get_piv_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int num ) +inline void wgp_state::common_get_piv_tile_info( tile_data &tileinfo, int tile_index, int num ) { - wgp_state *state = machine.driver_data(); - UINT16 tilenum = state->m_pivram[tile_index + num * 0x1000]; /* 3 blocks of $2000 */ - UINT16 attr = state->m_pivram[tile_index + num * 0x1000 + 0x8000]; /* 3 blocks of $2000 */ + UINT16 tilenum = m_pivram[tile_index + num * 0x1000]; /* 3 blocks of $2000 */ + UINT16 attr = m_pivram[tile_index + num * 0x1000 + 0x8000]; /* 3 blocks of $2000 */ - SET_TILE_INFO( + SET_TILE_INFO_MEMBER( 2, tilenum & 0x3fff, (attr & 0x3f), /* attr & 0x1 ?? */ @@ -20,61 +19,59 @@ INLINE void common_get_piv_tile_info( running_machine &machine, tile_data &tilei TILE_GET_INFO_MEMBER(wgp_state::get_piv0_tile_info) { - common_get_piv_tile_info(machine(), tileinfo, tile_index, 0); + common_get_piv_tile_info(tileinfo, tile_index, 0); } TILE_GET_INFO_MEMBER(wgp_state::get_piv1_tile_info) { - common_get_piv_tile_info(machine(), tileinfo, tile_index, 1); + common_get_piv_tile_info(tileinfo, tile_index, 1); } TILE_GET_INFO_MEMBER(wgp_state::get_piv2_tile_info) { - common_get_piv_tile_info(machine(), tileinfo, tile_index, 2); + common_get_piv_tile_info(tileinfo, tile_index, 2); } -static void wgp_core_vh_start( running_machine &machine, int piv_xoffs, int piv_yoffs ) +void wgp_state::wgp_core_vh_start( int piv_xoffs, int piv_yoffs ) { - wgp_state *state = machine.driver_data(); + m_piv_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); + m_piv_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); + m_piv_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); - state->m_piv_tilemap[0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv0_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); - state->m_piv_tilemap[1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv1_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); - state->m_piv_tilemap[2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv2_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); + m_piv_xoffs = piv_xoffs; + m_piv_yoffs = piv_yoffs; - state->m_piv_xoffs = piv_xoffs; - state->m_piv_yoffs = piv_yoffs; - - state->m_piv_tilemap[0]->set_transparent_pen(0); - state->m_piv_tilemap[1]->set_transparent_pen(0); - state->m_piv_tilemap[2]->set_transparent_pen(0); + m_piv_tilemap[0]->set_transparent_pen(0); + m_piv_tilemap[1]->set_transparent_pen(0); + m_piv_tilemap[2]->set_transparent_pen(0); /* flipscreen n/a */ - state->m_piv_tilemap[0]->set_scrolldx(-piv_xoffs, 0); - state->m_piv_tilemap[1]->set_scrolldx(-piv_xoffs, 0); - state->m_piv_tilemap[2]->set_scrolldx(-piv_xoffs, 0); - state->m_piv_tilemap[0]->set_scrolldy(-piv_yoffs, 0); - state->m_piv_tilemap[1]->set_scrolldy(-piv_yoffs, 0); - state->m_piv_tilemap[2]->set_scrolldy(-piv_yoffs, 0); + m_piv_tilemap[0]->set_scrolldx(-piv_xoffs, 0); + m_piv_tilemap[1]->set_scrolldx(-piv_xoffs, 0); + m_piv_tilemap[2]->set_scrolldx(-piv_xoffs, 0); + m_piv_tilemap[0]->set_scrolldy(-piv_yoffs, 0); + m_piv_tilemap[1]->set_scrolldy(-piv_yoffs, 0); + m_piv_tilemap[2]->set_scrolldy(-piv_yoffs, 0); /* We don't need tilemap_set_scroll_rows, as the custom draw routine applies rowscroll manually */ - tc0100scn_set_colbanks(state->m_tc0100scn, 0x80, 0xc0, 0x40); + tc0100scn_set_colbanks(m_tc0100scn, 0x80, 0xc0, 0x40); - state->save_item(NAME(state->m_piv_ctrl_reg)); - state->save_item(NAME(state->m_rotate_ctrl)); - state->save_item(NAME(state->m_piv_zoom)); - state->save_item(NAME(state->m_piv_scrollx)); - state->save_item(NAME(state->m_piv_scrolly)); + save_item(NAME(m_piv_ctrl_reg)); + save_item(NAME(m_rotate_ctrl)); + save_item(NAME(m_piv_zoom)); + save_item(NAME(m_piv_scrollx)); + save_item(NAME(m_piv_scrolly)); } void wgp_state::video_start() { - wgp_core_vh_start(machine(), 32, 16); + wgp_core_vh_start(32, 16); } VIDEO_START_MEMBER(wgp_state,wgp2) { - wgp_core_vh_start(machine(), 32, 16); + wgp_core_vh_start(32, 16); } @@ -341,17 +338,16 @@ static const UINT8 ylookup[16] = 2, 2, 3, 3, 2, 2, 3, 3 }; -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) +void wgp_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) { - wgp_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; + UINT16 *spriteram = m_spriteram; int offs, i, j, k; int x, y, curx, cury; int zx, zy, zoomx, zoomy, priority = 0; UINT8 small_sprite, col, flipx, flipy; UINT16 code, bigsprite, map_index; // UINT16 rotate = 0; - UINT16 tile_mask = (machine.gfx[0]->elements()) - 1; + UINT16 tile_mask = (machine().gfx[0]->elements()) - 1; static const int primasks[2] = {0x0, 0xfffc}; /* fff0 => under rhs of road only */ for (offs = 0x1ff; offs >= 0; offs--) @@ -397,19 +393,19 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const /* don't know what selects 2x2 sprites: we use a nasty kludge which seems to work */ - i = state->m_spritemap[map_index + 0xa]; - j = state->m_spritemap[map_index + 0xc]; + i = m_spritemap[map_index + 0xa]; + j = m_spritemap[map_index + 0xc]; small_sprite = ((i > 0) & (i <= 8) & (j > 0) & (j <= 8)); if (small_sprite) { for (i = 0; i < 4; i++) { - code = state->m_spritemap[(map_index + (i << 1))] & tile_mask; - col = state->m_spritemap[(map_index + (i << 1) + 1)] & 0xf; + code = m_spritemap[(map_index + (i << 1))] & tile_mask; + col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf; /* not known what controls priority */ - priority = (state->m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; + priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; flipx = 0; // no flip xy? flipy = 0; @@ -423,24 +419,24 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const zx = x + (((k + 1) * zoomx) / 2) - curx; zy = y + (((j + 1) * zoomy) / 2) - cury; - pdrawgfxzoom_transpen(bitmap, cliprect,machine.gfx[0], + pdrawgfxzoom_transpen(bitmap, cliprect,machine().gfx[0], code, col, flipx, flipy, curx,cury, zx << 12, zy << 12, - machine.priority_bitmap,primasks[((priority >> 1) &1)],0); /* maybe >> 2 or 0...? */ + machine().priority_bitmap,primasks[((priority >> 1) &1)],0); /* maybe >> 2 or 0...? */ } } else { for (i = 0; i < 16; i++) { - code = state->m_spritemap[(map_index + (i << 1))] & tile_mask; - col = state->m_spritemap[(map_index + (i << 1) + 1)] & 0xf; + code = m_spritemap[(map_index + (i << 1))] & tile_mask; + col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf; /* not known what controls priority */ - priority = (state->m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; + priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; flipx = 0; // no flip xy? flipy = 0; @@ -454,13 +450,13 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const zx = x + (((k + 1) * zoomx) / 4) - curx; zy = y + (((j + 1) * zoomy) / 4) - cury; - pdrawgfxzoom_transpen(bitmap, cliprect,machine.gfx[0], + pdrawgfxzoom_transpen(bitmap, cliprect,machine().gfx[0], code, col, flipx, flipy, curx,cury, zx << 12, zy << 12, - machine.priority_bitmap,primasks[((priority >> 1) &1)],0); /* maybe >> 2 or 0...? */ + machine().priority_bitmap,primasks[((priority >> 1) &1)],0); /* maybe >> 2 or 0...? */ } } } @@ -513,11 +509,10 @@ INLINE void bryan2_drawscanline( bitmap_ind16 &bitmap, int x, int y, int length, -static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) +void wgp_state::wgp_piv_layer_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority ) { - wgp_state *state = machine.driver_data(); - bitmap_ind16 &srcbitmap = state->m_piv_tilemap[layer]->pixmap(); - bitmap_ind8 &flagsbitmap = state->m_piv_tilemap[layer]->flagsmap(); + bitmap_ind16 &srcbitmap = m_piv_tilemap[layer]->pixmap(); + bitmap_ind8 &flagsbitmap = m_piv_tilemap[layer]->flagsmap(); UINT16 *dst16,*src16; UINT8 *tsrc; @@ -549,15 +544,15 @@ static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, In WGP2 see: road at big hill (default course) */ /* This calculation may be wrong, the y_index one too */ - zoomy = 0x10000 - (((state->m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512); + zoomy = 0x10000 - (((m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512); if (!flipscreen) { - sx = ((state->m_piv_scrollx[layer]) << 16); - sx += (state->m_piv_xoffs) * zoomx; /* may be imperfect */ + sx = ((m_piv_scrollx[layer]) << 16); + sx += (m_piv_xoffs) * zoomx; /* may be imperfect */ - y_index = (state->m_piv_scrolly[layer] << 16); - y_index += (state->m_piv_yoffs + min_y) * zoomy; /* may be imperfect */ + y_index = (m_piv_scrolly[layer] << 16); + y_index += (m_piv_yoffs + min_y) * zoomy; /* may be imperfect */ } else /* piv tiles flipscreen n/a */ { @@ -577,13 +572,13 @@ static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, src_y_index = (y_index >> 16) & 0x3ff; row_index = src_y_index; - row_zoom = state->m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff; + row_zoom = m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff; - row_colbank = state->m_pivram[row_index + layer * 0x400 + 0x3400] >> 8; + row_colbank = m_pivram[row_index + layer * 0x400 + 0x3400] >> 8; a = (row_colbank & 0xe0); /* kill bit 4 */ row_colbank = (((row_colbank & 0xf) << 1) | a) << 4; - row_scroll = state->m_pivram[row_index + layer * 0x1000 + 0x4000]; + row_scroll = m_pivram[row_index + layer * 0x1000 + 0x4000]; a = (row_scroll & 0xffe0) >> 1; /* kill bit 4 */ row_scroll = ((row_scroll & 0xf) | a) & width_mask; @@ -623,7 +618,7 @@ static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, } } - bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine.priority_bitmap, priority); + bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine().priority_bitmap, priority); y_index += zoomy; if (!machine_flip) y++; else y--; @@ -694,19 +689,19 @@ UINT32 wgp_state::screen_update_wgp(screen_device &screen, bitmap_ind16 &bitmap, #ifdef MAME_DEBUG if (m_dislayer[layer[0]] == 0) #endif - wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); + wgp_piv_layer_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); #ifdef MAME_DEBUG if (m_dislayer[layer[1]] == 0) #endif - wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[1], 0, 2); + wgp_piv_layer_draw(bitmap, cliprect, layer[1], 0, 2); #ifdef MAME_DEBUG if (m_dislayer[layer[2]] == 0) #endif - wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[2], 0, 4); + wgp_piv_layer_draw(bitmap, cliprect, layer[2], 0, 4); - draw_sprites(machine(), bitmap, cliprect, 16); + draw_sprites(bitmap, cliprect, 16); /* ... then here we should apply rotation from wgp_sate_ctrl[] to the bitmap before we draw the TC0100SCN layers on it */ layer[0] = tc0100scn_bottomlayer(m_tc0100scn); diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c index d11323d49fa..2adfeb8f958 100644 --- a/src/mame/video/williams.c +++ b/src/mame/video/williams.c @@ -95,60 +95,44 @@ #include "video/resnet.h" #include "includes/williams.h" - - -/************************************* - * - * Prototypes - * - *************************************/ - -static void blitter_init(running_machine &machine, int blitter_config, const UINT8 *remap_prom); -static void create_palette_lookup(running_machine &machine); - -static int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data); - - - /************************************* * * Williams video startup * *************************************/ -static void state_save_register(running_machine &machine) +void williams_state::state_save_register() { - williams_state *state = machine.driver_data(); - state_save_register_global(machine, state->m_blitter_window_enable); - state_save_register_global(machine, state->m_cocktail); - state_save_register_global_array(machine, state->m_blitterram); - state_save_register_global(machine, state->m_blitter_remap_index); - state_save_register_global(machine, state->m_blaster_color0); - state_save_register_global(machine, state->m_blaster_video_control); - state_save_register_global(machine, state->m_tilemap_xscroll); - state_save_register_global(machine, state->m_williams2_fg_color); + state_save_register_global(machine(), m_blitter_window_enable); + state_save_register_global(machine(), m_cocktail); + state_save_register_global_array(machine(), m_blitterram); + state_save_register_global(machine(), m_blitter_remap_index); + state_save_register_global(machine(), m_blaster_color0); + state_save_register_global(machine(), m_blaster_video_control); + state_save_register_global(machine(), m_tilemap_xscroll); + state_save_register_global(machine(), m_williams2_fg_color); } VIDEO_START_MEMBER(williams_state,williams) { - blitter_init(machine(), m_blitter_config, NULL); - create_palette_lookup(machine()); - state_save_register(machine()); + blitter_init(m_blitter_config, NULL); + create_palette_lookup(); + state_save_register(); } VIDEO_START_MEMBER(williams_state,blaster) { - blitter_init(machine(), m_blitter_config, memregion("proms")->base()); - create_palette_lookup(machine()); - state_save_register(machine()); + blitter_init(m_blitter_config, memregion("proms")->base()); + create_palette_lookup(); + state_save_register(); } VIDEO_START_MEMBER(williams_state,williams2) { - blitter_init(machine(), m_blitter_config, NULL); + blitter_init(m_blitter_config, NULL); /* allocate paletteram */ m_generic_paletteram_8.allocate(0x400 * 2); @@ -157,7 +141,7 @@ VIDEO_START_MEMBER(williams_state,williams2) m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(williams_state::get_tile_info),this), TILEMAP_SCAN_COLS, 24,16, 128,16); m_bg_tilemap->set_scrolldx(2, 0); - state_save_register(machine()); + state_save_register(); } @@ -277,9 +261,8 @@ UINT32 williams_state::screen_update_williams2(screen_device &screen, bitmap_rgb * *************************************/ -static void create_palette_lookup(running_machine &machine) +void williams_state::create_palette_lookup() { - williams_state *state = machine.driver_data(); static const int resistances_rg[3] = { 1200, 560, 330 }; static const int resistances_b[2] = { 560, 330 }; double weights_r[3], weights_g[3], weights_b[2]; @@ -294,14 +277,14 @@ static void create_palette_lookup(running_machine &machine) 2, resistances_b, weights_b, 0, 0); /* build a palette lookup */ - state->m_palette_lookup = auto_alloc_array(machine, rgb_t, 256); + m_palette_lookup = auto_alloc_array(machine(), rgb_t, 256); for (i = 0; i < 256; i++) { int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2)); int g = combine_3_weights(weights_g, BIT(i,3), BIT(i,4), BIT(i,5)); int b = combine_2_weights(weights_b, BIT(i,6), BIT(i,7)); - state->m_palette_lookup[i] = MAKE_RGB(r, g, b); + m_palette_lookup[i] = MAKE_RGB(r, g, b); } } @@ -476,27 +459,26 @@ WRITE8_MEMBER(williams_state::blaster_video_control_w) * *************************************/ -static void blitter_init(running_machine &machine, int blitter_config, const UINT8 *remap_prom) +void williams_state::blitter_init(int blitter_config, const UINT8 *remap_prom) { - williams_state *state = machine.driver_data(); static const UINT8 dummy_table[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; int i,j; /* by default, there is no clipping window - this will be touched only by games that have one */ - state->m_blitter_window_enable = 0; + m_blitter_window_enable = 0; /* switch off the video config */ - state->m_blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0; + m_blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0; /* create the remap table; if no PROM, make an identity remap table */ - state->m_blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256); - state->m_blitter_remap_index = 0; - state->m_blitter_remap = state->m_blitter_remap_lookup; + m_blitter_remap_lookup = auto_alloc_array(machine(), UINT8, 256 * 256); + m_blitter_remap_index = 0; + m_blitter_remap = m_blitter_remap_lookup; for (i = 0; i < 256; i++) { const UINT8 *table = remap_prom ? (remap_prom + (i & 0x7f) * 16) : dummy_table; for (j = 0; j < 256; j++) - state->m_blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f]; + m_blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f]; } } @@ -559,11 +541,10 @@ WRITE8_MEMBER(williams_state::williams2_blit_window_enable_w) * *************************************/ -INLINE void blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid) +inline void williams_state::blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid) { - williams_state *state = space.machine().driver_data(); /* always read from video RAM regardless of the bank setting */ - int pix = (offset < 0xc000) ? state->m_videoram[offset] : space.read_byte(offset); + int pix = (offset < 0xc000) ? m_videoram[offset] : space.read_byte(offset); /* handle transparency */ if (data & 0x08) @@ -582,14 +563,13 @@ INLINE void blit_pixel(address_space &space, int offset, int srcdata, int data, /* if the window is enabled, only blit to videoram below the clipping address */ /* note that we have to allow blits to non-video RAM (e.g. tileram) because those */ /* are not blocked by the window enable */ - if (!state->m_blitter_window_enable || offset < state->m_blitter_clip_address || offset >= 0xc000) + if (!m_blitter_window_enable || offset < m_blitter_clip_address || offset >= 0xc000) space.write_byte(offset, pix); } -static int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data) +int williams_state::blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data) { - williams_state *state = space.machine().driver_data(); int source, sxadv, syadv; int dest, dxadv, dyadv; int i, j, solid; @@ -610,7 +590,7 @@ static int blitter_core(address_space &space, int sstart, int dstart, int w, int return accesses; /* set the solid pixel value to the mask value */ - solid = state->m_blitterram[1]; + solid = m_blitterram[1]; /* first case: no shifting */ if (!(data & 0x20)) @@ -624,7 +604,7 @@ static int blitter_core(address_space &space, int sstart, int dstart, int w, int /* loop over the width */ for (j = w; j > 0; j--) { - blit_pixel(space, dest, state->m_blitter_remap[space.read_byte(source)], data, keepmask, solid); + blit_pixel(space, dest, m_blitter_remap[space.read_byte(source)], data, keepmask, solid); accesses += 2; /* advance */ @@ -658,7 +638,7 @@ static int blitter_core(address_space &space, int sstart, int dstart, int w, int dest = dstart & 0xffff; /* left edge case */ - pixdata = state->m_blitter_remap[space.read_byte(source)]; + pixdata = m_blitter_remap[space.read_byte(source)]; blit_pixel(space, dest, (pixdata >> 4) & 0x0f, data, keepmask | 0xf0, solid); accesses += 2; @@ -668,7 +648,7 @@ static int blitter_core(address_space &space, int sstart, int dstart, int w, int /* loop over the width */ for (j = w - 1; j > 0; j--) { - pixdata = (pixdata << 8) | state->m_blitter_remap[space.read_byte(source)]; + pixdata = (pixdata << 8) | m_blitter_remap[space.read_byte(source)]; blit_pixel(space, dest, (pixdata >> 4) & 0xff, data, keepmask, solid); accesses += 2; diff --git a/src/mame/video/wiz.c b/src/mame/video/wiz.c index ce5627aabd9..8ca1f6354a9 100644 --- a/src/mame/video/wiz.c +++ b/src/mame/video/wiz.c @@ -92,10 +92,9 @@ WRITE8_MEMBER(wiz_state::wiz_flipy_w) m_flipy = data; } -static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype) +void wiz_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype) { - wiz_state *state = machine.driver_data(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; int offs; /* for every character in the Video RAM, check if it has been modified */ @@ -110,32 +109,31 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, cons if (colortype) { - col = (state->m_attributesram[2 * sx + 1] & 0x07); + col = (m_attributesram[2 * sx + 1] & 0x07); } else { - col = (state->m_attributesram[2 * (offs % 32) + 1] & 0x04) + (videoram[offs] & 3); + col = (m_attributesram[2 * (offs % 32) + 1] & 0x04) + (videoram[offs] & 3); } - scroll = (8*sy + 256 - state->m_attributesram[2 * sx]) % 256; - if (state->m_flipy) + scroll = (8*sy + 256 - m_attributesram[2 * sx]) % 256; + if (m_flipy) { scroll = (248 - scroll) % 256; } - if (state->m_flipx) sx = 31 - sx; + if (m_flipx) sx = 31 - sx; - drawgfx_transpen(bitmap,cliprect,machine.gfx[bank], + drawgfx_transpen(bitmap,cliprect,machine().gfx[bank], videoram[offs], - col + 8 * state->m_palette_bank, - state->m_flipx,state->m_flipy, + col + 8 * m_palette_bank, + m_flipx,m_flipy, 8*sx,scroll,0); } } -static void draw_foreground(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype) +void wiz_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype) { - wiz_state *state = machine.driver_data(); int offs; /* draw the frontmost playfield. They are characters, but draw them as sprites. */ @@ -149,37 +147,34 @@ static void draw_foreground(running_machine &machine, bitmap_ind16 &bitmap, cons if (colortype) { - col = (state->m_attributesram2[2 * sx + 1] & 0x07); + col = (m_attributesram2[2 * sx + 1] & 0x07); } else { - col = (state->m_colorram2[offs] & 0x07); + col = (m_colorram2[offs] & 0x07); } - scroll = (8*sy + 256 - state->m_attributesram2[2 * sx]) % 256; - if (state->m_flipy) + scroll = (8*sy + 256 - m_attributesram2[2 * sx]) % 256; + if (m_flipy) { scroll = (248 - scroll) % 256; } - if (state->m_flipx) sx = 31 - sx; + if (m_flipx) sx = 31 - sx; - drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_char_bank[1]], - state->m_videoram2[offs], - col + 8 * state->m_palette_bank, - state->m_flipx,state->m_flipy, + drawgfx_transpen(bitmap,cliprect,machine().gfx[m_char_bank[1]], + m_videoram2[offs], + col + 8 * m_palette_bank, + m_flipx,m_flipy, 8*sx,scroll,0); } } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, - const rectangle &cliprect, UINT8* sprite_ram, - int bank) +void wiz_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8* sprite_ram,int bank) { - wiz_state *state = machine.driver_data(); int offs; - for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4) + for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4) { int sx,sy; @@ -189,13 +184,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, if (!sx || !sy) continue; - if ( state->m_flipx) sx = 240 - sx; - if (!state->m_flipy) sy = 240 - sy; + if ( m_flipx) sx = 240 - sx; + if (!m_flipy) sy = 240 - sy; - drawgfx_transpen(bitmap,cliprect,machine.gfx[bank], + drawgfx_transpen(bitmap,cliprect,machine().gfx[bank], sprite_ram[offs + 1], - (sprite_ram[offs + 2] & 0x07) + 8 * state->m_palette_bank, - state->m_flipx,state->m_flipy, + (sprite_ram[offs + 2] & 0x07) + 8 * m_palette_bank, + m_flipx,m_flipy, sx,sy,0); } } @@ -204,10 +199,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT32 wiz_state::screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(m_bgpen, cliprect); - draw_background(machine(), bitmap, cliprect, 2 + m_char_bank[0] , 0); - draw_foreground(machine(), bitmap, cliprect, 0); - draw_sprites(machine(), bitmap, cliprect, m_spriteram2, 4); - draw_sprites(machine(), bitmap, cliprect, m_spriteram , 5); + draw_background(bitmap, cliprect, 2 + m_char_bank[0] , 0); + draw_foreground(bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect, m_spriteram2, 4); + draw_sprites(bitmap, cliprect, m_spriteram , 5); return 0; } @@ -216,8 +211,8 @@ UINT32 wiz_state::screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, int bank; bitmap.fill(m_bgpen, cliprect); - draw_background(machine(), bitmap, cliprect, 2 + ((m_char_bank[0] << 1) | m_char_bank[1]), 0); - draw_foreground(machine(), bitmap, cliprect, 0); + draw_background(bitmap, cliprect, 2 + ((m_char_bank[0] << 1) | m_char_bank[1]), 0); + draw_foreground(bitmap, cliprect, 0); const rectangle spritevisiblearea(2*8, 32*8-1, 2*8, 30*8-1); const rectangle spritevisibleareaflipx(0*8, 30*8-1, 2*8, 30*8-1); @@ -225,8 +220,8 @@ UINT32 wiz_state::screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, bank = 7 + *m_sprite_bank; - draw_sprites(machine(), bitmap, visible_area, m_spriteram2, 6); - draw_sprites(machine(), bitmap, visible_area, m_spriteram , bank); + draw_sprites(bitmap, visible_area, m_spriteram2, 6); + draw_sprites(bitmap, visible_area, m_spriteram , bank); return 0; } @@ -234,9 +229,9 @@ UINT32 wiz_state::screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, UINT32 wiz_state::screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(m_bgpen, cliprect); - draw_background(machine(), bitmap, cliprect, 2 + m_char_bank[0], 1); - draw_foreground(machine(), bitmap, cliprect, 1); - draw_sprites(machine(), bitmap, cliprect, m_spriteram2, 4); - draw_sprites(machine(), bitmap, cliprect, m_spriteram , 5); + draw_background(bitmap, cliprect, 2 + m_char_bank[0], 1); + draw_foreground(bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, m_spriteram2, 4); + draw_sprites(bitmap, cliprect, m_spriteram , 5); return 0; } diff --git a/src/mame/video/wolfpack.c b/src/mame/video/wolfpack.c index 9d6826da895..4236cdc7133 100644 --- a/src/mame/video/wolfpack.c +++ b/src/mame/video/wolfpack.c @@ -118,9 +118,8 @@ void wolfpack_state::video_start() } -static void draw_ship(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void wolfpack_state::draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect) { - wolfpack_state *state = machine.driver_data(); static const UINT32 scaler[] = { 0x00000, 0x00500, 0x00a00, 0x01000, @@ -141,36 +140,35 @@ static void draw_ship(running_machine &machine, bitmap_ind16 &bitmap, const rect 0x2c000, 0x2fa00, 0x33500, 0x37000 }; - int chop = (scaler[state->m_ship_size >> 2] * state->m_ship_h_precess) >> 16; + int chop = (scaler[m_ship_size >> 2] * m_ship_h_precess) >> 16; drawgfxzoom_transpen(bitmap, cliprect, - machine.gfx[1], - state->m_ship_pic, + machine().gfx[1], + m_ship_pic, 0, - state->m_ship_reflect, 0, - 2 * (state->m_ship_h - chop), + m_ship_reflect, 0, + 2 * (m_ship_h - chop), 128, - 2 * scaler[state->m_ship_size >> 2], scaler[state->m_ship_size >> 2], 0); + 2 * scaler[m_ship_size >> 2], scaler[m_ship_size >> 2], 0); } -static void draw_torpedo(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect) { - wolfpack_state *state = machine.driver_data(); int count = 0; int x; int y; drawgfx_transpen(bitmap, cliprect, - machine.gfx[3], - state->m_torpedo_pic, + machine().gfx[3], + m_torpedo_pic, 0, 0, 0, - 2 * (244 - state->m_torpedo_h), - 224 - state->m_torpedo_v, 0); + 2 * (244 - m_torpedo_h), + 224 - m_torpedo_v, 0); - for (y = 16; y < 224 - state->m_torpedo_v; y++) + for (y = 16; y < 224 - m_torpedo_v; y++) { int x1; int x2; @@ -178,46 +176,45 @@ static void draw_torpedo(running_machine &machine, bitmap_ind16 &bitmap, const r if (y % 16 == 1) count = (count - 1) & 7; - x1 = 248 - state->m_torpedo_h - count; - x2 = 248 - state->m_torpedo_h + count; + x1 = 248 - m_torpedo_h - count; + x2 = 248 - m_torpedo_h + count; for (x = 2 * x1; x < 2 * x2; x++) - if (state->m_LFSR[(state->m_current_index + 0x300 * y + x) % 0x8000]) + if (m_LFSR[(m_current_index + 0x300 * y + x) % 0x8000]) bitmap.pix16(y, x) = 1; } } -static void draw_pt(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect) { - wolfpack_state *state = machine.driver_data(); rectangle rect = cliprect; - if (!(state->m_pt_pic & 0x20)) + if (!(m_pt_pic & 0x20)) rect.min_x = 256; - if (!(state->m_pt_pic & 0x10)) + if (!(m_pt_pic & 0x10)) rect.max_x = 255; drawgfx_transpen(bitmap, rect, - machine.gfx[2], - state->m_pt_pic, + machine().gfx[2], + m_pt_pic, 0, 0, 0, - 2 * state->m_pt_horz, - state->m_pt_pos_select ? 0x70 : 0xA0, 0); + 2 * m_pt_horz, + m_pt_pos_select ? 0x70 : 0xA0, 0); drawgfx_transpen(bitmap, rect, - machine.gfx[2], - state->m_pt_pic, + machine().gfx[2], + m_pt_pic, 0, 0, 0, - 2 * state->m_pt_horz - 512, - state->m_pt_pos_select ? 0x70 : 0xA0, 0); + 2 * m_pt_horz - 512, + m_pt_pos_select ? 0x70 : 0xA0, 0); } -static void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect) +void wolfpack_state::draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect) { rectangle rect = cliprect; @@ -269,9 +266,9 @@ UINT32 wolfpack_state::screen_update_wolfpack(screen_device &screen, bitmap_ind1 192 + 8 * i); } - draw_pt(machine(), bitmap, cliprect); - draw_ship(machine(), bitmap, cliprect); - draw_torpedo(machine(), bitmap, cliprect); + draw_pt(bitmap, cliprect); + draw_ship(bitmap, cliprect); + draw_torpedo(bitmap, cliprect); draw_water(machine().colortable, bitmap, cliprect); return 0; } @@ -287,7 +284,7 @@ void wolfpack_state::screen_eof_wolfpack(screen_device &screen, bool state) m_helper.fill(0); - draw_ship(machine(), m_helper, m_helper.cliprect()); + draw_ship(m_helper, m_helper.cliprect()); for (y = 128; y < 224 - m_torpedo_v; y++) { diff --git a/src/mame/video/wrally.c b/src/mame/video/wrally.c index 8600b897a64..8bcf2e52f48 100644 --- a/src/mame/video/wrally.c +++ b/src/mame/video/wrally.c @@ -101,18 +101,17 @@ void wrally_state::video_start() in the range 0x8-0xf are used. */ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) +void wrally_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) { - wrally_state *state = machine.driver_data(); int i, px, py; - gfx_element *gfx = machine.gfx[0]; + gfx_element *gfx = machine().gfx[0]; for (i = 6/2; i < (0x1000 - 6)/2; i += 4) { - int sx = state->m_spriteram[i+2] & 0x03ff; - int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; - int number = state->m_spriteram[i+3] & 0x3fff; - int color = (state->m_spriteram[i+2] & 0x7c00) >> 10; - int attr = (state->m_spriteram[i] & 0xfe00) >> 9; + int sx = m_spriteram[i+2] & 0x03ff; + int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff; + int number = m_spriteram[i+3] & 0x3fff; + int color = (m_spriteram[i+2] & 0x7c00) >> 10; + int attr = (m_spriteram[i] & 0xfe00) >> 9; int xflip = attr & 0x20; int yflip = attr & 0x40; @@ -122,7 +121,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (high_priority != priority) continue; - if (state->flip_screen()) { + if (flip_screen()) { sy = sy + 248; } @@ -196,11 +195,11 @@ UINT32 wrally_state::screen_update_wrally(screen_device &screen, bitmap_ind16 &b m_pant[1]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1),0); m_pant[0]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1) | TILEMAP_DRAW_LAYER0,0); - draw_sprites(machine(),bitmap,cliprect,0); + draw_sprites(bitmap,cliprect,0); m_pant[0]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1) | TILEMAP_DRAW_LAYER1,0); - draw_sprites(machine(),bitmap,cliprect,1); + draw_sprites(bitmap,cliprect,1); return 0; } diff --git a/src/mame/video/wwfsstar.c b/src/mame/video/wwfsstar.c index 6f32b94d3e0..0023a9a3e7b 100644 --- a/src/mame/video/wwfsstar.c +++ b/src/mame/video/wwfsstar.c @@ -105,7 +105,7 @@ TILE_GET_INFO_MEMBER(wwfsstar_state::get_bg0_tile_info) sprite colour marking could probably be improved.. *******************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void wwfsstar_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { /*- SPR RAM Format -** @@ -128,9 +128,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r **- End of Comments -*/ - wwfsstar_state *state = machine.driver_data(); - gfx_element *gfx = machine.gfx[1]; - UINT16 *source = state->m_spriteram; + gfx_element *gfx = machine().gfx[1]; + UINT16 *source = m_spriteram; UINT16 *finish = source + 0x3ff/2; while (source < finish) @@ -154,7 +153,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r number &= ~(chain - 1); - if (state->flip_screen()) + if (flip_screen()) { flipy = !flipy; flipx = !flipx; @@ -164,7 +163,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r for (count=0;countflip_screen()) + if (flip_screen()) { if (!flipy) { @@ -218,7 +217,7 @@ UINT32 wwfsstar_state::screen_update_wwfsstar(screen_device &screen, bitmap_ind1 m_bg0_tilemap->set_scrollx(0, m_scrollx ); m_bg0_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect ); + draw_sprites(bitmap,cliprect ); m_fg0_tilemap->draw(bitmap, cliprect, 0,0); return 0; diff --git a/src/mame/video/wwfwfest.c b/src/mame/video/wwfwfest.c index 00015e7e22c..850bf89ebe6 100644 --- a/src/mame/video/wwfwfest.c +++ b/src/mame/video/wwfwfest.c @@ -138,9 +138,8 @@ TILE_GET_INFO_MEMBER(wwfwfest_state::get_bg1_tile_info) sprite drawing could probably be improved a bit *******************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void wwfwfest_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - wwfwfest_state *state = machine.driver_data(); /*- SPR RAM Format -** 16 bytes per sprite @@ -161,8 +160,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r **- End of Comments -*/ - UINT16 *buffered_spriteram16 = state->m_spriteram->buffer(); - gfx_element *gfx = machine.gfx[1]; + UINT16 *buffered_spriteram16 = m_spriteram->buffer(); + gfx_element *gfx = machine().gfx[1]; UINT16 *source = buffered_spriteram16; UINT16 *finish = source + 0x2000/2; @@ -175,7 +174,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (enable) { xpos = +(source[5] & 0x00ff) | (source[1] & 0x0004) << 6; if (xpos>512-16) xpos -=512; - xpos += state->m_sprite_xoff; + xpos += m_sprite_xoff; ypos = (source[0] & 0x00ff) | (source[1] & 0x0002) << 7; ypos = (256 - ypos) & 0x1ff; ypos -= 16 ; @@ -186,15 +185,15 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r number = (source[2] & 0x00ff) | (source[3] & 0x00ff) << 8; colourbank = (source[4] & 0x000f); - if (state->flip_screen()) { + if (flip_screen()) { if (flipy) flipy=0; else flipy=1; if (flipx) flipx=0; else flipx=1; - ypos=240-ypos-state->m_sprite_xoff; + ypos=240-ypos-m_sprite_xoff; xpos=304-xpos; } for (count=0;countflip_screen()) { + if (flip_screen()) { if (!flipy) { drawgfx_transpen(bitmap,cliprect,gfx,number+count,colourbank,flipx,flipy,xpos,ypos+(16*(chain-1))-(16*count),0); } else { @@ -266,13 +265,13 @@ UINT32 wwfwfest_state::screen_update_wwfwfest(screen_device &screen, bitmap_ind1 if (m_pri == 0x007b) { m_bg0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bg1_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_fg0_tilemap->draw(bitmap, cliprect, 0,0); } if (m_pri == 0x007c) { m_bg0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bg1_tilemap->draw(bitmap, cliprect, 0,0); m_fg0_tilemap->draw(bitmap, cliprect, 0,0); } @@ -280,7 +279,7 @@ UINT32 wwfwfest_state::screen_update_wwfwfest(screen_device &screen, bitmap_ind1 if (m_pri == 0x0078) { m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bg0_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_fg0_tilemap->draw(bitmap, cliprect, 0,0); } return 0; diff --git a/src/mame/video/xain.c b/src/mame/video/xain.c index 9ad27210505..30b3348f20b 100644 --- a/src/mame/video/xain.c +++ b/src/mame/video/xain.c @@ -157,13 +157,12 @@ WRITE8_MEMBER(xain_state::xain_flipscreen_w) ***************************************************************************/ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) +void xain_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { - xain_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; - for (offs = 0; offs < state->m_spriteram.bytes();offs += 4) + for (offs = 0; offs < m_spriteram.bytes();offs += 4) { int sx,sy,flipx,flipy; int attr = spriteram[offs+1]; @@ -176,7 +175,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re if (sy <= -7) sy += 256; flipx = attr & 0x40; flipy = 0; - if (state->flip_screen()) + if (flip_screen()) { sx = 238 - sx; sy = 240 - sy; @@ -186,12 +185,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re if (attr & 0x80) /* double height */ { - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], + drawgfx_transpen(bitmap,cliprect,machine().gfx[3], numtile, color, flipx,flipy, sx,flipy ? sy+16:sy-16,0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], + drawgfx_transpen(bitmap,cliprect,machine().gfx[3], numtile+1, color, flipx,flipy, @@ -199,7 +198,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re } else { - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], + drawgfx_transpen(bitmap,cliprect,machine().gfx[3], numtile, color, flipx,flipy, @@ -215,48 +214,48 @@ UINT32 xain_state::screen_update_xain(screen_device &screen, bitmap_ind16 &bitma case 0: m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bgram1_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_char_tilemap->draw(bitmap, cliprect, 0,0); break; case 1: m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bgram0_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_char_tilemap->draw(bitmap, cliprect, 0,0); break; case 2: m_char_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bgram0_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram1_tilemap->draw(bitmap, cliprect, 0,0); break; case 3: m_char_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_bgram1_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram0_tilemap->draw(bitmap, cliprect, 0,0); break; case 4: m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_char_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram1_tilemap->draw(bitmap, cliprect, 0,0); break; case 5: m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); m_char_tilemap->draw(bitmap, cliprect, 0,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram0_tilemap->draw(bitmap, cliprect, 0,0); break; case 6: m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram1_tilemap->draw(bitmap, cliprect, 0,0); m_char_tilemap->draw(bitmap, cliprect, 0,0); break; case 7: m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(machine(), bitmap,cliprect); + draw_sprites(bitmap,cliprect); m_bgram0_tilemap->draw(bitmap, cliprect, 0,0); m_char_tilemap->draw(bitmap, cliprect, 0,0); break; diff --git a/src/mame/video/xorworld.c b/src/mame/video/xorworld.c index 0b99f3cfe4a..44be21dd9d2 100644 --- a/src/mame/video/xorworld.c +++ b/src/mame/video/xorworld.c @@ -94,10 +94,9 @@ void xorworld_state::video_start() 1 | xxxx---- -------- | sprite color */ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void xorworld_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) { - xorworld_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; + UINT16 *spriteram16 = m_spriteram; int i; for (i = 0; i < 0x40; i += 2) @@ -107,13 +106,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int code = (spriteram16[i+1] & 0x0ffc) >> 2; int color = (spriteram16[i+1] & 0xf000) >> 12; - drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0, sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, 0, 0, sx, sy, 0); } } UINT32 xorworld_state::screen_update_xorworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/xxmissio.c b/src/mame/video/xxmissio.c index d5d0bd1603f..9a8c85cc50f 100644 --- a/src/mame/video/xxmissio.c +++ b/src/mame/video/xxmissio.c @@ -77,28 +77,27 @@ void xxmissio_state::video_start() } -static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx) +void xxmissio_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx) { - xxmissio_state *state = gfx->machine().driver_data(); int offs; int chr,col; int x,y,px,py,fx,fy; for (offs=0; offs<0x800; offs +=0x20) { - chr = state->m_spriteram[offs]; - col = state->m_spriteram[offs+3]; + chr = m_spriteram[offs]; + col = m_spriteram[offs+3]; - fx = ((col & 0x10) >> 4) ^ state->m_flipscreen; - fy = ((col & 0x20) >> 5) ^ state->m_flipscreen; + fx = ((col & 0x10) >> 4) ^ m_flipscreen; + fy = ((col & 0x20) >> 5) ^ m_flipscreen; - x = state->m_spriteram[offs+1]*2; - y = state->m_spriteram[offs+2]; + x = m_spriteram[offs+1]*2; + y = m_spriteram[offs+2]; chr = chr + ((col & 0x40) << 2); col = col & 0x07; - if (state->m_flipscreen==0) + if (m_flipscreen==0) { px = x-8; py = y; diff --git a/src/mame/video/yiear.c b/src/mame/video/yiear.c index 0a1e3a5a768..1a4629c177c 100644 --- a/src/mame/video/yiear.c +++ b/src/mame/video/yiear.c @@ -102,14 +102,13 @@ void yiear_state::video_start() m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(yiear_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void yiear_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - yiear_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; - UINT8 *spriteram_2 = state->m_spriteram2; + UINT8 *spriteram = m_spriteram; + UINT8 *spriteram_2 = m_spriteram2; int offs; - for (offs = state->m_spriteram.bytes() - 2; offs >= 0; offs -= 2) + for (offs = m_spriteram.bytes() - 2; offs >= 0; offs -= 2) { int attr = spriteram[offs]; int code = spriteram_2[offs + 1] + 256 * (attr & 0x01); @@ -119,7 +118,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sy = 240 - spriteram[offs + 1]; int sx = spriteram_2[offs]; - if (state->flip_screen()) + if (flip_screen()) { sy = 240 - sy; flipy = !flipy; @@ -131,7 +130,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } drawgfx_transpen(bitmap, cliprect, - machine.gfx[1], + machine().gfx[1], code, color, flipx, flipy, sx, sy, 0); @@ -141,6 +140,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 yiear_state::screen_update_yiear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/yunsun16.c b/src/mame/video/yunsun16.c index 69c76fa191f..3539c8d928e 100644 --- a/src/mame/video/yunsun16.c +++ b/src/mame/video/yunsun16.c @@ -128,16 +128,15 @@ void yunsun16_state::video_start() ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void yunsun16_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - yunsun16_state *state = machine.driver_data(); int offs; - const rectangle &visarea = machine.primary_screen->visible_area(); + const rectangle &visarea = machine().primary_screen->visible_area(); int max_x = visarea.max_x + 1; int max_y = visarea.max_y + 1; - int pri = *state->m_priorityram & 3; + int pri = *m_priorityram & 3; int pri_mask; switch (pri) @@ -154,30 +153,30 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const break; } - for (offs = (state->m_spriteram.bytes() - 8) / 2 ; offs >= 0; offs -= 8 / 2) + for (offs = (m_spriteram.bytes() - 8) / 2 ; offs >= 0; offs -= 8 / 2) { - int x = state->m_spriteram[offs + 0]; - int y = state->m_spriteram[offs + 1]; - int code = state->m_spriteram[offs + 2]; - int attr = state->m_spriteram[offs + 3]; + int x = m_spriteram[offs + 0]; + int y = m_spriteram[offs + 1]; + int code = m_spriteram[offs + 2]; + int attr = m_spriteram[offs + 3]; int flipx = attr & 0x20; int flipy = attr & 0x40; - x += state->m_sprites_scrolldx; - y += state->m_sprites_scrolldy; + x += m_sprites_scrolldx; + y += m_sprites_scrolldy; - if (state->flip_screen()) // not used? + if (flip_screen()) // not used? { flipx = !flipx; x = max_x - x - 16; flipy = !flipy; y = max_y - y - 16; } - pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], + pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1], code, attr & 0x1f, flipx, flipy, x,y, - machine.priority_bitmap, + machine().priority_bitmap, pri_mask,15); } } @@ -219,6 +218,6 @@ UINT32 yunsun16_state::screen_update_yunsun16(screen_device &screen, bitmap_ind1 m_tilemap_0->draw(bitmap, cliprect, 0, 2); } - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/zac2650.c b/src/mame/video/zac2650.c index 52c2da48ce8..f0bcc9edb51 100644 --- a/src/mame/video/zac2650.c +++ b/src/mame/video/zac2650.c @@ -48,22 +48,21 @@ READ8_MEMBER(zac2650_state::tinvader_port_0_r) /* Check for Collision between 2 sprites */ /*****************************************/ -static int SpriteCollision(running_machine &machine, int first,int second) +int zac2650_state::SpriteCollision(int first,int second) { - zac2650_state *state = machine.driver_data(); int Checksum=0; int x,y; - const rectangle &visarea = machine.primary_screen->visible_area(); + const rectangle &visarea = machine().primary_screen->visible_area(); - if((state->m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (state->m_s2636_0_ram[second * 0x10 + 10] < 0xf0)) + if((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0)) { - int fx = (state->m_s2636_0_ram[first * 0x10 + 10] * 4)-22; - int fy = (state->m_s2636_0_ram[first * 0x10 + 12] * 3)+3; + int fx = (m_s2636_0_ram[first * 0x10 + 10] * 4)-22; + int fy = (m_s2636_0_ram[first * 0x10 + 12] * 3)+3; int expand = (first==1) ? 2 : 1; /* Draw first sprite */ - drawgfx_opaque(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[expand], + drawgfx_opaque(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[expand], first * 2, 0, 0,0, @@ -71,37 +70,37 @@ static int SpriteCollision(running_machine &machine, int first,int second) /* Get fingerprint */ - for (x = fx; x < fx + machine.gfx[expand]->width(); x++) + for (x = fx; x < fx + machine().gfx[expand]->width(); x++) { - for (y = fy; y < fy + machine.gfx[expand]->height(); y++) + for (y = fy; y < fy + machine().gfx[expand]->height(); y++) { if (visarea.contains(x, y)) - Checksum += state->m_spritebitmap.pix16(y, x); + Checksum += m_spritebitmap.pix16(y, x); } } /* Blackout second sprite */ - drawgfx_transpen(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[1], + drawgfx_transpen(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[1], second * 2, 1, 0,0, - (state->m_s2636_0_ram[second * 0x10 + 10] * 4)-22,(state->m_s2636_0_ram[second * 0x10 + 12] * 3) + 3, 0); + (m_s2636_0_ram[second * 0x10 + 10] * 4)-22,(m_s2636_0_ram[second * 0x10 + 12] * 3) + 3, 0); /* Remove fingerprint */ - for (x = fx; x < fx + machine.gfx[expand]->width(); x++) + for (x = fx; x < fx + machine().gfx[expand]->width(); x++) { - for (y = fy; y < fy + machine.gfx[expand]->height(); y++) + for (y = fy; y < fy + machine().gfx[expand]->height(); y++) { if (visarea.contains(x, y)) - Checksum -= state->m_spritebitmap.pix16(y, x); + Checksum -= m_spritebitmap.pix16(y, x); } } /* Zero bitmap */ - drawgfx_opaque(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[expand], + drawgfx_opaque(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[expand], first * 2, 1, 0,0, @@ -131,11 +130,10 @@ void zac2650_state::video_start() machine().gfx[2]->set_source(m_s2636_0_ram); } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - zac2650_state *state = machine.driver_data(); int offs; - const rectangle &visarea = machine.primary_screen->visible_area(); + const rectangle &visarea = machine().primary_screen->visible_area(); /* -------------------------------------------------------------- */ /* There seems to be a strange setup with this board, in that it */ @@ -148,42 +146,42 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r /* does not seem to be a fault of the emulation! */ /* -------------------------------------------------------------- */ - state->m_CollisionBackground = 0; /* Read from 0x1e80 bit 7 */ + m_CollisionBackground = 0; /* Read from 0x1e80 bit 7 */ // for collision detection checking - copybitmap(state->m_bitmap,bitmap,0,0,0,0,visarea); + copybitmap(m_bitmap,bitmap,0,0,0,0,visarea); for(offs=0;offs<0x50;offs+=0x10) { - if((state->m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) + if((m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) { int spriteno = (offs / 8); - int expand = ((state->m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; - int bx = (state->m_s2636_0_ram[offs+10] * 4) - 22; - int by = (state->m_s2636_0_ram[offs+12] * 3) + 3; + int expand = ((m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; + int bx = (m_s2636_0_ram[offs+10] * 4) - 22; + int by = (m_s2636_0_ram[offs+12] * 3) + 3; int x,y; /* Sprite->Background collision detection */ - drawgfx_transpen(bitmap,cliprect, machine.gfx[expand], + drawgfx_transpen(bitmap,cliprect, machine().gfx[expand], spriteno, 1, 0,0, bx,by, 0); - for (x = bx; x < bx + machine.gfx[expand]->width(); x++) + for (x = bx; x < bx + machine().gfx[expand]->width(); x++) { - for (y = by; y < by + machine.gfx[expand]->height(); y++) + for (y = by; y < by + machine().gfx[expand]->height(); y++) { if (visarea.contains(x, y)) - if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x)) + if (bitmap.pix16(y, x) != m_bitmap.pix16(y, x)) { - state->m_CollisionBackground = 0x80; + m_CollisionBackground = 0x80; break; } } } - drawgfx_transpen(bitmap,cliprect, machine.gfx[expand], + drawgfx_transpen(bitmap,cliprect, machine().gfx[expand], spriteno, 0, 0,0, @@ -192,18 +190,18 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r } /* Sprite->Sprite collision detection */ - state->m_CollisionSprite = 0; -// if(SpriteCollision(machine, 0,1)) state->m_CollisionSprite |= 0x20; /* Not Used */ - if(SpriteCollision(machine, 0,2)) state->m_CollisionSprite |= 0x10; - if(SpriteCollision(machine, 0,4)) state->m_CollisionSprite |= 0x08; - if(SpriteCollision(machine, 1,2)) state->m_CollisionSprite |= 0x04; - if(SpriteCollision(machine, 1,4)) state->m_CollisionSprite |= 0x02; -// if(SpriteCollision(machine, 2,4)) state->m_CollisionSprite |= 0x01; /* Not Used */ + m_CollisionSprite = 0; +// if(SpriteCollision(0,1)) m_CollisionSprite |= 0x20; /* Not Used */ + if(SpriteCollision(0,2)) m_CollisionSprite |= 0x10; + if(SpriteCollision(0,4)) m_CollisionSprite |= 0x08; + if(SpriteCollision(1,2)) m_CollisionSprite |= 0x04; + if(SpriteCollision(1,4)) m_CollisionSprite |= 0x02; +// if(SpriteCollision(2,4)) m_CollisionSprite |= 0x01; /* Not Used */ } UINT32 zac2650_state::screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/zaccaria.c b/src/mame/video/zaccaria.c index 58153fabfc1..6ff850c8d4f 100644 --- a/src/mame/video/zaccaria.c +++ b/src/mame/video/zaccaria.c @@ -203,9 +203,8 @@ WRITE8_MEMBER(zaccaria_state::zaccaria_flip_screen_y_w) offsets 1 and 2 are swapped if accessed from spriteram2 */ -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section) +void zaccaria_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section) { - zaccaria_state *state = machine.driver_data(); int offs,o1 = 1,o2 = 2; if (section) @@ -223,18 +222,18 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re if (sx == 1) continue; - if (state->flip_screen_x()) + if (flip_screen_x()) { sx = 240 - sx; flipx = !flipx; } - if (state->flip_screen_y()) + if (flip_screen_y()) { sy = 240 - sy; flipy = !flipy; } - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], (spriteram[offs + o1] & 0x3f) + (spriteram[offs + o2] & 0xc0), ((spriteram[offs + o2] & 0x07) << 2) | color, flipx,flipy,sx,sy,0); @@ -247,9 +246,9 @@ UINT32 zaccaria_state::screen_update_zaccaria(screen_device &screen, bitmap_ind1 // 3 layers of sprites, each with their own palette and priorities // Not perfect yet, does spriteram(1) layer have a priority bit somewhere? - draw_sprites(machine(),bitmap,cliprect,m_spriteram2,2,1); - draw_sprites(machine(),bitmap,cliprect,m_spriteram,1,0); - draw_sprites(machine(),bitmap,cliprect,m_spriteram2+0x20,0,1); + draw_sprites(bitmap,cliprect,m_spriteram2,2,1); + draw_sprites(bitmap,cliprect,m_spriteram,1,0); + draw_sprites(bitmap,cliprect,m_spriteram2+0x20,0,1); return 0; } diff --git a/src/mame/video/zaxxon.c b/src/mame/video/zaxxon.c index 0a156737636..cd693fe67d5 100644 --- a/src/mame/video/zaxxon.c +++ b/src/mame/video/zaxxon.c @@ -114,45 +114,43 @@ TILE_GET_INFO_MEMBER(zaxxon_state::congo_get_fg_tile_info) * *************************************/ -static void video_start_common(running_machine &machine, tilemap_get_info_delegate fg_tile_info) +void zaxxon_state::video_start_common(tilemap_get_info_delegate fg_tile_info) { - zaxxon_state *state = machine.driver_data(); - /* reset globals */ - state->m_bg_enable = 0; - state->m_bg_color = 0; - state->m_bg_position = 0; - state->m_fg_color = 0; - state->m_congo_fg_bank = 0; - state->m_congo_color_bank = 0; - memset(state->m_congo_custom, 0, sizeof(state->m_congo_custom)); + m_bg_enable = 0; + m_bg_color = 0; + m_bg_position = 0; + m_fg_color = 0; + m_congo_fg_bank = 0; + m_congo_color_bank = 0; + memset(m_congo_custom, 0, sizeof(m_congo_custom)); /* create a background and foreground tilemap */ - state->m_bg_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(zaxxon_state::get_bg_tile_info),state), TILEMAP_SCAN_ROWS, 8,8, 32,512); - state->m_fg_tilemap = &machine.tilemap().create(fg_tile_info, TILEMAP_SCAN_ROWS, 8,8, 32,32); + m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(zaxxon_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 32,512); + m_fg_tilemap = &machine().tilemap().create(fg_tile_info, TILEMAP_SCAN_ROWS, 8,8, 32,32); /* configure the foreground tilemap */ - state->m_fg_tilemap->set_transparent_pen(0); - state->m_fg_tilemap->set_scrolldx(0, machine.primary_screen->width() - 256); - state->m_fg_tilemap->set_scrolldy(0, machine.primary_screen->height() - 256); + m_fg_tilemap->set_transparent_pen(0); + m_fg_tilemap->set_scrolldx(0, machine().primary_screen->width() - 256); + m_fg_tilemap->set_scrolldy(0, machine().primary_screen->height() - 256); /* register for save states */ - state->save_item(NAME(state->m_bg_enable)); - state->save_item(NAME(state->m_bg_color)); - state->save_item(NAME(state->m_bg_position)); - state->save_item(NAME(state->m_fg_color)); + save_item(NAME(m_bg_enable)); + save_item(NAME(m_bg_color)); + save_item(NAME(m_bg_position)); + save_item(NAME(m_fg_color)); } void zaxxon_state::video_start() { - video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::zaxxon_get_fg_tile_info),this)); + video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::zaxxon_get_fg_tile_info),this)); } VIDEO_START_MEMBER(zaxxon_state,razmataz) { - video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::razmataz_get_fg_tile_info),this)); + video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::razmataz_get_fg_tile_info),this)); } @@ -166,7 +164,7 @@ VIDEO_START_MEMBER(zaxxon_state,congo) save_item(NAME(m_congo_color_bank)); save_item(NAME(m_congo_custom)); - video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::congo_get_fg_tile_info),this)); + video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::congo_get_fg_tile_info),this)); } @@ -297,24 +295,22 @@ WRITE8_MEMBER(zaxxon_state::congo_sprite_custom_w) * *************************************/ -static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int skew) +void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int skew) { - zaxxon_state *state = machine.driver_data(); - /* only draw if enabled */ - if (state->m_bg_enable) + if (m_bg_enable) { - bitmap_ind16 &pixmap = state->m_bg_tilemap->pixmap(); - int colorbase = state->m_bg_color + (state->m_congo_color_bank << 8); + bitmap_ind16 &pixmap = m_bg_tilemap->pixmap(); + int colorbase = m_bg_color + (m_congo_color_bank << 8); int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int flipmask = state->flip_screen() ? 0xff : 0x00; - int flipoffs = state->flip_screen() ? 0x38 : 0x40; + int flipmask = flip_screen() ? 0xff : 0x00; + int flipoffs = flip_screen() ? 0x38 : 0x40; int x, y; /* the starting X value is offset by 1 pixel (normal) or 7 pixels */ /* (flipped) due to a delay in the loading */ - if (!state->flip_screen()) + if (!flip_screen()) flipoffs -= 1; else flipoffs += 7; @@ -331,7 +327,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, cons /* base of the source row comes from VF plus the scroll value */ /* this is done by the 3 4-bit adders at U56, U74, U75 */ - srcy = vf + ((state->m_bg_position << 1) ^ 0xfff) + 1; + srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; src = &pixmap.pix16(srcy & ymask); /* loop over visible columns */ @@ -359,7 +355,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, cons /* if not enabled, fill the background with black */ else - bitmap.fill(get_black_pen(machine), cliprect); + bitmap.fill(get_black_pen(machine()), cliprect); } @@ -370,7 +366,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, cons * *************************************/ -INLINE int find_minimum_y(UINT8 value, int flip) +inline int zaxxon_state::find_minimum_y(UINT8 value, int flip) { int flipmask = flip ? 0xff : 0x00; int flipconst = flip ? 0xef : 0xf1; @@ -401,7 +397,7 @@ INLINE int find_minimum_y(UINT8 value, int flip) } -INLINE int find_minimum_x(UINT8 value, int flip) +inline int zaxxon_state::find_minimum_x(UINT8 value, int flip) { int flipmask = flip ? 0xff : 0x00; int x; @@ -415,12 +411,11 @@ INLINE int find_minimum_x(UINT8 value, int flip) } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask) +void zaxxon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask) { - zaxxon_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; - gfx_element *gfx = machine.gfx[2]; - int flip = state->flip_screen(); + UINT8 *spriteram = m_spriteram; + gfx_element *gfx = machine().gfx[2]; + int flip = flip_screen(); int flipmask = flip ? 0xff : 0x00; int offs; @@ -431,7 +426,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r int flipy = (spriteram[offs + (flipymask >> 8)] ^ flipmask) & flipymask; int flipx = (spriteram[offs + (flipxmask >> 8)] ^ flipmask) & flipxmask; int code = spriteram[offs + 1]; - int color = (spriteram[offs + 2] & 0x1f) + (state->m_congo_color_bank << 5); + int color = (spriteram[offs + 2] & 0x1f) + (m_congo_color_bank << 5); int sx = find_minimum_x(spriteram[offs + 3], flip); /* draw with 256 pixel offsets to ensure we wrap properly */ @@ -452,8 +447,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r UINT32 zaxxon_state::screen_update_zaxxon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_background(machine(), bitmap, cliprect, TRUE); - draw_sprites(machine(), bitmap, cliprect, 0x140, 0x180); + draw_background(bitmap, cliprect, TRUE); + draw_sprites(bitmap, cliprect, 0x140, 0x180); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -461,8 +456,8 @@ UINT32 zaxxon_state::screen_update_zaxxon(screen_device &screen, bitmap_ind16 &b UINT32 zaxxon_state::screen_update_futspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_background(machine(), bitmap, cliprect, TRUE); - draw_sprites(machine(), bitmap, cliprect, 0x180, 0x180); + draw_background(bitmap, cliprect, TRUE); + draw_sprites(bitmap, cliprect, 0x180, 0x180); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -470,8 +465,8 @@ UINT32 zaxxon_state::screen_update_futspy(screen_device &screen, bitmap_ind16 &b UINT32 zaxxon_state::screen_update_razmataz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_background(machine(), bitmap, cliprect, FALSE); - draw_sprites(machine(), bitmap, cliprect, 0x140, 0x180); + draw_background(bitmap, cliprect, FALSE); + draw_sprites(bitmap, cliprect, 0x140, 0x180); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -479,8 +474,8 @@ UINT32 zaxxon_state::screen_update_razmataz(screen_device &screen, bitmap_ind16 UINT32 zaxxon_state::screen_update_congo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_background(machine(), bitmap, cliprect, TRUE); - draw_sprites(machine(), bitmap, cliprect, 0x280, 0x180); + draw_background(bitmap, cliprect, TRUE); + draw_sprites(bitmap, cliprect, 0x280, 0x180); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; }